Re: Enabling Device DWC3 Device Mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello list and Ran, I've some more observations. Firstly, I have to set the dwc3
mode to peripheral directly. Checking the code I was unable to find what actually
allows you to select the mode if specifying OTG.

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:

[591550.770819] usb 1-1.2: new full-speed USB device number 76 using xhci_hcd
[591550.870962] usb 1-1.2: device descriptor read/64, error -32
[591551.078865] usb 1-1.2: device descriptor read/64, error -32
[591551.286875] usb 1-1.2: new full-speed USB device number 77 using xhci_hcd
[591551.386873] usb 1-1.2: device descriptor read/64, error -32
[591551.594859] usb 1-1.2: device descriptor read/64, error -32
[591551.703160] usb 1-1-port2: attempt power cycle

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 a fried the port or tripped a polyfuse, the port still works
after attempting USB3 device mode.

On Thu, Sep 17, 2020, at 10:42 PM, Ran Wang wrote:
> Hi Sid,
> 
> > -----Original Message-----
> > From: Sid Spry <sid@xxxxxxx>
> > Sent: Friday, September 18, 2020 11:08 AM
> > To: Ran Wang <ran.wang_1@xxxxxxx>
> > Cc: linux-usb@xxxxxxxxxxxxxxx
> > Subject: Re: Enabling Device DWC3 Device Mode
> > 
> > Thanks Ran. I took a look at the document, if you or anyone else can weigh in
> > I'd appreciate it. The platform devices seem to be active, see below.
>
> So you want to use 'otg' or 'preripheral'? The SW flows is a little bit 
> different (in dwc3/core.c)
> If you want otg, I guess module solution would not be good. But I have 
> no idea how to enable
> mass storage gadget in build-in way, to be honest. So you could try 
> ethernet gadget which
> doesn't require passing parameters, it works on my part.
> 
> > Starting at line 767. It's a lot sparser, but the dr_mode is there. I feel I should
> > note that despite the lack of devices in /sys/class/udc I have nodes in
> > /sys/bus/platform/drivers/dwc3:
> > 
> > # ls /sys/bus/platform/drivers/dwc3
> > bind  fe800000.usb  fe900000.usb  module  uevent  unbind
> > 
> > > One of the example in DTS is
> > > arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi
> > > and arch/arm64/boot/dts/freescale/fsl-lx2160a-rdb.dts, and you need to
> > > manually update it by following above doc to enable device mode.
> > >
> > 
> > The document linked is relevant beginning page 445. The above dts settings
> > seem appropriate and I have the necessary kernel configuration enabled. Any
> > relevant drivers are modules.
> > 
> > I'm not really sure how to diagnose it from here. Any help is appreciated.
> 
> Parsing property 'dr_mode' is the key to control driver logic path.
> 
> I think you could begin with drivers/usb/dwc3/core.c, see what happen 
> in dwc3_core_init_mode()
> which handling role switching (host/peripheral/otg) in calling 
> dwc3_probe()
> if you have made sure all kernel configuration had been done correctly, 
> such as (ethernet gadget):
> CONFIG_USB_DWC3=y
> CONFIG_USB_DWC3_DUAL_ROLE=y
> CONFIG_USB_GADGET=y
> CONFIG_USB_CONFIGFS=y
> CONFIG_USB_ETH=y
> 
> With dr_mode=peripheral (or otg), it should work (if above dwc3_probe() 
> encountered no error).
> 

I will pursue this in more detail so I don't need to reboot to change dwc3 mode
but didn't find any relevant code path for otg -> device from userspace. I'll try
debugging later.

Sid.



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux