Merge branch 'master' of git://git.denx.de/u-boot-mmc
diff --git a/MAINTAINERS b/MAINTAINERS
index 8af9b09..1299cbb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -624,7 +624,7 @@
 
 	jornada	SA1110
 
-Fabio Estevam <Fabio.Estevam@freescale.com>
+Fabio Estevam <fabio.estevam@freescale.com>
 
 	mx31pdk		i.MX31
 
@@ -905,9 +905,9 @@
 #	Board		CPU						#
 #########################################################################
 
-Daniel Engström <daniel@omicron.se>
+Graeme Russ <graeme.russ@gmail.com>
 
-	sc520_cdp	x86
+	eNET		AMD SC520
 
 #########################################################################
 # MIPS Systems:								#
diff --git a/MAKEALL b/MAKEALL
index e1b928f..6acece7 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -544,10 +544,10 @@
 "
 
 #########################################################################
-## i386 Systems
+## x86 Systems
 #########################################################################
 
-LIST_x86="$(boards_by_arch i386)"
+LIST_x86="$(boards_by_arch x86)"
 
 #########################################################################
 ## Nios-II Systems
diff --git a/Makefile b/Makefile
index 1d57134..713dba1 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@
 VERSION_FILE = $(obj)include/version_autogenerated.h
 
 HOSTARCH := $(shell uname -m | \
-	sed -e s/i.86/i386/ \
+	sed -e s/i.86/x86/ \
 	    -e s/sun4u/sparc64/ \
 	    -e s/arm.*/arm/ \
 	    -e s/sa110/arm/ \
@@ -167,7 +167,7 @@
 # U-Boot objects....order is important (i.e. start must be first)
 
 OBJS  = $(CPUDIR)/start.o
-ifeq ($(CPU),i386)
+ifeq ($(CPU),x86)
 OBJS += $(CPUDIR)/start16.o
 OBJS += $(CPUDIR)/resetvec.o
 endif
diff --git a/README b/README
index c9fedd8..4917e26 100644
--- a/README
+++ b/README
@@ -164,7 +164,7 @@
   /blackfin		Files generic to Analog Devices Blackfin architecture
     /cpu		CPU specific files
     /lib		Architecture specific library files
-  /i386			Files generic to i386 architecture
+  /x86			Files generic to x86 architecture
     /cpu		CPU specific files
     /lib		Architecture specific library files
   /m68k			Files generic to m68k architecture
diff --git a/arch/powerpc/config.mk b/arch/powerpc/config.mk
index 3afc439..e682071 100644
--- a/arch/powerpc/config.mk
+++ b/arch/powerpc/config.mk
@@ -26,8 +26,6 @@
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
 LDFLAGS_FINAL += --gc-sections
 PLATFORM_RELFLAGS += -fpic -mrelocatable -ffunction-sections -fdata-sections
-PLATFORM_RELFLAGS += $(call cc-option,-msingle-pic-base,)
-PLATFORM_RELFLAGS += $(call cc-option,-fno-jump-tables,)
 PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__
 PLATFORM_LDFLAGS  += -n
 
diff --git a/arch/powerpc/cpu/74xx_7xx/start.S b/arch/powerpc/cpu/74xx_7xx/start.S
index ab9412a..f6011fc 100644
--- a/arch/powerpc/cpu/74xx_7xx/start.S
+++ b/arch/powerpc/cpu/74xx_7xx/start.S
@@ -274,11 +274,7 @@
 	stwu	r0, -4(r1)	/* stack backtraces terminate cleanly	*/
 
 	GET_GOT			/* initialize GOT access	*/
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
+
 	/* run low-level CPU init code     (from Flash)	*/
 	bl	cpu_init_f
 	sync
@@ -592,11 +588,6 @@
 	mr	r10, r5		/* Save copy of Destination Address	*/
 
 	GET_GOT
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
 	mr	r3,  r5				/* Destination Address	*/
 	lis	r4, CONFIG_SYS_MONITOR_BASE@h		/* Source      Address	*/
 	ori	r4, r4, CONFIG_SYS_MONITOR_BASE@l
diff --git a/arch/powerpc/cpu/mpc512x/start.S b/arch/powerpc/cpu/mpc512x/start.S
index 632f967..9c2e4885de 100644
--- a/arch/powerpc/cpu/mpc512x/start.S
+++ b/arch/powerpc/cpu/mpc512x/start.S
@@ -255,11 +255,7 @@
 	/*------------------------------------------------------*/
 
 	GET_GOT			/* initialize GOT access	*/
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
+
 	/* r3: IMMR */
 	lis	r3, CONFIG_SYS_IMMR@h
 	/* run low-level CPU init code (in Flash) */
@@ -490,11 +486,6 @@
 	mr	r10, r5		/* Save copy of Destination Address */
 
 	GET_GOT
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
 	mr	r3,  r5				/* Destination Address */
 	lis	r4, CONFIG_SYS_MONITOR_BASE@h		/* Source      Address */
 	ori	r4, r4, CONFIG_SYS_MONITOR_BASE@l
diff --git a/arch/powerpc/cpu/mpc5xx/start.S b/arch/powerpc/cpu/mpc5xx/start.S
index 4fb2047..cc11c8f 100644
--- a/arch/powerpc/cpu/mpc5xx/start.S
+++ b/arch/powerpc/cpu/mpc5xx/start.S
@@ -174,11 +174,7 @@
 	/*----------------------------------------------------------------------*/
 
 	GET_GOT			/* initialize GOT access			*/
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
+
 	/* r3: IMMR */
 	bl	cpu_init_f	/* run low-level CPU init code     (from Flash)	*/
 
@@ -367,11 +363,6 @@
 	mr	r10, r5		/* Save copy of monitor destination Address in SRAM */
 
 	GET_GOT
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
 	mr	r3,  r5				/* Destination Address	*/
 	lis	r4, CONFIG_SYS_MONITOR_BASE@h		/* Source      Address	*/
 	ori	r4, r4, CONFIG_SYS_MONITOR_BASE@l
diff --git a/arch/powerpc/cpu/mpc5xxx/start.S b/arch/powerpc/cpu/mpc5xxx/start.S
index 0a05361..192aa50 100644
--- a/arch/powerpc/cpu/mpc5xxx/start.S
+++ b/arch/powerpc/cpu/mpc5xxx/start.S
@@ -160,11 +160,7 @@
 	/*--------------------------------------------------------------*/
 
 	GET_GOT			/* initialize GOT access		*/
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
+
 	/* r3: IMMR */
 	bl	cpu_init_f	/* run low-level CPU init code (in Flash)*/
 
@@ -553,11 +549,6 @@
 	mr	r10, r5		/* Save copy of Destination Address	*/
 
 	GET_GOT
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
 	mr	r3,  r5				/* Destination Address	*/
 	lis	r4, CONFIG_SYS_MONITOR_BASE@h		/* Source      Address	*/
 	ori	r4, r4, CONFIG_SYS_MONITOR_BASE@l
diff --git a/arch/powerpc/cpu/mpc8220/start.S b/arch/powerpc/cpu/mpc8220/start.S
index 1df87a6..300b35c 100644
--- a/arch/powerpc/cpu/mpc8220/start.S
+++ b/arch/powerpc/cpu/mpc8220/start.S
@@ -129,11 +129,7 @@
 	/*--------------------------------------------------------------*/
 
 	GET_GOT			/* initialize GOT access		*/
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
+
 	/* r3: IMMR */
 	bl	cpu_init_f	/* run low-level CPU init code (in Flash)*/
 
@@ -526,11 +522,6 @@
 	mr	r10, r5	    /* Save copy of Destination Address */
 
 	GET_GOT
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
 	mr	r3,  r5	    /* Destination Address		*/
 	lis	r4, CONFIG_SYS_MONITOR_BASE@h	/* Source Address	*/
 	ori	r4, r4, CONFIG_SYS_MONITOR_BASE@l
diff --git a/arch/powerpc/cpu/mpc824x/start.S b/arch/powerpc/cpu/mpc824x/start.S
index cc98875..fc4e922 100644
--- a/arch/powerpc/cpu/mpc824x/start.S
+++ b/arch/powerpc/cpu/mpc824x/start.S
@@ -183,11 +183,7 @@
 	/*----------------------------------------------------------------------*/
 
 	GET_GOT			/* initialize GOT access			*/
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
+
 	/* r3: IMMR */
 	bl	cpu_init_f	/* run low-level CPU init code     (from Flash)	*/
 
@@ -456,11 +452,6 @@
 	mr	r10, r5		/* Save copy of Destination Address	*/
 
 	GET_GOT
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
 	mr	r3,  r5				/* Destination Address	*/
 #ifdef CONFIG_SYS_RAMBOOT
 	lis	r4, CONFIG_SYS_SDRAM_BASE@h		/* Source      Address	*/
diff --git a/arch/powerpc/cpu/mpc8260/start.S b/arch/powerpc/cpu/mpc8260/start.S
index 23151cd..702546e 100644
--- a/arch/powerpc/cpu/mpc8260/start.S
+++ b/arch/powerpc/cpu/mpc8260/start.S
@@ -236,11 +236,7 @@
 	/*--------------------------------------------------------------*/
 
 	GET_GOT			/* initialize GOT access		*/
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
+
 	/* r3: IMMR */
 	bl	cpu_init_f	/* run low-level CPU init code (in Flash)*/
 
diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
index a9acb83..7e60315 100644
--- a/arch/powerpc/cpu/mpc83xx/start.S
+++ b/arch/powerpc/cpu/mpc83xx/start.S
@@ -285,11 +285,7 @@
 	/*------------------------------------------------------*/
 
 	GET_GOT			/* initialize GOT access	*/
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
+
 	/* r3: IMMR */
 	lis	r3, CONFIG_SYS_IMMR@h
 	/* run low-level CPU init code (in Flash)*/
@@ -826,11 +822,6 @@
 	mr	r10, r5		/* Save copy of Destination Address */
 
 	GET_GOT
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
 	mr	r3,  r5				/* Destination Address */
 	lis	r4, CONFIG_SYS_MONITOR_BASE@h		/* Source      Address */
 	ori	r4, r4, CONFIG_SYS_MONITOR_BASE@l
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index 3623357..5777493 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -421,11 +421,6 @@
 	stw	r0,+12(r1)		/* Save return addr (underflow vect) */
 
 	GET_GOT
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
 	bl	cpu_init_early_f
 
 	/* switch back to AS = 0 */
@@ -926,11 +921,6 @@
 	mr	r10,r5		/* Save copy of Destination Address	*/
 
 	GET_GOT
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
 	mr	r3,r5				/* Destination Address	*/
 	lis	r4,CONFIG_SYS_MONITOR_BASE@h		/* Source      Address	*/
 	ori	r4,r4,CONFIG_SYS_MONITOR_BASE@l
diff --git a/arch/powerpc/cpu/mpc86xx/start.S b/arch/powerpc/cpu/mpc86xx/start.S
index 2ec7fd4..3e3c21e 100644
--- a/arch/powerpc/cpu/mpc86xx/start.S
+++ b/arch/powerpc/cpu/mpc86xx/start.S
@@ -255,11 +255,7 @@
 	stwu	r0, -4(r1)	/* stack backtraces terminate cleanly	*/
 
 	GET_GOT			/* initialize GOT access	*/
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
+
 	/* run low-level CPU init code	   (from Flash) */
 	bl	cpu_init_f
 	sync
@@ -624,11 +620,6 @@
 	mr	r10, r5		/* Save copy of Destination Address	*/
 
 	GET_GOT
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
 	mr	r3,  r5				/* Destination Address	*/
 	lis	r4, CONFIG_SYS_MONITOR_BASE@h		/* Source      Address	*/
 	ori	r4, r4, CONFIG_SYS_MONITOR_BASE@l
diff --git a/arch/powerpc/cpu/mpc8xx/start.S b/arch/powerpc/cpu/mpc8xx/start.S
index f8256bf..fe3daa2 100644
--- a/arch/powerpc/cpu/mpc8xx/start.S
+++ b/arch/powerpc/cpu/mpc8xx/start.S
@@ -188,11 +188,7 @@
 	/*----------------------------------------------------------------------*/
 
 	GET_GOT			/* initialize GOT access			*/
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
+
 	/* r3: IMMR */
 	bl	cpu_init_f	/* run low-level CPU init code     (from Flash)	*/
 
@@ -477,11 +473,6 @@
 	mr	r10, r5		/* Save copy of Destination Address	*/
 
 	GET_GOT
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
 	mr	r3,  r5				/* Destination Address	*/
 	lis	r4, CONFIG_SYS_MONITOR_BASE@h		/* Source      Address	*/
 	ori	r4, r4, CONFIG_SYS_MONITOR_BASE@l
diff --git a/arch/powerpc/cpu/ppc4xx/start.S b/arch/powerpc/cpu/ppc4xx/start.S
index aa03d9a..b43e22c 100644
--- a/arch/powerpc/cpu/ppc4xx/start.S
+++ b/arch/powerpc/cpu/ppc4xx/start.S
@@ -262,11 +262,6 @@
 	bl	reconfig_tlb0
 #endif
 	GET_GOT
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
 	bl	cpu_init_f	/* run low-level CPU init code	   (from Flash) */
 	bl	board_init_f
 	/* NOTREACHED - board_init_f() does not return */
@@ -804,11 +799,7 @@
 	ori	r0,r0, RESET_VECTOR@l
 	stwu	r1,-8(r1)		/* Save back chain and move SP */
 	stw	r0,+12(r1)		/* Save return addr (underflow vect) */
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
+
 #ifdef CONFIG_NAND_SPL
 	bl	nand_boot_common	/* will not return */
 #else
@@ -923,11 +914,7 @@
 	stwu	r0, -4(r1)		/* stack backtraces terminate cleanly	*/
 
 	GET_GOT			/* initialize GOT access			*/
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
+
 	bl	board_init_f	/* run first part of init code (from Flash)	*/
 	/* NOTREACHED - board_init_f() does not return */
 
@@ -1192,11 +1179,6 @@
 	stw	r0, +12(r1)		/* Save return addr (underflow vect) */
 #endif /* CONFIG_SYS_INIT_DCACHE_CS */
 
-#if defined(__pic__) && __pic__ == 1
-	/* Needed for upcoming -msingle-pic-base */
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r30
-#endif
 #ifdef CONFIG_NAND_SPL
 	bl	nand_boot_common	/* will not return */
 #else
diff --git a/arch/i386/config.mk b/arch/x86/config.mk
similarity index 100%
rename from arch/i386/config.mk
rename to arch/x86/config.mk
diff --git a/arch/i386/cpu/Makefile b/arch/x86/cpu/Makefile
similarity index 100%
rename from arch/i386/cpu/Makefile
rename to arch/x86/cpu/Makefile
diff --git a/arch/i386/cpu/config.mk b/arch/x86/cpu/config.mk
similarity index 94%
rename from arch/i386/cpu/config.mk
rename to arch/x86/cpu/config.mk
index 9b2e2c9..d1b528a 100644
--- a/arch/i386/cpu/config.mk
+++ b/arch/x86/cpu/config.mk
@@ -23,7 +23,7 @@
 
 CROSS_COMPILE ?= i386-linux-
 
-PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__ -march=i386 -Werror
+PLATFORM_CPPFLAGS += -DCONFIG_X86 -D__I386__ -march=i386 -Werror
 
 # DO NOT MODIFY THE FOLLOWING UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!
 LDPPFLAGS += -DRESET_SEG_START=0xffff0000
diff --git a/arch/i386/cpu/cpu.c b/arch/x86/cpu/cpu.c
similarity index 89%
rename from arch/i386/cpu/cpu.c
rename to arch/x86/cpu/cpu.c
index 2339cd4..0c5d7c3 100644
--- a/arch/i386/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -1,6 +1,9 @@
 /*
+ * (C) Copyright 2008-2011
+ * Graeme Russ, <graeme.russ@gmail.com>
+ *
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * (C) Copyright 2002
  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
@@ -29,18 +32,16 @@
  * MA 02111-1307 USA
  */
 
-/*
- * CPU specific code
- */
-
 #include <common.h>
 #include <command.h>
 #include <asm/processor.h>
 #include <asm/processor-flags.h>
 #include <asm/interrupt.h>
 
-/* Constructor for a conventional segment GDT (or LDT) entry */
-/* This is a macro so it can be used in initializers */
+/*
+ * Constructor for a conventional segment GDT (or LDT) entry
+ * This is a macro so it can be used in initialisers
+ */
 #define GDT_ENTRY(flags, base, limit)			\
 	((((base)  & 0xff000000ULL) << (56-24)) |	\
 	 (((flags) & 0x0000f0ffULL) << 40) |		\
@@ -48,10 +49,6 @@
 	 (((base)  & 0x00ffffffULL) << 16) |		\
 	 (((limit) & 0x0000ffffULL)))
 
-/*
- * Set up the GDT
- */
-
 struct gdt_ptr {
 	u16 len;
 	u32 ptr;
@@ -59,8 +56,10 @@
 
 static void reload_gdt(void)
 {
-	/* There are machines which are known to not boot with the GDT
-	   being 8-byte unaligned.  Intel recommends 16 byte alignment. */
+	/*
+	 * There are machines which are known to not boot with the GDT
+	 * being 8-byte unaligned.  Intel recommends 16 byte alignment
+	 */
 	static const u64 boot_gdt[] __attribute__((aligned(16))) = {
 		/* CS: code, read/execute, 4 GB, base 0 */
 		[GDT_ENTRY_32BIT_CS] = GDT_ENTRY(0xc09b, 0, 0xfffff),
@@ -86,7 +85,6 @@
 		     : : "m" (gdt) : "ecx");
 }
 
-
 int x86_cpu_init_f(void)
 {
 	const u32 em_rst = ~X86_CR0_EM;
@@ -125,7 +123,9 @@
 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	printf ("resetting ...\n");
-	udelay(50000);				/* wait 50 ms */
+
+	/* wait 50 ms */
+	udelay(50000);
 	disable_interrupts();
 	reset_cpu(0);
 
@@ -136,7 +136,6 @@
 void  flush_cache (unsigned long dummy1, unsigned long dummy2)
 {
 	asm("wbinvd\n");
-	return;
 }
 
 void __attribute__ ((regparm(0))) generate_gpf(void);
@@ -150,7 +149,7 @@
 
 void __reset_cpu(ulong addr)
 {
-	printf("Resetting using i386 Triple Fault\n");
+	printf("Resetting using x86 Triple Fault\n");
 	set_vector(13, generate_gpf);  /* general protection fault handler */
 	set_vector(8, generate_gpf);   /* double fault handler */
 	generate_gpf();                /* start the show */
diff --git a/arch/i386/cpu/interrupts.c b/arch/x86/cpu/interrupts.c
similarity index 98%
rename from arch/i386/cpu/interrupts.c
rename to arch/x86/cpu/interrupts.c
index 1cefe02..62bcadc 100644
--- a/arch/i386/cpu/interrupts.c
+++ b/arch/x86/cpu/interrupts.c
@@ -1,9 +1,9 @@
 /*
- * (C) Copyright 2008
- * Graeme Russ, graeme.russ@gmail.com.
+ * (C) Copyright 2008-2011
+ * Graeme Russ, <graeme.russ@gmail.com>
  *
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * Portions of this file are derived from the Linux kernel source
  *  Copyright (C) 1991, 1992  Linus Torvalds
@@ -45,7 +45,7 @@
  * read/write functions for the control registers and messing everything up.
  * A memory clobber would solve the problem, but would prevent reordering of
  * all loads stores around it, which can hurt performance. Solution is to
- * use a variable and mimic reads and writes to it to enforce serialization
+ * use a variable and mimic reads and writes to it to enforce serialisation
  */
 static unsigned long __force_order;
 
diff --git a/arch/i386/cpu/resetvec.S b/arch/x86/cpu/resetvec.S
similarity index 89%
rename from arch/i386/cpu/resetvec.S
rename to arch/x86/cpu/resetvec.S
index d9222dd..c690d25 100644
--- a/arch/i386/cpu/resetvec.S
+++ b/arch/x86/cpu/resetvec.S
@@ -1,7 +1,8 @@
 /*
- *  U-boot - i386 Startup Code
+ *  U-boot - x86 Startup Code
  *
- *  Copyright (c) 2002	Omicron Ceti AB, Daniel Engström <denaiel@omicron.se>
+ * (C) Copyright 2002
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
diff --git a/arch/i386/cpu/sc520/Makefile b/arch/x86/cpu/sc520/Makefile
similarity index 96%
rename from arch/i386/cpu/sc520/Makefile
rename to arch/x86/cpu/sc520/Makefile
index 54260b6..694b61e 100644
--- a/arch/i386/cpu/sc520/Makefile
+++ b/arch/x86/cpu/sc520/Makefile
@@ -33,6 +33,7 @@
 
 COBJS-$(CONFIG_SYS_SC520) += sc520.o
 COBJS-$(CONFIG_PCI) += sc520_pci.o
+COBJS-$(CONFIG_SYS_SC520_RESET) += sc520_reset.o
 COBJS-$(CONFIG_SYS_SC520) += sc520_sdram.o
 COBJS-$(CONFIG_SYS_SC520_SSI) += sc520_ssi.o
 COBJS-$(CONFIG_SYS_SC520_TIMER) += sc520_timer.o
diff --git a/arch/i386/cpu/sc520/sc520.c b/arch/x86/cpu/sc520/sc520.c
similarity index 82%
rename from arch/i386/cpu/sc520/sc520.c
rename to arch/x86/cpu/sc520/sc520.c
index d0c313b..8c410a2 100644
--- a/arch/i386/cpu/sc520/sc520.c
+++ b/arch/x86/cpu/sc520/sc520.c
@@ -1,6 +1,9 @@
 /*
+ * (C) Copyright 2008-2011
+ * Graeme Russ, <graeme.russ@gmail.com>
+ *
  * (C) Copyright 2002
- * Daniel Engstr�m, Omicron Ceti AB <daniel@omicron.se>.
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -21,9 +24,6 @@
  * MA 02111-1307 USA
  */
 
-/* stuff specific for the sc520,
- * but idependent of implementation */
-
 #include <common.h>
 #include <asm/io.h>
 #include <asm/processor-flags.h>
@@ -65,13 +65,3 @@
 	return x86_cpu_init_r();
 }
 
-#ifdef CONFIG_SYS_SC520_RESET
-void reset_cpu(ulong addr)
-{
-	printf("Resetting using SC520 MMCR\n");
-	/* Write a '1' to the SYS_RST of the RESCFG MMCR */
-	writeb(0x01, &sc520_mmcr->rescfg);
-
-	/* NOTREACHED */
-}
-#endif
diff --git a/arch/i386/cpu/sc520/sc520_car.S b/arch/x86/cpu/sc520/sc520_car.S
similarity index 97%
rename from arch/i386/cpu/sc520/sc520_car.S
rename to arch/x86/cpu/sc520/sc520_car.S
index 22f5225..a33f94f 100644
--- a/arch/i386/cpu/sc520/sc520_car.S
+++ b/arch/x86/cpu/sc520/sc520_car.S
@@ -1,6 +1,6 @@
 /*
- * (C) Copyright 2010
- * Graeme Russ <graeme.russ@gmail.com>.
+ * (C) Copyright 2010-2011
+ * Graeme Russ, <graeme.russ@gmail.com>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -21,7 +21,6 @@
  * MA 02111-1307 USA
  */
 
-
 #include <config.h>
 #include <asm/processor-flags.h>
 #include <asm/ic/sc520.h>
diff --git a/arch/i386/cpu/sc520/sc520_pci.c b/arch/x86/cpu/sc520/sc520_pci.c
similarity index 94%
rename from arch/i386/cpu/sc520/sc520_pci.c
rename to arch/x86/cpu/sc520/sc520_pci.c
index b917734..8cd7ffe 100644
--- a/arch/i386/cpu/sc520/sc520_pci.c
+++ b/arch/x86/cpu/sc520/sc520_pci.c
@@ -1,6 +1,9 @@
 /*
+ * (C) Copyright 2008-2011
+ * Graeme Russ, <graeme.russ@gmail.com>
+ *
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB <daniel@omicron.se>.
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -21,8 +24,6 @@
  * MA 02111-1307 USA
  */
 
-/* stuff specific for the sc520, but independent of implementation */
-
 #include <common.h>
 #include <pci.h>
 #include <asm/io.h>
@@ -54,7 +55,6 @@
 	{ SC520_IRQ15, 1, 0x80 }
 };
 
-
 /* The interrupt used for PCI INTA-INTD  */
 int sc520_pci_ints[15] = {
 	-1, -1, -1, -1, -1, -1, -1, -1,
@@ -68,9 +68,8 @@
 	u8 tmpb;
 	u16 tmpw;
 
-# if 1
-	printf("set_irq(): map INT%c to IRQ%d\n", pci_pin + 'A', irq);
-#endif
+	debug("set_irq(): map INT%c to IRQ%d\n", pci_pin + 'A', irq);
+
 	if (irq < 0 || irq > 15) {
 		return -1; /* illegal irq */
 	}
@@ -138,5 +137,4 @@
 	/* enable target memory acceses on host brige */
 	pci_write_config_word(0, PCI_COMMAND,
 			      PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
-
 }
diff --git a/arch/i386/cpu/resetvec.S b/arch/x86/cpu/sc520/sc520_reset.c
similarity index 65%
copy from arch/i386/cpu/resetvec.S
copy to arch/x86/cpu/sc520/sc520_reset.c
index d9222dd..79ef976 100644
--- a/arch/i386/cpu/resetvec.S
+++ b/arch/x86/cpu/sc520/sc520_reset.c
@@ -1,7 +1,9 @@
 /*
- *  U-boot - i386 Startup Code
+ * (C) Copyright 2011
+ * Graeme Russ, <graeme.russ@gmail.com>
  *
- *  Copyright (c) 2002	Omicron Ceti AB, Daniel Engström <denaiel@omicron.se>
+ * (C) Copyright 2002
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -22,16 +24,17 @@
  * MA 02111-1307 USA
  */
 
-/* Reset vector, jumps to start16.S */
+#include <common.h>
+#include <asm/io.h>
+#include <asm/ic/sc520.h>
 
-.extern start16
+DECLARE_GLOBAL_DATA_PTR;
 
-.section .resetvec, "ax"
-.code16
-reset_vector:
-	cli
-	cld
-	jmp start16
+void reset_cpu(ulong addr)
+{
+	printf("Resetting using SC520 MMCR\n");
+	/* Write a '1' to the SYS_RST of the RESCFG MMCR */
+	writeb(0x01, &sc520_mmcr->rescfg);
 
-	.org 0xf
-	nop
+	/* NOTREACHED */
+}
diff --git a/arch/i386/cpu/sc520/sc520_sdram.c b/arch/x86/cpu/sc520/sc520_sdram.c
similarity index 99%
rename from arch/i386/cpu/sc520/sc520_sdram.c
rename to arch/x86/cpu/sc520/sc520_sdram.c
index d5ab55d..f3623f5 100644
--- a/arch/i386/cpu/sc520/sc520_sdram.c
+++ b/arch/x86/cpu/sc520/sc520_sdram.c
@@ -1,6 +1,6 @@
 /*
- * (C) Copyright 2010
- * Graeme Russ <graeme.russ@gmail.com>.
+ * (C) Copyright 2010,2011
+ * Graeme Russ, <graeme.russ@gmail.com>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
diff --git a/arch/i386/cpu/sc520/sc520_ssi.c b/arch/x86/cpu/sc520/sc520_ssi.c
similarity index 94%
rename from arch/i386/cpu/sc520/sc520_ssi.c
rename to arch/x86/cpu/sc520/sc520_ssi.c
index 6e5e346..ac58d25 100644
--- a/arch/i386/cpu/sc520/sc520_ssi.c
+++ b/arch/x86/cpu/sc520/sc520_ssi.c
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB <daniel@omicron.se>.
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -21,8 +21,6 @@
  * MA 02111-1307 USA
  */
 
-/* stuff specific for the sc520, but independent of implementation */
-
 #include <common.h>
 #include <asm/io.h>
 #include <asm/ic/ssi.h>
@@ -77,7 +75,6 @@
 	return readb(&sc520_mmcr->ssircv);
 }
 
-
 void ssi_tx_byte(u8 data)
 {
 	writeb(data, &sc520_mmcr->ssixmit);
diff --git a/arch/i386/cpu/sc520/sc520_timer.c b/arch/x86/cpu/sc520/sc520_timer.c
similarity index 94%
rename from arch/i386/cpu/sc520/sc520_timer.c
rename to arch/x86/cpu/sc520/sc520_timer.c
index d5617e9..1bcfe67 100644
--- a/arch/i386/cpu/sc520/sc520_timer.c
+++ b/arch/x86/cpu/sc520/sc520_timer.c
@@ -1,6 +1,9 @@
 /*
+ * (C) Copyright 2008-2011
+ * Graeme Russ, <graeme.russ@gmail.com>
+ *
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB <daniel@omicron.se>.
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -21,8 +24,6 @@
  * MA 02111-1307 USA
  */
 
-/* stuff specific for the sc520, but independent of implementation */
-
 #include <common.h>
 #include <asm/io.h>
 #include <asm/interrupt.h>
diff --git a/arch/i386/cpu/start.S b/arch/x86/cpu/start.S
similarity index 84%
rename from arch/i386/cpu/start.S
rename to arch/x86/cpu/start.S
index 0031389..7ccc076 100644
--- a/arch/i386/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -1,7 +1,11 @@
 /*
- *  U-boot - i386 Startup Code
+ *  U-boot - x86 Startup Code
  *
- *  Copyright (c) 2002	Omicron Ceti AB, Daniel Engström <denaiel@omicron.se>
+ * (C) Copyright 2008-2011
+ * Graeme Russ, <graeme.russ@gmail.com>
+ *
+ * (C) Copyright 2002
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -22,19 +26,17 @@
  * MA 02111-1307 USA
  */
 
-
 #include <config.h>
 #include <version.h>
 #include <asm/global_data.h>
 #include <asm/processor-flags.h>
 
-
 .section .text
 .code32
 .globl _start
 .type _start, @function
-.globl _i386boot_start
-_i386boot_start:
+.globl _x86boot_start
+_x86boot_start:
 	/*
 	 * This is the fail safe 32-bit bootstrap entry point. The
 	 * following code is not executed from a cold-reset (actually, a
@@ -56,8 +58,8 @@
 _start:
 	/* This is the 32-bit cold-reset entry point */
 
-	movl	$0x18, %eax	/* Load our segement registes, the
-				 * gdt have already been loaded by start16.S */
+	/* Load the segement registes to match the gdt loaded in start16.S */
+	movl	$0x18, %eax
 	movw	%ax, %fs
 	movw	%ax, %ds
 	movw	%ax, %gs
@@ -82,21 +84,13 @@
 	 * starting at CONFIG_SYS_CAR_ADDR to be used as a temporary stack
 	 */
 	movl	$CONFIG_SYS_INIT_SP_ADDR, %esp
-	movl	$CONFIG_SYS_INIT_GD_ADDR, %ebp
-
-	/* Set Boot Flags in Global Data */
-	movl	%ebx, (GD_FLAGS * 4)(%ebp)
-
-	/* Determine our load offset (and put in Global Data) */
-	call	1f
-1:	popl	%ecx
-	subl	$1b, %ecx
-	movl	%ecx, (GD_LOAD_OFF * 4)(%ebp)
 
 	/* Set parameter to board_init_f() to boot flags */
-	movl	(GD_FLAGS * 4)(%ebp), %eax
+	xorl	%eax, %eax
+	movw	%bx, %ax
 
-	call	board_init_f	/* Enter, U-boot! */
+	/* Enter, U-boot! */
+	call	board_init_f
 
 	/* indicate (lack of) progress */
 	movw	$0x85, %ax
diff --git a/arch/i386/cpu/start16.S b/arch/x86/cpu/start16.S
similarity index 93%
rename from arch/i386/cpu/start16.S
rename to arch/x86/cpu/start16.S
index 7dc5358..f1b9d0a 100644
--- a/arch/i386/cpu/start16.S
+++ b/arch/x86/cpu/start16.S
@@ -1,7 +1,11 @@
 /*
- *  U-boot - i386 Startup Code
+ *  U-boot - x86 Startup Code
+ *
+ * (C) Copyright 2008-2011
+ * Graeme Russ, <graeme.russ@gmail.com>
  *
- *  Copyright (c) 2002, 2003 Omicron Ceti AB, Daniel Engström <denaiel@omicron.se>
+ * (C) Copyright 2002,2003
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
diff --git a/arch/i386/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds
similarity index 90%
rename from arch/i386/cpu/u-boot.lds
rename to arch/x86/cpu/u-boot.lds
index 98a548d..5597422 100644
--- a/arch/i386/cpu/u-boot.lds
+++ b/arch/x86/cpu/u-boot.lds
@@ -21,6 +21,7 @@
  * MA 02111-1307 USA
  */
 
+#include <config.h>
 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
 OUTPUT_ARCH(i386)
 ENTRY(_start)
@@ -89,8 +90,8 @@
 	 * Reset Vector at the end of the Flash ROM
 	 */
 	. = START_16;
-	.start16 : AT (CONFIG_SYS_TEXT_BASE + (FLASH_SIZE - RESET_SEG_SIZE + START_16)) { KEEP(*(.start16)); }
+	.start16 : AT (CONFIG_SYS_TEXT_BASE + (CONFIG_SYS_MONITOR_LEN - RESET_SEG_SIZE + START_16)) { KEEP(*(.start16)); }
 
 	. = RESET_VEC_LOC;
-	.resetvec : AT (CONFIG_SYS_TEXT_BASE + (FLASH_SIZE - RESET_SEG_SIZE + RESET_VEC_LOC)) { KEEP(*(.resetvec)); }
+	.resetvec : AT (CONFIG_SYS_TEXT_BASE + (CONFIG_SYS_MONITOR_LEN - RESET_SEG_SIZE + RESET_VEC_LOC)) { KEEP(*(.resetvec)); }
 }
diff --git a/arch/i386/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
similarity index 100%
rename from arch/i386/include/asm/bitops.h
rename to arch/x86/include/asm/bitops.h
diff --git a/arch/i386/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h
similarity index 100%
rename from arch/i386/include/asm/bootparam.h
rename to arch/x86/include/asm/bootparam.h
diff --git a/arch/i386/include/asm/byteorder.h b/arch/x86/include/asm/byteorder.h
similarity index 100%
rename from arch/i386/include/asm/byteorder.h
rename to arch/x86/include/asm/byteorder.h
diff --git a/arch/i386/include/asm/config.h b/arch/x86/include/asm/config.h
similarity index 100%
rename from arch/i386/include/asm/config.h
rename to arch/x86/include/asm/config.h
diff --git a/arch/i386/include/asm/e820.h b/arch/x86/include/asm/e820.h
similarity index 100%
rename from arch/i386/include/asm/e820.h
rename to arch/x86/include/asm/e820.h
diff --git a/arch/i386/include/asm/errno.h b/arch/x86/include/asm/errno.h
similarity index 100%
rename from arch/i386/include/asm/errno.h
rename to arch/x86/include/asm/errno.h
diff --git a/arch/i386/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
similarity index 100%
rename from arch/i386/include/asm/global_data.h
rename to arch/x86/include/asm/global_data.h
diff --git a/arch/i386/include/asm/i8254.h b/arch/x86/include/asm/i8254.h
similarity index 100%
rename from arch/i386/include/asm/i8254.h
rename to arch/x86/include/asm/i8254.h
diff --git a/arch/i386/include/asm/i8259.h b/arch/x86/include/asm/i8259.h
similarity index 100%
rename from arch/i386/include/asm/i8259.h
rename to arch/x86/include/asm/i8259.h
diff --git a/arch/i386/include/asm/ibmpc.h b/arch/x86/include/asm/ibmpc.h
similarity index 100%
rename from arch/i386/include/asm/ibmpc.h
rename to arch/x86/include/asm/ibmpc.h
diff --git a/arch/i386/include/asm/ic/pci.h b/arch/x86/include/asm/ic/pci.h
similarity index 100%
rename from arch/i386/include/asm/ic/pci.h
rename to arch/x86/include/asm/ic/pci.h
diff --git a/arch/i386/include/asm/ic/sc520.h b/arch/x86/include/asm/ic/sc520.h
similarity index 100%
rename from arch/i386/include/asm/ic/sc520.h
rename to arch/x86/include/asm/ic/sc520.h
diff --git a/arch/i386/include/asm/ic/ssi.h b/arch/x86/include/asm/ic/ssi.h
similarity index 100%
rename from arch/i386/include/asm/ic/ssi.h
rename to arch/x86/include/asm/ic/ssi.h
diff --git a/arch/i386/include/asm/interrupt.h b/arch/x86/include/asm/interrupt.h
similarity index 94%
rename from arch/i386/include/asm/interrupt.h
rename to arch/x86/include/asm/interrupt.h
index d32ef8b..be52fe4 100644
--- a/arch/i386/include/asm/interrupt.h
+++ b/arch/x86/include/asm/interrupt.h
@@ -29,10 +29,10 @@
 
 #include <asm/types.h>
 
-/* arch/i386/cpu/interrupts.c */
+/* arch/x86/cpu/interrupts.c */
 void set_vector(u8 intnum, void *routine);
 
-/* arch/i386/lib/interupts.c */
+/* arch/x86/lib/interupts.c */
 void disable_irq(int irq);
 void enable_irq(int irq);
 
diff --git a/arch/i386/include/asm/io.h b/arch/x86/include/asm/io.h
similarity index 100%
rename from arch/i386/include/asm/io.h
rename to arch/x86/include/asm/io.h
diff --git a/arch/i386/include/asm/ioctl.h b/arch/x86/include/asm/ioctl.h
similarity index 100%
rename from arch/i386/include/asm/ioctl.h
rename to arch/x86/include/asm/ioctl.h
diff --git a/arch/i386/include/asm/ist.h b/arch/x86/include/asm/ist.h
similarity index 100%
rename from arch/i386/include/asm/ist.h
rename to arch/x86/include/asm/ist.h
diff --git a/arch/i386/include/asm/pci.h b/arch/x86/include/asm/pci.h
similarity index 100%
rename from arch/i386/include/asm/pci.h
rename to arch/x86/include/asm/pci.h
diff --git a/arch/i386/include/asm/posix_types.h b/arch/x86/include/asm/posix_types.h
similarity index 100%
rename from arch/i386/include/asm/posix_types.h
rename to arch/x86/include/asm/posix_types.h
diff --git a/arch/i386/include/asm/processor-flags.h b/arch/x86/include/asm/processor-flags.h
similarity index 100%
rename from arch/i386/include/asm/processor-flags.h
rename to arch/x86/include/asm/processor-flags.h
diff --git a/arch/i386/include/asm/processor.h b/arch/x86/include/asm/processor.h
similarity index 100%
rename from arch/i386/include/asm/processor.h
rename to arch/x86/include/asm/processor.h
diff --git a/arch/i386/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
similarity index 100%
rename from arch/i386/include/asm/ptrace.h
rename to arch/x86/include/asm/ptrace.h
diff --git a/arch/i386/include/asm/realmode.h b/arch/x86/include/asm/realmode.h
similarity index 100%
rename from arch/i386/include/asm/realmode.h
rename to arch/x86/include/asm/realmode.h
diff --git a/arch/i386/include/asm/string.h b/arch/x86/include/asm/string.h
similarity index 100%
rename from arch/i386/include/asm/string.h
rename to arch/x86/include/asm/string.h
diff --git a/arch/i386/include/asm/types.h b/arch/x86/include/asm/types.h
similarity index 100%
rename from arch/i386/include/asm/types.h
rename to arch/x86/include/asm/types.h
diff --git a/arch/i386/include/asm/u-boot-i386.h b/arch/x86/include/asm/u-boot-x86.h
similarity index 92%
rename from arch/i386/include/asm/u-boot-i386.h
rename to arch/x86/include/asm/u-boot-x86.h
index 7b39bd2..944e1a2 100644
--- a/arch/i386/include/asm/u-boot-i386.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -35,7 +35,7 @@
 typedef void (timer_fnc_t) (void);
 int register_timer_isr (timer_fnc_t *isr_func);
 
-/* Architecture specific - can be in arch/i386/cpu/, arch/i386/lib/, or $(BOARD)/ */
+/* Architecture specific - can be in arch/x86/cpu/, arch/x86/lib/, or $(BOARD)/ */
 int timer_init(void);
 int dram_init_f(void);
 
@@ -51,7 +51,7 @@
 void isa_unmap_rom(u32 addr);
 u32 isa_map_rom(u32 bus_addr, int size);
 
-/* arch/i386/lib/... */
+/* arch/x86/lib/... */
 int video_bios_init(void);
 int video_init(void);
 
diff --git a/arch/i386/include/asm/u-boot.h b/arch/x86/include/asm/u-boot.h
similarity index 100%
rename from arch/i386/include/asm/u-boot.h
rename to arch/x86/include/asm/u-boot.h
diff --git a/arch/i386/include/asm/unaligned.h b/arch/x86/include/asm/unaligned.h
similarity index 100%
rename from arch/i386/include/asm/unaligned.h
rename to arch/x86/include/asm/unaligned.h
diff --git a/arch/i386/include/asm/video/edid.h b/arch/x86/include/asm/video/edid.h
similarity index 100%
rename from arch/i386/include/asm/video/edid.h
rename to arch/x86/include/asm/video/edid.h
diff --git a/arch/i386/include/asm/zimage.h b/arch/x86/include/asm/zimage.h
similarity index 100%
rename from arch/i386/include/asm/zimage.h
rename to arch/x86/include/asm/zimage.h
diff --git a/arch/i386/lib/Makefile b/arch/x86/lib/Makefile
similarity index 100%
rename from arch/i386/lib/Makefile
rename to arch/x86/lib/Makefile
diff --git a/arch/i386/lib/bios.S b/arch/x86/lib/bios.S
similarity index 99%
rename from arch/i386/lib/bios.S
rename to arch/x86/lib/bios.S
index 48f1b81..660a244 100644
--- a/arch/i386/lib/bios.S
+++ b/arch/x86/lib/bios.S
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -42,7 +42,6 @@
  * a general purpose replacement for a real BIOS !!
  */
 
-
 .section .bios, "ax"
 .code16
 .org 0
diff --git a/arch/i386/lib/bios.h b/arch/x86/lib/bios.h
similarity index 81%
rename from arch/i386/lib/bios.h
rename to arch/x86/lib/bios.h
index 4901f89..3c8d61a 100644
--- a/arch/i386/lib/bios.h
+++ b/arch/x86/lib/bios.h
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -57,7 +57,7 @@
 #define OFFS_FLAGS   44    /* 16bit */
 
 #define SEGMENT      0x40
-#define STACK	     0x800			/* stack at 0x40:0x800 -> 0x800 */
+#define STACK	     0x800	/* stack at 0x40:0x800 -> 0x800 */
 
 /* save general registers */
 /* save some segments     */
@@ -67,28 +67,26 @@
 	/* setup BIOS stackpointer */
 
 #define MAKE_BIOS_STACK \
-	pushal		; \
-	pushw	%ds	; \
-	pushw	%gs	; \
-	pushw	%es	; \
-	pushw	%ss	; \
-	popw	%gs	; \
-	movw	$SEGMENT,%ax ; \
-	movw	%ax,%ds	; \
-	movw	%ax,%es	; \
-	movw	%ax,%ss	; \
-	movw	%sp,%bp	; \
-	movw	$STACK,%sp
+	pushal; \
+	pushw	%ds; \
+	pushw	%gs; \
+	pushw	%es; \
+	pushw	%ss; \
+	popw	%gs; \
+	movw	$SEGMENT, %ax; \
+	movw	%ax, %ds; \
+	movw	%ax, %es; \
+	movw	%ax, %ss; \
+	movw	%sp, %bp; \
+	movw	$STACK, %sp
 
 #define RESTORE_CALLERS_STACK \
-	pushw	%gs     ;			/* restore callers stack segment */ \
-	popw	%ss     ; \
-	movw	%bp,%sp	;			/* restore stackpointer */ \
-		\
-	popw	%es	;			/* restore segment selectors */ \
-	popw	%gs     ; \
-	popw	%ds     ; \
-		\
-	popal					/* restore GP registers */
+	pushw	%gs;		/* restore callers stack segment */ \
+	popw	%ss; \
+	movw	%bp, %sp;	/* restore stackpointer */ \
+	popw	%es;		/* restore segment selectors */ \
+	popw	%gs; \
+	popw	%ds; \
+	popal			/* restore GP registers */
 
 #endif
diff --git a/arch/i386/lib/bios_pci.S b/arch/x86/lib/bios_pci.S
similarity index 100%
rename from arch/i386/lib/bios_pci.S
rename to arch/x86/lib/bios_pci.S
diff --git a/arch/i386/lib/bios_setup.c b/arch/x86/lib/bios_setup.c
similarity index 98%
rename from arch/i386/lib/bios_setup.c
rename to arch/x86/lib/bios_setup.c
index 75407c1..6949b350 100644
--- a/arch/i386/lib/bios_setup.c
+++ b/arch/x86/lib/bios_setup.c
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -21,7 +21,6 @@
  * MA 02111-1307 USA
  */
 
-
 /*
  * Partly based on msbios.c from rolo 1.6:
  *----------------------------------------------------------------------
diff --git a/arch/i386/lib/board.c b/arch/x86/lib/board.c
similarity index 95%
rename from arch/i386/lib/board.c
rename to arch/x86/lib/board.c
index e0f9803..df54222 100644
--- a/arch/i386/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -1,9 +1,12 @@
 /*
+ * (C) Copyright 2008-2011
+ * Graeme Russ, <graeme.russ@gmail.com>
+ *
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * (C) Copyright 2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
  *
  * (C) Copyright 2002
  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
@@ -38,7 +41,7 @@
 #include <net.h>
 #include <ide.h>
 #include <serial.h>
-#include <asm/u-boot-i386.h>
+#include <asm/u-boot-x86.h>
 #include <elf.h>
 
 #ifdef CONFIG_BITBANGMII
@@ -103,13 +106,6 @@
 	return (0);
 }
 
-/*
- * WARNING: this code looks "cleaner" than the PowerPC version, but
- * has the disadvantage that you either get nothing, or everything.
- * On PowerPC, you might see "DRAM: " before the system hangs - which
- * gives a simple yet clear indication which part of the
- * initialization if failing.
- */
 static int display_dram_config (void)
 {
 	int i;
@@ -141,7 +137,6 @@
  * can relocate the monitor code to RAM.
  */
 
-
 /*
  * All attempts to come up with a "common" initialization sequence
  * that works for all boards and architectures failed: some of the
@@ -251,13 +246,13 @@
 	return 0;
 }
 
-/*
- * Load U-Boot into RAM, initialize BSS, perform relocation adjustments
- */
+/* Load U-Boot into RAM, initialize BSS, perform relocation adjustments */
 void board_init_f(ulong boot_flags)
 {
 	init_fnc_t **init_fnc_ptr;
 
+	gd->flags = boot_flags;
+
 	for (init_fnc_ptr = init_sequence_f; *init_fnc_ptr; ++init_fnc_ptr) {
 		if ((*init_fnc_ptr)() != 0)
 			hang();
diff --git a/arch/i386/lib/bootm.c b/arch/x86/lib/bootm.c
similarity index 86%
rename from arch/i386/lib/bootm.c
rename to arch/x86/lib/bootm.c
index b36e58d..a21a21f 100644
--- a/arch/i386/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -5,10 +5,13 @@
  *
  * Copyright (C) 2001  Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,8 +20,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
  */
 
 #include <common.h>
diff --git a/arch/i386/lib/interrupts.c b/arch/x86/lib/interrupts.c
similarity index 87%
rename from arch/i386/lib/interrupts.c
rename to arch/x86/lib/interrupts.c
index 5a28278..a2c598f 100644
--- a/arch/i386/lib/interrupts.c
+++ b/arch/x86/lib/interrupts.c
@@ -1,21 +1,21 @@
 /*
  * (C) Copyright 2009
- * Graeme Russ, graeme.russ@gmail.com
+ * Graeme Russ, <graeme.russ@gmail.com>
  *
  * (C) Copyright 2007
- * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com
+ * Daniel Hellstrom, Gaisler Research, <daniel@gaisler.com>
  *
  * (C) Copyright 2006
- * Detlev Zundel, DENX Software Engineering, dzu@denx.de
+ * Detlev Zundel, DENX Software Engineering, <dzu@denx.de>
  *
  * (C) Copyright -2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
  *
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * (C) Copyright 2001
- * Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc.
+ * Josh Huber, Mission Critical Linux, Inc, <huber@mclx.com>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -38,11 +38,11 @@
 
 /*
  * This file contains the high-level API for the interrupt sub-system
- * of the i386 port of U-Boot. Most of the functionality has been
+ * of the x86 port of U-Boot. Most of the functionality has been
  * shamelessly stolen from the leon2 / leon3 ports of U-Boot.
  * Daniel Hellstrom, Detlev Zundel, Wolfgang Denk and Josh Huber are
  * credited for the corresponding work on those ports. The original
- * interrupt handling routines for the i386 port were written by
+ * interrupt handling routines for the x86 port were written by
  * Daniel Engström
  */
 
diff --git a/arch/i386/lib/pcat_interrupts.c b/arch/x86/lib/pcat_interrupts.c
similarity index 96%
rename from arch/i386/lib/pcat_interrupts.c
rename to arch/x86/lib/pcat_interrupts.c
index 67e6e97..364c435 100644
--- a/arch/i386/lib/pcat_interrupts.c
+++ b/arch/x86/lib/pcat_interrupts.c
@@ -1,9 +1,9 @@
 /*
  * (C) Copyright 2009
- * Graeme Russ, graeme.russ@gmail.com
+ * Graeme Russ, <graeme.russ@gmail.com>
  *
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
diff --git a/arch/i386/lib/pcat_timer.c b/arch/x86/lib/pcat_timer.c
similarity index 97%
rename from arch/i386/lib/pcat_timer.c
rename to arch/x86/lib/pcat_timer.c
index 1373fd1..1911c6c 100644
--- a/arch/i386/lib/pcat_timer.c
+++ b/arch/x86/lib/pcat_timer.c
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
diff --git a/arch/i386/lib/pci.c b/arch/x86/lib/pci.c
similarity index 94%
rename from arch/i386/lib/pci.c
rename to arch/x86/lib/pci.c
index 9020e7c..e791e88 100644
--- a/arch/i386/lib/pci.c
+++ b/arch/x86/lib/pci.c
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -54,10 +54,9 @@
 	class_code &= 0xffffff00;
 	class_code >>= 8;
 
-#if 0
-	printf("PCI Header Vendor %04x device %04x class %06x\n",
+	debug("PCI Header Vendor %04x device %04x class %06x\n",
 	       vendor, device, class_code);
-#endif
+
 	/* Enable the rom addess decoder */
 	pci_write_config_dword(dev, PCI_ROM_ADDRESS, (u32)PCI_ROM_ADDRESS_MASK);
 	pci_read_config_dword(dev, PCI_ROM_ADDRESS, &addr_reg);
@@ -70,13 +69,12 @@
 
 	size = (~(addr_reg&PCI_ROM_ADDRESS_MASK))+1;
 
-#if 0
-	printf("ROM is %d bytes\n", size);
-#endif
+	debug("ROM is %d bytes\n", size);
+
 	rom_addr = pci_get_rom_window(hose, size);
-#if 0
-	printf("ROM mapped at %x \n", rom_addr);
-#endif
+
+	debug("ROM mapped at %x\n", rom_addr);
+
 	pci_write_config_dword(dev, PCI_ROM_ADDRESS,
 			       pci_phys_to_mem(dev, rom_addr)
 			       |PCI_ROM_ADDRESS_ENABLE);
diff --git a/arch/i386/lib/pci_type1.c b/arch/x86/lib/pci_type1.c
similarity index 61%
rename from arch/i386/lib/pci_type1.c
rename to arch/x86/lib/pci_type1.c
index 225ae4a..8ce5b33 100644
--- a/arch/i386/lib/pci_type1.c
+++ b/arch/x86/lib/pci_type1.c
@@ -1,15 +1,30 @@
 /*
- * Support for type PCI configuration cycles.
- * based on pci_indirect.c
+ * (C) Copyright 2002
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
- * Copyright (C) 2002 Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
+ * See file CREDITS for list of people who contributed to this
+ * project.
  *
  * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
  */
 
+/*
+ * Support for type PCI configuration cycles.
+ * based on pci_indirect.c
+ */
 #include <common.h>
 #include <asm/io.h>
 #include <pci.h>
diff --git a/arch/i386/lib/realmode.c b/arch/x86/lib/realmode.c
similarity index 95%
rename from arch/i386/lib/realmode.c
rename to arch/x86/lib/realmode.c
index 2dda95b..5be827c 100644
--- a/arch/i386/lib/realmode.c
+++ b/arch/x86/lib/realmode.c
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -26,10 +26,8 @@
 #include <asm/ptrace.h>
 #include <asm/realmode.h>
 
-
 #define REALMODE_MAILBOX ((char*)0xe00)
 
-
 extern ulong __realmode_start;
 extern ulong __realmode_size;
 extern char realmode_enter;
@@ -57,13 +55,11 @@
 {
 
 	/* setup out thin bios emulation */
-	if (bios_setup()) {
+	if (bios_setup())
 		return -1;
-	}
 
-	if (realmode_setup()) {
+	if (realmode_setup())
 		return -1;
-	}
 
 	in->eip = off;
 	in->xcs = seg;
diff --git a/arch/i386/lib/realmode_switch.S b/arch/x86/lib/realmode_switch.S
similarity index 99%
rename from arch/i386/lib/realmode_switch.S
rename to arch/x86/lib/realmode_switch.S
index d6c74ec..fce4ecc 100644
--- a/arch/i386/lib/realmode_switch.S
+++ b/arch/x86/lib/realmode_switch.S
@@ -21,7 +21,6 @@
  * MA 02111-1307 USA
  */
 
-
 /* 32bit -> 16bit -> 32bit mode switch code */
 
 /*
diff --git a/arch/i386/lib/timer.c b/arch/x86/lib/timer.c
similarity index 94%
rename from arch/i386/lib/timer.c
rename to arch/x86/lib/timer.c
index 5cb1f54..8fc68cd 100644
--- a/arch/i386/lib/timer.c
+++ b/arch/x86/lib/timer.c
@@ -1,6 +1,9 @@
 /*
+ * (C) Copyright 2008,2009
+ * Graeme Russ, <graeme.russ@gmail.com>
+ *
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
diff --git a/arch/i386/lib/video.c b/arch/x86/lib/video.c
similarity index 86%
rename from arch/i386/lib/video.c
rename to arch/x86/lib/video.c
index c58ed10..b29075c 100644
--- a/arch/i386/lib/video.c
+++ b/arch/x86/lib/video.c
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -30,7 +30,6 @@
 #include <asm/io.h>
 #include <asm/pci.h>
 
-
 /* basic textmode I/O from linux kernel */
 static char *vidmem = (char *)0xb8000;
 static int vidport;
@@ -42,9 +41,9 @@
 	int i;
 
 	outb_p(3, 0x61);
-	for (i=0;i<10*dur;i++) {
+	for (i = 0; i < 10*dur; i++)
 		udelay(1000);
-	}
+
 	outb_p(0, 0x61);
 }
 
@@ -52,8 +51,8 @@
 {
 	int i;
 
-	memcpy ( vidmem, vidmem + cols * 2, ( lines - 1 ) * cols * 2 );
-	for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 )
+	memcpy(vidmem, vidmem + cols * 2, (lines - 1) * cols * 2);
+	for (i = (lines - 1) * cols * 2; i < lines * cols * 2; i += 2)
 		vidmem[i] = ' ';
 }
 
@@ -61,14 +60,14 @@
 {
 	if (c == '\n') {
 		(*x) = 0;
-		if ( ++(*y) >= lines ) {
+		if (++(*y) >= lines) {
 			scroll();
 			(*y)--;
 		}
 	} else if (c == '\b') {
 		if ((*x) != 0) {
 			--(*x);
-			vidmem [ ( (*x) + cols * (*y) ) * 2 ] = ' ';
+			vidmem[((*x) + cols * (*y)) * 2] = ' ';
 		}
 	} else if (c == '\r') {
 		(*x) = 0;
@@ -106,16 +105,15 @@
 		}
 	} else if (c == '\f') {
 		int i;
-		for (i=0;i<lines*cols*2;i+=2) {
+		for (i = 0; i < lines * cols * 2; i += 2)
 			vidmem[i] = 0;
-		}
 		(*x) = 0;
 		(*y) = 0;
 	} else {
-		vidmem [ ( (*x) + cols * (*y) ) * 2 ] = c;
-		if ( ++(*x) >= cols ) {
+		vidmem[((*x) + cols * (*y)) * 2] = c;
+		if (++(*x) >= cols) {
 			(*x) = 0;
-			if ( ++(*y) >= lines ) {
+			if (++(*y) >= lines) {
 				scroll();
 				(*y)--;
 			}
@@ -150,9 +148,8 @@
 	x = orig_x;
 	y = orig_y;
 
-	while ( ( c = *s++ ) != '\0' ) {
+	while ((c = *s++) != '\0')
 		__video_putc(c, &x, &y);
-	}
 
 	orig_x = x;
 	orig_y = y;
@@ -189,10 +186,8 @@
 #if 0
 	printf("pos %x %d %d\n", pos, orig_x, orig_y);
 #endif
-	if (orig_y > lines) {
+	if (orig_y > lines)
 		orig_x = orig_y =0;
-	}
-
 
 	memset(&vga_dev, 0, sizeof(vga_dev));
 	strcpy(vga_dev.name, "vga");
@@ -203,13 +198,11 @@
 	vga_dev.tstc  = NULL;              /* 'tstc' function */
 	vga_dev.getc  = NULL;              /* 'getc' function */
 
-	if (stdio_register(&vga_dev) == 0) {
-	    return 1;
-	}
+	if (stdio_register(&vga_dev) == 0)
+		return 1;
 
-	if (i8042_kbd_init()) {
+	if (i8042_kbd_init())
 		return 1;
-	}
 
 	memset(&kbd_dev, 0, sizeof(kbd_dev));
 	strcpy(kbd_dev.name, "kbd");
@@ -220,18 +213,17 @@
 	kbd_dev.tstc  = i8042_tstc;  /* 'tstc' function */
 	kbd_dev.getc  = i8042_getc;  /* 'getc' function */
 
-	if (stdio_register(&kbd_dev) == 0) {
-	    return 1;
-	}
+	if (stdio_register(&kbd_dev) == 0)
+		return 1;
+
 	return 0;
 }
 
 
 int drv_video_init(void)
 {
-	if (video_bios_init()) {
+	if (video_bios_init())
 		return 1;
-	}
 
 	return video_init();
 }
diff --git a/arch/i386/lib/video_bios.c b/arch/x86/lib/video_bios.c
similarity index 98%
rename from arch/i386/lib/video_bios.c
rename to arch/x86/lib/video_bios.c
index c8060e6..6bc4335 100644
--- a/arch/i386/lib/video_bios.c
+++ b/arch/x86/lib/video_bios.c
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
diff --git a/arch/i386/lib/zimage.c b/arch/x86/lib/zimage.c
similarity index 98%
rename from arch/i386/lib/zimage.c
rename to arch/x86/lib/zimage.c
index 0c42072..cc4b40e 100644
--- a/arch/i386/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -22,7 +22,7 @@
  */
 
 /*
- * Linux i386 zImage and bzImage loading
+ * Linux x86 zImage and bzImage loading
  *
  * based on the procdure described in
  * linux/Documentation/i386/boot.txt
diff --git a/board/LEOX/elpt860/u-boot.lds b/board/LEOX/elpt860/u-boot.lds
index 45206ca..5aaf6b3 100644
--- a/board/LEOX/elpt860/u-boot.lds
+++ b/board/LEOX/elpt860/u-boot.lds
@@ -67,13 +67,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/RPXClassic/u-boot.lds b/board/RPXClassic/u-boot.lds
index 05cc233..d0b60cf 100644
--- a/board/RPXClassic/u-boot.lds
+++ b/board/RPXClassic/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/RPXlite/u-boot.lds b/board/RPXlite/u-boot.lds
index 05cc233..d0b60cf 100644
--- a/board/RPXlite/u-boot.lds
+++ b/board/RPXlite/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/RPXlite_dw/u-boot.lds b/board/RPXlite_dw/u-boot.lds
index 05cc233..d0b60cf 100644
--- a/board/RPXlite_dw/u-boot.lds
+++ b/board/RPXlite_dw/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/RRvision/u-boot.lds b/board/RRvision/u-boot.lds
index 3e7853a..8385373 100644
--- a/board/RRvision/u-boot.lds
+++ b/board/RRvision/u-boot.lds
@@ -52,13 +52,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/adder/u-boot.lds b/board/adder/u-boot.lds
index 661a94a..a762769 100644
--- a/board/adder/u-boot.lds
+++ b/board/adder/u-boot.lds
@@ -43,13 +43,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
 
   .data    :
diff --git a/board/amirix/ap1000/u-boot.lds b/board/amirix/ap1000/u-boot.lds
index 57fe1d9..cd8f5ce 100644
--- a/board/amirix/ap1000/u-boot.lds
+++ b/board/amirix/ap1000/u-boot.lds
@@ -49,13 +49,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/c2mon/u-boot.lds b/board/c2mon/u-boot.lds
index 524c36e..b9b8e3c 100644
--- a/board/c2mon/u-boot.lds
+++ b/board/c2mon/u-boot.lds
@@ -55,13 +55,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/cogent/u-boot.lds b/board/cogent/u-boot.lds
index e324f5c..2393d8d 100644
--- a/board/cogent/u-boot.lds
+++ b/board/cogent/u-boot.lds
@@ -51,13 +51,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/dave/PPChameleonEVB/u-boot.lds b/board/dave/PPChameleonEVB/u-boot.lds
index 20c32b7..3b10114 100644
--- a/board/dave/PPChameleonEVB/u-boot.lds
+++ b/board/dave/PPChameleonEVB/u-boot.lds
@@ -55,9 +55,10 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
diff --git a/board/eNET/config.mk b/board/eNET/config.mk
deleted file mode 100644
index 9d2dfa53..0000000
--- a/board/eNET/config.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# (C) Copyright 2002
-# Daniel Engström, Omicron Ceti AB, daniel@omicron.se.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-LDPPFLAGS += -DFLASH_SIZE=0x40000
diff --git a/board/eNET/eNET.c b/board/eNET/eNET.c
index dd0ce54..2a5636c 100644
--- a/board/eNET/eNET.c
+++ b/board/eNET/eNET.c
@@ -35,6 +35,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+unsigned long monitor_flash_len = CONFIG_SYS_MONITOR_LEN;
+
 static void enet_timer_isr(void);
 static void enet_toggle_run_led(void);
 static void enet_setup_pars(void);
diff --git a/board/eNET/eNET_pci.c b/board/eNET/eNET_pci.c
index fefb1a4..a03090e 100644
--- a/board/eNET/eNET_pci.c
+++ b/board/eNET/eNET_pci.c
@@ -1,9 +1,9 @@
 /*
- * (C) Copyright 2008
- * Graeme Russ, graeme.russ@gmail.com.
+ * (C) Copyright 2008,2009
+ * Graeme Russ, <graeme.russ@gmail.com>
  *
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB <daniel@omicron.se>.
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -23,6 +23,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  */
+
 #include <common.h>
 #include <pci.h>
 #include <asm/pci.h>
diff --git a/board/eltec/mhpc/u-boot.lds b/board/eltec/mhpc/u-boot.lds
index 2fac727..fd4e8a5 100644
--- a/board/eltec/mhpc/u-boot.lds
+++ b/board/eltec/mhpc/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/emk/top860/u-boot.lds b/board/emk/top860/u-boot.lds
index 32dcbd3..fb06648 100644
--- a/board/emk/top860/u-boot.lds
+++ b/board/emk/top860/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/ep88x/u-boot.lds b/board/ep88x/u-boot.lds
index e2dd1c2..332b35a 100644
--- a/board/ep88x/u-boot.lds
+++ b/board/ep88x/u-boot.lds
@@ -43,9 +43,10 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
diff --git a/board/esd/dasa_sim/u-boot.lds b/board/esd/dasa_sim/u-boot.lds
index 2bf60f5..b15948d 100644
--- a/board/esd/dasa_sim/u-boot.lds
+++ b/board/esd/dasa_sim/u-boot.lds
@@ -54,13 +54,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/esteem192e/u-boot.lds b/board/esteem192e/u-boot.lds
index 8455f0b..163b83d 100644
--- a/board/esteem192e/u-boot.lds
+++ b/board/esteem192e/u-boot.lds
@@ -56,13 +56,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/etx094/u-boot.lds b/board/etx094/u-boot.lds
index 04233d8..b68d9ea 100644
--- a/board/etx094/u-boot.lds
+++ b/board/etx094/u-boot.lds
@@ -56,13 +56,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/evb64260/u-boot.lds b/board/evb64260/u-boot.lds
index 0648f62..2d031ef 100644
--- a/board/evb64260/u-boot.lds
+++ b/board/evb64260/u-boot.lds
@@ -51,13 +51,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/fads/u-boot.lds b/board/fads/u-boot.lds
index 63d0ea1..9ea0674 100644
--- a/board/fads/u-boot.lds
+++ b/board/fads/u-boot.lds
@@ -49,13 +49,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/flagadm/u-boot.lds b/board/flagadm/u-boot.lds
index 2fac727..fd4e8a5 100644
--- a/board/flagadm/u-boot.lds
+++ b/board/flagadm/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/gen860t/u-boot.lds b/board/gen860t/u-boot.lds
index 8e854db..be99b51 100644
--- a/board/gen860t/u-boot.lds
+++ b/board/gen860t/u-boot.lds
@@ -52,13 +52,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/genietv/u-boot.lds b/board/genietv/u-boot.lds
index 3e396e4..1d66a9b 100644
--- a/board/genietv/u-boot.lds
+++ b/board/genietv/u-boot.lds
@@ -61,13 +61,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/hermes/u-boot.lds b/board/hermes/u-boot.lds
index d50c586..ca97115 100644
--- a/board/hermes/u-boot.lds
+++ b/board/hermes/u-boot.lds
@@ -53,13 +53,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/hymod/u-boot.lds b/board/hymod/u-boot.lds
index 1592f4f..1efa8b3 100644
--- a/board/hymod/u-boot.lds
+++ b/board/hymod/u-boot.lds
@@ -93,7 +93,7 @@
     _FIXUP_TABLE_ = .;
     *(.fixup)
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/icu862/u-boot.lds b/board/icu862/u-boot.lds
index cb5afc1..93c79a6 100644
--- a/board/icu862/u-boot.lds
+++ b/board/icu862/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/ip860/u-boot.lds b/board/ip860/u-boot.lds
index 05cc233..d0b60cf 100644
--- a/board/ip860/u-boot.lds
+++ b/board/ip860/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/ivm/u-boot.lds b/board/ivm/u-boot.lds
index ff7012a..1e843eb 100644
--- a/board/ivm/u-boot.lds
+++ b/board/ivm/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/kup/kup4k/u-boot.lds b/board/kup/kup4k/u-boot.lds
index 05cc233..d0b60cf 100644
--- a/board/kup/kup4k/u-boot.lds
+++ b/board/kup/kup4k/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/kup/kup4x/u-boot.lds b/board/kup/kup4x/u-boot.lds
index 05cc233..d0b60cf 100644
--- a/board/kup/kup4x/u-boot.lds
+++ b/board/kup/kup4x/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/lantec/u-boot.lds b/board/lantec/u-boot.lds
index 25e7a4d..de0b355 100644
--- a/board/lantec/u-boot.lds
+++ b/board/lantec/u-boot.lds
@@ -56,13 +56,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/lwmon/u-boot.lds b/board/lwmon/u-boot.lds
index d02db17..8bf7324 100644
--- a/board/lwmon/u-boot.lds
+++ b/board/lwmon/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/manroland/uc100/u-boot.lds b/board/manroland/uc100/u-boot.lds
index 344cbde..731cec9 100644
--- a/board/manroland/uc100/u-boot.lds
+++ b/board/manroland/uc100/u-boot.lds
@@ -50,13 +50,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/matrix_vision/mvsmr/u-boot.lds b/board/matrix_vision/mvsmr/u-boot.lds
index f3d01e7..bf2ed04 100644
--- a/board/matrix_vision/mvsmr/u-boot.lds
+++ b/board/matrix_vision/mvsmr/u-boot.lds
@@ -55,9 +55,10 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
diff --git a/board/mbx8xx/u-boot.lds b/board/mbx8xx/u-boot.lds
index 05cc233..d0b60cf 100644
--- a/board/mbx8xx/u-boot.lds
+++ b/board/mbx8xx/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/ml2/u-boot.lds b/board/ml2/u-boot.lds
index 0f2593d..9f9ddb8 100644
--- a/board/ml2/u-boot.lds
+++ b/board/ml2/u-boot.lds
@@ -44,13 +44,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/mousse/u-boot.lds b/board/mousse/u-boot.lds
index ef73e2b..dae2cfc 100644
--- a/board/mousse/u-boot.lds
+++ b/board/mousse/u-boot.lds
@@ -41,13 +41,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
 
   .data    :
diff --git a/board/mvblue/u-boot.lds b/board/mvblue/u-boot.lds
index 03ba155..11624d2 100644
--- a/board/mvblue/u-boot.lds
+++ b/board/mvblue/u-boot.lds
@@ -51,13 +51,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
 
   .data    :
diff --git a/board/netphone/u-boot.lds b/board/netphone/u-boot.lds
index b7b6c1a..a949e4f 100644
--- a/board/netphone/u-boot.lds
+++ b/board/netphone/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/netta/u-boot.lds b/board/netta/u-boot.lds
index b7b6c1a..a949e4f 100644
--- a/board/netta/u-boot.lds
+++ b/board/netta/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/netta2/u-boot.lds b/board/netta2/u-boot.lds
index b7b6c1a..a949e4f 100644
--- a/board/netta2/u-boot.lds
+++ b/board/netta2/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/netvia/u-boot.lds b/board/netvia/u-boot.lds
index b7b6c1a..a949e4f 100644
--- a/board/netvia/u-boot.lds
+++ b/board/netvia/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/nx823/u-boot.lds b/board/nx823/u-boot.lds
index 2fac727..fd4e8a5 100644
--- a/board/nx823/u-boot.lds
+++ b/board/nx823/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/quantum/u-boot.lds b/board/quantum/u-boot.lds
index 05cc233..d0b60cf 100644
--- a/board/quantum/u-boot.lds
+++ b/board/quantum/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/r360mpi/u-boot.lds b/board/r360mpi/u-boot.lds
index 60b3cbf..2fa085a 100644
--- a/board/r360mpi/u-boot.lds
+++ b/board/r360mpi/u-boot.lds
@@ -49,13 +49,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/rbc823/u-boot.lds b/board/rbc823/u-boot.lds
index 7b790ab..d943fb6 100644
--- a/board/rbc823/u-boot.lds
+++ b/board/rbc823/u-boot.lds
@@ -58,13 +58,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/rmu/u-boot.lds b/board/rmu/u-boot.lds
index 05cc233..d0b60cf 100644
--- a/board/rmu/u-boot.lds
+++ b/board/rmu/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/rsdproto/u-boot.lds b/board/rsdproto/u-boot.lds
index b36047a..81728db 100644
--- a/board/rsdproto/u-boot.lds
+++ b/board/rsdproto/u-boot.lds
@@ -80,7 +80,7 @@
     _FIXUP_TABLE_ = .;
     *(.fixup)
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/sandpoint/u-boot.lds b/board/sandpoint/u-boot.lds
index 841a29b..e382fd1 100644
--- a/board/sandpoint/u-boot.lds
+++ b/board/sandpoint/u-boot.lds
@@ -49,13 +49,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
 
   .data    :
diff --git a/board/sc3/u-boot.lds b/board/sc3/u-boot.lds
index 2cbbca5..4db46ca 100644
--- a/board/sc3/u-boot.lds
+++ b/board/sc3/u-boot.lds
@@ -96,13 +96,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    *(.got)
     _GOT2_TABLE_ = .;
     *(.got2)
+    *(.got)
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     *(.fixup)
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/siemens/IAD210/u-boot.lds b/board/siemens/IAD210/u-boot.lds
index 725bef8..0e78e4f 100644
--- a/board/siemens/IAD210/u-boot.lds
+++ b/board/siemens/IAD210/u-boot.lds
@@ -56,13 +56,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/sixnet/u-boot.lds b/board/sixnet/u-boot.lds
index 2711f2c..02d1980 100644
--- a/board/sixnet/u-boot.lds
+++ b/board/sixnet/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/snmc/qs850/u-boot.lds b/board/snmc/qs850/u-boot.lds
index 007ae00..9ab248a 100644
--- a/board/snmc/qs850/u-boot.lds
+++ b/board/snmc/qs850/u-boot.lds
@@ -50,13 +50,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/snmc/qs860t/u-boot.lds b/board/snmc/qs860t/u-boot.lds
index 05cc233..d0b60cf 100644
--- a/board/snmc/qs860t/u-boot.lds
+++ b/board/snmc/qs860t/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/spc1920/u-boot.lds b/board/spc1920/u-boot.lds
index 05cc233..d0b60cf 100644
--- a/board/spc1920/u-boot.lds
+++ b/board/spc1920/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/spd8xx/u-boot.lds b/board/spd8xx/u-boot.lds
index 796c283..950e1e6 100644
--- a/board/spd8xx/u-boot.lds
+++ b/board/spd8xx/u-boot.lds
@@ -57,13 +57,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/stx/stxxtc/u-boot.lds b/board/stx/stxxtc/u-boot.lds
index b7b6c1a..a949e4f 100644
--- a/board/stx/stxxtc/u-boot.lds
+++ b/board/stx/stxxtc/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/svm_sc8xx/u-boot.lds b/board/svm_sc8xx/u-boot.lds
index c4ce968..c65f022 100644
--- a/board/svm_sc8xx/u-boot.lds
+++ b/board/svm_sc8xx/u-boot.lds
@@ -63,13 +63,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/tqc/tqm8xx/u-boot.lds b/board/tqc/tqm8xx/u-boot.lds
index 83a09b0..f625c3d 100644
--- a/board/tqc/tqm8xx/u-boot.lds
+++ b/board/tqc/tqm8xx/u-boot.lds
@@ -63,13 +63,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/v37/u-boot.lds b/board/v37/u-boot.lds
index 578a49b..e62d53d 100644
--- a/board/v37/u-boot.lds
+++ b/board/v37/u-boot.lds
@@ -47,13 +47,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/board/westel/amx860/u-boot.lds b/board/westel/amx860/u-boot.lds
index 3514a66..3470b43 100644
--- a/board/westel/amx860/u-boot.lds
+++ b/board/westel/amx860/u-boot.lds
@@ -56,13 +56,14 @@
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_)>>2;
 
   .data    :
diff --git a/boards.cfg b/boards.cfg
index a45bd83..554e06c 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -205,8 +205,8 @@
 ip04                         blackfin    blackfin
 tcm-bf518                    blackfin    blackfin
 tcm-bf537                    blackfin    blackfin
-eNET                         i386        i386        eNET                -              sc520       eNET:SYS_TEXT_BASE=0x38040000
-eNET_SRAM                    i386        i386        eNET                -              sc520       eNET:SYS_TEXT_BASE=0x19000000
+eNET                         x86         x86        eNET                -              sc520       eNET:SYS_TEXT_BASE=0x38040000
+eNET_SRAM                    x86         x86        eNET                -              sc520       eNET:SYS_TEXT_BASE=0x19000000
 idmr                         m68k        mcf52x2
 TASREG                       m68k        mcf52x2     tasreg              esd
 M5208EVBE                    m68k        mcf52x2     m5208evbe           freescale
diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index 6e7be81..11a491d 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -19,6 +19,47 @@
 
 static struct spi_flash *flash;
 
+
+/*
+ * This function computes the length argument for the erase command.
+ * The length on which the command is to operate can be given in two forms:
+ * 1. <cmd> offset len  - operate on <'offset',  'len')
+ * 2. <cmd> offset +len - operate on <'offset',  'round_up(len)')
+ * If the second form is used and the length doesn't fall on the
+ * sector boundary, than it will be adjusted to the next sector boundary.
+ * If it isn't in the flash, the function will fail (return -1).
+ * Input:
+ *    arg: length specification (i.e. both command arguments)
+ * Output:
+ *    len: computed length for operation
+ * Return:
+ *    1: success
+ *   -1: failure (bad format, bad address).
+ */
+static int sf_parse_len_arg(char *arg, ulong *len)
+{
+	char *ep;
+	char round_up_len; /* indicates if the "+length" form used */
+	ulong len_arg;
+
+	round_up_len = 0;
+	if (*arg == '+') {
+		round_up_len = 1;
+		++arg;
+	}
+
+	len_arg = simple_strtoul(arg, &ep, 16);
+	if (ep == arg || *ep != '\0')
+		return -1;
+
+	if (round_up_len && flash->sector_size > 0)
+		*len = ROUND(len_arg - 1, flash->sector_size);
+	else
+		*len = len_arg;
+
+	return 1;
+}
+
 static int do_spi_flash_probe(int argc, char * const argv[])
 {
 	unsigned int bus = 0;
@@ -29,30 +70,30 @@
 	struct spi_flash *new;
 
 	if (argc < 2)
-		goto usage;
+		return -1;
 
 	cs = simple_strtoul(argv[1], &endp, 0);
 	if (*argv[1] == 0 || (*endp != 0 && *endp != ':'))
-		goto usage;
+		return -1;
 	if (*endp == ':') {
 		if (endp[1] == 0)
-			goto usage;
+			return -1;
 
 		bus = cs;
 		cs = simple_strtoul(endp + 1, &endp, 0);
 		if (*endp != 0)
-			goto usage;
+			return -1;
 	}
 
 	if (argc >= 3) {
 		speed = simple_strtoul(argv[2], &endp, 0);
 		if (*argv[2] == 0 || *endp != 0)
-			goto usage;
+			return -1;
 	}
 	if (argc >= 4) {
 		mode = simple_strtoul(argv[3], &endp, 16);
 		if (*argv[3] == 0 || *endp != 0)
-			goto usage;
+			return -1;
 	}
 
 	new = spi_flash_probe(bus, cs, speed, mode);
@@ -65,14 +106,7 @@
 		spi_flash_free(flash);
 	flash = new;
 
-	printf("%u KiB %s at %u:%u is now current device\n",
-			flash->size >> 10, flash->name, bus, cs);
-
 	return 0;
-
-usage:
-	puts("Usage: sf probe [bus:]cs [hz] [mode]\n");
-	return 1;
 }
 
 static int do_spi_flash_read_write(int argc, char * const argv[])
@@ -85,17 +119,17 @@
 	int ret;
 
 	if (argc < 4)
-		goto usage;
+		return -1;
 
 	addr = simple_strtoul(argv[1], &endp, 16);
 	if (*argv[1] == 0 || *endp != 0)
-		goto usage;
+		return -1;
 	offset = simple_strtoul(argv[2], &endp, 16);
 	if (*argv[2] == 0 || *endp != 0)
-		goto usage;
+		return -1;
 	len = simple_strtoul(argv[3], &endp, 16);
 	if (*argv[3] == 0 || *endp != 0)
-		goto usage;
+		return -1;
 
 	buf = map_physmem(addr, len, MAP_WRBACK);
 	if (!buf) {
@@ -116,10 +150,6 @@
 	}
 
 	return 0;
-
-usage:
-	printf("Usage: sf %s addr offset len\n", argv[0]);
-	return 1;
 }
 
 static int do_spi_flash_erase(int argc, char * const argv[])
@@ -130,14 +160,15 @@
 	int ret;
 
 	if (argc < 3)
-		goto usage;
+		return -1;
 
 	offset = simple_strtoul(argv[1], &endp, 16);
 	if (*argv[1] == 0 || *endp != 0)
-		goto usage;
-	len = simple_strtoul(argv[2], &endp, 16);
-	if (*argv[2] == 0 || *endp != 0)
-		goto usage;
+		return -1;
+
+	ret = sf_parse_len_arg(argv[2], &len);
+	if (ret != 1)
+		return -1;
 
 	ret = spi_flash_erase(flash, offset, len);
 	if (ret) {
@@ -146,24 +177,25 @@
 	}
 
 	return 0;
-
-usage:
-	puts("Usage: sf erase offset len\n");
-	return 1;
 }
 
 static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	const char *cmd;
+	int ret;
 
 	/* need at least two arguments */
 	if (argc < 2)
 		goto usage;
 
 	cmd = argv[1];
+	--argc;
+	++argv;
 
-	if (strcmp(cmd, "probe") == 0)
-		return do_spi_flash_probe(argc - 1, argv + 1);
+	if (strcmp(cmd, "probe") == 0) {
+		ret = do_spi_flash_probe(argc, argv);
+		goto done;
+	}
 
 	/* The remaining commands require a selected device */
 	if (!flash) {
@@ -172,9 +204,15 @@
 	}
 
 	if (strcmp(cmd, "read") == 0 || strcmp(cmd, "write") == 0)
-		return do_spi_flash_read_write(argc - 1, argv + 1);
-	if (strcmp(cmd, "erase") == 0)
-		return do_spi_flash_erase(argc - 1, argv + 1);
+		ret = do_spi_flash_read_write(argc, argv);
+	else if (strcmp(cmd, "erase") == 0)
+		ret = do_spi_flash_erase(argc, argv);
+	else
+		ret = -1;
+
+done:
+	if (ret != -1)
+		return ret;
 
 usage:
 	return cmd_usage(cmdtp);
@@ -189,5 +227,6 @@
 	"				  `offset' to memory at `addr'\n"
 	"sf write addr offset len	- write `len' bytes from memory\n"
 	"				  at `addr' to flash at `offset'\n"
-	"sf erase offset len		- erase `len' bytes from `offset'"
+	"sf erase offset [+]len		- erase `len' bytes from `offset'\n"
+	"				  `+len' round up `len' to block size"
 );
diff --git a/common/exports.c b/common/exports.c
index 3dff735..717e4af 100644
--- a/common/exports.c
+++ b/common/exports.c
@@ -15,7 +15,7 @@
 /* Reuse _exports.h with a little trickery to avoid bitrot */
 #define EXPORT_FUNC(sym) gd->jt[XF_##sym] = (void *)sym;
 
-#if !defined(CONFIG_I386) && !defined(CONFIG_PPC)
+#if !defined(CONFIG_X86) && !defined(CONFIG_PPC)
 # define install_hdlr      dummy
 # define free_hdlr         dummy
 #else /* kludge for non-standard function naming */
diff --git a/doc/README-i386 b/doc/README-i386
deleted file mode 100644
index c560d22..0000000
--- a/doc/README-i386
+++ /dev/null
@@ -1,74 +0,0 @@
-This is my attempt to port U-Boot to the i386 platform. This
-work was sponsored by my emplyer, Omicron Ceti AB. http://www.omicron.se
-
-It is currently capable of booting a linux bzImage from flash on
-the AMD SC520 CDP platform.
-
-It was originally based on PPCBoot taken from the CVS October 28 2002.
-
-To compile:
-
-1) Unpack the source tree, either from the complete tarball or
-   from the virgin snapshot + the patch
-
-2) Configure the source
-   $ make sc520_cdp_comfig
-   $ make
-
-To use this code on the CDP:
-1) Make a suitable kernel, I used 2.4.19 with the mtd-support updated
-   from the MTD CVS and a patch to allow root=/dev/mtdblock1 which I
-   included at the end of this file.
-   The following options in the MTD section might be useful:
-
-   CONFIG_MTD_PHYSMAP=y
-   CONFIG_MTD_PHYSMAP_START=38100000
-   CONFIG_MTD_PHYSMAP_LEN=7a0000
-   CONFIG_MTD_PHYSMAP_BUSWIDTH=2
-
-
-2) Program it in to the CDP flashbank with remon
-   u-boot.bin should be programmed att offset 0x7e000 and the kernel at
-   offset 0. If you want to use a jffs2 root file system (not included here),
-   it should be  programmed to offset 0x100000.
-
-   remon> z
-   remon> yi
-   remon> ns u-boot.bin 7e0000
-   remon> ns bzImage 0
-   remon> ns image.jffs2 100000
-
-3) Connect a terminal to the 25pin serial port at 9600bps, and start the CDP.
-
-   remon> z
-   remon> g
-
-4) U-Boot should output some message and a prompt on the terminal, to
-   start the kernel issue the following command:
-
-   BOOT> bootm
-
-5) The kernel should boot, and mount the root filesystem if present.
-
-We hope you find this stuff useful
-Daniel Engström, Omicron Ceti AB, daniel@omicron.se
-
-
---- linux-2.4.19-orig/init/do_mounts.c	Sat Aug  3 02:39:46 2002
-+++ linux-2.4.19/init/do_mounts.c	Mon Sep 23 16:21:33 2002
-@@ -224,6 +224,14 @@
-	{ "ftlc", 0x2c10 },
-	{ "ftld", 0x2c18 },
-	{ "mtdblock", 0x1f00 },
-+	{ "mtdblock0", 0x1f00 },
-+	{ "mtdblock1", 0x1f01 },
-+	{ "mtdblock2", 0x1f02 },
-+	{ "mtdblock3", 0x1f03 },
-+	{ "mtdblock4", 0x1f04 },
-+	{ "mtdblock5", 0x1f05 },
-+	{ "mtdblock6", 0x1f06 },
-+	{ "mtdblock7", 0x1f07 },
-	{ NULL, 0 }
- };
-
--------------------
diff --git a/doc/TODO-i386 b/doc/TODO-i386
deleted file mode 100644
index 9b6c5d4..0000000
--- a/doc/TODO-i386
+++ /dev/null
@@ -1,29 +0,0 @@
-i386 port missing features:
-* i386 cleaness (wbinvld is 486+ ... )
-* Pentium TSC timer/udelay
-* setup the BIOS data area and BIOS equipment word to reflect machine config. 
-* Make reset work (from Linux and from the boot prompt)
-* DMA, FDC, RTC, KBC initialization
-* split of part of arch/i386/cpu/interrupt.c to cpu/i385/entry.c?
-* re-entry of protected mode from real mode, should be added to realmode_switch.S 
-  (and used by INT 10h and INT 16h handlers for console I/O during early
-   linux boot...) 
-* missing functions in arch/i386/lib and arch/i386/cpu
-* speaker beep interface
-
-
-SC520 missing features:
-* Watchdog
-* SC520 timer/udelay
-* SC520 3rd PIC
-* SC520 ICE serial
-* SC520 MMCR reset 
-
-SC520 CDP board support missing features:
-* environment in sram
-
-SC520 CDP board support bugs:
-* SPI EEPROM support does not work
-* 0x680 LEDS dos not work for me
-* is it possible to make both the internal serial ports and the 
-  ports on the sio work at the same time?
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 5788328..91ddcb4 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -2089,6 +2089,14 @@
 
 void flash_protect_default(void)
 {
+#if defined(CONFIG_SYS_FLASH_AUTOPROTECT_LIST)
+	int i;
+	struct apl_s {
+		ulong start;
+		ulong size;
+	} apl[] = CONFIG_SYS_FLASH_AUTOPROTECT_LIST;
+#endif
+
 	/* Monitor protection ON by default */
 #if (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) && \
 	(!defined(CONFIG_MONITOR_IS_IN_RAM))
@@ -2130,12 +2138,6 @@
 {
 	unsigned long size = 0;
 	int i;
-#if defined(CONFIG_SYS_FLASH_AUTOPROTECT_LIST)
-	struct apl_s {
-		ulong start;
-		ulong size;
-	} apl[] = CONFIG_SYS_FLASH_AUTOPROTECT_LIST;
-#endif
 
 #ifdef CONFIG_SYS_FLASH_PROTECTION
 	/* read environment from EEPROM */
diff --git a/drivers/mtd/spi/atmel.c b/drivers/mtd/spi/atmel.c
index a9910b1..1ecece0 100644
--- a/drivers/mtd/spi/atmel.c
+++ b/drivers/mtd/spi/atmel.c
@@ -113,8 +113,35 @@
 
 static int at45_wait_ready(struct spi_flash *flash, unsigned long timeout)
 {
-	return spi_flash_cmd_poll_bit(flash, timeout,
-		CMD_AT45_READ_STATUS, AT45_STATUS_READY);
+	struct spi_slave *spi = flash->spi;
+	unsigned long timebase;
+	int ret;
+	u8 cmd = CMD_AT45_READ_STATUS;
+	u8 status;
+
+	timebase = get_timer(0);
+
+	ret = spi_xfer(spi, 8, &cmd, NULL, SPI_XFER_BEGIN);
+	if (ret)
+		return -1;
+
+	do {
+		ret = spi_xfer(spi, 8, NULL, &status, 0);
+		if (ret)
+			return -1;
+
+		if (status & AT45_STATUS_READY)
+			break;
+	} while (get_timer(timebase) < timeout);
+
+	/* Deactivate CS */
+	spi_xfer(spi, 0, NULL, NULL, SPI_XFER_END);
+
+	if (status & AT45_STATUS_READY)
+		return 0;
+
+	/* Timed out */
+	return -1;
 }
 
 /*
@@ -301,7 +328,7 @@
 /*
  * TODO: the two erase funcs (_p2/_at45) should get unified ...
  */
-int dataflash_erase_p2(struct spi_flash *flash, u32 offset, size_t len)
+static int dataflash_erase_p2(struct spi_flash *flash, u32 offset, size_t len)
 {
 	struct atmel_spi_flash *asf = to_atmel_spi_flash(flash);
 	unsigned long page_size;
@@ -360,7 +387,7 @@
 	return ret;
 }
 
-int dataflash_erase_at45(struct spi_flash *flash, u32 offset, size_t len)
+static int dataflash_erase_at45(struct spi_flash *flash, u32 offset, size_t len)
 {
 	struct atmel_spi_flash *asf = to_atmel_spi_flash(flash);
 	unsigned long page_addr;
@@ -495,14 +522,11 @@
 		goto err;
 	}
 
+	asf->flash.sector_size = page_size;
 	asf->flash.size = page_size * params->pages_per_block
 				* params->blocks_per_sector
 				* params->nr_sectors;
 
-	printf("SF: Detected %s with page size %u, total ",
-	       params->name, page_size);
-	print_size(asf->flash.size, "\n");
-
 	return &asf->flash;
 
 err:
diff --git a/drivers/mtd/spi/eon.c b/drivers/mtd/spi/eon.c
index 01caed5..e3de3aa 100644
--- a/drivers/mtd/spi/eon.c
+++ b/drivers/mtd/spi/eon.c
@@ -119,13 +119,9 @@
 	return ret;
 }
 
-int eon_erase(struct spi_flash *flash, u32 offset, size_t len)
+static int eon_erase(struct spi_flash *flash, u32 offset, size_t len)
 {
-	struct eon_spi_flash *eon = to_eon_spi_flash(flash);
-	return spi_flash_cmd_erase(flash, CMD_EN25Q128_BE,
-		eon->params->page_size * eon->params->pages_per_sector *
-			eon->params->sectors_per_block;
-		offset, len);
+	return spi_flash_cmd_erase(flash, CMD_EN25Q128_BE, offset, len);
 }
 
 struct spi_flash *spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode)
