EmbeddedRelated.com
Forums

AT91SAM9261EK Linux userspace SPI

Started by Dan Lyke March 19, 2009
This should be easy (I think). I've turned on "Device Drivers--->SPI
Support--->User mode SPI device driver support" in my kernel config
(built in, not a module). In
linux-2.6.28/arch/arm/mach-at91/board-sam9261ek.c, I added the
following to the "spi_board_info ek_spi_devices" array:

{ /* comm to my sub device */
.modalias = "spidev",
.chip_select = 1,
.max_speed_hz = 10 * 1000 * 1000,
.bus_num = 0,
},

Which, I believe, should give me a userspace /dev/spisomething
half-duplex interface to SPI0 CS1.

I'm not seeing my device show up.

Anyone got a suggestion?

Dan
Hi Dan,

AFAIK for char devices you need to use 'mkdev' to create the device - it
won't populate the /dev/ tree by itself.
If still problems, I'd consider compiling it as a module - then you can see
what's going on much easier with modprobe & family..
I'm not sure if you can use the alias for the mkdev process though. (?)

HTH
Best regards,
Kris

On Thu, 19 Mar 2009 15:36:51 -0700, Dan Lyke wrote:
> This should be easy (I think). I've turned on "Device Drivers--->SPI
> Support--->User mode SPI device driver support" in my kernel config
> (built in, not a module). In
> linux-2.6.28/arch/arm/mach-at91/board-sam9261ek.c, I added the
> following to the "spi_board_info ek_spi_devices" array:
>
> { /* comm to my sub device */
> .modalias = "spidev",
> .chip_select = 1,
> .max_speed_hz = 10 * 1000 * 1000,
> .bus_num = 0,
> },
>
> Which, I believe, should give me a userspace /dev/spisomething
> half-duplex interface to SPI0 CS1.
>
> I'm not seeing my device show up.
>
> Anyone got a suggestion?
>
> Dan
>
On Thu, 19 Mar 2009 15:36:51 -0700
Dan Lyke wrote:
> This should be easy (I think). I've turned on "Device Drivers--->SPI
> Support--->User mode SPI device driver support" in my kernel config
> (built in, not a module).

Uh. Hang on, I'm having some programming issues, apparently. Still
happy to have insight, but this one's cause my new kernel isn't getting
into the data flash.

Dan
On Fri, 20 Mar 2009 11:31:34 +1100
m...@virginbroadband.com.au wrote:
> AFAIK for char devices you need to use 'mkdev' to create the device -
> it won't populate the /dev/ tree by itself.

Just for closure on this:

1. I'm not sure if this is the default, but in all my futzing about I
added a
.controller_data = (void *) AT91_PIN_PA4,

line to my spi_board_info ek_spi_devices definition.

2. indeed, load the module, "mdev -s", device appears.

Thanks!