0
votes

I have a project using BeagleBone Black rev C with Debian 9.5 2018-10-07 4GB SD IOT running on the 4.14.x-ti kernel. I've set it up so it uses the am335x-boneblack.dtb and I'm trying to enable a custom overlay which claims some pins for the PRUSS.

The problem is, both the DTB and the overlay seem to be loaded correctly on boot, but the overlay changes don't seem to be applied at all.

Pins I wanted to use are defined in the pinmuxes in am335x-bone-common-universal-pins.dtsi, but they don't seem to be actually used by any peripherals.

The cape manager is disabled in 4.14, so can't use it to load an overlay.

Code / output

Related parts of /boot/uEnv.txt

dtb=am335x-boneblack.dtb
dtb_overlay=/lib/firmware/AM335X-PRU-STOPWATCH.dtbo
disable_uboot_overlay_emmc=1
disable_uboot_overlay_video=1
disable_uboot_overlay_audio=1
disable_uboot_overlay_wireless=1
disable_uboot_overlay_adc=1
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
enable_uboot_cape_universal=0

AM335X-PRU-STOPWATCH.dtso compiled as /lib/firmware/AM335X-PRU-STOPWATCH.dtbo

/dts-v1/;
/plugin/;
/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";
    part-number = "AM335X-PRU-STOPWATCH";
    version = "00A0";
    exclusive-use = "P8.11", "P8.15", "P8.28", "P8.29";
    fragment@0 {
        target = <&pruss>;
        __overlay__ {
            pinctrl-names = "default";
            pinctrl-0 = <&pinmux_P8_11_pruout_pin>;
            pinctrl-1 = <&pinmux_P8_15_pruin_pin>;
            pinctrl-2 = <&pinmux_P8_28_pruout_pin>;
            pinctrl-3 = <&pinmux_P8_29_pruin_pin>;
            status = "okay";
        };
    };
};

/opt/scripts/tools/version.sh output

eeprom:[A335BNLT00C04816BBBK05FF]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-10-07]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2018.09-00002-g0b54a51
eee]:[location: dd MBR]
kernel:[4.14.79-ti-r87]
nodejs:[v6.14.4]
device-tree-override:[dtb=am335x-boneblack.dtb]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[disable_uboot_overlay_emmc=1]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[disable_uboot_overlay_wireless=1]
uboot_overlay_options:[disable_uboot_overlay_adc=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-
00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=0]
uboot_overlay_options:[dtb_overlay=/lib/firmware/AM335X-PRU-STOPWATCH.dtbo]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.4.20180928.0-0rcnee0~stretch+20180928]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[librobotcontrol]:[1.0.3-git20181005.0-0rcnee0~stretch+20181005]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev us
ers systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk
 weston-launch xenomai]
cmdline:[console=ttyO0,115200n8 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait
coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[    0.985371] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[    0.986573] gpio-of-helper ocp:cape-universal: ready

Expected results

Pin P8_11 as pr1_pru0_pru_r30_15 in Mode 5

Pin P8_15 as pr1_pru0_pru_r31_15 in Mode 6

Pin P8_28 as pr1_pru1_pru_r31_13 in Mode 6

Pin P8_29 as pr1_pru1_pru_r30_12 in Mode 5

In order to use them in pru0 and pru1 code.

Actual results

Pins have default modes.

2
One of the annoyances of this platform is that the same things have been done in too many different ways over the years. Try things like looking for differences between how settings you know are taking effect are expressed, and how the ones that do not are. Can you introduce an intentional error like an invalid pin in your custom ones and see if that causes a debug message? Are you building or can you build the kernel, and put in some printk's in the code that would interpret this?Chris Stratton
Hey @ChrisStratton, thanks for your interest. Yeah, the problem is, there are absolutely no materials that are up to date and you're pretty much on your own now. Before I accidentally damaged Debian and had to copy the image and start again, I was actually able to cause an intentional error by definining own devices which claimed and configured the above pins, which said that the pins were already claimed by other devices during booting. I'm not sure which change exactly caused the overlays to actually load and sadly didn't document that before Debian got damaged.bartlomiej.n

2 Answers

2
votes

I eventually got to the root cause of the problem. If you specify any custom dtb in /boot/uEnv.txt, it disables loading of the default dtb (am335x-boneblack-uboot-univ.dtb as it turned out) and all of the settings specified below in the same file, including the rproc/uio PRU, custom and emmc/video/audio overlays if you want to use them. Which seems quite reasonable in retrospect. The solution is to just remove dtb=name.

debug: [enable_uboot_overlays=1] ...
debug: [enable_uboot_cape_universal=1] ...
debug: [uboot_base_dtb_univ=am335x-boneblack-uboot-univ.dtb] ...
uboot_overlays: [uboot_base_dtb=am335x-boneblack-uboot-univ.dtb] ...
uboot_overlays: Switching too: dtb=am335x-boneblack-uboot-univ.dtb ...
loading /boot/dtbs/4.14.79-ti-r87/am335x-boneblack-uboot-univ.dtb ...
172977 bytes read in 77 ms (2.1 MiB/s)
uboot_overlays: [fdt_buffer=0x60000] ...
uboot_overlays: uboot loading of [/lib/firmware/BB-BONE-eMMC1-01-00A0.dtbo] disabled by /boot/uEnv.txt [disable_uboot_overlay_emmc=1]...
uboot_overlays: uboot loading of [/lib/firmware/BB-HDMI-TDA998x-00A0.dtbo] disabled by /boot/uEnv.txt [disable_uboot_overlay_video=1]...
uboot_overlays: uboot loading of [/lib/firmware/BB-ADC-00A0.dtbo] disabled by /boot/uEnv.txt [disable_uboot_overlay_adc=1]...
uboot_overlays: loading /lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo ...
3513 bytes read in 232 ms (14.6 KiB/s)
uboot_overlays: [dtb_overlay=/lib/firmware/AM335X-PRU-STOPWATCH.dtbo] ...
uboot_overlays: loading /lib/firmware/AM335X-PRU-STOPWATCH.dtbo ...
1
votes

To apply boot overlays the device tree has to be compiled with dtc -@ unfortunately Debian does not set the flag. I have opened a but report https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910727. Maybe you want to sent a mail to [email protected] to confirm that this feature is needed.

Until this is fixed you will have to compile your own device tree:

You seem not to be using mainline U-Boot. In mainline U-Boot the overlays can be applied via the fdt command. The Debian flash-kernel package allows to put the necessary commands into a file in /etc/flash-kernel/preboot.d/.