RE: Enabling Device DWC3 Device Mode

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

 



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.

<snip>

>
> 
> Thanks for the pointer. Around line 771 is what I expected to see for my board.
> However, in arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi (I have the
> v2
> board) the USB related entries I see are:
> 
> &usbdrd3_0 {
>         status = "okay";
> };
> 
> &usbdrd_dwc3_0 {
>         status = "okay";
>         dr_mode = "otg";
> };
> 
> &usbdrd3_1 {
>         status = "okay";
> };
> 
> &usbdrd_dwc3_1 {
>         status = "okay";
>         dr_mode = "host";
> };

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).

> Thanks in advance!

Welcome

Regards,
Ran





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

  Powered by Linux