[LEDE-DEV] [PATCH RFC 2/2] ramips: dts: add precompiler macro for VLAN defaults

Daniel Golle daniel at makrotopia.org
Wed Feb 22 08:21:15 PST 2017


Add new dt-bindings precompiler include to replace numerical default
VLAN assignments with more meaningful descriptive values, such that
0x3f -> VLAN_CONFIG_LLLLL
0x2f -> VLAN_CONFIG_LLLLW
0x3e -> VLAN_CONFIG_WLLLL

In that we we get the best of both worlds: the usability of having
strings and all the freedom and simplicity of having just an 8-bit
field.

Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
(consider the previous PATCH RFC as 1/2 extended by this one)

 target/linux/ramips/dts/3G-6200N.dts               |  3 ++-
 target/linux/ramips/dts/3G150B.dts                 |  3 ++-
 target/linux/ramips/dts/3G300M.dts                 |  3 ++-
 target/linux/ramips/dts/AI-BR100.dts               |  3 ++-
 target/linux/ramips/dts/AIR3GII.dts                |  3 ++-
 target/linux/ramips/dts/ALL0239-3G.dts             |  3 ++-
 target/linux/ramips/dts/ALL0256N-4M.dts            |  3 ++-
 target/linux/ramips/dts/ALL0256N-8M.dts            |  3 ++-
 target/linux/ramips/dts/ALL5002.dts                |  3 ++-
 target/linux/ramips/dts/ALL5003.dts                |  3 ++-
 target/linux/ramips/dts/ATP-52B.dts                |  3 ++-
 target/linux/ramips/dts/AWAPN2403.dts              |  3 ++-
 target/linux/ramips/dts/AWM002.dtsi                |  3 ++-
 target/linux/ramips/dts/ArcherC20i.dts             |  3 ++-
 target/linux/ramips/dts/ArcherC50.dts              |  3 ++-
 target/linux/ramips/dts/ArcherMR200.dts            |  3 ++-
 target/linux/ramips/dts/BC2.dts                    |  3 ++-
 target/linux/ramips/dts/BR-6425.dts                |  3 ++-
 target/linux/ramips/dts/BROADWAY.dts               |  3 ++-
 target/linux/ramips/dts/CARAMBOLA.dts              |  3 ++-
 target/linux/ramips/dts/CS-QR10.dts                |  3 ++-
 target/linux/ramips/dts/D105.dts                   |  3 ++-
 target/linux/ramips/dts/D240.dts                   |  3 ++-
 target/linux/ramips/dts/DAP-1350.dts               |  3 ++-
 target/linux/ramips/dts/DB-WRT01.dts               |  3 ++-
 target/linux/ramips/dts/DCS-930.dts                |  3 ++-
 target/linux/ramips/dts/DCS-930L-B1.dts            |  3 ++-
 target/linux/ramips/dts/DIR-300-B1.dts             |  3 ++-
 target/linux/ramips/dts/DIR-300-B7.dts             |  3 ++-
 target/linux/ramips/dts/DIR-320-B1.dts             |  3 ++-
 target/linux/ramips/dts/DIR-600-B1.dts             |  3 ++-
 target/linux/ramips/dts/DIR-610-A1.dts             |  3 ++-
 target/linux/ramips/dts/DIR-615-D.dts              |  3 ++-
 target/linux/ramips/dts/DIR-615-H1.dts             |  3 ++-
 target/linux/ramips/dts/DIR-620-A1.dts             |  3 ++-
 target/linux/ramips/dts/DIR-620-D1.dts             |  3 ++-
 target/linux/ramips/dts/DIR-810L.dts               |  3 ++-
 target/linux/ramips/dts/DWR-512-B.dts              |  3 ++-
 target/linux/ramips/dts/ESR-9753.dts               |  3 ++-
 target/linux/ramips/dts/F5D8235_V2.dts             |  3 ++-
 target/linux/ramips/dts/FONERA20N.dts              |  3 ++-
 target/linux/ramips/dts/GL-MT300A.dts              |  3 ++-
 target/linux/ramips/dts/GL-MT300N.dts              |  3 ++-
 target/linux/ramips/dts/GL-MT750.dts               |  3 ++-
 target/linux/ramips/dts/HC5861.dts                 |  3 ++-
 target/linux/ramips/dts/HC5XXX.dtsi                |  3 ++-
 target/linux/ramips/dts/HG255D.dts                 |  3 ++-
 target/linux/ramips/dts/HW550-3G.dts               |  3 ++-
 target/linux/ramips/dts/IP2202.dts                 |  3 ++-
 target/linux/ramips/dts/JHR-N805R.dts              |  3 ++-
 target/linux/ramips/dts/JHR-N825R.dts              |  3 ++-
 target/linux/ramips/dts/JHR-N926R.dts              |  3 ++-
 target/linux/ramips/dts/M2M.dts                    |  3 ++-
 target/linux/ramips/dts/M3.dts                     |  3 ++-
 target/linux/ramips/dts/M4-4M.dts                  |  3 ++-
 target/linux/ramips/dts/M4-8M.dts                  |  3 ++-
 target/linux/ramips/dts/MAC1200RV2.dts             |  3 ++-
 target/linux/ramips/dts/MINIEMBPLUG.dts            |  3 ++-
 target/linux/ramips/dts/MINIEMBWIFI.dts            |  3 ++-
 target/linux/ramips/dts/MIWIFI-MINI.dts            |  3 ++-
 target/linux/ramips/dts/MLW221.dts                 |  3 ++-
 target/linux/ramips/dts/MLWG2.dts                  |  3 ++-
 target/linux/ramips/dts/MOFI3500-3GN.dts           |  3 ++-
 target/linux/ramips/dts/MPRA1.dts                  |  3 ++-
 target/linux/ramips/dts/MR-102N.dts                |  5 +++--
 target/linux/ramips/dts/MT7620a.dts                |  3 ++-
 target/linux/ramips/dts/MT7620a_MT7530.dts         |  3 ++-
 target/linux/ramips/dts/MT7620a_MT7610e.dts        |  3 ++-
 target/linux/ramips/dts/MT7620a_V22SG.dts          |  3 ++-
 target/linux/ramips/dts/MZK-750DHP.dts             |  3 ++-
 target/linux/ramips/dts/MZK-EX300NP.dts            |  3 ++-
 target/linux/ramips/dts/MZK-EX750NP.dts            |  3 ++-
 target/linux/ramips/dts/MZK-W300NH2.dts            |  3 ++-
 target/linux/ramips/dts/MZK-WDPR.dts               |  3 ++-
 target/linux/ramips/dts/MicroWRT.dts               |  3 ++-
 target/linux/ramips/dts/NA930.dts                  |  3 ++-
 target/linux/ramips/dts/NBG-419N.dts               |  3 ++-
 target/linux/ramips/dts/NBG-419N2.dts              |  3 ++-
 target/linux/ramips/dts/NCS601W.dts                |  3 ++-
 target/linux/ramips/dts/NW718.dts                  |  3 ++-
 target/linux/ramips/dts/OY-0001.dts                |  3 ++-
 target/linux/ramips/dts/PSG1208.dts                |  3 ++-
 target/linux/ramips/dts/PSG1218.dts                |  3 ++-
 target/linux/ramips/dts/PSR-680W.dts               |  3 ++-
 target/linux/ramips/dts/PWH2004.dts                |  3 ++-
 target/linux/ramips/dts/PX-4885.dtsi               |  3 ++-
 target/linux/ramips/dts/RT-G32-B1.dts              |  3 ++-
 target/linux/ramips/dts/RT-N10-PLUS.dts            |  3 ++-
 target/linux/ramips/dts/RT-N13U.dts                |  3 ++-
 target/linux/ramips/dts/RT-N14U.dts                |  3 ++-
 target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts  |  3 ++-
 target/linux/ramips/dts/RT5350F-OLINUXINO.dts      |  3 ++-
 target/linux/ramips/dts/RUT5XX.dts                 |  3 ++-
 target/linux/ramips/dts/SL-R7205.dts               |  3 ++-
 target/linux/ramips/dts/TINY-AC.dts                |  3 ++-
 target/linux/ramips/dts/UR-326N4G.dts              |  3 ++-
 target/linux/ramips/dts/UR-336UN.dts               |  3 ++-
 target/linux/ramips/dts/V22RW-2X2.dts              |  3 ++-
 target/linux/ramips/dts/W150M.dts                  |  3 ++-
 target/linux/ramips/dts/W306R_V20.dts              |  3 ++-
 target/linux/ramips/dts/W502U.dts                  |  3 ++-
 target/linux/ramips/dts/WCR-1166DS.dts             |  3 ++-
 target/linux/ramips/dts/WCR150GN.dts               |  3 ++-
 target/linux/ramips/dts/WHR-300HP2.dts             |  3 ++-
 target/linux/ramips/dts/WHR-600D.dts               |  3 ++-
 target/linux/ramips/dts/WHR-G300N.dts              |  3 ++-
 target/linux/ramips/dts/WIZARD8800.dts             |  3 ++-
 target/linux/ramips/dts/WL-330N.dts                |  3 ++-
 target/linux/ramips/dts/WL-330N3G.dts              |  3 ++-
 target/linux/ramips/dts/WL-341V3.dts               |  3 ++-
 target/linux/ramips/dts/WL-351.dts                 |  3 ++-
 target/linux/ramips/dts/WL-WN575A3.dts             |  3 ++-
 target/linux/ramips/dts/WMR-300.dts                |  3 ++-
 target/linux/ramips/dts/WR512-3GN-4M.dts           |  3 ++-
 target/linux/ramips/dts/WR512-3GN-8M.dts           |  3 ++-
 target/linux/ramips/dts/WR6202.dts                 |  3 ++-
 target/linux/ramips/dts/WRH-300CR.dts              |  3 ++-
 target/linux/ramips/dts/WRTNODE.dts                |  3 ++-
 target/linux/ramips/dts/WRTNODE2.dtsi              |  3 ++-
 target/linux/ramips/dts/WT3020-4M.dts              |  3 ++-
 target/linux/ramips/dts/WT3020-8M.dts              |  3 ++-
 target/linux/ramips/dts/X5.dts                     |  3 ++-
 target/linux/ramips/dts/X8.dts                     |  3 ++-
 target/linux/ramips/dts/XDXRN502J.dts              |  3 ++-
 target/linux/ramips/dts/Y1.dts                     |  3 ++-
 target/linux/ramips/dts/Y1S.dts                    |  3 ++-
 target/linux/ramips/dts/YOUKU-YK1.dts              |  3 ++-
 target/linux/ramips/dts/ZBT-APE522II.dts           |  3 ++-
 target/linux/ramips/dts/ZBT-CPE102.dts             |  3 ++-
 target/linux/ramips/dts/ZBT-WA05.dts               |  3 ++-
 target/linux/ramips/dts/ZBT-WE826.dts              |  3 ++-
 target/linux/ramips/dts/ZBT-WR8305RT.dts           |  3 ++-
 target/linux/ramips/dts/ZTE-Q7.dts                 |  3 ++-
 target/linux/ramips/dts/kn_rc.dts                  |  3 ++-
 target/linux/ramips/dts/kn_rf.dts                  |  3 ++-
 .../include/dt-bindings/net/mtk-soc-eth.h          | 25 ++++++++++++++++++++++
 136 files changed, 296 insertions(+), 136 deletions(-)
 create mode 100644 target/linux/ramips/files-4.9/include/dt-bindings/net/mtk-soc-eth.h

diff --git a/target/linux/ramips/dts/3G-6200N.dts b/target/linux/ramips/dts/3G-6200N.dts
index 502020e5d1..fadad49e6a 100644
--- a/target/linux/ramips/dts/3G-6200N.dts
+++ b/target/linux/ramips/dts/3G-6200N.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -99,7 +100,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/3G150B.dts b/target/linux/ramips/dts/3G150B.dts
index e242e3360e..e22feb61b0 100644
--- a/target/linux/ramips/dts/3G150B.dts
+++ b/target/linux/ramips/dts/3G150B.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -100,7 +101,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/3G300M.dts b/target/linux/ramips/dts/3G300M.dts
index 8ca8d15446..0102d87127 100644
--- a/target/linux/ramips/dts/3G300M.dts
+++ b/target/linux/ramips/dts/3G300M.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -111,7 +112,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/AI-BR100.dts b/target/linux/ramips/dts/AI-BR100.dts
index 2e95376ae9..3a83f235f8 100644
--- a/target/linux/ramips/dts/AI-BR100.dts
+++ b/target/linux/ramips/dts/AI-BR100.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -100,7 +101,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/AIR3GII.dts b/target/linux/ramips/dts/AIR3GII.dts
index e9c1434734..adb9cfaa9f 100644
--- a/target/linux/ramips/dts/AIR3GII.dts
+++ b/target/linux/ramips/dts/AIR3GII.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -89,7 +90,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/ALL0239-3G.dts b/target/linux/ramips/dts/ALL0239-3G.dts
index 7957bad2f9..1313c8ec22 100644
--- a/target/linux/ramips/dts/ALL0239-3G.dts
+++ b/target/linux/ramips/dts/ALL0239-3G.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -106,7 +107,7 @@
 
 &esw {
 	status = "okay";
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/ALL0256N-4M.dts b/target/linux/ramips/dts/ALL0256N-4M.dts
index b4d421fc29..0708240a58 100644
--- a/target/linux/ramips/dts/ALL0256N-4M.dts
+++ b/target/linux/ramips/dts/ALL0256N-4M.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -94,7 +95,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/ALL0256N-8M.dts b/target/linux/ramips/dts/ALL0256N-8M.dts
index 704e60625f..47d52f0bb2 100644
--- a/target/linux/ramips/dts/ALL0256N-8M.dts
+++ b/target/linux/ramips/dts/ALL0256N-8M.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -94,7 +95,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/ALL5002.dts b/target/linux/ramips/dts/ALL5002.dts
index ddfe811d9d..c561923a76 100644
--- a/target/linux/ramips/dts/ALL5002.dts
+++ b/target/linux/ramips/dts/ALL5002.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3352.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "ALL5002", "ralink,rt3352-soc";
@@ -95,7 +96,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/ALL5003.dts b/target/linux/ramips/dts/ALL5003.dts
index f507aa91b2..c9ac66799e 100644
--- a/target/linux/ramips/dts/ALL5003.dts
+++ b/target/linux/ramips/dts/ALL5003.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "ALL5003", "ralink,rt5350-soc";
@@ -95,7 +96,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/ATP-52B.dts b/target/linux/ramips/dts/ATP-52B.dts
index 7e872985dd..46e24942fb 100644
--- a/target/linux/ramips/dts/ATP-52B.dts
+++ b/target/linux/ramips/dts/ATP-52B.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -87,7 +88,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/AWAPN2403.dts b/target/linux/ramips/dts/AWAPN2403.dts
index 06bfac0578..d2edd85fc8 100644
--- a/target/linux/ramips/dts/AWAPN2403.dts
+++ b/target/linux/ramips/dts/AWAPN2403.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -76,7 +77,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/AWM002.dtsi b/target/linux/ramips/dts/AWM002.dtsi
index 9ff64917ea..cb44bf6365 100644
--- a/target/linux/ramips/dts/AWM002.dtsi
+++ b/target/linux/ramips/dts/AWM002.dtsi
@@ -1,4 +1,5 @@
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "AWM002", "ralink,rt5350-soc";
@@ -64,7 +65,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLL>;
 };
 
 &ehci {
diff --git a/target/linux/ramips/dts/ArcherC20i.dts b/target/linux/ramips/dts/ArcherC20i.dts
index 207e1144a6..a4da86a6a0 100644
--- a/target/linux/ramips/dts/ArcherC20i.dts
+++ b/target/linux/ramips/dts/ArcherC20i.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -120,7 +121,7 @@
 &ethernet {
 		pinctrl-names = "default";
 		mtd-mac-address = <&rom 0xf100>;
-		mediatek,portmap = <0x3e>;
+		mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 	};
 
 &ehci {
diff --git a/target/linux/ramips/dts/ArcherC50.dts b/target/linux/ramips/dts/ArcherC50.dts
index 7fda22d3e5..52b7fccf3c 100644
--- a/target/linux/ramips/dts/ArcherC50.dts
+++ b/target/linux/ramips/dts/ArcherC50.dts
@@ -3,6 +3,7 @@
 #include <dt-bindings/gpio/gpio.h>
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "ralink,mt7620a-soc";
@@ -151,7 +152,7 @@
 &ethernet {
 		pinctrl-names = "default";
 		mtd-mac-address = <&rom 0xf100>;
-		mediatek,portmap = <0x3e>;
+		mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 	};
 
 &ehci {
diff --git a/target/linux/ramips/dts/ArcherMR200.dts b/target/linux/ramips/dts/ArcherMR200.dts
index ec2c82bb8b..429c981fab 100644
--- a/target/linux/ramips/dts/ArcherMR200.dts
+++ b/target/linux/ramips/dts/ArcherMR200.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/gpio.h>
 
@@ -161,7 +162,7 @@
 
 &ethernet {
 		mtd-mac-address = <&rom 0xf100>;
-		mediatek,portmap = <0x3f>;
+		mediatek,portmap = <VLAN_CONFIG_LLLLL>;
 	};
 
 &ehci {
diff --git a/target/linux/ramips/dts/BC2.dts b/target/linux/ramips/dts/BC2.dts
index 55cf8964f3..652c0ad592 100644
--- a/target/linux/ramips/dts/BC2.dts
+++ b/target/linux/ramips/dts/BC2.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -77,7 +78,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/BR-6425.dts b/target/linux/ramips/dts/BR-6425.dts
index 1e13c97ada..1099dd1260 100644
--- a/target/linux/ramips/dts/BR-6425.dts
+++ b/target/linux/ramips/dts/BR-6425.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -65,7 +66,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/BROADWAY.dts b/target/linux/ramips/dts/BROADWAY.dts
index 6cfac0f988..c4883a848b 100644
--- a/target/linux/ramips/dts/BROADWAY.dts
+++ b/target/linux/ramips/dts/BROADWAY.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -82,7 +83,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/CARAMBOLA.dts b/target/linux/ramips/dts/CARAMBOLA.dts
index e38c49f957..400f9d5c9d 100644
--- a/target/linux/ramips/dts/CARAMBOLA.dts
+++ b/target/linux/ramips/dts/CARAMBOLA.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "CARAMBOLA", "ralink,rt3050-soc";
@@ -63,7 +64,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/CS-QR10.dts b/target/linux/ramips/dts/CS-QR10.dts
index 29534d01d4..f9fa8ffb1f 100644
--- a/target/linux/ramips/dts/CS-QR10.dts
+++ b/target/linux/ramips/dts/CS-QR10.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -123,7 +124,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &gsw {
diff --git a/target/linux/ramips/dts/D105.dts b/target/linux/ramips/dts/D105.dts
index f7ace49f62..0b974fd86e 100644
--- a/target/linux/ramips/dts/D105.dts
+++ b/target/linux/ramips/dts/D105.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -82,7 +83,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/D240.dts b/target/linux/ramips/dts/D240.dts
index dab9a4aecd..0c890270b8 100644
--- a/target/linux/ramips/dts/D240.dts
+++ b/target/linux/ramips/dts/D240.dts
@@ -34,6 +34,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
@@ -136,7 +137,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/DAP-1350.dts b/target/linux/ramips/dts/DAP-1350.dts
index c3225db952..0e09c0ba19 100644
--- a/target/linux/ramips/dts/DAP-1350.dts
+++ b/target/linux/ramips/dts/DAP-1350.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -115,7 +116,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/DB-WRT01.dts b/target/linux/ramips/dts/DB-WRT01.dts
index 2a2f5f2e3a..9b11721802 100644
--- a/target/linux/ramips/dts/DB-WRT01.dts
+++ b/target/linux/ramips/dts/DB-WRT01.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -83,7 +84,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &gsw {
diff --git a/target/linux/ramips/dts/DCS-930.dts b/target/linux/ramips/dts/DCS-930.dts
index d57682ec7b..b5998b7069 100644
--- a/target/linux/ramips/dts/DCS-930.dts
+++ b/target/linux/ramips/dts/DCS-930.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -103,7 +104,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/DCS-930L-B1.dts b/target/linux/ramips/dts/DCS-930L-B1.dts
index 8ebc1bb3d2..e3ce7a405b 100644
--- a/target/linux/ramips/dts/DCS-930L-B1.dts
+++ b/target/linux/ramips/dts/DCS-930L-B1.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -91,7 +92,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/DIR-300-B1.dts b/target/linux/ramips/dts/DIR-300-B1.dts
index 2ba6ae64c6..51229e4d6d 100644
--- a/target/linux/ramips/dts/DIR-300-B1.dts
+++ b/target/linux/ramips/dts/DIR-300-B1.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -103,7 +104,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/DIR-300-B7.dts b/target/linux/ramips/dts/DIR-300-B7.dts
index 9bb4345e33..0d21ccc5f2 100644
--- a/target/linux/ramips/dts/DIR-300-B7.dts
+++ b/target/linux/ramips/dts/DIR-300-B7.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -91,7 +92,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 	mediatek,led_polarity = <0x17>;
 };
 
diff --git a/target/linux/ramips/dts/DIR-320-B1.dts b/target/linux/ramips/dts/DIR-320-B1.dts
index 0716229835..a1cb7c7e92 100644
--- a/target/linux/ramips/dts/DIR-320-B1.dts
+++ b/target/linux/ramips/dts/DIR-320-B1.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -113,7 +114,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 	mediatek,led_polarity = <0x17>;
 };
 
diff --git a/target/linux/ramips/dts/DIR-600-B1.dts b/target/linux/ramips/dts/DIR-600-B1.dts
index 493d49bb73..f0020027e5 100644
--- a/target/linux/ramips/dts/DIR-600-B1.dts
+++ b/target/linux/ramips/dts/DIR-600-B1.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -103,7 +104,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/DIR-610-A1.dts b/target/linux/ramips/dts/DIR-610-A1.dts
index a70b4604b0..d862168a46 100644
--- a/target/linux/ramips/dts/DIR-610-A1.dts
+++ b/target/linux/ramips/dts/DIR-610-A1.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -92,7 +93,7 @@
 
 &esw {
 	status = "okay";
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 	mediatek,led_polarity = <0x17>;
 };
 
diff --git a/target/linux/ramips/dts/DIR-615-D.dts b/target/linux/ramips/dts/DIR-615-D.dts
index 67705fe3ce..a8331349c7 100644
--- a/target/linux/ramips/dts/DIR-615-D.dts
+++ b/target/linux/ramips/dts/DIR-615-D.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -90,7 +91,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/DIR-615-H1.dts b/target/linux/ramips/dts/DIR-615-H1.dts
index a2873be5da..38f3df28ae 100644
--- a/target/linux/ramips/dts/DIR-615-H1.dts
+++ b/target/linux/ramips/dts/DIR-615-H1.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3352.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -116,7 +117,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/DIR-620-A1.dts b/target/linux/ramips/dts/DIR-620-A1.dts
index 50967b29c2..cbf200f478 100644
--- a/target/linux/ramips/dts/DIR-620-A1.dts
+++ b/target/linux/ramips/dts/DIR-620-A1.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -108,7 +109,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/DIR-620-D1.dts b/target/linux/ramips/dts/DIR-620-D1.dts
index f3079d3703..a308cb9a96 100644
--- a/target/linux/ramips/dts/DIR-620-D1.dts
+++ b/target/linux/ramips/dts/DIR-620-D1.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3352.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -95,7 +96,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/DIR-810L.dts b/target/linux/ramips/dts/DIR-810L.dts
index 374b67172f..aa7e522397 100644
--- a/target/linux/ramips/dts/DIR-810L.dts
+++ b/target/linux/ramips/dts/DIR-810L.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -117,7 +118,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x28>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &gsw {
diff --git a/target/linux/ramips/dts/DWR-512-B.dts b/target/linux/ramips/dts/DWR-512-B.dts
index 42be55e0cf..7015caca1a 100644
--- a/target/linux/ramips/dts/DWR-512-B.dts
+++ b/target/linux/ramips/dts/DWR-512-B.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
@@ -131,7 +132,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &ethernet {
diff --git a/target/linux/ramips/dts/ESR-9753.dts b/target/linux/ramips/dts/ESR-9753.dts
index 59a961d699..c8b5dba3a3 100644
--- a/target/linux/ramips/dts/ESR-9753.dts
+++ b/target/linux/ramips/dts/ESR-9753.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -88,7 +89,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/F5D8235_V2.dts b/target/linux/ramips/dts/F5D8235_V2.dts
index b38dbbb072..9f087201a1 100644
--- a/target/linux/ramips/dts/F5D8235_V2.dts
+++ b/target/linux/ramips/dts/F5D8235_V2.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "F5D8235_V2", "ralink,rt3052-soc";
@@ -106,7 +107,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/FONERA20N.dts b/target/linux/ramips/dts/FONERA20N.dts
index c409f9b01d..e1143a1c48 100644
--- a/target/linux/ramips/dts/FONERA20N.dts
+++ b/target/linux/ramips/dts/FONERA20N.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -94,7 +95,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 
 	port at 0 {
 		compatible = "swconfig,port";
diff --git a/target/linux/ramips/dts/GL-MT300A.dts b/target/linux/ramips/dts/GL-MT300A.dts
index 9cbd689f9a..c29b1702d9 100644
--- a/target/linux/ramips/dts/GL-MT300A.dts
+++ b/target/linux/ramips/dts/GL-MT300A.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -133,7 +134,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4000>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/GL-MT300N.dts b/target/linux/ramips/dts/GL-MT300N.dts
index c4c6ef4085..079e029d85 100644
--- a/target/linux/ramips/dts/GL-MT300N.dts
+++ b/target/linux/ramips/dts/GL-MT300N.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -122,7 +123,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4000>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/GL-MT750.dts b/target/linux/ramips/dts/GL-MT750.dts
index c77e5fdfcb..30fd1369a6 100644
--- a/target/linux/ramips/dts/GL-MT750.dts
+++ b/target/linux/ramips/dts/GL-MT750.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -128,7 +129,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4000>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/HC5861.dts b/target/linux/ramips/dts/HC5861.dts
index abfaa38d72..564fa5b8b7 100644
--- a/target/linux/ramips/dts/HC5861.dts
+++ b/target/linux/ramips/dts/HC5861.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "HC5XXX.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "HC5861", "ralink,mt7620a-soc";
@@ -58,7 +59,7 @@
 	mtd-mac-address = <&factory 0x4>;
 	pinctrl-names = "default";
 	pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 
 	port at 4 {
 		status = "okay";
diff --git a/target/linux/ramips/dts/HC5XXX.dtsi b/target/linux/ramips/dts/HC5XXX.dtsi
index 651fac0c8b..7d23c76c8c 100644
--- a/target/linux/ramips/dts/HC5XXX.dtsi
+++ b/target/linux/ramips/dts/HC5XXX.dtsi
@@ -1,4 +1,5 @@
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -110,7 +111,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &sdhci {
diff --git a/target/linux/ramips/dts/HG255D.dts b/target/linux/ramips/dts/HG255D.dts
index 91426db3c9..2906f0c758 100644
--- a/target/linux/ramips/dts/HG255D.dts
+++ b/target/linux/ramips/dts/HG255D.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -120,7 +121,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/HW550-3G.dts b/target/linux/ramips/dts/HW550-3G.dts
index d5bca44f94..8d0099350c 100644
--- a/target/linux/ramips/dts/HW550-3G.dts
+++ b/target/linux/ramips/dts/HW550-3G.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -104,7 +105,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/IP2202.dts b/target/linux/ramips/dts/IP2202.dts
index 6f26f3b50a..8fdcb16fcc 100644
--- a/target/linux/ramips/dts/IP2202.dts
+++ b/target/linux/ramips/dts/IP2202.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -82,7 +83,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &otg {
diff --git a/target/linux/ramips/dts/JHR-N805R.dts b/target/linux/ramips/dts/JHR-N805R.dts
index 4493b3c30d..8d8cdb5858 100644
--- a/target/linux/ramips/dts/JHR-N805R.dts
+++ b/target/linux/ramips/dts/JHR-N805R.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -80,7 +81,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/JHR-N825R.dts b/target/linux/ramips/dts/JHR-N825R.dts
index 4eab893265..bde353ed37 100644
--- a/target/linux/ramips/dts/JHR-N825R.dts
+++ b/target/linux/ramips/dts/JHR-N825R.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -75,7 +76,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/JHR-N926R.dts b/target/linux/ramips/dts/JHR-N926R.dts
index e5b64c5b96..c46e74b81d 100644
--- a/target/linux/ramips/dts/JHR-N926R.dts
+++ b/target/linux/ramips/dts/JHR-N926R.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -121,7 +122,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/M2M.dts b/target/linux/ramips/dts/M2M.dts
index 74d66d5ff5..66036e38dc 100644
--- a/target/linux/ramips/dts/M2M.dts
+++ b/target/linux/ramips/dts/M2M.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -95,7 +96,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &ehci {
diff --git a/target/linux/ramips/dts/M3.dts b/target/linux/ramips/dts/M3.dts
index 19ccf3ddfa..17faf2f79b 100644
--- a/target/linux/ramips/dts/M3.dts
+++ b/target/linux/ramips/dts/M3.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -87,7 +88,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 	mediatek,led_polarity = <1>;
 };
 
diff --git a/target/linux/ramips/dts/M4-4M.dts b/target/linux/ramips/dts/M4-4M.dts
index 3e147e53b3..65f738ae9e 100644
--- a/target/linux/ramips/dts/M4-4M.dts
+++ b/target/linux/ramips/dts/M4-4M.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -80,7 +81,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 	mediatek,led_polarity = <1>;
 };
 
diff --git a/target/linux/ramips/dts/M4-8M.dts b/target/linux/ramips/dts/M4-8M.dts
index 65a3972d7d..c05b8191a0 100644
--- a/target/linux/ramips/dts/M4-8M.dts
+++ b/target/linux/ramips/dts/M4-8M.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -80,7 +81,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 	mediatek,led_polarity = <1>;
 };
 
diff --git a/target/linux/ramips/dts/MAC1200RV2.dts b/target/linux/ramips/dts/MAC1200RV2.dts
index d9ef5d91d2..6c98041ed6 100644
--- a/target/linux/ramips/dts/MAC1200RV2.dts
+++ b/target/linux/ramips/dts/MAC1200RV2.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7628an.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "mercury,mac1200rv2", "mediatek,mt7628an-soc";
@@ -72,7 +73,7 @@
 &ethernet {
 	pinctrl-names = "default";
 	mtd-mac-address = <&factory 0xd>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/MINIEMBPLUG.dts b/target/linux/ramips/dts/MINIEMBPLUG.dts
index 45616ef28a..9e64f433a1 100644
--- a/target/linux/ramips/dts/MINIEMBPLUG.dts
+++ b/target/linux/ramips/dts/MINIEMBPLUG.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -107,7 +108,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/MINIEMBWIFI.dts b/target/linux/ramips/dts/MINIEMBWIFI.dts
index ccdd40f801..3414e8c6c1 100644
--- a/target/linux/ramips/dts/MINIEMBWIFI.dts
+++ b/target/linux/ramips/dts/MINIEMBWIFI.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -82,7 +83,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/MIWIFI-MINI.dts b/target/linux/ramips/dts/MIWIFI-MINI.dts
index 18a38d08ff..4eeea46c70 100644
--- a/target/linux/ramips/dts/MIWIFI-MINI.dts
+++ b/target/linux/ramips/dts/MIWIFI-MINI.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -119,7 +120,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x28>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/MLW221.dts b/target/linux/ramips/dts/MLW221.dts
index c397d65835..fd85091f5f 100644
--- a/target/linux/ramips/dts/MLW221.dts
+++ b/target/linux/ramips/dts/MLW221.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620n.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -104,7 +105,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/MLWG2.dts b/target/linux/ramips/dts/MLWG2.dts
index 09104e33ef..20e7d7fce2 100644
--- a/target/linux/ramips/dts/MLWG2.dts
+++ b/target/linux/ramips/dts/MLWG2.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620n.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -104,7 +105,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/MOFI3500-3GN.dts b/target/linux/ramips/dts/MOFI3500-3GN.dts
index 23596e0f34..de9dd4d0d6 100644
--- a/target/linux/ramips/dts/MOFI3500-3GN.dts
+++ b/target/linux/ramips/dts/MOFI3500-3GN.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -100,7 +101,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/MPRA1.dts b/target/linux/ramips/dts/MPRA1.dts
index 9762658c72..af4be199e3 100644
--- a/target/linux/ramips/dts/MPRA1.dts
+++ b/target/linux/ramips/dts/MPRA1.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -106,7 +107,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/MR-102N.dts b/target/linux/ramips/dts/MR-102N.dts
index a28deb79ed..37dd6fdda7 100644
--- a/target/linux/ramips/dts/MR-102N.dts
+++ b/target/linux/ramips/dts/MR-102N.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -104,8 +105,8 @@
 
 &esw {
 	status = "okay";
-	#mediatek,portmap = <0x3e>;
-	mediatek,portmap = <0x2f>;
+	#mediatek,portmap = <VLAN_CONFIG_WLLLL>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/MT7620a.dts b/target/linux/ramips/dts/MT7620a.dts
index 073200b0bf..0acefe409d 100644
--- a/target/linux/ramips/dts/MT7620a.dts
+++ b/target/linux/ramips/dts/MT7620a.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -76,7 +77,7 @@
 	status = "okay";
 	pinctrl-names = "default";
 	pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 
 	port at 4 {
 		status = "okay";
diff --git a/target/linux/ramips/dts/MT7620a_MT7530.dts b/target/linux/ramips/dts/MT7620a_MT7530.dts
index 61584de857..b2acaa8dd5 100644
--- a/target/linux/ramips/dts/MT7620a_MT7530.dts
+++ b/target/linux/ramips/dts/MT7620a_MT7530.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc";
@@ -55,7 +56,7 @@
 	status = "okay";
 	pinctrl-names = "default";
 	pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 
 	port at 5 {
 		status = "okay";
diff --git a/target/linux/ramips/dts/MT7620a_MT7610e.dts b/target/linux/ramips/dts/MT7620a_MT7610e.dts
index 7686e8c02e..1ae1ffa6a7 100644
--- a/target/linux/ramips/dts/MT7620a_MT7610e.dts
+++ b/target/linux/ramips/dts/MT7620a_MT7610e.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -71,7 +72,7 @@
 	status = "okay";
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &gsw {
diff --git a/target/linux/ramips/dts/MT7620a_V22SG.dts b/target/linux/ramips/dts/MT7620a_V22SG.dts
index a5dca0c0e9..27c4b3d380 100644
--- a/target/linux/ramips/dts/MT7620a_V22SG.dts
+++ b/target/linux/ramips/dts/MT7620a_V22SG.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -70,7 +71,7 @@
 	status = "okay";
 	pinctrl-names = "default";
 	pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 
 	port at 4 {
 		status = "okay";
diff --git a/target/linux/ramips/dts/MZK-750DHP.dts b/target/linux/ramips/dts/MZK-750DHP.dts
index 34ad680165..27ee48b335 100644
--- a/target/linux/ramips/dts/MZK-750DHP.dts
+++ b/target/linux/ramips/dts/MZK-750DHP.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -103,7 +104,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &gsw {
diff --git a/target/linux/ramips/dts/MZK-EX300NP.dts b/target/linux/ramips/dts/MZK-EX300NP.dts
index 85f56518b1..7d7ec0ad61 100644
--- a/target/linux/ramips/dts/MZK-EX300NP.dts
+++ b/target/linux/ramips/dts/MZK-EX300NP.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -123,7 +124,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/MZK-EX750NP.dts b/target/linux/ramips/dts/MZK-EX750NP.dts
index cf63439450..cfc699b2ad 100644
--- a/target/linux/ramips/dts/MZK-EX750NP.dts
+++ b/target/linux/ramips/dts/MZK-EX750NP.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -128,7 +129,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/MZK-W300NH2.dts b/target/linux/ramips/dts/MZK-W300NH2.dts
index 4b002b7c20..c66b64a21c 100644
--- a/target/linux/ramips/dts/MZK-W300NH2.dts
+++ b/target/linux/ramips/dts/MZK-W300NH2.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -105,7 +106,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/MZK-WDPR.dts b/target/linux/ramips/dts/MZK-WDPR.dts
index ff26b153b6..dad3b07d16 100644
--- a/target/linux/ramips/dts/MZK-WDPR.dts
+++ b/target/linux/ramips/dts/MZK-WDPR.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "MZK-WDPR", "ralink,rt3052-soc";
@@ -74,7 +75,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/MicroWRT.dts b/target/linux/ramips/dts/MicroWRT.dts
index 3921d07004..ba806d19a9 100644
--- a/target/linux/ramips/dts/MicroWRT.dts
+++ b/target/linux/ramips/dts/MicroWRT.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -91,7 +92,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/NA930.dts b/target/linux/ramips/dts/NA930.dts
index 3f934afdb4..a0822ebcab 100644
--- a/target/linux/ramips/dts/NA930.dts
+++ b/target/linux/ramips/dts/NA930.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -132,7 +133,7 @@
 	status = "okay";
 	pinctrl-names = "default";
 	pinctrl-0 = <&rgmii1_pins &mdio_pins>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 
 	port at 4 {
 		status = "okay";
diff --git a/target/linux/ramips/dts/NBG-419N.dts b/target/linux/ramips/dts/NBG-419N.dts
index e19ce34b5c..9d857fa048 100644
--- a/target/linux/ramips/dts/NBG-419N.dts
+++ b/target/linux/ramips/dts/NBG-419N.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -88,7 +89,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/NBG-419N2.dts b/target/linux/ramips/dts/NBG-419N2.dts
index 73143bd642..80229dc701 100644
--- a/target/linux/ramips/dts/NBG-419N2.dts
+++ b/target/linux/ramips/dts/NBG-419N2.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3352.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -102,7 +103,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/NCS601W.dts b/target/linux/ramips/dts/NCS601W.dts
index 3c5097f559..82e5da3724 100644
--- a/target/linux/ramips/dts/NCS601W.dts
+++ b/target/linux/ramips/dts/NCS601W.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "NCS601W", "ralink,rt5350-soc";
@@ -56,7 +57,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/NW718.dts b/target/linux/ramips/dts/NW718.dts
index 60922555d6..86e6e90817 100644
--- a/target/linux/ramips/dts/NW718.dts
+++ b/target/linux/ramips/dts/NW718.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -96,7 +97,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/OY-0001.dts b/target/linux/ramips/dts/OY-0001.dts
index 41939c3c5e..80485b2b5f 100644
--- a/target/linux/ramips/dts/OY-0001.dts
+++ b/target/linux/ramips/dts/OY-0001.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -95,7 +96,7 @@
 &ethernet {
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &gsw {
diff --git a/target/linux/ramips/dts/PSG1208.dts b/target/linux/ramips/dts/PSG1208.dts
index 7a6c7588f8..0452702e6f 100644
--- a/target/linux/ramips/dts/PSG1208.dts
+++ b/target/linux/ramips/dts/PSG1208.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -92,7 +93,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &pcie {
diff --git a/target/linux/ramips/dts/PSG1218.dts b/target/linux/ramips/dts/PSG1218.dts
index 28088f8b08..911ce5afe3 100644
--- a/target/linux/ramips/dts/PSG1218.dts
+++ b/target/linux/ramips/dts/PSG1218.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -98,7 +99,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x28>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &pcie {
diff --git a/target/linux/ramips/dts/PSR-680W.dts b/target/linux/ramips/dts/PSR-680W.dts
index f749a4e589..4a50011d03 100644
--- a/target/linux/ramips/dts/PSR-680W.dts
+++ b/target/linux/ramips/dts/PSR-680W.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -81,7 +82,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/PWH2004.dts b/target/linux/ramips/dts/PWH2004.dts
index 18ee7426f4..61929e4e26 100644
--- a/target/linux/ramips/dts/PWH2004.dts
+++ b/target/linux/ramips/dts/PWH2004.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -78,7 +79,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/PX-4885.dtsi b/target/linux/ramips/dts/PX-4885.dtsi
index cb9586d556..6c3dc92fc4 100644
--- a/target/linux/ramips/dts/PX-4885.dtsi
+++ b/target/linux/ramips/dts/PX-4885.dtsi
@@ -1,4 +1,5 @@
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -47,7 +48,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/RT-G32-B1.dts b/target/linux/ramips/dts/RT-G32-B1.dts
index 38d6992f0c..fdfede0b7c 100644
--- a/target/linux/ramips/dts/RT-G32-B1.dts
+++ b/target/linux/ramips/dts/RT-G32-B1.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -77,7 +78,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/RT-N10-PLUS.dts b/target/linux/ramips/dts/RT-N10-PLUS.dts
index cb5a13618d..f40feb6860 100644
--- a/target/linux/ramips/dts/RT-N10-PLUS.dts
+++ b/target/linux/ramips/dts/RT-N10-PLUS.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -74,7 +75,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/RT-N13U.dts b/target/linux/ramips/dts/RT-N13U.dts
index 9625415b73..ef2754f9ea 100644
--- a/target/linux/ramips/dts/RT-N13U.dts
+++ b/target/linux/ramips/dts/RT-N13U.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -88,7 +89,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/RT-N14U.dts b/target/linux/ramips/dts/RT-N14U.dts
index cc3332d6ad..2920d7e4e1 100644
--- a/target/linux/ramips/dts/RT-N14U.dts
+++ b/target/linux/ramips/dts/RT-N14U.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620n.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -110,7 +111,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts b/target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts
index dbd2cf6ad4..4e231009f3 100644
--- a/target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts
+++ b/target/linux/ramips/dts/RT5350F-OLINUXINO-EVB.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "RT5350F-OLINUXINO-EVB", "ralink,rt5350-soc";
@@ -82,7 +83,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 	mediatek,led_polarity = <0x17>;
 };
 
diff --git a/target/linux/ramips/dts/RT5350F-OLINUXINO.dts b/target/linux/ramips/dts/RT5350F-OLINUXINO.dts
index a4f1aa7455..756f4c8c52 100644
--- a/target/linux/ramips/dts/RT5350F-OLINUXINO.dts
+++ b/target/linux/ramips/dts/RT5350F-OLINUXINO.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "RT5350F-OLINUXINO", "ralink,rt5350-soc";
@@ -60,7 +61,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 	mediatek,led_polarity = <0x17>;
 };
 
diff --git a/target/linux/ramips/dts/RUT5XX.dts b/target/linux/ramips/dts/RUT5XX.dts
index 7a09d43125..02245cf908 100644
--- a/target/linux/ramips/dts/RUT5XX.dts
+++ b/target/linux/ramips/dts/RUT5XX.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -80,7 +81,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/SL-R7205.dts b/target/linux/ramips/dts/SL-R7205.dts
index 7b6dc990e2..41445ed132 100644
--- a/target/linux/ramips/dts/SL-R7205.dts
+++ b/target/linux/ramips/dts/SL-R7205.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -83,7 +84,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/TINY-AC.dts b/target/linux/ramips/dts/TINY-AC.dts
index 082318b4d2..6986cbcc95 100644
--- a/target/linux/ramips/dts/TINY-AC.dts
+++ b/target/linux/ramips/dts/TINY-AC.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -112,7 +113,7 @@
 	status = "okay";
 	pinctrl-names = "default";
 	pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 
 	port at 4 {
 		status = "okay";
diff --git a/target/linux/ramips/dts/UR-326N4G.dts b/target/linux/ramips/dts/UR-326N4G.dts
index 4246fa4f37..2c7fbe9d84 100644
--- a/target/linux/ramips/dts/UR-326N4G.dts
+++ b/target/linux/ramips/dts/UR-326N4G.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -103,7 +104,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/UR-336UN.dts b/target/linux/ramips/dts/UR-336UN.dts
index 67def7ce7c..565cc777ba 100644
--- a/target/linux/ramips/dts/UR-336UN.dts
+++ b/target/linux/ramips/dts/UR-336UN.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -81,7 +82,7 @@
 };
 */
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 /* FIXME: no partitions defined */
diff --git a/target/linux/ramips/dts/V22RW-2X2.dts b/target/linux/ramips/dts/V22RW-2X2.dts
index 29d14c2e5f..a4db72747f 100644
--- a/target/linux/ramips/dts/V22RW-2X2.dts
+++ b/target/linux/ramips/dts/V22RW-2X2.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -84,7 +85,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/W150M.dts b/target/linux/ramips/dts/W150M.dts
index 9ac84a0f4b..631a5f2f2b 100644
--- a/target/linux/ramips/dts/W150M.dts
+++ b/target/linux/ramips/dts/W150M.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -108,7 +109,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/W306R_V20.dts b/target/linux/ramips/dts/W306R_V20.dts
index ff5ca59ad6..4505c53cfc 100644
--- a/target/linux/ramips/dts/W306R_V20.dts
+++ b/target/linux/ramips/dts/W306R_V20.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -82,7 +83,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/W502U.dts b/target/linux/ramips/dts/W502U.dts
index 1de6ffa337..4c7d84a1ae 100644
--- a/target/linux/ramips/dts/W502U.dts
+++ b/target/linux/ramips/dts/W502U.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -92,7 +93,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/WCR-1166DS.dts b/target/linux/ramips/dts/WCR-1166DS.dts
index 34734ceda5..222dfd3a9a 100644
--- a/target/linux/ramips/dts/WCR-1166DS.dts
+++ b/target/linux/ramips/dts/WCR-1166DS.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7628an.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
@@ -85,7 +86,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 	mediatek,portdisable = <0x27>;
 };
 
diff --git a/target/linux/ramips/dts/WCR150GN.dts b/target/linux/ramips/dts/WCR150GN.dts
index b47dd8b4af..13184fb7ed 100644
--- a/target/linux/ramips/dts/WCR150GN.dts
+++ b/target/linux/ramips/dts/WCR150GN.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -88,7 +89,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/WHR-300HP2.dts b/target/linux/ramips/dts/WHR-300HP2.dts
index 793bf03aec..6b83a3e969 100644
--- a/target/linux/ramips/dts/WHR-300HP2.dts
+++ b/target/linux/ramips/dts/WHR-300HP2.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -137,7 +138,7 @@
 &ethernet {
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &gsw {
diff --git a/target/linux/ramips/dts/WHR-600D.dts b/target/linux/ramips/dts/WHR-600D.dts
index d01a3d2c34..348b48c419 100644
--- a/target/linux/ramips/dts/WHR-600D.dts
+++ b/target/linux/ramips/dts/WHR-600D.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -133,7 +134,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &gsw {
diff --git a/target/linux/ramips/dts/WHR-G300N.dts b/target/linux/ramips/dts/WHR-G300N.dts
index c0779e25bd..2acb152b43 100644
--- a/target/linux/ramips/dts/WHR-G300N.dts
+++ b/target/linux/ramips/dts/WHR-G300N.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -78,7 +79,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 /* FIXME: no partitions defined */
diff --git a/target/linux/ramips/dts/WIZARD8800.dts b/target/linux/ramips/dts/WIZARD8800.dts
index 623e351104..e3fd6676c2 100644
--- a/target/linux/ramips/dts/WIZARD8800.dts
+++ b/target/linux/ramips/dts/WIZARD8800.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "WIZARD8800", "ralink,rt5350-soc";
@@ -64,7 +65,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &ehci {
diff --git a/target/linux/ramips/dts/WL-330N.dts b/target/linux/ramips/dts/WL-330N.dts
index 3095e24510..63026eed19 100644
--- a/target/linux/ramips/dts/WL-330N.dts
+++ b/target/linux/ramips/dts/WL-330N.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -91,7 +92,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/WL-330N3G.dts b/target/linux/ramips/dts/WL-330N3G.dts
index 948d37dc98..4fa9eb8745 100644
--- a/target/linux/ramips/dts/WL-330N3G.dts
+++ b/target/linux/ramips/dts/WL-330N3G.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -96,7 +97,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/WL-341V3.dts b/target/linux/ramips/dts/WL-341V3.dts
index e8b6d689de..04bffde245 100644
--- a/target/linux/ramips/dts/WL-341V3.dts
+++ b/target/linux/ramips/dts/WL-341V3.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -113,7 +114,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/WL-351.dts b/target/linux/ramips/dts/WL-351.dts
index 0c65f2f45c..1b3ffba6b3 100644
--- a/target/linux/ramips/dts/WL-351.dts
+++ b/target/linux/ramips/dts/WL-351.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -104,7 +105,7 @@
 
 &esw {
 	ralink,rgmii = <1>;
-	mediatek,portmap = <0x3f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLL>;
 	ralink,fct2 = <0x0002500c>;
 	/*
 	 * ext phy base addr 31, rx/tx clock skew 0,
diff --git a/target/linux/ramips/dts/WL-WN575A3.dts b/target/linux/ramips/dts/WL-WN575A3.dts
index 0285ec1509..e3a1b67946 100644
--- a/target/linux/ramips/dts/WL-WN575A3.dts
+++ b/target/linux/ramips/dts/WL-WN575A3.dts
@@ -3,6 +3,7 @@
 #include <dt-bindings/gpio/gpio.h>
 
 #include "mt7628an.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "wavlink,wl-wn575a3", "mediatek,mt7628an-soc";
@@ -125,5 +126,5 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x2e>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
diff --git a/target/linux/ramips/dts/WMR-300.dts b/target/linux/ramips/dts/WMR-300.dts
index ccac37be10..936623383d 100644
--- a/target/linux/ramips/dts/WMR-300.dts
+++ b/target/linux/ramips/dts/WMR-300.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620n.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -88,7 +89,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/WR512-3GN-4M.dts b/target/linux/ramips/dts/WR512-3GN-4M.dts
index 966faf2fd5..be9eda0a62 100644
--- a/target/linux/ramips/dts/WR512-3GN-4M.dts
+++ b/target/linux/ramips/dts/WR512-3GN-4M.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -99,7 +100,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/WR512-3GN-8M.dts b/target/linux/ramips/dts/WR512-3GN-8M.dts
index b376a67b58..e5ef857bc7 100644
--- a/target/linux/ramips/dts/WR512-3GN-8M.dts
+++ b/target/linux/ramips/dts/WR512-3GN-8M.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -99,7 +100,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/WR6202.dts b/target/linux/ramips/dts/WR6202.dts
index 1740b188fb..19c8711713 100644
--- a/target/linux/ramips/dts/WR6202.dts
+++ b/target/linux/ramips/dts/WR6202.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -103,7 +104,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/WRH-300CR.dts b/target/linux/ramips/dts/WRH-300CR.dts
index 6c64daf66a..325480f63e 100644
--- a/target/linux/ramips/dts/WRH-300CR.dts
+++ b/target/linux/ramips/dts/WRH-300CR.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620n.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -109,7 +110,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x2e>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/WRTNODE.dts b/target/linux/ramips/dts/WRTNODE.dts
index 0152c797d5..ecef26d8a4 100644
--- a/target/linux/ramips/dts/WRTNODE.dts
+++ b/target/linux/ramips/dts/WRTNODE.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620n.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "wrtnode", "ralink,mt7620n-soc";
@@ -73,7 +74,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/WRTNODE2.dtsi b/target/linux/ramips/dts/WRTNODE2.dtsi
index d9c4e6b06a..63eeb709e7 100644
--- a/target/linux/ramips/dts/WRTNODE2.dtsi
+++ b/target/linux/ramips/dts/WRTNODE2.dtsi
@@ -1,4 +1,5 @@
 #include "mt7628an.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -75,7 +76,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &sdhci {
diff --git a/target/linux/ramips/dts/WT3020-4M.dts b/target/linux/ramips/dts/WT3020-4M.dts
index 88fff785c5..2842f822a4 100644
--- a/target/linux/ramips/dts/WT3020-4M.dts
+++ b/target/linux/ramips/dts/WT3020-4M.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620n.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -84,7 +85,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/WT3020-8M.dts b/target/linux/ramips/dts/WT3020-8M.dts
index f86960350b..f1973ddca4 100644
--- a/target/linux/ramips/dts/WT3020-8M.dts
+++ b/target/linux/ramips/dts/WT3020-8M.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620n.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -84,7 +85,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/X5.dts b/target/linux/ramips/dts/X5.dts
index 9cae72c8fb..ddddb0fe7f 100644
--- a/target/linux/ramips/dts/X5.dts
+++ b/target/linux/ramips/dts/X5.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -119,7 +120,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 	mediatek,led_polarity = <1>;
 };
 
diff --git a/target/linux/ramips/dts/X8.dts b/target/linux/ramips/dts/X8.dts
index de5170e2ad..e6c23eebe1 100644
--- a/target/linux/ramips/dts/X8.dts
+++ b/target/linux/ramips/dts/X8.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt5350.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -80,7 +81,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 	mediatek,led_polarity = <1>;
 };
 
diff --git a/target/linux/ramips/dts/XDXRN502J.dts b/target/linux/ramips/dts/XDXRN502J.dts
index 304da9cf6e..19ee6a8459 100644
--- a/target/linux/ramips/dts/XDXRN502J.dts
+++ b/target/linux/ramips/dts/XDXRN502J.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "rt3050.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -82,7 +83,7 @@
 };
 
 &esw {
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/Y1.dts b/target/linux/ramips/dts/Y1.dts
index af501c284a..a8d2383d20 100644
--- a/target/linux/ramips/dts/Y1.dts
+++ b/target/linux/ramips/dts/Y1.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "Y1.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "lenovo,Y1", "ralink,mt7620a-soc";
@@ -45,5 +46,5 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
diff --git a/target/linux/ramips/dts/Y1S.dts b/target/linux/ramips/dts/Y1S.dts
index 1d95a12363..0b43deb532 100644
--- a/target/linux/ramips/dts/Y1S.dts
+++ b/target/linux/ramips/dts/Y1S.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "Y1.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 / {
 	compatible = "lenovo,Y1S", "ralink,mt7620a-soc";
@@ -72,7 +73,7 @@
 	mtd-mac-address = <&factory 0x4>;
 	pinctrl-names = "default";
 	pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 
 	port at 4 {
 		status = "okay";
diff --git a/target/linux/ramips/dts/YOUKU-YK1.dts b/target/linux/ramips/dts/YOUKU-YK1.dts
index 1763fb431a..d9f20f84ab 100644
--- a/target/linux/ramips/dts/YOUKU-YK1.dts
+++ b/target/linux/ramips/dts/YOUKU-YK1.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -105,7 +106,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/ZBT-APE522II.dts b/target/linux/ramips/dts/ZBT-APE522II.dts
index 07d7ff63fe..847d24a967 100644
--- a/target/linux/ramips/dts/ZBT-APE522II.dts
+++ b/target/linux/ramips/dts/ZBT-APE522II.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -109,7 +110,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/ZBT-CPE102.dts b/target/linux/ramips/dts/ZBT-CPE102.dts
index f609a86954..cf705df245 100644
--- a/target/linux/ramips/dts/ZBT-CPE102.dts
+++ b/target/linux/ramips/dts/ZBT-CPE102.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620n.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -102,7 +103,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/ZBT-WA05.dts b/target/linux/ramips/dts/ZBT-WA05.dts
index 2ed4a35714..6178d783ed 100644
--- a/target/linux/ramips/dts/ZBT-WA05.dts
+++ b/target/linux/ramips/dts/ZBT-WA05.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620n.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -102,7 +103,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/ZBT-WE826.dts b/target/linux/ramips/dts/ZBT-WE826.dts
index c7c5eb070f..b02d0dde8d 100644
--- a/target/linux/ramips/dts/ZBT-WE826.dts
+++ b/target/linux/ramips/dts/ZBT-WE826.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -102,7 +103,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/ZBT-WR8305RT.dts b/target/linux/ramips/dts/ZBT-WR8305RT.dts
index c46165b63e..b4d9e9bf76 100644
--- a/target/linux/ramips/dts/ZBT-WR8305RT.dts
+++ b/target/linux/ramips/dts/ZBT-WR8305RT.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620n.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -94,7 +95,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x2f>;
+	mediatek,portmap = <VLAN_CONFIG_LLLLW>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/ZTE-Q7.dts b/target/linux/ramips/dts/ZTE-Q7.dts
index 099ce51dba..3409a71976 100644
--- a/target/linux/ramips/dts/ZTE-Q7.dts
+++ b/target/linux/ramips/dts/ZTE-Q7.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620a.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/input/input.h>
 
@@ -92,7 +93,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&ephy_pins>;
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/kn_rc.dts b/target/linux/ramips/dts/kn_rc.dts
index d9c33f0288..a0c96d3e76 100644
--- a/target/linux/ramips/dts/kn_rc.dts
+++ b/target/linux/ramips/dts/kn_rc.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620n.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
@@ -115,7 +116,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/dts/kn_rf.dts b/target/linux/ramips/dts/kn_rf.dts
index 11a817f708..18108abbda 100644
--- a/target/linux/ramips/dts/kn_rf.dts
+++ b/target/linux/ramips/dts/kn_rf.dts
@@ -1,6 +1,7 @@
 /dts-v1/;
 
 #include "mt7620n.dtsi"
+#include <dt-bindings/net/mtk-soc-eth.h>
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
@@ -115,7 +116,7 @@
 
 &ethernet {
 	mtd-mac-address = <&factory 0x4>;
-	mediatek,portmap = <0x3e>;
+	mediatek,portmap = <VLAN_CONFIG_WLLLL>;
 };
 
 &wmac {
diff --git a/target/linux/ramips/files-4.9/include/dt-bindings/net/mtk-soc-eth.h b/target/linux/ramips/files-4.9/include/dt-bindings/net/mtk-soc-eth.h
new file mode 100644
index 0000000000..68ee32335c
--- /dev/null
+++ b/target/linux/ramips/files-4.9/include/dt-bindings/net/mtk-soc-eth.h
@@ -0,0 +1,25 @@
+/*
+ * Device Tree constants for MediaTek SoC's Ethernet switch
+ *
+ * Author: Daniel Golle <daniel at makrotopia.org>
+ *
+ * Copyright:   (C) 2017 Daniel Golle
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#ifndef _DT_BINDINGS_MTK_SOC_ETH_H
+#define _DT_BINDINGS_MTK_SOC_ETH_H
+
+#define VLAN_CONFIG_LLLLL 0x3f
+#define VLAN_CONFIG_LLLLW 0x2f
+#define VLAN_CONFIG_WLLLL 0x3e
+
+#endif
-- 
2.11.1




More information about the Lede-dev mailing list