How to enter Device Mode for USB OTG on USB Type A Port on AML-S905X-CC Le Potato

Normally, the top USB Type A port next to the Ethernet port is in host mode. This port is device mode capable for the USB OTG spec but USB Type A does not have the ID pin necessary to do OTG negotiation. The switch from host to device mode must be done manually and the dwc2 driver has to be re-probed.

echo device | sudo tee /sys/bus/platform/drivers/dwc3-meson-g12a/d0078080.usb/usb_role/d0078080.usb-role-switch/role
echo c9100000.usb | sudo tee /sys/bus/platform/drivers/dwc2/unbind
echo c9100000.usb | sudo tee /sys/bus/platform/drivers/dwc2/bind

Thank you for the instructions. The device tree shows that both c9000000 (host mode) and c9100000 (peripheral mode) are under d0078080 (host mode). Will changing the usb_role of d0078080 to device affect c9000000.usb which used dwc3 in host mode?

We haven’t tried. Update to the latest kernel before you try the instructions above.

Tried this and does not work. Here is the log entries from dmesg | grep usb
[ 176.597068] dwc3-meson-g12a d0078080.usb: Broken manual OTG switch
[ 176.597107] dwc3-meson-g12a d0078080.usb: switching to Device Mode
[ 208.076972] dwc2 c9100000.usb: supply vusb_d not found, using dummy regulator
[ 208.077427] dwc2 c9100000.usb: supply vusb_a not found, using dummy regulator
[ 208.077909] dwc2 c9100000.usb: EPs: 7, dedicated fifos, 712 entries in SPRAM
[ 266.699684] dwc2 c9100000.usb: bound driver g_mass_storage

The mass storage does not appear on the connected (via USB-A to USB-A cable) host computer.

Did you update the kernel and reset your ldto changes before trying the instructions above?

I am using armbian bullseye CLI latest version. Had to defreeze kernel upgrade. I have now completed the upgrade and mass storage works now !!
HID (Keyboard/Mouse) also works ! The other USB ports function in host mode as well. THANK YOU FOR THE SUPPORT !

Before upgrade uname -a

Linux lepotato 5.19.17-meson64 #22.11.1 SMP PREEMPT Wed Nov 30 11:05:42 UTC 2022 aarch64 GNU/Linux

After Upgrade uname -a

Linux lepotato 6.0.13-meson64 #22.11.2 SMP PREEMPT Sun Dec 18 16:52:19 CET 2022 aarch64 GNU/Linux

Armbian is a different beast altogether. A lot of our guides do not work on it due to differences in configuration.