比如我有两个SPI设备要用到SPI0总线
1、
Platform_device
struct platform_device s3c_device_spi0 = {
.name
= "s3c2410-spi",
.id
= 0,
.num_resources
= ARRAY_SIZE(s3c_spi0_resource),
.resource
= s3c_spi0_resource,
.dev
= {
.dma_mask = &s3c_device_spi0_dmamask,
.coherent_dma_mask = 0xffffffffUL
}
};
2、
Platform_driver
static struct platform_driver s3c24xx_spi_driver = {
.remove
= __exit_p(s3c24xx_spi_remove),
.driver
= {
.name
= "s3c2410-spi",
.owner
= THIS_MODULE,
.pm
= S3C24XX_SPI_PMOPS,
},
};
3、
spi_device
static struct spi_board_info s3c2410_spi0_board[] = {
[0] =
{
.modalias
= " spitest1",
.bus_num
= 0,
.chip_select
= 0,
.irq
= IRQ_EINT9,
.max_speed_hz
= 500*1000,
},
[1] =
{
.modalias
= "spitest2",
.bus_num
= 0,
.chip_select
= 0,
.irq
= IRQ_EINT9,
.max_speed_hz
= 500*1000,
},
};
4、
两个spi_driver
(1)static struct spi_driver tle62x0_driver = {
.driver = {
.name
= "spitest1",
.owner
= THIS_MODULE,
},
.probe
= tle62x0_probe,
.remove
= __devexit_p(tle62x0_remove),
};
(2)static struct spi_driver tle62x0_driver = {
.driver = {
.name
= "spitest2",
.owner
= THIS_MODULE,
},
.probe
= tle62x0_probe,
.remove
= __devexit_p(tle62x0_remove),
};
5、
问题:始终只有名叫“spitest1”的spi_driver才能probe成功,“spitest1”正是spi_device
6、
static struct spi_board_info s3c2410_spi0_board[]中的第一组元素,意味着spi_device
static struct spi_board_info s3c2410_spi0_board[]第二个以上的元素无法匹配,这是为何?
该如何才能匹配?
请大拿指点!衷心谢谢! |