linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: sh_eth: fix mdio access in sh_eth_close() for some SoCs
@ 2019-05-15  5:36 Yoshihiro Shimoda
  2019-05-15 15:41 ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: Yoshihiro Shimoda @ 2019-05-15  5:36 UTC (permalink / raw)
  To: sergei.shtylyov, davem; +Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda

The sh_eth_close() resets the MAC and then calls phy_stop()
so that mdio read access result is incorrect without any error
according to kernel trace like below:

ifconfig-216   [003] .n..   109.133124: mdio_access: ee700000.ethernet-ffffffff read  phy:0x01 reg:0x00 val:0xffff

To fix the issue, this patch adds a condition and set the RMII mode
regiseter in sh_eth_dev_exit() for some SoCs.

Note that when I have tried to move the sh_eth_dev_exit() calling
after phy_stop() on sh_eth_close(), but it gets worse.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/net/ethernet/renesas/sh_eth.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index e33af37..106ae90 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1596,6 +1596,10 @@ static void sh_eth_dev_exit(struct net_device *ndev)
 
 	/* Set MAC address again */
 	update_mac_address(ndev);
+
+	/* Set the mode again if required */
+	if (mdp->cd->rmiimode)
+		sh_eth_write(ndev, 0x1, RMIIMODE);
 }
 
 static void sh_eth_rx_csum(struct sk_buff *skb)
-- 
2.7.4


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

end of thread, other threads:[~2019-05-28  2:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-15  5:36 [PATCH] net: sh_eth: fix mdio access in sh_eth_close() for some SoCs Yoshihiro Shimoda
2019-05-15 15:41 ` Sergei Shtylyov
2019-05-20  7:42   ` Yoshihiro Shimoda
2019-05-25 18:06     ` Sergei Shtylyov
2019-05-28  2:33       ` Yoshihiro Shimoda

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