Hello.
I have a custom board based on am5728.
We want to use this board as usb-perepheral(also as a host on another port) but I have no succes with it.
Host system not recognize the board (checked on windows and linux host machines).
In board we use USB type-A port connector with modification - using supply line to indicate connection. We route this signal to gpio.
In different with am5728-evm I have no pmic, and that is why we should notify driver with another way.
I have only VBUS and have not ID.
G20 ball was chose and setted up it mux_data.h as gpio.
First of all I decided to check this pin works properly.
mux_data.h settings:
{DCAN1_TX, (M14 | PIN_INPUT_PULLUP)}, /* dcan1_tx.gpio1_14 */
dts-file was not changed.
In linux I exported this pin with gpio driver and read its state:
/sys/class/gpio# echo 14 > export
/sys/class/gpio# cat gpio14/value
It successful displaed the state of connected to host usb-cable.
After that I changed dts file.
This is parts of my decompiled dtb file:
extcon_usb2mi { compatible = "linux,extcon-usb-gpio"; vbus-gpio = <0xaf 0xe 0x0>; /*vbus-gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;*/ phandle = <0xf2>; }; ... omap_dwc3_1@48880000 { compatible = "ti,dwc3"; ti,hwmods = "usb_otg_ss1"; reg = <0x48880000 0x10000>; interrupts = <0x0 0x48 0x4>; #address-cells = <0x1>; #size-cells = <0x1>; utmi-mode = <0x2>; ranges; phandle = <0x1f4>; usb@48890000 { compatible = "snps,dwc3"; reg = <0x48890000 0x17000>; interrupts = <0x0 0x47 0x4 0x0 0x47 0x4 0x0 0x48 0x4>; interrupt-names = "peripheral", "host", "otg"; phys = <0xf0 0xf1>; phy-names = "usb2-phy", "usb3-phy"; maximum-speed = "super-speed"; dr_mode = "host"; snps,dis_u3_susphy_quirk; snps,dis_u2_susphy_quirk; phandle = <0x1f5>; }; }; omap_dwc3_2@488c0000 { compatible = "ti,dwc3"; ti,hwmods = "usb_otg_ss2"; reg = <0x488c0000 0x10000>; interrupts = <0x0 0x57 0x4>; #address-cells = <0x1>; #size-cells = <0x1>; utmi-mode = <0x2>; ranges; extcon = <0xf2>; phandle = <0x1f6>; usb@488d0000 { compatible = "snps,dwc3"; reg = <0x488d0000 0x17000>; interrupts = <0x0 0x49 0x4 0x0 0x49 0x4 0x0 0x57 0x4>; interrupt-names = "peripheral", "host", "otg"; phys = <0xf3>; phy-names = "usb2-phy"; maximum-speed = "high-speed"; dr_mode = "peripheral"; snps,dis_u3_susphy_quirk; snps,dis_u2_susphy_quirk; snps,dis_metastability_quirk; phandle = <0x1f7>; }; }; omap_dwc3_3@48900000 { compatible = "ti,dwc3"; ti,hwmods = "usb_otg_ss3"; reg = <0x48900000 0x10000>; interrupts = <0x0 0x158 0x4>; #address-cells = <0x1>; #size-cells = <0x1>; utmi-mode = <0x2>; ranges; status = "disabled"; phandle = <0x1f8>; usb@48910000 { compatible = "snps,dwc3"; reg = <0x48910000 0x17000>; interrupts = <0x0 0x58 0x4 0x0 0x58 0x4 0x0 0x158 0x4>; interrupt-names = "peripheral", "host", "otg"; maximum-speed = "high-speed"; dr_mode = "otg"; snps,dis_u3_susphy_quirk; snps,dis_u2_susphy_quirk; phandle = <0x1f9>; }; };
After system load I use g_serial driver:
# modprobe g_serial [ 576.257184] udc 488d0000.usb: registering UDC driver [g_serial] [ 576.274083] userial_init: registered 4 ttyGS* devices [ 576.281874] g_serial gadget: adding 'acm'/d34a2540 to config 'CDC ACM config'/bf398004 [ 576.289848] g_serial gadget: acm ttyGS0: dual speed IN/ep1in OUT/ep1out NOTIFY/ep2in [ 576.298162] g_serial gadget: Gadget Serial v2.4 [ 576.303636] g_serial gadget: g_serial ready
Also /dev/ttyGS0 appeared.
Besides it I ran chkusb script. There is output:
chkusb.sh Version 0.2.8 Linux K2M-5G-9876549999 4.14.79-gbde58ab01e #1 SMP PREEMPT Mon Dec 19 18:35:20 +07 2022 armv7l GNU/Linux USB is initialized Warning: CONFIG_USB_OTG undefined, which is required for DRD mode. ./0184.chkusb-0.2.8.sh: line 384: /proc/device-tree//ocp/omap_dwc3_1@48880000/usb@48890000/status: No such file or directory usb@48890000: host, ./0184.chkusb-0.2.8.sh: line 384: /proc/device-tree//ocp/omap_dwc3_2@488c0000/usb@488d0000/status: No such file or directory usb@488d0000: peripheral, Gadget Kernel Config: g_zero is enabled Gadget Kernel Config: g_audio is enabled Gadget Kernel Config: g_ether is enabled Gadget Kernel Config: g_ncm is enabled Gadget Kernel Config: g_mass_storage is enabled Gadget Kernel Config: g_serial is enabled Gadget Kernel Config: g_printer is enabled gadget driver loaded: DRIVER=g_serial The list of USB gadget drivers installed: /lib/modules/4.14.79-gbde58ab01e/kernel/drivers/usb/gadget/: function/ legacy/ libcomposite.ko /lib/modules/4.14.79-gbde58ab01e/kernel/drivers/usb/gadget/function: u_audio.ko u_ether.ko u_serial.ko usb_f_acm.ko usb_f_ecm.ko usb_f_ecm_subset.ko usb_f_eem.ko usb_f_fs.ko usb_f_hid.ko usb_f_mass_storage.ko usb_f_midi.ko usb_f_ncm.ko usb_f_obex.ko usb_f_printer.ko usb_f_rndis.ko usb_f_serial.ko usb_f_ss_lb.ko usb_f_uac1.ko usb_f_uac2.ko usb_f_uvc.ko /lib/modules/4.14.79-gbde58ab01e/kernel/drivers/usb/gadget/legacy: g_acm_ms.ko g_audio.ko g_cdc.ko g_dbgp.ko g_ether.ko g_ffs.ko g_hid.ko g_mass_storage.ko g_midi.ko g_multi.ko g_ncm.ko g_printer.ko g_serial.ko g_webcam.ko g_zero.ko gadgetfs.ko
Also I try with this settings but have no success:
{DCAN1_TX, (M14 | PIN_INPUT | SLEWCONTROL)}, /* dcan1_tx.gpio1_14 */
I not understand why host machine cannot recognize my board.
Can you help me with it? Do you have any suggession?