diff mbox series

[v2,08/10] net: stmmac: dwmac-loongson: Disable flow control for GMAC

Message ID 0ec0ae938964697010b3d035b7885e4dda89b012.1690439335.git.chenfeiyang@loongson.cn (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series stmmac: Add Loongson platform support | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Feiyang Chen July 27, 2023, 7:18 a.m. UTC
Loongson GMAC does not support Flow Control featurei. Use
disable_flow_control flag to disable it.

Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 2 ++
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c    | 5 +++++
 include/linux/stmmac.h                               | 1 +
 3 files changed, 8 insertions(+)

Comments

Andrew Lunn July 27, 2023, 10:36 a.m. UTC | #1
On Thu, Jul 27, 2023 at 03:18:51PM +0800, Feiyang Chen wrote:
> Loongson GMAC does not support Flow Control featurei. Use

No i in feature.

   Andrew
Feiyang Chen July 28, 2023, 1:46 a.m. UTC | #2
On Thu, Jul 27, 2023 at 6:36 PM Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Thu, Jul 27, 2023 at 03:18:51PM +0800, Feiyang Chen wrote:
> > Loongson GMAC does not support Flow Control featurei. Use
>
> No i in feature.
>

Hi, Andrew,

Sorry for the typo.

Thanks,
Feiyang

>    Andrew
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
index 3ab55340a6b8..439a5f8bcabe 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -61,6 +61,8 @@  static int loongson_gmac_data(struct pci_dev *pdev,
 	plat->phy_addr = -1;
 	plat->phy_interface = PHY_INTERFACE_MODE_RGMII_ID;
 
+	plat->disable_flow_control = true;
+
 	return 0;
 }
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 829de274e75d..4f69cad0be42 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3829,6 +3829,11 @@  static int __stmmac_open(struct net_device *dev,
 				   __func__, ret);
 			goto init_phy_error;
 		}
+
+		if (priv->plat->disable_flow_control) {
+			phy_support_sym_pause(dev->phydev);
+			phy_set_sym_pause(dev->phydev, false, false, true);
+		}
 	}
 
 	/* Extra statistics */
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index e21076f57205..54b9f308aabb 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -345,5 +345,6 @@  struct plat_stmmacenet_data {
 	const struct dwmac_regs *dwmac_regs;
 	bool dwmac_is_loongson;
 	int has_lgmac;
+	bool disable_flow_control;
 };
 #endif