Search code examples
linuxdriverbinddevicespi

SPI rtc-ds1305 doesn't show /dev/rtc and doesn't bind to my spi2.1


I need some help to find out why my rtc-ds1306 driver doesn't bind to the spi2.1 devices

I'm working on embedded linux (3.2.0) platform that I would like to use the spi to communicated with an RTC DS1306 and other spi devices. The platform come default with spi1.0 talk to a nor flash and I'm able to add and communicated with the spidev driver to the /dev/spi1.1 and /dev/spi2.0. The rtc-ds1305 driver is available under /sys/bus/spi/drivers/ (rtc-ds1306) but it's doesn't bind to any spi (ex:spi2.1). Spi1.1 and spi2.0 bind automatically. I don't see any error message at boot...

Can you tell me what is missing?

//---board-xxxx.c files----

static const struct flash_platform_data am335x_spi_flash = {
    .type      = "w25q64",
    .name      = "spi_flash",
};


/*
 * SPI Flash works at 80Mhz however SPI Controller works at 48MHz.
 * So setup Max speed to be less than that of Controller speed
 */
static struct spi_board_info am335x_spi0_slave_info[] = {
    {
        .modalias      = "m25p80",
        .platform_data = &am335x_spi_flash,
        .irq           = -1,
        .max_speed_hz  = 24000000,
        .bus_num       = 1,
        .chip_select   = 0,
    },
//PH140107 add spidev driver for the spi0_cs1
    {
        .modalias       = "spidev",
        .max_speed_hz   = 12000000,
        .bus_num        = 1,
        .chip_select    = 1,
        .mode       = SPI_MODE_0,
    },

};

//PH140110 add this platform_data
static const struct ds1305_platform_data am335x_spi_rtc = {
    .is_ds1306 = true,
    .en_1hz    = false,
};
/* PH140109
 * SPI RTC DS1306 (use RTC-ds1305 driver) and add SPI1_CS0 incase need it for spi1_dsp
 * So setup Max speed to be less than that of Controller speed
 */
static struct spi_board_info am335x_spi1_slave_info[] = {
    {
        .modalias       = "rtc-ds1305",
        .platform_data  = &am335x_spi_rtc,
        .max_speed_hz   = 1000000,
        .bus_num        = 2,
        .chip_select    = 1,
        .mode       = SPI_CS_HIGH | SPI_CPOL | SPI_CPHA,
    },

    {
        .modalias       = "spidev",
        .max_speed_hz   = 48000000,
        .bus_num        = 2,
        .chip_select    = 0,
        .mode       = SPI_MODE_0,
    },

};

edit: I can't find the rtc in the /dev/rtcX but in the /sys/bus/spi/devices I can see spi1.0,spi1.1,spi2.0 and spi2.1. Additionnaly in the /sys/bus/spi/drivers I can find m25p80, rtc-ds1305 and spidev. If I go in /sys/bus/spi/drivers/spidev I can see spi1.1 and spi2.0 (+ bind,uevent and unbind) but if I go to /sys/bus/spi/drivers/rtc-ds1305 there just bind,uevent and unbind.

I think I should see /dev/rtc0 and in /sys/bus/spi/drivers/rtc-ds1305 I should see spi2.1


Solution

  • I was working on a development board so the ds1306 wasn't populated so can't answering to the rtc-ds1305 driver sanity check. When connected to the real-board it appear under /dev/rtc0.

    Problem solve!