Other Parts Discussed in Thread: TUSB2036,
Tool/software: Linux
Team,
I am working with a customer gateway design that is based on the AM3352 and has a 3 port hub TUSB2036 device connected to USB0 which in turn is configured as Host only.
The requirement is to commission the eMMC flash using a USB mass storage device connected to one of the downstream hub ports mounted by u-boot for the target file system images etc.
We have the USB_DRVVBUS output connected to a USB switch to loop-back the VBUS to the AM3352 to satisfy the MUSB controller state machine but otherwise the TUSB2036 has downstream switches on each port and is configured as a self-powered hub.
There is a problem with u-boot first reliably detecting the downstream hub and second when the hub is detected then correctly enumerating USB MSD and USB Ethernet devices connected to the downstream hub ports.
With an external powered hub connected directly to USB0 (using a break-out cable bypassing the on-board TUSB2036) there is no issue with mounting connected devices, similarly
Our understanding is that the USB block has two checks for USBn_VBUS when acting as a Host. In order:
1) Ensure VBUS is not present prior to us asserting USBn_DRVVBUS (VBUS power switch control). The MUSB controller is dual-role capable so we need to ensure that VBUS isn’t already being provided prior to us doing so. This check can be overridden via SW for implementations that hard-wire VBUS to system 5V.
2) Ensure that VBUS is valid (>=4.4V) within 100ms of us asserting DRVVBUS. It is here to sense VBUS power switch OC as we don’t have a discrete pin for OC. This one cannot be overridden.
The TUSB2036 itself will apply a 1K5 pull-up resistor to USB_DP0 15ms after either a hard or soft reset to signal availability to the upstream USB0 port on the AM3352. It will then wait upto 3ms for the upstream controller to connect before transitioning to 'sleep' mode.
We see that VBUS goes down while u-boot USB hub code is attempting to configure hub and enumerate ports. Enabling debug makes it work (mostly) which still points at a timing issue. Still not clear whether the code is forcing VBUS down or the USB module is doing it internally.
It appears that there is a subtle timing inter-dependency when initialising the USB controller and the downstream TUSB2036 hub device.
Below is an extract from what u-boot reports, including the hub product text:
musb_lowlevel_init: DEVCTL = 19
musb_lowlevel_init: DEVCTL = 5D
_musb_reset_root_port: POWER = E0
_musb_reset_root_port: DEVCTL = 5D
scanning bus 0 for devices... New Device 0
_musb_reset_root_port: POWER = E0
_musb_reset_root_port: DEVCTL = 5D
set address 1
get_conf_no 0 Result 25, wLength 25
if 0, ep 0
##EP epmaxpacketin[1] = 1
set configuration 1
new device strings: Mfr=0, Product=1, SerialNumber=0
USB device number 1 default language ID 0x409
Manufacturer
Product General Purpose USB Hub
SerialNumber
1 USB Device(s) found
scan end
scanning usb for storage devices... 0 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found
=>
If Linux is booted serially then we consistently failing to boot Linux from USB with following as the last things logged:
[ 2.354562] Waiting for root device /dev/sda1... [ 2.468822] usb 1-1: new full-speed USB device number 2 using musb-hdrc [ 2.611069] hub 1-1:1.0: USB hub found [ 2.614973] hub 1-1:1.0: 3 ports detected [ 2.620276] musb-hdrc musb-hdrc.0.auto: VBUS_ERROR in a_host (89, <AValid), retry #1, port1 00000107 [ 2.794761] usb 1-1: USB disconnect, device number 2 [ 3.718836] hub 1-1:1.0: activate --> -19 [ 3.998796] usb 1-1: new full-speed USB device number 3 using musb-hdrc [ 4.140803] hub 1-1:1.0: USB hub found [ 4.144696] hub 1-1:1.0: 3 ports detected [ 4.428794] usb 1-1.2: new full-speed USB device number 4 using musb-hdrc [ 4.531642] usb 1-1.2: not running at top speed; connect to a high speed hub [ 5.372200] asix 1-1.2:1.0 eth0: register 'asix' at usb-musb-hdrc.0.auto-1.2, ASIX AX88772 USB 2.0 Ethernet, 7c:c3:a1:86:9a:4c
It doesn't seem to mount the mass storage device although it did find the ethernet adapter once on the second attempt.
We have tried inserting delays and holding the USB hub in reset until the MUSB controller has started however the connection and device operation is still very unstable.
Please can you comment on the correct initialisation sequence to use and any timing or driver sequencing dependencies.
Regards,
Garry
