Bug 217670 - dwc3: regression in USB DWC3 driver in kernel 5.15 branch
Summary: dwc3: regression in USB DWC3 driver in kernel 5.15 branch
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: USB (show other bugs)
Hardware: ARM Linux
: P3 normal
Assignee: Default virtual assignee for Drivers/USB
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-14 13:18 UTC by Tomasz Rostanski
Modified: 2023-09-01 13:14 UTC (History)
1 user (show)

See Also:
Kernel Version: 5.15.75-5.15.200
Subsystem:
Regression: Yes
Bisected commit-id: 9d4f84a15f9c9727bc07f59d9dafc89e65aadb34


Attachments
dmesg with USB 3.2 stick inserted (37.34 KB, text/plain)
2023-07-14 13:28 UTC, Tomasz Rostanski
Details
dmesg with usb 2.0 stick inserted (37.71 KB, text/plain)
2023-07-14 13:29 UTC, Tomasz Rostanski
Details
0001-usb-dwc3-reference-clock-period-configuration.patch (4.19 KB, application/mbox)
2023-09-01 12:53 UTC, Tomasz Rostanski
Details
0002-usb-dwc3-Get-clocks-individually.patch (4.96 KB, application/mbox)
2023-09-01 12:53 UTC, Tomasz Rostanski
Details
0003-usb-dwc3-Calculate-REFCLKPER-based-on-reference-cloc.patch (1.87 KB, application/mbox)
2023-09-01 12:53 UTC, Tomasz Rostanski
Details
0004-usb-dwc3-Program-GFLADJ.patch (4.05 KB, patch)
2023-09-01 12:54 UTC, Tomasz Rostanski
Details | Diff
0005-usb-dwc3-core-add-gfladj_refclk_lpm_sel-quirk.patch (2.79 KB, patch)
2023-09-01 12:54 UTC, Tomasz Rostanski
Details | Diff
0001-usb-dwc3-reference-clock-period-configuration.patch (4.19 KB, patch)
2023-09-01 12:54 UTC, Tomasz Rostanski
Details | Diff
0002-usb-dwc3-Get-clocks-individually.patch (4.96 KB, patch)
2023-09-01 12:55 UTC, Tomasz Rostanski
Details | Diff
0003-usb-dwc3-Calculate-REFCLKPER-based-on-reference-cloc.patch (1.87 KB, patch)
2023-09-01 12:55 UTC, Tomasz Rostanski
Details | Diff
0004-usb-dwc3-Program-GFLADJ.patch (4.05 KB, patch)
2023-09-01 12:56 UTC, Tomasz Rostanski
Details | Diff
0005-usb-dwc3-core-add-gfladj_refclk_lpm_sel-quirk.patch (2.79 KB, patch)
2023-09-01 12:56 UTC, Tomasz Rostanski
Details | Diff

Description Tomasz Rostanski 2023-07-14 13:18:29 UTC
The backport commit to 5.15 branch:
9d4f84a15f9c9727bc07f59d9dafc89e65aadb34 "arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes"  (from upstream commit 5c3d5ecf48ab06c709c012bf1e8f0c91e1fcd7ad)
switched from "snps,dis-u2-freeclk-exists-quirk" to "snps,gfladj-refclk-lpm-sel-quirk".

The problem is that the gfladj-refclk-lpm-sel-quirk quirk is not implemented / backported to 5.15 branch.

This commit should be either reverted, or the commit introducing gfladj-refclk-lpm-sel-quirk needs to be merged to 5.15 kernel branch.

As a result of this patch, on Gateworks Venice GW7400 revB board the USB 3.x devices which are connected to the USB Type C port does not enumerate and the following errors are generated:

[   14.906302] xhci-hcd xhci-hcd.0.auto: Timeout while waiting for setup device command
[   15.122383] usb 2-1: device not accepting address 2, error -62
[   25.282195] xhci-hcd xhci-hcd.0.auto: Abort failed to stop command ring: -110
[   25.297408] xhci-hcd xhci-hcd.0.auto: xHCI host controller not responding, assume dead
[   25.305345] xhci-hcd xhci-hcd.0.auto: HC died; cleaning up
[   25.311058] xhci-hcd xhci-hcd.0.auto: Timeout while waiting for stop endpoint command
[   25.334361] usb usb2-port1: couldn't allocate usb_device

