This function disables all "common interrupts", i.e., those that are
handled by the common interrupt handler.

Signed-off-by: Matthijs Kooijman <matth...@stdin.nl>
---
 drivers/staging/dwc2/core.c      | 14 ++++++++++++++
 drivers/staging/dwc2/core.h      |  6 ++++++
 drivers/staging/dwc2/core_intr.c |  5 -----
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/dwc2/core.c b/drivers/staging/dwc2/core.c
index 1cadb93..a3b8556 100644
--- a/drivers/staging/dwc2/core.c
+++ b/drivers/staging/dwc2/core.c
@@ -81,6 +81,20 @@ static void dwc2_enable_common_interrupts(struct dwc2_hsotg 
*hsotg)
        writel(intmsk, hsotg->regs + GINTMSK);
 }
 
+/**
+ * dwc2_disable_common_interrupts() - Disables the common interrupts
+ *
+ * @hsotg: Programming view of DWC_otg controller
+ */
+void dwc2_disable_common_interrupts(struct dwc2_hsotg *hsotg)
+{
+       u32 intmsk = readl(hsotg->regs + GINTMSK);
+
+       /* Disable common interrupts without disturbing host mode interrupts */
+       intmsk &= ~(GINTMSK_COMMON);
+       writel(intmsk, hsotg->regs + GINTMSK);
+}
+
 /*
  * Initializes the FSLSPClkSel field of the HCFG register depending on the
  * PHY type
diff --git a/drivers/staging/dwc2/core.h b/drivers/staging/dwc2/core.h
index 2817b60..0fa479e 100644
--- a/drivers/staging/dwc2/core.h
+++ b/drivers/staging/dwc2/core.h
@@ -544,6 +544,7 @@ extern void dwc2_flush_rx_fifo(struct dwc2_hsotg *hsotg);
 extern int dwc2_core_init(struct dwc2_hsotg *hsotg, bool select_phy);
 extern void dwc2_enable_global_interrupts(struct dwc2_hsotg *hcd);
 extern void dwc2_disable_global_interrupts(struct dwc2_hsotg *hcd);
+extern void dwc2_disable_common_interrupts(struct dwc2_hsotg *hsotg);
 
 /* This function should be called on every hardware interrupt. */
 extern irqreturn_t dwc2_handle_common_intr(int irq, void *dev);
@@ -751,4 +752,9 @@ extern void dwc2_dump_global_registers(struct dwc2_hsotg 
*hsotg);
  */
 extern u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg);
 
+#define GINTMSK_COMMON (GINTSTS_WKUPINT | GINTSTS_SESSREQINT | \
+                        GINTSTS_CONIDSTSCHNG | GINTSTS_OTGINT | \
+                        GINTSTS_MODEMIS | GINTSTS_DISCONNINT | \
+                        GINTSTS_USBSUSP | GINTSTS_RESTOREDONE)
+
 #endif /* __DWC2_CORE_H__ */
diff --git a/drivers/staging/dwc2/core_intr.c b/drivers/staging/dwc2/core_intr.c
index 3099f2d..c0f0272 100644
--- a/drivers/staging/dwc2/core_intr.c
+++ b/drivers/staging/dwc2/core_intr.c
@@ -400,11 +400,6 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg 
*hsotg)
        writel(GINTSTS_USBSUSP, hsotg->regs + GINTSTS);
 }
 
-#define GINTMSK_COMMON (GINTSTS_WKUPINT | GINTSTS_SESSREQINT |         \
-                        GINTSTS_CONIDSTSCHNG | GINTSTS_OTGINT |        \
-                        GINTSTS_MODEMIS | GINTSTS_DISCONNINT |         \
-                        GINTSTS_USBSUSP | GINTSTS_RESTOREDONE)
-
 /*
  * This function returns the Core Interrupt register
  */
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to