All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: mdio-ipq4019: add delay after clock enable
@ 2022-02-21 11:45 Baruch Siach
  2022-02-21 12:52 ` Andrew Lunn
  2022-02-21 13:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Baruch Siach @ 2022-02-21 11:45 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King
  Cc: Baruch Siach, Robert Marko, Luo Jie, Bryan O'Donoghue,
	netdev, linux-arm-msm

From: Baruch Siach <baruch.siach@siklu.com>

Experimentation shows that PHY detect might fail when the code attempts
MDIO bus read immediately after clock enable. Add delay to stabilize the
clock before bus access.

PHY detect failure started to show after commit 7590fc6f80ac ("net:
mdio: Demote probed message to debug print") that removed coincidental
delay between clock enable and bus access.

10ms is meant to match the time it take to send the probed message over
UART at 115200 bps. This might be a far overshoot.

Fixes: 23a890d493e3 ("net: mdio: Add the reset function for IPQ MDIO driver")
Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
---
 drivers/net/mdio/mdio-ipq4019.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mdio/mdio-ipq4019.c b/drivers/net/mdio/mdio-ipq4019.c
index 5f4cd24a0241..4eba5a91075c 100644
--- a/drivers/net/mdio/mdio-ipq4019.c
+++ b/drivers/net/mdio/mdio-ipq4019.c
@@ -200,7 +200,11 @@ static int ipq_mdio_reset(struct mii_bus *bus)
 	if (ret)
 		return ret;
 
-	return clk_prepare_enable(priv->mdio_clk);
+	ret = clk_prepare_enable(priv->mdio_clk);
+	if (ret == 0)
+		mdelay(10);
+
+	return ret;
 }
 
 static int ipq4019_mdio_probe(struct platform_device *pdev)
-- 
2.34.1


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

* Re: [PATCH] net: mdio-ipq4019: add delay after clock enable
  2022-02-21 11:45 [PATCH] net: mdio-ipq4019: add delay after clock enable Baruch Siach
@ 2022-02-21 12:52 ` Andrew Lunn
  2022-02-21 13:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2022-02-21 12:52 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Heiner Kallweit, Russell King, Baruch Siach, Robert Marko,
	Luo Jie, Bryan O'Donoghue, netdev, linux-arm-msm

On Mon, Feb 21, 2022 at 01:45:57PM +0200, Baruch Siach wrote:
> From: Baruch Siach <baruch.siach@siklu.com>
> 
> Experimentation shows that PHY detect might fail when the code attempts
> MDIO bus read immediately after clock enable. Add delay to stabilize the
> clock before bus access.
> 
> PHY detect failure started to show after commit 7590fc6f80ac ("net:
> mdio: Demote probed message to debug print") that removed coincidental
> delay between clock enable and bus access.
> 
> 10ms is meant to match the time it take to send the probed message over
> UART at 115200 bps. This might be a far overshoot.
> 
> Fixes: 23a890d493e3 ("net: mdio: Add the reset function for IPQ MDIO driver")
> Signed-off-by: Baruch Siach <baruch.siach@siklu.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH] net: mdio-ipq4019: add delay after clock enable
  2022-02-21 11:45 [PATCH] net: mdio-ipq4019: add delay after clock enable Baruch Siach
  2022-02-21 12:52 ` Andrew Lunn
@ 2022-02-21 13:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-21 13:10 UTC (permalink / raw)
  To: Baruch Siach
  Cc: andrew, hkallweit1, linux, baruch.siach, robert.marko, luoj,
	bryan.odonoghue, netdev, linux-arm-msm

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Mon, 21 Feb 2022 13:45:57 +0200 you wrote:
> From: Baruch Siach <baruch.siach@siklu.com>
> 
> Experimentation shows that PHY detect might fail when the code attempts
> MDIO bus read immediately after clock enable. Add delay to stabilize the
> clock before bus access.
> 
> PHY detect failure started to show after commit 7590fc6f80ac ("net:
> mdio: Demote probed message to debug print") that removed coincidental
> delay between clock enable and bus access.
> 
> [...]

Here is the summary with links:
  - net: mdio-ipq4019: add delay after clock enable
    https://git.kernel.org/netdev/net/c/b6ad6261d277

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-02-21 13:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-21 11:45 [PATCH] net: mdio-ipq4019: add delay after clock enable Baruch Siach
2022-02-21 12:52 ` Andrew Lunn
2022-02-21 13:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.