aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-08 13:03:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-08 13:03:52 -0400
commit132d68d37d33f1d0b9c1f507c8b4d64c27ecec8a (patch)
treeb3c05972e5579e1574873fe745fb1358c62a269c /drivers/usb/host/xhci.c
parent80f232121b69cc69a31ccb2b38c1665d770b0710 (diff)
parent3515468a87a47781f6af818773650513ff14656a (diff)
Merge tag 'usb-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB/PHY updates from Greg KH: "Here is the big set of USB and PHY driver patches for 5.2-rc1 There is the usual set of: - USB gadget updates - PHY driver updates and additions - USB serial driver updates and fixes - typec updates and new chips supported - mtu3 driver updates - xhci driver updates - other tiny driver updates Nothing really interesting, just constant forward progress. All of these have been in linux-next for a while with no reported issues. The usb-gadget and usb-serial trees were merged a bit "late", but both of them had been in linux-next before they got merged here last Friday" * tag 'usb-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (206 commits) USB: serial: f81232: implement break control USB: serial: f81232: add high baud rate support USB: serial: f81232: clear overrun flag USB: serial: f81232: fix interrupt worker not stop usb: dwc3: Rename DWC3_DCTL_LPM_ERRATA usb: dwc3: Fix default lpm_nyet_threshold value usb: dwc3: debug: Print GET_STATUS(device) tracepoint usb: dwc3: Do core validation early on probe usb: dwc3: gadget: Set lpm_capable usb: gadget: atmel: tie wake lock to running clock usb: gadget: atmel: support USB suspend usb: gadget: atmel_usba_udc: simplify setting of interrupt-enabled mask dwc2: gadget: Fix completed transfer size calculation in DDMA usb: dwc2: Set lpm mode parameters depend on HW configuration usb: dwc2: Fix channel disable flow usb: dwc2: Set actual frame number for completed ISOC transfer usb: gadget: do not use __constant_cpu_to_le16 usb: dwc2: gadget: Increase descriptors count for ISOC's usb: introduce usb_ep_type_string() function usb: dwc3: move synchronize_irq() out of the spinlock protected block ...
Diffstat (limited to 'drivers/usb/host/xhci.c')
-rw-r--r--drivers/usb/host/xhci.c40
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 */
1256static 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,