aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/xhci-mem.c26
-rw-r--r--drivers/usb/host/xhci-ring.c11
-rw-r--r--drivers/usb/host/xhci.c2
-rw-r--r--drivers/usb/host/xhci.h2
4 files changed, 35 insertions, 6 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index fd9e03afd91c..2eb658d26394 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{
@@ -1002,7 +1023,7 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
1002 return EP_INTERVAL(interval); 1023 return EP_INTERVAL(interval);
1003} 1024}
1004 1025
1005/* The "Mult" field in the endpoint context is only set for SuperSpeed devices. 1026/* The "Mult" field in the endpoint context is only set for SuperSpeed isoc eps.
1006 * High speed endpoint descriptors can define "the number of additional 1027 * High speed endpoint descriptors can define "the number of additional
1007 * transaction opportunities per microframe", but that goes in the Max Burst 1028 * transaction opportunities per microframe", but that goes in the Max Burst
1008 * endpoint context field. 1029 * endpoint context field.
@@ -1010,7 +1031,8 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
1010static inline u32 xhci_get_endpoint_mult(struct usb_device *udev, 1031static inline u32 xhci_get_endpoint_mult(struct usb_device *udev,
1011 struct usb_host_endpoint *ep) 1032 struct usb_host_endpoint *ep)
1012{ 1033{
1013 if (udev->speed != USB_SPEED_SUPER) 1034 if (udev->speed != USB_SPEED_SUPER ||
1035 !usb_endpoint_xfer_isoc(&ep->desc))
1014 return 0; 1036 return 0;
1015 return ep->ss_ep_comp.bmAttributes; 1037 return ep->ss_ep_comp.bmAttributes;
1016} 1038}
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 94e6934edb09..bfc99a939455 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2380,16 +2380,19 @@ static int queue_command(struct xhci_hcd *xhci, u32 field1, u32 field2,
2380 u32 field3, u32 field4, bool command_must_succeed) 2380 u32 field3, u32 field4, bool command_must_succeed)
2381{ 2381{
2382 int reserved_trbs = xhci->cmd_ring_reserved_trbs; 2382 int reserved_trbs = xhci->cmd_ring_reserved_trbs;
2383 int ret;
2384
2383 if (!command_must_succeed) 2385 if (!command_must_succeed)
2384 reserved_trbs++; 2386 reserved_trbs++;
2385 2387
2386 if (!room_on_ring(xhci, xhci->cmd_ring, reserved_trbs)) { 2388 ret = prepare_ring(xhci, xhci->cmd_ring, EP_STATE_RUNNING,
2387 if (!in_interrupt()) 2389 reserved_trbs, GFP_ATOMIC);
2388 xhci_err(xhci, "ERR: No room for command on command ring\n"); 2390 if (ret < 0) {
2391 xhci_err(xhci, "ERR: No room for command on command ring\n");
2389 if (command_must_succeed) 2392 if (command_must_succeed)
2390 xhci_err(xhci, "ERR: Reserved TRB counting for " 2393 xhci_err(xhci, "ERR: Reserved TRB counting for "
2391 "unfailable commands failed.\n"); 2394 "unfailable commands failed.\n");
2392 return -ENOMEM; 2395 return ret;
2393 } 2396 }
2394 queue_trb(xhci, xhci->cmd_ring, false, false, field1, field2, field3, 2397 queue_trb(xhci, xhci->cmd_ring, false, false, field1, field2, field3,
2395 field4 | xhci->cmd_ring->cycle_state); 2398 field4 | xhci->cmd_ring->cycle_state);
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 27345cd04da0..3998f72cd0c4 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -2134,6 +2134,8 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
2134 /* If this is a Set Address to an unconfigured device, setup ep 0 */ 2134 /* If this is a Set Address to an unconfigured device, setup ep 0 */
2135 if (!udev->config) 2135 if (!udev->config)
2136 xhci_setup_addressable_virt_dev(xhci, udev); 2136 xhci_setup_addressable_virt_dev(xhci, udev);
2137 else
2138 xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev);
2137 /* Otherwise, assume the core has the device configured how it wants */ 2139 /* Otherwise, assume the core has the device configured how it wants */
2138 xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id); 2140 xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id);
2139 xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2); 2141 xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 8b4b7d39f79c..6c7e3430ec93 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1292,6 +1292,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags);
1292void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id); 1292void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id);
1293int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags); 1293int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags);
1294int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev); 1294int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev);
1295void xhci_copy_ep0_dequeue_into_input_ctx(struct xhci_hcd *xhci,
1296 struct usb_device *udev);
1295unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc); 1297unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc);
1296unsigned int xhci_get_endpoint_flag(struct usb_endpoint_descriptor *desc); 1298unsigned int xhci_get_endpoint_flag(struct usb_endpoint_descriptor *desc);
1297unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index); 1299unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index);