All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] net: macb: Add small delay after link establishment
@ 2019-03-27 10:20 Stefan Roese
  2019-03-29 14:40 ` Eugen.Hristev at microchip.com
  2019-04-05  1:35 ` Joe Hershberger
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Roese @ 2019-03-27 10:20 UTC (permalink / raw)
  To: u-boot

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>
---
 drivers/net/macb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 182331f61d..72614164e9 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);
 		}
 	}
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-04-08  6:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-27 10:20 [U-Boot] [PATCH] net: macb: Add small delay after link establishment Stefan Roese
2019-03-29 14:40 ` Eugen.Hristev at microchip.com
2019-03-29 14:52   ` Stefan Roese
2019-03-29 14:59     ` Eugen.Hristev at microchip.com
2019-03-29 15:24       ` Stefan Roese
2019-04-02 12:16         ` Eugen.Hristev at microchip.com
2019-04-05  1:35 ` Joe Hershberger
2019-04-08  6:02   ` Eugen.Hristev at microchip.com

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.