Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12600 Discussions

Cannot enumerate/read USB mass storage if Linux booted from USB

Altera_Forum
Honored Contributor II
1,454 Views

Hello, 

 

I am trying to boot from the USB2.0 OTG port on my Altera SoCKit board (from Terasic), running Linux 3.18.20. I have a strange problem that I have tried to isolate as much as possible. 

 

Given: I have a Linux zImage and a dtb file. The zImage includes an initramfs for a rootfs which means that after u-boot loads the zImage (and the dtb file) into memory, prior to kicking off the boot, the media is no longer needed. 

 

(CASE: WORKING) If I place these files (zImage, dtb) on the MMC and boot from it (meaning zImage and dtb are initially loaded into memory from the MMC), then Linux is able to enumerate/read a USB stick in the USB2.0 OTG port. 

 

(CASE: not-WORKING) If I place the same files (zImage, dtb) on a USB stick and boot from the USB stick (meaning this time they are loaded into memory from the USB stick), then Linux is unable to enumerate/read the USB stick in the USB2.0 OTG port. U-boot has no problem reading these files into memory prior to kicking off the boot process. 

 

For the WORKING case the dmesg log shows ... 

 

[ 3.253471] dwc2 ffb40000.usb: DWC OTG Controller 

[ 3.258178] dwc2 ffb40000.usb: new USB bus registered, assigned bus number 1 

[ 3.265229] dwc2 ffb40000.usb: irq 160, io mem 0x00000000 

[ 3.270806] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 

[ 3.277580] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 

[ 3.284780] usb usb1: Product: DWC OTG Controller 

[ 3.289463] usb usb1: Manufacturer: Linux 3.18.20PLAIN-USB dwc2_hsotg 

[ 3.295884] usb usb1: SerialNumber: ffb40000.usb 

[ 3.300904] hub 1-0:1.0: USB hub found 

[ 3.304678] hub 1-0:1.0: 1 port detected 

[ 3.308811] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver 

[ 3.315385] usbcore: registered new interface driver uas 

[ 3.320761] usbcore: registered new interface driver usb-storage 

and then a little later: 

[ 4.143425] usb 1-1: new high-speed USB device number 2 using dwc2 

[ 4.253585] udevd[568]: starting version 182 

[ 4.353988] usb 1-1: New USB device found, idVendor=18a5, idProduct=0304 

[ 4.360690] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 

[ 4.367903] usb 1-1: Product: STORE N GO 

[ 4.373613] usb 1-1: Manufacturer: Verbatim 

[ 4.379696] usb 1-1: SerialNumber: 1208000000006A8D 

[ 4.444049] usb-storage 1-1:1.0: USB Mass Storage device detected 

[ 4.461279] scsi host0: usb-storage 1-1:1.0 

 

For the NOT-WORKING case the dmesg log shows... 

 

[ 3.273488] dwc2 ffb40000.usb: DWC OTG Controller 

[ 3.278195] dwc2 ffb40000.usb: new USB bus registered, assigned bus number 1 

[ 3.285245] dwc2 ffb40000.usb: irq 160, io mem 0x00000000 

[ 3.290814] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 

[ 3.297587] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 

[ 3.304787] usb usb1: Product: DWC OTG Controller 

[ 3.309470] usb usb1: Manufacturer: Linux 3.18.20PLAIN-USB dwc2_hsotg 

[ 3.315889] usb usb1: SerialNumber: ffb40000.usb 

[ 3.320903] hub 1-0:1.0: USB hub found 

[ 3.324677] hub 1-0:1.0: 1 port detected 

[ 3.328810] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver 

[ 3.335384] usbcore: registered new interface driver uas 

[ 3.340759] usbcore: registered new interface driver usb-storage 

same as before, and then a little later: 

[ 4.265500] udevd[567]: starting version 182 

[ 4.393461] usb 1-1: new high-speed USB device number 2 using dwc2 

[ 19.583374] usb 1-1: device descriptor read/64, error -110 

udevd[567]: worker [576] timeout, kill it 

 

 

udevd[567]: seq 529 '/devices/soc/ffb40000.usb/usb1' killed 

 

 

[ 34.859798] random: dd urandom read with 42 bits of entropy available 

[ 34.883443] usb 1-1: device descriptor read/64, error -110 

[ 35.183449] usb 1-1: new high-speed USB device number 3 using dwc2 

 

and then after booting is complete some more messages: 

 

Poky (Yocto Project Reference Distro) 1.7.3 cyclone5 /dev/ttyS0 

 

 

cyclone5 login: [ 50.373372] usb 1-1: device descriptor read/64, error -110 

[ 65.673370] usb 1-1: device descriptor read/64, error -110 

[ 65.973367] usb 1-1: new high-speed USB device number 4 using dwc2 

[ 76.393373] usb 1-1: device not accepting address 4, error -110 

[ 76.583368] usb 1-1: new high-speed USB device number 5 using dwc2 

[ 87.003368] usb 1-1: device not accepting address 5, error -110 

[ 87.009297] usb usb1-port1: unable to enumerate USB device 

 

 

 

 

Can anybody out there shed some light on this behavior and what I can do to fix it?  

 

I'll add that in u-boot I use the exact same bootcmd sequence, replacing the "mmc" loads with "usb" loads to memory. 

 

bootcmd=run callscript;run mmcload;run bridge_enable_handoff;run mmcboot 

 

 

usbbootcmd 'run callscript;run usbload;run bridge_enable_handoff;run usbboot' 

 

 

 

 

 

Thanks in advance for insights out there! 

 

George Broz 

Moog Industrial Group 

 

 

0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
684 Views

Further developments: 

 

Indications are that u-boot leaves USB initialized in some way that makes it unusable to Linux. 

 

If I simply do a 'usb start' then I get the "NOT-WORKING" results in my previous post regardless from where the zImage/dtb files are loaded.  

 

Can anybody comment on how to 'un-initialize' the USB subsystem in u-boot so that Linux can later use it?? (I tried 'usb reset', 'usb stop', and 'usb stop f' - these did not help). 

 

Thanks, 

 

George Broz 

Moog Industrial Group
0 Kudos
Altera_Forum
Honored Contributor II
684 Views

Problem solved: 

 

U-boot doesn't reset the hardware with the 'usb stop' command. 

 

Issuing a reset via the csftrst bit of the grstctrl register for the appropriate USB port using the u-boot 'mw' command after the zImage/dtb were loaded into memory (and after 'usb stop' was issued for good measure) did the trick. 

 

Example: mw ffb40010 1 

 

I can now boot from a USB stick. 

 

Hope this helps anyone else out there trying to do the same! 

 

George Broz 

Moog Industrial Group
0 Kudos
Reply