]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: gadget: renesas_usbhs: each pipe hold maxpacket size
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 11 Oct 2011 05:00:42 +0000 (22:00 -0700)
committerFelipe Balbi <balbi@ti.com>
Thu, 13 Oct 2011 17:41:32 +0000 (20:41 +0300)
Current renesas_usbhs pipe accessed DCPMAXP/PIPEMAXP register
to get own maxpacket size every time.
But maxpacket size isn't changed after pipe start,
and register access is too slow.

This patch adds new maxp variable to keep own maxpacket.
And un-used function are removed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/renesas_usbhs/pipe.c
drivers/usb/renesas_usbhs/pipe.h

index 1af19059dd02ed29b624d77ac854093be3add68c..1f86bededf8861e01c0a6712777a128e285bb42b 100644 (file)
@@ -106,17 +106,6 @@ static void __usbhsp_pipe_xxx_set(struct usbhs_pipe *pipe,
                usbhs_bset(priv, pipe_reg, mask, val);
 }
 
-static u16 __usbhsp_pipe_xxx_get(struct usbhs_pipe *pipe,
-                                u16 dcp_reg, u16 pipe_reg)
-{
-       struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
-
-       if (usbhs_pipe_is_dcp(pipe))
-               return usbhs_read(priv, dcp_reg);
-       else
-               return usbhs_read(priv, pipe_reg);
-}
-
 /*
  *             DCPCFG/PIPECFG functions
  */
@@ -144,11 +133,6 @@ static void usbhsp_pipe_maxp_set(struct usbhs_pipe *pipe, u16 mask, u16 val)
        __usbhsp_pipe_xxx_set(pipe, DCPMAXP, PIPEMAXP, mask, val);
 }
 
-static u16 usbhsp_pipe_maxp_get(struct usbhs_pipe *pipe)
-{
-       return __usbhsp_pipe_xxx_get(pipe, DCPMAXP, PIPEMAXP);
-}
-
 /*
  *             pipe control functions
  */
@@ -465,6 +449,8 @@ void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 epnum, u16 maxp)
 {
        usbhsp_pipe_barrier(pipe);
 
+       pipe->maxp = maxp;
+
        usbhsp_pipe_select(pipe);
        usbhsp_pipe_maxp_set(pipe, 0xFFFF, maxp);
 
@@ -477,11 +463,12 @@ void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 epnum, u16 maxp)
  */
 int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe)
 {
-       u16 mask = usbhs_pipe_is_dcp(pipe) ? DCP_MAXP_MASK : PIPE_MAXP_MASK;
-
-       usbhsp_pipe_select(pipe);
-
-       return (int)(usbhsp_pipe_maxp_get(pipe) & mask);
+       /*
+        * see
+        *      usbhs_pipe_config_update()
+        *      usbhs_dcp_malloc()
+        */
+       return pipe->maxp;
 }
 
 int usbhs_pipe_is_dir_in(struct usbhs_pipe *pipe)
index 46707b5ecb75feedb3b5fa8e119e2133856444f8..1baa1998c9a5ebeb061f8f2ff65b294358d339da 100644 (file)
@@ -30,6 +30,8 @@ struct usbhs_pipe {
        struct usbhs_fifo *fifo;
        struct list_head list;
 
+       int maxp;
+
        u32 flags;
 #define USBHS_PIPE_FLAGS_IS_USED               (1 << 0)
 #define USBHS_PIPE_FLAGS_IS_DIR_IN             (1 << 1)