* Code cleanup:
  - remove trailing white space, trailing empty lines, C++ comments, etc.
  - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
  - major rework of command structure
    (work done mostly by Michal Cendrowski and Joakim Kristiansen)
diff --git a/cpu/mpc5xx/Makefile b/cpu/mpc5xx/Makefile
index c05b394..ee20dda 100644
--- a/cpu/mpc5xx/Makefile
+++ b/cpu/mpc5xx/Makefile
@@ -23,10 +23,10 @@
 
 #
 # File:			cpu/mpc5xx/Makefile
-# 
+#
 # Discription:		Makefile to build mpc5xx cpu configuration.
 #			Will include top config.mk which itselfs
-#			uses the definitions made in cpu/mpc5xx/config.mk 
+#			uses the definitions made in cpu/mpc5xx/config.mk
 #
 
 
@@ -34,7 +34,7 @@
 
 LIB	= lib$(CPU).a
 
-START	= start.S 
+START	= start.S
 OBJS	= serial.o cpu.o cpu_init.o interrupts.o traps.o speed.o
 
 all:	.depend $(START) $(LIB)
diff --git a/cpu/mpc5xx/config.mk b/cpu/mpc5xx/config.mk
index d302d48..cfed499 100644
--- a/cpu/mpc5xx/config.mk
+++ b/cpu/mpc5xx/config.mk
@@ -23,12 +23,11 @@
 
 #
 # File:			config.mk
-# 
+#
 # Discription:		compiler flags and make definitions
 #
- 
+
 
 PLATFORM_RELFLAGS += 	-mrelocatable -ffixed-r14 -meabi
 
 PLATFORM_CPPFLAGS +=	-DCONFIG_5xx -ffixed-r2 -ffixed-r29  -mpowerpc -msoft-float
-
diff --git a/cpu/mpc5xx/cpu.c b/cpu/mpc5xx/cpu.c
index 5b3bd26..cc69511 100644
--- a/cpu/mpc5xx/cpu.c
+++ b/cpu/mpc5xx/cpu.c
@@ -17,15 +17,15 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, 
+ * Foundation,
  */
 
 /*
  * File:		cpu.c
- * 
- * Discription:		Some cpu specific function for watchdog, 
+ *
+ * Discription:		Some cpu specific function for watchdog,
  *                      cpu version test, clock setting ...
- * 
+ *
  */
 
 
@@ -74,7 +74,7 @@
 }
 
 /*
- * Called by macro WATCHDOG_RESET 
+ * Called by macro WATCHDOG_RESET
  */
 #if defined(CONFIG_WATCHDOG)
 void watchdog_reset (void)
@@ -93,7 +93,7 @@
 {
 	/* Use the MPC5xx Internal Watchdog */
 	immr->im_siu_conf.sc_swsr = 0x556c;	/* Prevent SW time-out */
-	immr->im_siu_conf.sc_swsr = 0xaa39;    
+	immr->im_siu_conf.sc_swsr = 0xaa39;
 }
 
 #endif /* CONFIG_WATCHDOG */
