diff mbox series

[U-Boot] net: phy: Increase link up delay in genphy_update_link()

Message ID 20190930082642.15206-1-sr@denx.de
State Accepted
Commit 27c3f70f3b50b05051792ef97a7ee13b6a2ed40b
Delegated to: Joe Hershberger
Headers show
Series [U-Boot] net: phy: Increase link up delay in genphy_update_link() | expand

Commit Message

Stefan Roese Sept. 30, 2019, 8:26 a.m. UTC
I've noticed that in most cases when genphy_update_link() is called, the
ethernet driver (mt7628-eth in this case) fails with the first ethernet
packets. Resulting in a timeout of the first tftp command. Increasing
the delay in the link check look from 1 to 50 ms and moving it below the
BMSR register read fixes this issue, resulting in a stable ethernet
traffic, even after initial link autonogotiation.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Weijie Gao <weijie.gao@mediatek.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
---
 drivers/net/phy/phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Joe Hershberger Nov. 30, 2019, 1:05 a.m. UTC | #1
On Mon, Sep 30, 2019 at 3:33 AM Stefan Roese <sr@denx.de> wrote:
>
> I've noticed that in most cases when genphy_update_link() is called, the
> ethernet driver (mt7628-eth in this case) fails with the first ethernet
> packets. Resulting in a timeout of the first tftp command. Increasing
> the delay in the link check look from 1 to 50 ms and moving it below the
> BMSR register read fixes this issue, resulting in a stable ethernet
> traffic, even after initial link autonogotiation.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Weijie Gao <weijie.gao@mediatek.com>
> Cc: Joe Hershberger <joe.hershberger@ni.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
diff mbox series

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index ae37dd6c1e..18e5ebd29c 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -256,11 +256,11 @@  int genphy_update_link(struct phy_device *phydev)
 				return -EINTR;
 			}
 
-			if ((i++ % 500) == 0)
+			if ((i++ % 10) == 0)
 				printf(".");
 
-			udelay(1000);	/* 1 ms */
 			mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);
+			mdelay(50);	/* 50 ms */
 		}
 		printf(" done\n");
 		phydev->link = 1;