All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [13/17] usb: dwc2: Change TxFIFO and RxFIFO flushing flow
@ 2018-01-19 10:44 Grigor Tovmasyan
  0 siblings, 0 replies; only message in thread
From: Grigor Tovmasyan @ 2018-01-19 10:44 UTC (permalink / raw
  To: John Youn, Felipe Balbi, Greg Kroah-Hartman, linux-usb
  Cc: Minas Harutyunyan, Grigor Tovmasyan

From: Minas Harutyunyan <hminas@synopsys.com>

Before flushing fifos required to check AHB master state and
lush when AHB master is in IDLE state.

Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com>
---
 drivers/usb/dwc2/core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index 6868ddf972f7..64a0b2068b14 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -658,6 +658,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);
@@ -681,6 +686,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);
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-01-19 10:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-19 10:44 [13/17] usb: dwc2: Change TxFIFO and RxFIFO flushing flow Grigor Tovmasyan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.