* Patches by Anders Larsen, 17 Sep 2003:
  - fix spelling errors
  - set GD_FLG_DEVINIT flag only after device function pointers
    are valid
  - Allow CFG_ALT_MEMTEST on systems where address zero isn't
    writeable
  - enable 3.rd UART (ST-UART) on PXA(XScale) CPUs
  - trigger watchdog while waiting in serial driver
diff --git a/CHANGELOG b/CHANGELOG
index 83b5b6a..9782fd4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,15 @@
 Changes for U-Boot 1.0.0:
 ======================================================================
 
+* Patches by Anders Larsen, 17 Sep 2003:
+  - fix spelling errors
+  - set GD_FLG_DEVINIT flag only after device function pointers
+    are valid
+  - Allow CFG_ALT_MEMTEST on systems where address zero isn't
+    writeable
+  - enable 3.rd UART (ST-UART) on PXA(XScale) CPUs
+  - trigger watchdog while waiting in serial driver
+
 * Add auto-update code for TRAB board using USB memory sticks,
   support new configuration with more memory
 
diff --git a/README b/README
index 691140f..aee88ed 100644
--- a/README
+++ b/README
@@ -1498,6 +1498,10 @@
 - CFG_ALT_MEMTEST:
 		Enable an alternate, more extensive memory test.
 
+- CFG_MEMTEST_SCRATCH:
+		Scratch address used by the alternate memory test
+		You only need to set this if address zero isn't writeable
+
 - CFG_TFTP_LOADADDR:
 		Default load address for network file downloads
 
diff --git a/board/at91rm9200dk/flash.c b/board/at91rm9200dk/flash.c
index ebbd6f4..9a67755 100644
--- a/board/at91rm9200dk/flash.c
+++ b/board/at91rm9200dk/flash.c
@@ -160,7 +160,7 @@
 		if (i == 0)
 			flashbase = PHYS_FLASH_1;
 		else
-			panic ("configured to many flash banks!\n");
+			panic ("configured too many flash banks!\n");
 
 		sector = 0;
 		start_address = flashbase;
diff --git a/board/cradle/flash.c b/board/cradle/flash.c
index e2d174e..d867a11 100644
--- a/board/cradle/flash.c
+++ b/board/cradle/flash.c
@@ -59,7 +59,7 @@
 		flashbase = PHYS_FLASH_2;
 		break;
 	 default:
-		panic("configured to many flash banks!\n");
+		panic("configured too many flash banks!\n");
 		break;
       }
       for (j = 0; j < flash_info[i].sector_count; j++)
diff --git a/board/csb226/flash.c b/board/csb226/flash.c
index 9801773..6b0e51a 100644
--- a/board/csb226/flash.c
+++ b/board/csb226/flash.c
@@ -62,7 +62,7 @@
 				flashbase = PHYS_FLASH_1;
 				break;
 			default:
-				panic("configured to many flash banks!\n");
+				panic("configured too many flash banks!\n");
 				break;
 		}
 		for (j = 0; j < flash_info[i].sector_count; j++) {
diff --git a/board/dnp1110/flash.c b/board/dnp1110/flash.c
index 4416393..60874ba 100644
--- a/board/dnp1110/flash.c
+++ b/board/dnp1110/flash.c
@@ -74,7 +74,7 @@
 		 flash_get_offsets(PHYS_FLASH_1, &flash_info[i]);
 		break;
 	   default:
-		panic("configured to many flash banks!\n");
+		panic("configured too many flash banks!\n");
 		break;
 	}
 	size += flash_info[i].size;
diff --git a/board/ep7312/flash.c b/board/ep7312/flash.c
index 1ee0a37..c687cc7 100644
--- a/board/ep7312/flash.c
+++ b/board/ep7312/flash.c
@@ -50,7 +50,7 @@
 		if (i == 0)
 			flashbase = PHYS_FLASH_1;
 		else
-			panic ("configured to many flash banks!\n");
+			panic ("configured too many flash banks!\n");
 		for (j = 0; j < flash_info[i].sector_count; j++) {
 			flash_info[i].start[j] = flashbase + j * MAIN_SECT_SIZE;
 		}
diff --git a/board/impa7/flash.c b/board/impa7/flash.c
index da4d31e..3e380e5 100644
--- a/board/impa7/flash.c
+++ b/board/impa7/flash.c
@@ -53,7 +53,7 @@
 	else if (i == 1)
 	  flashbase = PHYS_FLASH_2;
 	else
