How to enable SPI devices on 3.14 kernel?

Hi All,

I am trying to enable both SPI devices in the 3.14 kernel for a beaglebone black. I understand that the capemgr support is no longer there. I need some tips on how to enable these devices in the kernel. I don’t care if it is done statically at kernel build time. My application has no need to runtime enabling/disabling as is possible with capemgr and device tree overlays.

I see device tree source for spi0 but not spi1 in the 3.14 kernel source.

./arch/arm/boot/dts/am335x-bone-spi0-spidev.dtsi

Looks like SPI support is half-baked. I am pulling my source from here:

https://github.com/beagleboard/linux.git

Am I going down the wrong path with 3.14? Building from the 3.8 branch in this repo has compilation errors.

Thanks,

Dallas

Well, looks we have a volunteer.. Apply this on top of the latest 3.14
branch (i force pushed out an update about an hour ago)

Just enable either spi1/spi1a via:

#include "am335x-bone-spi1-spidev.dtsi"
(or)
#include "am335x-bone-spi1a-spidev.dtsi"

Regards,

0001-testing-add-spi1-spi1a.patch (4.26 KB)

btw:

crap, forgot to update the spidev node names: if you have spi0-spidev
or the bottom am335x-bone-basic-proto-cape.dtsi enabled, you'll get
this error:

ERROR (duplicate_label): Duplicate label 'spidev0' on
/ocp/spi@481a0000/spi@0 and /ocp/spi@48030000/spi@0
ERROR (duplicate_label): Duplicate label 'spidev1' on
/ocp/spi@481a0000/spi@1 and /ocp/spi@48030000/spi@1
ERROR: Input tree has errors, aborting (use -f to force output)
Makefile:121: recipe for target 'src/arm/am335x-boneblack.dtb' failed
make[1]: *** [src/arm/am335x-boneblack.dtb] Error 2

This fixes that..

diff --git a/arch/arm/boot/dts/am335x-bone-spi1-spidev.dtsi
b/arch/arm/boot/dts/am335x-bone-spi1-spidev.dtsi
index 24013d8a6b..5bc03e8 100644
--- a/arch/arm/boot/dts/am335x-bone-spi1-spidev.dtsi
+++ b/arch/arm/boot/dts/am335x-bone-spi1-spidev.dtsi
@@ -11,14 +11,14 @@
        pinctrl-0 = <&spi1_pins>;
        status = "okay";

