aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-11-24 20:28:35 -0500
committerFelipe Balbi <balbi@ti.com>2011-12-12 04:45:20 -0500
commitdfbb7f4fba47153de4be9ed6092804ebfd16bfbb (patch)
treecb47162177ef2c2916f50a7e46ec500f49b5e807
parent91b158f4d11164bfe5710873c8e162cf8c8d132b (diff)
usb: renesas_usbhs: add test-mode support
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/renesas_usbhs/common.c5
-rw-r--r--drivers/usb/renesas_usbhs/common.h2
-rw-r--r--drivers/usb/renesas_usbhs/mod_gadget.c22
3 files changed, 28 insertions, 1 deletions
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 016a34f58523..32a879fb0e36 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -132,6 +132,11 @@ void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable)
132 usbhs_bset(priv, SYSCFG, mask, enable ? val : 0); 132 usbhs_bset(priv, SYSCFG, mask, enable ? val : 0);
133} 133}
134 134
135void usbhs_sys_set_test_mode(struct usbhs_priv *priv, u16 mode)
136{
137 usbhs_write(priv, TESTMODE, mode);
138}
139
135/* 140/*
136 * frame functions 141 * frame functions
137 */ 142 */
diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h
index 71c295c76d9e..d79b3e27db95 100644
--- a/drivers/usb/renesas_usbhs/common.h
+++ b/drivers/usb/renesas_usbhs/common.h
@@ -33,6 +33,7 @@ struct usbhs_priv;
33#define SYSCFG 0x0000 33#define SYSCFG 0x0000
34#define BUSWAIT 0x0002 34#define BUSWAIT 0x0002
35#define DVSTCTR 0x0008 35#define DVSTCTR 0x0008
36#define TESTMODE 0x000C
36#define CFIFO 0x0014 37#define CFIFO 0x0014
37#define CFIFOSEL 0x0020 38#define CFIFOSEL 0x0020
38#define CFIFOCTR 0x0022 39#define CFIFOCTR 0x0022
@@ -283,6 +284,7 @@ void usbhs_bset(struct usbhs_priv *priv, u32 reg, u16 mask, u16 data);
283 */ 284 */
284void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable); 285void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable);
285void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable); 286void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable);
287void usbhs_sys_set_test_mode(struct usbhs_priv *priv, u16 mode);
286 288
287/* 289/*
288 * usb request 290 * usb request
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index dba15e07fbd2..1951de02957e 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -14,6 +14,7 @@
14 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 14 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * 15 *
16 */ 16 */
17#include <linux/delay.h>
17#include <linux/dma-mapping.h> 18#include <linux/dma-mapping.h>
18#include <linux/io.h> 19#include <linux/io.h>
19#include <linux/module.h> 20#include <linux/module.h>
@@ -286,6 +287,24 @@ struct usbhsg_recip_handle req_clear_feature = {
286/* 287/*
287 * USB_TYPE_STANDARD / set feature functions 288 * USB_TYPE_STANDARD / set feature functions
288 */ 289 */
290static int usbhsg_recip_handler_std_set_device(struct usbhs_priv *priv,
291 struct usbhsg_uep *uep,
292 struct usb_ctrlrequest *ctrl)
293{
294 switch (le16_to_cpu(ctrl->wValue)) {
295 case USB_DEVICE_TEST_MODE:
296 usbhsg_recip_handler_std_control_done(priv, uep, ctrl);
297 udelay(100);
298 usbhs_sys_set_test_mode(priv, le16_to_cpu(ctrl->wIndex >> 8));
299 break;
300 default:
301 usbhsg_recip_handler_std_control_done(priv, uep, ctrl);
302 break;
303 }
304
305 return 0;
306}
307
289static int usbhsg_recip_handler_std_set_endpoint(struct usbhs_priv *priv, 308static int usbhsg_recip_handler_std_set_endpoint(struct usbhs_priv *priv,
290 struct usbhsg_uep *uep, 309 struct usbhsg_uep *uep,
291 struct usb_ctrlrequest *ctrl) 310 struct usb_ctrlrequest *ctrl)
@@ -301,7 +320,7 @@ static int usbhsg_recip_handler_std_set_endpoint(struct usbhs_priv *priv,
301 320
302struct usbhsg_recip_handle req_set_feature = { 321struct usbhsg_recip_handle req_set_feature = {
303 .name = "set feature", 322 .name = "set feature",
304 .device = usbhsg_recip_handler_std_control_done, 323 .device = usbhsg_recip_handler_std_set_device,
305 .interface = usbhsg_recip_handler_std_control_done, 324 .interface = usbhsg_recip_handler_std_control_done,
306 .endpoint = usbhsg_recip_handler_std_set_endpoint, 325 .endpoint = usbhsg_recip_handler_std_set_endpoint,
307}; 326};
@@ -849,6 +868,7 @@ static int usbhsg_try_stop(struct usbhs_priv *priv, u32 status)
849 gpriv->gadget.speed = USB_SPEED_UNKNOWN; 868 gpriv->gadget.speed = USB_SPEED_UNKNOWN;
850 869
851 /* disable sys */ 870 /* disable sys */
871 usbhs_sys_set_test_mode(priv, 0);
852 usbhs_sys_function_ctrl(priv, 0); 872 usbhs_sys_function_ctrl(priv, 0);
853 873
854 usbhsg_pipe_disable(dcp); 874 usbhsg_pipe_disable(dcp);