Skip to contentSkip to conversation

usb: Fail to get descriptor for USB 2.0 device

U-Boot DATACOM - Paulo.Zaneti 3 participants 12 messages May 23, 2018 – May 24, 2018

lore
Share & tools
lore
#0 lore raw

Hi,

When trying to migrate a board from u-boot version 2016.09 to version 2018.03, I found a problem with a USB 2.0 device which used to work on version 2016.09.

In u-boot version 2016.09 the device appears like this:

2: Mass Storage,  USB Revision 2.0
 - SanDisk Cruzer Blade 200443243002FB509E64
 - Class: (from Interface) Mass Storage
 - PacketSize: 64  Configurations: 1
 - Vendor: 0x0781  Product 0x5567 Version 1.38
   Configuration: 1
   - Interfaces: 1 Bus Powered 200mA
     Interface: 0
     - Alternate Setting 0, Endpoints: 2
     - Class Mass Storage, Transp. SCSI, Bulk only
     - Endpoint 1 In Bulk MaxPacket 512
     - Endpoint 2 Out Bulk MaxPacket 512

But in version 2018.03 I just can't start usb. It fails with following error:

=> usb start
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... EHCI timed out on TD - token=0x80008c80 unable to get device descriptor (error=-1)
1 USB Device(s) found
USB1:   USB EHCI 1.00
scanning bus 1 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

I did a "git bisect" and found that this problem is related to the following commit:

c008faa usb: Only get 64 bytes device descriptor for full speed devices

I am not an expert on USB, so I would like to ask for help on this issue.

In u-boot v2018.03, file common/usb.c, line 973, shouldn't the comparison be like this:

        if (do_read && dev->speed >= USB_SPEED_FULL) {

or, at list:

        if (do_read && (dev->speed == USB_SPEED_FULL || dev->speed ==
USB_SPEED_HIGH)) {

I would submit a patch for this, but I lack on USB knowledge for explaining the patch.

#1 lore raw
Quoted 1 line · DATACOM - Paulo.Zaneti

Hi,

Hi,

Quoted 3 lines

When trying to migrate a board from u-boot version 2016.09 to version 2018.03, I found a problem with a USB 2.0 device which used to work on version 2016.09.

Does it still happen in u-boot/master ?

Quoted 51 lines

In u-boot version 2016.09 the device appears like this:

2: Mass Storage,  USB Revision 2.0
 - SanDisk Cruzer Blade 200443243002FB509E64
 - Class: (from Interface) Mass Storage
 - PacketSize: 64  Configurations: 1
 - Vendor: 0x0781  Product 0x5567 Version 1.38
   Configuration: 1
   - Interfaces: 1 Bus Powered 200mA
     Interface: 0
     - Alternate Setting 0, Endpoints: 2
     - Class Mass Storage, Transp. SCSI, Bulk only
     - Endpoint 1 In Bulk MaxPacket 512
     - Endpoint 2 Out Bulk MaxPacket 512

But in version 2018.03 I just can't start usb. It fails with following error:

=> usb start
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... EHCI timed out on TD - token=0x80008c80 unable to get device descriptor (error=-1)
1 USB Device(s) found
USB1:   USB EHCI 1.00
scanning bus 1 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found

I did a "git bisect" and found that this problem is related to the following commit:

c008faa usb: Only get 64 bytes device descriptor for full speed devices

I am not an expert on USB, so I would like to ask for help on this issue.

In u-boot v2018.03, file common/usb.c, line 973, shouldn't the comparison be like this:

        if (do_read && dev->speed >= USB_SPEED_FULL) {

or, at list:

        if (do_read && (dev->speed == USB_SPEED_FULL || dev->speed == USB_SPEED_HIGH)) {

I would submit a patch for this, but I lack on USB knowledge for explaining the patch.

Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw
Quoted 8 lines · Marek Vasut
Quoted 1 line · DATACOM - Paulo.Zaneti

Hi,

Hi,

Quoted 3 lines

When trying to migrate a board from u-boot version 2016.09 to version 2018.03, I found a problem with a USB 2.0 device which used to work on version 2016.09.

Does it still happen in u-boot/master ?

Yes, it still happens.

I just tested it with the following commit:
dca268a .travis.yml: Further optimizations

Quoted 53 lines
Quoted 52 lines

In u-boot version 2016.09 the device appears like this:

2: Mass Storage,  USB Revision 2.0
 - SanDisk Cruzer Blade 200443243002FB509E64
 - Class: (from Interface) Mass Storage
 - PacketSize: 64  Configurations: 1
 - Vendor: 0x0781  Product 0x5567 Version 1.38
   Configuration: 1
   - Interfaces: 1 Bus Powered 200mA
     Interface: 0
     - Alternate Setting 0, Endpoints: 2
     - Class Mass Storage, Transp. SCSI, Bulk only
     - Endpoint 1 In Bulk MaxPacket 512
     - Endpoint 2 Out Bulk MaxPacket 512

But in version 2018.03 I just can't start usb. It fails with following error:

=> usb start
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... EHCI timed out on TD - token=0x80008c80 unable to get device descriptor (error=-1)
1 USB Device(s) found
USB1:   USB EHCI 1.00
scanning bus 1 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

I did a "git bisect" and found that this problem is related to the following commit:

c008faa usb: Only get 64 bytes device descriptor for full speed devices

I am not an expert on USB, so I would like to ask for help on this issue.

In u-boot v2018.03, file common/usb.c, line 973, shouldn't the comparison be like this:

        if (do_read && dev->speed >= USB_SPEED_FULL) {

or, at list:

        if (do_read && (dev->speed == USB_SPEED_FULL || dev->speed ==
USB_SPEED_HIGH)) {

I would submit a patch for this, but I lack on USB knowledge for explaining the patch.

#3 lore raw
Quoted 7 lines · DATACOM - Paulo.Zaneti
Quoted 4 lines · Marek Vasut
Quoted 1 line · DATACOM - Paulo.Zaneti

Hi,

Hi,

Quoted 13 lines
Quoted 4 lines
Quoted 3 lines

When trying to migrate a board from u-boot version 2016.09 to version 2018.03, I found a problem with a USB 2.0 device which used to work on version 2016.09.

Does it still happen in u-boot/master ?

Yes, it still happens.

I just tested it with the following commit:
dca268a .travis.yml: Further optimizations

Quoted 5 lines
Quoted 5 lines

In u-boot version 2016.09 the device appears like this:

2: Mass Storage,  USB Revision 2.0
  - SanDisk Cruzer Blade 200443243002FB509E64

Let me guess, is this a DWC2-based host ? You didn't mention which SoC or USB controller it is.

Cfr https://lists.denx.de/pipermail/u-boot/2016-January/240090.html , DWC2 has problems with those sandisk sticks.

Signature · 2 lines
Best regards,
Marek Vasut
#4 lore raw
Quoted 17 lines · Marek Vasut
Quoted 16 lines · DATACOM - Paulo.Zaneti
Quoted 8 lines · Marek Vasut
Quoted 1 line · DATACOM - Paulo.Zaneti

Hi,

Hi,

Quoted 3 lines

When trying to migrate a board from u-boot version 2016.09 to version 2018.03, I found a problem with a USB 2.0 device which used to work on version 2016.09.

Does it still happen in u-boot/master ?

Yes, it still happens.

I just tested it with the following commit:
dca268a .travis.yml: Further optimizations

Quoted 2 lines
Quoted 2 lines

In u-boot version 2016.09 the device appears like this:

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

2: Mass Storage,  USB Revision 2.0
  - SanDisk Cruzer Blade 200443243002FB509E64

Let me guess, is this a DWC2-based host ? You didn't mention which SoC or USB controller it is.

Cfr https://lists.denx.de/pipermail/u-boot/2016-January/240090.html , DWC2 has problems with those sandisk sticks.

No, it is a NXP T1024 SoC.
Do you think it may be a problem with the SoC or NXP USB host driver ?

#5 lore raw
Quoted 22 lines · DATACOM - Paulo.Zaneti
Quoted 19 lines · Marek Vasut
Quoted 18 lines · DATACOM - Paulo.Zaneti
Quoted 8 lines · Marek Vasut
Quoted 1 line · DATACOM - Paulo.Zaneti

Hi,

Hi,

Quoted 3 lines

When trying to migrate a board from u-boot version 2016.09 to version 2018.03, I found a problem with a USB 2.0 device which used to work on version 2016.09.

Does it still happen in u-boot/master ?

Yes, it still happens.

I just tested it with the following commit:
dca268a .travis.yml: Further optimizations

Quoted 4 lines
Quoted 4 lines

In u-boot version 2016.09 the device appears like this:

2: Mass Storage,  USB Revision 2.0
   - SanDisk Cruzer Blade 200443243002FB509E64

Quoted 8 lines
Quoted 5 lines

Let me guess, is this a DWC2-based host ? You didn't mention which SoC or USB controller it is.

Cfr https://lists.denx.de/pipermail/u-boot/2016-January/240090.html , DWC2 has problems with those sandisk sticks.

No, it is a NXP T1024 SoC.
Do you think it may be a problem with the SoC or NXP USB host driver ?

So that's chipidea ? That one should be reasonably sane.

Submit the patch you had in mind and let's see what happens.

Signature · 2 lines
Best regards,
Marek Vasut
#6 lore raw
Quoted 24 lines · Marek Vasut
Quoted 23 lines · DATACOM - Paulo.Zaneti
Quoted 21 lines · Marek Vasut
Quoted 5 lines · DATACOM - Paulo.Zaneti
Quoted 4 lines · Marek Vasut
Quoted 1 line · DATACOM - Paulo.Zaneti

Hi,

Hi,

Quoted 12 lines
Quoted 4 lines
Quoted 3 lines

When trying to migrate a board from u-boot version 2016.09 to version 2018.03, I found a problem with a USB 2.0 device which used to work on version 2016.09.

Does it still happen in u-boot/master ?

Yes, it still happens.

I just tested it with the following commit:
dca268a .travis.yml: Further optimizations

Quoted 4 lines
Quoted 4 lines

In u-boot version 2016.09 the device appears like this:

2: Mass Storage,  USB Revision 2.0
   - SanDisk Cruzer Blade 200443243002FB509E64

Let me guess, is this a DWC2-based host ? You didn't mention which SoC or USB controller it is.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Cfr https://lists.denx.de/pipermail/u-boot/2016-January/240090.html , DWC2 has problems with those sandisk sticks.

No, it is a NXP T1024 SoC.
Do you think it may be a problem with the SoC or NXP USB host driver ?

So that's chipidea ? That one should be reasonably sane.

I don't think so. It uses following drivers:
  drivers/usb/host/ehci-fsl.c
  drivers/usb/host/ehci-hcd.c

Quoted 2 lines

Submit the patch you had in mind and let's see what happens.

I just noticed that this stick needs more time after the usb_set_address() call.
I increased the mdelay(10) to mdelay(20) and the "usb start" command worked. But the problem is that I am still not convinced that this should be the solution.

Quoted 1 line
#7 lore raw
Quoted 31 lines · DATACOM - Paulo.Zaneti
Quoted 28 lines · Marek Vasut
Quoted 27 lines · DATACOM - Paulo.Zaneti
Quoted 25 lines · Marek Vasut
Quoted 10 lines · DATACOM - Paulo.Zaneti
Quoted 9 lines · Marek Vasut
Quoted 1 line · DATACOM - Paulo.Zaneti

Hi,

Hi,

Quoted 5 lines

When trying to migrate a board from u-boot version 2016.09 to version
2018.03, I found a problem with a USB 2.0 device which used to work on
version 2016.09.

Quoted 9 lines
Quoted 1 line

Does it still happen in u-boot/master ?

Yes, it still happens.

I just tested it with the following commit:
dca268a .travis.yml: Further optimizations

Quoted 4 lines
Quoted 4 lines

In u-boot version 2016.09 the device appears like this:

2: Mass Storage,  USB Revision 2.0
    - SanDisk Cruzer Blade 200443243002FB509E64

Let me guess, is this a DWC2-based host ? You didn't mention which SoC or USB controller it is.

Cfr https://lists.denx.de/pipermail/u-boot/2016-January/240090.html , DWC2 has problems with those sandisk sticks.

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

No, it is a NXP T1024 SoC.
Do you think it may be a problem with the SoC or NXP USB host driver ?

So that's chipidea ? That one should be reasonably sane.

I don't think so. It uses following drivers:
  drivers/usb/host/ehci-fsl.c
  drivers/usb/host/ehci-hcd.c

Should be chipidea IP.

Quoted 7 lines
Quoted 1 line

Submit the patch you had in mind and let's see what happens.

I just noticed that this stick needs more time after the usb_set_address() call.
I increased the mdelay(10) to mdelay(20) and the "usb start" command worked.
But the problem is that I am still not convinced that this should be the solution.

Try setenv usb_pgood_delay 10000 ; usb reset then ?

Signature · 2 lines
Best regards,
Marek Vasut
#8 lore raw
In reply to DATACOM - Paulo.Zaneti

Hi,

Quoted 52 lines · DATACOM - Paulo.Zaneti
Quoted 36 lines · Marek Vasut
Quoted 34 lines · DATACOM - Paulo.Zaneti
Quoted 31 lines · Marek Vasut
Quoted 14 lines · DATACOM - Paulo.Zaneti
Quoted 12 lines · Marek Vasut
Quoted 2 lines · DATACOM - Paulo.Zaneti

Hi,

Hi,

Quoted 4 lines

When trying to migrate a board from u-boot version 2016.09 to version 2018.03, I found a problem with a USB 2.0 device which used to work on
version 2016.09.

Quoted 11 lines
Quoted 1 line

Does it still happen in u-boot/master ?

Yes, it still happens.

I just tested it with the following commit:
dca268a .travis.yml: Further optimizations

Quoted 5 lines
Quoted 5 lines

In u-boot version 2016.09 the device appears like this:

2: Mass Storage, USB Revision 2.0
- SanDisk Cruzer Blade 200443243002FB509E64

Let me guess, is this a DWC2-based host ? You didn't mention which SoC or USB controller it is.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

Cfr https://lists.denx.de/pipermail/u-boot/2016-January/240090.html , DWC2 has problems with those sandisk sticks.

No, it is a NXP T1024 SoC.
Do you think it may be a problem with the SoC or NXP USB host driver ?

So that's chipidea ? That one should be reasonably sane.

I don't think so. It uses following drivers:
drivers/usb/host/ehci-fsl.c
drivers/usb/host/ehci-hcd.c

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Submit the patch you had in mind and let's see what happens.

I just noticed that this stick needs more time after the usb_set_address() call.
I increased the mdelay(10) to mdelay(20) and the "usb start" command worked. But the problem is that I am still not convinced that this should be the solution.

Agreed. Can you bisect to see which commit broke your stick?

Regards,
Bin

#9 lore raw
Quoted 41 lines · Bin Meng

Hi,

Quoted 37 lines · DATACOM - Paulo.Zaneti
Quoted 25 lines · Marek Vasut
Quoted 24 lines · DATACOM - Paulo.Zaneti
Quoted 22 lines · Marek Vasut
Quoted 9 lines · DATACOM - Paulo.Zaneti
Quoted 8 lines · Marek Vasut
Quoted 1 line · DATACOM - Paulo.Zaneti

Hi,

Hi,

Quoted 4 lines

When trying to migrate a board from u-boot version 2016.09 to version 2018.03, I found a problem with a USB 2.0 device which used to work on
version 2016.09.

Quoted 9 lines
Quoted 1 line

Does it still happen in u-boot/master ?

Yes, it still happens.

I just tested it with the following commit:
dca268a .travis.yml: Further optimizations

Quoted 4 lines
Quoted 4 lines

In u-boot version 2016.09 the device appears like this:

2: Mass Storage, USB Revision 2.0
- SanDisk Cruzer Blade 200443243002FB509E64

Let me guess, is this a DWC2-based host ? You didn't mention which SoC or USB controller it is.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Cfr https://lists.denx.de/pipermail/u-boot/2016-January/240090.html , DWC2 has problems with those sandisk sticks.

No, it is a NXP T1024 SoC.
Do you think it may be a problem with the SoC or NXP USB host driver ?

So that's chipidea ? That one should be reasonably sane.

I don't think so. It uses following drivers:
drivers/usb/host/ehci-fsl.c
drivers/usb/host/ehci-hcd.c

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

Submit the patch you had in mind and let's see what happens.

I just noticed that this stick needs more time after the usb_set_address() call.
I increased the mdelay(10) to mdelay(20) and the "usb start" command worked. But the problem is that I am still not convinced that this should be the solution.

Agreed. Can you bisect to see which commit broke your stick?

Yes. The commit which broke my stick is:

commit c008faa77358bb5b313696dd1d5bb8afa03a6ca2
Author: Bin Meng <[email protected]>
Date:   Mon Sep 18 06:40:42 2017 -0700

    usb: Only get 64 bytes device descriptor for full speed devices

My first guess was that this commit should be adapted to "get_descriptor_len()" for USB_SPEED_HIGH too.

But then, I realized that I can bypass this problem by increasing the mdelay() after usb_set_address() from 10 to 20 msec.

So, I think commit c008faa77358bb5b313696dd1d5bb8afa03a6ca2 is not the offender one. It probably uncovered another problem with this stick.

I will try to get a better understanding before submitting a patch.

Quoted 3 lines

Regards,
Bin

Thank you guys for all the help. I hope I can contribute back too.

Regards,
Paulo

#10 lore raw
Quoted 66 lines · DATACOM - Paulo.Zaneti
Quoted 53 lines · Bin Meng

Hi,

Quoted 40 lines · DATACOM - Paulo.Zaneti
Quoted 28 lines · Marek Vasut
Quoted 27 lines · DATACOM - Paulo.Zaneti
Quoted 25 lines · Marek Vasut
Quoted 11 lines · DATACOM - Paulo.Zaneti
Quoted 10 lines · Marek Vasut
Quoted 1 line · DATACOM - Paulo.Zaneti

Hi,

Hi,

Quoted 6 lines

When trying to migrate a board from u-boot version 2016.09 to version
2018.03, I found a problem with a USB 2.0 device which used to work
on
version 2016.09.

Quoted 9 lines
Quoted 1 line

Does it still happen in u-boot/master ?

Yes, it still happens.

I just tested it with the following commit:
dca268a .travis.yml: Further optimizations

Quoted 4 lines
Quoted 4 lines

In u-boot version 2016.09 the device appears like this:

2: Mass Storage,  USB Revision 2.0
     - SanDisk Cruzer Blade 200443243002FB509E64

Let me guess, is this a DWC2-based host ? You didn't mention which SoC
or USB controller it is.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Cfr https://lists.denx.de/pipermail/u-boot/2016-January/240090.html , DWC2 has problems with those sandisk sticks.

No, it is a NXP T1024 SoC.
Do you think it may be a problem with the SoC or NXP USB host driver ?

So that's chipidea ? That one should be reasonably sane.

I don't think so. It uses following drivers:
   drivers/usb/host/ehci-fsl.c
   drivers/usb/host/ehci-hcd.c

Quoted 9 lines
Quoted 1 line

Submit the patch you had in mind and let's see what happens.

I just noticed that this stick needs more time after the usb_set_address()
call.
I increased the mdelay(10) to mdelay(20) and the "usb start" command worked.
But the problem is that I am still not convinced that this should be the solution.

Quoted 1 line

Agreed. Can you bisect to see which commit broke your stick?

Yes. The commit which broke my stick is:

commit c008faa77358bb5b313696dd1d5bb8afa03a6ca2
Author: Bin Meng <[email protected]>
Date:   Mon Sep 18 06:40:42 2017 -0700

    usb: Only get 64 bytes device descriptor for full speed devices

Quoted 8 lines

My first guess was that this commit should be adapted to "get_descriptor_len()" for USB_SPEED_HIGH too.

But then, I realized that I can bypass this problem by increasing the mdelay() after usb_set_address() from 10 to 20 msec.

So, I think commit c008faa77358bb5b313696dd1d5bb8afa03a6ca2 is not the offender one. It probably uncovered another problem with this stick.

That particular lineup of sandisk sticks is trash, I have a few of those here for testing too.

Quoted 1 line

I will try to get a better understanding before submitting a patch.

Did usb_pgood_delay help ?

Signature · 2 lines
Best regards,
Marek Vasut
#11 lore raw
Quoted 70 lines · Marek Vasut
Quoted 69 lines · DATACOM - Paulo.Zaneti
Quoted 51 lines · Bin Meng

Hi,

Quoted 38 lines · DATACOM - Paulo.Zaneti
Quoted 27 lines · Marek Vasut
Quoted 26 lines · DATACOM - Paulo.Zaneti
Quoted 25 lines · Marek Vasut
Quoted 11 lines · DATACOM - Paulo.Zaneti
Quoted 10 lines · Marek Vasut
Quoted 1 line · DATACOM - Paulo.Zaneti

Hi,

Hi,

Quoted 6 lines

When trying to migrate a board from u-boot version 2016.09 to version
2018.03, I found a problem with a USB 2.0 device which used to work
on
version 2016.09.

Quoted 9 lines
Quoted 1 line

Does it still happen in u-boot/master ?

Yes, it still happens.

I just tested it with the following commit:
dca268a .travis.yml: Further optimizations

Quoted 4 lines
Quoted 4 lines

In u-boot version 2016.09 the device appears like this:

2: Mass Storage,  USB Revision 2.0
     - SanDisk Cruzer Blade 200443243002FB509E64

Let me guess, is this a DWC2-based host ? You didn't mention which SoC
or USB controller it is.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Cfr https://lists.denx.de/pipermail/u-boot/2016-January/240090.html , DWC2 has problems with those sandisk sticks.

No, it is a NXP T1024 SoC.
Do you think it may be a problem with the SoC or NXP USB host driver ?

So that's chipidea ? That one should be reasonably sane.

I don't think so. It uses following drivers:
   drivers/usb/host/ehci-fsl.c
   drivers/usb/host/ehci-hcd.c

Quoted 9 lines
Quoted 1 line

Submit the patch you had in mind and let's see what happens.

I just noticed that this stick needs more time after the usb_set_address()
call.
I increased the mdelay(10) to mdelay(20) and the "usb start" command worked.
But the problem is that I am still not convinced that this should be the solution.

Quoted 1 line

Agreed. Can you bisect to see which commit broke your stick?

Yes. The commit which broke my stick is:

commit c008faa77358bb5b313696dd1d5bb8afa03a6ca2
Author: Bin Meng <[email protected]>
Date:   Mon Sep 18 06:40:42 2017 -0700

    usb: Only get 64 bytes device descriptor for full speed devices

My first guess was that this commit should be adapted to "get_descriptor_len()" for USB_SPEED_HIGH too.

But then, I realized that I can bypass this problem by increasing the mdelay() after usb_set_address() from 10 to 20 msec.

Quoted 7 lines
Quoted 2 lines

So, I think commit c008faa77358bb5b313696dd1d5bb8afa03a6ca2 is not the offender one. It probably uncovered another problem with this stick.

That particular lineup of sandisk sticks is trash, I have a few of those here for testing too.

Quoted 1 line

I will try to get a better understanding before submitting a patch.

Did usb_pgood_delay help ?

Yes. It worked. Thanks for the tip.

Quoted 1 line