Dear all,
I'm a newbie on Omap 4430 with linux and I hope this is the correct place to ask. I use Duovero (OMAP 4430) with kernel 3.6 and yocto 1.4 (Dylan) from gumstix repo:
github.com/.../Gumstix-YoctoProject-Repo
I have been reading threads related to SPI but my questions is more basic and fundamental:
https://e2e.ti.com/support/embedded/linux/f/354/t/259974
http://gumstix.8.x6.nabble.com/SPI-and-multi-threading-issue-td4969428.html
gumstix.8.x6.nabble.com/SPI-problem-on-Overo-td4966514.html
gumstix.8.x6.nabble.com/McSPI-input-DMA-threshold-td4966954.html
https://e2e.ti.com/support/arm/sitara_arm/f/791/t/188833
I enable DMA and McSPI from kernel menuconfig and by default McSPI is in single-channel master mode.
My application implements bidirectional communications using spidev and SPI_IOC_MESSAGE ioctl call.
I follow similar thread on pandaboard (since it use OMAP4) on:
https://groups.google.com/forum/#!msg/pandaboard/vg1tE8HABb0/mYQmQejAA-wJ.
I modify its code for my board as follows:
On board-duovero.c (under …/arch/arm/mach-omap2/) I add the following code:
static struct omap2_mcspi_device_config spidev_mcspi_config = {
.turbo_mode = 0,
.single_channel = 1, /* 0: slave, 1: master */
};
static struct spi_board_info duovero_spi_board_info[] __initdata = {
{
.modalias = "spidev",
.bus_num = 1,
.chip_select = 0,
.max_speed_hz = 48000000,
.mode = SPI_MODE_0,
.controller_data = &spidev_mcspi_config,
},
{
.modalias = "spidev",
.bus_num = 4,
.chip_select = 0,
.max_speed_hz = 48000000,
.mode = SPI_MODE_0,
.controller_data = &spidev_mcspi_config,
},
};
static int __init duovero_spi_init(void){
spi_register_board_info(duovero_spi_board_info, ARRAY_SIZE(duovero_spi_board_info));
omap_mux_init_signal("mcspi1_clk.mcspi1_clk", OMAP_PIN_INPUT | OMAP_MUX_MODE0);
omap_mux_init_signal("mcspi1_somi.mcspi1_somi", OMAP_PIN_INPUT | OMAP_MUX_MODE0);
omap_mux_init_signal("mcspi1_simo.mcspi1_simo", OMAP_PIN_OUTPUT | OMAP_MUX_MODE0);
omap_mux_init_signal("mcspi1_cs0.mcspi1_cs0", OMAP_PIN_OUTPUT| OMAP_MUX_MODE0);
return 0;
}
On duovero_init I add duovero_spi_init(). I can see during linux boot up that McSPI and DMA are initialized.
My questions are as follows:
1. Do I initialized the spi and McSPI correctly? Does the pin mux correct for Duovero?
2. I run loop back (connect MOSI with MISO) with spidev test code on:
https://www.kernel.org/doc/Documentation/spi/spidev_test.c
and I can see it works for 2 channels.
However, I’m not sure it uses McSPI + DMA since I check the CPU utilization are more less the same with and without McSPI + DMA.
How can I make user space code to exercise McSPI + DMA correctly?
Could someone please give me some hint on code to exercise McSPI + DMA?.
I know spi-omap2-mcspi.c provides drivers for McSPI.
Any help from anyone would be appreciated.
Thank you,
Josua Purba