All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: u-boot@lists.denx.de
Subject: [RESEND][PATCH 2/3] common/usb.c: Work around keyboard reporting "USB device not accepting new address"
Date: Tue, 18 Aug 2020 13:16:34 -0500	[thread overview]
Message-ID: <e2eafc19-e1d7-a614-e5e4-df7becc6371b@windriver.com> (raw)
In-Reply-To: <ab564382-e039-b3a2-859f-265698d3ad2b@denx.de>



On 8/18/20 10:08 AM, Marek Vasut wrote:
> On 8/18/20 4:34 PM, Jason Wessel wrote:
>> When resetting the rpi3 board sometimes it will display:
>>      USB device not accepting new address (error=0)
>>
>> After the message appears, the usb keyboard will not work.  It seems
>> that the configuration actually did succeed however.  Checking the
>> device status for a return code of zero and continuing allows the usb
>> keyboard and other usb devices to work function.
>>
>> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
>> ---
>>  common/usb.c | 7 ++++---
>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/common/usb.c b/common/usb.c
>> index aad13fd9c5..0eb5d40a2d 100644
>> --- a/common/usb.c
>> +++ b/common/usb.c
>> @@ -1054,11 +1054,12 @@ static int usb_prepare_device(struct usb_device *dev, int addr, bool do_read,
>>  	dev->devnum = addr;
>>  
>>  	err = usb_set_address(dev); /* set address */
>> -
>> -	if (err < 0) {
>> +	if (err < 0)
>> +		debug("\n       usb_set_address return < 0\n");
> 
> Please print the return code here.

Good idea.

> 
> Is dev->status always set by usb_set_address() when err < 0 ?

Yes.  The status is filled in as far as I can tell.  I had
received other values when exceeding timing thresholds with
too many printfs() to the serial port while debugging.

The usb hardware hardware devices seem to like their initialization
to be completed in a timely manner.

Jason.

> 
>> +	if (err < 0 && dev->status != 0) {
>>  		printf("\n      USB device not accepting new address " \
>>  			"(error=%lX)\n", dev->status);
>> -		return err;
>> +			return err;
>>  	}
>>  
>>  	mdelay(10);	/* Let the SET_ADDRESS settle */
>>

  reply	other threads:[~2020-08-18 18:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18 14:34 [RESEND][PATCH 0/3] Raspberry pi improvements usb core Jason Wessel
2020-08-18 14:34 ` [RESEND][PATCH 1/3] usb_kbd: succeed even if no interrupt is pending Jason Wessel
2020-08-18 15:05   ` Marek Vasut
2020-08-18 16:54     ` Jason Wessel
2020-08-18 17:20       ` Marek Vasut
2020-08-18 18:47         ` Jason Wessel
2020-08-18 21:00           ` Marek Vasut
2020-08-18 14:34 ` [RESEND][PATCH 2/3] common/usb.c: Work around keyboard reporting "USB device not accepting new address" Jason Wessel
2020-08-18 15:08   ` Marek Vasut
2020-08-18 18:16     ` Jason Wessel [this message]
2020-08-18 21:05       ` Marek Vasut
2020-08-18 14:34 ` [RESEND][PATCH 3/3] usb.c: Add a retry in the usb_prepare_device() Jason Wessel
2020-08-18 15:08   ` Marek Vasut
2020-08-18 18:01     ` Jason Wessel
2020-08-18 21:06       ` Marek Vasut
2020-08-18 15:00 ` [RESEND][PATCH 0/3] Raspberry pi improvements usb core Marek Vasut

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=e2eafc19-e1d7-a614-e5e4-df7becc6371b@windriver.com \
    --to=jason.wessel@windriver.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.