@@ -158,11 +154,10 @@
 	eon->flash.write = eon_write;
 	eon->flash.erase = eon_erase;
 	eon->flash.read = spi_flash_cmd_read_fast;
+	eon->flash.sector_size = params->page_size * params->pages_per_sector
+	    * params->sectors_per_block;
 	eon->flash.size = params->page_size * params->pages_per_sector
 	    * params->nr_sectors;
 
-	debug("SF: Detected %s with page size %u, total %u bytes\n",
-	      params->name, params->page_size, eon->flash.size);
-
 	return &eon->flash;
 }
diff --git a/drivers/mtd/spi/macronix.c b/drivers/mtd/spi/macronix.c
index 4155d4d..ff66f2a 100644
--- a/drivers/mtd/spi/macronix.c
+++ b/drivers/mtd/spi/macronix.c
@@ -175,13 +175,9 @@
 	return ret;
 }
 
-int macronix_erase(struct spi_flash *flash, u32 offset, size_t len)
+static int macronix_erase(struct spi_flash *flash, u32 offset, size_t len)
 {
-	struct macronix_spi_flash *mcx = to_macronix_spi_flash(flash);
-	return spi_flash_cmd_erase(flash, CMD_MX25XX_BE,
-		mcx->params->page_size * mcx->params->pages_per_sector *
-			mcx->params->sectors_per_block,
-		offset, len);
+	return spi_flash_cmd_erase(flash, CMD_MX25XX_BE, offset, len);
 }
 
 struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
