aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2019-03-27 11:20:19 +0100
committerEugen Hristev <eugen.hristev@microchip.com>2019-04-09 09:28:50 +0300
commit7bf9bca7c0a9fe5c63e8fd5c2aa63884d76dace0 (patch)
tree05166c35138bf40a5d987ec86c2b75344977bfa1
parent068d4c0a11e43cce6e819e19884b49a8bc4e1722 (diff)
downloadu-boot-7bf9bca7c0a9fe5c63e8fd5c2aa63884d76dace0.zip
u-boot-7bf9bca7c0a9fe5c63e8fd5c2aa63884d76dace0.tar.gz
u-boot-7bf9bca7c0a9fe5c63e8fd5c2aa63884d76dace0.tar.bz2
net: macb: Add small delay after link establishment
I've noticed that the first ethernet packet after PHY link establishment is not tranferred correctly most of the time on my AT91SAM9G25 board. Here I usually see a timeout of a few seconds, which is quite annoying. Adding a small delay (10ms in this case) after the link establishment helps to solve this problem. With this patch applied, this timeout on the first packet is not seen any more. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Wenyou Yang <wenyou.yang@atmel.com> Cc: Eugen Hristev <eugen.hristev@microchip.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
-rw-r--r--drivers/net/macb.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 182331f..7261416 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -550,8 +550,14 @@ static int macb_phy_init(struct macb_device *macb, const char *name)
for (i = 0; i < MACB_AUTONEG_TIMEOUT / 100; i++) {
status = macb_mdio_read(macb, MII_BMSR);
- if (status & BMSR_LSTATUS)
+ if (status & BMSR_LSTATUS) {
+ /*
+ * Delay a bit after the link is established,
+ * so that the next xfer does not fail
+ */
+ mdelay(10);
break;
+ }
udelay(100);
}
}