![]() |
USB Device Mode - Printable Version +- PINE64 (https://forum.pine64.org) +-- Forum: ROCKPRO64 (https://forum.pine64.org/forumdisplay.php?fid=98) +--- Forum: General Discussion on ROCKPRO64 (https://forum.pine64.org/forumdisplay.php?fid=99) +--- Thread: USB Device Mode (/showthread.php?tid=11523) |
USB Device Mode - R0b0t1 - 09-18-2020 I've a kernel build with DWC2/3 drivers and dual-role support enabled. I'm unable to see any devices in /sys/class/udc. Is there anyone who has worked on this? As I understand I need: CONFIG_USB_DWC3=y CONFIG_USB_DWC3_DUAL_ROLE=y CONFIG_USB_GADGET=y CONFIG_USB_CONFIGFS=y CONFIG_USB_ETH=y I see two controllers: # ls /sys/bus/platform/drivers/dwc3 bind fe800000.usb fe900000.usb module uevent unbind I'm not able to get any more information by inspecting that filesystem. For my config, I have: # cat .config | grep USB_DWC3 CONFIG_USB_DWC3=m # CONFIG_USB_DWC3_ULPI is not set # CONFIG_USB_DWC3_HOST is not set # CONFIG_USB_DWC3_GADGET is not set CONFIG_USB_DWC3_DUAL_ROLE=y CONFIG_USB_DWC3_HAPS=m CONFIG_USB_DWC3_MESON_G12A=m CONFIG_USB_DWC3_OF_SIMPLE=m # cat .config | grep USB_GADGET CONFIG_USB_GADGET=m # CONFIG_USB_GADGET_DEBUG is not set # CONFIG_USB_GADGET_DEBUG_FILES is not set # CONFIG_USB_GADGET_DEBUG_FS is not set CONFIG_USB_GADGET_VBUS_DRAW=2 CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 # CONFIG_USB_GADGET_XILINX is not set CONFIG_USB_GADGETFS=m # cat .config | grep USB_CONFIGFS CONFIG_USB_CONFIGFS=m CONFIG_USB_CONFIGFS_SERIAL=y CONFIG_USB_CONFIGFS_ACM=y CONFIG_USB_CONFIGFS_OBEX=y CONFIG_USB_CONFIGFS_NCM=y CONFIG_USB_CONFIGFS_ECM=y CONFIG_USB_CONFIGFS_ECM_SUBSET=y CONFIG_USB_CONFIGFS_RNDIS=y CONFIG_USB_CONFIGFS_EEM=y # CONFIG_USB_CONFIGFS_PHONET is not set CONFIG_USB_CONFIGFS_MASS_STORAGE=y CONFIG_USB_CONFIGFS_F_LB_SS=y CONFIG_USB_CONFIGFS_F_FS=y CONFIG_USB_CONFIGFS_F_UAC1=y # CONFIG_USB_CONFIGFS_F_UAC1_LEGACY is not set CONFIG_USB_CONFIGFS_F_UAC2=y CONFIG_USB_CONFIGFS_F_MIDI=y CONFIG_USB_CONFIGFS_F_HID=y CONFIG_USB_CONFIGFS_F_UVC=y CONFIG_USB_CONFIGFS_F_PRINTER=y RE: USB Device Mode - R0b0t1 - 09-18-2020 I made progress. The default device tree sets the first dwc3 controller as "otg." Unfortunately this seems to not have much effect. I've tried looking for a software switch and also tried plugging the board in as a device. How do you set this without needing a reboot? Changing the two DWC3 nodes in the file "arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi:" Code: &usbdrd3_0 { Code: status = "okay"; Code: dr_mode = "peripheral"; Code: }; They are both listed in /sys/class/udc: Code: # ls /sys/class/udc But, again, I'd like to change mode without needing to reboot. I'm also unsure how compatible the Type-C port is. RE: USB Device Mode - R0b0t1 - 09-19-2020 Really hoping someone can help, I can't get USB3 device mode working still. I have devices in /sys/class/udc and they function properly via configfs when plugged into a USB2 only port. If I plug them into a superspeed port I get nothing in dmesg on the host side. At first, I did get a response on the host, in the form of: Code: [591550.770819] usb 1-1.2: new full-speed USB device number 76 using xhci_hcd [img=15x15]data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==[/img] However now I get no driver activity when binding the UDC in configfs or loading or unloading the respective modules. Kernel is 5.7.15 w/ patches. It doesn't seem like bad USB-C wiring fried port or tripped a polyfuse, the port still works after attempting USB3 device mode. RE: USB Device Mode - guannais - 10-30-2020 Your investigation helped me a lot, thanks ![]() I think that I have solved the problem. To change USB mode without reboot you should type: Code: echo device > /sys/kernel/debug/fe800000.usb/mode but if the current mode is "otg" it will give those fails that you described on the host side. To avoid that set it to "host" before, and then "device". Code: echo host > /sys/kernel/debug/fe800000.usb/mode I configured the device for CDC EEM and the host side works fine with it (and the appropriate driver, of course). Update: I had to insert a little "sleep 0.03" between "echo host" and "echo device" for making it to work in a script. |