* 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/tools/updater/Makefile b/tools/updater/Makefile
index a8fb4ce..21b11ca 100644
--- a/tools/updater/Makefile
+++ b/tools/updater/Makefile
@@ -29,9 +29,9 @@
 IMAGE   = updater.image
 SRC     = update.c flash.c flash_hw.c utils.c cmd_flash.c string.c ctype.c dummy.c
 ASRC    = ppcstring.S
-OBJS	= $(SRC:.c=.o) $(ASRC:.S=.o) 
+OBJS	= $(SRC:.c=.o) $(ASRC:.S=.o)
 
-LIB	= $(TOPDIR)/examples/libsyscall.a 
+LIB	= $(TOPDIR)/examples/libsyscall.a
 LIBAOBJS= $(TOPDIR)/examples/syscall.o
 LIBCOBJS=
 LIBOBJS	= $(LIBAOBJS) $(LIBCOBJS)
@@ -50,14 +50,14 @@
 	$(OBJCOPY) -O srec $(<:.o=) $@
 
 %.o: %.c
-	$(CC) $(CPPFLAGS) -c $< 
+	$(CC) $(CPPFLAGS) -c $<
 
 %.o: %.S
 	$(CC) $(CPPFLAGS) -c $<
 
 #########################################################################
 
-updater: $(OBJS) $(LIB) $(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o 
+updater: $(OBJS) $(LIB) $(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o
 	$(LD) -g -Ttext $(LOAD_ADDR) -o updater -e _main $(OBJS) $(LIB)  \
 	$(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o
 	$(OBJCOPY) -O binary updater updater.bin
diff --git a/tools/updater/cmd_flash.c b/tools/updater/cmd_flash.c
index f3465f1..573546d 100644
--- a/tools/updater/cmd_flash.c
+++ b/tools/updater/cmd_flash.c
@@ -26,7 +26,6 @@
  */
 #include <common.h>
 #include <command.h>
-#include <cmd_boot.h>
 #include <flash.h>
 
 #if (CONFIG_COMMANDS & CFG_CMD_FLASH)
@@ -227,7 +226,7 @@
 		}
 	}
 	if (erased) {
-	    //	mon_printf ("Erased %d sectors\n", erased);
+	    /*	mon_printf ("Erased %d sectors\n", erased); */
 	} else {
 		mon_printf ("Error: start and/or end address"
 			" not on sector boundary\n");
@@ -264,8 +263,8 @@
 			if (info->flash_id == FLASH_UNKNOWN) {
 				continue;
 			}
-			//mon_printf ("%sProtect Flash Bank # %ld\n",
-			//	p ? "" : "Un-", bank);
+			/*mon_printf ("%sProtect Flash Bank # %ld\n", */
+			/*	p ? "" : "Un-", bank); */
 
 			for (i=0; i<info->sector_count; ++i) {
 #if defined(CFG_FLASH_PROTECTION)
@@ -290,9 +289,9 @@
 			mon_printf("Bad sector specification\n");
 			return 1;
 		}
-		//mon_printf("%sProtect Flash Sectors %d-%d in Bank # %d\n",
-		//	p ? "" : "Un-", sect_first, sect_last,
-		//	(info-flash_info)+1);
+		/*mon_printf("%sProtect Flash Sectors %d-%d in Bank # %d\n", */
+		/*	p ? "" : "Un-", sect_first, sect_last, */
+		/*	(info-flash_info)+1); */
 		for (i = sect_first; i <= sect_last; i++) {
 #if defined(CFG_FLASH_PROTECTION)
 			if (flash_real_protect(info, i, p))
@@ -418,8 +417,8 @@
 
 	}
 	if (protected) {
-	    //	mon_printf ("%sProtected %d sectors\n",
-	    //	p ? "" : "Un-", protected);
+	    /*	mon_printf ("%sProtected %d sectors\n", */
+	    /*	p ? "" : "Un-", protected); */
 	} else {
 	    mon_printf ("Error: start and/or end address"
 			" not on sector boundary\n");
diff --git a/tools/updater/flash_hw.c b/tools/updater/flash_hw.c
index ec11589..1d782c6 100644
--- a/tools/updater/flash_hw.c
+++ b/tools/updater/flash_hw.c
@@ -31,7 +31,6 @@
 
 /*---------------------------------------------------------------------*/
 #undef DEBUG_FLASH
-//#define DEBUG_FLASH
 
 #ifdef DEBUG_FLASH
 #define DEBUGF(fmt,args...) mon_printf(fmt ,##args)
@@ -68,7 +67,7 @@
     unsigned char x;
 
     flash_xd_nest --;
-   
+
     if (flash_xd_nest == 0)
     {
 	DEBUGF("Flash on memory bus\n");
@@ -327,7 +326,7 @@
 			/* set sector offsets for uniform sector type	*/
 			for (i = 0; i < info->sector_count; i++) {
 				info->start[i] = base + i * info->size /
-				                            info->sector_count;
+							    info->sector_count;
 			}
 			break;
 		default:
@@ -479,7 +478,7 @@
 		}
 
 		if ((rc = write_word(info, wp, data)) != 0) {
-		        flash_to_mem();
+			flash_to_mem();
 			return (rc);
 		}
 		wp += 4;
@@ -491,7 +490,7 @@
 	 * handle word aligned part
 	 */
 	while (cnt >= 4) {
-	    if (out_cnt>26214) 
+	    if (out_cnt>26214)
 	    {
 		mon_putc(219);
 		out_cnt = 0;
@@ -590,7 +589,7 @@
  */
 static void flash_reset (ulong addr)
 {
-        flash_to_xd();
+	flash_to_xd();
 	out8(addr, 0xF0);	/* reset bank */
 	iobarrier_rw();
 	flash_to_mem();
@@ -641,10 +640,10 @@
 			info->size / 0x100000, info->sector_count);
 	} else if (info->size % 0x400 == 0) {
 		mon_printf ("  Size: %ld KB in %d Sectors\n",
-		        info->size / 0x400, info->sector_count);
+			info->size / 0x400, info->sector_count);
 	} else {
 		mon_printf ("  Size: %ld B in %d Sectors\n",
-		        info->size, info->sector_count);
+			info->size, info->sector_count);
 	}
 
 	mon_printf ("  Sector Start Addresses:");
diff --git a/tools/updater/string.c b/tools/updater/string.c
index 50537a6..8a8edec 100644
--- a/tools/updater/string.c
+++ b/tools/updater/string.c
@@ -129,8 +129,8 @@
 {
        const char *p = s + strlen(s);
        do {
-           if (*p == (char)c)
-               return (char *)p;
+	   if (*p == (char)c)
+	       return (char *)p;
        } while (--p >= s);
        return NULL;
 }
@@ -316,7 +316,7 @@
 		p++;
 		size--;
 	}
-  	return (void *) p;
+	return (void *) p;
 }
 #endif
 
