diff options
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/ehci-omap.c | 167 | ||||
-rw-r--r-- | drivers/usb/host/ehci-sead3.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-tegra.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/isp1362-hcd.c | 8 | ||||
-rw-r--r-- | drivers/usb/host/ohci-omap.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/pci-quirks.c | 7 | ||||
-rw-r--r-- | drivers/usb/host/pci-quirks.h | 1 | ||||
-rw-r--r-- | drivers/usb/host/xhci-pci.c | 10 | ||||
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 40 | ||||
-rw-r--r-- | drivers/usb/host/xhci.c | 8 | ||||
-rw-r--r-- | drivers/usb/host/xhci.h | 3 |
11 files changed, 59 insertions, 192 deletions
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index bb55eb4a7d48..d7fe287d0678 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
@@ -56,15 +56,6 @@ | |||
56 | #define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8 | 56 | #define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8 |
57 | #define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0 | 57 | #define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0 |
58 | 58 | ||
59 | /* Errata i693 */ | ||
60 | static struct clk *utmi_p1_fck; | ||
61 | static struct clk *utmi_p2_fck; | ||
62 | static struct clk *xclk60mhsp1_ck; | ||
63 | static struct clk *xclk60mhsp2_ck; | ||
64 | static struct clk *usbhost_p1_fck; | ||
65 | static struct clk *usbhost_p2_fck; | ||
66 | static struct clk *init_60m_fclk; | ||
67 | |||
68 | /*-------------------------------------------------------------------------*/ | 59 | /*-------------------------------------------------------------------------*/ |
69 | 60 | ||
70 | static const struct hc_driver ehci_omap_hc_driver; | 61 | static const struct hc_driver ehci_omap_hc_driver; |
@@ -80,40 +71,6 @@ static inline u32 ehci_read(void __iomem *base, u32 reg) | |||
80 | return __raw_readl(base + reg); | 71 | return __raw_readl(base + reg); |
81 | } | 72 | } |
82 | 73 | ||
83 | /* Erratum i693 workaround sequence */ | ||
84 | static void omap_ehci_erratum_i693(struct ehci_hcd *ehci) | ||
85 | { | ||
86 | int ret = 0; | ||
87 | |||
88 | /* Switch to the internal 60 MHz clock */ | ||
89 | ret = clk_set_parent(utmi_p1_fck, init_60m_fclk); | ||
90 | if (ret != 0) | ||
91 | ehci_err(ehci, "init_60m_fclk set parent" | ||
92 | "failed error:%d\n", ret); | ||
93 | |||
94 | ret = clk_set_parent(utmi_p2_fck, init_60m_fclk); | ||
95 | if (ret != 0) | ||
96 | ehci_err(ehci, "init_60m_fclk set parent" | ||
97 | "failed error:%d\n", ret); | ||
98 | |||
99 | clk_enable(usbhost_p1_fck); | ||
100 | clk_enable(usbhost_p2_fck); | ||
101 | |||
102 | /* Wait 1ms and switch back to the external clock */ | ||
103 | mdelay(1); | ||
104 | ret = clk_set_parent(utmi_p1_fck, xclk60mhsp1_ck); | ||
105 | if (ret != 0) | ||
106 | ehci_err(ehci, "xclk60mhsp1_ck set parent" | ||
107 | "failed error:%d\n", ret); | ||
108 | |||
109 | ret = clk_set_parent(utmi_p2_fck, xclk60mhsp2_ck); | ||
110 | if (ret != 0) | ||
111 | ehci_err(ehci, "xclk60mhsp2_ck set parent" | ||
112 | "failed error:%d\n", ret); | ||
113 | |||
114 | clk_disable(usbhost_p1_fck); | ||
115 | clk_disable(usbhost_p2_fck); | ||
116 | } | ||
117 | 74 | ||
118 | static void omap_ehci_soft_phy_reset(struct usb_hcd *hcd, u8 port) | 75 | static void omap_ehci_soft_phy_reset(struct usb_hcd *hcd, u8 port) |
119 | { | 76 | { |
@@ -195,50 +152,6 @@ static int omap_ehci_init(struct usb_hcd *hcd) | |||
195 | return rc; | 152 | return rc; |
196 | } | 153 | } |
197 | 154 | ||
198 | static int omap_ehci_hub_control( | ||
199 | struct usb_hcd *hcd, | ||
200 | u16 typeReq, | ||
201 | u16 wValue, | ||
202 | u16 wIndex, | ||
203 | char *buf, | ||
204 | u16 wLength | ||
205 | ) | ||
206 | { | ||
207 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
208 | u32 __iomem *status_reg = &ehci->regs->port_status[ | ||
209 | (wIndex & 0xff) - 1]; | ||
210 | u32 temp; | ||
211 | unsigned long flags; | ||
212 | int retval = 0; | ||
213 | |||
214 | spin_lock_irqsave(&ehci->lock, flags); | ||
215 | |||
216 | if (typeReq == SetPortFeature && wValue == USB_PORT_FEAT_SUSPEND) { | ||
217 | temp = ehci_readl(ehci, status_reg); | ||
218 | if ((temp & PORT_PE) == 0 || (temp & PORT_RESET) != 0) { | ||
219 | retval = -EPIPE; | ||
220 | goto done; | ||
221 | } | ||
222 | |||
223 | temp &= ~PORT_WKCONN_E; | ||
224 | temp |= PORT_WKDISC_E | PORT_WKOC_E; | ||
225 | ehci_writel(ehci, temp | PORT_SUSPEND, status_reg); | ||
226 | |||
227 | omap_ehci_erratum_i693(ehci); | ||
228 | |||
229 | set_bit((wIndex & 0xff) - 1, &ehci->suspended_ports); | ||
230 | goto done; | ||
231 | } | ||
232 | |||
233 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
234 | |||
235 | /* Handle the hub control events here */ | ||
236 | return ehci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); | ||
237 | done: | ||
238 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
239 | return retval; | ||
240 | } | ||
241 | |||
242 | static void disable_put_regulator( | 155 | static void disable_put_regulator( |
243 | struct ehci_hcd_omap_platform_data *pdata) | 156 | struct ehci_hcd_omap_platform_data *pdata) |
244 | { | 157 | { |
@@ -351,79 +264,9 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
351 | goto err_pm_runtime; | 264 | goto err_pm_runtime; |
352 | } | 265 | } |
353 | 266 | ||
354 | /* get clocks */ | ||
355 | utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk"); | ||
356 | if (IS_ERR(utmi_p1_fck)) { | ||
357 | ret = PTR_ERR(utmi_p1_fck); | ||
358 | dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret); | ||
359 | goto err_add_hcd; | ||
360 | } | ||
361 | |||
362 | xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck"); | ||
363 | if (IS_ERR(xclk60mhsp1_ck)) { | ||
364 | ret = PTR_ERR(xclk60mhsp1_ck); | ||
365 | dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret); | ||
366 | goto err_utmi_p1_fck; | ||
367 | } | ||
368 | |||
369 | utmi_p2_fck = clk_get(dev, "utmi_p2_gfclk"); | ||
370 | if (IS_ERR(utmi_p2_fck)) { | ||
371 | ret = PTR_ERR(utmi_p2_fck); | ||
372 | dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret); | ||
373 | goto err_xclk60mhsp1_ck; | ||
374 | } | ||
375 | |||
376 | xclk60mhsp2_ck = clk_get(dev, "xclk60mhsp2_ck"); | ||
377 | if (IS_ERR(xclk60mhsp2_ck)) { | ||
378 | ret = PTR_ERR(xclk60mhsp2_ck); | ||
379 | dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret); | ||
380 | goto err_utmi_p2_fck; | ||
381 | } | ||
382 | |||
383 | usbhost_p1_fck = clk_get(dev, "usb_host_hs_utmi_p1_clk"); | ||
384 | if (IS_ERR(usbhost_p1_fck)) { | ||
385 | ret = PTR_ERR(usbhost_p1_fck); | ||
386 | dev_err(dev, "usbhost_p1_fck failed error:%d\n", ret); | ||
387 | goto err_xclk60mhsp2_ck; | ||
388 | } | ||
389 | |||
390 | usbhost_p2_fck = clk_get(dev, "usb_host_hs_utmi_p2_clk"); | ||
391 | if (IS_ERR(usbhost_p2_fck)) { | ||
392 | ret = PTR_ERR(usbhost_p2_fck); | ||
393 | dev_err(dev, "usbhost_p2_fck failed error:%d\n", ret); | ||
394 | goto err_usbhost_p1_fck; | ||
395 | } | ||
396 | |||
397 | init_60m_fclk = clk_get(dev, "init_60m_fclk"); | ||
398 | if (IS_ERR(init_60m_fclk)) { | ||
399 | ret = PTR_ERR(init_60m_fclk); | ||
400 | dev_err(dev, "init_60m_fclk failed error:%d\n", ret); | ||
401 | goto err_usbhost_p2_fck; | ||
402 | } | ||
403 | 267 | ||
404 | return 0; | 268 | return 0; |
405 | 269 | ||
406 | err_usbhost_p2_fck: | ||
407 | clk_put(usbhost_p2_fck); | ||
408 | |||
409 | err_usbhost_p1_fck: | ||
410 | clk_put(usbhost_p1_fck); | ||
411 | |||
412 | err_xclk60mhsp2_ck: | ||
413 | clk_put(xclk60mhsp2_ck); | ||
414 | |||
415 | err_utmi_p2_fck: | ||
416 | clk_put(utmi_p2_fck); | ||
417 | |||
418 | err_xclk60mhsp1_ck: | ||
419 | clk_put(xclk60mhsp1_ck); | ||
420 | |||
421 | err_utmi_p1_fck: | ||
422 | clk_put(utmi_p1_fck); | ||
423 | |||
424 | err_add_hcd: | ||
425 | usb_remove_hcd(hcd); | ||
426 | |||
427 | err_pm_runtime: | 270 | err_pm_runtime: |
428 | disable_put_regulator(pdata); | 271 | disable_put_regulator(pdata); |
429 | pm_runtime_put_sync(dev); | 272 | pm_runtime_put_sync(dev); |
@@ -454,14 +297,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev) | |||
454 | iounmap(hcd->regs); | 297 | iounmap(hcd->regs); |
455 | usb_put_hcd(hcd); | 298 | usb_put_hcd(hcd); |
456 | 299 | ||
457 | clk_put(utmi_p1_fck); | ||
458 | clk_put(utmi_p2_fck); | ||
459 | clk_put(xclk60mhsp1_ck); | ||
460 | clk_put(xclk60mhsp2_ck); | ||
461 | clk_put(usbhost_p1_fck); | ||
462 | clk_put(usbhost_p2_fck); | ||
463 | clk_put(init_60m_fclk); | ||
464 | |||
465 | pm_runtime_put_sync(dev); | 300 | pm_runtime_put_sync(dev); |
466 | pm_runtime_disable(dev); | 301 | pm_runtime_disable(dev); |
467 | 302 | ||
@@ -532,7 +367,7 @@ static const struct hc_driver ehci_omap_hc_driver = { | |||
532 | * root hub support | 367 | * root hub support |
533 | */ | 368 | */ |
534 | .hub_status_data = ehci_hub_status_data, | 369 | .hub_status_data = ehci_hub_status_data, |
535 | .hub_control = omap_ehci_hub_control, | 370 | .hub_control = ehci_hub_control, |
536 | .bus_suspend = ehci_bus_suspend, | 371 | .bus_suspend = ehci_bus_suspend, |
537 | .bus_resume = ehci_bus_resume, | 372 | .bus_resume = ehci_bus_resume, |
538 | 373 | ||
diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c index 58c96bd50d22..0c9e43cfaff5 100644 --- a/drivers/usb/host/ehci-sead3.c +++ b/drivers/usb/host/ehci-sead3.c | |||
@@ -40,7 +40,7 @@ static int ehci_sead3_setup(struct usb_hcd *hcd) | |||
40 | ehci->need_io_watchdog = 0; | 40 | ehci->need_io_watchdog = 0; |
41 | 41 | ||
42 | /* Set burst length to 16 words. */ | 42 | /* Set burst length to 16 words. */ |
43 | ehci_writel(ehci, 0x1010, &ehci->regs->reserved[1]); | 43 | ehci_writel(ehci, 0x1010, &ehci->regs->reserved1[1]); |
44 | 44 | ||
45 | return ret; | 45 | return ret; |
46 | } | 46 | } |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 950e95efa381..26dedb30ad0b 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -799,11 +799,12 @@ static int tegra_ehci_remove(struct platform_device *pdev) | |||
799 | #endif | 799 | #endif |
800 | 800 | ||
801 | usb_remove_hcd(hcd); | 801 | usb_remove_hcd(hcd); |
802 | usb_put_hcd(hcd); | ||
803 | 802 | ||
804 | tegra_usb_phy_close(tegra->phy); | 803 | tegra_usb_phy_close(tegra->phy); |
805 | iounmap(hcd->regs); | 804 | iounmap(hcd->regs); |
806 | 805 | ||
806 | usb_put_hcd(hcd); | ||
807 | |||
807 | clk_disable_unprepare(tegra->clk); | 808 | clk_disable_unprepare(tegra->clk); |
808 | clk_put(tegra->clk); | 809 | clk_put(tegra->clk); |
809 | 810 | ||
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 2ed112d3e159..256326322cfd 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c | |||
@@ -543,12 +543,12 @@ static void postproc_ep(struct isp1362_hcd *isp1362_hcd, struct isp1362_ep *ep) | |||
543 | usb_pipein(urb->pipe) ? "IN" : "OUT", ep->nextpid, | 543 | usb_pipein(urb->pipe) ? "IN" : "OUT", ep->nextpid, |
544 | short_ok ? "" : "not_", | 544 | short_ok ? "" : "not_", |
545 | PTD_GET_COUNT(ptd), ep->maxpacket, len); | 545 | PTD_GET_COUNT(ptd), ep->maxpacket, len); |
546 | /* save the data underrun error code for later and | ||
547 | * proceed with the status stage | ||
548 | */ | ||
549 | urb->actual_length += PTD_GET_COUNT(ptd); | ||
546 | if (usb_pipecontrol(urb->pipe)) { | 550 | if (usb_pipecontrol(urb->pipe)) { |
547 | ep->nextpid = USB_PID_ACK; | 551 | ep->nextpid = USB_PID_ACK; |
548 | /* save the data underrun error code for later and | ||
549 | * proceed with the status stage | ||
550 | */ | ||
551 | urb->actual_length += PTD_GET_COUNT(ptd); | ||
552 | BUG_ON(urb->actual_length > urb->transfer_buffer_length); | 552 | BUG_ON(urb->actual_length > urb->transfer_buffer_length); |
553 | 553 | ||
554 | if (urb->status == -EINPROGRESS) | 554 | if (urb->status == -EINPROGRESS) |
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index e7d75d295988..f8b2d91851f7 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -403,8 +403,6 @@ err0: | |||
403 | static inline void | 403 | static inline void |
404 | usb_hcd_omap_remove (struct usb_hcd *hcd, struct platform_device *pdev) | 404 | usb_hcd_omap_remove (struct usb_hcd *hcd, struct platform_device *pdev) |
405 | { | 405 | { |
406 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | ||
407 | |||
408 | usb_remove_hcd(hcd); | 406 | usb_remove_hcd(hcd); |
409 | if (!IS_ERR_OR_NULL(hcd->phy)) { | 407 | if (!IS_ERR_OR_NULL(hcd->phy)) { |
410 | (void) otg_set_host(hcd->phy->otg, 0); | 408 | (void) otg_set_host(hcd->phy->otg, 0); |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index df0828cb2aa3..c5e9e4a76f14 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -800,6 +800,13 @@ void usb_enable_xhci_ports(struct pci_dev *xhci_pdev) | |||
800 | } | 800 | } |
801 | EXPORT_SYMBOL_GPL(usb_enable_xhci_ports); | 801 | EXPORT_SYMBOL_GPL(usb_enable_xhci_ports); |
802 | 802 | ||
803 | void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) | ||
804 | { | ||
805 | pci_write_config_dword(xhci_pdev, USB_INTEL_USB3_PSSEN, 0x0); | ||
806 | pci_write_config_dword(xhci_pdev, USB_INTEL_XUSB2PR, 0x0); | ||
807 | } | ||
808 | EXPORT_SYMBOL_GPL(usb_disable_xhci_ports); | ||
809 | |||
803 | /** | 810 | /** |
804 | * PCI Quirks for xHCI. | 811 | * PCI Quirks for xHCI. |
805 | * | 812 | * |
diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h index b1002a8ef96f..ef004a5de20f 100644 --- a/drivers/usb/host/pci-quirks.h +++ b/drivers/usb/host/pci-quirks.h | |||
@@ -10,6 +10,7 @@ void usb_amd_quirk_pll_disable(void); | |||
10 | void usb_amd_quirk_pll_enable(void); | 10 | void usb_amd_quirk_pll_enable(void); |
11 | bool usb_is_intel_switchable_xhci(struct pci_dev *pdev); | 11 | bool usb_is_intel_switchable_xhci(struct pci_dev *pdev); |
12 | void usb_enable_xhci_ports(struct pci_dev *xhci_pdev); | 12 | void usb_enable_xhci_ports(struct pci_dev *xhci_pdev); |
13 | void usb_disable_xhci_ports(struct pci_dev *xhci_pdev); | ||
13 | #else | 14 | #else |
14 | static inline void usb_amd_quirk_pll_disable(void) {} | 15 | static inline void usb_amd_quirk_pll_disable(void) {} |
15 | static inline void usb_amd_quirk_pll_enable(void) {} | 16 | static inline void usb_amd_quirk_pll_enable(void) {} |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 18b231b0c5d3..9bfd4ca1153c 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -94,11 +94,21 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
94 | xhci->quirks |= XHCI_EP_LIMIT_QUIRK; | 94 | xhci->quirks |= XHCI_EP_LIMIT_QUIRK; |
95 | xhci->limit_active_eps = 64; | 95 | xhci->limit_active_eps = 64; |
96 | xhci->quirks |= XHCI_SW_BW_CHECKING; | 96 | xhci->quirks |= XHCI_SW_BW_CHECKING; |
97 | /* | ||
98 | * PPT desktop boards DH77EB and DH77DF will power back on after | ||
99 | * a few seconds of being shutdown. The fix for this is to | ||
100 | * switch the ports from xHCI to EHCI on shutdown. We can't use | ||
101 | * DMI information to find those particular boards (since each | ||
102 | * vendor will change the board name), so we have to key off all | ||
103 | * PPT chipsets. | ||
104 | */ | ||
105 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; | ||
97 | } | 106 | } |
98 | if (pdev->vendor == PCI_VENDOR_ID_ETRON && | 107 | if (pdev->vendor == PCI_VENDOR_ID_ETRON && |
99 | pdev->device == PCI_DEVICE_ID_ASROCK_P67) { | 108 | pdev->device == PCI_DEVICE_ID_ASROCK_P67) { |
100 | xhci->quirks |= XHCI_RESET_ON_RESUME; | 109 | xhci->quirks |= XHCI_RESET_ON_RESUME; |
101 | xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); | 110 | xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); |
111 | xhci->quirks |= XHCI_TRUST_TX_LENGTH; | ||
102 | } | 112 | } |
103 | if (pdev->vendor == PCI_VENDOR_ID_VIA) | 113 | if (pdev->vendor == PCI_VENDOR_ID_VIA) |
104 | xhci->quirks |= XHCI_RESET_ON_RESUME; | 114 | xhci->quirks |= XHCI_RESET_ON_RESUME; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 8275645889da..643c2f3f3e73 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -145,29 +145,37 @@ static void next_trb(struct xhci_hcd *xhci, | |||
145 | */ | 145 | */ |
146 | static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring) | 146 | static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring) |
147 | { | 147 | { |
148 | union xhci_trb *next; | ||
149 | unsigned long long addr; | 148 | unsigned long long addr; |
150 | 149 | ||
151 | ring->deq_updates++; | 150 | ring->deq_updates++; |
152 | 151 | ||
153 | /* If this is not event ring, there is one more usable TRB */ | 152 | /* |
153 | * If this is not event ring, and the dequeue pointer | ||
154 | * is not on a link TRB, there is one more usable TRB | ||
155 | */ | ||
154 | if (ring->type != TYPE_EVENT && | 156 | if (ring->type != TYPE_EVENT && |
155 | !last_trb(xhci, ring, ring->deq_seg, ring->dequeue)) | 157 | !last_trb(xhci, ring, ring->deq_seg, ring->dequeue)) |
156 | ring->num_trbs_free++; | 158 | ring->num_trbs_free++; |
157 | next = ++(ring->dequeue); | ||
158 | 159 | ||
159 | /* Update the dequeue pointer further if that was a link TRB or we're at | 160 | do { |
160 | * the end of an event ring segment (which doesn't have link TRBS) | 161 | /* |
161 | */ | 162 | * Update the dequeue pointer further if that was a link TRB or |
162 | while (last_trb(xhci, ring, ring->deq_seg, next)) { | 163 | * we're at the end of an event ring segment (which doesn't have |
163 | if (ring->type == TYPE_EVENT && last_trb_on_last_seg(xhci, | 164 | * link TRBS) |
164 | ring, ring->deq_seg, next)) { | 165 | */ |
165 | ring->cycle_state = (ring->cycle_state ? 0 : 1); | 166 | if (last_trb(xhci, ring, ring->deq_seg, ring->dequeue)) { |
167 | if (ring->type == TYPE_EVENT && | ||
168 | last_trb_on_last_seg(xhci, ring, | ||
169 | ring->deq_seg, ring->dequeue)) { | ||
170 | ring->cycle_state = (ring->cycle_state ? 0 : 1); | ||
171 | } | ||
172 | ring->deq_seg = ring->deq_seg->next; | ||
173 | ring->dequeue = ring->deq_seg->trbs; | ||
174 | } else { | ||
175 | ring->dequeue++; | ||
166 | } | 176 | } |
167 | ring->deq_seg = ring->deq_seg->next; | 177 | } while (last_trb(xhci, ring, ring->deq_seg, ring->dequeue)); |
168 | ring->dequeue = ring->deq_seg->trbs; | 178 | |
169 | next = ring->dequeue; | ||
170 | } | ||
171 | addr = (unsigned long long) xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue); | 179 | addr = (unsigned long long) xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue); |
172 | } | 180 | } |
173 | 181 | ||
@@ -2073,8 +2081,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
2073 | if (xhci->quirks & XHCI_TRUST_TX_LENGTH) | 2081 | if (xhci->quirks & XHCI_TRUST_TX_LENGTH) |
2074 | trb_comp_code = COMP_SHORT_TX; | 2082 | trb_comp_code = COMP_SHORT_TX; |
2075 | else | 2083 | else |
2076 | xhci_warn(xhci, "WARN Successful completion on short TX: " | 2084 | xhci_warn_ratelimited(xhci, |
2077 | "needs XHCI_TRUST_TX_LENGTH quirk?\n"); | 2085 | "WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?\n"); |
2078 | case COMP_SHORT_TX: | 2086 | case COMP_SHORT_TX: |
2079 | break; | 2087 | break; |
2080 | case COMP_STOP: | 2088 | case COMP_STOP: |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 7648b2d4b268..c59d5b5b6c7d 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -166,7 +166,7 @@ int xhci_reset(struct xhci_hcd *xhci) | |||
166 | xhci_writel(xhci, command, &xhci->op_regs->command); | 166 | xhci_writel(xhci, command, &xhci->op_regs->command); |
167 | 167 | ||
168 | ret = handshake(xhci, &xhci->op_regs->command, | 168 | ret = handshake(xhci, &xhci->op_regs->command, |
169 | CMD_RESET, 0, 250 * 1000); | 169 | CMD_RESET, 0, 10 * 1000 * 1000); |
170 | if (ret) | 170 | if (ret) |
171 | return ret; | 171 | return ret; |
172 | 172 | ||
@@ -175,7 +175,8 @@ int xhci_reset(struct xhci_hcd *xhci) | |||
175 | * xHCI cannot write to any doorbells or operational registers other | 175 | * xHCI cannot write to any doorbells or operational registers other |
176 | * than status until the "Controller Not Ready" flag is cleared. | 176 | * than status until the "Controller Not Ready" flag is cleared. |
177 | */ | 177 | */ |
178 | ret = handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000); | 178 | ret = handshake(xhci, &xhci->op_regs->status, |
179 | STS_CNR, 0, 10 * 1000 * 1000); | ||
179 | 180 | ||
180 | for (i = 0; i < 2; ++i) { | 181 | for (i = 0; i < 2; ++i) { |
181 | xhci->bus_state[i].port_c_suspend = 0; | 182 | xhci->bus_state[i].port_c_suspend = 0; |
@@ -658,6 +659,9 @@ void xhci_shutdown(struct usb_hcd *hcd) | |||
658 | { | 659 | { |
659 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 660 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
660 | 661 | ||
662 | if (xhci->quirks && XHCI_SPURIOUS_REBOOT) | ||
663 | usb_disable_xhci_ports(to_pci_dev(hcd->self.controller)); | ||
664 | |||
661 | spin_lock_irq(&xhci->lock); | 665 | spin_lock_irq(&xhci->lock); |
662 | xhci_halt(xhci); | 666 | xhci_halt(xhci); |
663 | spin_unlock_irq(&xhci->lock); | 667 | spin_unlock_irq(&xhci->lock); |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 55c0785810c9..c713256297ac 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1494,6 +1494,7 @@ struct xhci_hcd { | |||
1494 | #define XHCI_TRUST_TX_LENGTH (1 << 10) | 1494 | #define XHCI_TRUST_TX_LENGTH (1 << 10) |
1495 | #define XHCI_LPM_SUPPORT (1 << 11) | 1495 | #define XHCI_LPM_SUPPORT (1 << 11) |
1496 | #define XHCI_INTEL_HOST (1 << 12) | 1496 | #define XHCI_INTEL_HOST (1 << 12) |
1497 | #define XHCI_SPURIOUS_REBOOT (1 << 13) | ||
1497 | unsigned int num_active_eps; | 1498 | unsigned int num_active_eps; |
1498 | unsigned int limit_active_eps; | 1499 | unsigned int limit_active_eps; |
1499 | /* There are two roothubs to keep track of bus suspend info for */ | 1500 | /* There are two roothubs to keep track of bus suspend info for */ |
@@ -1537,6 +1538,8 @@ static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci) | |||
1537 | dev_err(xhci_to_hcd(xhci)->self.controller , fmt , ## args) | 1538 | dev_err(xhci_to_hcd(xhci)->self.controller , fmt , ## args) |
1538 | #define xhci_warn(xhci, fmt, args...) \ | 1539 | #define xhci_warn(xhci, fmt, args...) \ |
1539 | dev_warn(xhci_to_hcd(xhci)->self.controller , fmt , ## args) | 1540 | dev_warn(xhci_to_hcd(xhci)->self.controller , fmt , ## args) |
1541 | #define xhci_warn_ratelimited(xhci, fmt, args...) \ | ||
1542 | dev_warn_ratelimited(xhci_to_hcd(xhci)->self.controller , fmt , ## args) | ||
1540 | 1543 | ||
1541 | /* TODO: copied from ehci.h - can be refactored? */ | 1544 | /* TODO: copied from ehci.h - can be refactored? */ |
1542 | /* xHCI spec says all registers are little endian */ | 1545 | /* xHCI spec says all registers are little endian */ |