Commit 2becdc62 authored by Mian Yousaf Kaukab's avatar Mian Yousaf Kaukab Committed by Felipe Balbi

usb: dwc2: gadget: only reset core after addressed state

There is a 200ms guard period to avoid unnecessary resets of the dwc2
ip. This delay sometimes prove to be too large when usbcv is run with
an ehci host. dwc2 only needs to be reset after addressed state.
Change the logic to reset ip after addressed state.
Signed-off-by: default avatarMian Yousaf Kaukab <yousaf.kaukab@intel.com>
Tested-by: default avatarRobert Baldyga <r.baldyga@samsung.com>
Tested-by: default avatarDinh Nguyen <dinguyen@opensource.altera.com>
Tested-by: default avatarJohn Youn <johnyoun@synopsys.com>
Acked-by: default avatarJohn Youn <johnyoun@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 5390d438
...@@ -688,7 +688,6 @@ struct dwc2_hregs_backup { ...@@ -688,7 +688,6 @@ struct dwc2_hregs_backup {
* @ctrl_req: Request for EP0 control packets. * @ctrl_req: Request for EP0 control packets.
* @ep0_state: EP0 control transfers state * @ep0_state: EP0 control transfers state
* @test_mode: USB test mode requested by the host * @test_mode: USB test mode requested by the host
* @last_rst: Time of last reset
* @eps: The endpoints being supplied to the gadget framework * @eps: The endpoints being supplied to the gadget framework
* @g_using_dma: Indicate if dma usage is enabled * @g_using_dma: Indicate if dma usage is enabled
* @g_rx_fifo_sz: Contains rx fifo size value * @g_rx_fifo_sz: Contains rx fifo size value
...@@ -831,7 +830,6 @@ struct dwc2_hsotg { ...@@ -831,7 +830,6 @@ struct dwc2_hsotg {
struct usb_gadget gadget; struct usb_gadget gadget;
unsigned int enabled:1; unsigned int enabled:1;
unsigned int connected:1; unsigned int connected:1;
unsigned long last_rst;
struct dwc2_hsotg_ep *eps_in[MAX_EPS_CHANNELS]; struct dwc2_hsotg_ep *eps_in[MAX_EPS_CHANNELS];
struct dwc2_hsotg_ep *eps_out[MAX_EPS_CHANNELS]; struct dwc2_hsotg_ep *eps_out[MAX_EPS_CHANNELS];
u32 g_using_dma; u32 g_using_dma;
......
...@@ -2420,7 +2420,6 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg, ...@@ -2420,7 +2420,6 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
/* must be at-least 3ms to allow bus to see disconnect */ /* must be at-least 3ms to allow bus to see disconnect */
mdelay(3); mdelay(3);
hsotg->last_rst = jiffies;
hsotg->lx_state = DWC2_L0; hsotg->lx_state = DWC2_L0;
} }
...@@ -2504,6 +2503,7 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw) ...@@ -2504,6 +2503,7 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw)
if (gintsts & (GINTSTS_USBRST | GINTSTS_RESETDET)) { if (gintsts & (GINTSTS_USBRST | GINTSTS_RESETDET)) {
u32 usb_status = dwc2_readl(hsotg->regs + GOTGCTL); u32 usb_status = dwc2_readl(hsotg->regs + GOTGCTL);
u32 connected = hsotg->connected;
dev_dbg(hsotg->dev, "%s: USBRst\n", __func__); dev_dbg(hsotg->dev, "%s: USBRst\n", __func__);
dev_dbg(hsotg->dev, "GNPTXSTS=%08x\n", dev_dbg(hsotg->dev, "GNPTXSTS=%08x\n",
...@@ -2514,13 +2514,8 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw) ...@@ -2514,13 +2514,8 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw)
/* Report disconnection if it is not already done. */ /* Report disconnection if it is not already done. */
dwc2_hsotg_disconnect(hsotg); dwc2_hsotg_disconnect(hsotg);
if (usb_status & GOTGCTL_BSESVLD) { if (usb_status & GOTGCTL_BSESVLD && connected)
if (time_after(jiffies, hsotg->last_rst + dwc2_hsotg_core_init_disconnected(hsotg, true);
msecs_to_jiffies(200))) {
dwc2_hsotg_core_init_disconnected(hsotg, true);
}
}
} }
/* check both FIFOs */ /* check both FIFOs */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment