diff mbox series

net: mdio-ipq4019: add delay after clock enable

Message ID 01c6b6afb00c02a48fa99542c5b4c6a2c69092b0.1645443957.git.baruch@tkos.co.il (mailing list archive)
State Accepted
Commit b6ad6261d27708567b309fdb3102b12c42a070cc
Delegated to: Netdev Maintainers
Headers show
Series net: mdio-ipq4019: add delay after clock enable | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 1 blamed authors not CCed: davem@davemloft.net; 2 maintainers not CCed: davem@davemloft.net kuba@kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Baruch Siach Feb. 21, 2022, 11:45 a.m. UTC
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(-)

Comments

Andrew Lunn Feb. 21, 2022, 12:52 p.m. UTC | #1
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
patchwork-bot+netdevbpf@kernel.org Feb. 21, 2022, 1:10 p.m. UTC | #2
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!
diff mbox series

Patch

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)