When the commit is reverted the USB 3.x drives works fine.
Comment 1 Tomasz Rostanski 2023-07-14 13:28:59 UTC
Created attachment 304637 [details]
dmesg with USB 3.2 stick inserted
Comment 2 Tomasz Rostanski 2023-07-14 13:29:17 UTC
Created attachment 304638 [details]
dmesg with usb 2.0 stick inserted
Comment 3 Tomasz Rostanski 2023-07-14 13:30:10 UTC
The USB 2.0 devices are properly enumerated. Only USB 3.x devices are affected in our configuration.
Comment 4 Greg Kroah-Hartman 2023-07-16 15:00:01 UTC
On Fri, Jul 14, 2023 at 01:18:29PM +0000, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=217670
> 
>             Bug ID: 217670
>            Summary: Regression in USB DWC3 driver in kernel 5.15 branch
>            Product: Drivers
>            Version: 2.5
>           Hardware: ARM
>                 OS: Linux
>             Status: NEW
>           Severity: normal
>           Priority: P3
>          Component: USB
>           Assignee: drivers_usb@kernel-bugs.kernel.org
>           Reporter: tomasz.rostanski@thalesgroup.com
>         Regression: No
> 
> The backport commit to 5.15 branch:
> 9d4f84a15f9c9727bc07f59d9dafc89e65aadb34 "arm64: dts: imx8mp: Add
> snps,gfladj-refclk-lpm-sel quirk to USB nodes"  (from upstream commit
> 5c3d5ecf48ab06c709c012bf1e8f0c91e1fcd7ad)
> switched from "snps,dis-u2-freeclk-exists-quirk" to
> "snps,gfladj-refclk-lpm-sel-quirk".
> 
> The problem is that the gfladj-refclk-lpm-sel-quirk quirk is not implemented
> /
> backported to 5.15 branch.
> 
> This commit should be either reverted, or the commit introducing
> gfladj-refclk-lpm-sel-quirk needs to be merged to 5.15 kernel branch.

What commit exactly needs to be backported?

thanks,

greg k-h
Comment 5 Tomasz Rostanski 2023-07-17 05:20:35 UTC
I believe the missing commit is:

commit a6fc2f1b092787e9d7dbe472d720cede81680315
Author: Alexander Stein <alexander.stein@ew.tq-group.com>
Date:   Thu Sep 15 08:28:53 2022 +0200

    usb: dwc3: core: add gfladj_refclk_lpm_sel quirk

    This selects the SOF/ITP counter be running on ref_clk. As documented
    U2_FREECLK_EXISTS has to be set to 0 as well.

    Reviewed-by: Li Jun <jun.li@nxp.com>
    Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
    Link: https://lore.kernel.org/r/20220915062855.751881-3-alexander.stein@ew.tq-group.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Comment 6 Tomasz Rostanski 2023-07-17 06:36:08 UTC
The commit a6fc2f1b092787e9d7dbe472d720cede81680315 has dependencies of previous commits, so at the minimum the following commits needs to be backported:

7bee318838890 usb: dwc3: reference clock period configuration
a5ae3cbe9dfcc usb: dwc3: Get clocks individually
5114c3ee24875 usb: dwc3: Calculate REFCLKPER based on reference clock
596c87856e08d usb: dwc3: Program GFLADJ
a6fc2f1b09278 usb: dwc3: core: add gfladj_refclk_lpm_sel quirk
Comment 7 Greg Kroah-Hartman 2023-07-17 14:30:37 UTC
On Mon, Jul 17, 2023 at 06:36:08AM +0000, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=217670
> 
> --- Comment #6 from Tomasz Rostanski (tomasz.rostanski@thalesgroup.com) ---
> The commit a6fc2f1b092787e9d7dbe472d720cede81680315 has dependencies of
> previous commits, so at the minimum the following commits needs to be
> backported:
> 
> 7bee318838890 usb: dwc3: reference clock period configuration
> a5ae3cbe9dfcc usb: dwc3: Get clocks individually
> 5114c3ee24875 usb: dwc3: Calculate REFCLKPER based on reference clock
> 596c87856e08d usb: dwc3: Program GFLADJ
> a6fc2f1b09278 usb: dwc3: core: add gfladj_refclk_lpm_sel quirk

