[U-Boot] [PATCH 8/8] OMAP3 zoom2 Use usbtty if the debug board is not connected.

Tom Rix Tom.Rix at windriver.com
Mon Sep 28 18:37:29 CEST 2009


The preferred serial output comes from the debug board.
When the debug board is disconnected, fall back on using
usbtty from the usb connector on the Zoom2 board.

This shows up as /dev/ttyACM0 in a linux host.

Signed-off-by: Tom Rix <Tom.Rix at windriver.com>
---
 board/logicpd/zoom2/zoom2_serial.c |   12 ++++++++----
 include/configs/omap3_zoom2.h      |   17 +++++++++++++++++
 include/serial.h                   |   12 ++++++++++++
 3 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/board/logicpd/zoom2/zoom2_serial.c b/board/logicpd/zoom2/zoom2_serial.c
index a3d777d..ba58e39 100644
--- a/board/logicpd/zoom2/zoom2_serial.c
+++ b/board/logicpd/zoom2/zoom2_serial.c
@@ -86,6 +86,8 @@ void quad_putc_dev (unsigned long base, const char c)
 			quad_putc_dev (base, '\r');
 
 		NS16550_putc ((NS16550_t) base, c);
+	} else {
+		usbtty_putc(c);
 	}
 }
 
@@ -94,6 +96,8 @@ void quad_puts_dev (unsigned long base, const char *s)
 	if (zoom2_debug_board_connected ()) {
 		while ((s != NULL) && (*s != '\0'))
 			quad_putc_dev (base, *s++);
+	} else {
+		usbtty_puts(s);
 	}
 }
 
@@ -101,16 +105,16 @@ int quad_getc_dev (unsigned long base)
 {
 	if (zoom2_debug_board_connected ())
 		return NS16550_getc ((NS16550_t) base);
-	else
-		return 0;
+
+	return usbtty_getc();
 }
 
 int quad_tstc_dev (unsigned long base)
 {
 	if (zoom2_debug_board_connected ())
 		return NS16550_tstc ((NS16550_t) base);
-	else
-		return 0;
+
+	return usbtty_tstc();
 }
 
 void quad_setbrg_dev (unsigned long base)
diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h
index 75ab980..8d24efe 100644
--- a/include/configs/omap3_zoom2.h
+++ b/include/configs/omap3_zoom2.h
@@ -123,6 +123,20 @@
 #define CONFIG_OMAP3_GPIO_3 /* board revision */
 #define CONFIG_OMAP3_GPIO_5 /* debug board detection, ZOOM2_LED_BLUE */
 
+/* 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
+/* Change these to suit your needs */
+#define CONFIG_USBD_VENDORID		0x0451
+#define CONFIG_USBD_PRODUCTID		0x5678
+#define CONFIG_USBD_MANUFACTURER	"Texas Instruments"
+#define CONFIG_USBD_PRODUCT_NAME	"Zoom2"
+
 /* commands to include */
 #include <config_cmd_default.h>
 
@@ -170,6 +184,9 @@
 /* Environment information */
 #define CONFIG_BOOTDELAY		10
 
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"usbtty=cdc_acm\0" \
+
 /*
  * Miscellaneous configurable options
  */
diff --git a/include/serial.h b/include/serial.h
index 2c150ff..c0e1bce 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -60,9 +60,21 @@ extern int serial_assign(char * name);
 extern void serial_reinit_all(void);
 
 /* For usbtty */
+#ifdef CONFIG_USB_TTY
+
 extern int usbtty_getc(void);
 extern void usbtty_putc(const char c);
 extern void usbtty_puts(const char *str);
 extern int usbtty_tstc(void);
 
+#else
+
+/* stubs */
+#define usbtty_getc() 0
+#define usbtty_putc(a)
+#define usbtty_puts(a)
+#define usbtty_tstc() 0
+
+#endif /* CONFIG_USB_TTY */
+
 #endif
-- 
1.6.0.6



More information about the U-Boot mailing list