-	  panic("configured to many flash banks!\n");
+	  panic("configured too many flash banks!\n");
 	for (j = 0; j < flash_info[i].sector_count; j++)
 	{
 	    if (j <= 7)
diff --git a/board/innokom/flash.c b/board/innokom/flash.c
index 3caf43d..29c9166 100644
--- a/board/innokom/flash.c
+++ b/board/innokom/flash.c
@@ -276,7 +276,7 @@
 				flashbase = PHYS_FLASH_1;
 				break;
 			default:
-				panic("configured to many flash banks!\n");
+				panic("configured too many flash banks!\n");
 				break;
 		}
 		for (j = 0; j < flash_info[i].sector_count; j++) {
diff --git a/board/lart/flash.c b/board/lart/flash.c
index ad6134b..013c2fd 100644
--- a/board/lart/flash.c
+++ b/board/lart/flash.c
@@ -86,7 +86,7 @@
 	if (i == 0)
 	  flashbase = PHYS_FLASH_1;
 	else
-	  panic("configured to many flash banks!\n");
+	  panic("configured too many flash banks!\n");
 	for (j = 0; j < flash_info[i].sector_count; j++)
 	{
 	    if (j <= 7)
diff --git a/board/logodl/flash.c b/board/logodl/flash.c
index cef0b4d..8c304f9 100644
--- a/board/logodl/flash.c
+++ b/board/logodl/flash.c
@@ -91,7 +91,7 @@
 		flashbase = PHYS_FLASH_2;
 		break;
 	   default:
-		panic("configured to many flash banks!\n");
+		panic("configured too many flash banks!\n");
 		break;
 	}
 	for (j = 0; j < flash_info[i].sector_count; j++)
diff --git a/board/lubbock/flash.c b/board/lubbock/flash.c
index 9e07b11..ba82892 100644
--- a/board/lubbock/flash.c
+++ b/board/lubbock/flash.c
@@ -76,7 +76,7 @@
 			flash_get_offsets (PHYS_FLASH_2, &flash_info[i]);
 			break;
 		default:
-			panic ("configured to many flash banks!\n");
+			panic ("configured too many flash banks!\n");
 			break;
 		}
 		size += flash_info[i].size;
diff --git a/board/ml2/flash.c b/board/ml2/flash.c
index 090725d..4f805a6 100644
--- a/board/ml2/flash.c
+++ b/board/ml2/flash.c
@@ -72,7 +72,7 @@
 		if (i==0)
 			flashbase = CFG_FLASH_BASE;
 		else
-			panic("configured to many flash banks!\n");
+			panic("configured too many flash banks!\n");
 		for (j = 0; j < flash_info[i].sector_count; j++)
 				flash_info[i].start[j]=flashbase + j * SECT_SIZE;
 
diff --git a/board/mpl/vcma9/flash.c b/board/mpl/vcma9/flash.c
index 91517c4..829396b 100644
--- a/board/mpl/vcma9/flash.c
+++ b/board/mpl/vcma9/flash.c
@@ -80,7 +80,7 @@
 	if (i == 0)
 	  flashbase = PHYS_FLASH_1;
 	else
-	  panic("configured to many flash banks!\n");
+	  panic("configured too many flash banks!\n");
 	for (j = 0; j < flash_info[i].sector_count; j++)
 	{
 	    if (j <= 3)
diff --git a/board/omap1510inn/flash.c b/board/omap1510inn/flash.c
index 6b2739d..9453987 100644
--- a/board/omap1510inn/flash.c
+++ b/board/omap1510inn/flash.c
@@ -72,7 +72,7 @@
 			flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
 			break;
 		default:
-			panic ("configured to many flash banks!\n");
+			panic ("configured too many flash banks!\n");
 			break;
 		}
 		size += flash_info[i].size;
diff --git a/board/omap1610inn/flash.c b/board/omap1610inn/flash.c
index 59f5b68..0108545 100644
--- a/board/omap1610inn/flash.c
+++ b/board/omap1610inn/flash.c
@@ -96,7 +96,7 @@
 			flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
 			break;
 		default:
-			panic ("configured to many flash banks!\n");
+			panic ("configured too many flash banks!\n");
 			break;
 		}
 		size += flash_info[i].size;
diff --git a/board/sc520_cdp/flash.c b/board/sc520_cdp/flash.c
index 2f7ce52..d52a847 100644
--- a/board/sc520_cdp/flash.c
+++ b/board/sc520_cdp/flash.c
@@ -234,7 +234,7 @@
 			flashbase = SC520_FLASH_BANK2_BASE;
 			break;
 		default:
-			panic("configured to many flash banks!\n");
+			panic("configured too many flash banks!\n");
 		}
 
 		id = identify_flash(flashbase, 4);
