diff options
author | Manuel Lauss <mano@roarinelk.homelinux.net> | 2008-06-23 03:09:37 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-21 18:16:44 -0400 |
commit | 42bfc7b44f724fb5ce838fc2f552a3eb8cd768ec (patch) | |
tree | d97b0ca257dbadd4fafc6c55cef742d877d78d07 /drivers/usb/host/ohci-au1xxx.c | |
parent | 53c81a348fa1d21dd042d9c9a9f91795f83fed66 (diff) |
USB: Au1xxx-usb: suspend/resume support.
Copy the OHCI/EHCI PM callbacks of the PCI implementation since
they work equally well on Au1xxx hardware.
Tested on Au1200.
Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ohci-au1xxx.c')
-rw-r--r-- | drivers/usb/host/ohci-au1xxx.c | 59 |
1 files changed, 50 insertions, 9 deletions
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index 29c970ad487a..c0948008fe3d 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -248,27 +248,68 @@ static int ohci_hcd_au1xxx_drv_remove(struct platform_device *pdev) | |||
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
250 | 250 | ||
251 | /*TBD*/ | 251 | #ifdef CONFIG_PM |
252 | /*static int ohci_hcd_au1xxx_drv_suspend(struct platform_device *dev) | 252 | static int ohci_hcd_au1xxx_drv_suspend(struct platform_device *pdev, |
253 | pm_message_t message) | ||
253 | { | 254 | { |
254 | struct usb_hcd *hcd = platform_get_drvdata(dev); | 255 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
256 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
257 | unsigned long flags; | ||
258 | int rc; | ||
259 | |||
260 | rc = 0; | ||
261 | |||
262 | /* Root hub was already suspended. Disable irq emission and | ||
263 | * mark HW unaccessible, bail out if RH has been resumed. Use | ||
264 | * the spinlock to properly synchronize with possible pending | ||
265 | * RH suspend or resume activity. | ||
266 | * | ||
267 | * This is still racy as hcd->state is manipulated outside of | ||
268 | * any locks =P But that will be a different fix. | ||
269 | */ | ||
270 | spin_lock_irqsave(&ohci->lock, flags); | ||
271 | if (hcd->state != HC_STATE_SUSPENDED) { | ||
272 | rc = -EINVAL; | ||
273 | goto bail; | ||
274 | } | ||
275 | ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); | ||
276 | (void)ohci_readl(ohci, &ohci->regs->intrdisable); | ||
255 | 277 | ||
256 | return 0; | 278 | /* make sure snapshot being resumed re-enumerates everything */ |
279 | if (message.event == PM_EVENT_PRETHAW) | ||
280 | ohci_usb_reset(ohci); | ||
281 | |||
282 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
283 | |||
284 | au1xxx_stop_ohc(); | ||
285 | bail: | ||
286 | spin_unlock_irqrestore(&ohci->lock, flags); | ||
287 | |||
288 | return rc; | ||
257 | } | 289 | } |
258 | static int ohci_hcd_au1xxx_drv_resume(struct platform_device *dev) | 290 | |
291 | static int ohci_hcd_au1xxx_drv_resume(struct platform_device *pdev) | ||
259 | { | 292 | { |
260 | struct usb_hcd *hcd = platform_get_drvdata(dev); | 293 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
294 | |||
295 | au1xxx_start_ohc(); | ||
296 | |||
297 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
298 | ohci_finish_controller_resume(hcd); | ||
261 | 299 | ||
262 | return 0; | 300 | return 0; |
263 | } | 301 | } |
264 | */ | 302 | #else |
303 | #define ohci_hcd_au1xxx_drv_suspend NULL | ||
304 | #define ohci_hcd_au1xxx_drv_resume NULL | ||
305 | #endif | ||
265 | 306 | ||
266 | static struct platform_driver ohci_hcd_au1xxx_driver = { | 307 | static struct platform_driver ohci_hcd_au1xxx_driver = { |
267 | .probe = ohci_hcd_au1xxx_drv_probe, | 308 | .probe = ohci_hcd_au1xxx_drv_probe, |
268 | .remove = ohci_hcd_au1xxx_drv_remove, | 309 | .remove = ohci_hcd_au1xxx_drv_remove, |
269 | .shutdown = usb_hcd_platform_shutdown, | 310 | .shutdown = usb_hcd_platform_shutdown, |
270 | /*.suspend = ohci_hcd_au1xxx_drv_suspend, */ | 311 | .suspend = ohci_hcd_au1xxx_drv_suspend, |
271 | /*.resume = ohci_hcd_au1xxx_drv_resume, */ | 312 | .resume = ohci_hcd_au1xxx_drv_resume, |
272 | .driver = { | 313 | .driver = { |
273 | .name = "au1xxx-ohci", | 314 | .name = "au1xxx-ohci", |
274 | .owner = THIS_MODULE, | 315 | .owner = THIS_MODULE, |