aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2011-07-08 01:51:14 -0400
committerFelipe Balbi <balbi@ti.com>2011-07-08 05:50:57 -0400
commit96fe53ef5498ba130b2f054f2de38e090ddaa55f (patch)
tree58d849f4a6e477103fc10db6d80f2db62b9f8e5b /drivers/usb
parentceaa0a6eeadfd2f53df121210d99a1f80ee7645e (diff)
usb: gadget: r8a66597-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')
-rw-r--r--drivers/usb/gadget/r8a66597-udc.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index 834a0202ae3f..b8b30059f8af 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -622,6 +622,7 @@ static void disable_controller(struct r8a66597 *r8a66597)
622{ 622{
623 if (r8a66597->pdata->on_chip) { 623 if (r8a66597->pdata->on_chip) {
624 r8a66597_bset(r8a66597, SCKE, SYSCFG0); 624 r8a66597_bset(r8a66597, SCKE, SYSCFG0);
625 r8a66597_bclr(r8a66597, UTST, TESTMODE);
625 626
626 /* disable interrupts */ 627 /* disable interrupts */
627 r8a66597_write(r8a66597, 0, INTENB0); 628 r8a66597_write(r8a66597, 0, INTENB0);
@@ -639,6 +640,7 @@ static void disable_controller(struct r8a66597 *r8a66597)
639 r8a66597_bclr(r8a66597, SCKE, SYSCFG0); 640 r8a66597_bclr(r8a66597, SCKE, SYSCFG0);
640 641
641 } else { 642 } else {
643 r8a66597_bclr(r8a66597, UTST, TESTMODE);
642 r8a66597_bclr(r8a66597, SCKE, SYSCFG0); 644 r8a66597_bclr(r8a66597, SCKE, SYSCFG0);
643 udelay(1); 645 udelay(1);
644 r8a66597_bclr(r8a66597, PLLC, SYSCFG0); 646 r8a66597_bclr(r8a66597, PLLC, SYSCFG0);
@@ -1003,10 +1005,29 @@ static void clear_feature(struct r8a66597 *r8a66597,
1003 1005
1004static void set_feature(struct r8a66597 *r8a66597, struct usb_ctrlrequest *ctrl) 1006static void set_feature(struct r8a66597 *r8a66597, struct usb_ctrlrequest *ctrl)
1005{ 1007{
1008 u16 tmp;
1009 int timeout = 3000;
1006 1010
1007 switch (ctrl->bRequestType & USB_RECIP_MASK) { 1011 switch (ctrl->bRequestType & USB_RECIP_MASK) {
1008 case USB_RECIP_DEVICE: 1012 case USB_RECIP_DEVICE:
1009 control_end(r8a66597, 1); 1013 switch (le16_to_cpu(ctrl->wValue)) {
1014 case USB_DEVICE_TEST_MODE:
1015 control_end(r8a66597, 1);
1016 /* Wait for the completion of status stage */
1017 do {
1018 tmp = r8a66597_read(r8a66597, INTSTS0) & CTSQ;
1019 udelay(1);
1020 } while (tmp != CS_IDST || timeout-- > 0);
1021
1022 if (tmp == CS_IDST)
1023 r8a66597_bset(r8a66597,
1024 le16_to_cpu(ctrl->wIndex >> 8),
1025 TESTMODE);
1026 break;
1027 default:
1028 pipe_stall(r8a66597, 0);
1029 break;
1030 }
1010 break; 1031 break;
1011 case USB_RECIP_INTERFACE: 1032 case USB_RECIP_INTERFACE:
1012 control_end(r8a66597, 1); 1033 control_end(r8a66597, 1);