Configure your kernel like this: (2.6.35)
--- SPI support │ │
│ │ *** SPI Master Controller Drivers *** │ │
│ │ < > Utilities for Bitbanging SPI masters │ │
│ │ < > GPIO-based bitbanging SPI Master │ │
│ │ < > Xilinx SPI controller common module │ │
│ │ <*> Freescale MXS SPI/SSP controller │ │
│ │ < > DesignWare SPI controller core support │ │
│ │ *** SPI Protocol Masters *** │ │
│ │ <*> User mode SPI device driver support │ │
│ │ < > Infineon TLE62X0 (for power switching)
Even doing so you will get that no device is showing up in /dev
This is because originally the modalias is equal to m25p80 since it is intended to be used with a serial eeprom in the original design, changing to spidev is NOT automatic:
Code changes in red.
in /arch/arm/mach-mx28/mx28evk.c
static struct spi_board_info spi_board_info[] __initdata = {
#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
{
/* the modalias must be the same as spi device driver name */
.modalias = "spidev", /* Name of spi_driver for this device */
.max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
.bus_num = 1, /* Framework bus number */
.chip_select = 0, /* Framework chip select. */
.platform_data = &mx28_spi_flash_data,
},
#endif
};
Also remember that spidev comes with a sample application in Documentation/spi/spidev_test.c
If you bult it it won't work either, the issue is that our MX28 has only one DMA channel attached and it can read or write only on the spi not do both at the same time, this means that in the sample application the RX or the TX arrays addresses needs to be 0 otherwise the driver will state it cannot work in bidirectional mode and abort the transfer.
This with our 2.6.35_11_09 bsp, spidev enabled in the kernel config and the modalias to spidev and not to the eeprom.
And the test application modified like this:
struct spi_ioc_transfer tr = {
.tx_buf = (unsigned long)tx,
//.rx_buf = (unsigned long)rx,
.rx_buf = (unsigned long)0,
.len = ARRAY_SIZE(tx),
.delay_usecs = delay,
.speed_hz = speed,
.bits_per_word = bits,
};
Remember also to change the default spi device like this:
static const char *device = "/dev/spidev1.0";
Otrhewise you will need to use -D option.
Massimo