[U-Boot] 'usb start' works very unstable

Sergei Trofimovich
2010-08-07T07:18:48Z

I have 250GB USB-HDD attached to sheevaplug and using u-boot

U-Boot 2010.03-00176-g42f7128 (Aug 06 2010 - 22:24:34)
Marvell-Sheevaplug

It's a tip of 'u-boot-marvell/testing' branch.
I'm currently booting linux kernel from NAND
and using ext4 rootfs placed on this USB HDD.
Everything works mostly fine here (in-NAND
kernel and usb survive multiple reboots).

The problem is faulty usb detection in u-boot prompt.

After some reboots (one reboot is usually enough)
u-boot can't find attached USB storages:

# reboot linux kernel and stop at u-boot prompt
Marvell>> usb start
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... error in inquiry
0 Storage Device(s) found
Marvell>> usb start
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... 0 Storage Device(s) found
#ok, usb is dead? let's see if linux kernel will find it
Marvell>> nand read 0x01000000 0x00100000 0x00400000

NAND read: device 0 offset 0x100000, size 0x400000
4194304 bytes read: OK
Marvell>> setenv boot
bootdelay bootargs bootcmd
Marvell>> setenv bootargs console=ttyS0,115200 root=/dev/sda3 rw rootwait #points to usb hdd!
Marvell>> bootm 0x01000000
## Booting kernel from Legacy Image at 01000000 ...
Image Name: Linux-2.6.35
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2192340 Bytes = 2.1 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel ...
<skip>
[ 22.867424] Waiting for root device /dev/sda3...
[ 23.015860] scsi0 : usb-storage 1-1:1.0
[ 26.054268] scsi 0:0:0:0: Direct-Access StoreJet Transcend PQ: 0 ANSI: 2 CCS
[ 28.774083] sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)
[ 28.782324] sd 0:0:0:0: [sda] Write Protect is off
[ 28.787167] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 28.794693] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 28.800822] sda: sda1 sda2 sda3 sda4
[ 28.909571] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 28.915736] sd 0:0:0:0: [sda] Attached SCSI disk
[ 28.944594] EXT3-fs (sda3): error: couldn't mount because of unsupported optional features (240)
[ 28.953954] EXT2-fs (sda3): error: couldn't mount because of unsupported optional features (240)
[ 28.992562] EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null)
[ 29.000323] VFS: Mounted root (ext4 filesystem) on device 8:3.
[ 29.006227] Freeing init memory: 112K
INIT: version 2.87 booting

And it finds it! *phew*
It usually takes ~4 seconds to wait for root.

When I power off/power on sheevaplug I am able
to load something directly from USB:
Marvell>> usb start
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... 1 Storage Device(s) found
Marvell>> usb storage
Device 0: Vendor: StoreJet Rev: Prod: Transcend
Type: Hard Disk
Capacity: 28759.9 MB = 28.0 GB (488397168 x 512)

Heh, capacity is reported incorrectly, but it works am I'm able
to load kernel from there.

Marvell>> ext2ls usb 0:2 /
1024 .
1024 ..
12288 lost+found
<SYM> 1 boot
0 .keep
4466528 vmlinuz-2.6.35
904705 System.map-2.6.35
49205 config-2.6.35
4466528 vmlinuz-2.6.35.old
904705 System.map-2.6.35.old
49205 config-2.6.35.old
2192404 uImage-2.6.35
331132 u-boot.kwb-20100806

Marvell>> ext2load usb 0:2 0x01000000 /uImage-2.6.35
Loading file "/uImage-2.6.35" from usb device 0:2 (usbda2)
2192404 bytes read
Marvell>> bootm 0x01000000
## Booting kernel from Legacy Image at 01000000 ...
Image Name: Linux-2.6.35
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2192340 Bytes = 2.1 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel ...

and up to the shell#

If I reboot u-boot can't find usb storages (but the in-NAND kernel will boot):
[ 249.433555] Restarting system.

U-Boot 2010.03-00176-g42f7128 (Aug 06 2010 - 22:24:34)
Marvell-Sheevaplug
...
Hit any key to stop autoboot: 0
Marvell>> usb start
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... error in inquiry
0 Storage Device(s) found

All these things are almost 100% reproducible.

Vendor-shipped (Marvell's) u-boot has exactly the same disease:
** MARVELL BOARD: SHEEVA PLUG LE
U-Boot 1.1.4 (Mar 19 2009 - 16:06:59) Marvell version: 3.4.16

--

Sergei
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100807/3ef746d5/attachment.pgp