[PATCH 10/10] staging: dwc2: properly separate common and host interrupt enabling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Before, enabling common interrupts would implicitly disable all other
interrupts and enabling host interrupts would disable all interrupts and
then enable both common and host interrupts.

Now, these two are properly separated: each enable function only enables
its own interrupts and leaves all others alone. This makes the
functions do what you'd expect them to.

In practice, both of these functions are only called together during
initialization and cleanup, so there shouldn't be any behaviour change
(though some timing changes could occur).

Signed-off-by: Matthijs Kooijman <matthijs@xxxxxxxx>
---
 drivers/staging/dwc2/core.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/dwc2/core.c b/drivers/staging/dwc2/core.c
index 09b6d19..6b75821 100644
--- a/drivers/staging/dwc2/core.c
+++ b/drivers/staging/dwc2/core.c
@@ -69,13 +69,13 @@ static void dwc2_enable_common_interrupts(struct dwc2_hsotg *hsotg)
 	/* Clear any pending OTG Interrupts */
 	writel(0xffffffff, hsotg->regs + GOTGINT);
 
-	/* Clear any pending interrupts */
-	writel(0xffffffff, hsotg->regs + GINTSTS);
+	/* Clear any pending common interrupts */
+	writel(GINTMSK_COMMON, hsotg->regs + GINTSTS);
 
-	/* Enable the interrupts in the GINTMSK */
-	intmsk = GINTSTS_DISCONNINT | GINTSTS_MODEMIS | GINTSTS_OTGINT;
-
-	intmsk |= GINTSTS_CONIDSTSCHNG | GINTSTS_WKUPINT | GINTSTS_USBSUSP |
+	/* Enable common interrupts without disturbing host mode interrupts */
+	intmsk = readl(hsotg->regs + GINTMSK);
+	intmsk |= GINTSTS_DISCONNINT | GINTSTS_MODEMIS | GINTSTS_OTGINT |
+		  GINTSTS_CONIDSTSCHNG | GINTSTS_WKUPINT | GINTSTS_USBSUSP |
 		  GINTSTS_SESSREQINT;
 
 	writel(intmsk, hsotg->regs + GINTMSK);
@@ -481,15 +481,11 @@ void dwc2_enable_host_interrupts(struct dwc2_hsotg *hsotg)
 
 	dev_dbg(hsotg->dev, "%s()\n", __func__);
 
-	/* Disable all interrupts */
-	writel(0, hsotg->regs + GINTMSK);
+	/* Disable all host channel interrupts */
 	writel(0, hsotg->regs + HAINTMSK);
 
-	/* Clear any pending interrupts */
-	writel(0xffffffff, hsotg->regs + GINTSTS);
-
-	/* Enable the common interrupts */
-	dwc2_enable_common_interrupts(hsotg);
+	/* Clear any pending host mode interrupts */
+	writel(GINTMSK_HOST, hsotg->regs + GINTSTS);
 
 	/* Enable host mode interrupts without disturbing common interrupts */
 	intmsk = readl(hsotg->regs + GINTMSK);
-- 
1.8.0

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux