Detlev Zundel <d...@denx.de> writes:

> A diff of the "before" and "after" branches will be posted seperately
> for easier inspection.

As promised attached the diff "before" -> "after".

Cheers
  Detlev

-- 
C hasn't changed much since the 1970s. And let's face it it's ugly.
Can't we do better? C++? (Sorry, never mind.)
                                    -- Rob Pike
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de
diff --git a/board/inka4x0/inka4x0.c b/board/inka4x0/inka4x0.c
index 2ef770b..7428b92 100644
--- a/board/inka4x0/inka4x0.c
+++ b/board/inka4x0/inka4x0.c
@@ -55,7 +55,8 @@
 #ifndef CONFIG_SYS_RAMBOOT
 static void sdram_start (int hi_addr)
 {
-	struct mpc5xxx_sdram *sdram = (struct mpc5xxx_sdram *)MPC5XXX_SDRAM;
+	volatile struct mpc5xxx_sdram *sdram =
+		(struct mpc5xxx_sdram *)MPC5XXX_SDRAM;
 	long hi_addr_bit = hi_addr ? 0x01000000 : 0;
 
 	/* unlock mode register */
@@ -94,9 +95,12 @@ static void sdram_start (int hi_addr)
 
 phys_size_t initdram (int board_type)
 {
-	struct mpc5xxx_mmap_ctl *mm = (struct mpc5xxx_mmap_ctl *) CONFIG_SYS_MBAR;
-	struct mpc5xxx_cdm     *cdm = (struct mpc5xxx_cdm *)      MPC5XXX_CDM;
-	struct mpc5xxx_sdram *sdram = (struct mpc5xxx_sdram *)    MPC5XXX_SDRAM;
+	volatile struct mpc5xxx_mmap_ctl *mm =
+		(struct mpc5xxx_mmap_ctl *) CONFIG_SYS_MBAR;
+	volatile struct mpc5xxx_cdm     *cdm =
+		(struct mpc5xxx_cdm *)      MPC5XXX_CDM;
+	volatile struct mpc5xxx_sdram *sdram =
+		(struct mpc5xxx_sdram *)    MPC5XXX_SDRAM;
 	ulong dramsize = 0;
 #ifndef CONFIG_SYS_RAMBOOT
 	long test1, test2;
@@ -162,7 +166,7 @@ int checkboard (void)
 
 void flash_preinit(void)
 {
-	struct mpc5xxx_lpb *lpb = (struct mpc5xxx_lpb *)MPC5XXX_LPB;
+	volatile struct mpc5xxx_lpb *lpb = (struct mpc5xxx_lpb *)MPC5XXX_LPB;
 
 	/*
 	 * Now, when we are in RAM, enable flash write
@@ -175,18 +179,21 @@ void flash_preinit(void)
 
 int misc_init_r (void) {
 	extern int inkadiag_init_r (void);
+
 	/*
-	  * The command table used for the subcommands of inkadiag
-	  * needs to be relocated manually.
-	  */
+	 * The command table used for the subcommands of inkadiag
+	 * needs to be relocated manually.
+	 */
 	return inkadiag_init_r();
 }
 
 int misc_init_f (void)
 {
-	struct mpc5xxx_gpio	*gpio    = (struct mpc5xxx_gpio *)   MPC5XXX_GPIO;
-	struct mpc5xxx_wu_gpio	*wu_gpio = (struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
-	struct mpc5xxx_gpt	*gpt;
+	volatile struct mpc5xxx_gpio	*gpio    =
+		(struct mpc5xxx_gpio *)   MPC5XXX_GPIO;
+	volatile struct mpc5xxx_wu_gpio	*wu_gpio =
+		(struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
+	volatile struct mpc5xxx_gpt	*gpt;
 	char tmp[10];
 	int i, br;
 
@@ -272,7 +279,8 @@ void pci_init_board(void)
 
 void init_ide_reset (void)
 {
-	struct mpc5xxx_wu_gpio	*wu_gpio = (struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
+	volatile struct mpc5xxx_wu_gpio	*wu_gpio =
+		(struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
 
 	debug ("init_ide_reset\n");
 
@@ -285,7 +293,8 @@ void init_ide_reset (void)
 
 void ide_set_reset (int idereset)
 {
-	struct mpc5xxx_wu_gpio	*wu_gpio = (struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
+	volatile struct mpc5xxx_wu_gpio	*wu_gpio =
+		(struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO;
 
 	debug ("ide_reset(%d)\n", idereset);
 
diff --git a/board/inka4x0/inkadiag.c b/board/inka4x0/inkadiag.c
index bdbf652..06c9807 100644
--- a/board/inka4x0/inkadiag.c
+++ b/board/inka4x0/inkadiag.c
@@ -31,7 +31,11 @@
 
 #include <command.h>
 
-#define GPIO_BASE  (u_char *)0x30400000
+/* This is needed for the includes in ns16550.h */
+#define CONFIG_SYS_NS16550_REG_SIZE 1
+#include <ns16550.h>
+
+#define GPIO_BASE		((u_char *)CONFIG_SYS_CS3_START)
 
 #define DIGIN_TOUCHSCR_MASK	0x00003000	/* Inputs 12-13 */
 #define DIGIN_KEYB_MASK		0x00010000	/* Input 16 */
@@ -49,31 +53,8 @@
 #define DIGIO_DRAWER1		0x00000100	/* Output 8 */
 #define DIGIO_DRAWER2		0x00000200	/* Output 9 */
 
-#define SERIAL_PORT_BASE	(u_char *)0x80000000
-
-#define UART_RX		0	/* In:  Receive buffer (DLAB=0) */
-#define UART_TX		0	/* Out: Transmit buffer (DLAB=0) */
-#define UART_DLL	0	/* Out: Divisor Latch Low (DLAB=1) */
-
-#define UART_LCR	3	/* Out: Line Control Register */
-#define UART_MCR	4	/* Out: Modem Control Register */
-
-#define UART_LSR	5	/* In:  Line Status Register */
-#define UART_MSR	6	/* In:  Modem Status Register */
+#define SERIAL_PORT_BASE	((u_char *)CONFIG_SYS_CS2_START)
 
-#define UART_LCR_WLEN8  0x03	/* Wordlength: 8 bits */
-#define UART_LCR_DLAB	0x80	/* Divisor latch access bit */
-
-#define UART_LSR_THRE	0x20	/* Transmit-hold-register empty */
-#define UART_LSR_DR	0x01	/* Receiver data ready */
-
-#define UART_MCR_LOOP	0x10	/* Enable loopback test mode */
-#define UART_MCR_RTS	0x02	/* RTS complement */
-#define UART_MCR_DTR	0x01	/* DTR complement */
-
-#define UART_MSR_DCD	0x80	/* Data Carrier Detect */
-#define UART_MSR_DSR	0x20	/* Data Set Ready */
-#define UART_MSR_CTS	0x10	/* Clear to Send */
 #define PSC_OP1_RTS	0x01
 #define PSC_OP0_RTS	0x01
 
@@ -89,17 +70,15 @@ static unsigned int inka_digin_get_input(void)
 		in_8(GPIO_BASE + 2) << 16 | in_8(GPIO_BASE + 3) << 24;
 }
 
-#define LED_HIGH(NUM) \
-    do { \
-	    out_be32((unsigned *)MPC5XXX_GPT##NUM##_ENABLE,		\
-		     in_be32((unsigned *)MPC5XXX_GPT##NUM##_ENABLE) | 0x10); \
-    } while (0)
+#define LED_HIGH(NUM)							\
+	do {								\
+		setbits_be32((unsigned *)MPC5XXX_GPT##NUM##_ENABLE, 0x10); \
+	} while (0)
 
-#define LED_LOW(NUM) \
-    do { \
-	    out_be32((unsigned *)MPC5XXX_GPT##NUM##_ENABLE,		\
-		     in_be32((unsigned *)MPC5XXX_GPT##NUM##_ENABLE) & ~0x10); \
-    } while (0)
+#define LED_LOW(NUM)							\
+	do {								\
+		clrbits_be32((unsigned *)MPC5XXX_GPT##NUM##_ENABLE, 0x10); \
+	} while (0)
 
 #define CHECK_LED(NUM) \
     do { \
@@ -112,6 +91,8 @@ static unsigned int inka_digin_get_input(void)
 
 static void inka_digio_set_output(unsigned int state, int which)
 {
+	volatile struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
+
 	if (which == 0) {
 		/* other */
 		CHECK_LED(0);
@@ -121,29 +102,28 @@ static void inka_digio_set_output(unsigned int state, int which)
 		CHECK_LED(4);
 		CHECK_LED(5);
 	} else {
-		struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
 		if (which == 1) {
 			/* drawer1 */
 			if (state) {
-				gpio->simple_dvo &= ~0x1000;
+				clrbits_be32(&gpio->simple_dvo, 0x1000);
 				udelay(1);
-				gpio->simple_dvo |= 0x1000;
+				setbits_be32(&gpio->simple_dvo, 0x1000);
 			} else {
-				gpio->simple_dvo |= 0x1000;
+				setbits_be32(&gpio->simple_dvo, 0x1000);
 				udelay(1);
-				gpio->simple_dvo &= ~0x1000;
+				clrbits_be32(&gpio->simple_dvo, 0x1000);
 			}
 		}
 		if (which == 2) {
 			/* drawer 2 */
 			if (state) {
-				gpio->simple_dvo &= ~0x2000;
+				clrbits_be32(&gpio->simple_dvo, 0x2000);
 				udelay(1);
-				gpio->simple_dvo |= 0x2000;
+				setbits_be32(&gpio->simple_dvo, 0x2000);
 			} else {
-				gpio->simple_dvo |= 0x2000;
+				setbits_be32(&gpio->simple_dvo, 0x2000);
 				udelay(1);
-				gpio->simple_dvo &= ~0x2000;
+				clrbits_be32(&gpio->simple_dvo, 0x2000);
 			}
 		}
 	}
@@ -203,34 +183,33 @@ static int ser_init(volatile struct mpc5xxx_psc *psc, int baudrate)
 	int div;
 
 	/* reset PSC */
-	psc->command = PSC_SEL_MODE_REG_1;
+	out_8(&psc->command, PSC_SEL_MODE_REG_1);
 
 	/* select clock sources */
 
-	psc->psc_clock_select = 0;
+	out_be16(&psc->psc_clock_select, 0);
 	baseclk = (gd->ipb_clk + 16) / 32;
 
 	/* switch to UART mode */
-	psc->sicr = 0;
+	out_be32(&psc->sicr, 0);
 
 	/* configure parity, bit length and so on */
 
-	psc->mode = PSC_MODE_8_BITS | PSC_MODE_PARNONE;
-
-	psc->mode = PSC_MODE_ONE_STOP;
+	out_8(&psc->mode, PSC_MODE_8_BITS | PSC_MODE_PARNONE);
+	out_8(&psc->mode, PSC_MODE_ONE_STOP);
 
 	/* set up UART divisor */
 	div = (baseclk + (baudrate / 2)) / baudrate;
-	psc->ctur = (div >> 8) & 0xff;
-	psc->ctlr = div & 0xff;
+	out_8(&psc->ctur, (div >> 8) & 0xff);
+	out_8(&psc->ctlr, div & 0xff);
 
 	/* disable all interrupts */
-	psc->psc_imr = 0;
+	out_be16(&psc->psc_imr, 0);
 
 	/* reset and enable Rx/Tx */
-	psc->command = PSC_RST_RX;
-	psc->command = PSC_RST_TX;
-	psc->command = PSC_RX_ENABLE | PSC_TX_ENABLE;
+	out_8(&psc->command, PSC_RST_RX);
+	out_8(&psc->command, PSC_RST_TX);
+	out_8(&psc->command, PSC_RX_ENABLE | PSC_TX_ENABLE);
 
 	return 0;
 }
@@ -239,6 +218,7 @@ static void ser_putc(volatile struct mpc5xxx_psc *psc, const char c)
 {
 	/* Wait 1 second for last character to go. */
 	int i = 0;
+
 	while (!(psc->psc_status & PSC_SR_TXEMP) && (i++ < 1000000/10))
 		udelay(10);
 	psc->psc_buffer_8 = c;
@@ -249,24 +229,21 @@ static int ser_getc(volatile struct mpc5xxx_psc *psc)
 {
 	/* Wait for a character to arrive. */
 	int i = 0;
-	while (!(psc->psc_status & PSC_SR_RXRDY) && (i++ < 1000000/10))
-		udelay(10);
 
-	return psc->psc_buffer_8;
-}
-
-static unsigned char serial_in(unsigned char num, int offset)
-{
-	return in_8(SERIAL_PORT_BASE + (num << 3) + offset);
-}
+	while (!(in_be16(&psc->psc_status) & PSC_SR_RXRDY) && (i++ < 1000000/10))
+		udelay(10);
 
-static void serial_out(unsigned char num, int offset, unsigned char value)
-{
-	out_8(SERIAL_PORT_BASE + (num << 3) + offset, value);
+	return in_8(&psc->psc_buffer_8);
 }
 
 static int do_inkadiag_serial(cmd_tbl_t *cmdtp, int flag, int argc,
 			      char *argv[]) {
+	volatile struct NS16550 *uart;
+	volatile struct mpc5xxx_psc *psc;
+	unsigned int num, mode;
+	int combrd, baudrate, i, j, len;
+	int address;
+
 	if (argc < 5) {
 		cmd_usage(cmdtp);
 		return 1;
@@ -275,17 +252,16 @@ static int do_inkadiag_serial(cmd_tbl_t *cmdtp, int flag, int argc,
 	argc--;
 	argv++;
 
-	unsigned int num = simple_strtol(argv[0], NULL, 0);
+	num = simple_strtol(argv[0], NULL, 0);
 	if (num < 0 || num > 11) {
 		printf("invalid argument for num: %d\n", num);
 		return -1;
 	}
 
-	unsigned int mode = simple_strtol(argv[1], NULL, 0);
+	mode = simple_strtol(argv[1], NULL, 0);
 
-	int combrd = 0;
-	int baudrate = simple_strtoul(argv[2], NULL, 10);
-	int i;
+	combrd = 0;
+	baudrate = simple_strtoul(argv[2], NULL, 10);
 	for (i=0; i<N_BAUDRATES; ++i) {
 		if (baudrate == baudrate_table[i])
 			break;
@@ -297,90 +273,81 @@ static int do_inkadiag_serial(cmd_tbl_t *cmdtp, int flag, int argc,
 	}
 	combrd = 115200 / baudrate;
 
+	uart = (struct NS16550 *)(SERIAL_PORT_BASE + (num << 3));
+
 	printf("Testing uart %d.\n\n", num);
 
 	if ((num >= 0) && (num <= 7)) {
 		if (mode & 1) {
 			/* turn on 'loopback' mode */
-			serial_out(num, UART_MCR, UART_MCR_LOOP);
+			out_8(&uart->mcr, MCR_LOOP);
 		} else {
 			/*
 			 * establish the UART's operational parameters
-			 * set DLAB=1
+			 * set DLAB=1, so rbr accesses DLL
 			 */
-			serial_out(num, UART_LCR, UART_LCR_DLAB);
+			out_8(&uart->lcr, LCR_DLAB);
 			/* set baudrate */
-			serial_out(num, UART_DLL, combrd);
+			out_8(&uart->rbr, combrd);
 			/* set data-format: 8-N-1 */
-			serial_out(num, UART_LCR, UART_LCR_WLEN8);
+			out_8(&uart->lcr, LCR_WLS_8);
 		}
 
 		if (mode & 2) {
 			/* set request to send */
-			serial_out(num, UART_MCR, UART_MCR_RTS);
+			out_8(&uart->mcr, MCR_RTS);
 			udelay(10);
 			/* check clear to send */
-			if ((serial_in(num, UART_MSR) & UART_MSR_CTS) == 0x00)
+			if ((in_8(&uart->msr) & MSR_CTS) == 0x00)
 				return -1;
 		}
 		if (mode & 4) {
 			/* set data terminal ready */
-			serial_out(num, UART_MCR, UART_MCR_DTR);
+			out_8(&uart->mcr, MCR_DTR);
 			udelay(10);
 			/* check data set ready and carrier detect */
-			if ((serial_in(num, UART_MSR) &
-			     (UART_MSR_DSR | UART_MSR_DCD))
-			    != (UART_MSR_DSR | UART_MSR_DCD))
+			if ((in_8(&uart->msr) & (MSR_DSR | MSR_DCD))
+			    != (MSR_DSR | MSR_DCD))
 				return -1;
 		}
 
 		/* write each message-character, read it back, and display it */
-		int i, len = strlen(argv[3]);
-		for (i = 0; i < len; ++i) {
-			int j = 0;
-			while ((serial_in(num, UART_LSR) & UART_LSR_THRE) ==
-				0x00) {
+		for (i = 0, len = strlen(argv[3]); i < len; ++i) {
+			j = 0;
+			while ((in_8(&uart->lsr) & LSR_THRE) ==	0x00) {
 				if (j++ > CONFIG_SYS_HZ)
 					break;
 				udelay(10);
 			}
-			serial_out(num, UART_TX, argv[3][i]);
+			out_8(&uart->rbr, argv[3][i]);
 			j = 0;
-			while ((serial_in(num, UART_LSR) & UART_LSR_DR) ==
-				0x00) {
+			while ((in_8(&uart->lsr) & LSR_DR) == 0x00) {
 				if (j++ > CONFIG_SYS_HZ)
 					break;
 				udelay(10);
 			}
-			unsigned char data = serial_in(num, UART_RX);
-			printf("%c", data);
+			printf("%c", in_8(&uart->rbr));
 		}
 		printf("\n\n");
-		serial_out(num, UART_MCR, 0x00);
+		out_8(&uart->mcr, 0x00);
 	} else {
-		int address = 0;
-		int irq;
+		address = 0;
 
 		switch (num) {
 		case 8:
 			address = MPC5XXX_PSC6;
-			irq = MPC5XXX_PSC6_IRQ;
 			break;
 		case 9:
 			address = MPC5XXX_PSC3;
-			irq = MPC5XXX_PSC3_IRQ;
 			break;
 		case 10:
 			address = MPC5XXX_PSC2;
-			irq = MPC5XXX_PSC2_IRQ;
 			break;
 		case 11:
 			address = MPC5XXX_PSC1;
-			irq = MPC5XXX_PSC1_IRQ;
 			break;
 		}
-		volatile struct mpc5xxx_psc *psc =
-			(struct mpc5xxx_psc *)address;
+		psc = (struct mpc5xxx_psc *)address;
 		ser_init(psc, simple_strtol(argv[2], NULL, 0));
 		if (mode & 2) {
 			/* set request to send */
@@ -390,7 +357,7 @@ static int do_inkadiag_serial(cmd_tbl_t *cmdtp, int flag, int argc,
 			if ((in_8(&psc->ip) & PSC_IPCR_CTS) == 0)
 				return -1;
 		}
-		int i, len = strlen(argv[3]);
+		len = strlen(argv[3]);
 		for (i = 0; i < len; ++i) {
 			ser_putc(psc, argv[3][i]);
 			printf("%c", ser_getc(psc));
@@ -403,7 +370,7 @@ static int do_inkadiag_serial(cmd_tbl_t *cmdtp, int flag, int argc,
 #define BUZZER_GPT	(MPC5XXX_GPT + 0x60)	/* GPT6 */
 static void buzzer_turn_on(unsigned int freq)
 {
-	struct mpc5xxx_gpt *gpt = (struct mpc5xxx_gpt *)(BUZZER_GPT);
+	volatile struct mpc5xxx_gpt *gpt = (struct mpc5xxx_gpt *)(BUZZER_GPT);
 
 	const u32 prescale = gd->ipb_clk / freq / 128;
 	const u32 count = 128;
@@ -416,13 +383,17 @@ static void buzzer_turn_on(unsigned int freq)
 
 static void buzzer_turn_off(void)
 {
-	struct mpc5xxx_gpt *gpt = (struct mpc5xxx_gpt *)(BUZZER_GPT);
+	volatile struct mpc5xxx_gpt *gpt = (struct mpc5xxx_gpt *)(BUZZER_GPT);
+
 	gpt->emsr = 0;
 }
 
 static int do_inkadiag_buzzer(cmd_tbl_t *cmdtp, int flag, int argc,
 			      char *argv[]) {
 
+	unsigned int period, freq;
+	int prev, i;
+
 	if (argc != 3) {
 		cmd_usage(cmdtp);
 		return 1;
@@ -431,13 +402,13 @@ static int do_inkadiag_buzzer(cmd_tbl_t *cmdtp, int flag, int argc,
 	argc--;
 	argv++;
 
-	unsigned int period = simple_strtol(argv[0], NULL, 0);
+	period = simple_strtol(argv[0], NULL, 0);
 	if (!period)
 		printf("Zero period is senseless\n");
 	argc--;
 	argv++;
 
-	unsigned int freq = simple_strtol(argv[0], NULL, 0);
+	freq = simple_strtol(argv[0], NULL, 0);
 	/* avoid zero prescale in buzzer_turn_on() */
 	if (freq > gd->ipb_clk / 128) {
 		printf("%dHz exceeds maximum (%ldHz)\n", freq,
@@ -448,12 +419,11 @@ static int do_inkadiag_buzzer(cmd_tbl_t *cmdtp, int flag, int argc,
 		buzzer_turn_on(freq);
 
 	clear_ctrlc();
-	int prev = disable_ctrlc(0);
+	prev = disable_ctrlc(0);
 
 	printf("Buzzing for %d ms. Type ^C to abort!\n\n", period);
 
-	int i = 0;
-
+	i = 0;
 	while (!ctrlc() && (i++ < CONFIG_SYS_HZ))
 		udelay(period);
 
@@ -469,19 +439,21 @@ static int do_inkadiag_help(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
 cmd_tbl_t cmd_inkadiag_sub[] = {
 	U_BOOT_CMD_MKENT(io, 1, 1, do_inkadiag_io, "read digital input",
-			 "<drawer1|drawer2|other> [value] - get or set specified signal\n"),
+	 "<drawer1|drawer2|other> [value] - get or set specified signal\n"),
 	U_BOOT_CMD_MKENT(serial, 4, 1, do_inkadiag_serial, "test serial port",
-			 "<num> <mode> <baudrate> <msg>  - test uart num [0..11] in mode\n"
-			 "and baudrate with msg\n"),
+	 "<num> <mode> <baudrate> <msg>  - test uart num [0..11] in mode\n"
+	 "and baudrate with msg\n"),
 	U_BOOT_CMD_MKENT(buzzer, 2, 1, do_inkadiag_buzzer, "activate buzzer",
-			 "<period> <freq> - turn buzzer on for period ms with freq hz\n"),
+	 "<period> <freq> - turn buzzer on for period ms with freq hz\n"),
 	U_BOOT_CMD_MKENT(help, 4, 1, do_inkadiag_help, "get help",
-			 "[command] - get help for command\n"),
+	 "[command] - get help for command\n"),
 };
 
-static int do_inkadiag_help(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) {
-	extern int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp,
-			     int flag, int argc, char *argv[]);
+static int do_inkadiag_help(cmd_tbl_t *cmdtp, int flag,
+			    int argc, char *argv[]) {
+	extern int _do_help (cmd_tbl_t *cmd_start, int cmd_items,
+			     cmd_tbl_t *cmdtp, int flag,
+			     int argc, char *argv[]);
 	/* do_help prints command name - we prepend inkadiag to our subcommands! */
 #ifdef CONFIG_SYS_LONGHELP
 	puts ("inkadiag ");
@@ -513,13 +485,14 @@ U_BOOT_CMD(inkadiag, 6, 1, do_inkadiag,
 	   "    - perform a diagnosis on inka hardware\n"
 	   "'inkadiag' performs hardware tests.\n\n");
 
-/* Relocate the command table functino pointers when running in RAM */
+/* Relocate the command table function pointers when running in RAM */
 int inkadiag_init_r (void) {
 	cmd_tbl_t *cmdtp;
 
 	for (cmdtp = &cmd_inkadiag_sub[0]; cmdtp !=
 		     &cmd_inkadiag_sub[ARRAY_SIZE(cmd_inkadiag_sub)]; cmdtp++) {
 		ulong addr;
+
 		addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
 		cmdtp->cmd = (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
 
diff --git a/include/ns16550.h b/include/ns16550.h
index e6ade61..edfbc53 100644
--- a/include/ns16550.h
+++ b/include/ns16550.h
@@ -123,6 +123,7 @@ typedef volatile struct NS16550 *NS16550_t;
 #define MCR_RTS         0x02
 #define MCR_DMA_EN      0x04
 #define MCR_TX_DFR      0x08
+#define MCR_LOOP	0x10		/* Enable loopback test mode */
 
 #define LCR_WLS_MSK	0x03		/* character length select mask */
 #define LCR_WLS_5	0x00		/* 5 bit character length */
@@ -135,6 +136,7 @@ typedef volatile struct NS16550 *NS16550_t;
 #define LCR_STKP	0x20		/* Stick Parity */
 #define LCR_SBRK	0x40		/* Set Break */
 #define LCR_BKSE	0x80		/* Bank select enable */
+#define LCR_DLAB	0x80		/* Divisor latch access bit */
 
 #define LSR_DR		0x01		/* Data ready */
 #define LSR_OE		0x02		/* Overrun */
@@ -145,6 +147,15 @@ typedef volatile struct NS16550 *NS16550_t;
 #define LSR_TEMT	0x40		/* Xmitter empty */
 #define LSR_ERR		0x80		/* Error */
 
+#define MSR_DCD		0x80		/* Data Carrier Detect */
+#define MSR_RI		0x40		/* Ring Indicator */
+#define MSR_DSR		0x20		/* Data Set Ready */
+#define MSR_CTS		0x10		/* Clear to Send */
+#define MSR_DDCD	0x08		/* Delta DCD */
+#define MSR_TERI	0x04		/* Trailing edge ring indicator */
+#define MSR_DDSR	0x02		/* Delta DSR */
+#define MSR_DCTS	0x01		/* Delta CTS */
+
 #ifdef CONFIG_OMAP1510
 #define OSC_12M_SEL	0x01		/* selects 6.5 * current clk div */
 #endif
diff --git a/include/tws.h b/include/tws.h
index 35145d7..bfa8d58 100644
--- a/include/tws.h
+++ b/include/tws.h
@@ -27,7 +27,8 @@
 
 #ifndef TWS_SOFT_DECLARATIONS
 # if defined(CONFIG_MPC5xxx)
-#  define TWS_SOFT_DECLARATIONS volatile ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, I2C_PORT);
+#  define TWS_SOFT_DECLARATIONS \
+ volatile ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, I2C_PORT);
 # else
 #  define TWS_SOFT_DECLARATIONS
 # endif
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to