Controlling pin modes with kernel 6

Hello everyone,

I’m having issues with controlling the pin modes in my custom image which is based on Debian 11 with Linux kernel 6. Specifically, I need to give some pins to PRU.
According to Reason for bone-pinmux-helper driver removal in 6.1.69-ti-r20, bone-pinmux-helper driver has been removed, and thus config-pin utility no longer works. No worries, I thought, I can edit the dts(i) files and rebuild the device tree. I copied the relevant files in the kernel sources and renamed them using my board name. Then I opened arch/arm/boot/dts/am335x-myboardname-common-univ.dtsi, found P8_42 pin lines and changed BONE_PIN(P8_42, default, P8_42(PIN_OUTPUT | INPUT_EN | MUX_MODE7)) to BONE_PIN(P8_42, default, P8_42(PIN_INPUT | MUX_MODE6)). I did the same for other pins that I need to switch to pruin or pruout modes.

But it seems it doesn’t work.

Is it because these pinmuxes are referenced in

        P8_42_pinmux {
                compatible = "bone-pinmux-helper";
                status = "okay";
                pinctrl-names = "default", "gpio", "gpio_pu", "gpio_pd", "eqep", "pruout", "pruin";
                pinctrl-0 = <&P8_42_default_pin>;
                pinctrl-1 = <&P8_42_gpio_pin>;
                pinctrl-2 = <&P8_42_gpio_pu_pin>;
                pinctrl-3 = <&P8_42_gpio_pd_pin>;
                pinctrl-4 = <&P8_42_eqep_pin>;
                pinctrl-5 = <&P8_42_pruout_pin>;
                pinctrl-6 = <&P8_42_pruin_pin>;
        };

which is declared compatible with bone-pinmux-helper, and that driver has been removed?

How do I make P8_42 switch to pruin mode at least on boot? I can live without being able to change runtime modes.

There are hints that there’s some work done on config-pin replacement with gpio-aggregator for BeagleY-AI board, but I saw no updates for the last 6 months…

I know this is a bit underdeveloped now…but!

  1. I saw a .dtbo for UIO.
  2. It was for the am335x.
  3. Right now, I do not remember the kernel.

You say kernel 6.x.x. Okay, I see a kernel 6.11.x and many more available. What exact kernel do you want to build? And without further data, I cannot help. I say that idea because if I build a kernel, I can then look online at kernel.org to view what exactly is in that specified kernel.

There are DTS fragments everywhere…

I have v6.1.111 compiled now without current pulls. 

and...

if you go into /arch/arm/boot/dts/

You will see:

am335x-base0033.dts
am335x-boneblack-common.dtsi
am335x-boneblack.dts
am335x-boneblack-hdmi.dtsi
am335x-boneblack-wireless.dts
am335x-boneblue.dts
am335x-bone-common.dtsi
am335x-bone.dts
am335x-bonegreen-common.dtsi
am335x-bonegreen.dts
am335x-bonegreen-wireless.dts

Those, for the most part, are what is available from the beagleboard.org boards.

There is also representation to AM33XX_PADCONF which is listed at am33xx.dtsi (I think).

I do not discredit what you are saying. I just compile less kernels now for this am335x now. So, I am behind the times on development under the am335x with newer kernels.

Also…

am33xx.dtsi can be found in /arch/arm/boot/dts/ similarly.

Seth

P.S. I understand what you are saying about not being able to control the PRU onboard. DTS is tricky and one always has to go back and back and back.

update here…

a. The beagleboard.org gitlab pages have a linux kernel.
b. I do not believe, this is a guess, that the linux kernel at openbeagle.org is being developed for the am335x from beagleboard.org people.
c. I can do my best to help but I am afraid I may fall short on building around the am335x for PRU usage.

I have a 2022 image that I used not too long ago with the older kernels of 5.10.x. I think this is when, during 5.10.x, that development stopped for some people. There are so many newer boards now that boot lightning fast compared to the am335x on the BBB. Anyway, I hope this note finds you well. I can try is all I am saying.

@me21 ,

Also…maybe try to look at other peoples’ boards in the listed file:

/arch/arm/boot/dts/am3*

Some other people with the am335x may still be producing with it. I am just not sure right now.

Seth

P.S. Also, there may be a form of u-boot that is still out and about for producing the helper scripts for the am335x. Also, I would not think you would get much help if it is not a BBB, i.e. since you have a personal board with the same chip on it. Heads up!

The FPP team has the same basic issue and really needed the user space pinmuxing to “work”. Thus, I did port the bone-pinmux-helper and device tree requirements to Linux 6.11 so that we can have a usable kernel for our needs. That said, it’s ONLY the bone pinmux helper and not the other gpio_of_helper so doing the pinmux is slightly different I think ( path is /sys/devices/platform/ocp/ocp:%s_pinmux/state ) but it works.

If you want to give our kernel a try, you can grab debs for it from fpp-linux-kernel/debs at master · FalconChristmas/fpp-linux-kernel · GitHub . That said, we have a bunch of things disabled in it that you may need. The main thing we do is completely remove everything power management related so there is no cpu freq scaling and such at all. (The power management stuff interferes with timing on the GPIO0 pins so ws281x data gets corrupt). However, you can at least give it a try.

If you want to grab out patch and build your own kernel: Updates for FPP · FalconChristmas/bb-kernel@b2c2bc0 · GitHub

1 Like

Thank you @silver2row and @Daniel_Kulp for your contributions. According to the referenced topic in my first message, it doesn’t matter whether it’s BBB or a custom board with the same chip. The reason is the removal of bone-pinmux-helper driver in TI kernel branch.

I’m still making my first steps in kernel building, but since I didn’t actually need to be able to switch the pin modes at runtime, I solved my problem by moving from config-pin utility to setting the needed pin modes statically in the device tree file.

P.S. What was gpio_of_helper used for? It was also removed…

1 Like