[LEDE-DEV] [PATCH] lantiq: update USB controller handling

Antti Seppälä a.seppala at gmail.com
Fri Jan 6 14:31:10 PST 2017


On 6 January 2017 at 21:32, Hauke Mehrtens <hauke at hauke-m.de> wrote:
> On 01/06/2017 08:26 PM, Martin Blumenstingl wrote:
>> Hi Hauke,
>>
>> (CC'ing Mathias as he was looking into some of the USB issues as well)
>>
>> On Fri, Jan 6, 2017 at 8:06 PM, Hauke Mehrtens <hauke at hauke-m.de> wrote:
>>> This makes the code use the same settings aas the vendor sdrivers.
>> s/aas/as/
>> s/sdrivers/driver/
>> you should probably also mention that this:
>> 1. backports USB initialization fixes for XRX300, Danube and Amazon-SE
>> 2. sets the clock source for all SoCs which fixes USB (initialization)
>> issues on Danube when using the dwc2 driver (thus fixes FS#351 and
>> supersedes Mathias' "lantiq: set the usb clock source" RFC patch)
>
> Yes after I send the patch I noticed that I haven't updated the commit
> message. I will fix that.
>
> Could someone please test this patch and report back if it fixes the
> problems on Danube and works on Amazon SE or improves something in VR9?
> Positive and negative reports would be nice. I have only tested it on
> VR9 till now, I have to look what other boards I have here.
>

Hi Hauke.

The patch looks good except for the choices of fifo sizes from vendor
driver which from the point-of-view of usb packet sizes are quite odd
will break at least certain audio devices.

If I recall correctly the dwc2 specification (Method 1) proposes
values for fifo size at minimum of:

rx fifo size: 258 + number of host channels
non-periodic tx fifo size: 128
periodic tx fifo size: 768

The spec Method 2 which is used by the upstream driver autodetection
logic[1] doubles the rx and nptx sizes to try to fit two packets at
once for greater performance.

Especially the periodic fifo size choice of 32 for vr9 is way too
small to accommodate a complete usb packet.
We used to have the vendor driver values in use for vr9 but there were
some complaints on openwrt forum that usb audio devices did not work.

Changing the values to closer resemble the dwc2 specification actually
allows audio devices to work for some people [2].

Unfortunately the default total fifo size is 512 which can never
fulfil the dwc2 specification completely.
Is there a way to programmatically re-allocate a bigger fifo for the
lantiq platform during initialization? If there is we could let the
dwc2 driver autoconfigure the fifos as it sees fit.

Also the dwc2 driver apparently does a pretty good job at
autoconfiguring various other parameters for optimum performance so I
wonder whether we should rely on that instead of hard-coding them?

A disclaimer though: I'm not an usb expert. I only did the best I
could with the fifo values based on my testing and reading the dwc2
spec :)

1. https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/dwc2/core.c?h=v4.4#n892
2. https://forum.openwrt.org/viewtopic.php?pid=299862#p299862

-- 
Antti



More information about the Lede-dev mailing list