From: Boris Brezillon <boris.brezillon@free-electrons.com> To: Felipe Balbi <balbi@ti.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-usb@vger.kernel.org, Nicolas Ferre <nicolas.ferre@atmel.com>, Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>, Alexandre Belloni <alexandre.belloni@free-electrons.com> Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>, David Laight <David.Laight@ACULAB.COM>, Boris Brezillon <boris.brezillon@free-electrons.com> Subject: [PATCH v3 4/5] usb: atmel_usba_udc: Mask status with enabled irqs Date: Mon, 12 Jan 2015 11:57:57 +0100 [thread overview] Message-ID: <1421060278-27329-5-git-send-email-boris.brezillon@free-electrons.com> (raw) In-Reply-To: <1421060278-27329-1-git-send-email-boris.brezillon@free-electrons.com> Avoid interpreting useless status flags when we're not waiting for such events by masking the status variable with the interrupt enabled register value. Reported-by: Patrice VILCHEZ <patrice.vilchez@atmel.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> --- drivers/usb/gadget/udc/atmel_usba_udc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 55c8dde..bc3a532 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"); } -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: boris.brezillon@free-electrons.com (Boris Brezillon) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 4/5] usb: atmel_usba_udc: Mask status with enabled irqs Date: Mon, 12 Jan 2015 11:57:57 +0100 [thread overview] Message-ID: <1421060278-27329-5-git-send-email-boris.brezillon@free-electrons.com> (raw) In-Reply-To: <1421060278-27329-1-git-send-email-boris.brezillon@free-electrons.com> Avoid interpreting useless status flags when we're not waiting for such events by masking the status variable with the interrupt enabled register value. Reported-by: Patrice VILCHEZ <patrice.vilchez@atmel.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> --- drivers/usb/gadget/udc/atmel_usba_udc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 55c8dde..bc3a532 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"); } -- 1.9.1
next prev parent reply other threads:[~2015-01-12 10:58 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-01-12 10:57 [PATCH v3 0/5] usb: atmel_usba_udc: Rework errata handling Boris Brezillon 2015-01-12 10:57 ` Boris Brezillon 2015-01-12 10:57 ` [PATCH v3 1/5] usb: atmel_usba_udc: Rework at91sam9rl " Boris Brezillon 2015-01-12 10:57 ` Boris Brezillon 2015-01-12 12:15 ` Paul Bolle 2015-01-12 12:15 ` Paul Bolle 2015-01-12 12:54 ` Boris Brezillon 2015-01-12 12:54 ` Boris Brezillon 2015-01-12 10:57 ` [PATCH v3 2/5] usb: atmel_usba_udc: Add at91sam9g45 and at91sam9x5 " Boris Brezillon 2015-01-12 10:57 ` Boris Brezillon 2015-01-12 10:57 ` [PATCH v3 3/5] ARM: at91/dt: update udc compatible strings Boris Brezillon 2015-01-12 10:57 ` Boris Brezillon 2015-01-12 18:23 ` Felipe Balbi 2015-01-12 18:23 ` Felipe Balbi 2015-01-12 19:18 ` Boris Brezillon 2015-01-12 19:18 ` Boris Brezillon 2015-01-12 19:31 ` Felipe Balbi 2015-01-12 19:31 ` Felipe Balbi 2015-01-12 19:42 ` Boris Brezillon 2015-01-12 19:42 ` Boris Brezillon 2015-01-12 10:57 ` Boris Brezillon [this message] 2015-01-12 10:57 ` [PATCH v3 4/5] usb: atmel_usba_udc: Mask status with enabled irqs Boris Brezillon 2015-01-12 10:57 ` [PATCH v3 5/5] usb: gadget: atmel_usba: Cache INT_ENB register value Boris Brezillon 2015-01-12 10:57 ` Boris Brezillon 2015-01-12 11:08 ` [PATCH v3 0/5] usb: atmel_usba_udc: Rework errata handling Nicolas Ferre 2015-01-12 11:08 ` Nicolas Ferre 2015-01-12 13:08 ` [PATCH v4 1/5] usb: atmel_usba_udc: Rework at91sam9rl " Boris Brezillon 2015-01-12 13:08 ` Boris Brezillon 2015-01-13 2:15 ` [PATCH v3 0/5] usb: atmel_usba_udc: Rework " Bo Shen 2015-01-13 2:15 ` Bo Shen
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1421060278-27329-5-git-send-email-boris.brezillon@free-electrons.com \ --to=boris.brezillon@free-electrons.com \ --cc=David.Laight@ACULAB.COM \ --cc=alexandre.belloni@free-electrons.com \ --cc=balbi@ti.com \ --cc=gregkh@linuxfoundation.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-usb@vger.kernel.org \ --cc=nicolas.ferre@atmel.com \ --cc=plagnioj@jcrosoft.com \ --cc=sergei.shtylyov@cogentembedded.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.