]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.129/net-sh_eth-fix-mdio-access-in-sh_eth_close-for-r-car.patch
Linux 4.14.129
[thirdparty/kernel/stable-queue.git] / releases / 4.14.129 / net-sh_eth-fix-mdio-access-in-sh_eth_close-for-r-car.patch
CommitLineData
2a2a4ae2
SL
1From aabdf41105fb496d5d4b462a6a2ba1c82330be4d Mon Sep 17 00:00:00 2001
2From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
3Date: Tue, 28 May 2019 13:10:46 +0900
4Subject: 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
9The sh_eth_close() resets the MAC and then calls phy_stop()
10so that mdio read access result is incorrect without any error
11according to kernel trace like below:
12
13ifconfig-216 [003] .n.. 109.133124: mdio_access: ee700000.ethernet-ffffffff read phy:0x01 reg:0x00 val:0xffff
14
15According to the hardware manual, the RMII mode should be set to 1
16before operation the Ethernet MAC. However, the previous code was not
17set to 1 after the driver issued the soft_reset in sh_eth_dev_exit()
18so that the mdio read access result seemed incorrect. To fix the issue,
19this patch adds a condition and set the RMII mode register in
20sh_eth_dev_exit() for R-Car Gen2 and RZ/A1 SoCs.
21
22Note that when I have tried to move the sh_eth_dev_exit() calling
23after phy_stop() on sh_eth_close(), but it gets worse (kernel panic
24happened and it seems that a register is accessed while the clock is
25off).
26
27Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
28Signed-off-by: David S. Miller <davem@davemloft.net>
29Signed-off-by: Sasha Levin <sashal@kernel.org>
30---
31 drivers/net/ethernet/renesas/sh_eth.c | 4 ++++
32 1 file changed, 4 insertions(+)
33
34diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
35index 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--
502.20.1
51