From b86dafbfa2880c0db6ded195f9a6c9c37f303d9c Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 11 May 2011 16:00:09 +0900 Subject: [PATCH] --- yaml --- r: 248855 b: refs/heads/master c: c786e09c35924252ff219241e7027e340b77252d h: refs/heads/master i: 248853: 8a1444eb5260aecca8d456a3e67956154d462d9f 248851: 751fdd368e7cd813943d4cb9bce2018cc8befb24 248847: a4ad25f70129a7372ef64d7982664c0cba19b58f v: v3 --- [refs] | 2 +- trunk/drivers/usb/renesas_usbhs/pipe.c | 29 ++++++++++++-------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index c4120de14aea..efd281084376 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fd5054c169d29747a44b4e1419ff47f57ae82dbc +refs/heads/master: c786e09c35924252ff219241e7027e340b77252d diff --git a/trunk/drivers/usb/renesas_usbhs/pipe.c b/trunk/drivers/usb/renesas_usbhs/pipe.c index 5897ddad05f2..bc4521c54261 100644 --- a/trunk/drivers/usb/renesas_usbhs/pipe.c +++ b/trunk/drivers/usb/renesas_usbhs/pipe.c @@ -183,7 +183,6 @@ static void usbhsp_pipe_select(struct usbhs_pipe *pipe) static int usbhsp_pipe_barrier(struct usbhs_pipe *pipe) { struct usbhs_priv *priv = usbhsp_pipe_to_priv(pipe); - struct device *dev = usbhs_priv_to_dev(priv); int timeout = 1024; u16 val; @@ -206,6 +205,7 @@ static int usbhsp_pipe_barrier(struct usbhs_pipe *pipe) * - "Pipe Control Registers Switching Procedure" */ usbhs_write(priv, CFIFOSEL, 0); + usbhs_fifo_disable(pipe); do { val = usbhsp_pipectrl_get(pipe); @@ -217,21 +217,6 @@ static int usbhsp_pipe_barrier(struct usbhs_pipe *pipe) } while (timeout--); - /* - * force NAK - */ - timeout = 1024; - usbhs_fifo_disable(pipe); - do { - val = usbhsp_pipectrl_get(pipe); - val &= PBUSY; - if (!val) - return 0; - - } while (timeout--); - - dev_err(dev, "pipe barrier failed\n"); - return -EBUSY; } @@ -270,10 +255,22 @@ static void __usbhsp_pid_try_nak_if_stall(struct usbhs_pipe *pipe) void usbhs_fifo_disable(struct usbhs_pipe *pipe) { + int timeout = 1024; + u16 val; + /* see "Pipe n Control Register" - "PID" */ __usbhsp_pid_try_nak_if_stall(pipe); usbhsp_pipectrl_set(pipe, PID_MASK, PID_NAK); + + do { + val = usbhsp_pipectrl_get(pipe); + val &= PBUSY; + if (!val) + break; + + udelay(10); + } while (timeout--); } void usbhs_fifo_enable(struct usbhs_pipe *pipe)