]> Pileus Git - ~andy/linux/commitdiff
usb: renesas_usbhs: fixup connection fail
authorKuninori Morimoto <morimoto.kuninori@renesas.com>
Thu, 9 Jun 2011 07:48:25 +0000 (16:48 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 14 Jun 2011 21:23:23 +0000 (14:23 -0700)
Sometimes the connection fail happen on renesas_usbhs.
This patch fix it up.

Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/renesas_usbhs/mod_gadget.c
drivers/usb/renesas_usbhs/pipe.c
drivers/usb/renesas_usbhs/pipe.h

index 46e247ad14f34497e13c2b4007d28e99c256a9f0..aa591b663835cec66469f86d10e244d32e605c7b 100644 (file)
@@ -462,8 +462,11 @@ static int usbhsg_ep_enable(struct usb_ep *ep,
         * if it already have pipe,
         * nothing to do
         */
-       if (uep->pipe)
+       if (uep->pipe) {
+               usbhs_pipe_clear(uep->pipe);
+               usbhs_pipe_clear_sequence(uep->pipe);
                return 0;
+       }
 
        pipe = usbhs_pipe_malloc(priv, desc);
        if (pipe) {
index d0ae846632cdd48218df45a90d88cbe87202ba80..1b14cae45704e545f93e1e3073cb4b56404f353e 100644 (file)
@@ -500,6 +500,12 @@ void usbhs_pipe_clear_sequence(struct usbhs_pipe *pipe)
        usbhsp_pipectrl_set(pipe, SQCLR, SQCLR);
 }
 
+void usbhs_pipe_clear(struct usbhs_pipe *pipe)
+{
+       usbhsp_pipectrl_set(pipe, ACLRM, ACLRM);
+       usbhsp_pipectrl_set(pipe, ACLRM, 0);
+}
+
 static struct usbhs_pipe *usbhsp_get_pipe(struct usbhs_priv *priv, u32 type)
 {
        struct usbhs_pipe *pos, *pipe;
@@ -568,8 +574,7 @@ void usbhs_pipe_init(struct usbhs_priv *priv,
                INIT_LIST_HEAD(&pipe->list);
 
                /* pipe force init */
-               usbhsp_pipectrl_set(pipe, ACLRM, ACLRM);
-               usbhsp_pipectrl_set(pipe, ACLRM, 0);
+               usbhs_pipe_clear(pipe);
        }
 
        info->done = done;
index 35e100477e55c3622eeed1e4dc57600a707de340..41534cb0e73408ffb337b56ab491e508c9dae132 100644 (file)
@@ -87,6 +87,7 @@ void usbhs_pipe_init(struct usbhs_priv *priv,
                     int (*dma_map_ctrl)(struct usbhs_pkt *pkt, int map));
 int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe);
 void usbhs_pipe_clear_sequence(struct usbhs_pipe *pipe);
+void usbhs_pipe_clear(struct usbhs_pipe *pipe);
 int usbhs_pipe_is_accessible(struct usbhs_pipe *pipe);
 void usbhs_pipe_enable(struct usbhs_pipe *pipe);
 void usbhs_pipe_disable(struct usbhs_pipe *pipe);