@@ -215,12 +211,9 @@
 	mcx->flash.write = macronix_write;
 	mcx->flash.erase = macronix_erase;
 	mcx->flash.read = spi_flash_cmd_read_fast;
-	mcx->flash.size = params->page_size * params->pages_per_sector
-	    * params->sectors_per_block * params->nr_blocks;
-
-	printf("SF: Detected %s with page size %u, total ",
-	       params->name, params->page_size);
-	print_size(mcx->flash.size, "\n");
+	mcx->flash.sector_size = params->page_size * params->pages_per_sector
+		* params->sectors_per_block;
+	mcx->flash.size = mcx->flash.sector_size * params->nr_blocks;
 
 	return &mcx->flash;
 }
diff --git a/drivers/mtd/spi/ramtron.c b/drivers/mtd/spi/ramtron.c
index 171390d..078d16c 100644
--- a/drivers/mtd/spi/ramtron.c
+++ b/drivers/mtd/spi/ramtron.c
@@ -233,7 +233,7 @@
 		CMD_RAMTRON_WRITE);
 }
 
-int ramtron_erase(struct spi_flash *flash, u32 offset, size_t len)
+static int ramtron_erase(struct spi_flash *flash, u32 offset, size_t len)
 {
 	debug("SF: Erase of RAMTRON FRAMs is pointless\n");
 	return -1;
@@ -312,8 +312,5 @@
 	sn->flash.erase = ramtron_erase;
 	sn->flash.size = params->size;
 
-	printf("SF: Detected %s with size ", params->name);
-	print_size(sn->flash.size, "\n");
-
 	return &sn->flash;
 }
diff --git a/drivers/mtd/spi/spansion.c b/drivers/mtd/spi/spansion.c
index d54a5fa..a3401b3 100644
--- a/drivers/mtd/spi/spansion.c
+++ b/drivers/mtd/spi/spansion.c
@@ -196,12 +196,9 @@
 	return ret;
 }
 
-int spansion_erase(struct spi_flash *flash, u32 offset, size_t len)
+static int spansion_erase(struct spi_flash *flash, u32 offset, size_t len)
 {
-	struct spansion_spi_flash *spsn = to_spansion_spi_flash(flash);
-	return spi_flash_cmd_erase(flash, CMD_S25FLXX_SE,
-		spsn->params->page_size * spsn->params->pages_per_sector,
-		offset, len);
+	return spi_flash_cmd_erase(flash, CMD_S25FLXX_SE, offset, len);
 }
 
 struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode)
@@ -240,12 +237,8 @@
 	spsn->flash.write = spansion_write;
 	spsn->flash.erase = spansion_erase;
 	spsn->flash.read = spi_flash_cmd_read_fast;
-	spsn->flash.size = params->page_size * params->pages_per_sector
-	    * params->nr_sectors;
-
-	printf("SF: Detected %s with page size %u, total ",
-	       params->name, params->page_size);
-	print_size(spsn->flash.size, "\n");
+	spsn->flash.sector_size = params->page_size * params->pages_per_sector;
+	spsn->flash.size = spsn->flash.sector_size * params->nr_sectors;
 
 	return &spsn->flash;
 }
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 5c261f1..c75b716 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -131,12 +131,13 @@
 }
 
 int spi_flash_cmd_erase(struct spi_flash *flash, u8 erase_cmd,
-			u32 erase_size, u32 offset, size_t len)
+			u32 offset, size_t len)
 {
-	u32 start, end;
+	u32 start, end, erase_size;
 	int ret;
 	u8 cmd[4];
 
+	erase_size = flash->sector_size;
 	if (offset % erase_size || len % erase_size) {
 		debug("SF: Erase offset/length not multiple of erase size\n");
 		return -1;
@@ -296,6 +297,10 @@
 		goto err_manufacturer_probe;
 	}
 
+	printf("SF: Detected %s with page size ", flash->name);
+	print_size(flash->sector_size, ", total ");
+	print_size(flash->size, "\n");
+
 	spi_release_bus(spi);
 
 	return flash;
diff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h
index d7bcd6d..fc109ce 100644
--- a/drivers/mtd/spi/spi_flash_internal.h
+++ b/drivers/mtd/spi/spi_flash_internal.h
@@ -64,7 +64,7 @@
 
 /* Erase sectors. */
 int spi_flash_cmd_erase(struct spi_flash *flash, u8 erase_cmd,
-			u32 erase_size, u32 offset, size_t len);
+			u32 offset, size_t len);
 
 /* Manufacturer-specific probe functions */
 struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode);
diff --git a/drivers/mtd/spi/sst.c b/drivers/mtd/spi/sst.c
index 792d04d..4dc2db2 100644
--- a/drivers/mtd/spi/sst.c
+++ b/drivers/mtd/spi/sst.c
@@ -71,6 +71,10 @@
 		.nr_sectors = 1024,
 		.name = "SST25VF032B",
 	},{
+		.idcode1 = 0x4b,
+		.nr_sectors = 2048,
+		.name = "SST25VF064C",
+	},{
 		.idcode1 = 0x01,
 		.nr_sectors = 16,
 		.name = "SST25WF512",
@@ -199,10 +203,9 @@
 	return ret;
 }
 
-int sst_erase(struct spi_flash *flash, u32 offset, size_t len)
+static int sst_erase(struct spi_flash *flash, u32 offset, size_t len)
 {
-	return spi_flash_cmd_erase(flash, CMD_SST_SE, SST_SECTOR_SIZE,
-		offset, len);
+	return spi_flash_cmd_erase(flash, CMD_SST_SE, offset, len);
 }
 
 static int
@@ -256,11 +259,9 @@
 
 	stm->flash.write = sst_write;
 	stm->flash.erase = sst_erase;
-	stm->flash.size = SST_SECTOR_SIZE * params->nr_sectors;
-
-	printf("SF: Detected %s with page size %u, total ",
-	       params->name, SST_SECTOR_SIZE);
-	print_size(stm->flash.size, "\n");
+	stm->flash.read = spi_flash_cmd_read_fast;
+	stm->flash.sector_size = SST_SECTOR_SIZE;
+	stm->flash.size = stm->flash.sector_size * params->nr_sectors;
 
 	/* Flash powers up read-only, so clear BP# bits */
 	sst_unlock(&stm->flash);
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index 7ef690d..a1959ca 100644
--- a/drivers/mtd/spi/stmicro.c
+++ b/drivers/mtd/spi/stmicro.c
@@ -197,12 +197,9 @@
 	return ret;
 }
 
