Skip to contentSkip to conversation

ZOOM2 Add serial support.

PATCH New Tom Rix 1 participant 1 message Apr 1, 2009

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 ZOOM2 Add serial support.

Zoom2 serial is in general supplied by one of the 4 UARTS on the debug board. The default serial is from the USB connector on left side of the debug board. The USB connector will produce 2 of the 4 UARTS. On your host pick the first enumeration.

The serial port set up is the same with Zoom1.
Baud rate 115200, 8 bit data, no parity, 1 stop bit, no flow.

The kernel bootargs are
console=ttyS3,115200n8

---
 board/omap3/zoom2/Makefile       |    3 +-
 board/omap3/zoom2/zoom2_serial.c |  103 ++++++++++++++++++++++++++++++++++++++
 board/omap3/zoom2/zoom2_serial.h |   77 ++++++++++++++++++++++++++++
 common/serial.c                  |    2 +
 cpu/arm_cortexa8/omap3/mem.c     |   23 ++++++++
 drivers/serial/ns16550.c         |   13 ++++-
 include/asm-arm/arch-omap3/cpu.h |    2 +
 include/configs/omap3_zoom2.h    |   26 ++++-----
 include/ns16550.h                |   19 +++++++
 include/serial.h                 |    7 +++
 10 files changed, 258 insertions(+), 17 deletions(-)
 create mode 100644 board/omap3/zoom2/zoom2_serial.c
 create mode 100644 board/omap3/zoom2/zoom2_serial.h
board/omap3/zoom2/Makefile +2 -1
index b8fa5a7..d27990c 100644
@@ -26,7 +26,8 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).a
 
 COBJS	:= zoom2.o \
-	debug_board.o
+	debug_board.o \
+	zoom2_serial.o
 
 SRCS	:= $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/omap3/zoom2/zoom2_serial.c new file +103 -0

103 lines not on this page · raw message

board/omap3/zoom2/zoom2_serial.h new file +77 -0

77 lines not on this page · raw message

common/serial.c +2 -0
index 09385d0..3e9135b 100644
@@ -68,6 +68,8 @@ struct serial_device *__default_serial_console (void)
 #else
 #error "CONFIG_SERIAL? missing."
 #endif
+#elif defined(CONFIG_OMAP3_ZOOM2)
+		return DEFAULT_ZOOM2_SERIAL_DEVICE;
 #else
 #error No default console
 #endif
cpu/arm_cortexa8/omap3/mem.c +23 -0
index 3cc22c4..20a8748 100644
@@ -82,6 +82,18 @@ gpmc_csx_t *onenand_cs_base;
 
 #endif
 
+#if defined(CONFIG_OMAP3_ZOOM2)
+static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = {
+	0x00011000,
+	0x001F1F01,
+	0x00080803,
+	0x1D091D09,
+	0x041D1F1F,
+	0x1D0904C4, 0
+};
+gpmc_csx_t *serial_cs_base;
+#endif
+
 static sdrc_t *sdrc_base = (sdrc_t *)OMAP34XX_SDRC_BASE;
 
 /**************************************************************************
@@ -281,4 +293,15 @@ void gpmc_init(void)
 	boot_flash_env_addr = f_off;
 #endif
 #endif
+
+#ifdef CONFIG_OMAP3_ZOOM2
+	/* Configure console support on zoom2 */
+	gpmc_config = gpmc_serial_TL16CP754C;
+	serial_cs_base = (gpmc_csx_t *) (GPMC_CONFIG_CS0_BASE +
+					 (3 * GPMC_CONFIG_WIDTH));
+	enable_gpmc_config(gpmc_config,
+			   serial_cs_base,
+			   SERIAL_TL16CP754C_BASE,
+			   GPMC_SIZE_16M);
+#endif
 }
