[openwrt/openwrt] ipq40xx: Convert mikrotik,wap-ac to DSA

LEDE Commits lede-commits at lists.infradead.org
Wed Oct 19 14:25:08 PDT 2022


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/9a8e008188a11813a90b77ba32d24c0cca225bf9

commit 9a8e008188a11813a90b77ba32d24c0cca225bf9
Author: Mark Mentovai <mark at mentovai.com>
AuthorDate: Thu Nov 11 12:24:24 2021 -0500

    ipq40xx: Convert mikrotik,wap-ac to DSA
    
    As done previously, this preserves the MAC addresses of they physical
    Ethernet ports. The interfaces are renamed as eth0 is in use for the
    native GMAC; the new interface naming matches the physical port labels.
     - sw-eth1 corresponds to the physical port labeled ETH1 and has the
       base MAC address. This port can be used to power the device.
     - sw-eth2 corresponds to the physical port labeled ETH2 and has a MAC
       address one greater than the base.
    
    As this device has 2 physical ports, they are each connected to their
    respective PHYs, allowing the link status to be visible to software.
    Since they are not marked on the case with any role (such as LAN or
    WAN), both are bridged to the lan network by default, although this can
    easily be changed if needed.
    
    Signed-off-by: Mark Mentovai <mark at mentovai.com>
---
 target/linux/ipq40xx/base-files/etc/board.d/02_network |  7 +++++--
 .../base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh |  4 ++--
 .../files/arch/arm/boot/dts/qcom-ipq4018-wap-ac.dts    | 18 ++++++++++++++++++
 target/linux/ipq40xx/image/mikrotik.mk                 |  3 +--
 4 files changed, 26 insertions(+), 6 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 1089a7f3f8..36f1f7c24a 100644
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -52,11 +52,14 @@ ipq40xx_setup_interfaces()
 	cellc,rtl30vw)
 		ucidef_set_interface_lan "lan1 lan2"
 		;;
+	compex,wpj428)
+		ucidef_set_interface_lan "lan1 lan2"
+		;;
 	glinet,gl-b1300)
 		ucidef_set_interfaces_lan_wan "lan1 lan2" "wan"
 		;;
-	compex,wpj428)
-		ucidef_set_interface_lan "lan1 lan2"
+	mikrotik,wap-ac)
+		ucidef_set_interface_lan "sw-eth1 sw-eth2"
 		;;
 	zte,mf286d)
 		ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" "wan"
diff --git a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh
index 18c24e0511..e4a5eb3e89 100644
--- a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh
+++ b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh
@@ -26,8 +26,8 @@ preinit_set_mac_address() {
 		;;
 	mikrotik,wap-ac)
 		base_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base)
-		ip link set dev eth0 address "$base_mac"
-		ip link set dev eth1 address $(macaddr_add "$base_mac" 1)
+		ip link set dev sw-eth1 address "$base_mac"
+		ip link set dev sw-eth2 address $(macaddr_add "$base_mac" 1)
 		;;
 	zyxel,nbg6617)
 		base_mac=$(cat /sys/class/net/eth0/address)
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wap-ac.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wap-ac.dts
index e6a6202216..ecbdfac15f 100644
--- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wap-ac.dts
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-wap-ac.dts
@@ -187,6 +187,24 @@
 	status = "okay";
 };
 
+&gmac {
+	status = "okay";
+};
+
+&switch {
+	status = "okay";
+};
+
+&swport4 {
+	status = "okay";
+	label = "sw-eth2";
+};
+
+&swport5 {
+	status = "okay";
+	label = "sw-eth1";
+};
+
 &wifi0 {
 	status = "okay";
 
diff --git a/target/linux/ipq40xx/image/mikrotik.mk b/target/linux/ipq40xx/image/mikrotik.mk
index 8491ff4a42..d1f0829cd3 100644
--- a/target/linux/ipq40xx/image/mikrotik.mk
+++ b/target/linux/ipq40xx/image/mikrotik.mk
@@ -69,5 +69,4 @@ define Device/mikrotik_wap-ac
 	SOC := qcom-ipq4018
 	DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers
 endef
-# Missing DSA Setup
-#TARGET_DEVICES += mikrotik_wap-ac
+TARGET_DEVICES += mikrotik_wap-ac




More information about the lede-commits mailing list