My custom cape's devicetree fails to load at boot, but can be loaded manually

handros picture handros · Jun 10, 2014 · Viewed 9.2k times · Source

If I load my own device-tree overlay from a shell it loads fine, but if I try to load it at boot, it won't do so. What am I missing?

It is a debian BeagleBone Black that I set up using bone-debian-7.4-2014-04-23-2gb.img.xz
Linux beaglebone 3.8.13-bone47 #1 SMP Fri Apr 11 01:36:09 UTC 2014 armv7l GNU/Linux

Here is the change that I made to /boot/uboot/uEnv.txt :

optargs=capemgr.enable_partno=BB-FOO-GPIO

This is the output of dmesg | grep bone-capemgr :

Baseboard: 'A335BNLT,00A5,4049BBBK7400'
compatible-baseboard=ti,beaglebone-black
slot #0: No cape found
slot #1: No cape found
slot #2: No cape found
slot #3: No cape found
slot #4: specific override
bone: Using override eeprom data at slot 4
slot #4: 'Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G'
slot #5: specific override
bone: Using override eeprom data at slot 5
slot #5: 'Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI'
slot #6: specific override
bone: Using override eeprom data at slot 6
slot #6: 'Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN'
enabled_partno part_number 'BB-FOO-GPIO', version 'N/A', prio '0'
slot #7: generic override
bone: Using override eeprom data at slot 7
slot #7: 'Override Board Name,00A0,Override Manuf,BB-FOO-GPIO'
loader: before slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
loader: check slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
loader: before slot-5 BB-BONELT-HDMI:00A0 (prio 1)
loader: check slot-5 BB-BONELT-HDMI:00A0 (prio 1)
loader: before slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
loader: check slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
initialized OK.
loader: check slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
loader: check slot-5 BB-BONELT-HDMI:00A0 (prio 1)
loader: check slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
loader: before slot-7 BB-FOO-GPIO:00A0 (prio 0)
loader: check slot-7 BB-FOO-GPIO:00A0 (prio 0)
loader: after slot-7 BB-FOO-GPIO:00A0 (prio 0)
slot #7: Requesting part number/version based 'BB-FOO-GPIO-00A0.dtbo
slot #7: Requesting firmware 'BB-FOO-GPIO-00A0.dtbo' for board-name 'Override Board Name', version '00A0'
failed to load firmware 'BB-FOO-GPIO-00A0.dtbo'
loader: failed to load slot-7 BB-FOO-GPIO:00A0 (prio 0)
loader: check slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
loader: check slot-5 BB-BONELT-HDMI:00A0 (prio 1)
loader: after slot-5 BB-BONELT-HDMI:00A0 (prio 1)
slot #5: Requesting firmware 'cape-boneblack-hdmi-00A0.dtbo' for board-name 'Bone-Black-HDMI', version '00A0'
slot #5: dtbo 'cape-boneblack-hdmi-00A0.dtbo' loaded; converting to live tree
slot #5: #4 overlays
loader: check slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
loader: after slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
slot #4: Requesting firmware 'cape-bone-2g-emmc1.dtbo' for board-name 'Bone-LT-eMMC-2G', version '00A0'
slot #4: dtbo 'cape-bone-2g-emmc1.dtbo' loaded; converting to live tree
slot #4: #2 overlays
slot #4: Applied #2 overlays.
loader: done slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
loader: check slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
slot #5: Applied #4 overlays.
loader: done slot-5 BB-BONELT-HDMI:00A0 (prio 1)
loader: check slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
loader: after slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
slot #6: Requesting firmware 'cape-boneblack-hdmin-00A0.dtbo' for board-name 'Bone-Black-HDMIN', version '00A0'
slot #6: dtbo 'cape-boneblack-hdmin-00A0.dtbo' loaded; converting to live tree
slot #6: BB-BONELT-HDMIN conflict P8.45 (#5:BB-BONELT-HDMI)
slot #6: Failed verification
loader: failed to load slot-6 BB-BONELT-HDMIN:00A0 (prio 2)

Here is my source file for the device-tree overlay:

/dts-v1/;
/plugin/;

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";

    /* Identification */
    part-number = "BB-FOO-GPIO";
    version = "00A0";

    /* Resources required */
    exclusive-use =
        "P9.27",        /* XXX */
        "P9.23",        /* XXX */
        "gpio3_19",     /* XXX */
        "gpio1_17";     /* XXX */

    fragment@0 {
        target = <&am33xx_pinmux>;
        __overlay__ {
            foo_gpio_pins: pinmux_gpio_helper_pins {
                pinctrl-single,pins = <
                    0x1a4 0x0f      /* P9.27 GPIO3_19: MODE7 - OUTPUT */
                    0x044 0x2f      /* P9.23 GPIO1_17: MODE7 - INPUT */
                >;
            };
        };
    };

    fragment@1 {
        target = <&ocp>;    /* On-chip Peripherals */
        __overlay__ {

            foo_gpio_helper {
                compatible = "gpio-of-helper";
                pinctrl-names = "default";
                pinctrl-0 = <&foo_gpio_pins>;
                status = "okay";

                foo_test_output {
                    gpio-name = "foo_test_output";
                    gpio = <&gpio4 19 0x00>;            /* gpio4 => GPIO-3 */
                    output;
                    init-high;
                };

                foo_test_input {
                    gpio-name = "foo_test_input";
                    gpio = <&gpio2 17 0x00>;            /* gpio2 => GPIO-1 */
                    input;
                    count-rising-edge;
                    count-falling-edge;
                };
            };
        };
    };
};

~
(I compiled it so: dtc -O dtb -o BB-FOO-GPIO-00A0.dtbo -b 0 -@ BB-FOO-GPIO-00A0.dts}

Now loading it manually using echo BB-FOO-GPIO > $SLOTS" it loads fine..
dmesg -c gives me:

bone-capemgr bone_capemgr.9: part_number 'BB-FOO-GPIO', version 'N/A'
bone-capemgr bone_capemgr.9: slot #8: generic override
bone-capemgr bone_capemgr.9: bone: Using override eeprom data at slot 8
bone-capemgr bone_capemgr.9: slot #8: 'Override Board Name,00A0,Override Manuf,BB-FOO-GPIO'
bone-capemgr bone_capemgr.9: slot #8: Requesting part number/version based 'BB-FOO-GPIO-00A0.dtbo
bone-capemgr bone_capemgr.9: slot #8: Requesting firmware 'BB-FOO-GPIO-00A0.dtbo' for board-name 'Override Board Name', version '00A0'
bone-capemgr bone_capemgr.9: slot #8: dtbo 'BB-FOO-GPIO-00A0.dtbo' loaded; converting to live tree
bone-capemgr bone_capemgr.9: slot #8: #2 overlays
of_get_named_gpio_flags exited with status 17
gpio-of-helper foo_gpio_helper.15: Allocated GPIO id=0
of_get_named_gpio_flags exited with status 115
gpio-of-helper foo_gpio_helper.15: Allocated GPIO id=1
gpio-of-helper foo_gpio_helper.15: ready
bone-capemgr bone_capemgr.9: slot #8: Applied #2 overlays.

And cat /sys/devices/bone_capemgr.9/slots gives me what I desire:

0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
8: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-FOO-GPIO

So, what am I missing? Why won't it load at boot time, but it will from a shell? The problem seems related to firmware not being loaded... I don't understand.

Answer

George picture George · Jul 8, 2014

This is an issue that has a solution described in the link: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Loading_custom_capes

I hope it helps, George