ehci(4): interrupt transfer fix

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ehci(4): interrupt transfer fix

SASANO Takayoshi
Hello,

RL (NAK count reload) field in QH should be zero when using periodic
(interrupt) transfer.

Currently it is always set 8, but this causes high-speed interrupt transfer
malfunction in my machines, Hudson-D2 chipset(amd64) and Allwinner A10(armv7).

This causes USB2.0 hub cannot detect device attach/detach.

Here is a remedy, Linux sets the value 4 when asynchronous transfer so
I copied it.

Index: ehci.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ehci.c,v
retrieving revision 1.200
diff -u -p -r1.200 ehci.c
--- ehci.c 15 May 2017 10:52:08 -0000 1.200
+++ ehci.c 6 Jan 2019 06:08:37 -0000
@@ -1406,7 +1406,12 @@ ehci_open(struct usbd_pipe *pipe)
  panic("ehci_open: bad device speed %d", dev->speed);
  }
 
- naks = 8; /* XXX */
+ /*
+ * NAK reload count:
+ * must be zero with using periodic transfer.
+ * Linux 4.20's driver (ehci-q.c) sets 4, we use same value.
+ */
+ naks = ((xfertype == UE_CONTROL) || (xfertype == UE_BULK)) ? 4 : 0;
 
  /* Allocate sqh for everything, save isoc xfers */
  if (xfertype != UE_ISOCHRONOUS) {

--
SASANO Takayoshi (JG1UAA) <[hidden email]>