diff options
author | Peter Chen <peter.chen@freescale.com> | 2010-11-30 12:47:57 +0800 |
---|---|---|
committer | Alan Tull <alan.tull@freescale.com> | 2011-02-03 16:32:41 -0600 |
commit | 6e0635c7d23933481fb236a33d75fa39b14a809a (patch) | |
tree | 8de58ec63ce2ec96463bda0b66568c257a7acea7 /drivers/usb/host | |
parent | 05351bb3bbc517ebfd86ea917eb84d24661c28ee (diff) |
ENGR00134154-3 usb: add sync between usb resume and usb wakeup thread
The usb wakeup thread should be prior to usb system resume
during usb wakeup process. It adds wait_event_interruptible
at usb resume process, and the usb wakeup irq will set event,
and the usb wakeup thread will clear event.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/ehci-arc.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/usb/host/ehci-arc.c b/drivers/usb/host/ehci-arc.c index 20416da6d75f..615e76572eed 100644 --- a/drivers/usb/host/ehci-arc.c +++ b/drivers/usb/host/ehci-arc.c @@ -240,8 +240,9 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver, if (retval != 0) goto err5; +#if (!defined CONFIG_USB_OTG) fsl_platform_set_vbus_power(pdata, 1); - +#endif if (pdata->operating_mode == FSL_USB2_DR_OTG) { struct ehci_hcd *ehci = hcd_to_ehci(hcd); @@ -609,10 +610,6 @@ static int ehci_fsl_drv_suspend(struct platform_device *pdev, return 0; } - if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { - fsl_usb_clk_gate(hcd->self.controller->platform_data, true); - set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); - } /* only the otg host can go here */ /* wait for all usb device on the hcd dettached */ usb_lock_device(roothub); @@ -642,7 +639,10 @@ static int ehci_fsl_drv_suspend(struct platform_device *pdev, usb_unlock_device(roothub); } - pr_debug("%s: suspending...\n", __func__); + if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { + fsl_usb_clk_gate(hcd->self.controller->platform_data, true); + set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + } port_status = ehci_readl(ehci, &ehci->regs->port_status[0]); /* save EHCI registers */ @@ -682,10 +682,12 @@ static int ehci_fsl_drv_resume(struct platform_device *pdev) struct usb_device *roothub = hcd->self.root_hub; u32 tmp; struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; + struct fsl_usb2_wakeup_platform_data *wake_up_pdata = pdata->wakeup_pdata; /* Only handles OTG mode switch event */ printk(KERN_DEBUG "ehci fsl drv resume begins: %s\n", pdata->name); if (pdev->dev.power.status == DPM_RESUMING) { - printk(KERN_DEBUG "%s, pm event \n", __func__); + printk(KERN_DEBUG "%s,pm event, wait for wakeup irq if needed\n", __func__); + wait_event_interruptible(wake_up_pdata->wq, !wake_up_pdata->usb_wakeup_is_pending); if (!host_can_wakeup_system(pdev)) { if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { fsl_usb_clk_gate(hcd->self.controller->platform_data, true); |