-int stmicro_erase(struct spi_flash *flash, u32 offset, size_t len)
+static int stmicro_erase(struct spi_flash *flash, u32 offset, size_t len)
 {
-	struct stmicro_spi_flash *stm = to_stmicro_spi_flash(flash);
-	return spi_flash_cmd_erase(flash, CMD_M25PXX_SE,
-		stm->params->page_size * stm->params->pages_per_sector,
-		offset, len);
+	return spi_flash_cmd_erase(flash, CMD_M25PXX_SE, offset, len);
 }
 
 struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode)
@@ -249,12 +246,8 @@
 	stm->flash.write = stmicro_write;
 	stm->flash.erase = stmicro_erase;
 	stm->flash.read = spi_flash_cmd_read_fast;
-	stm->flash.size = params->page_size * params->pages_per_sector
-	    * params->nr_sectors;
-
-	printf("SF: Detected %s with page size %u, total ",
-	       params->name, params->page_size);
-	print_size(stm->flash.size, "\n");
+	stm->flash.sector_size = params->page_size * params->pages_per_sector;
+	stm->flash.size = stm->flash.sector_size * params->nr_sectors;
 
 	return &stm->flash;
 }
diff --git a/drivers/mtd/spi/winbond.c b/drivers/mtd/spi/winbond.c
index e88802f..e8d30ae 100644
--- a/drivers/mtd/spi/winbond.c
+++ b/drivers/mtd/spi/winbond.c
@@ -170,12 +170,9 @@
 	return ret;
 }
 
