netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: add support for platform specific config.
@ 2025-06-06 11:41 Xandy.Xiong
  2025-06-06 13:12 ` Simon Horman
  2025-06-06 16:46 ` Russell King (Oracle)
  0 siblings, 2 replies; 4+ messages in thread
From: Xandy.Xiong @ 2025-06-06 11:41 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Alexandre Torgue
  Cc: Russell King (Oracle), Furong Xu, netdev, linux-kernel,
	xiongliang

This patch adds support for platform-specific init config in the
stmmac driver. As SMMU remap, must after dma descriptor setup,
and same mac link caps must init before phy init. To support these feature,
a new function pointer 'fix_mac_config' is added to the
plat_stmmacenet_data structure.
And call the function pointer 'fix_mac_config' in the __stmmac_open().

Signed-off-by: Xandy.Xiong <xiongliang@xiaomi.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++++
 include/linux/stmmac.h                            | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 085c09039af4..8d629a3c2237 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4041,6 +4041,10 @@ static int __stmmac_open(struct net_device *dev,
 	if (ret < 0)
 		return ret;
 
+	/* Same mac config must before phy init and after stmmac_setup_dma_desc */
+	if (priv->plat->fix_mac_config)
+		priv->plat->fix_mac_config(dev, priv->plat->bsp_priv);
+
 	if ((!priv->hw->xpcs ||
 	     xpcs_get_an_mode(priv->hw->xpcs, mode) != DW_AN_C73)) {
 		ret = stmmac_init_phy(dev);
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 26ddf95d23f9..0a6021e5b932 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -239,6 +239,7 @@ struct plat_stmmacenet_data {
 			       phy_interface_t interface, int speed);
 	void (*fix_mac_speed)(void *priv, int speed, unsigned int mode);
 	int (*fix_soc_reset)(void *priv, void __iomem *ioaddr);
+	int (*fix_mac_config)(struct net_device *ndev, void *priv);
 	int (*serdes_powerup)(struct net_device *ndev, void *priv);
 	void (*serdes_powerdown)(struct net_device *ndev, void *priv);
 	int (*mac_finish)(struct net_device *ndev,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-06-06 16:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-06 11:41 [PATCH] net: stmmac: add support for platform specific config Xandy.Xiong
2025-06-06 13:12 ` Simon Horman
2025-06-06 16:46 ` Russell King (Oracle)
2025-06-06 16:49   ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).