diff options
author | Gregory Herrero <gregory.herrero@intel.com> | 2015-04-29 22:09:09 +0200 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-04-29 15:19:24 -0500 |
commit | 18b2b37c59e1bcd5a61716731ec5549fb5bb0203 (patch) | |
tree | 0a907368686b22003e1fec466398dc110ff4fa8b /drivers | |
parent | 7ababa926c66c5c5a862489b475ff5d96a7dd03a (diff) | |
download | linux-18b2b37c59e1bcd5a61716731ec5549fb5bb0203.tar.bz2 |
usb: dwc2: gadget: powerup controller if needed
During vbus session, usb controller needs to exit hibernation if it was
previously in suspend state.
Since controller will be resetted and configured, there is no need
to restore registers.
Moreover, set lx_state to L0 on B session. vbus_session callback may
not be used by all platforms. Thus, controller software state needs
to be set to L0 if the controller detects a valid B session.
Otherwise, lx_state will remain L2 and prevent any request submission.
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/dwc2/gadget.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 732761f9466b..56a08ac3849a 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2515,6 +2515,7 @@ irq_retry: kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET); + hsotg->lx_state = DWC2_L0; s3c_hsotg_core_init_disconnected(hsotg, true); } } @@ -3205,6 +3206,14 @@ static int s3c_hsotg_vbus_session(struct usb_gadget *gadget, int is_active) spin_lock_irqsave(&hsotg->lock, flags); if (is_active) { + /* + * If controller is hibernated, it must exit from hibernation + * before being initialized + */ + if (hsotg->lx_state == DWC2_L2) { + dwc2_exit_hibernation(hsotg, false); + hsotg->lx_state = DWC2_L0; + } /* Kill any ep0 requests as controller will be reinitialized */ kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET); s3c_hsotg_core_init_disconnected(hsotg, false); |