Can't get overlay to set pinmux for IEP

115 views
Skip to first unread message

Andrew P. Lentvorski

unread,
Jan 24, 2020, 2:32:18 AM1/24/20
to BeagleBoard

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




TJF

unread,
Jan 24, 2020, 12:28:02 PM1/24/20
to BeagleBoard
I guess your overlay cannot 'disable' pins that're claimed by another overlay. And here you're facing the core problem when working with device trees: you won't get reliable error messages. Everything ends up with trail-and-error bug finding.

I've good reasons why I always drop config-pin and its overlays. Instead I developed and shared libpruio and its pinmuxing. Your target is over the capabilities of the standard tools, but is well covered by the libpruio scope.

Robert Nelson

unread,
Jan 24, 2020, 12:37:51 PM1/24/20
to Beagle Board, bsd...@gmail.com
The pruss_ieq doesn't have pinctrl, you need to stick it in the pruss node:

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/AM335X-PRU-RPROC-4-14-TI-PRUCAPE-00A0.dts#L119-L131

It's really best to copy AM335X-PRU-RPROC-4-14-TI-PRUCAPE-00A0.dts to
your overlay name, and then rip out the pins you don't use..

Regards,


--
Robert Nelson
https://rcn-ee.com/

Andrew P. Lentvorski

unread,
Jan 24, 2020, 9:29:16 PM1/24/20
to BeagleBoard
Much appreciated, Robert.  I updated to the PRUCAPE file and tore out a bunch of stuff I didn't need and that seems to be setting the pinmux correctly.

Is there anything else in this file that can be removed?

Thanks.


// Code shamelessly copied from AM335X-PRU-RPROC-4-14-TI-PRUCAPE-00A0.dts

/dts-v1/;
/plugin/;


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

   
// identification
    part
-number = "BB-PRUDAP";
    version
= "00A0";


   
/*

     * 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_18_pinmux
{ status = "disabled"; };    /* P9_18: spi0_d1 */
            P9_17_pinmux
{ status = "disabled"; };    /* P9_17: spi0_cs0 */

       
};
   
};

    fragment@2
{
        target
= <&am33xx_pinmux>;
        __overlay__
{
            bb_prudap_pins
: pinmux_bb_prudap_pins {
                pinctrl
-single,pins = <

                   
0x158 0x2D    /* P9_18: spi0_d1.i2c1_sda, SLEWCTRL_FAST | INPUT_EN | PULL_DISABLE | MODE5 (IEP-edio/digio data in 6) */
                   
0x15c 0x2E    /* P9_17: spi0_cs0.i2c1_scl, SLEWCTRL_FAST | INPUT_EN | PULL_DISABLE | MODE6 (IEP-edio/digio data out 7) */
               
>;
           
};
       
};
   
};

    fragment@3
{
        target
-path="/";
        __overlay__
{

            ocp
{
               
#address-cells = <1>;
               
#size-cells = <1>;

                pruss_soc_bus
: pruss_soc_bus@4a326004 {
                    compatible
= "ti,am3356-pruss-soc-bus";
                    reg
= <0x4a326004 0x4>;
                    ti
,hwmods = "pruss";
                   
#address-cells = <1>;
                   
#size-cells = <1>;
                    ranges
= <0x0 0x4a300000 0x80000>;
                    status
= "okay";

                    pruss
: pruss@0 {
                        compatible
= "ti,am3356-pruss";
                        reg
= <0x0 0x80000>;
                        interrupts
= <20 21 22 23 24 25 26 27>;
                        interrupt
-names = "host2", "host3", "host4",
                                 
"host5", "host6", "host7",
                                 
"host8", "host9";
                       
#address-cells = <1>;
                       
#size-cells = <1>;
                        ranges
;

                        status
= "okay";
                        pinctrl
-names = "default";
                        pinctrl
-0 = <&bb_prudap_pins>;


                        pruss_iep
: iep@2e000 {
                            compatible
= "syscon";
                            reg
= <0x2e000 0x31c>;
                       
};
                   
};
               
};
           
};
       
};
   
};
};



Robert Nelson

unread,
Jan 24, 2020, 10:55:59 PM1/24/20
to Beagle Board
On Fri, Jan 24, 2020 at 8:29 PM Andrew P. Lentvorski <bsd...@gmail.com> wrote:
>
> Much appreciated, Robert. I updated to the PRUCAPE file and tore out a bunch of stuff I didn't need and that seems to be setting the pinmux correctly.
>
> Is there anything else in this file that can be removed?

I'd actually keep the whole "pruss_soc_bus" struct as it was, (with
those 5 or 6 extra nodes..)

More or less to just keep the driver happy..
Reply all
Reply to author
Forward
0 new messages