summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Štetiar <ynezz@true.cz>2020-11-04 16:20:17 +0100
committerPetr Štetiar <ynezz@true.cz>2020-11-09 09:14:02 +0100
commite26744551039ef8d33786948a830ba5aa0a988b8 (patch)
tree9f7b4bb76579b9879ef779faf442fd3ccffb4ebd
parent0516aa398cc73a2fec90db5795f7b1d73feefbeb (diff)
downloadopenwrt-e26744551039ef8d33786948a830ba5aa0a988b8.tar.gz
openwrt-e26744551039ef8d33786948a830ba5aa0a988b8.tar.bz2
openwrt-e26744551039ef8d33786948a830ba5aa0a988b8.zip
rtl838x: dts: use macros for phy and switch definitions
It's quite more readable, saves some tedious copy&pasting, not so error prone etc. Signed-off-by: Petr Štetiar <ynezz@true.cz>
-rw-r--r--target/linux/rtl838x/dts/rtl8382_allnet_all-sg8208m.dts111
-rw-r--r--target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-10p.dts125
-rw-r--r--target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-16.dts261
-rw-r--r--target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-28.dts359
-rw-r--r--target/linux/rtl838x/dts/rtl838x.dtsi33
5 files changed, 170 insertions, 719 deletions
diff --git a/target/linux/rtl838x/dts/rtl8382_allnet_all-sg8208m.dts b/target/linux/rtl838x/dts/rtl8382_allnet_all-sg8208m.dts
index 5433b7f372..a5dd3be0a4 100644
--- a/target/linux/rtl838x/dts/rtl8382_allnet_all-sg8208m.dts
+++ b/target/linux/rtl838x/dts/rtl8382_allnet_all-sg8208m.dts
@@ -103,46 +103,14 @@
#address-cells = <1>;
#size-cells = <0>;
- /* Internal phy */
- phy8: ethernet-phy@8 {
- reg = <8>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
-
- phy9: ethernet-phy@9 {
- reg = <9>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
-
- phy10: ethernet-phy@10 {
- reg = <10>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
-
- phy11: ethernet-phy@11 {
- reg = <11>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
-
- phy12: ethernet-phy@12 {
- reg = <12>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
-
- phy13: ethernet-phy@13 {
- reg = <13>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
-
- phy14: ethernet-phy@14 {
- reg = <14>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
-
- phy15: ethernet-phy@15 {
- reg = <15>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
+ INTERNAL_PHY(8)
+ INTERNAL_PHY(9)
+ INTERNAL_PHY(10)
+ INTERNAL_PHY(11)
+ INTERNAL_PHY(12)
+ INTERNAL_PHY(13)
+ INTERNAL_PHY(14)
+ INTERNAL_PHY(15)
};
};
@@ -151,61 +119,14 @@
#address-cells = <1>;
#size-cells = <0>;
- port@0 {
- reg = <8>;
- label = "lan1";
- phy-handle = <&phy8>;
- phy-mode = "internal";
- };
-
- port@1 {
- reg = <9>;
- label = "lan2";
- phy-handle = <&phy9>;
- phy-mode = "internal";
- };
-
- port@2 {
- reg = <10>;
- label = "lan3";
- phy-handle = <&phy10>;
- phy-mode = "internal";
- };
-
- port@3 {
- reg = <11>;
- label = "lan4";
- phy-handle = <&phy11>;
- phy-mode = "internal";
- };
-
- port@4 {
- reg = <12>;
- label = "lan5";
- phy-handle = <&phy12>;
- phy-mode = "internal";
- };
-
- port@5 {
- reg = <13>;
- label = "lan6";
- phy-handle = <&phy13>;
- phy-mode = "internal";
- };
-
- port@6 {
- reg = <14>;
- label = "lan7";
- phy-handle = <&phy14>;
- phy-mode = "internal";
- };
-
- port@7 {
- reg = <15>;
- label = "lan8";
- phy-handle = <&phy15>;
- phy-mode = "internal";
- };
+ SWITCH_PORT(8, 1, internal)
+ SWITCH_PORT(9, 2, internal)
+ SWITCH_PORT(10, 3, internal)
+ SWITCH_PORT(11, 4, internal)
+ SWITCH_PORT(12, 5, internal)
+ SWITCH_PORT(13, 6, internal)
+ SWITCH_PORT(14, 7, internal)
+ SWITCH_PORT(15, 8, internal)
port@28 {
ethernet = <&ethernet0>;
diff --git a/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-10p.dts b/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-10p.dts
index 89e3746ad5..9987316c21 100644
--- a/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-10p.dts
+++ b/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-10p.dts
@@ -99,8 +99,6 @@
};
};
-
-
&ethernet0 {
mdio: mdio-bus {
compatible = "realtek,rtl838x-mdio";
@@ -108,49 +106,16 @@
#address-cells = <1>;
#size-cells = <0>;
- /* Internal phy */
- phy8: ethernet-phy@8 {
- reg = <8>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy9: ethernet-phy@9 {
- reg = <9>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy10: ethernet-phy@10 {
- reg = <10>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy11: ethernet-phy@11 {
- reg = <11>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy12: ethernet-phy@12 {
- reg = <12>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy13: ethernet-phy@13 {
- reg = <13>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy14: ethernet-phy@14 {
- reg = <14>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy15: ethernet-phy@15 {
- reg = <15>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy24: ethernet-phy@24 {
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- reg = <24>;
- };
- phy26: ethernet-phy@26 {
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- reg = <26>;
- };
+ INTERNAL_PHY(8)
+ INTERNAL_PHY(9)
+ INTERNAL_PHY(10)
+ INTERNAL_PHY(11)
+ INTERNAL_PHY(12)
+ INTERNAL_PHY(13)
+ INTERNAL_PHY(14)
+ INTERNAL_PHY(15)
+ INTERNAL_PHY(24)
+ INTERNAL_PHY(26)
};
};
@@ -159,67 +124,17 @@
#address-cells = <1>;
#size-cells = <0>;
- port@0 {
- reg = <8>;
- label = "lan1";
- phy-handle = <&phy8>;
- phy-mode = "internal";
- };
- port@1 {
- reg = <9>;
- label = "lan2";
- phy-handle = <&phy9>;
- phy-mode = "internal";
- };
- port@2 {
- reg = <10>;
- label = "lan3";
- phy-handle = <&phy10>;
- phy-mode = "internal";
- };
- port@3 {
- reg = <11>;
- label = "lan4";
- phy-handle = <&phy11>;
- phy-mode = "internal";
- };
- port@4 {
- reg = <12>;
- label = "lan5";
- phy-handle = <&phy12>;
- phy-mode = "internal";
- };
- port@5 {
- reg = <13>;
- label = "lan6";
- phy-handle = <&phy13>;
- phy-mode = "internal";
- };
- port@6 {
- reg = <14>;
- label = "lan7";
- phy-handle = <&phy14>;
- phy-mode = "internal";
- };
- port@7 {
- reg = <15>;
- label = "lan8";
- phy-handle = <&phy15>;
- phy-mode = "internal";
- };
+ SWITCH_PORT(8, 1, internal)
+ SWITCH_PORT(9, 2, internal)
+ SWITCH_PORT(10, 3, internal)
+ SWITCH_PORT(11, 4, internal)
+ SWITCH_PORT(12, 5, internal)
+ SWITCH_PORT(13, 6, internal)
+ SWITCH_PORT(14, 7, internal)
+ SWITCH_PORT(15, 8, internal)
+ SWITCH_PORT(24, 9, internal)
+ SWITCH_PORT(26, 10, internal)
- port@24 {
- reg = <24>;
- label = "lan9";
- phy-mode = "internal";
- phy-handle = <&phy24>;
- };
- port@26 {
- reg = <26>;
- label = "lan10";
- phy-mode = "internal";
- phy-handle = <&phy26>;
- };
port@28 {
ethernet = <&ethernet0>;
reg = <28>;
diff --git a/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-16.dts b/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-16.dts
index 3843af1371..ac51185ed0 100644
--- a/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-16.dts
+++ b/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-16.dts
@@ -14,107 +14,28 @@
#address-cells = <1>;
#size-cells = <0>;
- /* External phy RTL8218B */
- phy0: ethernet-phy@0 {
- reg = <0>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy1: ethernet-phy@1 {
- reg = <1>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy2: ethernet-phy@2 {
- reg = <2>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy3: ethernet-phy@3 {
- reg = <3>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy4: ethernet-phy@4 {
- reg = <4>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy5: ethernet-phy@5 {
- reg = <5>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy6: ethernet-phy@6 {
- reg = <6>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy7: ethernet-phy@7 {
- reg = <7>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
+ EXTERNAL_PHY(0)
+ EXTERNAL_PHY(1)
+ EXTERNAL_PHY(2)
+ EXTERNAL_PHY(3)
+ EXTERNAL_PHY(4)
+ EXTERNAL_PHY(5)
+ EXTERNAL_PHY(6)
+ EXTERNAL_PHY(7)
- /* Internal phy RTL8218B */
- phy8: ethernet-phy@8 {
- reg = <8>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy9: ethernet-phy@9 {
- reg = <9>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy10: ethernet-phy@10 {
- reg = <10>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy11: ethernet-phy@11 {
- reg = <11>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy12: ethernet-phy@12 {
- reg = <12>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy13: ethernet-phy@13 {
- reg = <13>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy14: ethernet-phy@14 {
- reg = <14>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy15: ethernet-phy@15 {
- reg = <15>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
+ INTERNAL_PHY(8)
+ INTERNAL_PHY(9)
+ INTERNAL_PHY(10)
+ INTERNAL_PHY(11)
+ INTERNAL_PHY(12)
+ INTERNAL_PHY(13)
+ INTERNAL_PHY(14)
+ INTERNAL_PHY(15)
- /* External phy: RTL8214FC */
- phy24: ethernet-phy@24 {
- compatible = "ethernet-phy-ieee802.3-c22";
- sfp;
- media = "fibre";
- reg = <24>;
- };
- phy25: ethernet-phy@25 {
- compatible = "ethernet-phy-ieee802.3-c22";
- sfp;
- media = "fibre";
- reg = <25>;
- };
- phy26: ethernet-phy@26 {
- compatible = "ethernet-phy-ieee802.3-c22";
- sfp;
- media = "fibre";
- reg = <26>;
- };
- phy27: ethernet-phy@27 {
- compatible = "ethernet-phy-ieee802.3-c22";
- sfp;
- media = "fibre";
- reg = <27>;
- };
+ EXTERNAL_SFP_PHY(24)
+ EXTERNAL_SFP_PHY(25)
+ EXTERNAL_SFP_PHY(26)
+ EXTERNAL_SFP_PHY(27)
};
};
@@ -123,127 +44,29 @@
#address-cells = <1>;
#size-cells = <0>;
- port@0 {
- reg = <0>;
- label = "lan1";
- phy-handle = <&phy0>;
- phy-mode = "qsgmii";
- };
- port@1 {
- reg = <1>;
- label = "lan2";
- phy-handle = <&phy1>;
- phy-mode = "qsgmii";
- };
- port@2 {
- reg = <2>;
- label = "lan3";
- phy-handle = <&phy2>;
- phy-mode = "qsgmii";
- };
- port@3 {
- reg = <3>;
- label = "lan4";
- phy-handle = <&phy3>;
- phy-mode = "qsgmii";
- };
- port@4 {
- reg = <4>;
- label = "lan5";
- phy-handle = <&phy4>;
- phy-mode = "qsgmii";
- };
- port@5 {
- reg = <5>;
- label = "lan6";
- phy-handle = <&phy5>;
- phy-mode = "qsgmii";
- };
- port@6 {
- reg = <6>;
- label = "lan7";
- phy-handle = <&phy6>;
- phy-mode = "qsgmii";
- };
- port@7 {
- reg = <7>;
- label = "lan8";
- phy-handle = <&phy7>;
- phy-mode = "qsgmii";
- };
- port@8 {
- reg = <8>;
- label = "lan9";
- phy-handle = <&phy8>;
- phy-mode = "internal";
- };
- port@9 {
- reg = <9>;
- label = "lan10";
- phy-handle = <&phy9>;
- phy-mode = "internal";
- };
- port@10 {
- reg = <10>;
- label = "lan11";
- phy-handle = <&phy10>;
- phy-mode = "internal";
- };
- port@11 {
- reg = <11>;
- label = "lan12";
- phy-handle = <&phy11>;
- phy-mode = "internal";
- };
- port@12 {
- reg = <12>;
- label = "lan13";
- phy-handle = <&phy12>;
- phy-mode = "internal";
- };
- port@13 {
- reg = <13>;
- label = "lan14";
- phy-handle = <&phy13>;
- phy-mode = "internal";
- };
- port@14 {
- reg = <14>;
- label = "lan15";
- phy-handle = <&phy14>;
- phy-mode = "internal";
- };
- port@15 {
- reg = <15>;
- label = "lan16";
- phy-handle = <&phy15>;
- phy-mode = "internal";
- };
+ SWITCH_PORT(0, 1, qsgmii)
+ SWITCH_PORT(1, 2, qsgmii)
+ SWITCH_PORT(2, 3, qsgmii)
+ SWITCH_PORT(3, 4, qsgmii)
+ SWITCH_PORT(4, 5, qsgmii)
+ SWITCH_PORT(5, 6, qsgmii)
+ SWITCH_PORT(6, 7, qsgmii)
+ SWITCH_PORT(7, 8, qsgmii)
+
+ SWITCH_PORT(8, 9, internal)
+ SWITCH_PORT(9, 10, internal)
+ SWITCH_PORT(10, 11, internal)
+ SWITCH_PORT(11, 12, internal)
+ SWITCH_PORT(12, 13, internal)
+ SWITCH_PORT(13, 14, internal)
+ SWITCH_PORT(14, 15, internal)
+ SWITCH_PORT(15, 16, internal)
+
+ SWITCH_PORT(24, 17, qsgmii)
+ SWITCH_PORT(25, 18, qsgmii)
+ SWITCH_PORT(26, 19, qsgmii)
+ SWITCH_PORT(27, 20, qsgmii)
- port@24 {
- reg = <24>;
- label = "lan17";
- phy-handle = <&phy24>;
- phy-mode = "qsgmii";
- };
- port@25 {
- reg = <25>;
- label = "lan18";
- phy-handle = <&phy25>;
- phy-mode = "qsgmii";
- };
- port@26 {
- reg = <26>;
- label = "lan19";
- phy-handle = <&phy26>;
- phy-mode = "qsgmii";
- };
- port@27 {
- reg = <27>;
- label = "lan20";
- phy-handle = <&phy27>;
- phy-mode = "qsgmii";
- };
port@28 {
ethernet = <&ethernet0>;
reg = <28>;
diff --git a/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-28.dts b/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-28.dts
index f154ca963d..edd4fb140f 100644
--- a/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-28.dts
+++ b/target/linux/rtl838x/dts/rtl8382_d-link_dgs-1210-28.dts
@@ -14,141 +14,37 @@
#address-cells = <1>;
#size-cells = <0>;
- /* External phy RTL8218B */
- phy0: ethernet-phy@0 {
- reg = <0>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy1: ethernet-phy@1 {
- reg = <1>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy2: ethernet-phy@2 {
- reg = <2>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy3: ethernet-phy@3 {
- reg = <3>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy4: ethernet-phy@4 {
- reg = <4>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy5: ethernet-phy@5 {
- reg = <5>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy6: ethernet-phy@6 {
- reg = <6>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy7: ethernet-phy@7 {
- reg = <7>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
+ EXTERNAL_PHY(0)
+ EXTERNAL_PHY(1)
+ EXTERNAL_PHY(2)
+ EXTERNAL_PHY(3)
+ EXTERNAL_PHY(4)
+ EXTERNAL_PHY(5)
+ EXTERNAL_PHY(6)
+ EXTERNAL_PHY(7)
- /* Internal phy RTL8218B */
- phy8: ethernet-phy@8 {
- reg = <8>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy9: ethernet-phy@9 {
- reg = <9>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy10: ethernet-phy@10 {
- reg = <10>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy11: ethernet-phy@11 {
- reg = <11>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy12: ethernet-phy@12 {
- reg = <12>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy13: ethernet-phy@13 {
- reg = <13>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy14: ethernet-phy@14 {
- reg = <14>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
- phy15: ethernet-phy@15 {
- reg = <15>;
- compatible = "ethernet-phy-ieee802.3-c22";
- phy-is-integrated;
- };
+ INTERNAL_PHY(8)
+ INTERNAL_PHY(9)
+ INTERNAL_PHY(10)
+ INTERNAL_PHY(11)
+ INTERNAL_PHY(12)
+ INTERNAL_PHY(13)
+ INTERNAL_PHY(14)
+ INTERNAL_PHY(15)
- /* External phy RTL8218B */
- phy16: ethernet-phy@16 {
- reg = <16>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy17: ethernet-phy@17 {
- reg = <17>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy18: ethernet-phy@18 {
- reg = <18>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy19: ethernet-phy@19 {
- reg = <19>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy20: ethernet-phy@20 {
- reg = <20>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy21: ethernet-phy@21 {
- reg = <21>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy22: ethernet-phy@22 {
- reg = <22>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
- phy23: ethernet-phy@23 {
- reg = <23>;
- compatible = "ethernet-phy-ieee802.3-c22";
- };
+ EXTERNAL_PHY(16)
+ EXTERNAL_PHY(17)
+ EXTERNAL_PHY(18)
+ EXTERNAL_PHY(19)
+ EXTERNAL_PHY(20)
+ EXTERNAL_PHY(21)
+ EXTERNAL_PHY(22)
+ EXTERNAL_PHY(23)
- /* External phy: RTL8214FC */
- phy24: ethernet-phy@24 {
- compatible = "ethernet-phy-ieee802.3-c22";
- sfp;
- media = "fibre";
- reg = <24>;
- };
- phy25: ethernet-phy@25 {
- compatible = "ethernet-phy-ieee802.3-c22";
- sfp;
- media = "fibre";
- reg = <25>;
- };
- phy26: ethernet-phy@26 {
- compatible = "ethernet-phy-ieee802.3-c22";
- sfp;
- media = "fibre";
- reg = <26>;
- };
- phy27: ethernet-phy@27 {
- compatible = "ethernet-phy-ieee802.3-c22";
- sfp;
- media = "fibre";
- reg = <27>;
- };
+ EXTERNAL_SFP_PHY(24)
+ EXTERNAL_SFP_PHY(25)
+ EXTERNAL_SFP_PHY(26)
+ EXTERNAL_SFP_PHY(27)
};
};
@@ -157,175 +53,38 @@
#address-cells = <1>;
#size-cells = <0>;
- port@0 {
- reg = <0>;
- label = "lan1";
- phy-handle = <&phy0>;
- phy-mode = "qsgmii";
- };
- port@1 {
- reg = <1>;
- label = "lan2";
- phy-handle = <&phy1>;
- phy-mode = "qsgmii";
- };
- port@2 {
- reg = <2>;
- label = "lan3";
- phy-handle = <&phy2>;
- phy-mode = "qsgmii";
- };
- port@3 {
- reg = <3>;
- label = "lan4";
- phy-handle = <&phy3>;
- phy-mode = "qsgmii";
- };
- port@4 {
- reg = <4>;
- label = "lan5";
- phy-handle = <&phy4>;
- phy-mode = "qsgmii";
- };
- port@5 {
- reg = <5>;
- label = "lan6";
- phy-handle = <&phy5>;
- phy-mode = "qsgmii";
- };
- port@6 {
- reg = <6>;
- label = "lan7";
- phy-handle = <&phy6>;
- phy-mode = "qsgmii";
- };
- port@7 {
- reg = <7>;
- label = "lan8";
- phy-handle = <&phy7>;
- phy-mode = "qsgmii";
- };
- port@8 {
- reg = <8>;
- label = "lan9";
- phy-handle = <&phy8>;
- phy-mode = "internal";
- };
- port@9 {
- reg = <9>;
- label = "lan10";
- phy-handle = <&phy9>;
- phy-mode = "internal";
- };
- port@10 {
- reg = <10>;
- label = "lan11";
- phy-handle = <&phy10>;
- phy-mode = "internal";
- };
- port@11 {
- reg = <11>;
- label = "lan12";
- phy-handle = <&phy11>;
- phy-mode = "internal";
- };
- port@12 {
- reg = <12>;
- label = "lan13";
- phy-handle = <&phy12>;
- phy-mode = "internal";
- };
- port@13 {
- reg = <13>;
- label = "lan14";
- phy-handle = <&phy13>;
- phy-mode = "internal";
- };
- port@14 {
- reg = <14>;
- label = "lan15";
- phy-handle = <&phy14>;
- phy-mode = "internal";
- };
- port@15 {
- reg = <15>;
- label = "lan16";
- phy-handle = <&phy15>;
- phy-mode = "internal";
- };
- port@16 {
- reg = <16>;
- label = "lan17";
- phy-handle = <&phy16>;
- phy-mode = "qsgmii";
- };
- port@17 {
- reg = <17>;
- label = "lan18";
- phy-handle = <&phy17>;
- phy-mode = "qsgmii";
- };
- port@18 {
- reg = <18>;
- label = "lan19";
- phy-handle = <&phy18>;
- phy-mode = "qsgmii";
- };
- port@19 {
- reg = <19>;
- label = "lan20";
- phy-handle = <&phy19>;
- phy-mode = "qsgmii";
- };
- port@20 {
- reg = <20>;
- label = "lan21";
- phy-handle = <&phy20>;
- phy-mode = "qsgmii";
- };
- port@21 {
- reg = <21>;
- label = "lan22";
- phy-handle = <&phy21>;
- phy-mode = "qsgmii";
- };
- port@22 {
- reg = <22>;
- label = "lan23";
- phy-handle = <&phy22>;
- phy-mode = "qsgmii";
- };
- port@23 {
- reg = <23>;
- label = "lan24";
- phy-handle = <&phy23>;
- phy-mode = "qsgmii";
- };
+ SWITCH_PORT(0, 1, qsgmii)
+ SWITCH_PORT(1, 2, qsgmii)
+ SWITCH_PORT(2, 3, qsgmii)
+ SWITCH_PORT(3, 4, qsgmii)
+ SWITCH_PORT(4, 5, qsgmii)
+ SWITCH_PORT(5, 6, qsgmii)
+ SWITCH_PORT(6, 7, qsgmii)
+ SWITCH_PORT(7, 8, qsgmii)
+
+ SWITCH_PORT(8, 9, internal)
+ SWITCH_PORT(9, 10, internal)
+ SWITCH_PORT(10, 11, internal)
+ SWITCH_PORT(11, 12, internal)
+ SWITCH_PORT(12, 13, internal)
+ SWITCH_PORT(13, 14, internal)
+ SWITCH_PORT(14, 15, internal)
+ SWITCH_PORT(15, 16, internal)
+
+ SWITCH_PORT(16, 17, qsgmii)
+ SWITCH_PORT(17, 18, qsgmii)
+ SWITCH_PORT(18, 19, qsgmii)
+ SWITCH_PORT(19, 20, qsgmii)
+ SWITCH_PORT(20, 21, qsgmii)
+ SWITCH_PORT(21, 22, qsgmii)
+ SWITCH_PORT(22, 23, qsgmii)
+ SWITCH_PORT(23, 24, qsgmii)
+
+ SWITCH_PORT(24, 25, qsgmii)
+ SWITCH_PORT(25, 26, qsgmii)
+ SWITCH_PORT(26, 27, qsgmii)
+ SWITCH_PORT(27, 28, qsgmii)
- port@24 {
- reg = <24>;
- label = "lan25";
- phy-handle = <&phy24>;
- phy-mode = "qsgmii";
- };
- port@25 {
- reg = <25>;
- label = "lan26";
- phy-handle = <&phy25>;
- phy-mode = "qsgmii";
- };
- port@26 {
- reg = <26>;
- label = "lan27";
- phy-handle = <&phy26>;
- phy-mode = "qsgmii";
- };
- port@27 {
- reg = <27>;
- label = "lan28";
- phy-handle = <&phy27>;
- phy-mode = "qsgmii";
- };
port@28 {
ethernet = <&ethernet0>;
reg = <28>;
diff --git a/target/linux/rtl838x/dts/rtl838x.dtsi b/target/linux/rtl838x/dts/rtl838x.dtsi
index 99c324bf52..37bbcefd44 100644
--- a/target/linux/rtl838x/dts/rtl838x.dtsi
+++ b/target/linux/rtl838x/dts/rtl838x.dtsi
@@ -2,6 +2,39 @@
/dts-v1/;
+#define STRINGIZE(s) #s
+#define LAN_LABEL(p, s) STRINGIZE(p ## s)
+#define SWITCH_PORT_LABEL(n) LAN_LABEL(lan, n)
+
+#define INTERNAL_PHY(n) \
+ phy##n: ethernet-phy@##n { \
+ reg = <##n>; \
+ compatible = "ethernet-phy-ieee802.3-c22"; \
+ phy-is-integrated; \
+ };
+
+#define EXTERNAL_PHY(n) \
+ phy##n: ethernet-phy@##n { \
+ reg = <##n>; \
+ compatible = "ethernet-phy-ieee802.3-c22"; \
+ };
+
+#define EXTERNAL_SFP_PHY(n) \
+ phy##n: ethernet-phy@##n { \
+ compatible = "ethernet-phy-ieee802.3-c22"; \
+ sfp; \
+ media = "fibre"; \
+ reg = <##n>; \
+ };
+
+#define SWITCH_PORT(n, s, m) \
+ port@##n { \
+ reg = <##n>; \
+ label = SWITCH_PORT_LABEL(s) ; \
+ phy-handle = <&phy##n>; \
+ phy-mode = #m ; \
+ };
+
/ {
#address-cells = <1>;
#size-cells = <1>;