[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2ae6d8c6-372f-4708-8bd4-f461b403b986@cogentembedded.com>
Date: Wed, 5 Jun 2019 21:19:08 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
davem@...emloft.net
Cc: netdev@...r.kernel.org, linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH v2] net: sh_eth: fix mdio access in sh_eth_close() for
R-Car Gen2 and RZ/A1 SoCs
Hello!
I've been meaning to look around this issue before replying to this respin
but didn't notify DaveM, so he finally merged it...
On 05/28/2019 07:10 AM, Yoshihiro Shimoda wrote:
> 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
>
> According to the hardware manual, the RMII mode should be set to 1
> before operation the Ethernet MAC. However, the previous code was not
> set to 1 after the driver issued the soft_reset in sh_eth_dev_exit()
> so that the mdio read access result seemed incorrect. To fix the issue,
> this patch adds a condition and set the RMII mode register in
> sh_eth_dev_exit() for R-Car Gen2 and RZ/A1 SoCs.
I told you RZ/G1, not RZ/A1. The latter has its own data structure
and different register layout.
> 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 (kernel panic
> happened and it seems that a register is accessed while the clock is
> off).
I've reproduced it but still don't know why that happens.
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
> ---
> Changes from v1 (https://patchwork.kernel.org/patch/10944265/):
> - Revise the subject, commit log and the comment of the code.
> - Move the RMII setting to right after soft_reset.
>
> 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 6354f19..7ba35a0 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -1594,6 +1594,10 @@ static void sh_eth_dev_exit(struct net_device *ndev)
> sh_eth_get_stats(ndev);
> mdp->cd->soft_reset(ndev);
>
> + /* Set the RMII mode again if required */
When I asked for more details, I was meaning this comment. Thanks for telling me
about the gory details anyway. :-)
> + if (mdp->cd->rmiimode)
> + sh_eth_write(ndev, 0x1, RMIIMODE);
> +
> /* Set MAC address again */
> update_mac_address(ndev);
> }
MBR, Sergei
Powered by blists - more mailing lists