drivers/serial/ns16550.c +11 -2
index 397f5df..93a1bd2 100644
@@ -14,9 +14,18 @@
 void NS16550_init (NS16550_t com_port, int baud_divisor)
 {
 	com_port->ier = 0x00;
-#ifdef CONFIG_OMAP
+#if defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)
 	com_port->mdr1 = 0x7;	/* mode select reset TL16C750*/
 #endif
+#if defined(CONFIG_OMAP3_ZOOM2)
+	/* On Zoom2 board Set pre-scalar to 1
+	 * CLKSEL is GND => MCR[7] is 1 => preslr is 4
+	 * So change the prescl to 1
+	 */
+	com_port->lcr = 0xBF;
+	com_port->fcr |= 0x10;
+	com_port->mcr &= 0x7F;
+#endif
 	com_port->lcr = LCR_BKSE | LCRVAL;
 	com_port->dll = 0;
 	com_port->dlm = 0;
@@ -27,7 +36,7 @@ void NS16550_init (NS16550_t com_port, int baud_divisor)
 	com_port->dll = baud_divisor & 0xff;
 	com_port->dlm = (baud_divisor >> 8) & 0xff;
 	com_port->lcr = LCRVAL;
-#if defined(CONFIG_OMAP)
+#if defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)
 #if defined(CONFIG_APTIX)
 	com_port->mdr1 = 3;	/* /13 mode so Aptix 6MHz can hit 115200 */
 #else
include/asm-arm/arch-omap3/cpu.h +2 -0
index c544e0c..7671a3a 100644
@@ -153,6 +153,8 @@ typedef struct gpmc_csx {
 #define PISMO2_BASE		0x18000000	/* PISMO2 CS1/2 */
 #define ONENAND_MAP		0x20000000	/* OneNand addr */
 						/* (actual size small port) */
+#define SERIAL_TL16CP754C_BASE	0x10000000      /* Zoom2 Serial chip address */
+
 /* SMS */
 #ifndef __ASSEMBLY__
 typedef struct sms {
include/configs/omap3_zoom2.h +12 -14
index 9ea8ea0..c991b1b 100644
@@ -70,26 +70,24 @@
 
 /*
  * NS16550 Configuration
+ * Zoom2 uses the TL16CP754C on the debug board
  */
-#define V_NS16550_CLK			48000000	/* 48MHz (APLL96/2) */
+#define CONFIG_SERIAL_MULTI      1
+/* 0 - 1 : first  USB with respect to the left edge of the debug board
+   2 - 3 : second USB with respect to the left edge of the debug board */
+#define DEFAULT_ZOOM2_SERIAL_DEVICE (&zoom2_serial_device0)
 
-#define CONFIG_SYS_NS16550
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE	(-4)
-#define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
+#define V_NS16550_CLK            (1843200)  /* 1.8432 Mhz */
 
-/*
- * select serial console configuration
- */
-#define CONFIG_CONS_INDEX		3
-#define CONFIG_SYS_NS16550_COM3		OMAP34XX_UART3
-#define CONFIG_SERIAL3			3	/* UART3 */
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_REG_SIZE     (-2)
+#define CONFIG_SYS_NS16550_CLK          V_NS16550_CLK
+#define CONFIG_BAUDRATE          115200
+#define CONFIG_SYS_BAUDRATE_TABLE   {115200}
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
-#define CONFIG_BAUDRATE			115200
-#define CONFIG_SYS_BAUDRATE_TABLE	{4800, 9600, 19200, 38400, 57600,\
-					115200}
+
 #define CONFIG_MMC			1
 #define CONFIG_OMAP3_MMC		1
 #define CONFIG_DOS_PARTITION		1
include/ns16550.h +19 -0
index edfbc53..ebaa44f 100644
@@ -57,6 +57,25 @@ struct NS16550 {
 	unsigned long msr;		/* 6 r  */
 	unsigned long scr;		/* 7 rw */
 }; /* No need to pack an already aligned struct */
+#elif (CONFIG_SYS_NS16550_REG_SIZE == -2)
+struct NS16550 {
+	unsigned char rbr;		/* 0 r  */
+	int pad1:8;
+	unsigned char ier;		/* 1 rw */
+	int pad2:8;
+	unsigned char fcr;		/* 2 w  */
+	int pad3:8;
+	unsigned char lcr;		/* 3 rw */
+	int pad4:8;
+	unsigned char mcr;		/* 4 rw */
+	int pad5:8;
+	unsigned char lsr;		/* 5 r  */
+	int pad6:8;
+	unsigned char msr;		/* 6 r  */
+	int pad7:8;
+	unsigned char scr;		/* 7 rw */
+	int pad8:8;
+}; /* No need to pack an already aligned struct */
 #elif (CONFIG_SYS_NS16550_REG_SIZE == -4)
 struct NS16550 {
 	unsigned char rbr;		/* 0 */
include/serial.h +7 -0
index e3d8b36..aca5221 100644
@@ -42,6 +42,13 @@ extern struct serial_device s3c24xx_serial1_device;
 extern struct serial_device s3c24xx_serial2_device;
 #endif
 
+#if defined(CONFIG_OMAP3_ZOOM2)
+extern struct serial_device zoom2_serial_device0;
+extern struct serial_device zoom2_serial_device1;
+extern struct serial_device zoom2_serial_device2;
+extern struct serial_device zoom2_serial_device3;
+#endif
+
 extern struct serial_device serial_ffuart_device;
 extern struct serial_device serial_btuart_device;
 extern struct serial_device serial_stuart_device;
Signature · 1 line
1.6.0.5