Commit 9870d895 authored by Boris Brezillon's avatar Boris Brezillon Committed by Felipe Balbi

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: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
Reported-by: default avatarPatrice VILCHEZ <patrice.vilchez@atmel.com>
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 258e2ddd
...@@ -1612,12 +1612,14 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) ...@@ -1612,12 +1612,14 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
spin_lock(&udc->lock); 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); DBG(DBG_INT, "irq, status=%#08x\n", status);
if (status & USBA_DET_SUSPEND) { if (status & USBA_DET_SUSPEND) {
toggle_bias(udc, 0); toggle_bias(udc, 0);
usba_writel(udc, INT_CLR, USBA_DET_SUSPEND); 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; udc->bias_pulse_needed = true;
DBG(DBG_BUS, "Suspend detected\n"); DBG(DBG_BUS, "Suspend detected\n");
if (udc->gadget.speed != USB_SPEED_UNKNOWN if (udc->gadget.speed != USB_SPEED_UNKNOWN
...@@ -1631,6 +1633,8 @@ static irqreturn_t usba_udc_irq(int irq, void *devid) ...@@ -1631,6 +1633,8 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (status & USBA_WAKE_UP) { if (status & USBA_WAKE_UP) {
toggle_bias(udc, 1); toggle_bias(udc, 1);
usba_writel(udc, INT_CLR, USBA_WAKE_UP); 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"); DBG(DBG_BUS, "Wake Up CPU detected\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment