All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] "usb storage" command issues
@ 2017-09-26 17:03 Stefan Roese
  2017-11-20  7:07 ` Bin Meng
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Roese @ 2017-09-26 17:03 UTC (permalink / raw)
  To: u-boot

Hi,

I'm currently testing USB on my x86 platform. And noticed, that
the "usb storage" command does not work as expected:

=> usb reset  
resetting USB...
USB0:   Register 7000820 NbrPorts 7
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... 5 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
=> usb tree
USB device tree:
  1  Hub (5 Gb/s, 0mA)
  |  U-Boot XHCI Host Controller 
  |
  +-2  Mass Storage (480 Mb/s, 224mA)
  |    SanDisk Ultra 4C530001010620110505
  |  
  +-3  Hub (480 Mb/s, 0mA)
    |
    +-4  Hub (480 Mb/s, 100mA)
      |
      +-5  Hub (12 Mb/s, 100mA)
         
=> usb storage
Card did not respond to voltage select!
mmc_init: -95, time 28
No storage devices, perhaps not 'usb start'ed..?


While debugging I found, that usb_stor_info() calls blk_first_device(IF_TYPE_USB, &dev)
which calls uclass_first_device(UCLASS_BLK, devp). With my current DM tree:

=> dm tree
 Class       Probed   Name
----------------------------------------
 root        [ + ]    root_driver
...
 mmc         [ + ]    |   |-- pci_mmc
 blk         [   ]    |   |   `-- pci_mmc.blk
 mmc         [ + ]    |   |-- pci_mmc
 blk         [   ]    |   |   `-- pci_mmc.blk


the first BLK device is a MMC device. With uclass_first_device() its
probe function is called here, which fails in this case. Resulting in
an abort for the loop over all BLK devices.

How should this be handled for the "usb storage" command. Probing
all BLK devices while running this command seems a bit too much.

Any suggestions on how to fix this?

Thanks,
Stefan

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

* [U-Boot] "usb storage" command issues
  2017-09-26 17:03 [U-Boot] "usb storage" command issues Stefan Roese
@ 2017-11-20  7:07 ` Bin Meng
  2017-11-20 15:38   ` Simon Glass
  0 siblings, 1 reply; 7+ messages in thread
From: Bin Meng @ 2017-11-20  7:07 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

On Wed, Sep 27, 2017 at 1:03 AM, Stefan Roese <sr@denx.de> wrote:
> Hi,
>
> I'm currently testing USB on my x86 platform. And noticed, that
> the "usb storage" command does not work as expected:
>
> => usb reset
> resetting USB...
> USB0:   Register 7000820 NbrPorts 7
> Starting the controller
> USB XHCI 1.00
> scanning bus 0 for devices... 5 USB Device(s) found
>        scanning usb for storage devices... 1 Storage Device(s) found
> => usb tree
> USB device tree:
>   1  Hub (5 Gb/s, 0mA)
>   |  U-Boot XHCI Host Controller
>   |
>   +-2  Mass Storage (480 Mb/s, 224mA)
>   |    SanDisk Ultra 4C530001010620110505
>   |
>   +-3  Hub (480 Mb/s, 0mA)
>     |
>     +-4  Hub (480 Mb/s, 100mA)
>       |
>       +-5  Hub (12 Mb/s, 100mA)
>
> => usb storage
> Card did not respond to voltage select!
> mmc_init: -95, time 28
> No storage devices, perhaps not 'usb start'ed..?
>
>
> While debugging I found, that usb_stor_info() calls blk_first_device(IF_TYPE_USB, &dev)
> which calls uclass_first_device(UCLASS_BLK, devp). With my current DM tree:
>
> => dm tree
>  Class       Probed   Name
> ----------------------------------------
>  root        [ + ]    root_driver
> ...
>  mmc         [ + ]    |   |-- pci_mmc
>  blk         [   ]    |   |   `-- pci_mmc.blk
>  mmc         [ + ]    |   |-- pci_mmc
>  blk         [   ]    |   |   `-- pci_mmc.blk
>
>
> the first BLK device is a MMC device. With uclass_first_device() its
> probe function is called here, which fails in this case. Resulting in
> an abort for the loop over all BLK devices.
>
> How should this be handled for the "usb storage" command. Probing
> all BLK devices while running this command seems a bit too much.
>
> Any suggestions on how to fix this?
>

Sorry I missed this before. Is it still broken in current mainline?

Regards,
Bin

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

* [U-Boot] "usb storage" command issues
  2017-11-20  7:07 ` Bin Meng