Can you test this to verify that it does actually work for you?

thanks,

greg k-h
Comment 8 Tomasz Rostanski 2023-07-18 05:25:18 UTC
I confirm. It works for me.
Comment 9 The Linux kernel's regression tracker (Thorsten Leemhuis) 2023-08-31 09:12:27 UTC
(In reply to Tomasz Rostanski from comment #8)
>>> 7bee318838890 usb: dwc3: reference clock period configuration
>>> a5ae3cbe9dfcc usb: dwc3: Get clocks individually
>>> 5114c3ee24875 usb: dwc3: Calculate REFCLKPER based on reference clock
>>> 596c87856e08d usb: dwc3: Program GFLADJ
>>> a6fc2f1b09278 usb: dwc3: core: add gfladj_refclk_lpm_sel quirk
>>
>> Can you test this to verify that it does actually work for you?
>> thanks,
>>
>> greg k-h
>
> I confirm. It works for me.

Tomasz, was a fix ever merged to 5.15.y – either a revert or the changes listed above? Doesn't look like it from here, but I have the strong suspicion that I'm missing something here.
Comment 10 Tomasz Rostanski 2023-08-31 09:19:43 UTC
No it's not fixed in 5.15.y.
Comment 11 The Linux kernel's regression tracker (Thorsten Leemhuis) 2023-08-31 09:31:51 UTC
Greg, guess it fell through the cracks on your side then. You afaics intended to apply these to 5.15.y to fix the regression that was caused by backporting  5c3d5ecf48a ("arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes") [v6.1-rc1] to 5.15.y:

>>> 7bee318838890 usb: dwc3: reference clock period configuration
>>> a5ae3cbe9dfcc usb: dwc3: Get clocks individually
>>> 5114c3ee24875 usb: dwc3: Calculate REFCLKPER based on reference clock
>>> 596c87856e08d usb: dwc3: Program GFLADJ
>>> a6fc2f1b09278 usb: dwc3: core: add gfladj_refclk_lpm_sel quirk

Thomas confirmed that they fix the regression here: https://bugzilla.kernel.org/show_bug.cgi?id=217670#c8
Comment 12 Greg Kroah-Hartman 2023-08-31 10:56:26 UTC
On Thu, Aug 31, 2023 at 09:31:51AM +0000, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=217670
> 
> --- Comment #11 from The Linux kernel's regression tracker (Thorsten
> Leemhuis) (regressions@leemhuis.info) ---
> Greg, guess it fell through the cracks on your side then. You afaics intended
> to apply these to 5.15.y to fix the regression that was caused by backporting 
> 5c3d5ecf48a ("arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB
> nodes") [v6.1-rc1] to 5.15.y:
> 
> >>> 7bee318838890 usb: dwc3: reference clock period configuration
> >>> a5ae3cbe9dfcc usb: dwc3: Get clocks individually
> >>> 5114c3ee24875 usb: dwc3: Calculate REFCLKPER based on reference clock
> >>> 596c87856e08d usb: dwc3: Program GFLADJ
> >>> a6fc2f1b09278 usb: dwc3: core: add gfladj_refclk_lpm_sel quirk
> 
> Thomas confirmed that they fix the regression here:
> https://bugzilla.kernel.org/show_bug.cgi?id=217670#c8

Those ids do not match up properly.  Can we please take this to email on
the stable@vger.kernel.org list?  I thought we resolved this there
already, if not, I need a real list of ids, in the correct order, to
apply please.

thanks,

greg k-h
Comment 13 The Linux kernel's regression tracker (Thorsten Leemhuis) 2023-09-01 09:22:19 UTC
Tomasz, can you do what Greg asked for? It seems the commits you listed in comment 6 do not apply cleanly any more (I just checked), so you are in the best position to help here, as something might have changed since your comment 6 and 8.
Comment 14 Tomasz Rostanski 2023-09-01 12:53:02 UTC
Created attachment 305003 [details]
0001-usb-dwc3-reference-clock-period-configuration.patch
Comment 15 Tomasz Rostanski 2023-09-01 12:53:21 UTC
Created attachment 305004 [details]
0002-usb-dwc3-Get-clocks-individually.patch
Comment 16 Tomasz Rostanski 2023-09-01 12:53:40 UTC
Created attachment 305005 [details]
0003-usb-dwc3-Calculate-REFCLKPER-based-on-reference-cloc.patch
Comment 17 Tomasz Rostanski 2023-09-01 12:54:03 UTC
Created attachment 305006 [details]
0004-usb-dwc3-Program-GFLADJ.patch
Comment 18 Tomasz Rostanski 2023-09-01 12:54:28 UTC
Created attachment 305007 [details]
0005-usb-dwc3-core-add-gfladj_refclk_lpm_sel-quirk.patch
Comment 19 Tomasz Rostanski 2023-09-01 12:54:54 UTC
Created attachment 305008 [details]
0001-usb-dwc3-reference-clock-period-configuration.patch
Comment 20 Tomasz Rostanski 2023-09-01 12:55:20 UTC
Created attachment 305009 [details]
0002-usb-dwc3-Get-clocks-individually.patch
Comment 21 Tomasz Rostanski 2023-09-01 12:55:52 UTC
Created attachment 305010 [details]
0003-usb-dwc3-Calculate-REFCLKPER-based-on-reference-cloc.patch
Comment 22 Tomasz Rostanski 2023-09-01 12:56:12 UTC
Created attachment 305011 [details]
0004-usb-dwc3-Program-GFLADJ.patch
Comment 23 Tomasz Rostanski 2023-09-01 12:56:35 UTC
Created attachment 305012 [details]
0005-usb-dwc3-core-add-gfladj_refclk_lpm_sel-quirk.patch
Comment 24 Tomasz Rostanski 2023-09-01 12:57:47 UTC
I have attached rebased patches against 5.15.129:
0001-usb-dwc3-reference-clock-period-configuration.patch
0002-usb-dwc3-Get-clocks-individually.patch
0003-usb-dwc3-Calculate-REFCLKPER-based-on-reference-cloc.patch
0004-usb-dwc3-Program-GFLADJ.patch
0005-usb-dwc3-core-add-gfladj_refclk_lpm_sel-quirk.patch
apply with git am.
Comment 25 The Linux kernel's regression tracker (Thorsten Leemhuis) 2023-09-01 13:13:56 UTC
That won't fly, bugzilla is not used like that by the kernel developers (and the changelog is lost afaics, which is a no-go, too). Please submit them as outline in https://www.kernel.org/doc/html/next/process/stable-kernel-rules.html (you likely need option 3 in case the patches need to be adjusted for the 5.15.y branch, otherwise option 2 would do the trick)
Comment 26 Greg Kroah-Hartman 2023-09-01 13:14:39 UTC
On Fri, Sep 01, 2023 at 12:57:47PM +0000, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=217670
> 
> --- Comment #24 from Tomasz Rostanski (tomasz.rostanski@thalesgroup.com) ---
> I have attached rebased patches against 5.15.129:
> 0001-usb-dwc3-reference-clock-period-configuration.patch
> 0002-usb-dwc3-Get-clocks-individually.patch
> 0003-usb-dwc3-Calculate-REFCLKPER-based-on-reference-cloc.patch
> 0004-usb-dwc3-Program-GFLADJ.patch
> 0005-usb-dwc3-core-add-gfladj_refclk_lpm_sel-quirk.patch
> apply with git am.

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

Note You need to log in before you can comment on or make changes to this bug.