Re: Use device tree to disable U1/U2 in gadget devices based on DWC3

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

 



On Wed, 24 Apr 2019, Claus H. Stovgaard wrote:

> Hi Balbi and other USB developers.
> 
> I am developing camera devices based on Xilinx ZynqMP, using the
> gadget framework and the build-in dwc3 core of the ZynqMP as USB3
> controller and the build-in Cirrus SERDES as phy.
> Testing with a number of hosts and Windows 7, has shown sporadic
> reconnects when leaving U2/U1, caused by failing link training, where
> the host resets the bus. Sometime it also means it reconnect via
> USB2.
> 
> So to overcome this, I will like to have the option for disabling
> U1/U2 on the core when working with those hosts.
> 
> Currently I have made a hack in ep0.c where I return EINVAL in
> dwc3_ep0_handle_u1 and dwc3_ep0_handle_u2 together with not setting
> DWC3_DCTL_ACCEPTU1ENA and DWC3_DCTL_ACCEPTU2ENA in
> dwc3_ep0_set_config
> Will though prefer a solution possible to upstream, so was thinking
> about adding two devicetree bindings.
> 
> * snps,u1_disable_as_gadget: When set the core will not enable U1 if
> requested from host, nor initiate U1.
> * snps,u2_disable_as_gadget: When set the core will not enable U2 if
> requested from host, nor initiate U2.
> 
> If you think this might be something which can be upstreamed I will
> prepare the code and send a patch for discussion.
> On the other hand, if you think that disabling U1/U2 via device tree
> as suggested should not be a feature no need for me to try making it
> a feature.

Speaking as an interested bystander, I would first wonder why your
hardware fails during link training.  If it is properly designed, that
should not happen.  The fact that it does happen suggests your devices
might also experience problems during normal data transport.

Second, the bindings you suggested would not be accepted by the 
devicetree maintainers.  The whole idea behind devicetree is that it 
describes the hardware, not the software.  Things like 
u1_disable_as_gadget are software concepts and so do not belong in a 
devicetree description.

You might be better off creating sysfs attribute files for disabling
entry into U1 and U2.  Alternatively, if you really want to do it
through devicetree, you should create a binding that does describe your
hardware properties, such as "u1-and-u2-are-broken", or
"broken-link-training", or something else along those lines.

Alan Stern




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

  Powered by Linux