SPI rtc-ds1305没有显示/ dev / rtc,也没有绑定到我的spi2.1

时间:2014-01-10 22:20:17

标签: linux driver bind device spi

我需要一些帮助来找出我的rtc-ds1306驱动程序没有绑定到spi2.1设备的原因

我正在开发嵌入式Linux(3.2.0)平台,我想使用spi与RTC DS1306和其他spi设备进行通信。该平台默认使用spi1.0与一个flash进行通信,我可以添加spidev驱动程序并与/dev/spi1.1和/dev/spi2.0进行通信。 rtc-ds1305驱动程序在/ sys / bus / spi / drivers /(rtc-ds1306)下可用,但它不绑定到任何spi(例如:spi2.1)。 Spi1.1和spi2.0自动绑定。我没有在启动时看到任何错误消息...

你能告诉我缺少什么吗?

// --- 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,
    },

};

编辑:我在/ dev / rtcX中找不到rtc,但在/ sys / bus / spi / devices中我可以看到spi1.0,spi1.1,spi2.0和spi2.1。另外在/ sys / bus / spi / drivers中我可以找到m25p80,rtc-ds1305和spidev。如果我进入/ sys / bus / spi / drivers / spidev我可以看到spi1.1和spi2.0(+ bind,uevent和unbind)但是如果我去/ sys / bus / spi / drivers / rtc-ds1305那里只是绑定,uevent和unbind。

我想我应该看/ dev / rtc0和/ sys / bus / spi / drivers / rtc-ds1305我应该看到spi2.1

1 个答案:

答案 0 :(得分:0)

我正在使用开发板,因此ds1306没有填充,因此无法回答rtc-ds1305驱动程序的健全性检查。当连接到真实板时,它出现在/ dev / rtc0。

问题解决!