]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/host/ehci-pci.c
USB: revert EHCI VIA workaround patch
[linux-2.6-omap-h63xx.git] / drivers / usb / host / ehci-pci.c
index a1bd2bea6debcff9d436495953c2aa1ed01fcbbb..e51c1ed81ac463cdc677c1a84883ede4e6a2ec9c 100644 (file)
@@ -76,6 +76,30 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
        dbg_hcs_params(ehci, "reset");
        dbg_hcc_params(ehci, "reset");
 
+        /* ehci_init() causes memory for DMA transfers to be
+         * allocated.  Thus, any vendor-specific workarounds based on
+         * limiting the type of memory used for DMA transfers must
+         * happen before ehci_init() is called. */
+       switch (pdev->vendor) {
+       case PCI_VENDOR_ID_NVIDIA:
+               /* NVidia reports that certain chips don't handle
+                * QH, ITD, or SITD addresses above 2GB.  (But TD,
+                * data buffer, and periodic schedule are normal.)
+                */
+               switch (pdev->device) {
+               case 0x003c:    /* MCP04 */
+               case 0x005b:    /* CK804 */
+               case 0x00d8:    /* CK8 */
+               case 0x00e8:    /* CK8S */
+                       if (pci_set_consistent_dma_mask(pdev,
+                                               DMA_31BIT_MASK) < 0)
+                               ehci_warn(ehci, "can't enable NVidia "
+                                       "workaround for >2GB RAM\n");
+                       break;
+               }
+               break;
+       }
+
        /* cache this readonly data; minimize chip reads */
        ehci->hcs_params = readl(&ehci->caps->hcs_params);
 
@@ -88,8 +112,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
        if (retval)
                return retval;
 
-       /* NOTE:  only the parts below this line are PCI-specific */
-
        switch (pdev->vendor) {
        case PCI_VENDOR_ID_TDI:
                if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
@@ -107,19 +129,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
                break;
        case PCI_VENDOR_ID_NVIDIA:
                switch (pdev->device) {
-               /* NVidia reports that certain chips don't handle
-                * QH, ITD, or SITD addresses above 2GB.  (But TD,
-                * data buffer, and periodic schedule are normal.)
-                */
-               case 0x003c:    /* MCP04 */
-               case 0x005b:    /* CK804 */
-               case 0x00d8:    /* CK8 */
-               case 0x00e8:    /* CK8S */
-                       if (pci_set_consistent_dma_mask(pdev,
-                                               DMA_31BIT_MASK) < 0)
-                               ehci_warn(ehci, "can't enable NVidia "
-                                       "workaround for >2GB RAM\n");
-                       break;
                /* Some NForce2 chips have problems with selective suspend;
                 * fixed in newer silicon.
                 */
@@ -229,6 +238,12 @@ static int ehci_pci_suspend(struct usb_hcd *hcd, pm_message_t message)
        writel (0, &ehci->regs->intr_enable);
        (void)readl(&ehci->regs->intr_enable);
 
+       /* make sure snapshot being resumed re-enumerates everything */
+       if (message.event == PM_EVENT_PRETHAW) {
+               ehci_halt(ehci);
+               ehci_reset(ehci);
+       }
+
        clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
  bail:
        spin_unlock_irqrestore (&ehci->lock, flags);
@@ -289,7 +304,7 @@ restart:
        spin_lock_irq(&ehci->lock);
        if (ehci->reclaim)
                ehci->reclaim_ready = 1;
-       ehci_work(ehci, NULL);
+       ehci_work(ehci);
        spin_unlock_irq(&ehci->lock);
 
        /* restart; khubd will disconnect devices */
@@ -323,6 +338,7 @@ static const struct hc_driver ehci_pci_hc_driver = {
        .resume =               ehci_pci_resume,
 #endif
        .stop =                 ehci_stop,
+       .shutdown =             ehci_shutdown,
 
        /*
         * managing i/o requests and associated device resources
@@ -369,24 +385,5 @@ static struct pci_driver ehci_pci_driver = {
        .suspend =      usb_hcd_pci_suspend,
        .resume =       usb_hcd_pci_resume,
 #endif
+       .shutdown =     usb_hcd_pci_shutdown,
 };
-
-static int __init ehci_hcd_pci_init(void)
-{
-       if (usb_disabled())
-               return -ENODEV;
-
-       pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n",
-               hcd_name,
-               sizeof(struct ehci_qh), sizeof(struct ehci_qtd),
-               sizeof(struct ehci_itd), sizeof(struct ehci_sitd));
-
-       return pci_register_driver(&ehci_pci_driver);
-}
-module_init(ehci_hcd_pci_init);
-
-static void __exit ehci_hcd_pci_cleanup(void)
-{
-       pci_unregister_driver(&ehci_pci_driver);
-}
-module_exit(ehci_hcd_pci_cleanup);