Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: dwc2: make the scheduler handle excessive NAKs better

I'm seeing problems with a d-link dwcl-g122 wifi dongle that
someone sent me. There are reports of other wifi dongles with the
same/similar problem. The devices appear to be NAKing to the point
of confusing the dwc2 driver completely.

The attached patch helps with my d-link dwl-g122 - it's adapted
from the Raspberry Pi dwc_otg driver, which is a modified version
of the Synopsys vendor driver. The error recovery is still valid
after the patch, I think.

Cc: Dom Cobley <popcornmix@gmail.com>
Signed-off-by: Nick Hudson <skrll@netbsd.org>
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Nick Hudson and committed by
Greg Kroah-Hartman
151d0cbd 87df8ac3

+8
+8
drivers/usb/dwc2/hcd_intr.c
··· 1890 1890 "hcint 0x%08x, intsts 0x%08x\n", 1891 1891 chan->hcint, 1892 1892 readl(hsotg->regs + GINTSTS)); 1893 + goto error; 1893 1894 } 1894 1895 } 1895 1896 } else { 1896 1897 dev_info(hsotg->dev, 1897 1898 "NYET/NAK/ACK/other in non-error case, 0x%08x\n", 1898 1899 chan->hcint); 1900 + error: 1901 + /* Failthrough: use 3-strikes rule */ 1902 + qtd->error_count++; 1903 + dwc2_update_urb_state_abn(hsotg, chan, chnum, qtd->urb, 1904 + qtd, DWC2_HC_XFER_XACT_ERR); 1905 + dwc2_hcd_save_data_toggle(hsotg, chan, chnum, qtd); 1906 + dwc2_halt_channel(hsotg, chan, qtd, DWC2_HC_XFER_XACT_ERR); 1899 1907 } 1900 1908 } 1901 1909