xhci: For streams the css flag most be read from the stream-ctx on ep stop
authorHans de Goede <hdegoede@redhat.com>
Thu, 3 Oct 2013 22:29:47 +0000 (00:29 +0200)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Tue, 4 Mar 2014 23:38:01 +0000 (15:38 -0800)
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
drivers/usb/host/xhci-ring.c

index 3ec1d8fe06faf42828e45f7ea27843c67df12f18..51c5109bbefc7f708a3a940f247445f1754b5dc9 100644 (file)
@@ -546,9 +546,9 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci,
                struct xhci_dequeue_state *state)
 {
        struct xhci_virt_device *dev = xhci->devs[slot_id];
+       struct xhci_virt_ep *ep = &dev->eps[ep_index];
        struct xhci_ring *ep_ring;
        struct xhci_generic_trb *trb;
-       struct xhci_ep_ctx *ep_ctx;
        dma_addr_t addr;
 
        ep_ring = xhci_triad_to_transfer_ring(xhci, slot_id,
@@ -573,8 +573,16 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci,
        /* Dig out the cycle state saved by the xHC during the stop ep cmd */
        xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
                        "Finding endpoint context");
-       ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index);
-       state->new_cycle_state = 0x1 & le64_to_cpu(ep_ctx->deq);
+       /* 4.6.9 the css flag is written to the stream context for streams */
+       if (ep->ep_state & EP_HAS_STREAMS) {
+               struct xhci_stream_ctx *ctx =
+                       &ep->stream_info->stream_ctx_array[stream_id];
+               state->new_cycle_state = 0x1 & le64_to_cpu(ctx->stream_ring);
+       } else {
+               struct xhci_ep_ctx *ep_ctx
+                       = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index);
+               state->new_cycle_state = 0x1 & le64_to_cpu(ep_ctx->deq);
+       }
 
        state->new_deq_ptr = cur_td->last_trb;
        xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,