Skip to content

Commit ceaa0a6

Browse files
shimodayFelipe Balbi
authored andcommitted
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 <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 5154e9f commit ceaa0a6

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

drivers/usb/gadget/m66592-udc.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ static void init_controller(struct m66592 *m66592)
691691

692692
static void disable_controller(struct m66592 *m66592)
693693
{
694+
m66592_bclr(m66592, M66592_UTST, M66592_TESTMODE);
694695
if (!m66592->pdata->on_chip) {
695696
m66592_bclr(m66592, M66592_SCKE, M66592_SYSCFG);
696697
udelay(1);
@@ -1048,10 +1049,30 @@ static void clear_feature(struct m66592 *m66592, struct usb_ctrlrequest *ctrl)
10481049

10491050
static void set_feature(struct m66592 *m66592, struct usb_ctrlrequest *ctrl)
10501051
{
1052+
u16 tmp;
1053+
int timeout = 3000;
10511054

10521055
switch (ctrl->bRequestType & USB_RECIP_MASK) {
10531056
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+
}
10551076
break;
10561077
case USB_RECIP_INTERFACE:
10571078
control_end(m66592, 1);

0 commit comments

Comments
 (0)