Skip to contentSkip to conversation

Rename common ns16550 constants with UART_ prefix to prevent conflicts

PATCH New Detlev Zundel 1 participant 1 message Apr 3, 2009 Input drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Rename common ns16550 constants with UART_ prefix to prevent conflicts

Fix problems introduced in commit 7b5611cdd12ca0cc33f994f0d4a4454788fc3124 [inka4x0: Add hardware diagnosis functions for inka4x0] which redefined MSR_RI which is already used on PowerPC systems.

Also eliminate redundant definitions in ps2mult.h. More cleanup will be needed for other redundant occurrences though.

---
 board/inka4x0/inkadiag.c |   20 ++++----
 board/linkstation/avr.c  |    6 +-
 drivers/input/ps2ser.c   |   22 ++++----
 drivers/serial/ns16550.c |   39 +++++++------
 include/ns16550.h        |  135 +++++++++++++++++++++++++++++++--------------
 include/ps2mult.h        |   99 ---------------------------------
 6 files changed, 139 insertions(+), 182 deletions(-)
board/inka4x0/inkadiag.c +10 -10
index 06c9807..12c0a85 100644
@@ -280,48 +280,48 @@ static int do_inkadiag_serial(cmd_tbl_t *cmdtp, int flag, int argc,
 	if ((num >= 0) && (num <= 7)) {
 		if (mode & 1) {
 			/* turn on 'loopback' mode */
-			out_8(&uart->mcr, MCR_LOOP);
+			out_8(&uart->mcr, UART_MCR_LOOP);
 		} else {
 			/*
 			 * establish the UART's operational parameters
 			 * set DLAB=1, so rbr accesses DLL
 			 */
-			out_8(&uart->lcr, LCR_DLAB);
+			out_8(&uart->lcr, UART_LCR_DLAB);
 			/* set baudrate */
 			out_8(&uart->rbr, combrd);
 			/* set data-format: 8-N-1 */
-			out_8(&uart->lcr, LCR_WLS_8);
+			out_8(&uart->lcr, UART_LCR_WLS_8);
 		}
 
 		if (mode & 2) {
 			/* set request to send */
-			out_8(&uart->mcr, MCR_RTS);
+			out_8(&uart->mcr, UART_MCR_RTS);
 			udelay(10);
 			/* check clear to send */
-			if ((in_8(&uart->msr) & MSR_CTS) == 0x00)
+			if ((in_8(&uart->msr) & UART_MSR_CTS) == 0x00)
 				return -1;
 		}
 		if (mode & 4) {
 			/* set data terminal ready */
-			out_8(&uart->mcr, MCR_DTR);
+			out_8(&uart->mcr, UART_MCR_DTR);
 			udelay(10);
 			/* check data set ready and carrier detect */
-			if ((in_8(&uart->msr) & (MSR_DSR | MSR_DCD))
-			    != (MSR_DSR | MSR_DCD))
+			if ((in_8(&uart->msr) & (UART_MSR_DSR | UART_MSR_DCD))
+			    != (UART_MSR_DSR | UART_MSR_DCD))
 				return -1;
 		}
 
 		/* write each message-character, read it back, and display it */
 		for (i = 0, len = strlen(argv[3]); i < len; ++i) {
 			j = 0;
-			while ((in_8(&uart->lsr) & LSR_THRE) ==	0x00) {
+			while ((in_8(&uart->lsr) & UART_LSR_THRE) ==	0x00) {
 				if (j++ > CONFIG_SYS_HZ)
 					break;
 				udelay(10);
 			}
 			out_8(&uart->rbr, argv[3][i]);
 			j = 0;
-			while ((in_8(&uart->lsr) & LSR_DR) == 0x00) {
+			while ((in_8(&uart->lsr) & UART_LSR_DR) == 0x00) {
 				if (j++ > CONFIG_SYS_HZ)
 					break;
 				udelay(10);
board/linkstation/avr.c +3 -3
index fda1b91..782b24a 100644
@@ -90,12 +90,12 @@ void init_AVR_DUART (void)
 	 */
 	AVR_port->lcr = 0x00;
 	AVR_port->ier = 0x00;
-	AVR_port->lcr = LCR_BKSE;
+	AVR_port->lcr = UART_LCR_BKSE;
 	AVR_port->dll = clock_divisor & 0xff;
 	AVR_port->dlm = (clock_divisor >> 8) & 0xff;
-	AVR_port->lcr = LCR_WLS_8 | LCR_PEN | LCR_EPS;
+	AVR_port->lcr = UART_LCR_WLS_8 | UART_LCR_PEN | UART_LCR_EPS;
 	AVR_port->mcr = 0x00;
-	AVR_port->fcr = FCR_FIFO_EN | FCR_RXSR | FCR_TXSR;
+	AVR_port->fcr = UART_FCR_FIFO_EN | UART_FCR_RXSR | UART_FCR_TXSR;
 
 	miconCntl_DisWDT();
 
drivers/input/ps2ser.c +12 -10
index 1af3fde..1a5e2d4 100644
@@ -1,6 +1,6 @@
 /***********************************************************************
  *
- * (C) Copyright 2004
+ * (C) Copyright 2004-2009
  * DENX Software Engineering
  * Wolfgang Denk, wd at denx.de
  * All rights reserved.
@@ -18,9 +18,11 @@
 #include <asm/io.h>
 #include <asm/atomic.h>
 #include <ps2mult.h>
-#if defined(CONFIG_SYS_NS16550) || defined(CONFIG_MPC85xx)
-#include <ns16550.h>
+/* This is needed for ns16550.h */
+#ifndef CONFIG_SYS_NS16550_REG_SIZE
+#define CONFIG_SYS_NS16550_REG_SIZE 1
 #endif
+#include <ns16550.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -128,12 +130,12 @@ int ps2ser_init(void)
 	NS16550_t com_port = (NS16550_t)COM_BASE;
 
 	com_port->ier = 0x00;
-	com_port->lcr = LCR_BKSE | LCR_8N1;
+	com_port->lcr = UART_LCR_BKSE | UART_LCR_8N1;
 	com_port->dll = (CONFIG_SYS_NS16550_CLK / 16 / PS2SER_BAUD) & 0xff;
 	com_port->dlm = ((CONFIG_SYS_NS16550_CLK / 16 / PS2SER_BAUD) >> 8) & 0xff;
-	com_port->lcr = LCR_8N1;
-	com_port->mcr = (MCR_DTR | MCR_RTS);
-	com_port->fcr = (FCR_FIFO_EN | FCR_RXSR | FCR_TXSR);
+	com_port->lcr = UART_LCR_8N1;
+	com_port->mcr = (UART_MCR_DTR | UART_MCR_RTS);
+	com_port->fcr = (UART_FCR_FIFO_EN | UART_FCR_RXSR | UART_FCR_TXSR);
 
 	return (0);
 }
@@ -202,7 +204,7 @@ void ps2ser_putc(int chr)
 	psc->psc_buffer_8 = chr;
 #elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
       defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555)
-	while ((com_port->lsr & LSR_THRE) == 0);
+	while ((com_port->lsr & UART_LSR_THRE) == 0);
 	com_port->thr = chr;
 #else
 	while (!(ps2ser_in(UART_LSR) & UART_LSR_THRE));
@@ -227,7 +229,7 @@ static int ps2ser_getc_hw(void)
 	}
 #elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
       defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555)
-	if (com_port->lsr & LSR_DR) {
+	if (com_port->lsr & UART_LSR_DR) {
 		res = com_port->rbr;
 	}
 #else
@@ -315,7 +317,7 @@ static void ps2ser_interrupt(void *dev_id)
 	} while (status & PSC_SR_RXRDY);
 #elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
       defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555)
-	} while (status & LSR_DR);
+	} while (status & UART_LSR_DR);
 #else
 	} while (status & UART_IIR_RDI);
 #endif
