PATCH/RFC: ohci wakeup updates (4/4)
From: David Brownell
Date: Mon Oct 04 2004 - 17:24:41 EST
The HCDs that understand about wakeup (OHCI, EHCI) would
need small tweaks to use the driver model hooks.
EHCI needs comparable changes, but I didn't want to spend
the time splitting them out from other patches unless there
was some agreement that this was the way the driver model
should expose wakeup.
Makes OHCI use the new pmcore wakeup bits, not the old usbcore ones.
Also includes a slightly better interpretation of the RWC bit.
[ against Greg's 2.6.9-rc3 USB tree, hence 2.6.9-rc3-mm2 ]
--- 1.83/drivers/usb/host/ohci-hcd.c Fri Oct 1 16:23:18 2004
+++ edited/drivers/usb/host/ohci-hcd.c Sat Oct 2 11:01:41 2004
@@ -505,10 +505,6 @@
hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS),
ohci->hc_control);
- if (ohci->hc_control & OHCI_CTRL_RWC
- && !(ohci->flags & OHCI_QUIRK_AMD756))
- ohci->hcd.can_wakeup = 1;
-
switch (ohci->hc_control & OHCI_CTRL_HCFS) {
case OHCI_USB_OPER:
temp = 0;
@@ -655,7 +651,7 @@
usb_set_device_state (udev, USB_STATE_CONFIGURED);
return 0;
}
-
+
/* connect the virtual root hub */
udev = usb_alloc_dev (NULL, bus, 0);
if (!udev) {
@@ -664,6 +660,11 @@
writel (ohci->hc_control, &ohci->regs->control);
return -ENOMEM;
}
+ /* RWC doesn't always mean the same thing... */
+ if (device_can_wakeup(bus->controller))
+ device_init_wakeup(bus->controller,
+ ohci->hc_control & OHCI_CTRL_RWC);
+ device_init_wakeup(&udev->dev, !(ohci->flags & OHCI_QUIRK_AMD756));
udev->speed = USB_SPEED_FULL;
if (hcd_register_root (udev, &ohci->hcd) != 0) {
--- 1.36/drivers/usb/host/ohci-hub.c Mon Sep 20 10:31:27 2004
+++ edited/drivers/usb/host/ohci-hub.c Sat Oct 2 11:01:41 2004
@@ -105,7 +105,7 @@
writel (ohci_readl (&ohci->regs->intrstatus), &ohci->regs->intrstatus);
/* maybe resume can wake root hub */
- if (ohci->hcd.remote_wakeup)
+ if (device_may_wakeup(&root->dev))
ohci->hc_control |= OHCI_CTRL_RWE;
else
ohci->hc_control &= ~OHCI_CTRL_RWE;
@@ -231,7 +231,7 @@
msleep (3);
temp = OHCI_CONTROL_INIT | OHCI_USB_OPER;
- if (ohci->hcd.can_wakeup)
+ if (device_can_wakeup(hcd->self.controller));
temp |= OHCI_CTRL_RWC;
ohci->hc_control = temp;
writel (temp, &ohci->regs->control);
@@ -347,7 +347,8 @@
*/
if (!(status & RH_PS_CCS))
continue;
- if ((status & RH_PS_PSS) && ohci->hcd.remote_wakeup)
+ if ((status & RH_PS_PSS)
+ && device_may_wakeup(&hcd->self.root_hub->dev))
continue;
can_suspend = 0;
}