* [PATCH] NET: dwmac: Make dwmac reset unconditional
@ 2017-07-18 14:07 Eugeniy Paltsev
  2017-07-19 20:52 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eugeniy Paltsev @ 2017-07-18 14:07 UTC (permalink / raw)
  To: netdev
  Cc: linux-snps-arc, linux-kernel, Alexandre Torgue,
	Giuseppe Cavallaro, Eugeniy Paltsev
Unconditional reset dwmac before HW init if reset controller is present.
In existing implementation we reset dwmac only after second module
probing:
(module load -> unload -> load again [reset happens])
Now we reset dwmac at every module load:
(module load [reset happens] -> unload -> load again [reset happens])
Also some reset controllers have only reset callback instead of
assert + deassert callbacks pair, so handle this case.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 12236da..c7b3d0d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4096,8 +4096,15 @@ int stmmac_dvr_probe(struct device *device,
 	if ((phyaddr >= 0) && (phyaddr <= 31))
 		priv->plat->phy_addr = phyaddr;
 
-	if (priv->plat->stmmac_rst)
+	if (priv->plat->stmmac_rst) {
+		ret = reset_control_assert(priv->plat->stmmac_rst);
 		reset_control_deassert(priv->plat->stmmac_rst);
+		/* Some reset controllers have only reset callback instead of
+		 * assert + deassert callbacks pair.
+		 */
+		if (ret == -ENOTSUPP)
+			reset_control_reset(priv->plat->stmmac_rst);
+	}
 
 	/* Init MAC and get the capabilities */
 	ret = stmmac_hw_init(priv);
-- 
2.9.3
^ permalink raw reply related	[flat|nested] 2+ messages in thread
* Re: [PATCH] NET: dwmac: Make dwmac reset unconditional
  2017-07-18 14:07 [PATCH] NET: dwmac: Make dwmac reset unconditional Eugeniy Paltsev
@ 2017-07-19 20:52 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-07-19 20:52 UTC (permalink / raw)
  To: Eugeniy.Paltsev
  Cc: netdev, linux-snps-arc, linux-kernel, alexandre.torgue,
	peppe.cavallaro
From: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Date: Tue, 18 Jul 2017 17:07:15 +0300
> Unconditional reset dwmac before HW init if reset controller is present.
> 
> In existing implementation we reset dwmac only after second module
> probing:
> (module load -> unload -> load again [reset happens])
> 
> Now we reset dwmac at every module load:
> (module load [reset happens] -> unload -> load again [reset happens])
> 
> Also some reset controllers have only reset callback instead of
> assert + deassert callbacks pair, so handle this case.
> 
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Applied.
^ permalink raw reply	[flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-19 20:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-18 14:07 [PATCH] NET: dwmac: Make dwmac reset unconditional Eugeniy Paltsev
2017-07-19 20:52 ` David Miller
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).