I have been struggling to get SPI working correctly. So far I have modified the board file so SPI 1.0 is the touchscreen controller, and SPI 1.1 is my device, using the spidev driver. I assume it’s ok to use separate drivers on the same bus.
static struct spi_board_info overo_spi_board_info[] __initdata = {
// SPI 1.0
// (CONFIG_TOUCHSCREEN_ADS7846) || (CONFIG_TOUCHSCREEN_ADS7846_MODULE)
{
.modalias = “ads7846”,
.bus_num = 1,
.chip_select = 0,
.max_speed_hz = 100000, //100 kHz (125 kHz = max)
.controller_data = &ads7846_mcspi_config,
.irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN),
.platform_data = &ads7846_config,
},
// SPI 1.1
// CONFIG_FPA_DRIVER
{
.modalias = “spidev”,
.max_speed_hz = 6000000, //6 MHz ( 48 MHz = max(OMAP3350) ) || ( 66 MHz = max (AT32UC3A1512) )
.bus_num = 1,
.chip_select = 1,
.mode = SPI_MODE_1,
},
};
static int __init overo_spi_init(void)
{
overo_ads7846_init();
spi_register_board_info(overo_spi_board_info,
ARRAY_SIZE(overo_spi_board_info));
return 0;
}
I have also done the pinmux in the board file as follows:
static struct omap_board_mux board_mux[] __initdata = {
OMAP3_MUX(MCSPI1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
OMAP3_MUX(MCSPI1_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
OMAP3_MUX(MCSPI1_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
OMAP3_MUX(MCSPI1_CS0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
{ .reg_offset = OMAP_MUX_TERMINATOR },
};
The kernel builds and “/dev/spidev1.1” comes up after boot. I’m using android so had to give my application root permission by using chmod via adb. I can successfully open my device. Write (half duplex) and ioctl (full duplex) calls come back without errors.
The problem is nothing is happening with SPI 1.1. The touchscreen works just fine, but the chip select (CS0) stays active low. CS0 needs to go high and CS1 needs to go low, and then communicate with my device over the bus. None of this is happening.
Anyone see something I may have missed?