- spidev0: spi@0 {
+ spidev2: spi@0 {
                compatible = "spidev";
                reg = <0>;
                spi-max-frequency = <16000000>;
                spi-cpha;
        };

- spidev1: spi@1 {
+ spidev3: spi@1 {
                compatible = "spidev";
                reg = <1>;
                spi-max-frequency = <16000000>;
diff --git a/arch/arm/boot/dts/am335x-bone-spi1a-spidev.dtsi
b/arch/arm/boot/dts/am335x-bone-spi1a-spidev.dtsi
index b2185dd..3aded7b 100644
--- a/arch/arm/boot/dts/am335x-bone-spi1a-spidev.dtsi
+++ b/arch/arm/boot/dts/am335x-bone-spi1a-spidev.dtsi
@@ -11,14 +11,14 @@
        pinctrl-0 = <&spi1a_pins>;
        status = "okay";

- spidev0: spi@0 {
+ spidev2: spi@0 {
                compatible = "spidev";
                reg = <0>;
                spi-max-frequency = <16000000>;
                spi-cpha;
        };

- spidev1: spi@1 {
+ spidev3: spi@1 {
                compatible = "spidev";
                reg = <1>;
                spi-max-frequency = <16000000>;

you know.. half baked.. :wink: Just got all the lcd's working today, spi1
hasn't been a priorty as i don't have a cape that uses it...

Regards,

Hi Robert, many thanks for this. How dost one actually enable the spi devices in 3.14? I’m used to working with the overlays and capemgr, i.e. echoing to capemgr slots etc.

Well it's still in it's infancy.

Here's what works today:
http://elinux.org/Beagleboard:Capes_3.8_to_3.14

Take a look at the main am335x-boneblack.dts file:

https://github.com/beagleboard/linux/blob/3.14.17-ti-r15/arch/arm/boot/dts/am335x-boneblack.dts#L31

If you need usart1:

Just change:

/* #include "am335x-bone-ttyO1.dtsi" */

to:
#include "am335x-bone-ttyO1.dtsi"

and rebuild.

I'm working on a second repo, so that you don't have to rebuild the
kernel, just for dts changes:

https://github.com/RobertCNelson/dtb-rebuilder/tree/3.14-ti

Just issue "make all" and all *.dtb's will be rebuilt (these match the
full kernel tree (3.14.17-ti-r15)) above.

Haven't finished the "make install" so you still have to manually copy
the *.dtb's.

So, just make the *.dts change, rebuild, copy *.dtb, reboot, new
device enabled..

Regards,

Okay just added the "make install"

Follow:
http://elinux.org/Beagleboard:Capes_3.8_to_3.14#Custom_dtb

edit ./src/arm/am335x-boneblack.dts

To rebuild/install:

make
sudo make install

Then, reboot..

Regards,

Wow! Thanks for the quick response. Will give it a shot.

Hi Robert, everything builds clean and I can see SPI0 after booting. The devices are spi1.0 and spi1.1. However, I’m not able to see any SPI1 devices. Suspecting HDMI conflict, I set the status for the HDMI device to “disabled” in
am335x-base0033.dts. But that didn’t seem to help. Anything else you can think of that I should check?

Thanks,
Dallas

Okay, i should probally remove all non "bb.org" boards.. am335x-base0033.dts

am335x-base0033.dts - Device Tree file for IGEP AQUILA EXPANSION

The only two you should touch:

am335x-bone.dts (BeagleBone White)
am335x-boneblack.dts (BeagleBone Black)

If you want to pastebin.com your current *.dts I'll look at it..

Regards,

btw, i added some more notes to:

http://elinux.org/Beagleboard:Capes_3.8_to_3.14#Custom_dtb

This feedback always helps us tune the wiki for the next new user..

Regards,

I just pasted my am335x-boneblack.dts to http://pastebin.com/PwccRatb

Here you go:

http://pastebin.com/rSg1h46h

(just disabled the last line, proto-cape, as it'll inerfear)

Regards,

You’re my hero! :slight_smile: Working like a champ now! Thanks a million.

Hello Robert,

I’ve just tried to duplicate your instructions here to get both spidev 0 and 1 using your dts from the pastebin link above and I am only getting /dev/spidev1.0 and /dev/spidev1.1 – no spidev0.N or spidev2.N

uname -a:

Linux SQR-3 3.14.17-ti-r16 #1 SMP Thu Aug 28 23:18:48 UTC 2014 armv7l GNU/Linux

I just updated from 3.8 using your latest install-me.sh from rcn-ee.org

and did:

git clone -b 3.14-ti https://github.com/RobertCNelson/dtb-rebuilder.git

make and make install did not complain but no joy.

/dev/spidev1.[0/1] is enabled by:

https://github.com/RobertCNelson/dtb-rebuilder/blob/3.14-ti/src/arm/am335x-boneblack.dts#L102

as that enables:
#include "am335x-bone-spi0-spidev.dtsi"

For /dev/spidev2.[0/1] you have two choices:

Uncomment:
https://github.com/RobertCNelson/dtb-rebuilder/blob/3.14-ti/src/arm/am335x-boneblack.dts#L43

or
https://github.com/RobertCNelson/dtb-rebuilder/blob/3.14-ti/src/arm/am335x-boneblack.dts#L50

then make/sudo make install/sudo reboot

Regards,

2nd thought, the uart conflicts..
so disable:

#include "am335x-bone-basic-proto-cape.dtsi"
->
/* #include "am335x-bone-basic-proto-cape.dtsi" */

Then add spi0:
#include "am335x-bone-spi0-spidev.dtsi"

Then spi1:
#include "am335x-bone-spi1-spidev.dtsi"
or
#include "am335x-bone-spi1a-spidev.dtsi"

then make/sudo make install/sudo reboot

Regards,

Hello Robert,

I had done just as you’ve described, but the system I started with had uboot and company installed in /boot/uboot rather than /boot and your ‘make install’ in …/dtb-rebuilder.git didn’t seem to be touching /boot/uboot. I guessed that that was why I wasn’t seeing the changes I was hoping for ( that is: /dev/spidev2.[0/1] ) so i tried completing the install for my setup by moving files into /boot/uboot/dtbs and bricked my board.

This morning I began with:

https://rcn-ee.net/deb/testing/2014-08-19/lxde/BBB-eMMC-flasher-debian-7.6-lxde-armhf-2014-08-19-2gb.img.xz

flashed my bone…

did:

apt-get install linux-image-3.14.17-ti-r16

then:

git clone -b 3.14-ti https://github.com/RobertCNelson/dtb-rebuilder.git

Jason,

/boot/uboot should have been nothing more than a mount point for /dev/mmcblk0p1. Which is the fat16 formatted partition that u-boot.img, MLO, and uEnv.txt reside.

/boot/uEnv.txt should be nothing more than . …

root@arm:~# cat /boot/uEnv.txt
uname_r=3.8.13-bone64.1
cmdline=quiet init=/lib/systemd/systemd
cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN

Or something similar.

How would you guys feel about nuking that fat16 "boot" partition. :wink:

Regards,

How would you guys feel about nuking that fat16 “boot” partition. :wink:

Quite honestly Robert. It’s been around since I first got my A5A last year, so I’m used to it. But I suppose having one partition formatted as ext2/3/4 would be more convenient