ipq40xx: convert ASUS RT-AC58U to DSA
authorChristian Lamparter <chunkeey@gmail.com>
Sat, 9 Mar 2019 17:08:27 +0000 (18:08 +0100)
committerChristian Lamparter <chunkeey@gmail.com>
Sun, 14 Apr 2019 14:40:55 +0000 (16:40 +0200)
This patch converts the ASUS RT-AC58U to ipqess ethernet + qca8k's DSA.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
target/linux/ipq40xx/base-files/etc/board.d/02_network
target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh
target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts

index d8a5697..375c89b 100755 (executable)
@@ -22,7 +22,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" \
@@ -71,11 +73,6 @@ ipq40xx_setup_macs()
        local board="$1"
 
        case "$board" in
-       asus,rt-ac58u)
-               CI_UBIPART=UBI_DEV
-               wan_mac=$(mtd_get_mac_binary_ubi Factory 20486)
-               lan_mac=$(mtd_get_mac_binary_ubi Factory 4102)
-               ;;
        engenius,ens620ext)
                wan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
                lan_mac=$(macaddr_add "$wan_mac" 1)
index ce5c1fc..0f8d31b 100644 (file)
@@ -3,12 +3,21 @@
 . /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 4102)
                ip link set dev eth0 address $(macaddr_add "$base_mac" +1)
                ip link set dev eth1 address $(macaddr_add "$base_mac" +3)
                ;;
+       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)
+               ;;
        meraki,mr33)
                mac_lan=$(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 102)
                [ -n "$mac_lan" ] && ip link set dev eth0 address "$mac_lan"
@@ -18,6 +27,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
index 26c086e..0b94394 100644 (file)
@@ -19,6 +19,7 @@
                led-failsafe = &power;
                led-running = &power;
                led-upgrade = &power;
+               ethernet0 = &gmac;
        };
 
        chosen {
                        status = "okay";
                };
 
-               mdio@90000 {
-                       status = "okay";
-               };
-
-               ess-psgmii@98000 {
-                       status = "okay";
-               };
-
                tcsr@1949000 {
                        compatible = "qcom,tcsr";
                        reg = <0x1949000 0x100>;
                        qcom,usb-hsphy-mode-select = <TCSR_USB_HSPHY_HOST_MODE>;
                };
 
-               ess_tcsr@1953000 {
-                       compatible = "qcom,tcsr";
-                       reg = <0x1953000 0x1000>;
-                       qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
-               };
-
                tcsr@1957000 {
                        compatible = "qcom,tcsr";
                        reg = <0x1957000 0x100>;
                watchdog@b017000 {
                        status = "okay";
                };
-
-               ess-switch@c000000 {
-                       status = "okay";
-               };
-
-               edma@c080000 {
-                       status = "okay";
-               };
        };
 
        keys {
        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";
 };