Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: automatically enable wakeup for PCI host controllers

This patch (as1193b) enables wakeup during initialization for all PCI
host controllers, and it removes some code (and comments!) that are no
longer needed now that the PCI core automatically initializes wakeup
settings for all new devices.

The idea is that the bus should initialize wakeup, and the bus glue
or controller driver should enable it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Alan Stern and committed by
Greg Kroah-Hartman
6fd9086a a0d4922d

+17 -10
+1
drivers/usb/core/hcd-pci.c
··· 128 128 } 129 129 130 130 pci_set_master(dev); 131 + device_set_wakeup_enable(&dev->dev, 1); 131 132 132 133 retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED); 133 134 if (retval != 0)
+7 -3
drivers/usb/host/ehci-pci.c
··· 219 219 /* Serial Bus Release Number is at PCI 0x60 offset */ 220 220 pci_read_config_byte(pdev, 0x60, &ehci->sbrn); 221 221 222 - /* Workaround current PCI init glitch: wakeup bits aren't 223 - * being set from PCI PM capability. 222 + /* Keep this around for a while just in case some EHCI 223 + * implementation uses legacy PCI PM support. This test 224 + * can be removed on 17 Dec 2009 if the dev_warn() hasn't 225 + * been triggered by then. 224 226 */ 225 227 if (!device_can_wakeup(&pdev->dev)) { 226 228 u16 port_wake; 227 229 228 230 pci_read_config_word(pdev, 0x62, &port_wake); 229 - if (port_wake & 0x0001) 231 + if (port_wake & 0x0001) { 232 + dev_warn(&pdev->dev, "Enabling legacy PCI PM\n"); 230 233 device_init_wakeup(&pdev->dev, 1); 234 + } 231 235 } 232 236 233 237 #ifdef CONFIG_USB_SUSPEND
+7 -5
drivers/usb/host/ohci-hcd.c
··· 589 589 /* also: power/overcurrent flags in roothub.a */ 590 590 } 591 591 592 - /* Reset USB nearly "by the book". RemoteWakeupConnected was 593 - * saved if boot firmware (BIOS/SMM/...) told us it's connected, 594 - * or if bus glue did the same (e.g. for PCI add-in cards with 595 - * PCI PM support). 592 + /* Reset USB nearly "by the book". RemoteWakeupConnected has 593 + * to be checked in case boot firmware (BIOS/SMM/...) has set up 594 + * wakeup in a way the bus isn't aware of (e.g., legacy PCI PM). 595 + * If the bus glue detected wakeup capability then it should 596 + * already be enabled. Either way, if wakeup should be enabled 597 + * but isn't, we'll enable it now. 596 598 */ 597 599 if ((ohci->hc_control & OHCI_CTRL_RWC) != 0 598 - && !device_may_wakeup(hcd->self.controller)) 600 + && !device_can_wakeup(hcd->self.controller)) 599 601 device_init_wakeup(hcd->self.controller, 1); 600 602 601 603 switch (ohci->hc_control & OHCI_CTRL_HCFS) {
+2 -2
drivers/usb/host/ohci-pci.c
··· 355 355 356 356 /* RWC may not be set for add-in PCI cards, since boot 357 357 * firmware probably ignored them. This transfers PCI 358 - * PM wakeup capabilities (once the PCI layer is fixed). 358 + * PM wakeup capabilities. 359 359 */ 360 - if (device_may_wakeup(&pdev->dev)) 360 + if (device_can_wakeup(&pdev->dev)) 361 361 ohci->hc_control |= OHCI_CTRL_RWC; 362 362 } 363 363 #endif /* CONFIG_PM */