Hi experts,
I looked at the user manual of LSDK 20.04 for otg mode test, and I follow the steps to verify the dwc3 USB2 port otg mode.
But after reboot from new kernel image with configs for Ethernet gadget.
I cannot find usb0 netdevice when I set CONFIG_USB_DWC3_DUAL_ROLE in kernel menuconfig.
And if I set usb to gadget only mode, the outcomes like the followings:
root@nxp-lx2xxx:~# uname -a
Linux nxp-lx2xxx 4.19.90-yocto-standard+ #4 SMP PREEMPT Tue Aug 18 15:04:00 CST 2020 aarch64 aarch64 aarch64 GNU/Linux
root@nxp-lx2xxx:~#
root@nxp-lx2xxx:~#
root@nxp-lx2xxx:~# dmesg | grep usb
[ 2.286687] usbcore: registered new interface driver usbfs
[ 2.290874] usbcore: registered new interface driver hub
[ 2.294916] usbcore: registered new device driver usb
[ 2.875393] iommu: Adding device 3100000.usb to group 4
[ 2.879492] dwc3 3100000.usb: Failed to get clk 'ref': -2
[ 2.883599] dwc3 3100000.usb: Configuration mismatch. dr_mode forced to gadget
[ 2.889829] iommu: Adding device 3110000.usb to group 5
[ 2.893888] dwc3 3110000.usb: Failed to get clk 'ref': -2
[ 2.897995] dwc3 3110000.usb: Configuration mismatch. dr_mode forced to gadget
[ 2.904395] usbcore: registered new interface driver usb-storage
[ 2.915515] usb0: HOST MAC 76:a4:68:d7:dc:e5
[ 2.918494] usb0: MAC ee:c8:14:f2:8a:1e
[ 3.204427] usbcore: registered new interface driver usbhid
[ 3.211446] usbhid: USB HID core driver
[ 4.929559] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
root@nxp-lx2xxx:~#
root@nxp-lx2xxx:~# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
link/can
3: can1: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
link/can
4: usb0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
link/ether ee:c8:14:f2:8a:1e brd ff:ff:ff:ff:ff:ff
5: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
6: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
link/ether 00:04:9f:06:a2:c5 brd ff:ff:ff:ff:ff:ff
7: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:04:9f:06:a2:ca brd ff:ff:ff:ff:ff:ff
root@nxp-lx2xxx:~#
root@nxp-lx2xxx:~# lsusb
root@nxp-lx2xxx:~#
root@nxp-lx2xxx:~# ethtool usb0
Settings for usb0:
Link detected: no
root@nxp-lx2xxx:~# dmesg | grep dwc3
[ 2.879492] dwc3 3100000.usb: Failed to get clk 'ref': -2
[ 2.883599] dwc3 3100000.usb: Configuration mismatch. dr_mode forced to gadget
[ 2.893888] dwc3 3110000.usb: Failed to get clk 'ref': -2
[ 2.897995] dwc3 3110000.usb: Configuration mismatch. dr_mode forced to gadget
root@nxp-lx2xxx:~#
root@nxp-lx2xxx:~#
root@nxp-lx2xxx:~#
root@nxp-lx2xxx:~# ifconfig usb0 192.168.2.2 up
IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
root@nxp-lx2xxx:~#
root@nxp-lx2xxx:~# dmesg | grep dwc3
[ 2.879492] dwc3 3100000.usb: Failed to get clk 'ref': -2
[ 2.883599] dwc3 3100000.usb: Configuration mismatch. dr_mode forced to gadget
[ 2.893888] dwc3 3110000.usb: Failed to get clk 'ref': -2
[ 2.897995] dwc3 3110000.usb: Configuration mismatch. dr_mode forced to gadget
root@nxp-lx2xxx:~#
root@nxp-lx2xxx:~# ethtool usb0
Settings for usb0:
Link detected: no
root@nxp-lx2xxx:~#
root@nxp-lx2xxx:~#
root@nxp-lx2xxx:~# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
link/can
3: can1: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
link/can
4: usb0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
link/ether ee:c8:14:f2:8a:1e brd ff:ff:ff:ff:ff:ff
5: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
6: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
link/ether 00:04:9f:06:a2:c5 brd ff:ff:ff:ff:ff:ff
7: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:04:9f:06:a2:ca brd ff:ff:ff:ff:ff:ff
root@nxp-lx2xxx:~#
As the above log shows, the usb0 can not work as normal.
Is there something should be configed?
Looking forward your reply.
Thanks,
Zhantao
Hello Zhantao,
Please refer to the following configuration for USB Ethernet gadget.
Please configure Linux Kernel as the following.
USB Gadget support --->
<M> USB Gadget functions configurable through configfs
<M> USB Gadget precomposed configurations
<M> Ethernet Gadget (with CDC Ethernet support) Ethernet gadget support.
Please configure dts file as the following.
usb0: usb3@2f00000 {
compatible = "snps,dwc3";
reg = <0x0 0x2f00000 0x0 0x10000>;
dr_mode = "peripheral";
interrupts = <0 60 0x4>;
snps,quirk-frame-length-adjustment = <0x20>;
snps,dis_rxdet_inp3_quirk;
maximum-speed = “super-speed”;
};
Insmod related ko files on RDB board.
# insmod libcomposite.ko
# insmod u_ether.ko
# insmod usb_f_ecm.ko
# insmod usb_f_ecm_subset.ko
# insmod usb_f_rndis.ko
# insmod g_ether.ko
Thanks,
Yiping