Am I doing something wrong or are my expectations incorrect?
I created an overlay file BB-PRUDAP-00A0 to take over P9_17 and P9_18 and set them to the IEP.
I added it to uEnv.txt and apparently it loaded:
root@beaglebone:~/prudap/lkm/prudap_lkm# ls -al /proc/device-tree/chosen/overlays/
total 0
drwxr-xr-x 2 root root 0 Jan 24 07:11 .
drwxr-xr-x 3 root root 0 Jan 24 07:11 ..
-r--r--r-- 1 root root 25 Jan 24 07:11 AM335X-PRU-RPROC-4-14-TI-00A0
-r--r--r-- 1 root root 25 Jan 24 07:11 BB-ADC-00A0
-r--r--r-- 1 root root 25 Jan 24 07:11 BB-BONE-eMMC1-01-00A0
-r--r--r-- 1 root root 25 Jan 24 07:11 BB-PRUDAP-00A0
-r--r--r-- 1 root root 9 Jan 24 07:11 name
It also seems to have exclusive control over the pins:
root@beaglebone:~# config-pin P9_17 pwm
ERROR: open() for /sys/devices/platform/ocp/ocp:P9_17_pinmux/state failed, No such file or directory
However, when I check the actual pinmux values, I get:
[ 77.897980] prudap: spi0_cs0 pinmux state: 0x37
[ 77.897986] prudap: spi0_d1 pinmux state: 0x37
That's not what I expect. I expected to see 0x2E and 0x2D like I requested in the overlay file.
What did I do wrong in the BB-PRUDAP-00A0.dts file. Those values are not what I wanted, but I can override those values in a kernel module. However, I expected the pinmux to be already set up due to the overlay file.
Any help would be appreciated.
Thanks.
BB-PRUDAP-00A0.dts file:
/dts-v1/;
/plugin/;
#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/pinctrl/am33xx.h>
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";
// identification
part-number = "BB-PRUDAP";
version = "00A0";
// resources this cape uses
exclusive-use =
"P9.17", // spi0_cs0
"P9.18", // spi0_d1
"pruss_iep"; // hardware ip used
/*
* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
*/
fragment@0 {
target-path="/";
__overlay__ {
chosen {
overlays {
BB-PRUDAP-00A0 = __TIMESTAMP__;
};
};
};
};
/*
* Free up the pins used by the cape from the pinmux helpers.
*/
fragment@1 {
target = <&ocp>;
__overlay__ {
P9_17_pinmux { status = "disabled"; }; /* spi0_cs0 */
P9_18_pinmux { status = "disabled"; }; /* spi0_d1 */
};
};
fragment@2 {
target = <&am33xx_pinmux>;
__overlay__ {
bb_prudap_pins: pinmux_bb_prudap_pins {
pinctrl-single,pins = <
BONE_P9_17 0x2E /* spi0_cs0.i2c1_scl, SLEWCTRL_FAST | INPUT_EN | PULL_DISABLE | MODE6 (IEP-edio/digio data out 7) */
BONE_P9_18 0x2D /* spi0_d1.i2c1_sda, SLEWCTRL_FAST | INPUT_EN | PULL_DISABLE | MODE5 (IEP-edio/digio data in 6) */
>;
};
};
};
fragment@3 {
target = <&pruss_iep>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_prudap_pins>;
};
};
};
/boot/uEnv.txt for completeness:
root@beaglebone:~/prudap/lkm/prudap_lkm# cat /boot/uEnv.txt
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0
uname_r=4.14.108-ti-r113
#uuid=
#dtb=
###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###
###Additional custom capes
uboot_overlay_addr4=/lib/firmware/BB-PRUDAP-00A0.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#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
###
###PRUSS OPTIONS
###pru_rproc (4.4.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo
###pru_rproc (4.14.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.4.x-ti, 4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###
cmdline=coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 quiet
#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768@60e
#Use an overlayfs on top of a read-only root filesystem:
#cmdline=coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 quiet overlayroot=tmpfs
##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh