diff options
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, |