Davinci, linux-03.20.00.13, Logic AM1808 EVM board. Code Sourcery Lite.
I want to send / recieve data from the SPI. spidev seems to be the way to get this to happen easily. On Spi1, I want to use chip select 1, since chip select 0 selects the flash/eeprom memory. There's several partial threads on this subject, but not quite this. Read spi-summary.txt, but even confused the situation even more.
board-da850-evm.c:
static struct spi_board_info da850_spi_board_info[] = {
[0] = {
.modalias = "m25p80",
.platform_data = &spi_flash_data,
.mode = SPI_MODE_0,
.max_speed_hz = 30000000, /* max sample rate at 3V */
.bus_num = 1,
.chip_select = 0,
},
[1] = {
.modalias = "spidev",
//#.platform_data = &spi_flash_data,
.mode = SPI_MODE_0,
.max_speed_hz = 30000000, /* max sample rate at 3V */
.bus_num = 1,
.chip_select = 1,
},
};
Also:
da850_init_spi1(BIT(0), da850_spi_board_info,
ARRAY_SIZE(da850_spi_board_info));
da850_init_spi1(BIT(1), da850_spi_board_info,
ARRAY_SIZE(da850_spi_board_info));
device-da8xx.c
static struct platform_device da850_spi1_device = {
.name = "spi_davinci",
.id = 1,
.resource = da850_spi1_resources,
.num_resources = ARRAY_SIZE(da850_spi1_resources),
.dev = {
.platform_data = &da850_spi1_pdata,
},
};
static struct platform_device da850_spi11_device = {
.name = "spidev",
.id = 32,
.resource = da850_spi1_resources,
.num_resources = ARRAY_SIZE(da850_spi1_resources),
.dev = {
.platform_data = &da850_spi11_pdata,
},
};
void __init da850_init_spi1(unsigned chipselect_mask,
struct spi_board_info *info, unsigned len)
{
spi_register_board_info(info, len);
platform_device_register(&da850_spi1_device);
platform_device_register(&da850_spi11_device);
}
recompiled the uImage and copied it up. spidev is a selected to load, not as a .ko module.
make uImage ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
make modules ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
make modules_install INSTALL_MOD_PATH=/home/wtpatrick/Work/am1808/boot_fs ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
be careful, you have to manually delete the device-da8xx.o file and the board-da850-evm.o file, because the make file doesn't seem to check.
I'm getting part way there now,
in /sys/bus/spi/drivers I see spidev and m25p80
in /sys/class I see spidev
in /sys/devices/platform I see spidev.32
I don't see anything in /dev so I typed: mknod -m 666 /dev/spi c 153 32
now I see /dev/spi. (maybe that's the source of the spidev.32 above ?)
But, when I ./echo "hello" > /dev/spi I don't see anything on any of the SPI lines.
Ideas?