]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.54/net-sh_eth-fix-mdio-access-in-sh_eth_close-for-r-car.patch
Linux 5.1.13
[thirdparty/kernel/stable-queue.git] / releases / 4.19.54 / net-sh_eth-fix-mdio-access-in-sh_eth_close-for-r-car.patch
1 From 53f150b778e402590126a5b3539d7f2d6097e0aa 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 f27a0dc8c563..5e3e6e262ba3 100644
36 --- a/drivers/net/ethernet/renesas/sh_eth.c
37 +++ b/drivers/net/ethernet/renesas/sh_eth.c
38 @@ -1588,6 +1588,10 @@ static void sh_eth_dev_exit(struct net_device *ndev)
39 sh_eth_get_stats(ndev);
40 mdp->cd->soft_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