This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x: USB disconnect with USB VBUS power off, then re-power and re-connect

Hi,

 

a customer is using the USB in host mode and needs to be able to programmatically control power on the USB host port and disconnect and re-enumarate a USB device, i.e. Once the device is powered off, that we are able to power it back on and successfully re-enumerate the device.

Could someone double-check the following steps using the sysfs for the USB driver and let us know whether this approach is good. The following commands do the job:

Un-bind the host controller

echo usb2 > /sys/bus/usb/drivers/usb/unbind

Output:

[   15.569827] usb 2-1: USB disconnect, device number 2

[   15.587779] musb_bus_suspend 2457: trying to suspend as a_host while active

At this point if I run the lsusb command I can see the two USB controllers but the device is no longer there.

 

root@muse-master:~# lsusb

Bus 002 Device 001: ID 1d6b:0002

Bus 001 Device 001: ID 1d6b:0002

 

Turn off the USB host power

echo 0 > /sys/class/leds/usb_host_power/brightness

Output:

[  133.403930] musb-hdrc musb-hdrc.1.auto: VBUS_ERROR in a_wait_vrise (80, <SessEnd), retry #3, port1 0008050b

 

Turn on the USB host power

echo 1 > /sys/class/leds/usb_host_power/brightness

 

Re-bind the host controller

echo usb2 > /sys/bus/usb/drivers/usb/bind

 

At this point the device is recognized and drivers are loaded.

Please let us know if there are any gotchas.

 

Thanks!

--Gunter