enable USB serial support
authorGrazvydas Ignotas <notasas@gmail.com>
Thu, 17 Jun 2010 20:54:15 +0000 (23:54 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Thu, 17 Jun 2010 20:54:15 +0000 (23:54 +0300)
requested by DjWillis, costed ~14kB.

board/pandora/menu.c
include/configs/omap3_pandora.h

index 86c1576..38cad6d 100644 (file)
@@ -68,6 +68,17 @@ static int menu_do_poweroff(struct menu_item *item)
        return 0;
 }
 
+static int menu_do_usb_serial(struct menu_item *item)
+{
+       printf("Switched to USB serial.\n");
+
+       setenv("stdout", "usbtty");
+       setenv("stdin", "usbtty");
+       setenv("stderr", "usbtty");
+       setenv("bootcmd", "");
+       return 1;
+}
+
 static int menu_do_serial(struct menu_item *item)
 {
        printf("Switched to serial.\n");
@@ -93,6 +104,7 @@ static int menu_do_script_cmd(struct menu_item *item)
 static struct menu_item default_menu_items[] = {
        { "default boot",       menu_do_default, },
        { "power off",          menu_do_poweroff, },
+       { "USB serial prompt",  menu_do_usb_serial, },
        { "serial prompt",      menu_do_serial, },
 };
 
@@ -164,8 +176,11 @@ found:
        }
 
 finish:
-       if (menu_item_count < ARRAY_SIZE(menu_items))
-               menu_items[menu_item_count++] = &default_menu_items[2];
+       for (i = 2; i < ARRAY_SIZE(default_menu_items); i++) {
+               if (menu_item_count >= ARRAY_SIZE(menu_items))
+                       break;
+               menu_items[menu_item_count++] = &default_menu_items[i];
+       }
 
        setenv("stdout", "lcd");
 }
index da566bb..b09ae1d 100644 (file)
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV   1
 #define CONFIG_SYS_DEVICE_NULLDEV      1
 
+/* USB */
+#define CONFIG_MUSB_UDC                        1
+#define CONFIG_USB_OMAP3               1
+#define CONFIG_TWL4030_USB             1
+
+/* USB device configuration */
+#define CONFIG_USB_DEVICE              1
+#define CONFIG_USB_TTY                 1
+
 /*
  * Hardware drivers
  */
 #define CONFIG_BOOTDELAY               0
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
+       "usbtty=cdc_acm\0" \
        "loadaddr=0x82000000\0" \
        "bootargs=ubi.mtd=4 ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs " \
        "rw rootflags=bulk_read console=ttyS0,115200n8 " \