@ 2017-11-20 15:38   ` Simon Glass
  2017-11-20 16:25     ` Stefan Roese
  2017-11-28  9:40     ` Stefan Roese
  0 siblings, 2 replies; 7+ messages in thread
From: Simon Glass @ 2017-11-20 15:38 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

On 20 November 2017 at 00:07, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Stefan,
>
> On Wed, Sep 27, 2017 at 1:03 AM, Stefan Roese <sr@denx.de> wrote:
> > Hi,
> >
> > I'm currently testing USB on my x86 platform. And noticed, that
> > the "usb storage" command does not work as expected:
> >
> > => usb reset
> > resetting USB...
> > USB0:   Register 7000820 NbrPorts 7
> > Starting the controller
> > USB XHCI 1.00
> > scanning bus 0 for devices... 5 USB Device(s) found
> >        scanning usb for storage devices... 1 Storage Device(s) found
> > => usb tree
> > USB device tree:
> >   1  Hub (5 Gb/s, 0mA)
> >   |  U-Boot XHCI Host Controller
> >   |
> >   +-2  Mass Storage (480 Mb/s, 224mA)
> >   |    SanDisk Ultra 4C530001010620110505
> >   |
> >   +-3  Hub (480 Mb/s, 0mA)
> >     |
> >     +-4  Hub (480 Mb/s, 100mA)
> >       |
> >       +-5  Hub (12 Mb/s, 100mA)
> >
> > => usb storage
> > Card did not respond to voltage select!
> > mmc_init: -95, time 28
> > No storage devices, perhaps not 'usb start'ed..?
> >
> >
> > While debugging I found, that usb_stor_info() calls blk_first_device(IF_TYPE_USB, &dev)
> > which calls uclass_first_device(UCLASS_BLK, devp). With my current DM tree:
> >
> > => dm tree
> >  Class       Probed   Name
> > ----------------------------------------
> >  root        [ + ]    root_driver
> > ...
> >  mmc         [ + ]    |   |-- pci_mmc
> >  blk         [   ]    |   |   `-- pci_mmc.blk
> >  mmc         [ + ]    |   |-- pci_mmc
> >  blk         [   ]    |   |   `-- pci_mmc.blk
> >
> >
> > the first BLK device is a MMC device. With uclass_first_device() its
> > probe function is called here, which fails in this case. Resulting in
> > an abort for the loop over all BLK devices.
> >
> > How should this be handled for the "usb storage" command. Probing
> > all BLK devices while running this command seems a bit too much.
> >
> > Any suggestions on how to fix this?
> >
>
> Sorry I missed this before. Is it still broken in current mainline?

Me too.

Probing the block device should call mmc_blk_probe() which should call
mmc_init(), etc. I'm not sure what is going wrong there?

Regards,
Simon

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

* [U-Boot] "usb storage" command issues
  2017-11-20 15:38   ` Simon Glass
@ 2017-11-20 16:25     ` Stefan Roese
  2017-11-28  9:40     ` Stefan Roese
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Roese @ 2017-11-20 16:25 UTC (permalink / raw)
  To: u-boot

Hi Simon, Hi Bin,

On 20.11.2017 16:38, Simon Glass wrote:
> On 20 November 2017 at 00:07, Bin Meng <bmeng.cn@gmail.com> wrote:
>>
>> Hi Stefan,
>>
>> On Wed, Sep 27, 2017 at 1:03 AM, Stefan Roese <sr@denx.de> wrote:
>>> Hi,
>>>
>>> I'm currently testing USB on my x86 platform. And noticed, that
>>> the "usb storage" command does not work as expected:
>>>
>>> => usb reset
>>> resetting USB...
>>> USB0:   Register 7000820 NbrPorts 7
>>> Starting the controller
>>> USB XHCI 1.00
>>> scanning bus 0 for devices... 5 USB Device(s) found
>>>         scanning usb for storage devices... 1 Storage Device(s) found
>>> => usb tree
>>> USB device tree:
>>>    1  Hub (5 Gb/s, 0mA)
>>>    |  U-Boot XHCI Host Controller
>>>    |
>>>    +-2  Mass Storage (480 Mb/s, 224mA)
>>>    |    SanDisk Ultra 4C530001010620110505
>>>    |
>>>    +-3  Hub (480 Mb/s, 0mA)
>>>      |
>>>      +-4  Hub (480 Mb/s, 100mA)
>>>        |
>>>        +-5  Hub (12 Mb/s, 100mA)
>>>
>>> => usb storage
>>> Card did not respond to voltage select!
>>> mmc_init: -95, time 28
>>> No storage devices, perhaps not 'usb start'ed..?
>>>
>>>
>>> While debugging I found, that usb_stor_info() calls blk_first_device(IF_TYPE_USB, &dev)
>>> which calls uclass_first_device(UCLASS_BLK, devp). With my current DM tree:
>>>
>>> => dm tree
>>>   Class       Probed   Name
>>> ----------------------------------------
>>>   root        [ + ]    root_driver
>>> ...
>>>   mmc         [ + ]    |   |-- pci_mmc
>>>   blk         [   ]    |   |   `-- pci_mmc.blk
>>>   mmc         [ + ]    |   |-- pci_mmc
>>>   blk         [   ]    |   |   `-- pci_mmc.blk
>>>
>>>
>>> the first BLK device is a MMC device. With uclass_first_device() its
>>> probe function is called here, which fails in this case. Resulting in
>>> an abort for the loop over all BLK devices.
>>>
>>> How should this be handled for the "usb storage" command. Probing
>>> all BLK devices while running this command seems a bit too much.
>>>
>>> Any suggestions on how to fix this?
>>>
>>
>> Sorry I missed this before. Is it still broken in current mainline?
> 
> Me too.
> 
> Probing the block device should call mmc_blk_probe() which should call
> mmc_init(), etc. I'm not sure what is going wrong there?

I'm currently traveling and frankly I don't recall everything on this
issue. I need to dig into this, once I'm back in the office end of
this week. But many thanks for checking on this.

Thanks,
Stefan

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

* [U-Boot] "usb storage" command issues
  2017-11-20 15:38   ` Simon Glass
  2017-11-20 16:25     ` Stefan Roese
@ 2017-11-28  9:40     ` Stefan Roese
  2017-11-29 13:08       ` Simon Glass
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Roese @ 2017-11-28  9:40 UTC (permalink / raw)
  To: u-boot

Hi Bin, Hi Simon,

On 20.11.2017 16:38, Simon Glass wrote:
> On 20 November 2017 at 00:07, Bin Meng <bmeng.cn@gmail.com> wrote:
>>
>> Hi Stefan,
>>
>> On Wed, Sep 27, 2017 at 1:03 AM, Stefan Roese <sr@denx.de> wrote:
>>> Hi,
>>>
>>> I'm currently testing USB on my x86 platform. And noticed, that
>>> the "usb storage" command does not work as expected:
>>>
>>> => usb reset
>>> resetting USB...
>>> USB0:   Register 7000820 NbrPorts 7
>>> Starting the controller
>>> USB XHCI 1.00
>>> scanning bus 0 for devices... 5 USB Device(s) found
>>>         scanning usb for storage devices... 1 Storage Device(s) found
>>> => usb tree
>>> USB device tree:
>>>    1  Hub (5 Gb/s, 0mA)
>>>    |  U-Boot XHCI Host Controller
>>>    |
>>>    +-2  Mass Storage (480 Mb/s, 224mA)
>>>    |    SanDisk Ultra 4C530001010620110505
>>>    |
>>>    +-3  Hub (480 Mb/s, 0mA)
>>>      |
>>>      +-4  Hub (480 Mb/s, 100mA)
>>>        |
>>>        +-5  Hub (12 Mb/s, 100mA)
>>>
>>> => usb storage
>>> Card did not respond to voltage select!
>>> mmc_init: -95, time 28
>>> No storage devices, perhaps not 'usb start'ed..?
>>>
>>>
>>> While debugging I found, that usb_stor_info() calls blk_first_device(IF_TYPE_USB, &dev)
>>> which calls uclass_first_device(UCLASS_BLK, devp). With my current DM tree:
>>>
>>> => dm tree
>>>   Class       Probed   Name
>>> ----------------------------------------
>>>   root        [ + ]    root_driver
>>> ...
>>>   mmc         [ + ]    |   |-- pci_mmc
>>>   blk         [   ]    |   |   `-- pci_mmc.blk
>>>   mmc         [ + ]    |   |-- pci_mmc
>>>   blk         [   ]    |   |   `-- pci_mmc.blk
>>>
>>>
>>> the first BLK device is a MMC device. With uclass_first_device() its
>>> probe function is called here, which fails in this case. Resulting in
>>> an abort for the loop over all BLK devices.
>>>
>>> How should this be handled for the "usb storage" command. Probing
>>> all BLK devices while running this command seems a bit too much.
>>>
>>> Any suggestions on how to fix this?
>>>
>>
>> Sorry I missed this before. Is it still broken in current mainline?

Finally I'm getting back to this issue. And yes, its still broken in
mainline.

> Me too.
> 
> Probing the block device should call mmc_blk_probe() which should call
> mmc_init(), etc. I'm not sure what is going wrong there?

