提交 065d3931 编写于 作者: G Gregory Herrero 提交者: Felipe Balbi

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: NGregory Herrero <gregory.herrero@intel.com>
Signed-off-by: NMian Yousaf Kaukab <yousaf.kaukab@intel.com>
Tested-by: NRobert Baldyga <r.baldyga@samsung.com>
Tested-by: NDinh Nguyen <dinguyen@opensource.altera.com>
Tested-by: NJohn Youn <johnyoun@synopsys.com>
Acked-by: NJohn Youn <johnyoun@synopsys.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 2e84da6e
...@@ -2189,6 +2189,7 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg) ...@@ -2189,6 +2189,7 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
} }
call_gadget(hsotg, disconnect); call_gadget(hsotg, disconnect);
hsotg->lx_state = DWC2_L3;
} }
/** /**
...@@ -2415,6 +2416,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg, ...@@ -2415,6 +2416,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
mdelay(3); mdelay(3);
hsotg->last_rst = jiffies; hsotg->last_rst = jiffies;
hsotg->lx_state = DWC2_L0;
} }
static void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg) static void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
...@@ -2514,7 +2516,6 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw) ...@@ -2514,7 +2516,6 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw)
kill_all_requests(hsotg, hsotg->eps_out[0], kill_all_requests(hsotg, hsotg->eps_out[0],
-ECONNRESET); -ECONNRESET);
hsotg->lx_state = DWC2_L0;
dwc2_hsotg_core_init_disconnected(hsotg, true); dwc2_hsotg_core_init_disconnected(hsotg, true);
} }
} }
...@@ -3205,10 +3206,9 @@ static int dwc2_hsotg_vbus_session(struct usb_gadget *gadget, int is_active) ...@@ -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 * If controller is hibernated, it must exit from hibernation
* before being initialized * before being initialized
*/ */
if (hsotg->lx_state == DWC2_L2) { if (hsotg->lx_state == DWC2_L2)
dwc2_exit_hibernation(hsotg, false); dwc2_exit_hibernation(hsotg, false);
hsotg->lx_state = DWC2_L0;
}
/* Kill any ep0 requests as controller will be reinitialized */ /* Kill any ep0 requests as controller will be reinitialized */
kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET); kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET);
dwc2_hsotg_core_init_disconnected(hsotg, false); dwc2_hsotg_core_init_disconnected(hsotg, false);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册