Commit 6c9644685940e1d98c2d38fb205e8da14f3690b5
Committed by
Joe Hershberger
1 parent
a931f78307
Exists in
smarc_8mq_lf_v2020.04
and in
9 other branches
drivers: net: fsl_enetc_mdio: return with time-out if HW is stuck
On some boards MDIO may get stuck if it detects echo on the line. This is a know hardware issue, there is a board fix for it. In case we're running on a board that doesn't have the fix, we don't want to loop here forever and freeze U-Boot. Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff
drivers/net/fsl_enetc_mdio.c
... | ... | @@ -17,8 +17,13 @@ |
17 | 17 | |
18 | 18 | static void enetc_mdio_wait_bsy(struct enetc_mdio_priv *priv) |
19 | 19 | { |
20 | - while (enetc_read(priv, ENETC_MDIO_CFG) & ENETC_EMDIO_CFG_BSY) | |
20 | + int to = 10000; | |
21 | + | |
22 | + while ((enetc_read(priv, ENETC_MDIO_CFG) & ENETC_EMDIO_CFG_BSY) && | |
23 | + --to) | |
21 | 24 | cpu_relax(); |
25 | + if (!to) | |
26 | + printf("T"); | |
22 | 27 | } |
23 | 28 | |
24 | 29 | int enetc_mdio_read_priv(struct enetc_mdio_priv *priv, int addr, int devad, |