Skip to content

Commit 519d8bd

Browse files
shimodayFelipe Balbi
authored andcommitted
usb: renesas_usbhs: fix clearing the {BRDY,BEMP}STS condition
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: d5c6a1e ("usb: renesas_usbhs: fixup interrupt status clear method") Cc: <[email protected]> # v3.8+ Signed-off-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 7c113f7 commit 519d8bd

File tree

1 file changed

+9
-2
lines changed
  • drivers/usb/renesas_usbhs

1 file changed

+9
-2
lines changed

drivers/usb/renesas_usbhs/mod.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,16 @@ static irqreturn_t usbhs_interrupt(int irq, void *data)
282282
if (usbhs_mod_is_host(priv))
283283
usbhs_write(priv, INTSTS1, ~irq_state.intsts1 & INTSTS1_MAGIC);
284284

285-
usbhs_write(priv, BRDYSTS, ~irq_state.brdysts);
285+
/*
286+
* The driver should not clear the xxxSTS after the line of
287+
* "call irq callback functions" because each "if" statement is
288+
* possible to call the callback function for avoiding any side effects.
289+
*/
290+
if (irq_state.intsts0 & BRDY)
291+
usbhs_write(priv, BRDYSTS, ~irq_state.brdysts);
286292
usbhs_write(priv, NRDYSTS, ~irq_state.nrdysts);
287-
usbhs_write(priv, BEMPSTS, ~irq_state.bempsts);
293+
if (irq_state.intsts0 & BEMP)
294+
usbhs_write(priv, BEMPSTS, ~irq_state.bempsts);
288295

289296
/*
290297
* call irq callback functions

0 commit comments

Comments
 (0)