diff --git a/board/sc520_cdp/flash_old.c b/board/sc520_cdp/flash_old.c
index 416b01d..3c0f6d6 100644
--- a/board/sc520_cdp/flash_old.c
+++ b/board/sc520_cdp/flash_old.c
@@ -101,7 +101,7 @@
 			flashbase = SC520_FLASH_BANK0_BASE;
 			break;
 		default:
-			panic("configured to many flash banks!\n");
+			panic("configured too many flash banks!\n");
 		}
 
 		for (j = 0; j < flash_info[i].sector_count; j++) {
diff --git a/board/sc520_spunk/flash.c b/board/sc520_spunk/flash.c
index d97dc21..4942e59 100644
--- a/board/sc520_spunk/flash.c
+++ b/board/sc520_spunk/flash.c
@@ -239,7 +239,7 @@
 			flashbase = SC520_FLASH_BANK0_BASE;
 			break;
 		default:
-			panic("configured to many flash banks!\n");
+			panic("configured too many flash banks!\n");
 		}
 
 		id = identify_flash(flashbase, 2);
diff --git a/board/shannon/flash.c b/board/shannon/flash.c
index 74f5f69..65ebc27 100644
--- a/board/shannon/flash.c
+++ b/board/shannon/flash.c
@@ -73,7 +73,7 @@
 	if (i == 0)
 	  flashbase = PHYS_FLASH_1;
 	else
-	  panic("configured to many flash banks!\n");
+	  panic("configured too many flash banks!\n");
 	for (j = 0; j < flash_info[i].sector_count; j++)
 	{
 
diff --git a/board/shannon/shannon.c b/board/shannon/shannon.c
index 1876e3e..c090bde4 100644
--- a/board/shannon/shannon.c
+++ b/board/shannon/shannon.c
@@ -60,7 +60,7 @@
 	*(unsigned long *)temp = 0x00060006;
 
 	}
-#endif /* CONFIG_INIT_CRITICAL */
+#endif /* CONFIG_INFERNO */
 
 	/* arch number for shannon */
 	gd->bd->bi_arch_number = 97;
diff --git a/board/smdk2410/flash.c b/board/smdk2410/flash.c
index d7479f0..a37c6f8 100644
--- a/board/smdk2410/flash.c
+++ b/board/smdk2410/flash.c
@@ -80,7 +80,7 @@
 	if (i == 0)
 	  flashbase = PHYS_FLASH_1;
 	else
-	  panic("configured to many flash banks!\n");
+	  panic("configured too many flash banks!\n");
 	for (j = 0; j < flash_info[i].sector_count; j++)
 	{
 	    if (j <= 3)
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 3e22598..3918678 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -555,7 +555,11 @@
 	vu_long	temp;
 	vu_long	anti_pattern;
 	vu_long	num_words;
+#if defined(CFG_MEMTEST_SCRATCH)
+	vu_long *dummy = (vu_long*)CFG_MEMTEST_SCRATCH;
+#else
 	vu_long *dummy = NULL;
+#endif
 	int	j;
 	int iterations = 1;
 
diff --git a/common/console.c b/common/console.c
index 148c599..d933c33 100644
--- a/common/console.c
+++ b/common/console.c
@@ -436,6 +436,8 @@
 		console_setfile (stdin, inputdev);
 	}
 
+	gd->flags |= GD_FLG_DEVINIT;	/* device initialization completed */
+
 #ifndef CFG_CONSOLE_INFO_QUIET
 	/* Print information */
 	printf ("In:    ");
@@ -480,6 +482,8 @@
 /* Called after the relocation - use desired console functions */
 int console_init_r (void)
 {
+	DECLARE_GLOBAL_DATA_PTR;
+
 	device_t *inputdev = NULL, *outputdev = NULL;
 	int i, items = ListNumItems (devlist);
 
@@ -514,6 +518,8 @@
 		console_setfile (stdin, inputdev);
 	}
 
+	gd->flags |= GD_FLG_DEVINIT;	/* device initialization completed */
+
 #ifndef CFG_CONSOLE_INFO_QUIET
 	/* Print information */
 	printf ("In:    ");
diff --git a/common/devices.c b/common/devices.c
index 4839eac..7b4a1cd 100644
--- a/common/devices.c
+++ b/common/devices.c
@@ -158,8 +158,6 @@
 
 int devices_init (void)
 {
-	DECLARE_GLOBAL_DATA_PTR;
-
 #ifndef CONFIG_ARM     /* already relocated for current ARM implementation */
 	ulong relocation_offset = gd->reloc_off;
 	int i;
@@ -195,8 +193,6 @@
 #endif
 	drv_system_init ();
 
-	gd-> flags |= GD_FLG_DEVINIT;	/* device initialization done */
-
 	return (0);
 }
 
