summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2015-01-06 14:47:01 +0100
committerFelipe Balbi <balbi@ti.com>2015-01-12 12:13:29 -0600
commit9870d895ad87efae130b2990db9ba265271f113b (patch)
tree91a5c0b8936d86e62eafafac27e84a96760e7315 /drivers
parent258e2ddd634c20065d1c41290d10d2e5cf2f56e2 (diff)
downloadlinux-9870d895ad87efae130b2990db9ba265271f113b.tar.bz2
usb: atmel_usba_udc: Mask status with enabled irqs
Avoid interpreting useless status flags when we're not waiting for such events by masking the status variable with the interrupt enabled register value. Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Reported-by: Patrice VILCHEZ <patrice.vilchez@atmel.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/udc/atmel_usba_udc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 55c8dde67f83..bc3a53264c43 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1612,12 +1612,14 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
spin_lock(&udc->lock);
- status = usba_readl(udc, INT_STA);
+ status = usba_readl(udc, INT_STA) & usba_readl(udc, INT_ENB);
DBG(DBG_INT, "irq, status=%#08x\n", status);
if (status & USBA_DET_SUSPEND) {
toggle_bias(udc, 0);
usba_writel(udc, INT_CLR, USBA_DET_SUSPEND);
+ usba_writel(udc, INT_ENB,
+ usba_readl(udc, INT_ENB) | USBA_WAKE_UP);
udc->bias_pulse_needed = true;
DBG(DBG_BUS, "Suspend detected\n");
if (udc->gadget.speed != USB_SPEED_UNKNOWN
@@ -1631,6 +1633,8 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (status & USBA_WAKE_UP) {
toggle_bias(udc, 1);
usba_writel(udc, INT_CLR, USBA_WAKE_UP);
+ usba_writel(udc, INT_ENB,
+ usba_readl(udc, INT_ENB) & ~USBA_WAKE_UP);
DBG(DBG_BUS, "Wake Up CPU detected\n");
}