[beagleboard] Re: Accessing SPI interface from user space

447 views
Skip to first unread message

T.Hoff...@gsp-berlin.de

unread,
Jan 22, 2009, 3:37:32 AM1/22/09
to beagl...@googlegroups.com
Hi Sandeep, Hi All,
 
you wrote that you have to register the "spidev" driver. I read all the documentation, but there is nothing about this topic. Can you tell me how to register "spidev" as the driver for the SPI port?
 
Best Regards
Tino
Von: beagl...@googlegroups.com [mailto:beagl...@googlegroups.com]Im Auftrag von Sandeep Nair
Gesendet: Samstag, 6. September 2008 01:53
An: beagl...@googlegroups.com
Betreff: [beagleboard] Re: Accessing SPI interface from user space

"spidev" driver provides userspace access to SPI port. You can see a sample userspace program using spidev on :
http://www.google.com/codesearch?hl=en&q=spidev.h+lang:c+show:bXp711pR3ZI:Jhc81BqH8XI:P4HqIm5CIgg&sa=N&cd=2&ct=rc&cs_p=http://www.landley.net&cs_f=kdocs/Documentation/spi/spidev_test.c

But you do need to do the pin mux configuration for getting the SPI port on the expansion connector. And you also need to register "spidev" as the driver for that SPI port.

Best Regards
Sandeep


On Fri, Sep 5, 2008 at 7:09 PM, John Beetem <johnb...@yahoo.com> wrote:

On the Ångström demo I've been able to use mmap() and /dev/mem to map
OMAP peripheral memory into my user space application.  So far I've
only accessed the GPIO registers so I could play with the user LEDs.

Code looks something like this:

   int fd = open("/dev/mem", O_RDWR); volatile ulong *A;
   if (fd < 0) {printf("Could not open file\n"); return;}
   A = (ulong*) mmap(NULL, 0x10000, PROT_READ | PROT_WRITE,
           MAP_SHARED, fd, 0x49050000);
   if (A == MAP_FAILED) {printf("Mapping failed\n"); close(fd);
return;}
   A[0x603C / 4] |= 0x600000;   // Turn on LEDs

On Sep 5, 2:03 pm, "Philip Balister" <philip.balis...@gmail.com>
wrote:
> I'd like to use one of the SPI ports on the expansion connector to
> test my FPGA skillz by sending some data to the FPGA via the expansion
> connector.
>
> Is there a user space utility that wuold let me do this. My
> understanding is I need to set a mux register so the expansion
> connector has some spi interfaces and make sure the relevant clocks
> are active. Has someone already created a utility to do this?
>
> Philip-



Cliff Brake

unread,
Jan 30, 2009, 6:06:08 PM1/30/09
to beagl...@googlegroups.com
On Thu, Jan 22, 2009 at 3:37 AM, <T.Hoff...@gsp-berlin.de> wrote:
> Hi Sandeep, Hi All,
>
> you wrote that you have to register the "spidev" driver. I read all the
> documentation, but there is nothing about this topic. Can you tell me how to
> register "spidev" as the driver for the SPI port?

Generally you need something like the following in your kernel
platform code (this is PXA, but OMAP should be similar). It is fairly
tedious to get the bus_num and chip_select right, the is the price of
flexibility.

static struct pxa2xx_spi_master pxa_ssp_master_info = {
.num_chipselect = 1,
};

static struct spi_board_info spi_board_info[] __initdata = {
{
.modalias = "spidev",
.max_speed_hz = 13000000,
.bus_num = 1,
.chip_select = 0,
},
};

pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));

Cliff

--
=======================
Cliff Brake
http://bec-systems.com

T.Hoff...@gsp-berlin.de

unread,
Feb 2, 2009, 7:35:37 AM2/2/09
to beagl...@googlegroups.com
Hi Cliff,

thank you for the hint. I found the same structure in the board-specific init file, but not with the "spidev". I will change it and than I think it will work fine.

Tino

-----Ursprüngliche Nachricht-----
Von: beagl...@googlegroups.com
[mailto:beagl...@googlegroups.com]Im Auftrag von Cliff Brake
Gesendet: Samstag, 31. Januar 2009 00:06
An: beagl...@googlegroups.com
Betreff: [beagleboard] Re: Accessing SPI interface from user space



saladino

unread,
Feb 2, 2009, 4:23:07 PM2/2/09
to Beagle Board
Hi Tino,

Please let us know how you make out. I am also interested in using SPI
from userland...

Thanks,
Saladino.

On Feb 2, 7:35 am, <T.Hoffsta...@gsp-berlin.de> wrote:
> Hi Cliff,
>
> thank you for the hint. I found the same structure in the board-specific init file, but not with the "spidev". I will change it and than I think it will work fine.
>
> Tino
>
> -----Ursprüngliche Nachricht-----
> Von: beagl...@googlegroups.com
> [mailto:beagl...@googlegroups.com]Im Auftrag von Cliff Brake
> Gesendet: Samstag, 31. Januar 2009 00:06
> An: beagl...@googlegroups.com
> Betreff: [beagleboard] Re: AccessingSPIinterface fromuserspace
>

doug....@gmail.com

unread,
Feb 4, 2009, 1:24:13 AM2/4/09
to Beagle Board


On Feb 2, 1:23 pm, saladino <s_a_l_...@tokyo.com> wrote:
> Hi Tino,
>
> Please let us know how you make out. I am also interested in using SPI
> from userland...
>

dido
Reply all
Reply to author
Forward
0 new messages