All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [RFT PATCH v1 3/5] usb: Add some delay to wait for slow USB devices to be operational
Date: Mon, 23 Mar 2020 08:04:43 +0100	[thread overview]
Message-ID: <20200323080443.29173033@jawa> (raw)
In-Reply-To: <dae6ea7c-2161-8817-5a6e-2cab7d4f4295@denx.de>

Hi Marek,

> On 3/22/20 2:00 PM, Lukasz Majewski wrote:
> > This change provides some extra time for some slow (or degraded)
> > USB devices to become fully operational.
> > 
> > This code is the port to newest U-Boot of the fix from - "rayvt"
> > (from [1]).
> > 
> > Links:
> > [1] - https://forum.doozan.com/read.php?3,35295,35295#msg-35295
> > [2] -
> > https://www.dropbox.com/s/nrkrd1no63viuu8/uboot-bodhi-2016.05-timeoutTD.patch?dl=0
> > 
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > [Unfortunately, the original patch [2] did not contain S-o-B from
> > the original author - "rayvt"]
> > ---
> > 
> >  common/usb.c | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/common/usb.c b/common/usb.c
> > index 349e838f1d..305482b5bb 100644
> > --- a/common/usb.c
> > +++ b/common/usb.c
> > @@ -925,14 +925,20 @@ static int get_descriptor_len(struct
> > usb_device *dev, int len, int expect_len) __maybe_unused struct
> > usb_device_descriptor *desc; ALLOC_CACHE_ALIGN_BUFFER(unsigned
> > char, tmpbuf, USB_BUFSIZ); int err;
> > +	int retry = 5;
> >  
> >  	desc = (struct usb_device_descriptor *)tmpbuf;
> >  
> > +again:
> >  	err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, len);
> >  	if (err < expect_len) {
> >  		if (err < 0) {
> > -			printf("unable to get device descriptor
> > (error=%d)\n",
> > -				err);
> > +			printf("unable to get device descriptor
> > (error=%d) retry: %d\n",
> > +			       err, retry);
> > +			mdelay(50);  
> 
> Why 50 mSec and not some other value, like 100 mSec ?

I think that this value (50 ms) was took from Linux in some point and
with the retry set to 5 was the ported heuristics.

If you ask why exactly there is 50 ms - I cannot say, as I've just
ported the patch.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200323/1f4f6231/attachment.sig>

  reply	other threads:[~2020-03-23  7:04 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-22 13:00 [RFT PATCH v1 0/5] usb: Improve robustness of ehci-hcd controller operation Lukasz Majewski
2020-03-22 13:00 ` [RFT PATCH v1 1/5] Revert "usb: ehci-hcd: Keep async schedule running" Lukasz Majewski
2020-03-22 13:18   ` Marek Vasut
2020-03-23  6:57     ` Lukasz Majewski
2020-03-23 11:46       ` Marek Vasut
2020-03-23 12:41         ` Lukasz Majewski
2020-03-24  0:58           ` Marek Vasut
2020-03-24  7:06             ` Lukasz Majewski
2020-03-24 15:07               ` Marek Vasut
2020-03-24 18:11                 ` Lukasz Majewski
2020-03-24 18:33                   ` Marek Vasut
2020-03-22 13:00 ` [RFT PATCH v1 2/5] usb: Handle XACTERR error in DATA phase of USB storage Lukasz Majewski
2020-03-22 13:23   ` Marek Vasut
2020-03-23  7:00     ` Lukasz Majewski
2020-03-23 11:50       ` Marek Vasut
2020-03-23 13:03         ` Lukasz Majewski
2020-03-24  1:01           ` Marek Vasut
2020-03-22 13:00 ` [RFT PATCH v1 3/5] usb: Add some delay to wait for slow USB devices to be operational Lukasz Majewski
2020-03-22 13:29   ` Marek Vasut
2020-03-23  7:04     ` Lukasz Majewski [this message]
2020-03-23 11:52       ` Marek Vasut
2020-03-22 13:00 ` [RFT PATCH v1 4/5] usb: Provide code to handle spinup of USB usb devices (mostly HDDs) Lukasz Majewski
2020-03-22 13:32   ` Marek Vasut
2020-03-23  7:53     ` Lukasz Majewski
2020-03-23 11:57       ` Marek Vasut
2020-03-23 12:54         ` Lukasz Majewski
2020-03-24  1:04           ` Marek Vasut
2020-03-22 13:00 ` [RFT PATCH v1 5/5] usb: Handle QT_TOKEN_STATUS_XACTERR error when sending data Lukasz Majewski
2020-03-22 13:45   ` Marek Vasut
2020-03-23  7:18     ` Lukasz Majewski
2020-03-23 11:59       ` Marek Vasut
2020-03-23 12:58         ` Lukasz Majewski
2020-03-24  1:06           ` Marek Vasut
2020-03-23 20:58 ` [RFT PATCH v1 0/5] usb: Improve robustness of ehci-hcd controller operation Tom Rini
2020-03-23 22:11   ` Lukasz Majewski

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=20200323080443.29173033@jawa \
    --to=lukma@denx.de \
    --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.