-int winbond_erase(struct spi_flash *flash, u32 offset, size_t len)
+static int winbond_erase(struct spi_flash *flash, u32 offset, size_t len)
 {
-	struct winbond_spi_flash *stm = to_winbond_spi_flash(flash);
-	return spi_flash_cmd_erase(flash, CMD_W25_SE,
-		(1 << stm->params->l2_page_size) * stm->params->pages_per_sector,
-		offset, len);
+	return spi_flash_cmd_erase(flash, CMD_W25_SE, offset, len);
 }
 
 struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
@@ -213,13 +210,11 @@
 	stm->flash.write = winbond_write;
 	stm->flash.erase = winbond_erase;
 	stm->flash.read = spi_flash_cmd_read_fast;
+	stm->flash.sector_size = (1 << stm->params->l2_page_size) *
+		stm->params->pages_per_sector;
 	stm->flash.size = page_size * params->pages_per_sector
 				* params->sectors_per_block
 				* params->nr_blocks;
 
-	printf("SF: Detected %s with page size %u, total ",
-	       params->name, page_size);
-	print_size(stm->flash.size, "\n");
-
 	return &stm->flash;
 }
diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 2d2e709..507d38c 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -4,7 +4,7 @@
 #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
 #endif /* GCC_VERSION */
 
