summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc2
diff options
context:
space:
mode:
authorGregory Herrero <gregory.herrero@intel.com>2015-09-22 15:16:54 +0200
committerFelipe Balbi <balbi@ti.com>2015-10-01 12:40:19 -0500
commit065d393124f06ef1f5a20a6f5f262fee2cfa873d (patch)
tree30b810f4932f8d7cba24fff2abd6adad16826ffc /drivers/usb/dwc2
parent2e84da6e340a652e942c3513703020976b28190b (diff)
usb: dwc2: gadget: ensure lx_state corresponds to current state
Correctly update lx_state on gadget connection and disconnection. When usb cable is disconnected, lx_state must be updated to L3 as controller could be in power off state. When usb cable is connected, lx_state must be updated to L0 as controller is powered. Signed-off-by: Gregory Herrero <gregory.herrero@intel.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Tested-by: Robert Baldyga <r.baldyga@samsung.com> Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com> Tested-by: John Youn <johnyoun@synopsys.com> Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc2')
-rw-r--r--drivers/usb/dwc2/gadget.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index ddd14a725760..ddb54272478d 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2189,6 +2189,7 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
}
call_gadget(hsotg, disconnect);
+ hsotg->lx_state = DWC2_L3;
}
/**
@@ -2415,6 +2416,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
mdelay(3);
hsotg->last_rst = jiffies;
+ hsotg->lx_state = DWC2_L0;
}
static void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
@@ -2514,7 +2516,6 @@ irq_retry:
kill_all_requests(hsotg, hsotg->eps_out[0],
-ECONNRESET);
- hsotg->lx_state = DWC2_L0;
dwc2_hsotg_core_init_disconnected(hsotg, true);
}
}
@@ -3205,10 +3206,9 @@ static int dwc2_hsotg_vbus_session(struct usb_gadget *gadget, int is_active)
* If controller is hibernated, it must exit from hibernation
* before being initialized
*/
- if (hsotg->lx_state == DWC2_L2) {
+ 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);
dwc2_hsotg_core_init_disconnected(hsotg, false);