Fix resume breakage of USB PCI controllers behind cardbus bridges
Subsystems (4)
cover Fix resume breakage of USB PCI controllers behind cardbus bridges
[Sorry for resending, I forgot to send CCs to the mailing lists.]
Hi,
Unfortunately, we broke the resume of USB PCI controllers behind cardbus bridges by moving the restoration of their standard config registers to usb_hcd_pci_resume_early(). Namely, if USB PCI controller is behind a cardbus bridge, we're restoring its config registers too early, before the bridge becomes operational.
IMO in the future it's better to move the resume of cardbus bridges to the early resume phase (ie. before device interrupts will be enabled), but for 2.6.29 I think we should just go back to the 2.6.28 behavior, which is to call pci_restore_state() from usb_hcd_pci_resume(). The following patch does this.
Thanks,
Rafael
PATCH 1/1 USB/PCI: Fix resume breakage of controllers behind cardbus bridges
From: Rafael J. Wysocki <[email protected]>
If a USB PCI controller is behind a cardbus bridge, we are trying to restore its configuration registers too early, before the cardbus bridge is operational. To fix this, call pci_restore_state() from usb_hcd_pci_resume() and remove usb_hcd_pci_resume_early() which is no longer necessary (the configuration spaces of USB controllers that are not behind cardbus bridges will be restored by the PCI PM core with interrupts disabled anyway).
This patch fixes the regression from 2.6.28 tracked as
http://bugzilla.kernel.org/show_bug.cgi?id=12659
--- drivers/usb/core/hcd-pci.c | 15 ++------------- drivers/usb/core/hcd.h | 1 - drivers/usb/host/ehci-pci.c | 1 - drivers/usb/host/ohci-pci.c | 1 - drivers/usb/host/uhci-hcd.c | 1 - 5 files changed, 2 insertions(+), 17 deletions(-)
drivers/usb/core/hcd-pci.c +2 -13
@@ -298,19 +298,6 @@ int usb_hcd_pci_suspend(struct pci_dev *EXPORT_SYMBOL_GPL (usb_hcd_pci_suspend);/** -* usb_hcd_pci_resume_early - resume a PCI-based HCD before IRQs are enabled -* @dev: USB Host Controller being resumed -* -* Store this function in the HCD's struct pci_driver as .resume_early. -*/ -int usb_hcd_pci_resume_early (struct pci_dev *dev) -{ -pci_restore_state (dev); -return 0 ; -} -EXPORT_SYMBOL_GPL (usb_hcd_pci_resume_early); - -/** * usb_hcd_pci_resume - power management resume of a PCI-based HCD * @dev: USB Host Controller being resumed *
@@ -333,6 +320,8 @@ int usb_hcd_pci_resume(struct pci_dev *d }#endif +pci_restore_state (dev); + hcd =pci_get_drvdata (dev);if (hcd->state !=HC_STATE_SUSPENDED ) { dev_dbg(hcd->self.controller,
drivers/usb/core/hcd.h +0 -1
@@ -257,7 +257,6 @@ extern void usb_hcd_pci_remove(struct pc#ifdef CONFIG_PM extern int usb_hcd_pci_suspend (struct pci_dev *dev,pm_message_t msg); -extern int usb_hcd_pci_resume_early (struct pci_dev *dev);extern int usb_hcd_pci_resume (struct pci_dev *dev);#endif /* CONFIG_PM */
drivers/usb/host/ehci-pci.c +0 -1
@@ -432,7 +432,6 @@ static struct pci_driver ehci_pci_driver#ifdef CONFIG_PM .suspend = usb_hcd_pci_suspend, - .resume_early = usb_hcd_pci_resume_early, .resume = usb_hcd_pci_resume, #endif .shutdown = usb_hcd_pci_shutdown,
drivers/usb/host/ohci-pci.c +0 -1
@@ -487,7 +487,6 @@ static struct pci_driver ohci_pci_driver#ifdef CONFIG_PM .suspend = usb_hcd_pci_suspend, - .resume_early = usb_hcd_pci_resume_early, .resume = usb_hcd_pci_resume,#endif
drivers/usb/host/uhci-hcd.c +0 -1
@@ -942,7 +942,6 @@ static struct pci_driver uhci_pci_driver#ifdef CONFIG_PM .suspend = usb_hcd_pci_suspend, - .resume_early = usb_hcd_pci_resume_early, .resume = usb_hcd_pci_resume,#endif /* PM */ };
PATCH 1/1 USB/PCI: Fix resume breakage of controllers behind cardbus bridges
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
If a USB PCI controller is behind a cardbus bridge, we are trying to restore its configuration registers too early, before the cardbus bridge is operational. To fix this, call pci_restore_state() from usb_hcd_pci_resume() and remove usb_hcd_pci_resume_early() which is no longer necessary (the configuration spaces of USB controllers that are not behind cardbus bridges will be restored by the PCI PM core with interrupts disabled anyway).
This patch fixes the regression from 2.6.28 tracked as
http://bugzilla.kernel.org/show_bug.cgi?id=12659
--- drivers/usb/core/hcd-pci.c | 15 ++------------- drivers/usb/core/hcd.h | 1 - drivers/usb/host/ehci-pci.c | 1 - drivers/usb/host/ohci-pci.c | 1 - drivers/usb/host/uhci-hcd.c | 1 - 5 files changed, 2 insertions(+), 17 deletions(-)
drivers/usb/core/hcd-pci.c +2 -13
@@ -298,19 +298,6 @@ int usb_hcd_pci_suspend(struct pci_dev *EXPORT_SYMBOL_GPL (usb_hcd_pci_suspend);/** -* usb_hcd_pci_resume_early - resume a PCI-based HCD before IRQs are enabled -* @dev: USB Host Controller being resumed -* -* Store this function in the HCD's struct pci_driver as .resume_early. -*/ -int usb_hcd_pci_resume_early (struct pci_dev *dev) -{ -pci_restore_state (dev); -return 0 ; -} -EXPORT_SYMBOL_GPL (usb_hcd_pci_resume_early); - -/** * usb_hcd_pci_resume - power management resume of a PCI-based HCD * @dev: USB Host Controller being resumed *
@@ -333,6 +320,8 @@ int usb_hcd_pci_resume(struct pci_dev *d }#endif +pci_restore_state (dev); + hcd =pci_get_drvdata (dev);if (hcd->state !=HC_STATE_SUSPENDED ) { dev_dbg(hcd->self.controller,
drivers/usb/core/hcd.h +0 -1
@@ -257,7 +257,6 @@ extern void usb_hcd_pci_remove(struct pc#ifdef CONFIG_PM extern int usb_hcd_pci_suspend (struct pci_dev *dev,pm_message_t msg); -extern int usb_hcd_pci_resume_early (struct pci_dev *dev);extern int usb_hcd_pci_resume (struct pci_dev *dev);#endif /* CONFIG_PM */
drivers/usb/host/ehci-pci.c +0 -1
@@ -432,7 +432,6 @@ static struct pci_driver ehci_pci_driver#ifdef CONFIG_PM .suspend = usb_hcd_pci_suspend, - .resume_early = usb_hcd_pci_resume_early, .resume = usb_hcd_pci_resume, #endif .shutdown = usb_hcd_pci_shutdown,
drivers/usb/host/ohci-pci.c +0 -1
@@ -487,7 +487,6 @@ static struct pci_driver ohci_pci_driver#ifdef CONFIG_PM .suspend = usb_hcd_pci_suspend, - .resume_early = usb_hcd_pci_resume_early, .resume = usb_hcd_pci_resume,#endif
drivers/usb/host/uhci-hcd.c +0 -1
@@ -942,7 +942,6 @@ static struct pci_driver uhci_pci_driver#ifdef CONFIG_PM .suspend = usb_hcd_pci_suspend, - .resume_early = usb_hcd_pci_resume_early, .resume = usb_hcd_pci_resume,#endif /* PM */ };