]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
microchipsw: tactical-1000: rename ports
authorRobert Marko <robert.marko@sartura.hr>
Wed, 12 Nov 2025 12:10:50 +0000 (13:10 +0100)
committerRobert Marko <robert.marko@sartura.hr>
Thu, 12 Mar 2026 09:09:07 +0000 (10:09 +0100)
Rename the network ports so they match the information printed on the
case.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
target/linux/microchipsw/dts/lan9696-tactical-1000.dts
target/linux/microchipsw/lan969x/base-files/etc/board.d/02_network
target/linux/microchipsw/lan969x/base-files/lib/preinit/04_set_netdev_label [new file with mode: 0755]
target/linux/microchipsw/patches-6.12/0097-v6.19-net-sparx5-lan969x-populate-netdev-of_node.patch [new file with mode: 0644]

index 1ee1d3ab55c9cb3b6d7ca2be634a3fd75c75ca60..4aeadc7fd2262b0722c12bf572ec0794163d2b4b 100644 (file)
                        phy-mode = "qsgmii";
                        phys = <&serdes 0>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan4";
                };
 
                port1: port@1 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 0>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan3";
                };
 
                port2: port@2 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 0>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan2";
                };
 
                port3: port@3 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 0>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan1";
                };
 
                port4: port@4 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 1>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan8";
                };
 
                port5: port@5 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 1>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan7";
                };
 
                port6: port@6 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 1>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan6";
                };
 
                port7: port@7 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 1>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan5";
                };
 
                port8: port@8 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 2>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan12";
                };
 
                port9: port@9 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 2>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan11";
                };
 
                port10: port@10 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 2>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan10";
                };
 
                port11: port@11 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 2>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan9";
                };
 
                port12: port@12 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 3>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan16";
                };
 
                port13: port@13 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 3>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan15";
                };
 
                port14: port@14 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 3>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan14";
                };
 
                port15: port@15 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 3>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan13";
                };
 
                port16: port@16 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 4>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan20";
                };
 
                port17: port@17 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 4>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan19";
                };
 
                port18: port@18 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 4>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan18";
                };
 
                port19: port@19 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 4>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan17";
                };
 
                port20: port@20 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 5>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan24";
                };
 
                port21: port@21 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 5>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan23";
                };
 
                port22: port@22 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 5>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan22";
                };
 
                port23: port@23 {
                        phy-mode = "qsgmii";
                        phys = <&serdes 5>;
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "lan21";
                };
 
                port24: port@24 {
                        managed = "in-band-status";
                        microchip,bandwidth = <10000>;
                        microchip,sd-sgpio = <24>;
+                       openwrt,netdev-name = "sfp1";
                };
 
                port25: port@25 {
                        managed = "in-band-status";
                        microchip,bandwidth = <10000>;
                        microchip,sd-sgpio = <28>;
+                       openwrt,netdev-name = "sfp2";
                };
 
                port26: port@26 {
                        managed = "in-band-status";
                        microchip,bandwidth = <10000>;
                        microchip,sd-sgpio = <32>;
+                       openwrt,netdev-name = "sfp3";
                };
 
                port27: port@27 {
                        managed = "in-band-status";
                        microchip,bandwidth = <10000>;
                        microchip,sd-sgpio = <36>;
+                       openwrt,netdev-name = "sfp4";
                };
 
                port29: port@29 {
                        phy-handle = <&phy3>;
                        phy-mode = "rgmii-id";
                        microchip,bandwidth = <1000>;
+                       openwrt,netdev-name = "mgmt";
                };
        };
 };
index fcf03f88a36f7df212c20839c74d1d30bdda3071..726207d833fbb4e728313b9db75dcd7d9d9bb8e1 100644 (file)
@@ -9,7 +9,7 @@ lan969x_setup_interfaces()
        case "$board" in
        microchip,ev23x71a|\
        novarq,tactical-1000)
-               lan_list=$(ls -1 -v -d /sys/class/net/eth* | xargs -n1 basename | xargs)
+               lan_list=$(ls -1 -v -d /sys/class/net/eth* /sys/class/net/lan* /sys/class/net/sfp* /sys/class/net/mgmt* | xargs -n1 basename | xargs)
                ucidef_set_interface_lan "$lan_list"
                ;;
        *)
diff --git a/target/linux/microchipsw/lan969x/base-files/lib/preinit/04_set_netdev_label b/target/linux/microchipsw/lan969x/base-files/lib/preinit/04_set_netdev_label
new file mode 100755 (executable)
index 0000000..2042d56
--- /dev/null
@@ -0,0 +1,15 @@
+set_netdev_labels() {
+       local dir
+       local label
+       local netdev
+
+       for dir in /sys/class/net/*; do
+               [ -r "$dir/of_node/openwrt,netdev-name" ] || continue
+               read -r label < "$dir/of_node/openwrt,netdev-name"
+               netdev="${dir##*/}"
+               [ "$netdev" = "$label" ] && continue
+               ip link set "$netdev" name "$label"
+       done
+}
+
+boot_hook_add preinit_main set_netdev_labels
diff --git a/target/linux/microchipsw/patches-6.12/0097-v6.19-net-sparx5-lan969x-populate-netdev-of_node.patch b/target/linux/microchipsw/patches-6.12/0097-v6.19-net-sparx5-lan969x-populate-netdev-of_node.patch
new file mode 100644 (file)
index 0000000..d1eccda
--- /dev/null
@@ -0,0 +1,26 @@
+From fc6aa0e470e092873eddb213d996a8beee86bf4d Mon Sep 17 00:00:00 2001
+From: Robert Marko <robert.marko@sartura.hr>
+Date: Mon, 10 Nov 2025 13:42:53 +0100
+Subject: [PATCH] net: sparx5/lan969x: populate netdev of_node
+
+Populate of_node for the port netdevs, to make the individual ports
+of_nodes available in sysfs.
+
+Signed-off-by: Robert Marko <robert.marko@sartura.hr>
+Link: https://patch.msgid.link/20251110124342.199216-1-robert.marko@sartura.hr
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
++++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
+@@ -396,6 +396,8 @@ static int sparx5_create_port(struct spa
+       spx5_port->phylink = phylink;
++      spx5_port->ndev->dev.of_node = spx5_port->of_node;
++
+       return 0;
+ }