We are using TI AM335x starter kit for our development activity and trying to “enable” the spidev0.0 driver in linux-3.2.0-psp04.06.00.11 source .So, please give me the steps of information to enable the spidev0.0 driver along with the kernel image.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
We are using TI AM335x starter kit for our development activity and trying to “enable” the spidev0.0 driver in linux-3.2.0-psp04.06.00.11 source .So, please give me the steps of information to enable the spidev0.0 driver along with the kernel image.
Hello JVS Electronics Pvt Ltd-India,
You already have the answer in the first post but I will show you how to enable and check proper work of the spidev in the shortest way.
If the SPI device is attached to the J11 connector It will appear as /dev/spidev1.0.
1. Run your favourite kernel configuration tool and enable SPI support for the user space.
Device Drivers ---> SPI support ---> User mode SPI device driver support
2. Modify arch/arm/mach-omap2/board-am335xevm.c
static struct spi_board_info am335x_spi0_slave_info[] = { { .modalias = "m25p80", .platform_data = &am335x_spi_flash, .irq = -1, .max_speed_hz = 24000000, .bus_num = 1, .chip_select = 0, }, };
to
static struct spi_board_info am335x_spi0_slave_info[] = { { .modalias = "spidev", .max_speed_hz = 48000000, //48 Mbps .bus_num = 1, .chip_select = 0, .mode = SPI_MODE_1, }, };
/* EVM - Starter Kit */ static struct evm_dev_cfg evm_sk_dev_cfg[] = { {am335x_rtc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {mmc1_wl12xx_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {mmc0_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {rgmii1_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {rgmii2_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {lcdc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {enable_ecap2, DEV_ON_BASEBOARD, PROFILE_ALL}, {mfd_tscadc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {gpio_keys_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {gpio_led_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {lis331dlh_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {mcasp1_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {uart1_wl12xx_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {wl12xx_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {gpio_ddr_vtt_enb_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {sgx_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {NULL, 0, 0}, };
to
/* EVM - Starter Kit */ static struct evm_dev_cfg evm_sk_dev_cfg[] = { {am335x_rtc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {mmc1_wl12xx_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {mmc0_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {rgmii1_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {rgmii2_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {lcdc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {enable_ecap2, DEV_ON_BASEBOARD, PROFILE_ALL}, {mfd_tscadc_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {gpio_keys_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {gpio_led_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {lis331dlh_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {mcasp1_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {uart1_wl12xx_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {wl12xx_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {gpio_ddr_vtt_enb_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {sgx_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {spi0_init, DEV_ON_BASEBOARD, PROFILE_ALL}, {NULL, 0, 0}, };
Cross-Compile the spidev_test.c which is located in your kernel source Documentation/spi directory.
arm-linux-gnueabihf-gcc -o spidev_test spidev_test.c
Put a wire between MOSI and MISO (J11's pins 3 and 6) and run the compiled spidev_test.
./spidev_test -D /dev/spidev1.0
If all went well the feedback from the execution will be:
FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF DE AD BE EF BA AD F0 0D
Best regards,
Kemal