I, too have battled with this dilemma while trying to port ILI9340C display stuff to Beaglebone Black. The way /dev/devices/bone_capemgr.*
works is that anything which you echo to its slots
directory it goes and searches for a Device Tree overlay for that device, a new thing in Linux Kernel 3.0 and higher. For anyone who does not know (it took me forever to find this) Device Trees are basically a driver that tells Linux how to deal with a device, but instead of containing any code, they are simply a configuration file, per-se, that tells Linux what to put where in order to talk to a device, and what to expect in return. That being said, BB-SPIx-01
is a compiled Device Tree file, a .dts in /lib/firmware/
which points to the SPI device, and tells spidev
what to do with it.
BB-SPI1-01
happens to be connected to the HDMI port already for some audio thing (I think) and, therefore, unless you disable HDMI entirely, SPI1
is always tied up by the HDMI framer. This explains why writing BB-SPI1-01
to /sys/devices/bone_capemgr.*/slots
fails. This is a special file, and when you write to it, a kernel process reads your input and proceeds to attempt to make a 'device' file elsewhere, and since BB-SPI1-01
is already enabled, that file already exists, and so the kernel process that handles those things returns an error and pipes it through whatever process initiated it, in this case, you, the user, typing echo BB-SPI1-01 > /sys/devices/bone_capemgr.*/slots
.
On the bright side, SPI0
is left unused. Therefore, in order to use it, all you have to do is enable it in userland. To do that, (and you have figured this out already, but for everyone else) type echo BB-SPI0-01 > /sys/devices/bone_capemgr.*/slots
at the command line, and then just to be sure that spidev is running, type modprobe spidev
as root. Now, to verify, type ls /dev | grep spi
and see what comes up. /dev/spidevX.Y
is your SPI bus, for me that would be /dev/spidev1.0
.
I'm sorry that was really long winded, but I'm culminating my research thus far into one spot in the hopes that it will help someone.
If you have any questions, please feel free to ask!