Skip to contentSkip to conversation

Patch "dmaengine: usb-dmac: check CHCR.DE bit in usb_dmac_isr_channel()" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Sep 5, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

dmaengine: usb-dmac: check CHCR.DE bit in usb_dmac_isr_channel()

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
dmaengine-usb-dmac-check-chcr.de-bit-in-usb_dmac_isr_channel.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 626d2f07de89bf6be3d7301524d0ab3375b81b9c Mon Sep 17 00:00:00 2001

From: Yoshihiro Shimoda <[email protected]>
Date: Thu, 4 Aug 2016 19:59:41 +0900
Subject: dmaengine: usb-dmac: check CHCR.DE bit in usb_dmac_isr_channel()

From: Yoshihiro Shimoda <[email protected]>

commit 626d2f07de89bf6be3d7301524d0ab3375b81b9c upstream.

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)
---
 drivers/dma/sh/usb-dmac.c |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/dma/sh/usb-dmac.c +11 -8
@@ -600,27 +600,30 @@ static irqreturn_t usb_dmac_isr_channel(
 {
 	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);
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/usb-renesas_usbhs-clear-the-brdysts-in-usbhsg_ep_enable.patch queue-4.4/dmaengine-usb-dmac-check-chcr.de-bit-in-usb_dmac_isr_channel.patch queue-4.4/usb-renesas_usbhs-use-dmac-only-if-the-pipe-type-is-bulk.patch queue-4.4/usb-renesas_usbhs-gadget-fix-return-value-check-in-usbhs_mod_gadget_probe.patch