@@ -124,32 +124,31 @@
 
 
 /*
- * Reset board 
+ * Reset board
  */
 int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 {
 	ulong addr;
-	
+
 	/* Interrupts off, enable reset */
-        __asm__ volatile	("  mtspr	81, %r0		\n\t"
+	__asm__ volatile	("  mtspr	81, %r0		\n\t"
 				 "  mfmsr	%r3		\n\t"
 				 "  rlwinm	%r31,%r3,0,25,23\n\t"
 				 "  mtmsr	%r31		\n\t");
-        /*
-         * Trying to execute the next instruction at a non-existing address
-         * should cause a machine check, resulting in reset
-         */
+	/*
+	 * Trying to execute the next instruction at a non-existing address
+	 * should cause a machine check, resulting in reset
+	 */
 #ifdef CFG_RESET_ADDRESS
-        addr = CFG_RESET_ADDRESS;
+	addr = CFG_RESET_ADDRESS;
 #else
-        /*
-         * note: when CFG_MONITOR_BASE points to a RAM address, CFG_MONITOR_BASE         * - sizeof (ulong) is usually a valid address. Better pick an address
-         * known to be invalid on your system and assign it to CFG_RESET_ADDRESS.
-         * "(ulong)-1" used to be a good choice for many systems...
-         */
-        addr = CFG_MONITOR_BASE - sizeof (ulong);
+	/*
+	 * note: when CFG_MONITOR_BASE points to a RAM address, CFG_MONITOR_BASE         * - sizeof (ulong) is usually a valid address. Better pick an address
+	 * known to be invalid on your system and assign it to CFG_RESET_ADDRESS.
+	 * "(ulong)-1" used to be a good choice for many systems...
+	 */
+	addr = CFG_MONITOR_BASE - sizeof (ulong);
 #endif
 	((void (*) (void)) addr) ();
 	return 1;
 }
-
diff --git a/cpu/mpc5xx/cpu_init.c b/cpu/mpc5xx/cpu_init.c
index 27cf3d6..e19d0f4 100644
--- a/cpu/mpc5xx/cpu_init.c
+++ b/cpu/mpc5xx/cpu_init.c
@@ -16,12 +16,12 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, 
+ * Foundation,
  */
 
 /*
  * File:		cpu_init.c
- * 
+ *
  * Discription:		Contains initialisation functions to setup
  *    			the cpu properly
  *
@@ -32,7 +32,7 @@
 #include <watchdog.h>
 
 /*
- * Setup essential cpu registers to run 
+ * Setup essential cpu registers to run
  */
 void cpu_init_f (volatile immap_t * immr)
 {
@@ -45,7 +45,7 @@
 
 #if defined(CONFIG_WATCHDOG)
 	reset_5xx_watchdog (immr);
-#endif 
+#endif
 
 	/* SIUMCR - contains debug pin configuration */
 	immr->im_siu_conf.sc_siumcr |= CFG_SIUMCR;
@@ -56,10 +56,10 @@
 
 	/* Full IMB bus speed */
 	immr->im_uimb.uimb_umcr = CFG_UMCR;
-	
+
 	/* Time base and decrementer will be enables (TBE) */
 	/* in init_timebase() in time.c called from board_init_f(). */
- 
+
 	/* Initialize the PIT. Unlock PISCRK */
 	immr->im_sitk.sitk_piscrk = KAPWR_KEY;
 	immr->im_sit.sit_piscr = CFG_PISCR;
diff --git a/cpu/mpc5xx/interrupts.c b/cpu/mpc5xx/interrupts.c
index 282c316..4618680 100644
--- a/cpu/mpc5xx/interrupts.c
+++ b/cpu/mpc5xx/interrupts.c
@@ -17,12 +17,12 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, 
+ * Foundation,
  */
 
 /*
  * File:		interrupt.c
- * 
+ *
  * Discription:		Contains interrupt routines needed by U-Boot
  *
  */
@@ -46,7 +46,7 @@
 static struct interrupt_action irq_vecs[NR_IRQS];
 
 /*
- * Local function prototypes 
+ * Local function prototypes
  */
 static __inline__ unsigned long get_msr (void)
 {
@@ -78,15 +78,15 @@
 }
 
 /*
- * Enable interrupts 
- */ 
+ * Enable interrupts
+ */
 void enable_interrupts (void)
 {
 	set_msr (get_msr () | MSR_EE);
 }
 
-/* 
- * Returns flag if MSR_EE was set before 
+/*
+ * Returns flag if MSR_EE was set before
  */
 int disable_interrupts (void)
 {
@@ -97,7 +97,7 @@
 }
 
 /*
- * Initialise interrupts 
+ * Initialise interrupts
  */
 
 int interrupt_init (void)
@@ -209,7 +209,7 @@
 volatile ulong timestamp = 0;
 
 /*
- *  Timer interrupt - gets called when  bit 0 of DEC changes from 
+ *  Timer interrupt - gets called when  bit 0 of DEC changes from
  *  0. Decrementer is enabled with bit TBE in TBSCR.
  */
 void timer_interrupt (struct pt_regs *regs)
@@ -226,7 +226,7 @@
 	immr->im_clkrstk.cark_plprcrk = KAPWR_KEY;
 	__asm__ ("nop");
 	immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS | PLPRCR_TMIST;
-	
+
 	/* Restore Decrementer Count */
 	set_dec (decrementer_count);
 
@@ -249,7 +249,7 @@
 }
 
 /*
- * Reset timer 
+ * Reset timer
  */
 void reset_timer (void)
 {
diff --git a/cpu/mpc5xx/serial.c b/cpu/mpc5xx/serial.c
index 738c275..4868782 100644
--- a/cpu/mpc5xx/serial.c
+++ b/cpu/mpc5xx/serial.c
@@ -17,13 +17,13 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, 
+ * Foundation,
  */
 
 /*
  * File:		serial.c
- * 
- * Discription:		Serial interface driver for SCI1 and SCI2. 
+ *
+ * Discription:		Serial interface driver for SCI1 and SCI2.
  *     			Since this code will be called from ROM use
  * 			only non-static local variables.
  *
@@ -36,7 +36,7 @@
 
 
 /*
- * Local function prototypes 
+ * Local function prototypes
  */
 
 static int ready_to_send(void);
@@ -54,25 +54,25 @@
 #if defined(CONFIG_5xx_CONS_SCI1)
 	/* 10-Bit, 1 start bit, 8 data bit, no parity, 1 stop bit */
 	immr->im_qsmcm.qsmcm_scc1r1 = SCI_M_10;
-	immr->im_qsmcm.qsmcm_scc1r1 = SCI_TE | SCI_RE; 
+	immr->im_qsmcm.qsmcm_scc1r1 = SCI_TE | SCI_RE;
 #else
-	immr->im_qsmcm.qsmcm_scc2r1 = SCI_M_10; 
+	immr->im_qsmcm.qsmcm_scc2r1 = SCI_M_10;
 	immr->im_qsmcm.qsmcm_scc2r1 = SCI_TE | SCI_RE;
 #endif
 	return 0;
 }
 
 void serial_putc(const char c)
-{        
+{
 	volatile immap_t *immr = (immap_t *)CFG_IMMR;
-	
+
 	/* Test for completition */
 	if(ready_to_send()) {
 #if defined(CONFIG_5xx_CONS_SCI1)
-		immr->im_qsmcm.qsmcm_sc1dr = (short)c; 
+		immr->im_qsmcm.qsmcm_sc1dr = (short)c;
 #else
 		immr->im_qsmcm.qsmcm_sc2dr = (short)c;
-#endif		
+#endif
 		if(c == '\n') {
 			if(ready_to_send());
 #if defined(CONFIG_5xx_CONS_SCI1)
@@ -85,27 +85,27 @@
 }
 
 int serial_getc(void)
-{	
+{
 	volatile immap_t *immr = (immap_t *)CFG_IMMR;
 	volatile short status;
 	unsigned char tmp;
-    
+
 	/* New data ? */
 	do {
 #if defined(CONFIG_5xx_CONS_SCI1)
-      		status = immr->im_qsmcm.qsmcm_sc1sr; 
+		status = immr->im_qsmcm.qsmcm_sc1sr;
 #else
 		status = immr->im_qsmcm.qsmcm_sc2sr;
 #endif
 
 #if defined(CONFIG_WATCHDOG)
-		reset_5xx_watchdog (immr);	
+		reset_5xx_watchdog (immr);
 #endif
-  	} while ((status & SCI_RDRF) == 0);
-    		
+	} while ((status & SCI_RDRF) == 0);
+
 	/* Read data */
 #if defined(CONFIG_5xx_CONS_SCI1)
-	tmp = (unsigned char)(immr->im_qsmcm.qsmcm_sc1dr & SCI_SCXDR_MK); 
+	tmp = (unsigned char)(immr->im_qsmcm.qsmcm_sc1dr & SCI_SCXDR_MK);
 #else
 	tmp = (unsigned char)( immr->im_qsmcm.qsmcm_sc2dr & SCI_SCXDR_MK);
 #endif
@@ -115,27 +115,27 @@
 int serial_tstc()
 {
 	volatile immap_t *immr = (immap_t *)CFG_IMMR;
-  	short status;
+	short status;
 
 	/* New data character ? */
 #if defined(CONFIG_5xx_CONS_SCI1)
-	status = immr->im_qsmcm.qsmcm_sc1sr; 
+	status = immr->im_qsmcm.qsmcm_sc1sr;
 #else
 	status = immr->im_qsmcm.qsmcm_sc2sr;
 #endif
-	return (status & SCI_RDRF); 
+	return (status & SCI_RDRF);
 }
 
 void serial_setbrg (void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
-        volatile immap_t *immr = (immap_t *)CFG_IMMR;
+	volatile immap_t *immr = (immap_t *)CFG_IMMR;
 	short scxbr;
 
 	/* Set baudrate */
 	scxbr = (gd->cpu_clk / (32 * gd->baudrate));
 #if defined(CONFIG_5xx_CONS_SCI1)
-	immr->im_qsmcm.qsmcm_scc1r0 = (scxbr & SCI_SCXBR_MK); 
+	immr->im_qsmcm.qsmcm_scc1r0 = (scxbr & SCI_SCXBR_MK);
 #else
 	immr->im_qsmcm.qsmcm_scc2r0 = (scxbr & SCI_SCXBR_MK);
 #endif
@@ -154,18 +154,17 @@
 	volatile immap_t *immr = (immap_t *)CFG_IMMR;
 	volatile short status;
 
-  	do {
+	do {
 #if defined(CONFIG_5xx_CONS_SCI1)
-    		status = immr->im_qsmcm.qsmcm_sc1sr; 
+		status = immr->im_qsmcm.qsmcm_sc1sr;
 #else
 		status = immr->im_qsmcm.qsmcm_sc2sr;
 #endif
 
 #if defined(CONFIG_WATCHDOG)
-		reset_5xx_watchdog (immr);	
+		reset_5xx_watchdog (immr);
 #endif
-  	} while ((status & SCI_TDRE) == 0);
-	return 1; 
+	} while ((status & SCI_TDRE) == 0);
+	return 1;
 
 }
-
diff --git a/cpu/mpc5xx/speed.c b/cpu/mpc5xx/speed.c
index 8098c99..f6097f5 100644
--- a/cpu/mpc5xx/speed.c
+++ b/cpu/mpc5xx/speed.c
@@ -17,14 +17,14 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, 
+ * Foundation,
  */
 
 /*
  * File:		speed.c
- * 
+ *
  * Discription:		Provides cpu speed calculation
- * 
+ *
  */
 
 #include <common.h>
@@ -49,8 +49,8 @@
 		gd->cpu_clk = vcoout / (2^(((immr->im_clkrst.car_sccr & SCCR_DFNL_MSK) >> SCCR_DFNL_SHIFT) + 1));
 	} else {
     		gd->cpu_clk = vcoout / (2^(immr->im_clkrst.car_sccr & SCCR_DFNH_MSK));
-    	}	
-	
+    	}
+
 #else /* CONFIG_5xx_GCLK_FREQ */
 	gd->bus_clk = CONFIG_5xx_GCLK_FREQ;
 #endif /* CONFIG_5xx_GCLK_FREQ */
diff --git a/cpu/mpc5xx/start.S b/cpu/mpc5xx/start.S
index 694de77..3b6d344 100644
--- a/cpu/mpc5xx/start.S
+++ b/cpu/mpc5xx/start.S
@@ -3,7 +3,7 @@
  *  Copyright (C) 1999	Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
  *  Copyright (C) 2000, 2001, 2002 Wolfgang Denk <wd@denx.de>
  *  Copyright (C) 2003  Martin Winistoerfer, martinwinistoerfer@gmx.ch.
- * 
+ *
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -25,7 +25,7 @@
 
 /*
  * File:		start.S
- * 
+ *
  * Discription:		startup code
  *
  */
@@ -39,9 +39,9 @@
 
 #include <ppc_asm.tmpl>
 #include <ppc_defs.h>
-	
+
 #include <linux/config.h>
-#include <asm/processor.h>	
+#include <asm/processor.h>
 
 #ifndef  CONFIG_IDENT_STRING
 #define  CONFIG_IDENT_STRING ""
@@ -88,7 +88,7 @@
 _start:
 	mfspr	r3, 638
 	li	r4, CFG_ISB			/* Set ISB bit */
-	or	r3, r3, r4 
+	or	r3, r3, r4
 	mtspr	638, r3
 	li	r21, BOOTFLAG_COLD		/* Normal Power-On: Boot from FLASH	*/
 	b	boot_cold
@@ -131,7 +131,7 @@
 
 	/* Initialize some SPRs that are hard to access from C			*/
 	/*----------------------------------------------------------------------*/
-	
+
 	lis     r3, CFG_IMMR@h          	/* Pass IMMR as arg1 to C routine */
 	lis	r2, CFG_INIT_SP_ADDR@h
 	ori	r1, r2, CFG_INIT_SP_ADDR@l	/* Set up the stack in internal SRAM */
@@ -169,7 +169,6 @@
 	bl	board_init_f	/* run 1st part of board init code (from Flash) */
 
 
-
 	.globl	_start_of_vectors
 _start_of_vectors:
 
@@ -389,7 +388,7 @@
 	SYNC
 	rfi
 
-		
+
 /*
  * unsigned int get_immr (unsigned int mask)
  *
@@ -476,7 +475,7 @@
 	stwu	r0,-4(r7)
 	bdnz	3b
 
-4:	sync			
+4:	sync
 	isync
 
 /*
@@ -493,8 +492,8 @@
 	/*
 	 * Relocation Function, r14 point to got2+0x8000
 	 *
-         * Adjust got2 pointers, no need to check for 0, this code
-         * already puts a few entries in the table.
+	 * Adjust got2 pointers, no need to check for 0, this code
+	 * already puts a few entries in the table.
 	 */
 	li	r0,__got2_entries@sectoff@l
 	la	r3,GOT(_GOT2_TABLE_)
@@ -508,7 +507,7 @@
 	bdnz	1b
 
 	/*
-         * Now adjust the fixups and the pointers to the fixups
+	 * Now adjust the fixups and the pointers to the fixups
 	 * in case we need to move ourselves again.
 	 */
 2:	li	r0,__fixup_entries@sectoff@l