From 1ccc3bfd54f7d9a2a2a02f2cb2b062452ea8d830 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Mon, 29 Aug 2022 23:15:56 +0800 Subject: [PATCH] ramips: mt7621: fixes dsa hnat support --- target/linux/ramips/dts/mt7621.dtsi | 14 ++++---------- target/linux/ramips/dts/mt7621_gehua_ghl-r-001.dts | 7 +++++++ .../ramips/dts/mt7621_hatlab_gateboard-one.dts | 14 +++++++++----- target/linux/ramips/dts/mt7621_jcg_q20.dts | 4 ++++ target/linux/ramips/dts/mt7621_jcg_y2.dts | 7 +++++++ target/linux/ramips/dts/mt7621_phicomm_k2p.dts | 7 +++++++ .../ramips/dts/mt7621_raisecom_msg1500-x-00.dts | 7 +++++++ .../ramips/dts/mt7621_xiaomi_mi-router-cr660x.dts | 7 +++++++ .../ramips/dts/mt7621_xiaomi_router-ac2100.dtsi | 7 +++++++ target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts | 7 +++++++ .../files/drivers/net/ethernet/mtk/mtk_eth_soc.c | 4 ++++ 11 files changed, 70 insertions(+), 15 deletions(-) diff --git a/target/linux/ramips/dts/mt7621.dtsi b/target/linux/ramips/dts/mt7621.dtsi index d25c1b2b9..ff29244ca 100644 --- a/target/linux/ramips/dts/mt7621.dtsi +++ b/target/linux/ramips/dts/mt7621.dtsi @@ -490,13 +490,7 @@ compatible = "mediatek,eth-mac"; reg = <1>; status = "disabled"; - phy-mode = "rgmii"; - - fixed-link { - speed = <1000>; - full-duplex; - pause; - }; + phy-mode = "rgmii-rxid"; }; mdio: mdio-bus { @@ -563,8 +557,8 @@ hnat: hnat@1e100000 { compatible = "mediatek,mtk-hnat_v1"; - /* ext-devices = "apcli0", "apclii0","apclix0", - "ra0", "rai0", "rax0", "wlan0", "wlan1"; */ + ext-devices = "apcli0", "apclii0","apclix0", + "ra0", "rai0", "rax0", "wlan0", "wlan1"; reg = <0x1e100000 0x3000>; resets = <ðsys 0>; @@ -573,7 +567,7 @@ mtketh-wan = "wan"; mtketh-ppd = "lan"; mtketh-lan = "lan"; - mtketh-max-gmac = <1>; + mtketh-max-gmac = <2>; mtkdsa-wan-port = <4>; }; diff --git a/target/linux/ramips/dts/mt7621_gehua_ghl-r-001.dts b/target/linux/ramips/dts/mt7621_gehua_ghl-r-001.dts index 50e47a543..7d3573a71 100644 --- a/target/linux/ramips/dts/mt7621_gehua_ghl-r-001.dts +++ b/target/linux/ramips/dts/mt7621_gehua_ghl-r-001.dts @@ -113,7 +113,14 @@ &gmac1 { mtd-mac-address = <&factory 0xe000>; mtd-mac-address-increment = <1>; + phy-mode = "rgmii"; status = "okay"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; }; &gsw { diff --git a/target/linux/ramips/dts/mt7621_hatlab_gateboard-one.dts b/target/linux/ramips/dts/mt7621_hatlab_gateboard-one.dts index 3fa75d9f8..4592bb030 100644 --- a/target/linux/ramips/dts/mt7621_hatlab_gateboard-one.dts +++ b/target/linux/ramips/dts/mt7621_hatlab_gateboard-one.dts @@ -61,11 +61,11 @@ cpu_fan: cpu_fan { compatible = "gpio-fan"; gpios = <&gpio 13 GPIO_ACTIVE_HIGH - &gpio 14 GPIO_ACTIVE_HIGH>; - gpio-fan,speed-map = < 0 0 - 2000 1 - 4000 2 - 6000 3>; + &gpio 14 GPIO_ACTIVE_HIGH>; + gpio-fan,speed-map = < 0 0 + 2000 1 + 4000 2 + 6000 3>; #cooling-cells = <2>; }; @@ -214,6 +214,10 @@ mtd-mac-address-increment = <6>; }; +&hnat { + mtketh-wan = "eth5"; +}; + &switch0 { ports { port@0 { diff --git a/target/linux/ramips/dts/mt7621_jcg_q20.dts b/target/linux/ramips/dts/mt7621_jcg_q20.dts index 5464ca06c..3f4978c72 100644 --- a/target/linux/ramips/dts/mt7621_jcg_q20.dts +++ b/target/linux/ramips/dts/mt7621_jcg_q20.dts @@ -160,6 +160,10 @@ }; }; +&hnat { + mtkdsa-wan-port = <0>; +}; + &switch0 { ports { port@1 { diff --git a/target/linux/ramips/dts/mt7621_jcg_y2.dts b/target/linux/ramips/dts/mt7621_jcg_y2.dts index bd88923f7..ccbe9f8c1 100644 --- a/target/linux/ramips/dts/mt7621_jcg_y2.dts +++ b/target/linux/ramips/dts/mt7621_jcg_y2.dts @@ -94,7 +94,14 @@ &gmac1 { mtd-mac-address = <&factory 0xe006>; + phy-mode = "rgmii"; status = "okay"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; }; &gsw { diff --git a/target/linux/ramips/dts/mt7621_phicomm_k2p.dts b/target/linux/ramips/dts/mt7621_phicomm_k2p.dts index ad64ee5d5..01fb5e866 100644 --- a/target/linux/ramips/dts/mt7621_phicomm_k2p.dts +++ b/target/linux/ramips/dts/mt7621_phicomm_k2p.dts @@ -107,7 +107,14 @@ &gmac1 { mtd-mac-address = <&factory 0xe006>; + phy-mode = "rgmii"; status = "okay"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; }; &gsw { diff --git a/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts index f38f150be..5b55487b7 100644 --- a/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts +++ b/target/linux/ramips/dts/mt7621_raisecom_msg1500-x-00.dts @@ -115,7 +115,14 @@ }; &gmac1 { + phy-mode = "rgmii"; status = "okay"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; }; &gsw { diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dts index 2057deca9..b5d2d9a19 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dts +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-cr660x.dts @@ -135,7 +135,14 @@ &gmac1 { mtd-mac-address = <&factory 0x3fffa>; + phy-mode = "rgmii"; status = "okay"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; }; &gsw { diff --git a/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi index 9d6b5428a..7df108072 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi +++ b/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi @@ -30,7 +30,14 @@ &gmac1 { mtd-mac-address = <&factory 0xe006>; + phy-mode = "rgmii"; status = "okay"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; }; &gsw { diff --git a/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts b/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts index 57e6cc42a..5bda61cbc 100644 --- a/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts +++ b/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts @@ -91,7 +91,14 @@ &gmac1 { mtd-mac-address = <&factory 0x4>; mtd-mac-address-increment = <1>; + phy-mode = "rgmii"; status = "okay"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; }; &gsw { diff --git a/target/linux/ramips/files/drivers/net/ethernet/mtk/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/mtk/mtk_eth_soc.c index c811c7006..12cfc089e 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/mtk/mtk_eth_soc.c +++ b/target/linux/ramips/files/drivers/net/ethernet/mtk/mtk_eth_soc.c @@ -3400,6 +3400,7 @@ static const struct net_device_ops mtk_netdev_ops = { static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) { + const char *name = of_get_property(np, "label", NULL); const __be32 *_id = of_get_property(np, "reg", NULL); struct phylink *phylink; int phy_mode, id, err; @@ -3490,6 +3491,9 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) eth->netdev[id]->irq = eth->irq[0]; eth->netdev[id]->dev.of_node = np; + if (name) + strlcpy(eth->netdev[id]->name, name, IFNAMSIZ); + return 0; free_netdev: