From: Richard Zhao <richard.z...@freescale.com>

In order to avoid re-queueing of the role changing work, we need to clear
the ID change interrupt bit right in the irq handler.

Tested-by: Michael Grzeschik <m.grzesc...@pengutronix.de>
Tested-by: Marc Kleine-Budde <m...@pengutronix.de>
Signed-off-by: Richard Zhao <richard.z...@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shish...@linux.intel.com>
---
 drivers/usb/chipidea/core.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 3c3ed77..19ef324 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -273,8 +273,6 @@ static void ci_role_work(struct work_struct *work)
        struct ci13xxx *ci = container_of(work, struct ci13xxx, work);
        enum ci_role role = ci_otg_role(ci);
 
-       hw_write(ci, OP_OTGSC, OTGSC_IDIS, OTGSC_IDIS);
-
        if (role != ci->role) {
                dev_dbg(ci->dev, "switching from %s to %s\n",
                        ci_role(ci)->name, ci->roles[role]->name);
@@ -325,6 +323,7 @@ static irqreturn_t ci_irq(int irq, void *data)
                u32 sts = hw_read(ci, OP_OTGSC, ~0);
 
                if (sts & OTGSC_IDIS) {
+                       hw_write(ci, OP_OTGSC, OTGSC_IDIS, OTGSC_IDIS);
                        queue_work(ci->wq, &ci->work);
                        ret = IRQ_HANDLED;
                }
-- 
1.7.10.4

--
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