]>
Commit | Line | Data |
---|---|---|
2a2a4ae2 SL |
1 | From aabdf41105fb496d5d4b462a6a2ba1c82330be4d Mon Sep 17 00:00:00 2001 |
2 | From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | |
3 | Date: Tue, 28 May 2019 13:10:46 +0900 | |
4 | Subject: net: sh_eth: fix mdio access in sh_eth_close() for R-Car Gen2 and | |
5 | RZ/A1 SoCs | |
6 | ||
7 | [ Upstream commit 315ca92dd863fecbffc0bb52ae0ac11e0398726a ] | |
8 | ||
9 | The sh_eth_close() resets the MAC and then calls phy_stop() | |
10 | so that mdio read access result is incorrect without any error | |
11 | according to kernel trace like below: | |
12 | ||
13 | ifconfig-216 [003] .n.. 109.133124: mdio_access: ee700000.ethernet-ffffffff read phy:0x01 reg:0x00 val:0xffff | |
14 | ||
15 | According to the hardware manual, the RMII mode should be set to 1 | |
16 | before operation the Ethernet MAC. However, the previous code was not | |
17 | set to 1 after the driver issued the soft_reset in sh_eth_dev_exit() | |
18 | so that the mdio read access result seemed incorrect. To fix the issue, | |
19 | this patch adds a condition and set the RMII mode register in | |
20 | sh_eth_dev_exit() for R-Car Gen2 and RZ/A1 SoCs. | |
21 | ||
22 | Note that when I have tried to move the sh_eth_dev_exit() calling | |
23 | after phy_stop() on sh_eth_close(), but it gets worse (kernel panic | |
24 | happened and it seems that a register is accessed while the clock is | |
25 | off). | |
26 | ||
27 | Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | |
28 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
29 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
30 | --- | |
31 | drivers/net/ethernet/renesas/sh_eth.c | 4 ++++ | |
32 | 1 file changed, 4 insertions(+) | |
33 | ||
34 | diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c | |
35 | index abfb9faadbc4..9b1906a65e11 100644 | |
36 | --- a/drivers/net/ethernet/renesas/sh_eth.c | |
37 | +++ b/drivers/net/ethernet/renesas/sh_eth.c | |
38 | @@ -1458,6 +1458,10 @@ static void sh_eth_dev_exit(struct net_device *ndev) | |
39 | sh_eth_get_stats(ndev); | |
40 | sh_eth_reset(ndev); | |
41 | ||
42 | + /* Set the RMII mode again if required */ | |
43 | + if (mdp->cd->rmiimode) | |
44 | + sh_eth_write(ndev, 0x1, RMIIMODE); | |
45 | + | |
46 | /* Set MAC address again */ | |
47 | update_mac_address(ndev); | |
48 | } | |
49 | -- | |
50 | 2.20.1 | |
51 |