aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea/core.c
diff options
context:
space:
mode:
authorRichard Zhao <richard.zhao@freescale.com>2012-09-12 07:58:11 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-12 14:20:38 -0400
commitb183c19f98f8afee799ee41e062810d6b1c7e123 (patch)
treed1cd7920d4e434930d75ad2577c10ed249036f7e /drivers/usb/chipidea/core.c
parent388ed487234429652c1cdb797ad45cb0967b2343 (diff)
USB: chipidea: re-order irq handling to avoid unhandled irqs
- let role driver handle irq before ID change check; this gives the role driver a chance to handle disconnect; - disable irq during switch role; no role driver to handle irq in the period. Tested-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Tested-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Richard Zhao <richard.zhao@freescale.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea/core.c')
-rw-r--r--drivers/usb/chipidea/core.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 19ef3242cf43..f69d029b4607 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -279,6 +279,7 @@ static void ci_role_work(struct work_struct *work)
279 279
280 ci_role_stop(ci); 280 ci_role_stop(ci);
281 ci_role_start(ci, role); 281 ci_role_start(ci, role);
282 enable_irq(ci->irq);
282 } 283 }
283} 284}
284 285
@@ -318,18 +319,22 @@ static irqreturn_t ci_irq(int irq, void *data)
318{ 319{
319 struct ci13xxx *ci = data; 320 struct ci13xxx *ci = data;
320 irqreturn_t ret = IRQ_NONE; 321 irqreturn_t ret = IRQ_NONE;
322 u32 otgsc = 0;
321 323
322 if (ci->is_otg) { 324 if (ci->is_otg)
323 u32 sts = hw_read(ci, OP_OTGSC, ~0); 325 otgsc = hw_read(ci, OP_OTGSC, ~0);
326
327 if (ci->role != CI_ROLE_END)
328 ret = ci_role(ci)->irq(ci);
324 329
325 if (sts & OTGSC_IDIS) { 330 if (ci->is_otg && (otgsc & OTGSC_IDIS)) {
326 hw_write(ci, OP_OTGSC, OTGSC_IDIS, OTGSC_IDIS); 331 hw_write(ci, OP_OTGSC, OTGSC_IDIS, OTGSC_IDIS);
327 queue_work(ci->wq, &ci->work); 332 disable_irq_nosync(ci->irq);
328 ret = IRQ_HANDLED; 333 queue_work(ci->wq, &ci->work);
329 } 334 ret = IRQ_HANDLED;
330 } 335 }
331 336
332 return ci->role == CI_ROLE_END ? ret : ci_role(ci)->irq(ci); 337 return ret;
333} 338}
334 339
335static DEFINE_IDA(ci_ida); 340static DEFINE_IDA(ci_ida);