aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2014-01-31 14:52:57 -0500
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2014-02-07 17:30:03 -0500
commit3d4b81eda2211f32886e2978daf6f39885042fc4 (patch)
treea5eaedd2afe98eebb2268f67640f44530992f707
parent9cf00d91708221ff2d8a11143315f7ebab8d5da8 (diff)
Revert "usb: xhci: Link TRB must not occur within a USB payload burst"
This reverts commit 35773dac5f862cb1c82ea151eba3e2f6de51ec3e. It's a hack that caused regressions in the usb-storage and userspace USB drivers that use usbfs and libusb. Commit 70cabb7d992f "xhci 1.0: Limit arbitrarily-aligned scatter gather." should fix the issues seen with the ax88179_178a driver on xHCI 1.0 hosts, without causing regressions. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: stable@vger.kernel.org # 3.12
-rw-r--r--drivers/usb/host/xhci-ring.c54
-rw-r--r--include/linux/usb.h2
2 files changed, 2 insertions, 54 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 0272450a1667..0ed64eb68e48 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2967,58 +2967,8 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,
2967 } 2967 }
2968 2968
2969 while (1) { 2969 while (1) {
2970 if (room_on_ring(xhci, ep_ring, num_trbs)) { 2970 if (room_on_ring(xhci, ep_ring, num_trbs))
2971 union xhci_trb *trb = ep_ring->enqueue; 2971 break;
2972 unsigned int usable = ep_ring->enq_seg->trbs +
2973 TRBS_PER_SEGMENT - 1 - trb;
2974 u32 nop_cmd;
2975
2976 /*
2977 * Section 4.11.7.1 TD Fragments states that a link
2978 * TRB must only occur at the boundary between
2979 * data bursts (eg 512 bytes for 480M).
2980 * While it is possible to split a large fragment
2981 * we don't know the size yet.
2982 * Simplest solution is to fill the trb before the
2983 * LINK with nop commands.
2984 */
2985 if (num_trbs == 1 || num_trbs <= usable || usable == 0)
2986 break;
2987
2988 if (ep_ring->type != TYPE_BULK)
2989 /*
2990 * While isoc transfers might have a buffer that
2991 * crosses a 64k boundary it is unlikely.
2992 * Since we can't add NOPs without generating
2993 * gaps in the traffic just hope it never
2994 * happens at the end of the ring.
2995 * This could be fixed by writing a LINK TRB
2996 * instead of the first NOP - however the
2997 * TRB_TYPE_LINK_LE32() calls would all need
2998 * changing to check the ring length.
2999 */
3000 break;
3001
3002 if (num_trbs >= TRBS_PER_SEGMENT) {
3003 xhci_err(xhci, "Too many fragments %d, max %d\n",
3004 num_trbs, TRBS_PER_SEGMENT - 1);
3005 return -ENOMEM;
3006 }
3007
3008 nop_cmd = cpu_to_le32(TRB_TYPE(TRB_TR_NOOP) |
3009 ep_ring->cycle_state);
3010 ep_ring->num_trbs_free -= usable;
3011 do {
3012 trb->generic.field[0] = 0;
3013 trb->generic.field[1] = 0;
3014 trb->generic.field[2] = 0;
3015 trb->generic.field[3] = nop_cmd;
3016 trb++;
3017 } while (--usable);
3018 ep_ring->enqueue = trb;
3019 if (room_on_ring(xhci, ep_ring, num_trbs))
3020 break;
3021 }
3022 2972
3023 if (ep_ring == xhci->cmd_ring) { 2973 if (ep_ring == xhci->cmd_ring) {
3024 xhci_err(xhci, "Do not support expand command ring\n"); 2974 xhci_err(xhci, "Do not support expand command ring\n");
diff --git a/include/linux/usb.h b/include/linux/usb.h
index c716da18c668..7f6eb859873e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1265,8 +1265,6 @@ typedef void (*usb_complete_t)(struct urb *);
1265 * @sg: scatter gather buffer list, the buffer size of each element in 1265 * @sg: scatter gather buffer list, the buffer size of each element in
1266 * the list (except the last) must be divisible by the endpoint's 1266 * the list (except the last) must be divisible by the endpoint's
1267 * max packet size if no_sg_constraint isn't set in 'struct usb_bus' 1267 * max packet size if no_sg_constraint isn't set in 'struct usb_bus'
1268 * (FIXME: scatter-gather under xHCI is broken for periodic transfers.
1269 * Do not use urb->sg for interrupt endpoints for now, only bulk.)
1270 * @num_mapped_sgs: (internal) number of mapped sg entries 1268 * @num_mapped_sgs: (internal) number of mapped sg entries
1271 * @num_sgs: number of entries in the sg list 1269 * @num_sgs: number of entries in the sg list
1272 * @transfer_buffer_length: How big is transfer_buffer. The transfer may 1270 * @transfer_buffer_length: How big is transfer_buffer. The transfer may