usb: renesas_usbhs: Don't check CSSTS bit if peripheral mode
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Fri, 5 Feb 2016 04:57:11 +0000 (13:57 +0900)
committerFelipe Balbi <balbi@kernel.org>
Fri, 4 Mar 2016 13:14:28 +0000 (15:14 +0200)
Since Some SoCs (e.g. R-Car Gen2) don't have the CSSTS bit in the
pipectrl registers ({DCP,PIPEn}CTR) because such SoCs have peripheral
mode only. So, this driver should not check the CSSTS bit if peripheral
mode is running.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/renesas_usbhs/pipe.c

index 0e95d2925dc58f20b30d0b5e0ba9756ea86a1a0d..78e9dba701c495bea8b6455ea52ae03677d803ac 100644 (file)
@@ -241,7 +241,7 @@ static int usbhsp_pipe_barrier(struct usbhs_pipe *pipe)
 {
        struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
        int timeout = 1024;
-       u16 val;
+       u16 mask = usbhs_mod_is_host(priv) ? (CSSTS | PID_MASK) : PID_MASK;
 
        /*
         * make sure....
@@ -265,9 +265,7 @@ static int usbhsp_pipe_barrier(struct usbhs_pipe *pipe)
        usbhs_pipe_disable(pipe);
 
        do {
-               val  = usbhsp_pipectrl_get(pipe);
-               val &= CSSTS | PID_MASK;
-               if (!val)
+               if (!(usbhsp_pipectrl_get(pipe) & mask))
                        return 0;
 
                udelay(10);