I was searching through the web and especially this group if someone
shares my pain. I noticed there are a lot of people failing to use
SPI3 & SPI4 on the expansion connector and so am I.
I'm trying to write some SPI device drivers for rowboat (Linux Kernel
2.6.32). So I enabled the SPI subsystem in the kernel and followed the
PinMux-Guide in[1], hoping to enable the SPI.
What I got was 3 devices (spidev3.0, spidev3.1 and spidev4.0) in /dev,
so far so good. I set up an oscilloscope monitoring the clock signal
of SPI3 and SPI4. As I tried to write something to one of the devices,
issuing
$ echo test > /dev/spidev3.0
on the commandline, I expected to see the clock on the osc, but
nothing came. Same on spidev4.0.
Searching for people having the same problems, I found a discussion
with a very similar problem[2] what lead me to my first question:
- Is it nescessary to setup the PinMux in u-boot AND the kernel?
As far as I understood, the kernel simply overwrites the PinMux set by
u-boot so I can modify the board-file to set the PinMux for my needs,
right?
My modifications in the pinmux are as follows:
I created two methods, which are called right after the expansionboard
evaluation in "omap3_beagle_init":
static void __init omap3_beagle_config_mcspi3_mux(void)
{
// NOTE: Clock pins need to be in input mode
omap_mux_init_signal("sdmmc2_clk.mcspi3_clk", OMAP_PIN_INPUT);
omap_mux_init_signal("sdmmc2_dat3.mcspi3_cs0", OMAP_PIN_OUTPUT);
omap_mux_init_signal("sdmmc2_dat2.mcspi3_cs1", OMAP_PIN_OUTPUT);
omap_mux_init_signal("sdmmc2_cmd.mcspi3_simo", OMAP_PIN_OUTPUT);
omap_mux_init_signal("sdmmc2_dat0.mcspi3_somi", OMAP_PIN_INPUT_PULLUP);
}
static void __init omap3_beagle_config_mcspi4_mux(void)
{
// NOTE: Clock pins need to be in input mode
omap_mux_init_signal("mcbsp1_clkr.mcspi4_clk", OMAP_PIN_INPUT);
omap_mux_init_signal("mcbsp1_fsx.mcspi4_cs0", OMAP_PIN_OUTPUT);
omap_mux_init_signal("mcbsp1_dx.mcspi4_simo", OMAP_PIN_OUTPUT);
omap_mux_init_signal("mcbsp1_dr.mcspi4_somi", OMAP_PIN_INPUT_PULLUP);
}
Both methods are executed and both of them set the pinmux register to
the expected value. To make sure of this, I patched the
"omap_mux_write" method in "mux.c" to output every modification.
For testing purposes I also expanded the "board_mux" table with
following lines:
/* SPI3 */
OMAP3_MUX(SDMMC2_CLK, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), /* SCK */
OMAP3_MUX(SDMMC2_DAT0, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), /* SOMI */
OMAP3_MUX(SDMMC2_CMD, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT), /* SIMO */
OMAP3_MUX(SDMMC2_DAT3, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT), /* CS0 */
OMAP3_MUX(SDMMC2_DAT2, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT), /* CS1 */
/* McSPI 4 */
OMAP3_MUX(MCBSP1_CLKR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
OMAP3_MUX(MCBSP1_DX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
OMAP3_MUX(MCBSP1_DR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
OMAP3_MUX(MCBSP1_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP),
As far as I understand the code, this does the very same as the
methods above do. At least the output of my "hack" in "omap_mux_write"
shows the very same output for both initializations. So here is my
second question: One of these two ways is enough isn't it?
Does anyone of you guys have some pointers for me how to trace down my
problem?
Thank you in advance for your Help
Ueli
[1] http://elinux.org/BeagleBoard/SPI
[2]
http://groups.google.com/group/beagleboard/browse_thread/thread/476ef1a2be830c81/f4e5ef94038ec5dc