netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net: stmmac: add support for platform specific reset
@ 2023-03-21 19:09 Shenwei Wang
  2023-03-21 19:09 ` [PATCH 2/2] net: stmmac: dwmac-imx: use platform specific reset for imx93 SoCs Shenwei Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Shenwei Wang @ 2023-03-21 19:09 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Shawn Guo, NXP Linux Team
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Wong Vee Khee, Jon Hunter,
	Mohammad Athari Bin Ismail, Andrey Konovalov,
	Revanth Kumar Uppala, Tan Tee Min, Shenwei Wang, netdev,
	linux-stm32, linux-arm-kernel, imx

This patch adds support for platform-specific reset logic in the
stmmac driver. Some SoCs require a different reset mechanism than
the standard dwmac IP reset. To support these platforms, a new function
pointer 'fix_soc_reset' is added to the plat_stmmacenet_data structure.
The stmmac_reset macro in hwif.h is modified to call the 'fix_soc_reset'
function if it exists. This enables the driver to use the platform-specific
reset logic when necessary.

Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/hwif.h | 10 +++++++++-
 include/linux/stmmac.h                     |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h
index 16a7421715cb..e24ce870690e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
@@ -215,7 +215,15 @@ struct stmmac_dma_ops {
 };
 
 #define stmmac_reset(__priv, __args...) \
-	stmmac_do_callback(__priv, dma, reset, __args)
+({ \
+	int __result = -EINVAL; \
+	if ((__priv) && (__priv)->plat && (__priv)->plat->fix_soc_reset) { \
+		__result = (__priv)->plat->fix_soc_reset((__priv)->plat, ##__args); \
+	} else { \
+		__result = stmmac_do_callback(__priv, dma, reset, __args); \
+	} \
+	__result; \
+})
 #define stmmac_dma_init(__priv, __args...) \
 	stmmac_do_void_callback(__priv, dma, init, __args)
 #define stmmac_init_chan(__priv, __args...) \
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index a152678b82b7..9044477fad61 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -223,6 +223,7 @@ struct plat_stmmacenet_data {
 	struct stmmac_rxq_cfg rx_queues_cfg[MTL_MAX_RX_QUEUES];
 	struct stmmac_txq_cfg tx_queues_cfg[MTL_MAX_TX_QUEUES];
 	void (*fix_mac_speed)(void *priv, unsigned int speed);
+	int (*fix_soc_reset)(void *priv, void __iomem *ioaddr);
 	int (*serdes_powerup)(struct net_device *ndev, void *priv);
 	void (*serdes_powerdown)(struct net_device *ndev, void *priv);
 	void (*speed_mode_2500)(struct net_device *ndev, void *priv);
-- 
2.34.1


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

end of thread, other threads:[~2023-03-30 16:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-21 19:09 [PATCH 1/1] net: stmmac: add support for platform specific reset Shenwei Wang
2023-03-21 19:09 ` [PATCH 2/2] net: stmmac: dwmac-imx: use platform specific reset for imx93 SoCs Shenwei Wang
2023-03-22 16:33 ` [PATCH 1/1] net: stmmac: add support for platform specific reset Simon Horman
2023-03-22 21:56   ` [EXT] " Shenwei Wang
2023-03-30 14:55 ` Shenwei Wang
2023-03-30 16:37   ` Jakub Kicinski

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).