All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eugen.Hristev at microchip.com <Eugen.Hristev@microchip.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net: macb: Add small delay after link establishment
Date: Fri, 29 Mar 2019 14:40:49 +0000	[thread overview]
Message-ID: <282db78e-95c8-de3e-dea0-e61ce653debe@microchip.com> (raw)
In-Reply-To: <20190327102019.8268-1-sr@denx.de>



On 27.03.2019 12:20, Stefan Roese wrote:

> 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.

Hi Stefan,

I find this a bit odd... maybe someone with a different board having 
this Ethernet controller can confirm or infirm this ?
Linux driver for macb has a similar issue ?
Adding a delay just for the sake of it might hide another issue that we 
are missing at this point: why exactly transfer fails right away... it 
is likely that we want to send packets but link in fact is not ready ?
Or any reason why the packet is not correctly transferred? Do you see 
errors on the line or the packet vanishes completely ?
What kind of packet is this first one ? Does it depend on the packet type ?

Sorry for maybe asking too many questions.

I have added Nicolas and Claudiu who have more experience with macb on 
at91 boards

Thanks,
Eugen

> 
> 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);
>   		}
>   	}
> 

  reply	other threads:[~2019-03-29 14:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=282db78e-95c8-de3e-dea0-e61ce653debe@microchip.com \
    --to=eugen.hristev@microchip.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.