LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
 
Search this Thread
Old 02-23-2012, 05:25 AM   #1
Nixon
LQ Newbie
 
Registered: Jun 2004
Posts: 27

Rep: Reputation: 15
initialise SPIDEV from userspace beaglebone


Hello,

I am trying to find out of it is possible to pinmux and then load the spidev struct from userspace on a beaglebone. The spidev documentation states:
DEVICE CREATION, DRIVER BINDING
25===============================
26The simplest way to arrange to use this driver is to just list it in the
27spi_board_info for a device as the driver it should use: the "modalias"
28entry is "spidev", matching the name of the driver exposing this API.
29Set up the other device characteristics (bits per word, SPI clocking,
30chipselect polarity, etc) as usual, so you won't always need to override
31them later.
32
33(Sysfs also supports userspace driven binding/unbinding of drivers to
34devices. That mechanism might be supported here in the future.)

35
36When you do that, the sysfs node for the SPI device will include a child
37device node with a "dev" attribute that will be understood by udev or mdev.
38(Larger systems will have "udev". Smaller ones may configure "mdev" into
39busybox; it's less featureful, but often enough.) For a SPI device with
40chipselect C on bus B, you should see:
41
42 /dev/spidevB.C ... character special device, major number 153 with
43 a dynamically chosen minor device number. This is the node
44 that userspace programs will open, created by "udev" or "mdev".
45
46 /sys/devices/.../spiB.C ... as usual, the SPI device node will
47 be a child of its SPI master controller.
48
49 /sys/class/spidev/spidevB.C ... created when the "spidev" driver
50 binds to that device. (Directory or symlink, based on whether
51 or not you enabled the "deprecated sysfs files" Kconfig option.)
52
53Do not try to manage the /dev character device special file nodes by hand.
54That's error prone, and you'd need to pay careful attention to system
55security issues; udev/mdev should already be configured securely.
56
57If you unbind the "spidev" driver from that device, those two "spidev" nodes
58(in sysfs and in /dev) should automatically be removed (respectively by the
59kernel and by udev/mdev). You can unbind by removing the "spidev" driver
60module, which will affect all devices using this driver. You can also unbind
61by having kernel code remove the SPI device, probably by removing the driver
62for its SPI controller (so its spi_master vanishes).
63
64Since this is a standard Linux device driver -- even though it just happens
65to expose a low level API to userspace -- it can be associated with any number
66of devices at a time. Just provide one spi_board_info record for each such
67SPI device, and you'll get a /dev device node for each device.
Does this mean that support for it is not available but could be implemented?

Cheers,
Jack.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with SPI driver and spidev asmeti Linux - Software 2 11-11-2011 09:08 PM
imx51 - babbage - spidev driver problem - SCLK not generated linux_pn Linux - Software 1 02-16-2010 12:09 PM
SPIDEV implementation issues - probe not called Mintu123 Linux - Software 0 08-28-2008 11:37 AM
Array initialise Sherlock Programming 2 02-05-2007 01:42 AM
Initialise inetd redneon Slackware 1 07-28-2005 10:53 AM


All times are GMT -5. The time now is 03:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration