* [PATCH] dmaengine: usb-dmac: check CHCR.DE bit in usb_dmac_isr_channel()
@ 2016-08-04 10:59 Yoshihiro Shimoda
2016-08-08 8:12 ` Vinod Koul
0 siblings, 1 reply; 2+ messages in thread
From: Yoshihiro Shimoda @ 2016-08-04 10:59 UTC (permalink / raw)
To: vinod.koul, dan.j.williams
Cc: dmaengine, linux-renesas-soc, Yoshihiro Shimoda, stable
The USB-DMAC's interruption happens even if the CHCR.DE is not set to 1
because CHCR.NULLE is set to 1. So, this driver should call
usb_dmac_isr_transfer_end() if the DE bit is set to 1 only. Otherwise,
the desc is possible to be NULL in the usb_dmac_isr_transfer_end().
Fixes: 0c1c8ff32fa2 ("dmaengine: usb-dmac: Add Renesas USB DMA Controller (USB-DMAC) driver)
Cc: <stable@vger.kernel.org> # v4.1+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/dma/sh/usb-dmac.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c
index 749f1bd..06ecdc3 100644
--- a/drivers/dma/sh/usb-dmac.c
+++ b/drivers/dma/sh/usb-dmac.c
@@ -600,27 +600,30 @@ static irqreturn_t usb_dmac_isr_channel(int irq, void *dev)
{
struct usb_dmac_chan *chan = dev;
irqreturn_t ret = IRQ_NONE;
- u32 mask = USB_DMACHCR_TE;
- u32 check_bits = USB_DMACHCR_TE | USB_DMACHCR_SP;
+ u32 mask = 0;
u32 chcr;
+ bool xfer_end = false;
spin_lock(&chan->vc.lock);
chcr = usb_dmac_chan_read(chan, USB_DMACHCR);
- if (chcr & check_bits)
- mask |= USB_DMACHCR_DE | check_bits;
+ if (chcr & (USB_DMACHCR_TE | USB_DMACHCR_SP)) {
+ mask |= USB_DMACHCR_DE | USB_DMACHCR_TE | USB_DMACHCR_SP;
+ if (chcr & USB_DMACHCR_DE)
+ xfer_end = true;
+ ret |= IRQ_HANDLED;
+ }
if (chcr & USB_DMACHCR_NULL) {
/* An interruption of TE will happen after we set FTE */
mask |= USB_DMACHCR_NULL;
chcr |= USB_DMACHCR_FTE;
ret |= IRQ_HANDLED;
}
- usb_dmac_chan_write(chan, USB_DMACHCR, chcr & ~mask);
+ if (mask)
+ usb_dmac_chan_write(chan, USB_DMACHCR, chcr & ~mask);
- if (chcr & check_bits) {
+ if (xfer_end)
usb_dmac_isr_transfer_end(chan);
- ret |= IRQ_HANDLED;
- }
spin_unlock(&chan->vc.lock);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] dmaengine: usb-dmac: check CHCR.DE bit in usb_dmac_isr_channel()
2016-08-04 10:59 [PATCH] dmaengine: usb-dmac: check CHCR.DE bit in usb_dmac_isr_channel() Yoshihiro Shimoda
@ 2016-08-08 8:12 ` Vinod Koul
0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2016-08-08 8:12 UTC (permalink / raw)
To: Yoshihiro Shimoda; +Cc: dan.j.williams, dmaengine, linux-renesas-soc, stable
On Thu, Aug 04, 2016 at 07:59:41PM +0900, Yoshihiro Shimoda wrote:
> The USB-DMAC's interruption happens even if the CHCR.DE is not set to 1
> because CHCR.NULLE is set to 1. So, this driver should call
> usb_dmac_isr_transfer_end() if the DE bit is set to 1 only. Otherwise,
> the desc is possible to be NULL in the usb_dmac_isr_transfer_end().
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-08 8:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-04 10:59 [PATCH] dmaengine: usb-dmac: check CHCR.DE bit in usb_dmac_isr_channel() Yoshihiro Shimoda
2016-08-08 8:12 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).