aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVardan Mikayelyan <mvardan@synopsys.com>2018-01-16 07:04:24 -0500
committerFelipe Balbi <felipe.balbi@linux.intel.com>2018-02-12 03:59:31 -0500
commit755d739534f998d92e348fba8ffb0478416576e7 (patch)
tree85c071686cfba05e9398f74688882539b525cbe4
parent9e95a66cce7250c358d496e1c3b62e29ce79ef40 (diff)
usb: dwc2: Fix dwc2_hsotg_core_init_disconnected()
We should call dwc2_hsotg_enqueue_setup() after properly setting lx_state. Because it may cause error-out from dwc2_hsotg_enqueue_setup() due to wrong value in lx_state. Issue can be reproduced by loading driver while connected A-Connector (start in A-HOST mode) then disconnect A-Connector to switch to B-DEVICE. Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Vardan Mikayelyan <mvardan@synopsys.com> Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
-rw-r--r--drivers/usb/dwc2/gadget.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index d6222e946463..5bcad1d869b5 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3381,12 +3381,6 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
3381 dwc2_writel(dwc2_hsotg_ep0_mps(hsotg->eps_out[0]->ep.maxpacket) | 3381 dwc2_writel(dwc2_hsotg_ep0_mps(hsotg->eps_out[0]->ep.maxpacket) |
3382 DXEPCTL_USBACTEP, hsotg->regs + DIEPCTL0); 3382 DXEPCTL_USBACTEP, hsotg->regs + DIEPCTL0);
3383 3383
3384 dwc2_hsotg_enqueue_setup(hsotg);
3385
3386 dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n",
3387 dwc2_readl(hsotg->regs + DIEPCTL0),
3388 dwc2_readl(hsotg->regs + DOEPCTL0));
3389
3390 /* clear global NAKs */ 3384 /* clear global NAKs */
3391 val = DCTL_CGOUTNAK | DCTL_CGNPINNAK; 3385 val = DCTL_CGOUTNAK | DCTL_CGNPINNAK;
3392 if (!is_usb_reset) 3386 if (!is_usb_reset)
@@ -3397,6 +3391,12 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
3397 mdelay(3); 3391 mdelay(3);
3398 3392
3399 hsotg->lx_state = DWC2_L0; 3393 hsotg->lx_state = DWC2_L0;
3394
3395 dwc2_hsotg_enqueue_setup(hsotg);
3396
3397 dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n",
3398 dwc2_readl(hsotg->regs + DIEPCTL0),
3399 dwc2_readl(hsotg->regs + DOEPCTL0));
3400} 3400}
3401 3401
3402static void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg) 3402static void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)