[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250606114155.3517-1-xiongliang@xiaomi.com>
Date: Fri, 6 Jun 2025 19:41:55 +0800
From: Xandy.Xiong <xiongliang@...omi.com>
To: Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Maxime Coquelin
<mcoquelin.stm32@...il.com>, Alexandre Torgue <alexandre.torgue@...s.st.com>
CC: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>, Furong Xu
<0x1207@...il.com>, <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<xiongliang@...omi.com>
Subject: [PATCH] net: stmmac: add support for platform specific config.
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@...omi.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
Powered by blists - more mailing lists