From 66a3c32b47a9c9da155fd04045d7262b005a1de3 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Mon, 24 Oct 2022 18:55:44 +0200 Subject: [PATCH] ipq40xx: Convert openmesh,a42 to DSA * ethernet1: - physical port label "Ethernet 1" - can be used to power the device - its mac address is printed on the device label * ethernet2: - physical port label "Ethernet 2" Both ports are not marked by there role (because the vendor firmware automatically detects roles) but the "Ethernet 1" port was used in the past for "WAN" functionality in OpenWrt. Reviewed-by: Robert Marko Signed-off-by: Sven Eckelmann --- .../ipq40xx/base-files/etc/board.d/02_network | 6 +++++ .../lib/preinit/05_set_iface_mac_ipq40xx.sh | 4 +++ .../arch/arm/boot/dts/qcom-ipq4018-a42.dts | 26 ++++++++++++++++--- target/linux/ipq40xx/image/generic.mk | 3 +-- 4 files changed, 33 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 80b7b02e8a..6c6d04a923 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -73,6 +73,9 @@ ipq40xx_setup_interfaces() netgear,srs60) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" ;; + openmesh,a42) + ucidef_set_interfaces_lan_wan "ethernet2" "ethernet1" + ;; zte,mf286d) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" "wan" ;; @@ -159,6 +162,9 @@ ipq40xx_setup_macs() pakedge,wr-1) wan_mac=$(macaddr_add $(get_mac_label) 1) ;; + openmesh,a42) + label_mac="$(mtd_get_mac_binary "0:ART" 0x0)" + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac 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 ddfef1ab2d..4ae4103131 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 @@ -29,6 +29,10 @@ preinit_set_mac_address() { ip link set dev lan1 address $(macaddr_add "$base_mac" 1) ip link set dev eth0 address $(macaddr_setbit "$base_mac" 7) ;; + openmesh,a42) + ip link set dev ethernet1 address $(mtd_get_mac_binary "0:ART" 0x0) + ip link set dev ethernet2 address $(mtd_get_mac_binary "0:ART" 0x6) + ;; mikrotik,wap-ac) base_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base) ip link set dev sw-eth1 address "$base_mac" diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-a42.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-a42.dts index 2236edf80b..89f5183045 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-a42.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-a42.dts @@ -17,10 +17,6 @@ status = "okay"; }; - mdio@90000 { - status = "okay"; - }; - tcsr@194b000 { /* select hostmode */ compatible = "qcom,tcsr"; @@ -166,6 +162,28 @@ status = "okay"; }; +&mdio { + status = "okay"; +}; + +&gmac { + status = "okay"; +}; + +&switch { + status = "okay"; +}; + +&swport4 { + status = "okay"; + label = "ethernet2"; +}; + +&swport5 { + status = "okay"; + label = "ethernet1"; +}; + &wifi0 { status = "okay"; qcom,ath10k-calibration-variant = "OM-A42"; diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index 9fb34a7871..14a2745719 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -888,8 +888,7 @@ define Device/openmesh_a42 IMAGE/factory.bin := append-rootfs | pad-rootfs | openmesh-image ce_type=A42 IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata endef -# Missing DSA Setup -#TARGET_DEVICES += openmesh_a42 +TARGET_DEVICES += openmesh_a42 define Device/openmesh_a62 $(call Device/FitImageLzma) -- 2.30.2