Sorry, I am cross posting, original unanswered post here:
A customer I am helping is using the AM3352 with processor SDK 02.00.01.07.
This product is in production and being used by end customers.
A new feature request has resulted in the need for a special value to be loaded by the factory.
Currently, the USB subsystem is configured as a peripheral with a mass storage gadget configuration. This has been working just fine.
To allow the factory to interact with the device in a more automated fashion, we are trying to dynamically reconfigure the gadget from a mass storage device to a serial ACM gadget device. We do NOT want both configured at the same time. We simply want to configure the USB serial port gadget in the factory only.
This does not work.
To dynamically reconfigure, I have attempted to have two possible gadgets defined, such as:
Then, simply disable the mass storage gadget with:
echo '' > /sys/kernel/config/usb_gadget/massStorageGadget/UDC
and enable the serial port gadget with:
echo "musb-hdrc.0.auto" > /sys/kernel/config/usb_gadget/serialGadget/UDC
This appears to work, until we connect the USB cable to the device, then we see the following error messages in dmesg:
[ 839.828577] Mass Storage Function, version: 2009/09/11
[ 839.834234] LUN: removable file: (no medium)
[ 839.920019] Number of LUNs=1
[ 839.924408] udc musb-hdrc.0.auto: registering UDC driver [massStorageGadget]
[ 839.924503] configfs-gadget gadget: adding 'Mass Storage Function'/cf558d00 to config 'c1'/cf4c9c98
[ 839.927476] configfs-gadget gadget: I/O thread pid: 310
[ 839.927544] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
[ 839.928461] mass_storage.ms0/lun.0: open backing file: /dev/mmcblk0p6
[ 888.788641] configfs-gadget musb-hdrc.0.auto: unregistering UDC driver [massStorageGadget]
[ 888.791621] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_stop
[ 888.791706] configfs-gadget gadget: unbind function 'Mass Storage Function'/cf558d00
[ 888.813452] configfs-gadget gadget: unbind
[ 896.092545] userial_init: registered 4 ttyGS* devices
[ 896.286606] udc musb-hdrc.0.auto: registering UDC driver [serialGadget]
[ 896.286763] configfs-gadget gadget: adding 'acm'/cf242e40 to config 'c1'/cc21ea98
[ 896.286837] configfs-gadget gadget: acm ttyGS0: dual speed IN/ep1in OUT/ep1out NOTIFY/ep2in
[ 896.286873] configfs-gadget musb-hdrc.0.auto: usb_gadget_udc_start
[ 903.351816] musb_h_ep0_irq 1164: no URB for end 0
[ 903.356656] musb_h_ep0_irq 1164: no URB for end 0
[ 904.593829] musb_h_ep0_irq 1164: no URB for end 0
<<repeats the "no URB for end 0" msg multiple times>>
Looking at the driver code, the "no URB for end 0" appears to be a fatal issue or "should not happen" error.
The host PC does not see the device at this point.
Any ideas? The only way I have found to enable the serial port is to reboot and enable only the serial gadget. I can also enable the serial and the mass storage together in a single composite gadget, which works, but that is not desired as it now requires our end-customers to configure Windows. (works great with Linux, as expected.).
Also, just disabling the mass storage gadget and reenabling the mass storage gadget results in the same "no URB for end 0" issue, and again the host PC does not see the device. I must reboot the device to enable the gadget again.
So, the questions are:
* how to dynamically reconfigure a peripheral USB setup? Is this possible?
* is there a way to "hard reset" the usb subsystem in linux without rebooting the device/linux?
* or, how can we dynamically add the serial port to the composite gadget, already configured for mass storage?
Thank you very much,