From 693c573358e86bf478d392ae8c039ec9521d4559 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 9 Mar 2019 18:08:27 +0100 Subject: [PATCH] ipq40xx: convert ASUS RT-AC58U to DSA This patch converts the ASUS RT-AC58U to ipqess ethernet + qca8k's DSA. Signed-off-by: Christian Lamparter --- .../ipq40xx/base-files/etc/board.d/02_network | 8 +-- .../lib/preinit/05_set_iface_mac_ipq40xx.sh | 18 ++++++ .../arm/boot/dts/qcom-ipq4018-rt-ac58u.dts | 55 +++++++++++-------- 3 files changed, 55 insertions(+), 26 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 61d02a17bc..13588d8af8 100755 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -42,7 +42,9 @@ ipq40xx_setup_interfaces() openmesh,a62) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; - asus,rt-ac58u|\ + asus,rt-ac58u) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" + ;; zyxel,nbg6617) ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_add_switch "switch0" \ @@ -121,9 +123,7 @@ ipq40xx_setup_macs() ;; asus,rt-ac58u) CI_UBIPART=UBI_DEV - wan_mac=$(mtd_get_mac_binary_ubi Factory 0x1006) - lan_mac=$(mtd_get_mac_binary_ubi Factory 0x5006) - label_mac=$wan_mac + label_mac=$(mtd_get_mac_binary_ubi Factory 0x1006) ;; cilab,meshpoint-one) label_mac=$(mtd_get_mac_binary "ART" 0x1006) 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 4d8113698e..66c815ba19 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 @@ -1,6 +1,10 @@ . /lib/functions.sh preinit_set_mac_address() { + local wan_mac + local lan14_mac + local lan_mac + case $(board_name) in asus,map-ac2200) base_mac=$(mtd_get_mac_binary_ubi Factory 0x1006) @@ -11,6 +15,11 @@ preinit_set_mac_address() { ip link set dev eth0 address $(mtd_get_mac_binary "ART" 0x6) ip link set dev eth1 address $(mtd_get_mac_binary "ART" 0x0) ;; + asus,rt-ac58u) + CI_UBIPART=UBI_DEV + wan_mac=$(mtd_get_mac_binary_ubi Factory 20486) + lan14_mac=$(mtd_get_mac_binary_ubi Factory 4102) + ;; engenius,eap2200) base_mac=$(cat /sys/class/net/eth0/address) ip link set dev eth1 address $(macaddr_add "${base_mac}" +1) @@ -29,6 +38,15 @@ preinit_set_mac_address() { ip link set dev eth0 address $(macaddr_add "$base_mac" +2) ip link set dev eth1 address $(macaddr_add "$base_mac" +3) esac + + [ -n "$lan_mac" ] && ip link set dev lan address "$lan_mac" + [ -n "$wan_mac" ] && ip link set dev wan address "$wan_mac" + [ -n "$lan14_mac" ] && { + ip link set dev lan1 address "$lan14_mac" + ip link set dev lan2 address "$lan14_mac" + ip link set dev lan3 address "$lan14_mac" + ip link set dev lan4 address "$lan14_mac" + } } boot_hook_add preinit_main preinit_set_mac_address diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts index a0030f77ce..82317faf61 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts @@ -19,6 +19,7 @@ led-failsafe = &led_power; led-running = &led_power; led-upgrade = &led_power; + ethernet0 = &gmac; }; chosen { @@ -30,14 +31,6 @@ status = "okay"; }; - mdio@90000 { - status = "okay"; - }; - - ess-psgmii@98000 { - status = "okay"; - }; - tcsr@1949000 { compatible = "qcom,tcsr"; reg = <0x1949000 0x100>; @@ -50,12 +43,6 @@ qcom,usb-hsphy-mode-select = ; }; - ess_tcsr@1953000 { - compatible = "qcom,tcsr"; - reg = <0x1953000 0x1000>; - qcom,ess-interface-select = ; - }; - tcsr@1957000 { compatible = "qcom,tcsr"; reg = <0x1957000 0x100>; @@ -88,14 +75,6 @@ watchdog@b017000 { status = "okay"; }; - - ess-switch@c000000 { - status = "okay"; - }; - - edma@c080000 { - status = "okay"; - }; }; keys { @@ -157,6 +136,38 @@ status = "okay"; }; +&mdio { + status = "okay"; +}; + +&psgmii_phy { + status = "okay"; +}; + +&ess { + status = "okay"; +}; + +&gmac { + status = "okay"; +}; + +&essport1 { + label = "lan4"; +}; + +&essport2 { + label = "lan3"; +}; + +&essport3 { + label = "lan2"; +}; + +&essport4 { + label = "lan1"; +}; + &blsp_dma { status = "okay"; }; -- 2.30.2