drivers/serial/ns16550.c +21 -18
index 397f5df..657c9da 100644
@@ -7,9 +7,12 @@
 #include <config.h>
 #include <ns16550.h>
 
-#define LCRVAL LCR_8N1					/* 8 data, 1 stop, no parity */
-#define MCRVAL (MCR_DTR | MCR_RTS)			/* RTS/DTR */
-#define FCRVAL (FCR_FIFO_EN | FCR_RXSR | FCR_TXSR)	/* Clear & enable FIFOs */
+#define UART_LCRVAL UART_LCR_8N1		/* 8 data, 1 stop, no parity */
+#define UART_MCRVAL (UART_MCR_DTR | \
+		     UART_MCR_RTS)		/* RTS/DTR */
+#define UART_FCRVAL (UART_FCR_FIFO_EN |	\
+		     UART_FCR_RXSR |	\
+		     UART_FCR_TXSR)		/* Clear & enable FIFOs */
 
 void NS16550_init (NS16550_t com_port, int baud_divisor)
 {
@@ -17,16 +20,16 @@ void NS16550_init (NS16550_t com_port, int baud_divisor)
 #ifdef CONFIG_OMAP
 	com_port->mdr1 = 0x7;	/* mode select reset TL16C750*/
 #endif
-	com_port->lcr = LCR_BKSE | LCRVAL;
+	com_port->lcr = UART_LCR_BKSE | UART_LCRVAL;
 	com_port->dll = 0;
 	com_port->dlm = 0;
-	com_port->lcr = LCRVAL;
-	com_port->mcr = MCRVAL;
-	com_port->fcr = FCRVAL;
-	com_port->lcr = LCR_BKSE | LCRVAL;
+	com_port->lcr = UART_LCRVAL;
+	com_port->mcr = UART_MCRVAL;
+	com_port->fcr = UART_FCRVAL;
+	com_port->lcr = UART_LCR_BKSE | UART_LCRVAL;
 	com_port->dll = baud_divisor & 0xff;
 	com_port->dlm = (baud_divisor >> 8) & 0xff;
-	com_port->lcr = LCRVAL;
+	com_port->lcr = UART_LCRVAL;
 #if defined(CONFIG_OMAP)
 #if defined(CONFIG_APTIX)
 	com_port->mdr1 = 3;	/* /13 mode so Aptix 6MHz can hit 115200 */
@@ -40,29 +43,29 @@ void NS16550_init (NS16550_t com_port, int baud_divisor)
 void NS16550_reinit (NS16550_t com_port, int baud_divisor)
 {
 	com_port->ier = 0x00;
-	com_port->lcr = LCR_BKSE | LCRVAL;
+	com_port->lcr = UART_LCR_BKSE | UART_LCRVAL;
 	com_port->dll = 0;
 	com_port->dlm = 0;
-	com_port->lcr = LCRVAL;
-	com_port->mcr = MCRVAL;
-	com_port->fcr = FCRVAL;
-	com_port->lcr = LCR_BKSE;
+	com_port->lcr = UART_LCRVAL;
+	com_port->mcr = UART_MCRVAL;
+	com_port->fcr = UART_FCRVAL;
+	com_port->lcr = UART_LCR_BKSE;
 	com_port->dll = baud_divisor & 0xff;
 	com_port->dlm = (baud_divisor >> 8) & 0xff;
-	com_port->lcr = LCRVAL;
+	com_port->lcr = UART_LCRVAL;
 }
 #endif /* CONFIG_NS16550_MIN_FUNCTIONS */
 
 void NS16550_putc (NS16550_t com_port, char c)
 {
-	while ((com_port->lsr & LSR_THRE) == 0);
+	while ((com_port->lsr & UART_LSR_THRE) == 0);
 	com_port->thr = c;
 }
 
 #ifndef CONFIG_NS16550_MIN_FUNCTIONS
 char NS16550_getc (NS16550_t com_port)
 {
-	while ((com_port->lsr & LSR_DR) == 0) {
+	while ((com_port->lsr & UART_LSR_DR) == 0) {
 #ifdef CONFIG_USB_TTY
 		extern void usbtty_poll(void);
 		usbtty_poll();
@@ -73,7 +76,7 @@ char NS16550_getc (NS16550_t com_port)
 
 int NS16550_tstc (NS16550_t com_port)
 {
-	return ((com_port->lsr & LSR_DR) != 0);
+	return ((com_port->lsr & UART_LSR_DR) != 0);
 }
 
 #endif /* CONFIG_NS16550_MIN_FUNCTIONS */
include/ns16550.h +93 -42

152 lines not on this page · raw message

include/ps2mult.h +0 -99

103 lines not on this page · raw message

Signature · 4 lines
1.6.0.6


--=NSA-Uzi-CIA-Soviet-bomb-KGB-Clinton--