Skip to content

Commit

Permalink
net: mdio-ipq4019: add delay after clock enable
Browse files Browse the repository at this point in the history
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 7590fc6 ("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: 23a890d ("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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Baruch Siach authored and davem330 committed Feb 21, 2022
1 parent cc20cce commit b6ad626
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/mdio/mdio-ipq4019.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b6ad626

Please sign in to comment.