[openwrt/openwrt] generic: 6.6: backport patch adding support for rgmii-id in stmmac-ipq806x

LEDE Commits lede-commits at lists.infradead.org
Thu May 9 08:01:02 PDT 2024


ansuel pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/9001014a24e4211a83246653b96721b79f4a92f7

commit 9001014a24e4211a83246653b96721b79f4a92f7
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Thu May 9 16:32:03 2024 +0200

    generic: 6.6: backport patch adding support for rgmii-id in stmmac-ipq806x
    
    Backport patch merged upstream for rgmii-id support in stmmac-ipq806x.
    
    This is needed for some device that directly connets PHY to the gmac
    port and require rgmii-id phy-modes.
    
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 ...dwmac-ipq806x-account-for-rgmii-txid-rxid.patch | 68 ++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/target/linux/generic/backport-6.6/740-v6.10-net-stmmac-dwmac-ipq806x-account-for-rgmii-txid-rxid.patch b/target/linux/generic/backport-6.6/740-v6.10-net-stmmac-dwmac-ipq806x-account-for-rgmii-txid-rxid.patch
new file mode 100644
index 0000000000..ab8e9ffab5
--- /dev/null
+++ b/target/linux/generic/backport-6.6/740-v6.10-net-stmmac-dwmac-ipq806x-account-for-rgmii-txid-rxid.patch
@@ -0,0 +1,68 @@
+From abb45a2477f533cd4aab3085defdff131e2e8c4f Mon Sep 17 00:00:00 2001
+From: Christian Marangi <ansuelsmth at gmail.com>
+Date: Mon, 6 May 2024 14:32:46 +0200
+Subject: [PATCH] net: stmmac: dwmac-ipq806x: account for rgmii-txid/rxid/id
+ phy-mode
+
+Currently the ipq806x dwmac driver is almost always used attached to the
+CPU port of a switch and phy-mode was always set to "rgmii" or "sgmii".
+
+Some device came up with a special configuration where the PHY is
+directly attached to the GMAC port and in those case phy-mode needs to
+be set to "rgmii-id" to make the PHY correctly work and receive packets.
+
+Since the driver supports only "rgmii" and "sgmii" mode, when "rgmii-id"
+(or variants) mode is set, the mode is rejected and probe fails.
+
+Add support also for these phy-modes to correctly setup PHYs that requires
+delay applied to tx/rx.
+
+Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
+Reviewed-by: Andrew Lunn <andrew at lunn.ch>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
+@@ -171,6 +171,9 @@ static int ipq806x_gmac_set_speed(struct
+ 
+ 	switch (gmac->phy_mode) {
+ 	case PHY_INTERFACE_MODE_RGMII:
++	case PHY_INTERFACE_MODE_RGMII_ID:
++	case PHY_INTERFACE_MODE_RGMII_RXID:
++	case PHY_INTERFACE_MODE_RGMII_TXID:
+ 		div = get_clk_div_rgmii(gmac, speed);
+ 		clk_bits = NSS_COMMON_CLK_GATE_RGMII_RX_EN(gmac->id) |
+ 			   NSS_COMMON_CLK_GATE_RGMII_TX_EN(gmac->id);
+@@ -412,6 +415,9 @@ static int ipq806x_gmac_probe(struct pla
+ 	val |= NSS_COMMON_GMAC_CTL_CSYS_REQ;
+ 	switch (gmac->phy_mode) {
+ 	case PHY_INTERFACE_MODE_RGMII:
++	case PHY_INTERFACE_MODE_RGMII_ID:
++	case PHY_INTERFACE_MODE_RGMII_RXID:
++	case PHY_INTERFACE_MODE_RGMII_TXID:
+ 		val |= NSS_COMMON_GMAC_CTL_PHY_IFACE_SEL;
+ 		break;
+ 	case PHY_INTERFACE_MODE_SGMII:
+@@ -427,6 +433,9 @@ static int ipq806x_gmac_probe(struct pla
+ 	val &= ~(1 << NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id));
+ 	switch (gmac->phy_mode) {
+ 	case PHY_INTERFACE_MODE_RGMII:
++	case PHY_INTERFACE_MODE_RGMII_ID:
++	case PHY_INTERFACE_MODE_RGMII_RXID:
++	case PHY_INTERFACE_MODE_RGMII_TXID:
+ 		val |= NSS_COMMON_CLK_SRC_CTRL_RGMII(gmac->id) <<
+ 			NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id);
+ 		break;
+@@ -444,6 +453,9 @@ static int ipq806x_gmac_probe(struct pla
+ 	val |= NSS_COMMON_CLK_GATE_PTP_EN(gmac->id);
+ 	switch (gmac->phy_mode) {
+ 	case PHY_INTERFACE_MODE_RGMII:
++	case PHY_INTERFACE_MODE_RGMII_ID:
++	case PHY_INTERFACE_MODE_RGMII_RXID:
++	case PHY_INTERFACE_MODE_RGMII_TXID:
+ 		val |= NSS_COMMON_CLK_GATE_RGMII_RX_EN(gmac->id) |
+ 			NSS_COMMON_CLK_GATE_RGMII_TX_EN(gmac->id);
+ 		break;




More information about the lede-commits mailing list