[openwrt/openwrt] bmips: dgnd3700-v2: fix ethernet

LEDE Commits lede-commits at lists.infradead.org
Tue Mar 16 19:07:44 GMT 2021


noltari pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/be169514942b8d20475edb25887865e56cede6f6

commit be169514942b8d20475edb25887865e56cede6f6
Author: Álvaro Fernández Rojas <noltari at gmail.com>
AuthorDate: Sun Mar 14 20:05:29 2021 +0100

    bmips: dgnd3700-v2: fix ethernet
    
    This is a temporary workaround to get the ethernet working, since external
    switch is connected by MDIO and it needs additional work.
    
    Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
 .../bmips/dts/bcm6362-netgear-dgnd3700-v2.dts      | 16 +++++
 .../bmips/nand/base-files/etc/board.d/02_network   |  3 +
 ...et-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch | 72 ++++++++++++++++++++++
 3 files changed, 91 insertions(+)

diff --git a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts
index fe26ebeed0..0d88169184 100644
--- a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts
+++ b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts
@@ -216,6 +216,22 @@
 	};
 };
 
+&switch0 {
+	ports {
+		port at 4 {
+			reg = <4>;
+			label = "extsw";
+
+			phy-mode = "rgmii";
+
+			fixed-link {
+				speed = <1000>;
+				full-duplex;
+			};
+		};
+	};
+};
+
 &uart0 {
 	status = "okay";
 };
diff --git a/target/linux/bmips/nand/base-files/etc/board.d/02_network b/target/linux/bmips/nand/base-files/etc/board.d/02_network
index db62e61287..b5ee52a682 100644
--- a/target/linux/bmips/nand/base-files/etc/board.d/02_network
+++ b/target/linux/bmips/nand/base-files/etc/board.d/02_network
@@ -8,6 +8,9 @@ case "$(board_name)" in
 comtrend,vr-3032u)
 	ucidef_set_interface_lan "lan1 lan2 lan3 lan4"
 	;;
+netgear,dgnd3700-v2)
+	ucidef_set_interface_lan "extsw"
+	;;
 esac
 
 board_config_flush
diff --git a/target/linux/bmips/patches-5.10/505-net-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch b/target/linux/bmips/patches-5.10/505-net-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch
new file mode 100644
index 0000000000..f5bc8807b1
--- /dev/null
+++ b/target/linux/bmips/patches-5.10/505-net-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch
@@ -0,0 +1,72 @@
+From 32cf73d8c6485b7b97aca7e377a68436d09b7022 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari at gmail.com>
+Date: Sun, 14 Mar 2021 20:03:44 +0100
+Subject: [PATCH] net: dsa: b53: add support for BCM63xx RGMIIs
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
+---
+ drivers/net/dsa/b53/b53_common.c | 37 ++++++++++++++++++++++++++++++++
+ 1 file changed, 37 insertions(+)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -1140,6 +1140,36 @@ static void b53_force_port_config(struct
+ 	b53_write8(dev, B53_CTRL_PAGE, off, reg);
+ }
+ 
++static void b53_adjust_63xx_rgmii(struct dsa_switch *ds, int port,
++				  phy_interface_t interface)
++{
++	struct b53_device *dev = ds->priv;
++	u8 rgmii_ctrl = 0, off;
++
++	if (port == 8)
++		off = B53_RGMII_CTRL_IMP;
++	else
++		off = B53_RGMII_CTRL_P(port);
++
++	b53_read8(dev, B53_CTRL_PAGE, off, &rgmii_ctrl);
++
++	rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC);
++	if (interface == PHY_INTERFACE_MODE_RGMII_ID)
++		rgmii_ctrl |= (RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC);
++	else if (interface == PHY_INTERFACE_MODE_RGMII_RXID)
++		rgmii_ctrl |= RGMII_CTRL_DLL_RXC;
++	else if (interface == PHY_INTERFACE_MODE_RGMII_TXID)
++		rgmii_ctrl |= RGMII_CTRL_DLL_TXC;
++
++	if (port != B53_CPU_PORT)
++		rgmii_ctrl |= RGMII_CTRL_ENABLE_GMII;
++
++	b53_write8(dev, B53_CTRL_PAGE, off, rgmii_ctrl);
++
++	dev_info(ds->dev, "Configured port %d for %s\n", port,
++		 phy_modes(interface));
++}
++
+ static void b53_adjust_link(struct dsa_switch *ds, int port,
+ 			    struct phy_device *phydev)
+ {
+@@ -1166,6 +1196,9 @@ static void b53_adjust_link(struct dsa_s
+ 			      tx_pause, rx_pause);
+ 	b53_force_link(dev, port, phydev->link);
+ 
++	if (is63xx(dev))
++		b53_adjust_63xx_rgmii(ds, port, phydev->interface);
++
+ 	if (is531x5(dev) && phy_interface_is_rgmii(phydev)) {
+ 		if (port == 8)
+ 			off = B53_RGMII_CTRL_IMP;
+@@ -1358,6 +1391,9 @@ void b53_phylink_mac_link_up(struct dsa_
+ {
+ 	struct b53_device *dev = ds->priv;
+ 
++	if (is63xx(dev) && port >= 4)
++		b53_adjust_63xx_rgmii(ds, port, interface);
++
+ 	if (mode == MLO_AN_PHY)
+ 		return;
+ 



More information about the lede-commits mailing list