aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-10-11 01:00:42 -0400
committerFelipe Balbi <balbi@ti.com>2011-10-13 13:41:32 -0400
commit7fd097e727466cda1b22beca6cb11096b8be88d2 (patch)
treeb47921653186127abf2ea24e538f2cb9fb95370f /drivers
parentf5aa889f725b56934171f9845cf00a17de9cc76c (diff)
usb: gadget: renesas_usbhs: each pipe hold maxpacket size
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/renesas_usbhs/pipe.c29
-rw-r--r--drivers/usb/renesas_usbhs/pipe.h2
2 files changed, 10 insertions, 21 deletions
diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c
index 1af19059dd02..1f86bededf88 100644
--- a/drivers/usb/renesas_usbhs/pipe.c
+++ b/drivers/usb/renesas_usbhs/pipe.c
@@ -106,17 +106,6 @@ static void __usbhsp_pipe_xxx_set(struct usbhs_pipe *pipe,
106 usbhs_bset(priv, pipe_reg, mask, val); 106 usbhs_bset(priv, pipe_reg, mask, val);
107} 107}
108 108
109static u16 __usbhsp_pipe_xxx_get(struct usbhs_pipe *pipe,
110 u16 dcp_reg, u16 pipe_reg)
111{
112 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
113
114 if (usbhs_pipe_is_dcp(pipe))
115 return usbhs_read(priv, dcp_reg);
116 else
117 return usbhs_read(priv, pipe_reg);
118}
119
120/* 109/*
121 * DCPCFG/PIPECFG functions 110 * DCPCFG/PIPECFG functions
122 */ 111 */
@@ -144,11 +133,6 @@ static void usbhsp_pipe_maxp_set(struct usbhs_pipe *pipe, u16 mask, u16 val)
144 __usbhsp_pipe_xxx_set(pipe, DCPMAXP, PIPEMAXP, mask, val); 133 __usbhsp_pipe_xxx_set(pipe, DCPMAXP, PIPEMAXP, mask, val);
145} 134}
146 135
147static u16 usbhsp_pipe_maxp_get(struct usbhs_pipe *pipe)
148{
149 return __usbhsp_pipe_xxx_get(pipe, DCPMAXP, PIPEMAXP);
150}
151
152/* 136/*
153 * pipe control functions 137 * pipe control functions
154 */ 138 */
@@ -465,6 +449,8 @@ void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 epnum, u16 maxp)
465{ 449{
466 usbhsp_pipe_barrier(pipe); 450 usbhsp_pipe_barrier(pipe);
467 451
452 pipe->maxp = maxp;
453
468 usbhsp_pipe_select(pipe); 454 usbhsp_pipe_select(pipe);
469 usbhsp_pipe_maxp_set(pipe, 0xFFFF, maxp); 455 usbhsp_pipe_maxp_set(pipe, 0xFFFF, maxp);
470 456
@@ -477,11 +463,12 @@ void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 epnum, u16 maxp)
477 */ 463 */
478int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe) 464int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe)
479{ 465{
480 u16 mask = usbhs_pipe_is_dcp(pipe) ? DCP_MAXP_MASK : PIPE_MAXP_MASK; 466 /*
481 467 * see
482 usbhsp_pipe_select(pipe); 468 * usbhs_pipe_config_update()
483 469 * usbhs_dcp_malloc()
484 return (int)(usbhsp_pipe_maxp_get(pipe) & mask); 470 */
471 return pipe->maxp;
485} 472}
486 473
487int usbhs_pipe_is_dir_in(struct usbhs_pipe *pipe) 474int usbhs_pipe_is_dir_in(struct usbhs_pipe *pipe)
diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h
index 46707b5ecb75..1baa1998c9a5 100644
--- a/drivers/usb/renesas_usbhs/pipe.h
+++ b/drivers/usb/renesas_usbhs/pipe.h
@@ -30,6 +30,8 @@ struct usbhs_pipe {
30 struct usbhs_fifo *fifo; 30 struct usbhs_fifo *fifo;
31 struct list_head list; 31 struct list_head list;
32 32
33 int maxp;
34
33 u32 flags; 35 u32 flags;
34#define USBHS_PIPE_FLAGS_IS_USED (1 << 0) 36#define USBHS_PIPE_FLAGS_IS_USED (1 << 0)
35#define USBHS_PIPE_FLAGS_IS_DIR_IN (1 << 1) 37#define USBHS_PIPE_FLAGS_IS_DIR_IN (1 << 1)