From bf055fcdca155993b9b6c82f951000eefb13288a Mon Sep 17 00:00:00 2001
From: David Bauer <mail@david-bauer.net>
Date: Mon, 6 Mar 2023 21:27:49 +0100
Subject: [PATCH] ipq40xx: convert Netgear EX6100/EX6150 v2 to DSA

Signed-off-by: David Bauer <mail@david-bauer.net>
---
 .../ipq40xx/base-files/etc/board.d/02_network      |  4 +++-
 .../arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi   | 14 ++++++++++++++
 target/linux/ipq40xx/image/generic.mk              |  6 ++----
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index e5789d15b9..3625938e38 100644
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -50,7 +50,9 @@ ipq40xx_setup_interfaces()
 	meraki,mr33|\
 	meraki,mr74|\
 	mikrotik,lhgg-60ad|\
-	mikrotik,sxtsq-5-ac)
+	mikrotik,sxtsq-5-ac|\
+	netgear,ex6100v2|\
+	netgear,ex6150v2)
 		ucidef_set_interface_lan "lan"
 		;;
 	avm,fritzbox-7530)
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
index ddb2c9bd03..dc5c25c84a 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi
@@ -65,6 +65,7 @@
 		led-failsafe = &power_amber;
 		led-running = &power_green;
 		led-upgrade = &power_amber;
+		label-mac-device = &gmac;
 	};
 
 	keys {
@@ -323,3 +324,16 @@
 	nvmem-cell-names = "pre-calibration", "mac-address";
 	nvmem-cells = <&precal_art_5000>, <&macaddr_dnidata_c>;
 };
+
+&gmac {
+	status = "okay";
+};
+
+&switch {
+	status = "okay";
+};
+
+&swport4 {
+	status = "okay";
+	label = "lan";
+};
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index a145f05358..a0ad63cfce 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -814,16 +814,14 @@ define Device/netgear_ex6100v2
 	DEVICE_MODEL := EX6100
 	DEVICE_VARIANT := v2
 endef
-# Missing DSA Setup
-#TARGET_DEVICES += netgear_ex6100v2
+TARGET_DEVICES += netgear_ex6100v2
 
 define Device/netgear_ex6150v2
 	$(call Device/netgear_ex61x0v2)
 	DEVICE_MODEL := EX6150
 	DEVICE_VARIANT := v2
 endef
-# Missing DSA Setup
-#TARGET_DEVICES += netgear_ex6150v2
+TARGET_DEVICES += netgear_ex6150v2
 
 define Device/netgear_orbi
 	$(call Device/DniImage)
-- 
2.30.2