The problem is, that *all* block devices are probed with the "usb
storage" command, including MMC devices, which come first in my DM tree.
As the first MMC device is not available, this command stops here with
the error listed above.

IMHO, "usb storage" should only list the USB block devices. Not sure,
if this ever worked with DM USB enabled.

Thanks,
Stefan

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

* [U-Boot] "usb storage" command issues
  2017-11-28  9:40     ` Stefan Roese
@ 2017-11-29 13:08       ` Simon Glass
  2017-11-29 15:56         ` Stefan Roese
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Glass @ 2017-11-29 13:08 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

On 28 November 2017 at 02:40, Stefan Roese <sr@denx.de> wrote:
> Hi Bin, Hi Simon,
>
> On 20.11.2017 16:38, Simon Glass wrote:
>>
>> On 20 November 2017 at 00:07, Bin Meng <bmeng.cn@gmail.com> wrote:
>>>
>>>
>>> Hi Stefan,
>>>
>>> On Wed, Sep 27, 2017 at 1:03 AM, Stefan Roese <sr@denx.de> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm currently testing USB on my x86 platform. And noticed, that
>>>> the "usb storage" command does not work as expected:
>>>>
>>>> => usb reset
>>>> resetting USB...
>>>> USB0:   Register 7000820 NbrPorts 7
>>>> Starting the controller
>>>> USB XHCI 1.00
>>>> scanning bus 0 for devices... 5 USB Device(s) found
>>>>         scanning usb for storage devices... 1 Storage Device(s) found
>>>> => usb tree
>>>> USB device tree:
>>>>    1  Hub (5 Gb/s, 0mA)
>>>>    |  U-Boot XHCI Host Controller
>>>>    |
>>>>    +-2  Mass Storage (480 Mb/s, 224mA)
>>>>    |    SanDisk Ultra 4C530001010620110505
>>>>    |
>>>>    +-3  Hub (480 Mb/s, 0mA)
>>>>      |
>>>>      +-4  Hub (480 Mb/s, 100mA)
>>>>        |
>>>>        +-5  Hub (12 Mb/s, 100mA)
>>>>
>>>> => usb storage
>>>> Card did not respond to voltage select!
>>>> mmc_init: -95, time 28
>>>> No storage devices, perhaps not 'usb start'ed..?
>>>>
>>>>
>>>> While debugging I found, that usb_stor_info() calls
>>>> blk_first_device(IF_TYPE_USB, &dev)
>>>> which calls uclass_first_device(UCLASS_BLK, devp). With my current DM
>>>> tree:
>>>>
>>>> => dm tree
>>>>   Class       Probed   Name
>>>> ----------------------------------------
>>>>   root        [ + ]    root_driver
>>>> ...
>>>>   mmc         [ + ]    |   |-- pci_mmc
>>>>   blk         [   ]    |   |   `-- pci_mmc.blk
>>>>   mmc         [ + ]    |   |-- pci_mmc
>>>>   blk         [   ]    |   |   `-- pci_mmc.blk
>>>>
>>>>
>>>> the first BLK device is a MMC device. With uclass_first_device() its
>>>> probe function is called here, which fails in this case. Resulting in
>>>> an abort for the loop over all BLK devices.
>>>>
>>>> How should this be handled for the "usb storage" command. Probing
>>>> all BLK devices while running this command seems a bit too much.
>>>>
>>>> Any suggestions on how to fix this?
>>>>
>>>
>>> Sorry I missed this before. Is it still broken in current mainline?
>
>
> Finally I'm getting back to this issue. And yes, its still broken in
> mainline.
>
>> Me too.
>>
>> Probing the block device should call mmc_blk_probe() which should call
>> mmc_init(), etc. I'm not sure what is going wrong there?
>
>
> The problem is, that *all* block devices are probed with the "usb
> storage" command, including MMC devices, which come first in my DM tree.
> As the first MMC device is not available, this command stops here with
> the error listed above.
>
> IMHO, "usb storage" should only list the USB block devices. Not sure,
> if this ever worked with DM USB enabled.

I think there is a problem in blk_first_device() and
blk_next_device(). They use uclass_first/next_device() to iterate
through the block devices, but those functions probe each device they
find, even if not a USB device.

The fix is to adjust blk_first/next_device() to use
uclass_find_first/next_device() instead, and then only probe the ones
that need to be returned.

Regards,
Simon

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

* [U-Boot] "usb storage" command issues
  2017-11-29 13:08       ` Simon Glass
@ 2017-11-29 15:56         ` Stefan Roese
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Roese @ 2017-11-29 15:56 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On 29.11.2017 14:08, Simon Glass wrote:
> Hi Stefan,
> 
> On 28 November 2017 at 02:40, Stefan Roese <sr@denx.de> wrote:
>> Hi Bin, Hi Simon,
>>
>> On 20.11.2017 16:38, Simon Glass wrote:
>>>
>>> On 20 November 2017 at 00:07, Bin Meng <bmeng.cn@gmail.com> wrote:
>>>>
>>>>
>>>> Hi Stefan,
>>>>
>>>> On Wed, Sep 27, 2017 at 1:03 AM, Stefan Roese <sr@denx.de> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I'm currently testing USB on my x86 platform. And noticed, that
>>>>> the "usb storage" command does not work as expected:
>>>>>
>>>>> => usb reset
>>>>> resetting USB...
>>>>> USB0:   Register 7000820 NbrPorts 7
>>>>> Starting the controller
>>>>> USB XHCI 1.00
>>>>> scanning bus 0 for devices... 5 USB Device(s) found
>>>>>          scanning usb for storage devices... 1 Storage Device(s) found
>>>>> => usb tree
>>>>> USB device tree:
>>>>>     1  Hub (5 Gb/s, 0mA)
>>>>>     |  U-Boot XHCI Host Controller
>>>>>     |
>>>>>     +-2  Mass Storage (480 Mb/s, 224mA)
>>>>>     |    SanDisk Ultra 4C530001010620110505
>>>>>     |
>>>>>     +-3  Hub (480 Mb/s, 0mA)
>>>>>       |
>>>>>       +-4  Hub (480 Mb/s, 100mA)
>>>>>         |
>>>>>         +-5  Hub (12 Mb/s, 100mA)
>>>>>
>>>>> => usb storage
>>>>> Card did not respond to voltage select!
>>>>> mmc_init: -95, time 28
>>>>> No storage devices, perhaps not 'usb start'ed..?
>>>>>
>>>>>
>>>>> While debugging I found, that usb_stor_info() calls
>>>>> blk_first_device(IF_TYPE_USB, &dev)
>>>>> which calls uclass_first_device(UCLASS_BLK, devp). With my current DM
>>>>> tree:
>>>>>
>>>>> => dm tree
>>>>>    Class       Probed   Name
>>>>> ----------------------------------------
>>>>>    root        [ + ]    root_driver
>>>>> ...
>>>>>    mmc         [ + ]    |   |-- pci_mmc
>>>>>    blk         [   ]    |   |   `-- pci_mmc.blk
>>>>>    mmc         [ + ]    |   |-- pci_mmc
>>>>>    blk         [   ]    |   |   `-- pci_mmc.blk
>>>>>
>>>>>
>>>>> the first BLK device is a MMC device. With uclass_first_device() its
>>>>> probe function is called here, which fails in this case. Resulting in
>>>>> an abort for the loop over all BLK devices.
>>>>>
>>>>> How should this be handled for the "usb storage" command. Probing
>>>>> all BLK devices while running this command seems a bit too much.
>>>>>
>>>>> Any suggestions on how to fix this?
>>>>>
>>>>
>>>> Sorry I missed this before. Is it still broken in current mainline?
>>
>>
>> Finally I'm getting back to this issue. And yes, its still broken in
>> mainline.
>>
>>> Me too.
>>>
>>> Probing the block device should call mmc_blk_probe() which should call
>>> mmc_init(), etc. I'm not sure what is going wrong there?
>>
>>
>> The problem is, that *all* block devices are probed with the "usb
>> storage" command, including MMC devices, which come first in my DM tree.
>> As the first MMC device is not available, this command stops here with
>> the error listed above.
>>
>> IMHO, "usb storage" should only list the USB block devices. Not sure,
>> if this ever worked with DM USB enabled.
> 
> I think there is a problem in blk_first_device() and
> blk_next_device(). They use uclass_first/next_device() to iterate
> through the block devices, but those functions probe each device they
> find, even if not a USB device.
> 
> The fix is to adjust blk_first/next_device() to use
> uclass_find_first/next_device() instead, and then only probe the ones
> that need to be returned.

Thanks. I've posted a patch to change this behavior, fixing the
"usb storage" issue, I've been experiencing:

http://patchwork.ozlabs.org/patch/842638/

Thanks,
Stefan

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

end of thread, other threads:[~2017-11-29 15:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-26 17:03 [U-Boot] "usb storage" command issues Stefan Roese
2017-11-20  7:07 ` Bin Meng
2017-11-20 15:38   ` Simon Glass
2017-11-20 16:25     ` Stefan Roese
2017-11-28  9:40     ` Stefan Roese
2017-11-29 13:08       ` Simon Glass
2017-11-29 15:56         ` Stefan Roese

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.