aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ehci-fsl.c7
-rw-r--r--drivers/usb/host/ehci-hcd.c12
-rw-r--r--drivers/usb/host/ehci-hub.c31
-rw-r--r--drivers/usb/host/ehci-omap.c39
-rw-r--r--drivers/usb/host/ehci-pci.c8
-rw-r--r--drivers/usb/host/ehci-tegra.c3
-rw-r--r--drivers/usb/host/ehci.h2
-rw-r--r--drivers/usb/host/ohci-at91.c12
-rw-r--r--drivers/usb/host/pci-quirks.c10
-rw-r--r--drivers/usb/host/uhci-hub.c5
-rw-r--r--drivers/usb/host/xhci-dbg.c2
-rw-r--r--drivers/usb/host/xhci-ext-caps.h5
-rw-r--r--drivers/usb/host/xhci-mem.c9
-rw-r--r--drivers/usb/host/xhci-pci.c4
-rw-r--r--drivers/usb/host/xhci-ring.c6
-rw-r--r--drivers/usb/host/xhci.c12
-rw-r--r--drivers/usb/host/xhci.h4
17 files changed, 121 insertions, 50 deletions
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 3e7345172e0..d0a84bd3f3e 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -218,6 +218,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci,
218 u32 portsc; 218 u32 portsc;
219 struct usb_hcd *hcd = ehci_to_hcd(ehci); 219 struct usb_hcd *hcd = ehci_to_hcd(ehci);
220 void __iomem *non_ehci = hcd->regs; 220 void __iomem *non_ehci = hcd->regs;
221 struct fsl_usb2_platform_data *pdata;
222
223 pdata = hcd->self.controller->platform_data;
221 224
222 portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); 225 portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]);
223 portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); 226 portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW);
@@ -234,7 +237,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci,
234 /* fall through */ 237 /* fall through */
235 case FSL_USB2_PHY_UTMI: 238 case FSL_USB2_PHY_UTMI:
236 /* enable UTMI PHY */ 239 /* enable UTMI PHY */
237 setbits32(non_ehci + FSL_SOC_USB_CTRL, CTRL_UTMI_PHY_EN); 240 if (pdata->have_sysif_regs)
241 setbits32(non_ehci + FSL_SOC_USB_CTRL,
242 CTRL_UTMI_PHY_EN);
238 portsc |= PORT_PTS_UTMI; 243 portsc |= PORT_PTS_UTMI;
239 break; 244 break;
240 case FSL_USB2_PHY_NONE: 245 case FSL_USB2_PHY_NONE:
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 057cdda7a48..4a3bc5b7a06 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -347,6 +347,8 @@ static int ehci_reset (struct ehci_hcd *ehci)
347 if (ehci->debug) 347 if (ehci->debug)
348 dbgp_external_startup(); 348 dbgp_external_startup();
349 349
350 ehci->port_c_suspend = ehci->suspended_ports =
351 ehci->resuming_ports = 0;
350 return retval; 352 return retval;
351} 353}
352 354
@@ -856,8 +858,13 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
856 goto dead; 858 goto dead;
857 } 859 }
858 860
861 /*
862 * We don't use STS_FLR, but some controllers don't like it to
863 * remain on, so mask it out along with the other status bits.
864 */
865 masked_status = status & (INTR_MASK | STS_FLR);
866
859 /* Shared IRQ? */ 867 /* Shared IRQ? */
860 masked_status = status & INTR_MASK;
861 if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { 868 if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) {
862 spin_unlock(&ehci->lock); 869 spin_unlock(&ehci->lock);
863 return IRQ_NONE; 870 return IRQ_NONE;
@@ -908,7 +915,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
908 pcd_status = status; 915 pcd_status = status;
909 916
910 /* resume root hub? */ 917 /* resume root hub? */
911 if (!(cmd & CMD_RUN)) 918 if (ehci->rh_state == EHCI_RH_SUSPENDED)
912 usb_hcd_resume_root_hub(hcd); 919 usb_hcd_resume_root_hub(hcd);
913 920
914 /* get per-port change detect bits */ 921 /* get per-port change detect bits */
@@ -939,6 +946,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
939 * like usb_port_resume() does. 946 * like usb_port_resume() does.
940 */ 947 */
941 ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); 948 ehci->reset_done[i] = jiffies + msecs_to_jiffies(25);
949 set_bit(i, &ehci->resuming_ports);
942 ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); 950 ehci_dbg (ehci, "port %d remote wakeup\n", i + 1);
943 mod_timer(&hcd->rh_timer, ehci->reset_done[i]); 951 mod_timer(&hcd->rh_timer, ehci->reset_done[i]);
944 } 952 }
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 256fbd42e48..38fe0762315 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -223,15 +223,10 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
223 * remote wakeup, we must fail the suspend. 223 * remote wakeup, we must fail the suspend.
224 */ 224 */
225 if (hcd->self.root_hub->do_remote_wakeup) { 225 if (hcd->self.root_hub->do_remote_wakeup) {
226 port = HCS_N_PORTS(ehci->hcs_params); 226 if (ehci->resuming_ports) {
227 while (port--) { 227 spin_unlock_irq(&ehci->lock);
228 if (ehci->reset_done[port] != 0) { 228 ehci_dbg(ehci, "suspend failed because a port is resuming\n");
229 spin_unlock_irq(&ehci->lock); 229 return -EBUSY;
230 ehci_dbg(ehci, "suspend failed because "
231 "port %d is resuming\n",
232 port + 1);
233 return -EBUSY;
234 }
235 } 230 }
236 } 231 }
237 232
@@ -554,16 +549,12 @@ static int
554ehci_hub_status_data (struct usb_hcd *hcd, char *buf) 549ehci_hub_status_data (struct usb_hcd *hcd, char *buf)
555{ 550{
556 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 551 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
557 u32 temp, status = 0; 552 u32 temp, status;
558 u32 mask; 553 u32 mask;
559 int ports, i, retval = 1; 554 int ports, i, retval = 1;
560 unsigned long flags; 555 unsigned long flags;
561 u32 ppcd = 0; 556 u32 ppcd = 0;
562 557
563 /* if !USB_SUSPEND, root hub timers won't get shut down ... */
564 if (ehci->rh_state != EHCI_RH_RUNNING)
565 return 0;
566
567 /* init status to no-changes */ 558 /* init status to no-changes */
568 buf [0] = 0; 559 buf [0] = 0;
569 ports = HCS_N_PORTS (ehci->hcs_params); 560 ports = HCS_N_PORTS (ehci->hcs_params);
@@ -572,6 +563,11 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf)
572 retval++; 563 retval++;
573 } 564 }
574 565
566 /* Inform the core about resumes-in-progress by returning
567 * a non-zero value even if there are no status changes.
568 */
569 status = ehci->resuming_ports;
570
575 /* Some boards (mostly VIA?) report bogus overcurrent indications, 571 /* Some boards (mostly VIA?) report bogus overcurrent indications,
576 * causing massive log spam unless we completely ignore them. It 572 * causing massive log spam unless we completely ignore them. It
577 * may be relevant that VIA VT8235 controllers, where PORT_POWER is 573 * may be relevant that VIA VT8235 controllers, where PORT_POWER is
@@ -846,6 +842,7 @@ static int ehci_hub_control (
846 ehci_writel(ehci, 842 ehci_writel(ehci,
847 temp & ~(PORT_RWC_BITS | PORT_RESUME), 843 temp & ~(PORT_RWC_BITS | PORT_RESUME),
848 status_reg); 844 status_reg);
845 clear_bit(wIndex, &ehci->resuming_ports);
849 retval = handshake(ehci, status_reg, 846 retval = handshake(ehci, status_reg,
850 PORT_RESUME, 0, 2000 /* 2msec */); 847 PORT_RESUME, 0, 2000 /* 2msec */);
851 if (retval != 0) { 848 if (retval != 0) {
@@ -864,6 +861,7 @@ static int ehci_hub_control (
864 ehci->reset_done[wIndex])) { 861 ehci->reset_done[wIndex])) {
865 status |= USB_PORT_STAT_C_RESET << 16; 862 status |= USB_PORT_STAT_C_RESET << 16;
866 ehci->reset_done [wIndex] = 0; 863 ehci->reset_done [wIndex] = 0;
864 clear_bit(wIndex, &ehci->resuming_ports);
867 865
868 /* force reset to complete */ 866 /* force reset to complete */
869 ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET), 867 ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET),
@@ -884,8 +882,10 @@ static int ehci_hub_control (
884 ehci_readl(ehci, status_reg)); 882 ehci_readl(ehci, status_reg));
885 } 883 }
886 884
887 if (!(temp & (PORT_RESUME|PORT_RESET))) 885 if (!(temp & (PORT_RESUME|PORT_RESET))) {
888 ehci->reset_done[wIndex] = 0; 886 ehci->reset_done[wIndex] = 0;
887 clear_bit(wIndex, &ehci->resuming_ports);
888 }
889 889
890 /* transfer dedicated ports to the companion hc */ 890 /* transfer dedicated ports to the companion hc */
891 if ((temp & PORT_CONNECT) && 891 if ((temp & PORT_CONNECT) &&
@@ -920,6 +920,7 @@ static int ehci_hub_control (
920 status |= USB_PORT_STAT_SUSPEND; 920 status |= USB_PORT_STAT_SUSPEND;
921 } else if (test_bit(wIndex, &ehci->suspended_ports)) { 921 } else if (test_bit(wIndex, &ehci->suspended_ports)) {
922 clear_bit(wIndex, &ehci->suspended_ports); 922 clear_bit(wIndex, &ehci->suspended_ports);
923 clear_bit(wIndex, &ehci->resuming_ports);
923 ehci->reset_done[wIndex] = 0; 924 ehci->reset_done[wIndex] = 0;
924 if (temp & PORT_PE) 925 if (temp & PORT_PE)
925 set_bit(wIndex, &ehci->port_c_suspend); 926 set_bit(wIndex, &ehci->port_c_suspend);
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index bba9850f32f..5c78f9e7146 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -42,6 +42,7 @@
42#include <plat/usb.h> 42#include <plat/usb.h>
43#include <linux/regulator/consumer.h> 43#include <linux/regulator/consumer.h>
44#include <linux/pm_runtime.h> 44#include <linux/pm_runtime.h>
45#include <linux/gpio.h>
45 46
46/* EHCI Register Set */ 47/* EHCI Register Set */
47#define EHCI_INSNREG04 (0xA0) 48#define EHCI_INSNREG04 (0xA0)
@@ -191,6 +192,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
191 } 192 }
192 } 193 }
193 194
195 if (pdata->phy_reset) {
196 if (gpio_is_valid(pdata->reset_gpio_port[0]))
197 gpio_request_one(pdata->reset_gpio_port[0],
198 GPIOF_OUT_INIT_LOW, "USB1 PHY reset");
199
200 if (gpio_is_valid(pdata->reset_gpio_port[1]))
201 gpio_request_one(pdata->reset_gpio_port[1],
202 GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
203
204 /* Hold the PHY in RESET for enough time till DIR is high */
205 udelay(10);
206 }
207
194 pm_runtime_enable(dev); 208 pm_runtime_enable(dev);
195 pm_runtime_get_sync(dev); 209 pm_runtime_get_sync(dev);
196 210
@@ -237,6 +251,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
237 /* root ports should always stay powered */ 251 /* root ports should always stay powered */
238 ehci_port_power(omap_ehci, 1); 252 ehci_port_power(omap_ehci, 1);
239 253
254 if (pdata->phy_reset) {
255 /* Hold the PHY in RESET for enough time till
256 * PHY is settled and ready
257 */
258 udelay(10);
259
260 if (gpio_is_valid(pdata->reset_gpio_port[0]))
261 gpio_set_value(pdata->reset_gpio_port[0], 1);
262
263 if (gpio_is_valid(pdata->reset_gpio_port[1]))
264 gpio_set_value(pdata->reset_gpio_port[1], 1);
265 }
266
240 return 0; 267 return 0;
241 268
242err_add_hcd: 269err_add_hcd:
@@ -259,8 +286,9 @@ err_io:
259 */ 286 */
260static int ehci_hcd_omap_remove(struct platform_device *pdev) 287static int ehci_hcd_omap_remove(struct platform_device *pdev)
261{ 288{
262 struct device *dev = &pdev->dev; 289 struct device *dev = &pdev->dev;
263 struct usb_hcd *hcd = dev_get_drvdata(dev); 290 struct usb_hcd *hcd = dev_get_drvdata(dev);
291 struct ehci_hcd_omap_platform_data *pdata = dev->platform_data;
264 292
265 usb_remove_hcd(hcd); 293 usb_remove_hcd(hcd);
266 disable_put_regulator(dev->platform_data); 294 disable_put_regulator(dev->platform_data);
@@ -269,6 +297,13 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
269 pm_runtime_put_sync(dev); 297 pm_runtime_put_sync(dev);
270 pm_runtime_disable(dev); 298 pm_runtime_disable(dev);
271 299
300 if (pdata->phy_reset) {
301 if (gpio_is_valid(pdata->reset_gpio_port[0]))
302 gpio_free(pdata->reset_gpio_port[0]);
303
304 if (gpio_is_valid(pdata->reset_gpio_port[1]))
305 gpio_free(pdata->reset_gpio_port[1]);
306 }
272 return 0; 307 return 0;
273} 308}
274 309
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 01bb7241d6e..fe8dc069164 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -144,6 +144,14 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
144 hcd->has_tt = 1; 144 hcd->has_tt = 1;
145 tdi_reset(ehci); 145 tdi_reset(ehci);
146 } 146 }
147 if (pdev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK) {
148 /* EHCI #1 or #2 on 6 Series/C200 Series chipset */
149 if (pdev->device == 0x1c26 || pdev->device == 0x1c2d) {
150 ehci_info(ehci, "broken D3 during system sleep on ASUS\n");
151 hcd->broken_pci_sleep = 1;
152 device_set_wakeup_capable(&pdev->dev, false);
153 }
154 }
147 break; 155 break;
148 case PCI_VENDOR_ID_TDI: 156 case PCI_VENDOR_ID_TDI:
149 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { 157 if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 3de48a2d795..86183366647 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -224,6 +224,7 @@ static int tegra_ehci_hub_control(
224 temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); 224 temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);
225 /* start resume signalling */ 225 /* start resume signalling */
226 ehci_writel(ehci, temp | PORT_RESUME, status_reg); 226 ehci_writel(ehci, temp | PORT_RESUME, status_reg);
227 set_bit(wIndex-1, &ehci->resuming_ports);
227 228
228 spin_unlock_irqrestore(&ehci->lock, flags); 229 spin_unlock_irqrestore(&ehci->lock, flags);
229 msleep(20); 230 msleep(20);
@@ -236,6 +237,7 @@ static int tegra_ehci_hub_control(
236 pr_err("%s: timeout waiting for SUSPEND\n", __func__); 237 pr_err("%s: timeout waiting for SUSPEND\n", __func__);
237 238
238 ehci->reset_done[wIndex-1] = 0; 239 ehci->reset_done[wIndex-1] = 0;
240 clear_bit(wIndex-1, &ehci->resuming_ports);
239 241
240 tegra->port_resuming = 1; 242 tegra->port_resuming = 1;
241 goto done; 243 goto done;
@@ -729,7 +731,6 @@ static int tegra_ehci_probe(struct platform_device *pdev)
729 err = -ENODEV; 731 err = -ENODEV;
730 goto fail; 732 goto fail;
731 } 733 }
732 set_irq_flags(irq, IRQF_VALID);
733 734
734#ifdef CONFIG_USB_OTG_UTILS 735#ifdef CONFIG_USB_OTG_UTILS
735 if (pdata->operating_mode == TEGRA_USB_OTG) { 736 if (pdata->operating_mode == TEGRA_USB_OTG) {
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 8f9acbc96fd..2694ed6558d 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -117,6 +117,8 @@ struct ehci_hcd { /* one per controller */
117 the change-suspend feature turned on */ 117 the change-suspend feature turned on */
118 unsigned long suspended_ports; /* which ports are 118 unsigned long suspended_ports; /* which ports are
119 suspended */ 119 suspended */
120 unsigned long resuming_ports; /* which ports have
121 started to resume */
120 122
121 /* per-HC memory pools (could be per-bus, but ...) */ 123 /* per-HC memory pools (could be per-bus, but ...) */
122 struct dma_pool *qh_pool; /* qh per active urb */ 124 struct dma_pool *qh_pool; /* qh per active urb */
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 09f597ad6e0..13ebeca8e73 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -94,7 +94,7 @@ static void at91_stop_hc(struct platform_device *pdev)
94 94
95/*-------------------------------------------------------------------------*/ 95/*-------------------------------------------------------------------------*/
96 96
97static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); 97static void __devexit usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
98 98
99/* configure so an HC device and id are always provided */ 99/* configure so an HC device and id are always provided */
100/* always called with process context; sleeping is OK */ 100/* always called with process context; sleeping is OK */
@@ -108,7 +108,7 @@ static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
108 * then invokes the start() method for the HCD associated with it 108 * then invokes the start() method for the HCD associated with it
109 * through the hotplug entry's driver_data. 109 * through the hotplug entry's driver_data.
110 */ 110 */
111static int usb_hcd_at91_probe(const struct hc_driver *driver, 111static int __devinit usb_hcd_at91_probe(const struct hc_driver *driver,
112 struct platform_device *pdev) 112 struct platform_device *pdev)
113{ 113{
114 int retval; 114 int retval;
@@ -203,7 +203,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
203 * context, "rmmod" or something similar. 203 * context, "rmmod" or something similar.
204 * 204 *
205 */ 205 */
206static void usb_hcd_at91_remove(struct usb_hcd *hcd, 206static void __devexit usb_hcd_at91_remove(struct usb_hcd *hcd,
207 struct platform_device *pdev) 207 struct platform_device *pdev)
208{ 208{
209 usb_remove_hcd(hcd); 209 usb_remove_hcd(hcd);
@@ -545,7 +545,7 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev)
545 545
546/*-------------------------------------------------------------------------*/ 546/*-------------------------------------------------------------------------*/
547 547
548static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) 548static int __devinit ohci_hcd_at91_drv_probe(struct platform_device *pdev)
549{ 549{
550 struct at91_usbh_data *pdata; 550 struct at91_usbh_data *pdata;
551 int i; 551 int i;
@@ -620,7 +620,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
620 return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); 620 return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev);
621} 621}
622 622
623static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) 623static int __devexit ohci_hcd_at91_drv_remove(struct platform_device *pdev)
624{ 624{
625 struct at91_usbh_data *pdata = pdev->dev.platform_data; 625 struct at91_usbh_data *pdata = pdev->dev.platform_data;
626 int i; 626 int i;
@@ -696,7 +696,7 @@ MODULE_ALIAS("platform:at91_ohci");
696 696
697static struct platform_driver ohci_hcd_at91_driver = { 697static struct platform_driver ohci_hcd_at91_driver = {
698 .probe = ohci_hcd_at91_drv_probe, 698 .probe = ohci_hcd_at91_drv_probe,
699 .remove = ohci_hcd_at91_drv_remove, 699 .remove = __devexit_p(ohci_hcd_at91_drv_remove),
700 .shutdown = usb_hcd_platform_shutdown, 700 .shutdown = usb_hcd_platform_shutdown,
701 .suspend = ohci_hcd_at91_drv_suspend, 701 .suspend = ohci_hcd_at91_drv_suspend,
702 .resume = ohci_hcd_at91_drv_resume, 702 .resume = ohci_hcd_at91_drv_resume,
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 11de5f1be98..32dada8c8b4 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -825,9 +825,13 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev)
825 } 825 }
826 } 826 }
827 827
828 /* Disable any BIOS SMIs */ 828 val = readl(base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
829 writel(XHCI_LEGACY_DISABLE_SMI, 829 /* Mask off (turn off) any enabled SMIs */
830 base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); 830 val &= XHCI_LEGACY_DISABLE_SMI;
831 /* Mask all SMI events bits, RW1C */
832 val |= XHCI_LEGACY_SMI_EVENTS;
833 /* Disable any BIOS SMIs and clear all SMI events*/
834 writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
831 835
832 if (usb_is_intel_switchable_xhci(pdev)) 836 if (usb_is_intel_switchable_xhci(pdev))
833 usb_enable_xhci_ports(pdev); 837 usb_enable_xhci_ports(pdev);
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
index 045cde4cbc3..768d54295a2 100644
--- a/drivers/usb/host/uhci-hub.c
+++ b/drivers/usb/host/uhci-hub.c
@@ -196,11 +196,12 @@ static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf)
196 status = get_hub_status_data(uhci, buf); 196 status = get_hub_status_data(uhci, buf);
197 197
198 switch (uhci->rh_state) { 198 switch (uhci->rh_state) {
199 case UHCI_RH_SUSPENDING:
200 case UHCI_RH_SUSPENDED: 199 case UHCI_RH_SUSPENDED:
201 /* if port change, ask to be resumed */ 200 /* if port change, ask to be resumed */
202 if (status || uhci->resuming_ports) 201 if (status || uhci->resuming_ports) {
202 status = 1;
203 usb_hcd_resume_root_hub(hcd); 203 usb_hcd_resume_root_hub(hcd);
204 }
204 break; 205 break;
205 206
206 case UHCI_RH_AUTO_STOPPED: 207 case UHCI_RH_AUTO_STOPPED:
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c
index e9b0f043455..4b436f5a417 100644
--- a/drivers/usb/host/xhci-dbg.c
+++ b/drivers/usb/host/xhci-dbg.c
@@ -119,7 +119,7 @@ static void xhci_print_command_reg(struct xhci_hcd *xhci)
119 xhci_dbg(xhci, " Event Interrupts %s\n", 119 xhci_dbg(xhci, " Event Interrupts %s\n",
120 (temp & CMD_EIE) ? "enabled " : "disabled"); 120 (temp & CMD_EIE) ? "enabled " : "disabled");
121 xhci_dbg(xhci, " Host System Error Interrupts %s\n", 121 xhci_dbg(xhci, " Host System Error Interrupts %s\n",
122 (temp & CMD_EIE) ? "enabled " : "disabled"); 122 (temp & CMD_HSEIE) ? "enabled " : "disabled");
123 xhci_dbg(xhci, " HC has %sfinished light reset\n", 123 xhci_dbg(xhci, " HC has %sfinished light reset\n",
124 (temp & CMD_LRESET) ? "not " : ""); 124 (temp & CMD_LRESET) ? "not " : "");
125} 125}
diff --git a/drivers/usb/host/xhci-ext-caps.h b/drivers/usb/host/xhci-ext-caps.h
index c7f33123d4c..377f4242dab 100644
--- a/drivers/usb/host/xhci-ext-caps.h
+++ b/drivers/usb/host/xhci-ext-caps.h
@@ -62,8 +62,9 @@
62/* USB Legacy Support Control and Status Register - section 7.1.2 */ 62/* USB Legacy Support Control and Status Register - section 7.1.2 */
63/* Add this offset, plus the value of xECP in HCCPARAMS to the base address */ 63/* Add this offset, plus the value of xECP in HCCPARAMS to the base address */
64#define XHCI_LEGACY_CONTROL_OFFSET (0x04) 64#define XHCI_LEGACY_CONTROL_OFFSET (0x04)
65/* bits 1:2, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */ 65/* bits 1:3, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */
66#define XHCI_LEGACY_DISABLE_SMI ((0x3 << 1) + (0xff << 5) + (0x7 << 17)) 66#define XHCI_LEGACY_DISABLE_SMI ((0x7 << 1) + (0xff << 5) + (0x7 << 17))
67#define XHCI_LEGACY_SMI_EVENTS (0x7 << 29)
67 68
68/* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */ 69/* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */
69#define XHCI_L1C (1 << 16) 70#define XHCI_L1C (1 << 16)
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index cae4c6f2845..68eaa908ac8 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1796,11 +1796,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
1796 int i; 1796 int i;
1797 1797
1798 /* Free the Event Ring Segment Table and the actual Event Ring */ 1798 /* Free the Event Ring Segment Table and the actual Event Ring */
1799 if (xhci->ir_set) {
1800 xhci_writel(xhci, 0, &xhci->ir_set->erst_size);
1801 xhci_write_64(xhci, 0, &xhci->ir_set->erst_base);
1802 xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue);
1803 }
1804 size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); 1799 size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries);
1805 if (xhci->erst.entries) 1800 if (xhci->erst.entries)
1806 dma_free_coherent(&pdev->dev, size, 1801 dma_free_coherent(&pdev->dev, size,
@@ -1812,7 +1807,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
1812 xhci->event_ring = NULL; 1807 xhci->event_ring = NULL;
1813 xhci_dbg(xhci, "Freed event ring\n"); 1808 xhci_dbg(xhci, "Freed event ring\n");
1814 1809
1815 xhci_write_64(xhci, 0, &xhci->op_regs->cmd_ring);
1816 if (xhci->cmd_ring) 1810 if (xhci->cmd_ring)
1817 xhci_ring_free(xhci, xhci->cmd_ring); 1811 xhci_ring_free(xhci, xhci->cmd_ring);
1818 xhci->cmd_ring = NULL; 1812 xhci->cmd_ring = NULL;
@@ -1841,7 +1835,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
1841 xhci->medium_streams_pool = NULL; 1835 xhci->medium_streams_pool = NULL;
1842 xhci_dbg(xhci, "Freed medium stream array pool\n"); 1836 xhci_dbg(xhci, "Freed medium stream array pool\n");
1843 1837
1844 xhci_write_64(xhci, 0, &xhci->op_regs->dcbaa_ptr);
1845 if (xhci->dcbaa) 1838 if (xhci->dcbaa)
1846 dma_free_coherent(&pdev->dev, sizeof(*xhci->dcbaa), 1839 dma_free_coherent(&pdev->dev, sizeof(*xhci->dcbaa),
1847 xhci->dcbaa, xhci->dcbaa->dma); 1840 xhci->dcbaa, xhci->dcbaa->dma);
@@ -2459,6 +2452,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
2459 2452
2460fail: 2453fail:
2461 xhci_warn(xhci, "Couldn't initialize memory\n"); 2454 xhci_warn(xhci, "Couldn't initialize memory\n");
2455 xhci_halt(xhci);
2456 xhci_reset(xhci);
2462 xhci_mem_cleanup(xhci); 2457 xhci_mem_cleanup(xhci);
2463 return -ENOMEM; 2458 return -ENOMEM;
2464} 2459}
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index ef98b38626f..7a856a767e7 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -95,6 +95,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
95 xhci->quirks |= XHCI_RESET_ON_RESUME; 95 xhci->quirks |= XHCI_RESET_ON_RESUME;
96 xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); 96 xhci_dbg(xhci, "QUIRK: Resetting on resume\n");
97 } 97 }
98 if (pdev->vendor == PCI_VENDOR_ID_VIA)
99 xhci->quirks |= XHCI_RESET_ON_RESUME;
98} 100}
99 101
100/* called during probe() after chip reset completes */ 102/* called during probe() after chip reset completes */
@@ -326,7 +328,7 @@ int __init xhci_register_pci(void)
326 return pci_register_driver(&xhci_pci_driver); 328 return pci_register_driver(&xhci_pci_driver);
327} 329}
328 330
329void __exit xhci_unregister_pci(void) 331void xhci_unregister_pci(void)
330{ 332{
331 pci_unregister_driver(&xhci_pci_driver); 333 pci_unregister_driver(&xhci_pci_driver);
332} 334}
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 6bd9d53062e..3d9422f16a2 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2417,7 +2417,7 @@ hw_died:
2417 u32 irq_pending; 2417 u32 irq_pending;
2418 /* Acknowledge the PCI interrupt */ 2418 /* Acknowledge the PCI interrupt */
2419 irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); 2419 irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending);
2420 irq_pending |= 0x3; 2420 irq_pending |= IMAN_IP;
2421 xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending); 2421 xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending);
2422 } 2422 }
2423 2423
@@ -2734,7 +2734,7 @@ int xhci_queue_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
2734 urb->dev->speed == USB_SPEED_FULL) 2734 urb->dev->speed == USB_SPEED_FULL)
2735 urb->interval /= 8; 2735 urb->interval /= 8;
2736 } 2736 }
2737 return xhci_queue_bulk_tx(xhci, GFP_ATOMIC, urb, slot_id, ep_index); 2737 return xhci_queue_bulk_tx(xhci, mem_flags, urb, slot_id, ep_index);
2738} 2738}
2739 2739
2740/* 2740/*
@@ -3514,7 +3514,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags,
3514 } 3514 }
3515 ep_ring->num_trbs_free_temp = ep_ring->num_trbs_free; 3515 ep_ring->num_trbs_free_temp = ep_ring->num_trbs_free;
3516 3516
3517 return xhci_queue_isoc_tx(xhci, GFP_ATOMIC, urb, slot_id, ep_index); 3517 return xhci_queue_isoc_tx(xhci, mem_flags, urb, slot_id, ep_index);
3518} 3518}
3519 3519
3520/**** Command Ring Operations ****/ 3520/**** Command Ring Operations ****/
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index e1963d4a430..36641a7f237 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -106,6 +106,9 @@ int xhci_halt(struct xhci_hcd *xhci)
106 STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); 106 STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC);
107 if (!ret) 107 if (!ret)
108 xhci->xhc_state |= XHCI_STATE_HALTED; 108 xhci->xhc_state |= XHCI_STATE_HALTED;
109 else
110 xhci_warn(xhci, "Host not halted after %u microseconds.\n",
111 XHCI_MAX_HALT_USEC);
109 return ret; 112 return ret;
110} 113}
111 114
@@ -664,11 +667,11 @@ static void xhci_save_registers(struct xhci_hcd *xhci)
664 xhci->s3.dev_nt = xhci_readl(xhci, &xhci->op_regs->dev_notification); 667 xhci->s3.dev_nt = xhci_readl(xhci, &xhci->op_regs->dev_notification);
665 xhci->s3.dcbaa_ptr = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr); 668 xhci->s3.dcbaa_ptr = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr);
666 xhci->s3.config_reg = xhci_readl(xhci, &xhci->op_regs->config_reg); 669 xhci->s3.config_reg = xhci_readl(xhci, &xhci->op_regs->config_reg);
667 xhci->s3.irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending);
668 xhci->s3.irq_control = xhci_readl(xhci, &xhci->ir_set->irq_control);
669 xhci->s3.erst_size = xhci_readl(xhci, &xhci->ir_set->erst_size); 670 xhci->s3.erst_size = xhci_readl(xhci, &xhci->ir_set->erst_size);
670 xhci->s3.erst_base = xhci_read_64(xhci, &xhci->ir_set->erst_base); 671 xhci->s3.erst_base = xhci_read_64(xhci, &xhci->ir_set->erst_base);
671 xhci->s3.erst_dequeue = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); 672 xhci->s3.erst_dequeue = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue);
673 xhci->s3.irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending);
674 xhci->s3.irq_control = xhci_readl(xhci, &xhci->ir_set->irq_control);
672} 675}
673 676
674static void xhci_restore_registers(struct xhci_hcd *xhci) 677static void xhci_restore_registers(struct xhci_hcd *xhci)
@@ -677,10 +680,11 @@ static void xhci_restore_registers(struct xhci_hcd *xhci)
677 xhci_writel(xhci, xhci->s3.dev_nt, &xhci->op_regs->dev_notification); 680 xhci_writel(xhci, xhci->s3.dev_nt, &xhci->op_regs->dev_notification);
678 xhci_write_64(xhci, xhci->s3.dcbaa_ptr, &xhci->op_regs->dcbaa_ptr); 681 xhci_write_64(xhci, xhci->s3.dcbaa_ptr, &xhci->op_regs->dcbaa_ptr);
679 xhci_writel(xhci, xhci->s3.config_reg, &xhci->op_regs->config_reg); 682 xhci_writel(xhci, xhci->s3.config_reg, &xhci->op_regs->config_reg);
680 xhci_writel(xhci, xhci->s3.irq_pending, &xhci->ir_set->irq_pending);
681 xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control);
682 xhci_writel(xhci, xhci->s3.erst_size, &xhci->ir_set->erst_size); 683 xhci_writel(xhci, xhci->s3.erst_size, &xhci->ir_set->erst_size);
683 xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); 684 xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base);
685 xhci_write_64(xhci, xhci->s3.erst_dequeue, &xhci->ir_set->erst_dequeue);
686 xhci_writel(xhci, xhci->s3.irq_pending, &xhci->ir_set->irq_pending);
687 xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control);
684} 688}
685 689
686static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) 690static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci)
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 91074fdab3e..3d69c4b2b54 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -205,6 +205,10 @@ struct xhci_op_regs {
205#define CMD_PM_INDEX (1 << 11) 205#define CMD_PM_INDEX (1 << 11)
206/* bits 12:31 are reserved (and should be preserved on writes). */ 206/* bits 12:31 are reserved (and should be preserved on writes). */
207 207
208/* IMAN - Interrupt Management Register */
209#define IMAN_IP (1 << 1)
210#define IMAN_IE (1 << 0)
211
208/* USBSTS - USB status - status bitmasks */ 212/* USBSTS - USB status - status bitmasks */
209/* HC not running - set to 1 when run/stop bit is cleared. */ 213/* HC not running - set to 1 when run/stop bit is cleared. */
210#define STS_HALT XHCI_STS_HALT 214#define STS_HALT XHCI_STS_HALT