diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2011-07-19 14:01:23 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-07-19 14:25:45 -0400 |
commit | e04f5f7e423018bcec84c11af2058cdce87816f3 (patch) | |
tree | a11ccaa195e169c8dd2aa14d2a71ac5049d6c96e /drivers/usb/host/ehci-q.c | |
parent | 026dfaf18973404a01f488d6aa556a8c466e06a4 (diff) |
EHCI: fix direction handling for interrupt data toggles
This patch (as1480) fixes a rather obscure bug in ehci-hcd. The
qh_update() routine needs to know the number and direction of the
endpoint corresponding to its QH argument. The number can be taken
directly from the QH data structure, but the direction isn't stored
there. The direction is taken instead from the first qTD linked to
the QH.
However, it turns out that for interrupt transfers, qh_update() gets
called before the qTDs are linked to the QH. As a result, qh_update()
computes a bogus direction value, which messes up the endpoint toggle
handling. Under the right combination of circumstances this causes
usb_reset_endpoint() not to work correctly, which causes packets to be
dropped and communications to fail.
Now, it's silly for the QH structure not to have direct access to all
the descriptor information for the corresponding endpoint. Ultimately
it may get a pointer to the usb_host_endpoint structure; for now,
adding a copy of the direction flag solves the immediate problem.
This allows the Spyder2 color-calibration system (a low-speed USB
device that sends all its interrupt data packets with the toggle set
to 0 and hance requires constant use of usb_reset_endpoint) to work
when connected through a high-speed hub. Thanks to Graeme Gill for
supplying the hardware that allowed me to track down this bug.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Graeme Gill <graeme@argyllcms.com>
CC: <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ehci-q.c')
-rw-r--r-- | drivers/usb/host/ehci-q.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 9bf3c0d983c4..0917e3a32465 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -103,7 +103,7 @@ qh_update (struct ehci_hcd *ehci, struct ehci_qh *qh, struct ehci_qtd *qtd) | |||
103 | if (!(hw->hw_info1 & cpu_to_hc32(ehci, 1 << 14))) { | 103 | if (!(hw->hw_info1 & cpu_to_hc32(ehci, 1 << 14))) { |
104 | unsigned is_out, epnum; | 104 | unsigned is_out, epnum; |
105 | 105 | ||
106 | is_out = !(qtd->hw_token & cpu_to_hc32(ehci, 1 << 8)); | 106 | is_out = qh->is_out; |
107 | epnum = (hc32_to_cpup(ehci, &hw->hw_info1) >> 8) & 0x0f; | 107 | epnum = (hc32_to_cpup(ehci, &hw->hw_info1) >> 8) & 0x0f; |
108 | if (unlikely (!usb_gettoggle (qh->dev, epnum, is_out))) { | 108 | if (unlikely (!usb_gettoggle (qh->dev, epnum, is_out))) { |
109 | hw->hw_token &= ~cpu_to_hc32(ehci, QTD_TOGGLE); | 109 | hw->hw_token &= ~cpu_to_hc32(ehci, QTD_TOGGLE); |
@@ -946,6 +946,7 @@ done: | |||
946 | hw = qh->hw; | 946 | hw = qh->hw; |
947 | hw->hw_info1 = cpu_to_hc32(ehci, info1); | 947 | hw->hw_info1 = cpu_to_hc32(ehci, info1); |
948 | hw->hw_info2 = cpu_to_hc32(ehci, info2); | 948 | hw->hw_info2 = cpu_to_hc32(ehci, info2); |
949 | qh->is_out = !is_input; | ||
949 | usb_settoggle (urb->dev, usb_pipeendpoint (urb->pipe), !is_input, 1); | 950 | usb_settoggle (urb->dev, usb_pipeendpoint (urb->pipe), !is_input, 1); |
950 | qh_refresh (ehci, qh); | 951 | qh_refresh (ehci, qh); |
951 | return qh; | 952 | return qh; |