diff options
Diffstat (limited to 'drivers/usb/host/xhci.c')
-rw-r--r-- | drivers/usb/host/xhci.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 7fa58c99f126..a9bb796794e3 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -893,7 +893,7 @@ static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci) | |||
893 | struct xhci_port **ports; | 893 | struct xhci_port **ports; |
894 | int port_index; | 894 | int port_index; |
895 | unsigned long flags; | 895 | unsigned long flags; |
896 | u32 t1, t2; | 896 | u32 t1, t2, portsc; |
897 | 897 | ||
898 | spin_lock_irqsave(&xhci->lock, flags); | 898 | spin_lock_irqsave(&xhci->lock, flags); |
899 | 899 | ||
@@ -902,10 +902,15 @@ static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci) | |||
902 | ports = xhci->usb3_rhub.ports; | 902 | ports = xhci->usb3_rhub.ports; |
903 | while (port_index--) { | 903 | while (port_index--) { |
904 | t1 = readl(ports[port_index]->addr); | 904 | t1 = readl(ports[port_index]->addr); |
905 | portsc = t1; | ||
905 | t1 = xhci_port_state_to_neutral(t1); | 906 | t1 = xhci_port_state_to_neutral(t1); |
906 | t2 = t1 & ~PORT_WAKE_BITS; | 907 | t2 = t1 & ~PORT_WAKE_BITS; |
907 | if (t1 != t2) | 908 | if (t1 != t2) { |
908 | writel(t2, ports[port_index]->addr); | 909 | writel(t2, ports[port_index]->addr); |
910 | xhci_dbg(xhci, "disable wake bits port %d-%d, portsc: 0x%x, write: 0x%x\n", | ||
911 | xhci->usb3_rhub.hcd->self.busnum, | ||
912 | port_index + 1, portsc, t2); | ||
913 | } | ||
909 | } | 914 | } |
910 | 915 | ||
911 | /* disable usb2 ports Wake bits */ | 916 | /* disable usb2 ports Wake bits */ |
@@ -913,12 +918,16 @@ static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci) | |||
913 | ports = xhci->usb2_rhub.ports; | 918 | ports = xhci->usb2_rhub.ports; |
914 | while (port_index--) { | 919 | while (port_index--) { |
915 | t1 = readl(ports[port_index]->addr); | 920 | t1 = readl(ports[port_index]->addr); |
921 | portsc = t1; | ||
916 | t1 = xhci_port_state_to_neutral(t1); | 922 | t1 = xhci_port_state_to_neutral(t1); |
917 | t2 = t1 & ~PORT_WAKE_BITS; | 923 | t2 = t1 & ~PORT_WAKE_BITS; |
918 | if (t1 != t2) | 924 | if (t1 != t2) { |
919 | writel(t2, ports[port_index]->addr); | 925 | writel(t2, ports[port_index]->addr); |
926 | xhci_dbg(xhci, "disable wake bits port %d-%d, portsc: 0x%x, write: 0x%x\n", | ||
927 | xhci->usb2_rhub.hcd->self.busnum, | ||
928 | port_index + 1, portsc, t2); | ||
929 | } | ||
920 | } | 930 | } |
921 | |||
922 | spin_unlock_irqrestore(&xhci->lock, flags); | 931 | spin_unlock_irqrestore(&xhci->lock, flags); |
923 | } | 932 | } |
924 | 933 | ||
@@ -1238,6 +1247,21 @@ EXPORT_SYMBOL_GPL(xhci_resume); | |||
1238 | 1247 | ||
1239 | /*-------------------------------------------------------------------------*/ | 1248 | /*-------------------------------------------------------------------------*/ |
1240 | 1249 | ||
1250 | /* | ||
1251 | * Bypass the DMA mapping if URB is suitable for Immediate Transfer (IDT), | ||
1252 | * we'll copy the actual data into the TRB address register. This is limited to | ||
1253 | * transfers up to 8 bytes on output endpoints of any kind with wMaxPacketSize | ||
1254 | * >= 8 bytes. If suitable for IDT only one Transfer TRB per TD is allowed. | ||
1255 | */ | ||
1256 | static int xhci_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, | ||
1257 | gfp_t mem_flags) | ||
1258 | { | ||
1259 | if (xhci_urb_suitable_for_idt(urb)) | ||
1260 | return 0; | ||
1261 | |||
1262 | return usb_hcd_map_urb_for_dma(hcd, urb, mem_flags); | ||
1263 | } | ||
1264 | |||
1241 | /** | 1265 | /** |
1242 | * xhci_get_endpoint_index - Used for passing endpoint bitmasks between the core and | 1266 | * xhci_get_endpoint_index - Used for passing endpoint bitmasks between the core and |
1243 | * HCDs. Find the index for an endpoint given its descriptor. Use the return | 1267 | * HCDs. Find the index for an endpoint given its descriptor. Use the return |
@@ -1783,6 +1807,7 @@ static int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1783 | struct xhci_container_ctx *in_ctx; | 1807 | struct xhci_container_ctx *in_ctx; |
1784 | unsigned int ep_index; | 1808 | unsigned int ep_index; |
1785 | struct xhci_input_control_ctx *ctrl_ctx; | 1809 | struct xhci_input_control_ctx *ctrl_ctx; |
1810 | struct xhci_ep_ctx *ep_ctx; | ||
1786 | u32 added_ctxs; | 1811 | u32 added_ctxs; |
1787 | u32 new_add_flags, new_drop_flags; | 1812 | u32 new_add_flags, new_drop_flags; |
1788 | struct xhci_virt_device *virt_dev; | 1813 | struct xhci_virt_device *virt_dev; |
@@ -1873,6 +1898,9 @@ static int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1873 | /* Store the usb_device pointer for later use */ | 1898 | /* Store the usb_device pointer for later use */ |
1874 | ep->hcpriv = udev; | 1899 | ep->hcpriv = udev; |
1875 | 1900 | ||
1901 | ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index); | ||
1902 | trace_xhci_add_endpoint(ep_ctx); | ||
1903 | |||
1876 | xhci_debugfs_create_endpoint(xhci, virt_dev, ep_index); | 1904 | xhci_debugfs_create_endpoint(xhci, virt_dev, ep_index); |
1877 | 1905 | ||
1878 | xhci_dbg(xhci, "add ep 0x%x, slot id %d, new drop flags = %#x, new add flags = %#x\n", | 1906 | xhci_dbg(xhci, "add ep 0x%x, slot id %d, new drop flags = %#x, new add flags = %#x\n", |
@@ -2747,6 +2775,8 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci, | |||
2747 | } | 2775 | } |
2748 | 2776 | ||
2749 | slot_ctx = xhci_get_slot_ctx(xhci, command->in_ctx); | 2777 | slot_ctx = xhci_get_slot_ctx(xhci, command->in_ctx); |
2778 | |||
2779 | trace_xhci_configure_endpoint_ctrl_ctx(ctrl_ctx); | ||
2750 | trace_xhci_configure_endpoint(slot_ctx); | 2780 | trace_xhci_configure_endpoint(slot_ctx); |
2751 | 2781 | ||
2752 | if (!ctx_change) | 2782 | if (!ctx_change) |
@@ -4012,6 +4042,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
4012 | trace_xhci_address_ctx(xhci, virt_dev->in_ctx, | 4042 | trace_xhci_address_ctx(xhci, virt_dev->in_ctx, |
4013 | le32_to_cpu(slot_ctx->dev_info) >> 27); | 4043 | le32_to_cpu(slot_ctx->dev_info) >> 27); |
4014 | 4044 | ||
4045 | trace_xhci_address_ctrl_ctx(ctrl_ctx); | ||
4015 | spin_lock_irqsave(&xhci->lock, flags); | 4046 | spin_lock_irqsave(&xhci->lock, flags); |
4016 | trace_xhci_setup_device(virt_dev); | 4047 | trace_xhci_setup_device(virt_dev); |
4017 | ret = xhci_queue_address_device(xhci, command, virt_dev->in_ctx->dma, | 4048 | ret = xhci_queue_address_device(xhci, command, virt_dev->in_ctx->dma, |
@@ -5154,6 +5185,7 @@ static const struct hc_driver xhci_hc_driver = { | |||
5154 | /* | 5185 | /* |
5155 | * managing i/o requests and associated device resources | 5186 | * managing i/o requests and associated device resources |
5156 | */ | 5187 | */ |
5188 | .map_urb_for_dma = xhci_map_urb_for_dma, | ||
5157 | .urb_enqueue = xhci_urb_enqueue, | 5189 | .urb_enqueue = xhci_urb_enqueue, |
5158 | .urb_dequeue = xhci_urb_dequeue, | 5190 | .urb_dequeue = xhci_urb_dequeue, |
5159 | .alloc_dev = xhci_alloc_dev, | 5191 | .alloc_dev = xhci_alloc_dev, |