diff --git a/common/usb.c b/common/usb.c
index 9474abe..a96052a 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -595,7 +595,7 @@
 	int i;
 	USB_PRINTF("New Device %d\n",dev_index);
 	if(dev_index==USB_MAX_DEVICE) {
-		printf("ERROR, to many USB Devices max=%d\n",USB_MAX_DEVICE);
+		printf("ERROR, too many USB Devices, max=%d\n",USB_MAX_DEVICE);
 		return NULL;
 	}
 	usb_dev[dev_index].devnum=dev_index+1; /* default Address is 0, real addresses start with 1 */
diff --git a/cpu/pxa/cpu.c b/cpu/pxa/cpu.c
index cc9b3ff..6b82f04 100644
--- a/cpu/pxa/cpu.c
+++ b/cpu/pxa/cpu.c
@@ -83,7 +83,7 @@
 {
 	extern void reset_cpu (ulong addr);
 
-	printf ("reseting ...\n");
+	printf ("resetting ...\n");
 
 	udelay (50000);				/* wait 50 ms */
 	disable_interrupts ();
diff --git a/cpu/pxa/serial.c b/cpu/pxa/serial.c
index c9d5f70..cedebfe 100644
--- a/cpu/pxa/serial.c
+++ b/cpu/pxa/serial.c
@@ -29,6 +29,7 @@
  */
 
 #include <common.h>
+#include <watchdog.h>
 #include <asm/arch/pxa-regs.h>
 
 void serial_setbrg (void)
@@ -38,7 +39,7 @@
 	unsigned int quot = 0;
 
 	if (gd->baudrate == 1200)
-		quot = 192;
+		quot = 768;
 	else if (gd->baudrate == 9600)
 		quot = 96;
 	else if (gd->baudrate == 19200)
@@ -53,7 +54,6 @@
 		hang ();
 
 #ifdef CONFIG_FFUART
-
 	CKEN |= CKEN6_FFUART;
 
 	FFIER = 0;					/* Disable for now */
@@ -82,9 +82,21 @@
 	BTIER = IER_UUE;			/* Enable BFUART */
 
 #elif defined(CONFIG_STUART)
-#error "Bad: not implemented yet!"
+	CKEN |= CKEN5_STUART;
+
+	STIER = 0;
+	STFCR = 0;
+
+	/* set baud rate */
+	STLCR = LCR_DLAB;
+	STDLL = quot & 0xff;
+	STDLH = quot >> 8;
+	STLCR = LCR_WLS0 | LCR_WLS1;
+
+	STIER = IER_UUE;			/* Enable STUART */
+
 #else
-#error "Bad: you didn't configured serial ..."
+#error "Bad: you didn't configure serial ..."
 #endif
 }
 
@@ -109,13 +121,17 @@
 {
 #ifdef CONFIG_FFUART
 	/* wait for room in the tx FIFO on FFUART */
-	while ((FFLSR & LSR_TEMT) == 0);
-
+	while ((FFLSR & LSR_TEMT) == 0)
+		WATCHDOG_RESET ();	/* Reset HW Watchdog, if needed */
 	FFTHR = c;
 #elif defined(CONFIG_BTUART)
-	while ((BTLSR & LSR_TEMT ) == 0 );
+	while ((BTLSR & LSR_TEMT ) == 0 )
+		WATCHDOG_RESET ();	/* Reset HW Watchdog, if needed */
 	BTTHR = c;
 #elif defined(CONFIG_STUART)
+	while ((STLSR & LSR_TEMT ) == 0 )
+		WATCHDOG_RESET ();	/* Reset HW Watchdog, if needed */
+	STTHR = c;
 #endif
 
 	/* If \n, also do \r */
@@ -135,6 +151,7 @@
 #elif defined(CONFIG_BTUART)
 	return BTLSR & LSR_DR;
 #elif defined(CONFIG_STUART)
+	return STLSR & LSR_DR;
 #endif
 }
 
@@ -146,14 +163,17 @@
 int serial_getc (void)
 {
 #ifdef CONFIG_FFUART
-	while (!(FFLSR & LSR_DR));
-
+	while (!(FFLSR & LSR_DR))
+		WATCHDOG_RESET ();	/* Reset HW Watchdog, if needed */
 	return (char) FFRBR & 0xff;
 #elif defined(CONFIG_BTUART)
-	while (!(BTLSR & LSR_DR));
-
+	while (!(BTLSR & LSR_DR))
+		WATCHDOG_RESET ();	/* Reset HW Watchdog, if needed */
 	return (char) BTRBR & 0xff;
 #elif defined(CONFIG_STUART)
+	while (!(STLSR & LSR_DR))
+		WATCHDOG_RESET ();	/* Reset HW Watchdog, if needed */
+	return (char) STRBR & 0xff;
 #endif
 }