aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/langwell_udc.c
diff options
context:
space:
mode:
authorLuo Andy <yifei.luo@intel.com>2010-11-22 21:41:21 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-11-30 19:50:36 -0500
commit7fc56f0d9908fe140a01387d59954e3d0a2e7744 (patch)
tree88cbdeeacff090643c8b2dc6e44df82b2d1f2b6b /drivers/usb/gadget/langwell_udc.c
parentb23f2f94136884ebeb1b5e2196f4a53086444afa (diff)
usb: gadget: langwell_udc: add usb test mode support
This patch adds test mode support for Langwell gadget driver. Signed-off-by: Henry Yuan <hang.yuan@intel.com> Signed-off-by: Andy Luo <yifei.luo@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/langwell_udc.c')
-rw-r--r--drivers/usb/gadget/langwell_udc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
index b8ec954c0692..777972454e3e 100644
--- a/drivers/usb/gadget/langwell_udc.c
+++ b/drivers/usb/gadget/langwell_udc.c
@@ -2225,6 +2225,7 @@ static void handle_setup_packet(struct langwell_udc *dev,
2225 u16 wValue = le16_to_cpu(setup->wValue); 2225 u16 wValue = le16_to_cpu(setup->wValue);
2226 u16 wIndex = le16_to_cpu(setup->wIndex); 2226 u16 wIndex = le16_to_cpu(setup->wIndex);
2227 u16 wLength = le16_to_cpu(setup->wLength); 2227 u16 wLength = le16_to_cpu(setup->wLength);
2228 u32 portsc1;
2228 2229
2229 dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__); 2230 dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
2230 2231
@@ -2313,6 +2314,28 @@ static void handle_setup_packet(struct langwell_udc *dev,
2313 dev->dev_status &= ~(1 << wValue); 2314 dev->dev_status &= ~(1 << wValue);
2314 } 2315 }
2315 break; 2316 break;
2317 case USB_DEVICE_TEST_MODE:
2318 dev_dbg(&dev->pdev->dev, "SETUP: TEST MODE\n");
2319 if ((wIndex & 0xff) ||
2320 (dev->gadget.speed != USB_SPEED_HIGH))
2321 ep0_stall(dev);
2322
2323 switch (wIndex >> 8) {
2324 case TEST_J:
2325 case TEST_K:
2326 case TEST_SE0_NAK:
2327 case TEST_PACKET:
2328 case TEST_FORCE_EN:
2329 if (prime_status_phase(dev, EP_DIR_IN))
2330 ep0_stall(dev);
2331 portsc1 = readl(&dev->op_regs->portsc1);
2332 portsc1 |= (wIndex & 0xf00) << 8;
2333 writel(portsc1, &dev->op_regs->portsc1);
2334 goto end;
2335 default:
2336 rc = -EOPNOTSUPP;
2337 }
2338 break;
2316 default: 2339 default:
2317 rc = -EOPNOTSUPP; 2340 rc = -EOPNOTSUPP;
2318 break; 2341 break;