aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/m66592-udc.c
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2011-07-08 01:51:33 -0400
committerFelipe Balbi <balbi@ti.com>2011-07-08 05:47:47 -0400
commitceaa0a6eeadfd2f53df121210d99a1f80ee7645e (patch)
tree4344c43a56c828a83a775948bb90cc688fd90434 /drivers/usb/gadget/m66592-udc.c
parent5154e9f126c1d2ee8f5f93d9954f83d82b2d5e64 (diff)
usb: gadget: m66592-udc: add support for TEST_MODE
The USB high speed device must support the TEST_MODE, but the driver didn't support it. When we sent the SET_FEATURE for TEST_MODE to the driver, the request was successful, but the module didn't enter the TEST_MODE. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/m66592-udc.c')
-rw-r--r--drivers/usb/gadget/m66592-udc.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index dd9f460a7ef4..40c2f7a4f8fb 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -691,6 +691,7 @@ static void init_controller(struct m66592 *m66592)
691 691
692static void disable_controller(struct m66592 *m66592) 692static void disable_controller(struct m66592 *m66592)
693{ 693{
694 m66592_bclr(m66592, M66592_UTST, M66592_TESTMODE);
694 if (!m66592->pdata->on_chip) { 695 if (!m66592->pdata->on_chip) {
695 m66592_bclr(m66592, M66592_SCKE, M66592_SYSCFG); 696 m66592_bclr(m66592, M66592_SCKE, M66592_SYSCFG);
696 udelay(1); 697 udelay(1);
@@ -1048,10 +1049,30 @@ static void clear_feature(struct m66592 *m66592, struct usb_ctrlrequest *ctrl)
1048 1049
1049static void set_feature(struct m66592 *m66592, struct usb_ctrlrequest *ctrl) 1050static void set_feature(struct m66592 *m66592, struct usb_ctrlrequest *ctrl)
1050{ 1051{
1052 u16 tmp;
1053 int timeout = 3000;
1051 1054
1052 switch (ctrl->bRequestType & USB_RECIP_MASK) { 1055 switch (ctrl->bRequestType & USB_RECIP_MASK) {
1053 case USB_RECIP_DEVICE: 1056 case USB_RECIP_DEVICE:
1054 control_end(m66592, 1); 1057 switch (le16_to_cpu(ctrl->wValue)) {
1058 case USB_DEVICE_TEST_MODE:
1059 control_end(m66592, 1);
1060 /* Wait for the completion of status stage */
1061 do {
1062 tmp = m66592_read(m66592, M66592_INTSTS0) &
1063 M66592_CTSQ;
1064 udelay(1);
1065 } while (tmp != M66592_CS_IDST || timeout-- > 0);
1066
1067 if (tmp == M66592_CS_IDST)
1068 m66592_bset(m66592,
1069 le16_to_cpu(ctrl->wIndex >> 8),
1070 M66592_TESTMODE);
1071 break;
1072 default:
1073 pipe_stall(m66592, 0);
1074 break;
1075 }
1055 break; 1076 break;
1056 case USB_RECIP_INTERFACE: 1077 case USB_RECIP_INTERFACE:
1057 control_end(m66592, 1); 1078 control_end(m66592, 1);