aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-10-11 01:02:33 -0400
committerFelipe Balbi <balbi@ti.com>2011-10-13 13:41:40 -0400
commitef8bedb9048c293dfa85ac36482a1970646a8272 (patch)
treed20426f584ee7854fd4061a768249e7ac35a1bcc /drivers/usb/renesas_usbhs
parent356db7edadb98edbc60abf46b86a1816bfee6278 (diff)
usb: gadget: renesas_usbhs: move usbhs_usbreq_get/set_val() to common.c
usbhs_usbreq_get/set_val() functions were in pipe.c file, but it is irrelevant to pipe. this patch move it to common.c Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/renesas_usbhs')
-rw-r--r--drivers/usb/renesas_usbhs/common.c26
-rw-r--r--drivers/usb/renesas_usbhs/common.h7
-rw-r--r--drivers/usb/renesas_usbhs/pipe.c24
-rw-r--r--drivers/usb/renesas_usbhs/pipe.h6
4 files changed, 33 insertions, 30 deletions
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 17abdfe53067..b327458f5cad 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -147,6 +147,32 @@ int usbhs_frame_get_num(struct usbhs_priv *priv)
147} 147}
148 148
149/* 149/*
150 * usb request functions
151 */
152void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
153{
154 u16 val;
155
156 val = usbhs_read(priv, USBREQ);
157 req->bRequest = (val >> 8) & 0xFF;
158 req->bRequestType = (val >> 0) & 0xFF;
159
160 req->wValue = usbhs_read(priv, USBVAL);
161 req->wIndex = usbhs_read(priv, USBINDX);
162 req->wLength = usbhs_read(priv, USBLENG);
163}
164
165void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
166{
167 usbhs_write(priv, USBREQ, (req->bRequest << 8) | req->bRequestType);
168 usbhs_write(priv, USBVAL, req->wValue);
169 usbhs_write(priv, USBINDX, req->wIndex);
170 usbhs_write(priv, USBLENG, req->wLength);
171
172 usbhs_bset(priv, DCPCTR, SUREQ, SUREQ);
173}
174
175/*
150 * bus/vbus functions 176 * bus/vbus functions
151 */ 177 */
152void usbhs_bus_send_sof_enable(struct usbhs_priv *priv) 178void usbhs_bus_send_sof_enable(struct usbhs_priv *priv)
diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h
index a5cef8160107..3b233809cdaa 100644
--- a/drivers/usb/renesas_usbhs/common.h
+++ b/drivers/usb/renesas_usbhs/common.h
@@ -185,6 +185,7 @@ struct usbhs_priv;
185/* PIPEnCTR */ 185/* PIPEnCTR */
186/* DCPCTR */ 186/* DCPCTR */
187#define BSTS (1 << 15) /* Buffer Status */ 187#define BSTS (1 << 15) /* Buffer Status */
188#define SUREQ (1 << 14) /* Sending SETUP Token */
188#define CSSTS (1 << 12) /* CSSTS Status */ 189#define CSSTS (1 << 12) /* CSSTS Status */
189#define SQCLR (1 << 8) /* Toggle Bit Clear */ 190#define SQCLR (1 << 8) /* Toggle Bit Clear */
190#define ACLRM (1 << 9) /* Buffer Auto-Clear Mode */ 191#define ACLRM (1 << 9) /* Buffer Auto-Clear Mode */
@@ -260,6 +261,12 @@ void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable);
260void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable); 261void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable);
261 262
262/* 263/*
264 * usb request
265 */
266void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req);
267void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req);
268
269/*
263 * bus 270 * bus
264 */ 271 */
265void usbhs_bus_send_sof_enable(struct usbhs_priv *priv); 272void usbhs_bus_send_sof_enable(struct usbhs_priv *priv);
diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c
index 18101332eb8a..6aaa4364994e 100644
--- a/drivers/usb/renesas_usbhs/pipe.c
+++ b/drivers/usb/renesas_usbhs/pipe.c
@@ -40,30 +40,6 @@ static char *usbhsp_pipe_name[] = {
40}; 40};
41 41
42/* 42/*
43 * usb request functions
44 */
45void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
46{
47 u16 val;
48
49 val = usbhs_read(priv, USBREQ);
50 req->bRequest = (val >> 8) & 0xFF;
51 req->bRequestType = (val >> 0) & 0xFF;
52
53 req->wValue = usbhs_read(priv, USBVAL);
54 req->wIndex = usbhs_read(priv, USBINDX);
55 req->wLength = usbhs_read(priv, USBLENG);
56}
57
58void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
59{
60 usbhs_write(priv, USBREQ, (req->bRequest << 8) | req->bRequestType);
61 usbhs_write(priv, USBVAL, req->wValue);
62 usbhs_write(priv, USBINDX, req->wIndex);
63 usbhs_write(priv, USBLENG, req->wLength);
64}
65
66/*
67 * DCPCTR/PIPEnCTR functions 43 * DCPCTR/PIPEnCTR functions
68 */ 44 */
69static void usbhsp_pipectrl_set(struct usbhs_pipe *pipe, u16 mask, u16 val) 45static void usbhsp_pipectrl_set(struct usbhs_pipe *pipe, u16 mask, u16 val)
diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h
index fc776accb1df..8120fad73b2d 100644
--- a/drivers/usb/renesas_usbhs/pipe.h
+++ b/drivers/usb/renesas_usbhs/pipe.h
@@ -71,12 +71,6 @@ struct usbhs_pipe_info {
71#define usbhs_priv_to_pipeinfo(pr) (&(pr)->pipe_info) 71#define usbhs_priv_to_pipeinfo(pr) (&(pr)->pipe_info)
72 72
73/* 73/*
74 * usb request
75 */
76void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req);
77void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req);
78
79/*
80 * pipe control 74 * pipe control
81 */ 75 */
82struct usbhs_pipe 76struct usbhs_pipe