summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc2/core.c
diff options
context:
space:
mode:
authorMinas Harutyunyan <hminas@synopsys.com>2018-01-19 13:44:46 +0300
committerFelipe Balbi <felipe.balbi@linux.intel.com>2018-03-13 11:47:43 +0300
commit8f55fd6041323dd528e85d4303519d053110a5d4 (patch)
tree727389d2c7116749385ca857621b77d71cac93ef /drivers/usb/dwc2/core.c
parent92a8dd26464e1f21f1d869ec53717bd2c1200d63 (diff)
downloadlinux-8f55fd6041323dd528e85d4303519d053110a5d4.tar.xz
usb: dwc2: Change TxFIFO and RxFIFO flushing flow
Before flushing fifos required to check AHB master state and lush when AHB master is in IDLE state. Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc2/core.c')
-rw-r--r--drivers/usb/dwc2/core.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index 6294cee64e60..e85f2d230da4 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -675,6 +675,11 @@ void dwc2_flush_tx_fifo(struct dwc2_hsotg *hsotg, const int num)
dev_vdbg(hsotg->dev, "Flush Tx FIFO %d\n", num);
+ /* Wait for AHB master IDLE state */
+ if (dwc2_hsotg_wait_bit_set(hsotg, GRSTCTL, GRSTCTL_AHBIDLE, 10000))
+ dev_warn(hsotg->dev, "%s: HANG! AHB Idle GRSCTL\n",
+ __func__);
+
greset = GRSTCTL_TXFFLSH;
greset |= num << GRSTCTL_TXFNUM_SHIFT & GRSTCTL_TXFNUM_MASK;
dwc2_writel(greset, hsotg->regs + GRSTCTL);
@@ -698,6 +703,11 @@ void dwc2_flush_rx_fifo(struct dwc2_hsotg *hsotg)
dev_vdbg(hsotg->dev, "%s()\n", __func__);
+ /* Wait for AHB master IDLE state */
+ if (dwc2_hsotg_wait_bit_set(hsotg, GRSTCTL, GRSTCTL_AHBIDLE, 10000))
+ dev_warn(hsotg->dev, "%s: HANG! AHB Idle GRSCTL\n",
+ __func__);
+
greset = GRSTCTL_RXFFLSH;
dwc2_writel(greset, hsotg->regs + GRSTCTL);