提交 6fd9086a 编写于 作者: A Alan Stern 提交者: Greg Kroah-Hartman

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: NAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 a0d4922d
...@@ -128,6 +128,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -128,6 +128,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
} }
pci_set_master(dev); pci_set_master(dev);
device_set_wakeup_enable(&dev->dev, 1);
retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED); retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);
if (retval != 0) if (retval != 0)
......
...@@ -219,16 +219,20 @@ static int ehci_pci_setup(struct usb_hcd *hcd) ...@@ -219,16 +219,20 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
/* Serial Bus Release Number is at PCI 0x60 offset */ /* Serial Bus Release Number is at PCI 0x60 offset */
pci_read_config_byte(pdev, 0x60, &ehci->sbrn); pci_read_config_byte(pdev, 0x60, &ehci->sbrn);
/* Workaround current PCI init glitch: wakeup bits aren't /* Keep this around for a while just in case some EHCI
* being set from PCI PM capability. * implementation uses legacy PCI PM support. This test
* can be removed on 17 Dec 2009 if the dev_warn() hasn't
* been triggered by then.
*/ */
if (!device_can_wakeup(&pdev->dev)) { if (!device_can_wakeup(&pdev->dev)) {
u16 port_wake; u16 port_wake;
pci_read_config_word(pdev, 0x62, &port_wake); pci_read_config_word(pdev, 0x62, &port_wake);
if (port_wake & 0x0001) if (port_wake & 0x0001) {
dev_warn(&pdev->dev, "Enabling legacy PCI PM\n");
device_init_wakeup(&pdev->dev, 1); device_init_wakeup(&pdev->dev, 1);
} }
}
#ifdef CONFIG_USB_SUSPEND #ifdef CONFIG_USB_SUSPEND
/* REVISIT: the controller works fine for wakeup iff the root hub /* REVISIT: the controller works fine for wakeup iff the root hub
......
...@@ -589,13 +589,15 @@ static int ohci_run (struct ohci_hcd *ohci) ...@@ -589,13 +589,15 @@ static int ohci_run (struct ohci_hcd *ohci)
/* also: power/overcurrent flags in roothub.a */ /* also: power/overcurrent flags in roothub.a */
} }
/* Reset USB nearly "by the book". RemoteWakeupConnected was /* Reset USB nearly "by the book". RemoteWakeupConnected has
* saved if boot firmware (BIOS/SMM/...) told us it's connected, * to be checked in case boot firmware (BIOS/SMM/...) has set up
* or if bus glue did the same (e.g. for PCI add-in cards with * wakeup in a way the bus isn't aware of (e.g., legacy PCI PM).
* PCI PM support). * If the bus glue detected wakeup capability then it should
* already be enabled. Either way, if wakeup should be enabled
* but isn't, we'll enable it now.
*/ */
if ((ohci->hc_control & OHCI_CTRL_RWC) != 0 if ((ohci->hc_control & OHCI_CTRL_RWC) != 0
&& !device_may_wakeup(hcd->self.controller)) && !device_can_wakeup(hcd->self.controller))
device_init_wakeup(hcd->self.controller, 1); device_init_wakeup(hcd->self.controller, 1);
switch (ohci->hc_control & OHCI_CTRL_HCFS) { switch (ohci->hc_control & OHCI_CTRL_HCFS) {
......
...@@ -355,9 +355,9 @@ static int __devinit ohci_pci_start (struct usb_hcd *hcd) ...@@ -355,9 +355,9 @@ static int __devinit ohci_pci_start (struct usb_hcd *hcd)
/* RWC may not be set for add-in PCI cards, since boot /* RWC may not be set for add-in PCI cards, since boot
* firmware probably ignored them. This transfers PCI * firmware probably ignored them. This transfers PCI
* PM wakeup capabilities (once the PCI layer is fixed). * PM wakeup capabilities.
*/ */
if (device_may_wakeup(&pdev->dev)) if (device_can_wakeup(&pdev->dev))
ohci->hc_control |= OHCI_CTRL_RWC; ohci->hc_control |= OHCI_CTRL_RWC;
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册