diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-11-24 20:28:35 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-12-12 04:45:20 -0500 |
commit | dfbb7f4fba47153de4be9ed6092804ebfd16bfbb (patch) | |
tree | cb47162177ef2c2916f50a7e46ec500f49b5e807 /drivers/usb/renesas_usbhs/mod_gadget.c | |
parent | 91b158f4d11164bfe5710873c8e162cf8c8d132b (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>
Diffstat (limited to 'drivers/usb/renesas_usbhs/mod_gadget.c')
-rw-r--r-- | drivers/usb/renesas_usbhs/mod_gadget.c | 22 |
1 files changed, 21 insertions, 1 deletions
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 | */ |
290 | static 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 | |||
289 | static int usbhsg_recip_handler_std_set_endpoint(struct usbhs_priv *priv, | 308 | static 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 | ||
302 | struct usbhsg_recip_handle req_set_feature = { | 321 | struct 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); |