]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
MUSB: tusb updates 1/2 -- host side test support
authorDavid Brownell <david-b@pacbell.net>
Mon, 4 Sep 2006 13:27:30 +0000 (16:27 +0300)
committerTony Lindgren <tony@atomide.com>
Tue, 5 Sep 2006 14:16:52 +0000 (17:16 +0300)
Preliminary high speed electrical test support for the host side.

drivers/usb/musb/g_ep0.c
drivers/usb/musb/musbdefs.h
drivers/usb/musb/plat_uds.c
drivers/usb/musb/virthub.c

index 69fabd4af38f9637a21b76616d20166e252cc860..0f0142b16074559904a8577ed04f428337e1c380 100644 (file)
@@ -200,27 +200,6 @@ static void musb_g_ep0_giveback(struct musb *pThis, struct usb_request *req)
        musb_g_giveback(&pThis->aLocalEnd[0].ep_in, req, 0);
 }
 
-
-/* for high speed test mode; see USB 2.0 spec 7.1.20 */
-static const u8 musb_test_packet[53] = {
-       /* implicit SYNC then DATA0 to start */
-
-       /* JKJKJKJK x9 */
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-       /* JJKKJJKK x8 */
-       0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
-       /* JJJJKKKK x8 */
-       0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee,
-       /* JJJJJJJKKKKKKK x8 */
-       0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-       /* JJJJJJJK x8 */
-       0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd,
-       /* JKKKKKKK x10, JK */
-       0xfc, 0x7e, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0x7e
-
-       /* implicit CRC16 then EOP to end */
-};
-
 /*
  * Handle all control requests with no DATA stage, including standard
  * requests such as:
@@ -684,13 +663,8 @@ irqreturn_t musb_g_ep0_irq(struct musb *pThis)
                else if (pThis->bTestMode) {
                        DBG(1, "entering TESTMODE\n");
 
-                       if (MGC_M_TEST_PACKET == pThis->bTestModeValue) {
-                               musb_write_fifo(&pThis->aLocalEnd[0],
-                                                sizeof(musb_test_packet),
-                                                musb_test_packet);
-                       }
-
-                       musb_writew(regs, MGC_O_HDRC_CSR0, MGC_M_CSR0_TXPKTRDY);
+                       if (MGC_M_TEST_PACKET == pThis->bTestModeValue)
+                               musb_load_testpacket(pThis);
 
                        musb_writeb(pBase, MGC_O_HDRC_TESTMODE,
                                   pThis->bTestModeValue);
index 6962be49e69ed407dfad5ac83a87c7ca4fe7c86a..f27aea7fb4b8d0ba68cdb535c39d85f243448981 100644 (file)
@@ -525,6 +525,8 @@ extern void musb_write_fifo(struct musb_hw_ep *ep,
 extern void musb_read_fifo(struct musb_hw_ep *ep,
                               u16 wCount, u8 * pDest);
 
+extern void musb_load_testpacket(struct musb *);
+
 extern irqreturn_t musb_interrupt(struct musb *);
 
 extern void musb_platform_enable(struct musb *musb);
index 62c215cb11ca4eba9f6317b5cbd5be9dba89aa44..772a8a67641fad95b512bf68e3d017fb22f12a01 100644 (file)
@@ -318,6 +318,37 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 wCount, u8 *pDest)
 
 #endif /* normal PIO */
 
+
+/*-------------------------------------------------------------------------*/
+
+/* for high speed test mode; see USB 2.0 spec 7.1.20 */
+static const u8 musb_test_packet[53] = {
+       /* implicit SYNC then DATA0 to start */
+
+       /* JKJKJKJK x9 */
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       /* JJKKJJKK x8 */
+       0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
+       /* JJJJKKKK x8 */
+       0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee,
+       /* JJJJJJJKKKKKKK x8 */
+       0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+       /* JJJJJJJK x8 */
+       0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd,
+       /* JKKKKKKK x10, JK */
+       0xfc, 0x7e, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0x7e
+
+       /* implicit CRC16 then EOP to end */
+};
+
+void musb_load_testpacket(struct musb *musb)
+{
+       MGC_SelectEnd(musb->pRegs, 0);
+       musb_write_fifo(musb->control_ep,
+                       sizeof(musb_test_packet), musb_test_packet);
+       musb_writew(musb->pRegs, MGC_O_HDRC_CSR0, MGC_M_CSR0_TXPKTRDY);
+}
+
 /*-------------------------------------------------------------------------*/
 
 /*
index 94ead8a79dd2d60e576132004725668038734e36..f581415f2282d47f08e9c60fc5834a77a8e1533d 100644 (file)
@@ -257,7 +257,7 @@ int musb_hub_control(
                                musb->port1_status);
                break;
        case SetPortFeature:
-               if (wIndex != 1)
+               if ((wIndex & 0xff) != 1)
                        goto error;
 
                switch (wValue) {
@@ -282,6 +282,37 @@ int musb_hub_control(
                        musb_port_suspend(musb, TRUE);
                        break;
                case USB_PORT_FEAT_TEST:
+                       wIndex >>= 8;
+                       switch (wIndex) {
+                       case 1:
+                               pr_debug("TEST_J\n");
+                               temp = MGC_M_TEST_J;
+                               break;
+                       case 2:
+                               pr_debug("TEST_K\n");
+                               temp = MGC_M_TEST_K;
+                               break;
+                       case 3:
+                               pr_debug("TEST_SE0_NAK\n");
+                               temp = MGC_M_TEST_SE0_NAK;
+                               break;
+                       case 4:
+                               pr_debug("TEST_PACKET\n");
+                               temp = MGC_M_TEST_PACKET;
+                               musb_load_testpacket(musb);
+                               break;
+                       case 5:
+                               pr_debug("TEST_FORCE_ENABLE\n");
+                               temp = MGC_M_TEST_FORCE_HOST
+                                       | MGC_M_TEST_FORCE_HS;
+
+                               /* FIXME and enable a session too */
+                               break;
+                       default:
+                               goto error;
+                       }
+                       musb_writeb(musb->pRegs, MGC_O_HDRC_TESTMODE, temp);
+                       musb->port1_status |= USB_PORT_STAT_TEST;
                        break;
                default:
                        goto error;