aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-mem.c
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2010-07-09 11:08:54 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-07-26 15:00:58 -0400
commit2d1ee5904bb51ea33c6a6f4bec6b6a243e2432a8 (patch)
treea0cb613f987699aa63d6314556c0f2e5fc2a9632 /drivers/usb/host/xhci-mem.c
parent809cd1cb80d7dffe75dc94bc94ef2aab3dadc86a (diff)
USB: xhci: Set EP0 dequeue ptr after reset of configured device.
When a configured device is reset, the control endpoint's ring is reused. If control transfers to the device were issued before the device is reset, the dequeue pointer will be somewhere in the middle of the ring. If the device is then issued an address with the set address command, the xHCI driver must provide a valid input context for control endpoint zero. The original code would give the hardware the original input context, which had a dequeue pointer set to the top of the ring. This would cause the host to re-execute any control transfers until it reached the ring's enqueue pointer. When issuing a set address command for a device that has just been configured and then reset, use the control endpoint's enqueue pointer as the hardware's dequeue pointer. Assumption: All control transfers will be completed or cancelled before the set address command is issued to the device. If there are any outstanding control transfers, this code will not work. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/xhci-mem.c')
-rw-r--r--drivers/usb/host/xhci-mem.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index fd9e03afd91..8cc824bbc4e 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -835,6 +835,27 @@ fail:
835 return 0; 835 return 0;
836} 836}
837 837
838void xhci_copy_ep0_dequeue_into_input_ctx(struct xhci_hcd *xhci,
839 struct usb_device *udev)
840{
841 struct xhci_virt_device *virt_dev;
842 struct xhci_ep_ctx *ep0_ctx;
843 struct xhci_ring *ep_ring;
844
845 virt_dev = xhci->devs[udev->slot_id];
846 ep0_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, 0);
847 ep_ring = virt_dev->eps[0].ring;
848 /*
849 * FIXME we don't keep track of the dequeue pointer very well after a
850 * Set TR dequeue pointer, so we're setting the dequeue pointer of the
851 * host to our enqueue pointer. This should only be called after a
852 * configured device has reset, so all control transfers should have
853 * been completed or cancelled before the reset.
854 */
855 ep0_ctx->deq = xhci_trb_virt_to_dma(ep_ring->enq_seg, ep_ring->enqueue);
856 ep0_ctx->deq |= ep_ring->cycle_state;
857}
858
838/* Setup an xHCI virtual device for a Set Address command */ 859/* Setup an xHCI virtual device for a Set Address command */
839int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev) 860int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev)
840{ 861{