Skip to contentSkip to conversation

Patch "usb: renesas_usbhs: fix clearing the {BRDY,BEMP}STS condition" has been added to the 4.7-stable tree

PATCH [email protected] 1 participant 1 message Sep 22, 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

usb: renesas_usbhs: fix clearing the {BRDY,BEMP}STS condition

to the 4.7-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:
usb-renesas_usbhs-fix-clearing-the-brdy-bemp-sts-condition.patch
and it can be found in the queue-4.7 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 519d8bd4b5d3d82c413eac5bb42b106bb4b9ec15 Mon Sep 17 00:00:00 2001

From: Yoshihiro Shimoda <[email protected]>
Date: Mon, 29 Aug 2016 18:00:38 +0900
Subject: usb: renesas_usbhs: fix clearing the {BRDY,BEMP}STS condition

From: Yoshihiro Shimoda <[email protected]>

commit 519d8bd4b5d3d82c413eac5bb42b106bb4b9ec15 upstream.

The previous driver is possible to stop the transfer wrongly. For example:
1) An interrupt happens, but not BRDY interruption.
2) Read INTSTS0. And than state->intsts0 is not set to BRDY.
3) BRDY is set to 1 here.
4) Read BRDYSTS.
5) Clear the BRDYSTS. And then. the BRDY is cleared wrongly.

Remarks:
- The INTSTS0.BRDY is read only.
- If any bits of BRDYSTS are set to 1, the BRDY is set to 1.
- If BRDYSTS is 0, the BRDY is set to 0.

So, this patch adds condition to avoid such situation. (And about NRDYSTS, this is not used for now. But, avoiding any side effects, this patch doesn't touch it.)

Fixes d5c6a1e024dd ("usb: renesas_usbhs: fixup interrupt status clear method")
---
 drivers/usb/renesas_usbhs/mod.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/usb/renesas_usbhs/mod.c +9 -2
@@ -282,9 +282,16 @@ static irqreturn_t usbhs_interrupt(int i
 	if (usbhs_mod_is_host(priv))
 		usbhs_write(priv, INTSTS1, ~irq_state.intsts1 & INTSTS1_MAGIC);
 
-	usbhs_write(priv, BRDYSTS, ~irq_state.brdysts);
+	/*
+	 * The driver should not clear the xxxSTS after the line of
+	 * "call irq callback functions" because each "if" statement is
+	 * possible to call the callback function for avoiding any side effects.
+	 */
+	if (irq_state.intsts0 & BRDY)
+		usbhs_write(priv, BRDYSTS, ~irq_state.brdysts);
 	usbhs_write(priv, NRDYSTS, ~irq_state.nrdysts);
-	usbhs_write(priv, BEMPSTS, ~irq_state.bempsts);
+	if (irq_state.intsts0 & BEMP)
+		usbhs_write(priv, BEMPSTS, ~irq_state.bempsts);
 
 	/*
 	 * call irq callback functions

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

queue-4.7/usb-gadget-udc-renesas-usb3-clear-vbout-bit-in-drd_con.patch queue-4.7/usb-renesas_usbhs-fix-clearing-the-brdy-bemp-sts-condition.patch