usb: gadget: renesas_usbhs: move usbhs_usbreq_get/set_val() to common.c
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 11 Oct 2011 05:02:33 +0000 (22:02 -0700)
committerFelipe Balbi <balbi@ti.com>
Thu, 13 Oct 2011 17:41:40 +0000 (20:41 +0300)
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>
drivers/usb/renesas_usbhs/common.c
drivers/usb/renesas_usbhs/common.h
drivers/usb/renesas_usbhs/pipe.c
drivers/usb/renesas_usbhs/pipe.h

index 17abdfe53067b49c729e7d392d7e294cb5a11616..b327458f5cadfb2f4d58444c545f510c0eea2d8d 100644 (file)
@@ -146,6 +146,32 @@ int usbhs_frame_get_num(struct usbhs_priv *priv)
        return usbhs_read(priv, FRMNUM) & FRNM_MASK;
 }
 
+/*
+ *             usb request functions
+ */
+void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
+{
+       u16 val;
+
+       val = usbhs_read(priv, USBREQ);
+       req->bRequest           = (val >> 8) & 0xFF;
+       req->bRequestType       = (val >> 0) & 0xFF;
+
+       req->wValue     = usbhs_read(priv, USBVAL);
+       req->wIndex     = usbhs_read(priv, USBINDX);
+       req->wLength    = usbhs_read(priv, USBLENG);
+}
+
+void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
+{
+       usbhs_write(priv, USBREQ,  (req->bRequest << 8) | req->bRequestType);
+       usbhs_write(priv, USBVAL,  req->wValue);
+       usbhs_write(priv, USBINDX, req->wIndex);
+       usbhs_write(priv, USBLENG, req->wLength);
+
+       usbhs_bset(priv, DCPCTR, SUREQ, SUREQ);
+}
+
 /*
  *             bus/vbus functions
  */
index a5cef816010785e1f191285e6b07c527a0cdc488..3b233809cdaaf06a937f81ab51d354209c537c54 100644 (file)
@@ -185,6 +185,7 @@ struct usbhs_priv;
 /* PIPEnCTR */
 /* DCPCTR */
 #define BSTS           (1 << 15)       /* Buffer Status */
+#define SUREQ          (1 << 14)       /* Sending SETUP Token */
 #define CSSTS          (1 << 12)       /* CSSTS Status */
 #define SQCLR          (1 << 8)        /* Toggle Bit Clear */
 #define        ACLRM           (1 << 9)        /* Buffer Auto-Clear Mode */
@@ -259,6 +260,12 @@ void usbhs_sys_usb_ctrl(struct usbhs_priv *priv, int enable);
 void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable);
 void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable);
 
+/*
+ * usb request
+ */
+void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req);
+void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req);
+
 /*
  * bus
  */
index 18101332eb8adbbdeb7e29b1bbe5ded214f40144..6aaa4364994ecf49a741b69720f5883d4b68d760 100644 (file)
@@ -39,30 +39,6 @@ static char *usbhsp_pipe_name[] = {
        [USB_ENDPOINT_XFER_ISOC]        = "ISO",
 };
 
-/*
- *             usb request functions
- */
-void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
-{
-       u16 val;
-
-       val = usbhs_read(priv, USBREQ);
-       req->bRequest           = (val >> 8) & 0xFF;
-       req->bRequestType       = (val >> 0) & 0xFF;
-
-       req->wValue     = usbhs_read(priv, USBVAL);
-       req->wIndex     = usbhs_read(priv, USBINDX);
-       req->wLength    = usbhs_read(priv, USBLENG);
-}
-
-void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
-{
-       usbhs_write(priv, USBREQ,  (req->bRequest << 8) | req->bRequestType);
-       usbhs_write(priv, USBVAL,  req->wValue);
-       usbhs_write(priv, USBINDX, req->wIndex);
-       usbhs_write(priv, USBLENG, req->wLength);
-}
-
 /*
  *             DCPCTR/PIPEnCTR functions
  */
index fc776accb1dfddd88557d1e615f180fd9d83f744..8120fad73b2d1c6091c700f1da25c7c2077b9eb0 100644 (file)
@@ -70,12 +70,6 @@ struct usbhs_pipe_info {
  */
 #define usbhs_priv_to_pipeinfo(pr)     (&(pr)->pipe_info)
 
-/*
- * usb request
- */
-void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req);
-void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req);
-
 /*
  * pipe control
  */