[PATCH] USB: EHCI updates (4/4) driver model wakeup flags
authorDavid Brownell <david-b@pacbell.net>
Mon, 7 Nov 2005 23:24:46 +0000 (15:24 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 4 Jan 2006 21:48:30 +0000 (13:48 -0800)
This teaches the EHCI driver to use the new driver model wakeup flags,
replacing the similar ones in the HCD glue.  It also adds a workaround
for the current glitch whereby PCI init doesn't init the wakeup flags
from the PCI PM capabilities.  (EHCI controllers don't worry about
legacy mode; the PCI PM capability would always do the job.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ehci-hub.c
drivers/usb/host/ehci-pci.c

index 29f52a44b92801248624dc6a70be09d76cbb924d..dd871023265cd1bc5e08d7b3cc8d0a528cf61f11 100644 (file)
@@ -624,7 +624,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
        }
 
        /* remote wakeup [4.3.1] */
-       if ((status & STS_PCD) && hcd->remote_wakeup) {
+       if ((status & STS_PCD) && device_may_wakeup(&hcd->self.root_hub->dev)) {
                unsigned        i = HCS_N_PORTS (ehci->hcs_params);
 
                /* resume root hub? */
index 82caf336e9b6491e5c56b9579303881c8d24e6b6..69b0b9be7a641fbdd670bb19683e684b7fe45db0 100644 (file)
@@ -59,7 +59,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
 
                if ((t1 & PORT_PE) && !(t1 & PORT_OWNER))
                        t2 |= PORT_SUSPEND;
-               if (hcd->remote_wakeup)
+               if (device_may_wakeup(&hcd->self.root_hub->dev))
                        t2 |= PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E;
                else
                        t2 &= ~(PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E);
@@ -517,7 +517,7 @@ static int ehci_hub_control (
                        if ((temp & PORT_PE) == 0
                                        || (temp & PORT_RESET) != 0)
                                goto error;
-                       if (hcd->remote_wakeup)
+                       if (device_may_wakeup(&hcd->self.root_hub->dev))
                                temp |= PORT_WAKE_BITS;
                        writel (temp | PORT_SUSPEND,
                                &ehci->regs->port_status [wIndex]);
index 13f73a836e455033c002c49d6efea2219262ac3d..ac088bc72f1cb1c1d91acaaeb7f6295886ca4a5e 100644 (file)
@@ -210,7 +210,16 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
        /* Serial Bus Release Number is at PCI 0x60 offset */
        pci_read_config_byte(pdev, 0x60, &ehci->sbrn);
 
-       /* REVISIT:  per-port wake capability (PCI 0x62) currently unused */
+       /* Workaround current PCI init glitch:  wakeup bits aren't
+        * being set from PCI PM capability.
+        */
+       if (!device_can_wakeup(&pdev->dev)) {
+               u16     port_wake;
+
+               pci_read_config_word(pdev, 0x62, &port_wake);
+               if (port_wake & 0x0001)
+                       device_init_wakeup(&pdev->dev, 1);
+       }
 
        retval = ehci_pci_reinit(ehci, pdev);
 done: