Thread (11 messages) flat view 11 messages, 4 authors, 2021-06-08

Re: [PATCH v2] net: stmmac: explicitly deassert GMAC_AHB_RESET

From: Matthew Hagan <hidden>
Date: 2021-06-08 19:07:05
Also in: lkml, netdev

On 07/06/2021 10:45, Philipp Zabel wrote:
On Sun, 2021-06-06 at 11:30 +0100, Matthew Hagan wrote:
quoted
We are currently assuming that GMAC_AHB_RESET will already be deasserted
by the bootloader. However if this has not been done, probing of the GMAC
will fail. To remedy this we must ensure GMAC_AHB_RESET has been deasserted
prior to probing.

v2 changes:
 - remove NULL condition check for stmmac_ahb_rst in stmmac_main.c
 - unwrap dev_err() message in stmmac_main.c
 - add PTR_ERR() around plat->stmmac_ahb_rst in stmmac_platform.c

Signed-off-by: Matthew Hagan <redacted>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 4 ++++
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 7 +++++++
 include/linux/stmmac.h                                | 1 +
 3 files changed, 12 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 6d41dd6f9f7a..0d4cb423cbbd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6840,6 +6840,10 @@ int stmmac_dvr_probe(struct device *device,
 			reset_control_reset(priv->plat->stmmac_rst);
 	}
 
+	ret = reset_control_deassert(priv->plat->stmmac_ahb_rst);
+	if (ret == -ENOTSUPP)
+		dev_err(priv->device, "unable to bring out of ahb reset\n");
+
I would make this

	if (ret)
		dev_err(priv->device, "unable to bring out of ahb reset: %pe\n", ERR_PTR(ret));
Done.
Also consider asserting the reset again in the remove path. Or is there
a reason not to?
Don't see any issue doing this. As this is a shared reset, the assert will only occur
when the final GMAC is removed, due to the tracking of deassert_count.
With that addressed,

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
Thanks,

Matthew


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help