aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2014-08-22 07:14:00 -0400
committerFelipe Balbi <balbi@ti.com>2014-09-03 10:15:57 -0400
commitc4d8199ba1a7aa390b06db23f4532e2c1875aefb (patch)
treef000d2f2726c08aa09c560a7131cb4270f5b1997 /drivers/usb
parent8355b2b3082d302091506703d2e4e239f7deed7f (diff)
usb: renesas_usbhs: protect mod->irq_{bemp,brdy}sts by spin lock
This patch protects the mod->irq_bempsts and mod->irq_brdysts by spin lock in the usbhs_status_get_each_irq() because other functions will write them during spin lock. Otherwise, the driver will clears the BRDYSTS and/or BEMPSTS wrongly, and then, the transaction will not finish. Also since the driver should use the INTSTS0 and BRDYSTS and BEMPSTS as the same timing, the patch protects them. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/renesas_usbhs/mod.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c
index 6a030b931a3b..9a705b15b3a1 100644
--- a/drivers/usb/renesas_usbhs/mod.c
+++ b/drivers/usb/renesas_usbhs/mod.c
@@ -213,7 +213,10 @@ static int usbhs_status_get_each_irq(struct usbhs_priv *priv,
213{ 213{
214 struct usbhs_mod *mod = usbhs_mod_get_current(priv); 214 struct usbhs_mod *mod = usbhs_mod_get_current(priv);
215 u16 intenb0, intenb1; 215 u16 intenb0, intenb1;
216 unsigned long flags;
216 217
218 /******************** spin lock ********************/
219 usbhs_lock(priv, flags);
217 state->intsts0 = usbhs_read(priv, INTSTS0); 220 state->intsts0 = usbhs_read(priv, INTSTS0);
218 state->intsts1 = usbhs_read(priv, INTSTS1); 221 state->intsts1 = usbhs_read(priv, INTSTS1);
219 222
@@ -229,6 +232,8 @@ static int usbhs_status_get_each_irq(struct usbhs_priv *priv,
229 state->bempsts &= mod->irq_bempsts; 232 state->bempsts &= mod->irq_bempsts;
230 state->brdysts &= mod->irq_brdysts; 233 state->brdysts &= mod->irq_brdysts;
231 } 234 }
235 usbhs_unlock(priv, flags);
236 /******************** spin unlock ******************/
232 237
233 /* 238 /*
234 * Check whether the irq enable registers and the irq status are set 239 * Check whether the irq enable registers and the irq status are set