-#if defined(CONFIG_I386)
+#if defined(CONFIG_X86)
 /*
  * x86 does not have a dedicated register to store the pointer to
  * the global_data. Thus the jump table address is stored in a
@@ -198,7 +198,7 @@
 		*cp++ = 0;
 	}
 
-#if defined(CONFIG_I386)
+#if defined(CONFIG_X86)
 	/* x86 does not have a dedicated register for passing global_data */
 	global_data = (gd_t *)argv[-1];
 	jt = global_data->jt;
diff --git a/include/common.h b/include/common.h
index 9ba1601..21c05db 100644
--- a/include/common.h
+++ b/include/common.h
@@ -272,9 +272,9 @@
 # include <asm/setup.h>
 # include <asm/u-boot-arm.h>	/* ARM version to be fixed! */
 #endif /* CONFIG_ARM */
-#ifdef CONFIG_I386		/* x86 version to be fixed! */
-# include <asm/u-boot-i386.h>
-#endif /* CONFIG_I386 */
+#ifdef CONFIG_X86		/* x86 version to be fixed! */
+# include <asm/u-boot-x86.h>
+#endif /* CONFIG_X86 */
 
 #ifdef CONFIG_AUTO_COMPLETE
 int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf);
diff --git a/include/configs/eNET.h b/include/configs/eNET.h
index 34a9d68..548d52c 100644
--- a/include/configs/eNET.h
+++ b/include/configs/eNET.h
@@ -33,7 +33,6 @@
  * High Level Configuration Options
  * (easy to change)
  */
-#define CONFIG_X86
 #define CONFIG_SYS_SC520
 #define CONFIG_SYS_SC520_SSI
 #define CONFIG_SHOW_BOOT_PROGRESS
@@ -158,16 +157,19 @@
 /*-----------------------------------------------------------------------
  * Memory organization:
  * 32kB Stack
+ * 16kB Cache-As-RAM @ 0x19200000
  * 256kB Monitor
+ * (128kB + Environment Sector Size) malloc pool
  */
-#define CONFIG_SYS_STACK_SIZE			0x8000
+#define CONFIG_SYS_STACK_SIZE			(32 * 1024)
 #define CONFIG_SYS_CAR_ADDR			0x19200000
-#define CONFIG_SYS_CAR_SIZE			0x00004000
+#define CONFIG_SYS_CAR_SIZE			(16 * 1024)
 #define CONFIG_SYS_INIT_SP_ADDR			(CONFIG_SYS_CAR_ADDR + \
 						 CONFIG_SYS_CAR_SIZE)
 #define CONFIG_SYS_MONITOR_BASE			CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_MONITOR_LEN			(256 * 1024)
-#define CONFIG_SYS_MALLOC_LEN			(CONFIG_ENV_SIZE + 128*1024)
+#define CONFIG_SYS_MALLOC_LEN			(CONFIG_ENV_SECT_SIZE + \
+						 128*1024)
 /* Address of temporary Global Data */
 #define CONFIG_SYS_INIT_GD_ADDR			CONFIG_SYS_CAR_ADDR
 
@@ -198,17 +200,25 @@
 #define CONFIG_SYS_FLASH_LEGACY_512Kx8
 #define CONFIG_SYS_FLASH_ERASE_TOUT		2000	/* ms */
 #define CONFIG_SYS_FLASH_WRITE_TOUT		2000	/* ms */
+
 /*-----------------------------------------------------------------------
  * Environment configuration
+ * - Boot flash is 512kB with 64kB sectors
+ * - StrataFlash is 32MB with 128kB sectors
+ * - Redundant embedded environment is 25% of the Boot flash
+ * - Redundant StrataFlash environment is <1% of the StrataFlash
+ * - Environment is therefore located in StrataFlash
+ * - Primary copy is located in first sector of first flash
+ * - Redundant copy is located in second sector of first flash
+ * - Stack is only 32kB, so environment size is limited to 4kB
  */
 #define CONFIG_ENV_IS_IN_FLASH
 #define CONFIG_ENV_SECT_SIZE			0x20000
-#define CONFIG_ENV_SIZE				CONFIG_ENV_SECT_SIZE
+#define CONFIG_ENV_SIZE				0x01000
 #define CONFIG_ENV_ADDR				CONFIG_SYS_FLASH_BASE_1
-/* Redundant Copy */
 #define CONFIG_ENV_ADDR_REDUND			(CONFIG_SYS_FLASH_BASE_1 + \
 						 CONFIG_ENV_SECT_SIZE)
-#define CONFIG_ENV_SIZE_REDUND			CONFIG_ENV_SECT_SIZE
+#define CONFIG_ENV_SIZE_REDUND			CONFIG_ENV_SIZE
 
 /*-----------------------------------------------------------------------
  * PCI configuration
diff --git a/include/exports.h b/include/exports.h
index 6382311..ddd1bf4 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -45,7 +45,7 @@
 
 #define XF_VERSION	6
 
-#if defined(CONFIG_I386)
+#if defined(CONFIG_X86)
 extern gd_t *global_data;
 #endif
 
diff --git a/include/spi_flash.h b/include/spi_flash.h
index 1f8ba29..a384071 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -26,11 +26,6 @@
 #include <spi.h>
 #include <linux/types.h>
 
-struct spi_flash_region {
-	unsigned int	count;
-	unsigned int	size;
-};
-
 struct spi_flash {
 	struct spi_slave *spi;
 
@@ -38,6 +33,8 @@
 
 	u32		size;
 
+	u32		sector_size;
+
 	int		(*read)(struct spi_flash *flash, u32 offset,
 				size_t len, void *buf);
 	int		(*write)(struct spi_flash *flash, u32 offset,
diff --git a/net/bootp.c b/net/bootp.c
index 1a71786..87b027e 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -464,7 +464,7 @@
 
 	/* Pad to minimal length */
 #ifdef	CONFIG_DHCP_MIN_EXT_LEN
-	while ((e - start) <= CONFIG_DHCP_MIN_EXT_LEN)
+	while ((e - start) < CONFIG_DHCP_MIN_EXT_LEN)
 		*e++ = 0;
 #endif