diff options
author | Ramneek Mehresh <ramneek.mehresh@freescale.com> | 2013-05-16 10:09:02 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-05-17 19:40:12 (GMT) |
commit | 6a2b97552c5c9b612a9ef37fb2f181005b1919aa (patch) | |
tree | d35ad40ffecfe577582b6937a9b69e362ef2f7e1 /drivers | |
parent | f4cfc8dfdd01e41386bec86a5aca96c6dff414a4 (diff) | |
download | linux-fsl-qoriq-6a2b97552c5c9b612a9ef37fb2f181005b1919aa.tar.xz |
fsl/otg: Fix USB gadget drv start issue
Move synchronization delay b/w host and gadget drv from
fsl_udc_resume() to fsl_otg_start_gadget() to prevent
msleep() getting called from inside interrupt context.
Gadget resume always gets called from inside interrupt
context except during ID change.
Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Change-Id: I8b9705546ef13d560d8b898f8be4fb8e1b986582
Reviewed-on: http://git.am.freescale.net:8181/2548
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Aggrwal Poonam-B10812 <Poonam.Aggrwal@freescale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/fsl_udc_core.c | 16 | ||||
-rw-r--r-- | drivers/usb/gadget/fsl_usb2_udc.h | 1 | ||||
-rw-r--r-- | drivers/usb/otg/fsl_otg.c | 11 |
3 files changed, 10 insertions, 18 deletions
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 35eaa6f..9611d9f 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -1785,7 +1785,6 @@ static void suspend_irq(struct fsl_udc *udc) static void bus_resume(struct fsl_udc *udc) { - udc->last_state = udc->usb_state; udc->usb_state = udc->resume_state; udc->resume_state = 0; @@ -2693,21 +2692,6 @@ static int fsl_udc_suspend(struct platform_device *pdev, pm_message_t state) *-----------------------------------------------------------------*/ static int fsl_udc_resume(struct platform_device *pdev) { -#if defined(CONFIG_FSL_USB2_OTG) || defined(CONFIG_FSL_USB2_OTG_MODULE) - /* Add delay to synchronize between host and gadget drivers - * Upon role-reversal host drv is shutdown by kernel worker - * thread. By the time host drv shuts down, dr controller - * gets programmed for gadget role. Shutting host drv after this - * results in controller getting reset, and it stops responding - * to otg events - * - * This delay can be added only if this function call is not in - * interrupt context which happens only when USB device is not - * coming out of SUSPEND state - */ - if (udc_controller->last_state != USB_STATE_SUSPENDED) - msleep(1000); -#endif /* Enable DR irq reg and set controller Run */ if (udc_controller->stopped) { dr_controller_setup(udc_controller); diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h index 53f508a..c6703bb 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.h +++ b/drivers/usb/gadget/fsl_usb2_udc.h @@ -500,7 +500,6 @@ struct fsl_udc { u32 max_pipes; /* Device max pipes */ u32 bus_reset; /* Device is bus resetting */ u32 resume_state; /* USB state to resume */ - u32 last_state; /* previous USB state */ u32 usb_state; /* USB current state */ u32 ep0_state; /* Endpoint zero state */ u32 ep0_dir; /* Endpoint zero direction: can be diff --git a/drivers/usb/otg/fsl_otg.c b/drivers/usb/otg/fsl_otg.c index bc8922e..1216329 100644 --- a/drivers/usb/otg/fsl_otg.c +++ b/drivers/usb/otg/fsl_otg.c @@ -533,8 +533,17 @@ int fsl_otg_start_gadget(struct otg_fsm *fsm, int on) dev = otg->gadget->dev.parent; if (on) { - if (dev->driver->resume) + /* Delay gadget resume to synchronize between host and gadget + * drivers. Upon role-reversal host drv is shutdown by kernel + * worker thread. By the time host drv shuts down, controller + * gets programmed for gadget role. Shutting host drv after + * this results in controller getting reset, and it stops + * responding to otg events + */ + if (dev->driver->resume) { + msleep(1000); dev->driver->resume(dev); + } } else { if (dev->driver->suspend) dev->driver->suspend(dev, otg_suspend_state); |