diff --git a/tools/updater/update.c b/tools/updater/update.c
index 66c6dfc..26204fb 100644
--- a/tools/updater/update.c
+++ b/tools/updater/update.c
@@ -35,7 +35,7 @@
     mon_printf("\nUpdate done. Please remove diskette.\n");
     mon_printf("The machine will automatically reset in %d seconds\n", i);
     mon_printf("You can switch off/reset now when the floppy is removed\n\n");
-    
+
     while (i)
     {
 	mon_printf("Resetting in %d\r", i);
diff --git a/tools/updater/utils.c b/tools/updater/utils.c
index e230e19..0304f94 100644
--- a/tools/updater/utils.c
+++ b/tools/updater/utils.c
@@ -15,7 +15,7 @@
 static __inline__ void
 set_msr(unsigned long msr)
 {
-	asm volatile("mtmsr %0" : : "r" (msr)); 
+	asm volatile("mtmsr %0" : : "r" (msr));
 }
 
 static __inline__ unsigned long
@@ -31,7 +31,7 @@
 static __inline__ void
 set_dec(unsigned long val)
 {
-	asm volatile("mtdec %0" : : "r" (val)); 
+	asm volatile("mtdec %0" : : "r" (val));
 }
 
 
@@ -69,80 +69,80 @@
 
 unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
 {
-        unsigned long result = 0,value;
+	unsigned long result = 0,value;
 
-        if (*cp == '0') {
-                cp++;
-                if ((*cp == 'x') && isxdigit(cp[1])) {
-                        base = 16;
-                        cp++;
-                }
-                if (!base) {
-                        base = 8;
-                }
-        }
-        if (!base) {
-                base = 10;
-        }
-        while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
-            ? toupper(*cp) : *cp)-'A'+10) < base) {
-                result = result*base + value;
-                cp++;
-        }
-        if (endp)
-                *endp = (char *)cp;
-        return result;
+	if (*cp == '0') {
+		cp++;
+		if ((*cp == 'x') && isxdigit(cp[1])) {
+			base = 16;
+			cp++;
+		}
+		if (!base) {
+			base = 8;
+		}
+	}
+	if (!base) {
+		base = 10;
+	}
+	while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
+	    ? toupper(*cp) : *cp)-'A'+10) < base) {
+		result = result*base + value;
+		cp++;
+	}
+	if (endp)
+		*endp = (char *)cp;
+	return result;
 }
 
 long simple_strtol(const char *cp,char **endp,unsigned int base)
 {
-        if(*cp=='-')
-                return -simple_strtoul(cp+1,endp,base);
-        return simple_strtoul(cp,endp,base);
+	if(*cp=='-')
+		return -simple_strtoul(cp+1,endp,base);
+	return simple_strtoul(cp,endp,base);
 }
 
 static inline void
 soft_restart(unsigned long addr)
 {
-        /* SRR0 has system reset vector, SRR1 has default MSR value */
-        /* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
+	/* SRR0 has system reset vector, SRR1 has default MSR value */
+	/* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
 
-        __asm__ __volatile__ ("mtspr    26, %0"         :: "r" (addr));
-        __asm__ __volatile__ ("li       4, (1 << 6)"    ::: "r4");
-        __asm__ __volatile__ ("mtspr    27, 4");
-        __asm__ __volatile__ ("rfi");
+	__asm__ __volatile__ ("mtspr    26, %0"         :: "r" (addr));
+	__asm__ __volatile__ ("li       4, (1 << 6)"    ::: "r4");
+	__asm__ __volatile__ ("mtspr    27, 4");
+	__asm__ __volatile__ ("rfi");
 
-        while(1);       /* not reached */
+	while(1);       /* not reached */
 }
 
 void
 do_reset (void)
 {
-        ulong addr;
-        /* flush and disable I/D cache */
-        __asm__ __volatile__ ("mfspr    3, 1008"        ::: "r3");
-        __asm__ __volatile__ ("ori      5, 5, 0xcc00"   ::: "r5");
-        __asm__ __volatile__ ("ori      4, 3, 0xc00"    ::: "r4");
-        __asm__ __volatile__ ("andc     5, 3, 5"        ::: "r5");
-        __asm__ __volatile__ ("sync");
-        __asm__ __volatile__ ("mtspr    1008, 4");
-        __asm__ __volatile__ ("isync");
-        __asm__ __volatile__ ("sync");
-        __asm__ __volatile__ ("mtspr    1008, 5");
-        __asm__ __volatile__ ("isync");
-        __asm__ __volatile__ ("sync");
+	ulong addr;
+	/* flush and disable I/D cache */
+	__asm__ __volatile__ ("mfspr    3, 1008"        ::: "r3");
+	__asm__ __volatile__ ("ori      5, 5, 0xcc00"   ::: "r5");
+	__asm__ __volatile__ ("ori      4, 3, 0xc00"    ::: "r4");
+	__asm__ __volatile__ ("andc     5, 3, 5"        ::: "r5");
+	__asm__ __volatile__ ("sync");
+	__asm__ __volatile__ ("mtspr    1008, 4");
+	__asm__ __volatile__ ("isync");
+	__asm__ __volatile__ ("sync");
+	__asm__ __volatile__ ("mtspr    1008, 5");
+	__asm__ __volatile__ ("isync");
+	__asm__ __volatile__ ("sync");
 
 #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.
-         */
-        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.
+	 */
+	addr = CFG_MONITOR_BASE - sizeof (ulong);
 #endif
-        soft_restart(addr);
-        while(1);       /* not reached */
+	soft_restart(addr);
+	while(1);       /* not reached */
 }