Hi,
I have difficulty populating /dev with spi device on i.MX23 evk board. I see device in /proc/devices as spi. All relevant modules have been hard-compiled into kernel via make config. I understand that i must to use mx23evk.c and device.c but have idea no how to do this for my own code, and how to edit them. Any help activating spi?
Thanks! (excuse my english please)
Solved! Go to Solution.
Just like everyone else does it ;-)
make menuconfig -> turn on drivers you want (usually the spi mxs driver and drivers for your peripherals).
Add this to your board file (mx23evk.c) ... but make sure to modify it to your needs, this is an example:
static struct spi_board_info spi_board_info[] __initdata = {
{
.modalias = "libertas_spi",
.platform_data = &z2_lbs_pdata,
.controller_data = &z2_lbs_chip_info,
.irq = PXA_GPIO_TO_IRQ(GPIO36_ZIPITZ2_WIFI_IRQ),
.max_speed_hz = 13000000,
.bus_num = 1,
.chip_select = 0,
},
{
.modalias = "lms283gf05",
.controller_data = &lms283_chip_info,
.platform_data = &lms283_pdata,
.max_speed_hz = 400000,
.bus_num = 2,
.chip_select = 0,
},
};
And call spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); in the platform init.
That's all. Make sure the .modalias field contains the proper name of the driver, make sure your bus number and chipselect is OK. Usually you want to grep around in arch/arm if someone else isn't already using the driver and then just copy that and adjust for your needs ;-)
Just like everyone else does it ;-)
make menuconfig -> turn on drivers you want (usually the spi mxs driver and drivers for your peripherals).
Add this to your board file (mx23evk.c) ... but make sure to modify it to your needs, this is an example:
static struct spi_board_info spi_board_info[] __initdata = {
{
.modalias = "libertas_spi",
.platform_data = &z2_lbs_pdata,
.controller_data = &z2_lbs_chip_info,
.irq = PXA_GPIO_TO_IRQ(GPIO36_ZIPITZ2_WIFI_IRQ),
.max_speed_hz = 13000000,
.bus_num = 1,
.chip_select = 0,
},
{
.modalias = "lms283gf05",
.controller_data = &lms283_chip_info,
.platform_data = &lms283_pdata,
.max_speed_hz = 400000,
.bus_num = 2,
.chip_select = 0,
},
};
And call spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); in the platform init.
That's all. Make sure the .modalias field contains the proper name of the driver, make sure your bus number and chipselect is OK. Usually you want to grep around in arch/arm if someone else isn't already using the driver and then just copy that and adjust for your needs ;-)