[openwrt/openwrt] realtek: DTS: add macro for switch port with SerDes

LEDE Commits lede-commits at lists.infradead.org
Sat Sep 20 03:51:27 PDT 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/06c895f5d3a98669aa0f6ac3a06815474e57234d

commit 06c895f5d3a98669aa0f6ac3a06815474e57234d
Author: Markus Stockhausen <markus.stockhausen at gmx.de>
AuthorDate: Thu Sep 18 05:10:50 2025 -0400

    realtek: DTS: add macro for switch port with SerDes
    
    In the future the PCS & DSA drivers will lookup the SerDes of a
    switch port via pcs-handle (like upstream does). Provide a macro
    that allows to expand the existing port definitions. To link a
    SerDes to port simply do
    
    Either in short form:
    
    replace SWITCH_PORT(0, 1, qsgmii)
    with    SWITCH_PORT_SDS(0, 1, 3, qsgmii) (Link to SerDes 3)
    
    Or in long form:
    
    port at 24 {
            reg = <24>;
            label = "lan25";
            pcs-handle = <&serdes4>; (Link to SerDes 4)
            phy-handle = <&phy24>;
            phy-mode = "1000base-x";
            managed = "in-band-status";
            sfp = <&sfp0>;
    };
    
    Signed-off-by: Markus Stockhausen <markus.stockhausen at gmx.de>
    Link: https://github.com/openwrt/openwrt/pull/20075
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 target/linux/realtek/dts/macros.dtsi | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/target/linux/realtek/dts/macros.dtsi b/target/linux/realtek/dts/macros.dtsi
index b47b782669..fbdd3fbb1c 100644
--- a/target/linux/realtek/dts/macros.dtsi
+++ b/target/linux/realtek/dts/macros.dtsi
@@ -42,11 +42,20 @@
 		reg = <##n>; \
 	};
 
-#define SWITCH_PORT(n, s, m) \
-	port##n: port@##n { \
-		reg = <##n>; \
-		label = SWITCH_PORT_LABEL(s) ; \
-		phy-handle = <&phy##n>; \
+#define SWITCH_PORT(p, l, m) \
+	port##p: port@##p { \
+		reg = <##p>; \
+		label = SWITCH_PORT_LABEL(l) ; \
+		phy-handle = <&phy##p>; \
+		phy-mode = #m ; \
+	};
+
+#define SWITCH_PORT_SDS(p, l, s, m) \
+	port##p: port@##p { \
+		reg = <##p>; \
+		label = SWITCH_PORT_LABEL(l) ; \
+		pcs-handle = <&serdes##s>; \
+		phy-handle = <&phy##p>; \
 		phy-mode = #m ; \
 	};
 




More information about the lede-commits mailing list