[PATCH] USB: EHCI updates (4/4) driver model wakeup flags

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 <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
commit 2c1c3c4cd5f796b1912c65aaf3bf48c0ddf11f5e
tree d0adc25607629f4fbb9f45cc498f5c155d520291
parent 8d7802ed3c617120863f84346638d1cf1c96137b
author David Brownell <[EMAIL PROTECTED]> Mon, 07 Nov 2005 15:24:46 -0800
committer Greg Kroah-Hartman <[EMAIL PROTECTED]> Wed, 04 Jan 2006 13:48:30 -0800

 drivers/usb/host/ehci-hcd.c |    2 +-
 drivers/usb/host/ehci-hub.c |    4 ++--
 drivers/usb/host/ehci-pci.c |   11 ++++++++++-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 29f52a4..dd87102 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -624,7 +624,7 @@ static irqreturn_t ehci_irq (struct usb_
        }
 
        /* 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? */
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 82caf33..69b0b9b 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -59,7 +59,7 @@ static int ehci_bus_suspend (struct usb_
 
                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]);
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 13f73a8..ac088bc 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -210,7 +210,16 @@ static int ehci_pci_setup(struct usb_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:



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to