5.4-ti-rt am335x-SmartPH-dual-emac

Here’s what Google AI says about the subject. Of course there’s no device tree examples for switch mode.

The dual_emac property in the CPSW device tree node has been replaced by a different mechanism using VLAN filtering in recent Linux kernels, including kernel 6.1.

Instead of a dedicated dual_emac property, the kernel now uses a switchdev model, where the desired operation mode (switch or dual EMAC) is determined by how the network interfaces are configured in the Linux networking stack (e.g., using a bridge and VLAN settings), rather than a static device tree property.

Specifically:

  • The driver defaults to a switch mode configuration, presenting a single network interface (e.g., eth0) to the host CPU, with all physical ports part of the internal switch.

  • To achieve the functionality previously provided by dual_emac mode (where two separate network interfaces, e.g., eth0 and eth1, are exposed), you must now configure a software bridge in the Linux network stack and set it to a VLAN-unaware mode, or adjust the default PVIDs of the individual switch ports. The driver then manages the ports using internal VLAN IDs (typically 1 and 2 by default for the two slaves) to segregate traffic and achieve the dual interface behavior.

This change allows for more flexible configuration through standard Linux networking tools (like ip and bridge commands) instead of requiring a specific device tree flag. You can find more details on how to configure this in the Linux Kernel Documentation for the TI CPSW switchdev driver.

Now I’m having issues with gpiod. I remember having the same issues back when I tried migrating to 5.10-bone-rt, but it worked fine with 5.10-ti–rt, so I used it instead. The problem with the 5.x and 6.x bone-rt kernel is that all the gpios are off by one port. According to the Beagbone Black device tree and schematic, the usr0-usr3 LEDs should be on gpiochip1, not gpiochip0.

debian@BeagleBone:~$ gpioinfo -c gpiochip0
gpiochip0 - 32 lines:
line 0: “P8_25 [mmc1_dat0]” input
line 1: “[mmc1_dat1]” input
line 2: “P8_5 [mmc1_dat2]” input
line 3: “P8_6 [mmc1_dat3]” input
line 4: “P8_23 [mmc1_dat4]” input
line 5: “P8_22 [mmc1_dat5]” input
line 6: “P8_3 [mmc1_dat6]” input
line 7: “P8_4 [mmc1_dat7]” input
line 8: “NC” output active-low consumer=“PHY reset”
line 9: “NC” input
line 10: “NC” input
line 11: “NC” input
line 12: “P8_12” input
line 13: “P8_11” input
line 14: “P8_16” input
line 15: “P8_15” input
line 16: “P9_15A” input
line 17: “P9_23” input
line 18: “P9_14 [ehrpwm1a]” input
line 19: “P9_16 [ehrpwm1b]” input
line 20: “[emmc rst]” input
line 21: “[usr0 led]” output consumer=“beaglebone:green:usr0”
line 22: “[usr1 led]” output consumer=“beaglebone:green:usr1”
line 23: “[usr2 led]” output consumer=“beaglebone:green:usr2”
line 24: “[usr3 led]” output consumer=“beaglebone:green:usr3”
line 25: “[hdmi irq]” input
line 26: “[usb vbus oc]” input
line 27: “[hdmi audio]” output consumer=“enable”
line 28: “P9_12” input
line 29: “P8_26” input
line 30: “P8_21 [emmc]” input
line 31: “P8_20 [emmc]” input

Correct, mainline linux has been ripping out a lot of the gpio ‘magic’ numbers.. gpiochip values are now dynamic..

For output, best to use gpio-leds, for input use gpio-key..

gpio-leds: BeagleBoard-DeviceTrees/src/arm/overlays/BONE-LED-P9-19.dtso at v6.12.x-Beagle · beagleboard/BeagleBoard-DeviceTrees · GitHub

Regards,

1 Like

Oh ya… now I remember you suggesting this last time hit this problem. The only thing keeping me from using the gpio-leds and gpio-key on all of my gpio is that some of them are constantly changing their direction, similar to how a keyboard matrix works when it “scans” for a key press.

Fortunately, the bidirectional gpios are not on gpiochip0, so I can just subtract 1 from the gpiochipX for those gpios.

