aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-05-11 03:00:09 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-05-11 18:17:01 -0400
commitc786e09c35924252ff219241e7027e340b77252d (patch)
tree0c72f99272e303024d8a3ea2b3592c5f777f39a8 /drivers
parentfd5054c169d29747a44b4e1419ff47f57ae82dbc (diff)
usb: renesas_usbhs: fixup fifo disable
It was necessary to check pipe condition after disable fifo. Current driver checked it in a wrong place. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/renesas_usbhs/pipe.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c
index 5897ddad05f2..bc4521c54261 100644
--- a/drivers/usb/renesas_usbhs/pipe.c
+++ b/drivers/usb/renesas_usbhs/pipe.c
@@ -183,7 +183,6 @@ static void usbhsp_pipe_select(struct usbhs_pipe *pipe)
183static int usbhsp_pipe_barrier(struct usbhs_pipe *pipe) 183static int usbhsp_pipe_barrier(struct usbhs_pipe *pipe)
184{ 184{
185 struct usbhs_priv *priv = usbhsp_pipe_to_priv(pipe); 185 struct usbhs_priv *priv = usbhsp_pipe_to_priv(pipe);
186 struct device *dev = usbhs_priv_to_dev(priv);
187 int timeout = 1024; 186 int timeout = 1024;
188 u16 val; 187 u16 val;
189 188
@@ -206,6 +205,7 @@ static int usbhsp_pipe_barrier(struct usbhs_pipe *pipe)
206 * - "Pipe Control Registers Switching Procedure" 205 * - "Pipe Control Registers Switching Procedure"
207 */ 206 */
208 usbhs_write(priv, CFIFOSEL, 0); 207 usbhs_write(priv, CFIFOSEL, 0);
208 usbhs_fifo_disable(pipe);
209 209
210 do { 210 do {
211 val = usbhsp_pipectrl_get(pipe); 211 val = usbhsp_pipectrl_get(pipe);
@@ -217,21 +217,6 @@ static int usbhsp_pipe_barrier(struct usbhs_pipe *pipe)
217 217
218 } while (timeout--); 218 } while (timeout--);
219 219
220 /*
221 * force NAK
222 */
223 timeout = 1024;
224 usbhs_fifo_disable(pipe);
225 do {
226 val = usbhsp_pipectrl_get(pipe);
227 val &= PBUSY;
228 if (!val)
229 return 0;
230
231 } while (timeout--);
232
233 dev_err(dev, "pipe barrier failed\n");
234
235 return -EBUSY; 220 return -EBUSY;
236} 221}
237 222
@@ -270,10 +255,22 @@ static void __usbhsp_pid_try_nak_if_stall(struct usbhs_pipe *pipe)
270 255
271void usbhs_fifo_disable(struct usbhs_pipe *pipe) 256void usbhs_fifo_disable(struct usbhs_pipe *pipe)
272{ 257{
258 int timeout = 1024;
259 u16 val;
260
273 /* see "Pipe n Control Register" - "PID" */ 261 /* see "Pipe n Control Register" - "PID" */
274 __usbhsp_pid_try_nak_if_stall(pipe); 262 __usbhsp_pid_try_nak_if_stall(pipe);
275 263
276 usbhsp_pipectrl_set(pipe, PID_MASK, PID_NAK); 264 usbhsp_pipectrl_set(pipe, PID_MASK, PID_NAK);
265
266 do {
267 val = usbhsp_pipectrl_get(pipe);
268 val &= PBUSY;
269 if (!val)
270 break;
271
272 udelay(10);
273 } while (timeout--);
277} 274}
278 275
279void usbhs_fifo_enable(struct usbhs_pipe *pipe) 276void usbhs_fifo_enable(struct usbhs_pipe *pipe)