Hi,
I'm trying to configure my custom i.MX93 board to switch USB roles from host mode to peripheral. As the custom board setting, USB type-A is for host and a micro USB is for devcie (peripheral).
I'm currently running a custom Linux build based on imx-6.6.3 yocto project
As I modprobe the module g_mass_storage and setup the usb role from host to device, there are some error messages occurred.
root@imx93evk:~# echo host > /sys/bus/platform/devices/ci_hdrc.0/usb_role/ci_hdrc.0-role-switch/role
[ 79.667113] ci_hdrc ci_hdrc.0: EHCI Host Controller
root@imx93evk:~# [ 79.672827] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 2
[ 79.700263] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
[ 79.706898] hub 2-0:1.0: USB hub found
[ 79.713134] hub 2-0:1.0: 1 port detected
root@imx93evk:~# lsusb
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@imx93evk:~# modprobe g_mass_storage file=/dev/mmcblk0 removable=1
[ 118.913030] Mass Storage Function, version: 2009/09/11
[ 118.918280] LUN: removable file: (no medium)
[ 118.922669] LUN: removable file: /dev/mmcblk0
[ 118.927056] Number of LUNs=1
[ 118.930068] g_mass_storage gadget.0: Mass Storage Gadget, version: 2009/09/11
[ 118.937246] g_mass_storage gadget.0: userspace failed to provide iSerialNumber
[ 118.944532] g_mass_storage gadget.0: g_mass_storage ready
root@imx93evk:~# echo device > /sys/bus/platform/devices/ci_hdrc.0/usb_role/ci_hdrc.0-role-switch/role
[ 126.608591] ci_hdrc ci_hdrc.0: remove, state 4
[ 126.613071] usb usb2: USB disconnect, device number 1
[ 126.620568] ci_hdrc ci_hdrc.0: USB bus 2 deregistered
[ 126.626743] usbmisc_imx 4c100200.usbmisc: vbus is error
root@imx93evk:~# [ 126.636382] usbmisc_imx 4c100200.usbmisc: Error occurs during detection: -22
Here is my kernel device tree setup:
&usbotg1 {
dr_mode = "otg";
hnp-disable;
srp-disable;
adp-disable;
usb-role-switch;
role-switch-default-mode = "host";
disable-over-current;
samsung,picophy-pre-emp-curr-control = <3>;
samsung,picophy-dc-vol-level-adjust = <7>;
status = "okay";
};
Can you help me figure out my issue ?
Sincerely.
A switch controled the USB data bus flow between USB type-A (host) and micro USB (device).
The USB_ID pin only passed through from i.MX93 to micro USB.
For the testing step, maybe I can try the peripheral mode first to connect the PC as device successfully.