Thanks for the suggestion!

Oh, but I found here where you said it was due to a race condition:

So I can’t count on the “subtract 1” method to work everytime.

The last comment in the thread said:
“Since it is because of random race conditions, I use device tree overlay and load manually when boot. Seems libgpiod is happy now.”

Do you think that really works?

If i had to rely on libgpiod to work with multiple kernel versions, with a gpiochipX that is not constant..

I’d first, update the gpio-line-names in my device-tree to match my device:

Then second, update my libgpiod calls to what i did on the Beagley-ai, to mirror RPI gpio numbers…

gpioset $(gpiofind GPIO14)=1

Where GPIO14 was defined here: BeagleBoard-DeviceTrees/src/arm64/ti/k3-am67a-beagley-ai-pinmux.dtsi at v6.1.x-Beagle · beagleboard/BeagleBoard-DeviceTrees · GitHub

&main_gpio1 {
	pinctrl-names = "default";
	gpio-line-names = "", "", "", "", "", /* 0-4 */
			  "", "", "GPIO16", "GPIO17", "GPIO21", /* 5-9 */
			  "GPIO20", "GPIO18", "GPIO19", "GPIO15", "GPIO14", /* 10-14 */
			  "GPIO5", "GPIO12", "GPIO6", "GPIO13", ""; /* 15-19 */
};

So then it doesn’t matter if the gpiochipX values changes, the gpio-line-names has a define for GPIO14 all the time.. found by gpiofind..

Regards,

Hmm… I don’t think gpiofind comes in the gpiod package for Debian 13.

debian@BeagleBone:~$ ls -l /usr/bin/gpio*
-rwxr-xr-x 1 root root 67164 Mar 13 2025 /usr/bin/gpiodetect
-rwxr-xr-x 1 root root 67164 Mar 13 2025 /usr/bin/gpioget
-rwxr-xr-x 1 root root 67164 Mar 13 2025 /usr/bin/gpioinfo
-rwxr-xr-x 1 root root 67112 Mar 13 2025 /usr/bin/gpiomon
-rwxr-xr-x 1 root root 67112 Mar 13 2025 /usr/bin/gpionotify
-rwxr-xr-x 1 root root 67164 Mar 13 2025 /usr/bin/gpioset

awesome… Making sure you're not a bot!

I’m making some progress on my gpios, except for the bi-directional pins. I think I’m missing some magic that the “dir-changeable” property of the “gpio-of-helper” was doing to make things work. I can’t find any documentation on what that property actually did.

that’s gone… use devmem to switch the pinmux values…

Regards,

Well this is embarrassing… When I removed the “gpio-of-helper” section from my v5.10 device tree to make my v6.1 device tree, I didn’t realize there was no longer anything setting the pin muxes for my gpios.

That’s the magic I was missing, not the “dir-changeable” property.

1 Like

I noticed the newer kernel isn’t cleaning up the /tmp folder on reboot like the older one I’ve been using. I can probably come up with my own way to do this, but it might be better to figure out what changed, and change it back.

Do you know what changed in the kernel that caused it now to clean up the /tmp folder on reboots?

sudo systemctl mask tmp.mount
sudo reboot

and it’ll return to pre Debian 13 settings..

Regards,

Do you know if I can execute that command when I’m chroot’ed into Linux partition during my SD card image build? Or does it need to be done on first time boot?

I do it in a chroot after debootstrap; chroot: in most cases we do not have a lot of ram · RobertCNelson/omap-image-builder@a4b5c1e · GitHub

Hmm… There are still stale files in the /tmp folder after reboot. I tried this:

echo -e “d /tmp/ 0755 - -\nR /tmp/” > /etc/tmpfiles.d/tmp-cleanup.conf

Where:
d /tmp/ 0755 - -\nR /tmp/ #creates /tmp/ and sets the cleanup age to 0.
R /tmp/ #recursively removes /tmp/ and all of it’s subdirectories.

That appears to work. Can you see anything wrong with this solution?

That’s all I’ve done to my fleet of virtual machines after upgraded to Trixie… Haven’t noticed any issues after cleanup.