Patch by Murray Jensen, 20 Jun 2003:
- hymod update
- cleanup (especially for gcc-3.x compilers)
diff --git a/CHANGELOG b/CHANGELOG
index fc06773..b7f49ae 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,10 @@
 Changes since U-Boot 0.3.1:
 ======================================================================
 
+* Patch by Murray Jensen, 20 Jun 2003:
+  - hymod update
+  - cleanup (especially for gcc-3.x compilers)
+
 * Patch by Tom Guilliams, 20 Jun 2003:
   added CONFIG_750FX support for IBM 750FX processors
 
diff --git a/MAKEALL b/MAKEALL
index b66ef97..6407e84 100644
--- a/MAKEALL
+++ b/MAKEALL
@@ -58,11 +58,11 @@
 #########################################################################
 
 LIST_824x="	\
-        A3000           BMW		CPC45		CU824	 \
-	MOUSSE          MUSENKI    	OXC		PN62     \
-	Sandpoint8240   Sandpoint8245	utx8245		 \
+        A3000           BMW		CPC45		CU824		\
+	MOUSSE          MUSENKI    	OXC		PN62		\
+	Sandpoint8240   Sandpoint8245	utx8245		\
 "
-x
+
 #########################################################################
 ## MPC8260 Systems (includes 8250, 8255 etc.)
 #########################################################################
diff --git a/board/hymod/config.mk b/board/hymod/config.mk
index ccc7f38..0a9985f 100644
--- a/board/hymod/config.mk
+++ b/board/hymod/config.mk
@@ -27,6 +27,6 @@
 
 TEXT_BASE = 0x40000000
 
-PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)
+PLATFORM_CPPFLAGS += -I$(TOPDIR)
 
 OBJCFLAGS = --remove-section=.ppcenv
diff --git a/board/hymod/eeprom.c b/board/hymod/eeprom.c
index 01e1453..15eb48e 100644
--- a/board/hymod/eeprom.c
+++ b/board/hymod/eeprom.c
@@ -39,62 +39,61 @@
 	unsigned dev_addr = CFG_I2C_EEPROM_ADDR | \
 		(which ? HYMOD_EEOFF_MEZZ : HYMOD_EEOFF_MAIN);
 	unsigned offset = 0;
-	uchar data[HYMOD_EEPROM_SIZE], *dp, *edp;
-	hymod_eehdr_t *hp;
+	uchar data[HYMOD_EEPROM_MAXLEN], *dp, *edp;
+	hymod_eehdr_t hdr;
 	ulong len, crc;
 
 	memset (ep, 0, sizeof *ep);
-	memset (data, 0, HYMOD_EEPROM_SIZE);
-	crc = 0;
 
-	hp = (hymod_eehdr_t *)data;
-	eeprom_read (dev_addr, offset, (uchar *)hp, sizeof (*hp));
-	offset += sizeof (*hp);
+	eeprom_read (dev_addr, offset, (uchar *)&hdr, sizeof (hdr));
+	offset += sizeof (hdr);
 
-	if (hp->id != HYMOD_EEPROM_ID || hp->ver > HYMOD_EEPROM_VER ||
-	  (len = hp->len) > HYMOD_EEPROM_MAXLEN)
+	if (hdr.id != HYMOD_EEPROM_ID || hdr.ver > HYMOD_EEPROM_VER ||
+	  (len = hdr.len) > HYMOD_EEPROM_MAXLEN)
 	    return (0);
 
-	dp = (uchar *)(hp + 1); edp = dp + len;
-	eeprom_read (dev_addr, offset, dp, len);
+	eeprom_read (dev_addr, offset, data, len);
 	offset += len;
 
 	eeprom_read (dev_addr, offset, (uchar *)&crc, sizeof (ulong));
+	offset += sizeof (ulong);
 
-	if (crc32 (0, data, edp - data) != crc)
+	if (crc32 (crc32 (0, (char *)&hdr, sizeof hdr), data, len) != crc)
 		return (0);
 
-	ep->ver = hp->ver;
+	ep->ver = hdr.ver;
+	dp = data; edp = dp + len;
 
 	for (;;) {
-		hymod_eerec_t *rp = (hymod_eerec_t *)dp;
 		ulong rtyp;
 		uchar rlen, *rdat;
-		uint rsiz;
 
-		if (rp->small.topbit == 0) {
-		    rtyp = rp->small.type;
-		    rlen = rp->small.len;
-		    rdat = rp->small.data;
-		    rsiz = offsetof (hymod_eerec_t, small.data) + rlen;
-		}
-		else if (rp->medium.nxtbit == 0) {
-		    rtyp = rp->medium.type;
-		    rlen = rp->medium.len;
-		    rdat = rp->medium.data;
-		    rsiz = offsetof (hymod_eerec_t, medium.data) + rlen;
-		}
+		rtyp = *dp++;
+		if ((rtyp & 0x80) == 0)
+			rlen = *dp++;
 		else {
-		    rtyp = rp->large.type;
-		    rlen = rp->large.len;
-		    rdat = rp->large.data;
-		    rsiz = offsetof (hymod_eerec_t, large.data) + rlen;
+			uchar islarge = rtyp & 0x40;
+
+			rtyp = ((rtyp & 0x3f) << 8) | *dp++;
+			if (islarge) {
+				rtyp = (rtyp << 8) | *dp++;
+				rtyp = (rtyp << 8) | *dp++;
+			}
+
+			rlen = *dp++;
+			rlen = (rlen << 8) | *dp++;
+			if (islarge) {
+				rlen = (rlen << 8) | *dp++;
+				rlen = (rlen << 8) | *dp++;
+			}
 		}
 
 		if (rtyp == 0)
 			break;
 
-		dp += rsiz;
+		rdat = dp;
+		dp += rlen;
+
 		if (dp > edp)	/* error? */
 			break;
 
@@ -102,12 +101,20 @@
 
 		case HYMOD_EEREC_SERNO:		/* serial number */
 			if (rlen == sizeof (ulong))
-				memcpy (&ep->serno, rdat, sizeof (ulong));
+				ep->serno = \
+					((ulong)rdat[0] << 24) | \
+					((ulong)rdat[1] << 16) | \
+					((ulong)rdat[2] << 8) | \
+					(ulong)rdat[3];
 			break;
 
 		case HYMOD_EEREC_DATE:		/* date */
-			if (rlen == sizeof (hymod_date_t))
-				memcpy (&ep->date, rdat, sizeof (hymod_date_t));
+			if (rlen == sizeof (hymod_date_t)) {
+				ep->date.year = ((ushort)rdat[0] << 8) | \
+					(ushort)rdat[1];
+				ep->date.month = rdat[2];
+				ep->date.day = rdat[3];
+			}
 			break;
 
 		case HYMOD_EEREC_BATCH:		/* batch */
@@ -250,18 +257,13 @@
 static uchar *
 uint_handler (eerec_map_t *rp, uchar *val, uchar *dp, uchar *edp)
 {
-	uchar *eval;
-	union {
-		uchar cval[4];
-		ushort sval[2];
-		ulong lval;
-	} rdata;
+	char *eval;
+	ulong lval;
 
-	rdata.lval = simple_strtol (val, (char **)&eval, 10);
+	lval = simple_strtol (val, &eval, 10);
 
-	if (eval == val || *eval != '\0') {
-		printf ("%s rec (%s) is not a valid uint\n",
-			rp->name, val);
+	if ((uchar *)eval == val || *eval != '\0') {
+		printf ("%s rec (%s) is not a valid uint\n", rp->name, val);
 		return (NULL);
 	}
 
@@ -276,27 +278,29 @@
 	switch (rp->length) {
 
 	case 1:
-		if (rdata.lval >= 256) {
+		if (lval >= 256) {
 			printf ("%s rec value (%lu) out of range (0-255)\n",
-				rp->name, rdata.lval);
+				rp->name, lval);
 			return (NULL);
 		}
-		*dp++ = rdata.cval[3];
+		*dp++ = lval;
 		break;
 
 	case 2:
-		if (rdata.lval >= 65536) {
+		if (lval >= 65536) {
 			printf ("%s rec value (%lu) out of range (0-65535)\n",
-				rp->name, rdata.lval);
+				rp->name, lval);
 			return (NULL);
 		}
-		memcpy (dp, &rdata.sval[1], 2);
-		dp += 2;
+		*dp++ = lval >> 8;
+		*dp++ = lval;
 		break;
 
 	case 4:
-		memcpy (dp, &rdata.lval, 4);
-		dp += 4;
+		*dp++ = lval >> 24;
+		*dp++ = lval >> 16;
+		*dp++ = lval >> 8;
+		*dp++ = lval;
 		break;
 
 	default:
@@ -311,32 +315,41 @@
 date_handler (eerec_map_t *rp, uchar *val, uchar *dp, uchar *edp)
 {
 	hymod_date_t date;
-	uchar *p = val, *ep;
+	uchar *p = val;
+	char *ep;
+	ulong lval;
 
-	date.year = simple_strtol (p, (char **)&ep, 10);
-	if (ep == p || *ep++ != '-') {
+	lval = simple_strtol (p, &ep, 10);
+	if ((uchar *)ep == p || *ep++ != '-') {
 bad_date:
 		printf ("%s rec (%s) is not a valid date\n", rp->name, val);
 		return (NULL);
 	}
+	if (lval >= 65536)
+		goto bad_date;
+	date.year = lval;
 
-	date.month = simple_strtol (p = ep, (char **)&ep, 10);
-	if (ep == p || *ep++ != '-' || date.month == 0 || date.month > 12)
+	lval = simple_strtol (p = ep, &ep, 10);
+	if ((uchar *)ep == p || *ep++ != '-' || lval == 0 || lval > 12)
 		goto bad_date;
+	date.month = lval;
 
-	date.day = simple_strtol (p = ep, (char **)&ep, 10);
-	if (ep == p || *ep != '\0' || date.day == 0 || date.day > 31)
+	lval = simple_strtol (p = ep, &ep, 10);
+	if ((uchar *)ep == p || *ep != '\0' || lval == 0 || lval > 31)
 		goto bad_date;
+	date.day = lval;
 
-	if (dp + 2 + sizeof (hymod_date_t) > edp) {
+	if (dp + 2 + rp->length > edp) {
 		printf ("can't fit %s rec into eeprom\n", rp->name);
 		return (NULL);
 	}
 
 	*dp++ = rp->type;
-	*dp++ = sizeof (hymod_date_t);
-	memcpy (dp, &date, sizeof (hymod_date_t));
-	dp += sizeof (hymod_date_t);
+	*dp++ = rp->length;
+	*dp++ = date.year >> 8;
+	*dp++ = date.year;
+	*dp++ = date.month;
+	*dp++ = date.day;
 
 	return (dp);
 }
@@ -368,29 +381,28 @@
 static uchar *
 bytes_handler (eerec_map_t *rp, uchar *val, uchar *dp, uchar *edp)
 {
-	uchar bytes[HYMOD_MAX_BYTES], nbytes = 0;
-	uchar *p = val, *ep;
+	uchar bytes[HYMOD_MAX_BYTES], nbytes, *p;
+	char *ep;
 
-	for (;;) {
+	for (nbytes = 0, p = val; *p != '\0'; p = (uchar *)ep) {
+		ulong lval;
 
-		if (nbytes >= HYMOD_MAX_BYTES) {
-			printf ("%s rec (%s) byte array too long\n",
+		lval = simple_strtol (p, &ep, 10);
+		if ((uchar *)ep == p || (*ep != '\0' && *ep != ',') || \
+		    lval >= 256) {
+			printf ("%s rec (%s) byte array has invalid uint\n",
 				rp->name, val);
 			return (NULL);
 		}
-
-		bytes[nbytes++] = simple_strtol (p, (char **)&ep, 10);
-
-		if (ep == p || (*ep != '\0' && *ep != ',')) {
-			printf ("%s rec (%s) byte array has invalid uint\n",
+		if (nbytes >= HYMOD_MAX_BYTES) {
+			printf ("%s rec (%s) byte array too long\n",
 				rp->name, val);
 			return (NULL);
 		}
-
-		if (*ep++ == '\0')
-			break;
+		bytes[nbytes++] = lval;
 
-		p = ep;
+		if (*ep != '\0')
+			ep++;
 	}
 
 	if (dp + 2 + nbytes > edp) {
@@ -459,6 +471,7 @@
 	hymod_eehdr_t *hp = (hymod_eehdr_t *)&data[0];
 	ulong crc;
 
+	memset (hp, 0, sizeof *hp);
 	hp->id = HYMOD_EEPROM_ID;
 	hp->ver = HYMOD_EEPROM_VER;
 
diff --git a/board/hymod/flash.c b/board/hymod/flash.c
index 7d1ae30..ad0a229 100644
--- a/board/hymod/flash.c
+++ b/board/hymod/flash.c
@@ -43,29 +43,26 @@
  * in the flash_info entry "fip". Fatal error if nothing there.
  */
 static void
-bank_probe (flash_info_t *fip, bank_addr_t base)
+bank_probe (flash_info_t *fip, volatile bank_addr_t base)
 {
-	bank_addr_t addr;
+	volatile bank_addr_t addr;
 	bank_word_t word;
 	int i;
 
 	/* reset the flash */
 	*base = BANK_CMD_RST;
 
-	/* check the manufacturer id - must be intel */
+	/* put flash into read id mode */
 	*base = BANK_CMD_RD_ID;
-	word = *BANK_REG_MAN_CODE (base);
-	*base = BANK_CMD_RST;
 
+	/* check the manufacturer id - must be intel */
+	word = *BANK_REG_MAN_CODE (base);
 	if (word != BANK_FILL_WORD (INTEL_MANUFACT&0xff))
 		panic ("\nbad manufacturer's code (0x%08lx) at addr 0x%08lx",
 			(unsigned long)word, (unsigned long)base);
 
 	/* check the device id */
-	*base = BANK_CMD_RD_ID;
 	word = *BANK_REG_DEV_CODE (base);
-	*base = BANK_CMD_RST;
-
 	switch (word) {
 
 	case BANK_FILL_WORD (INTEL_ID_28F320J5&0xff):
@@ -110,12 +107,15 @@
 	}
 
 	fip->size = (bank_size_t)addr - (bank_size_t)base;
+
+	/* reset the flash */
+	*base = BANK_CMD_RST;
 }
 
 static void
 bank_reset (flash_info_t *info, int sect)
 {
-	bank_addr_t addr = (bank_addr_t)info->start[sect];
+	volatile bank_addr_t addr = (bank_addr_t)info->start[sect];
 
 #ifdef FLASH_DEBUG
 	printf ("writing reset cmd to addr 0x%08lx\n", (unsigned long)addr);
@@ -127,7 +127,7 @@
 static void
 bank_erase_init (flash_info_t *info, int sect)
 {
-	bank_addr_t addr = (bank_addr_t)info->start[sect];
+	volatile bank_addr_t addr = (bank_addr_t)info->start[sect];
 	int flag;
 
 #ifdef FLASH_DEBUG
@@ -152,7 +152,7 @@
 static int
 bank_erase_poll (flash_info_t *info, int sect)
 {
-	bank_addr_t addr = (bank_addr_t)info->start[sect];
+	volatile bank_addr_t addr = (bank_addr_t)info->start[sect];
 	bank_word_t stat = *addr;
 
 #ifdef FLASH_DEBUG
@@ -176,7 +176,7 @@
 }
 
 static int
-bank_write_word (bank_addr_t addr, bank_word_t value)
+bank_write_word (volatile bank_addr_t addr, bank_word_t value)
 {
 	bank_word_t stat;
 	ulong start;
diff --git a/board/hymod/flash.h b/board/hymod/flash.h
index 10db7fc..ee047fe 100644
--- a/board/hymod/flash.h
+++ b/board/hymod/flash.h
@@ -92,7 +92,7 @@
 #endif /* EXAMPLE */
 
 /* the sizes of these two types should probably be the same */
-typedef volatile bank_word_t *bank_addr_t;
+typedef bank_word_t *bank_addr_t;
 typedef unsigned long bank_size_t;
 
 /* align bank addresses and sizes to bank word boundaries */
diff --git a/board/hymod/global_env b/board/hymod/global_env
index 16def24..43cab1d 100644
--- a/board/hymod/global_env
+++ b/board/hymod/global_env
@@ -58,7 +58,7 @@
 # MISCELLANEOUS PARAMETERS
 
 # version must always come first
-version=3
+version=4
 
 # set the ip address based on the main board serial number
 ipaddr=192.168.1.%S
@@ -74,7 +74,7 @@
 # BOOTING COMMANDS AND PARAMETERS
 
 # command to run when "auto-booting"
-bootcmd=bootm 40080000 40200000
+bootcmd=bootm 40080000
 
 # how long the "countdown" to automatically running "bootcmd" is
 bootdelay=2
@@ -88,9 +88,9 @@
 #	r4 - address of initial ramdisk image (0 means no initrd)
 #	r5 - size of initial ramdisk image
 #	r6 - address of command line string
--bootargs=root=/dev/ram rw
+-bootargs=root=/dev/mtdblock5 rootfstype=squashfs ro
 
-# these four are for hymod linux intergrated into our Sun network
+# these four are for hymod linux integrated into our Sun network
 bootargs+=serialno=%S
 bootargs+=nisclient nisdomain=mlb.dmt.csiro.au nissrvadr=138.194.112.4
 bootargs+=nfsclient
@@ -145,14 +145,17 @@
 cmpaltlinux=cmp.b 100000 40140000 $(filesize)
 newaltlinux=run fetchaltlinux erasealtlinux copyaltlinux cmpaltlinux
 
-fetchird=tftp 100000 /hymod/initrd.bin
-eraseird=erase 1:8-47
-copyird=cp.b 100000 40200000 $(filesize)
-cmpird=cmp.b 100000 40200000 $(filesize)
-newinitrd=run fetchird eraseird copyird cmpird
+fetchroot=tftp 100000 /hymod/root.bin
+eraseroot=erase 1:8-47
+copyroot=cp.b 100000 40200000 $(filesize)
+cmproot=cmp.b 100000 40200000 $(filesize)
+newroot=run fetchroot eraseroot copyroot cmproot
 
 fetchard=tftp 100000 /hymod/apprd.bin
 eraseard=erase 1:48-63
 copyard=cp.b 100000 40c00000 $(filesize)
 cmpard=cmp.b 100000 40c00000 $(filesize)
 newapprd=run fetchard eraseard copyard cmpard
+
+# pass above map to linux mtd driver
+bootargs+=mtdparts=phys:256k(u-boot),256k(u-boot-env),768k(linux),768k(altlinux),10m(root),4m(hymod)
diff --git a/config.mk b/config.mk
index 95b7256..4dc350f 100644
--- a/config.mk
+++ b/config.mk
@@ -23,6 +23,11 @@
 
 #########################################################################
 
+# clean the slate ...
+PLATFORM_RELFLAGS =
+PLATFORM_CPPFLAGS =
+PLATFORM_LDFLAGS =
+
 #
 # When cross-compiling on NetBSD, we have to define __PPC__ or else we
 # will pick up a va_list declaration that is incompatible with the
diff --git a/cpu/mpc8260/config.mk b/cpu/mpc8260/config.mk
index 632010e..2ebed5b 100644
--- a/cpu/mpc8260/config.mk
+++ b/cpu/mpc8260/config.mk
@@ -23,5 +23,5 @@
 
 PLATFORM_RELFLAGS += -mrelocatable -ffixed-r14 -meabi
 
-PLATFORM_CPPFLAGS += -DCONFIG_8260 -ffixed-r2 -ffixed-r29 -mstring
-##PLATFORM_CPPFLAGS += -DCONFIG_8260 -ffixed-r2 -mstring
+PLATFORM_CPPFLAGS += -DCONFIG_8260 -ffixed-r2 -ffixed-r29 \
+		     -mstring -mcpu=603e -mmultiple
diff --git a/include/cmd_confdefs.h b/include/cmd_confdefs.h
index 2d9b5a5..74614eb 100644
--- a/include/cmd_confdefs.h
+++ b/include/cmd_confdefs.h
@@ -30,62 +30,62 @@
 /*
  * Configurable monitor commands
  */
-#define CFG_CMD_BDI		0x00000001	/* bdinfo			*/
-#define CFG_CMD_LOADS		0x00000002	/* loads			*/
-#define CFG_CMD_LOADB		0x00000004	/* loadb			*/
-#define CFG_CMD_IMI		0x00000008	/* iminfo			*/
-#define CFG_CMD_CACHE		0x00000010	/* icache, dcache		*/
-#define CFG_CMD_FLASH		0x00000020	/* flinfo, erase, protect	*/
-#define CFG_CMD_MEMORY		0x00000040	/* md, mm, nm, mw, cp, cmp,	*/
+#define CFG_CMD_BDI		0x00000001U	/* bdinfo			*/
+#define CFG_CMD_LOADS		0x00000002U	/* loads			*/
+#define CFG_CMD_LOADB		0x00000004U	/* loadb			*/
+#define CFG_CMD_IMI		0x00000008U	/* iminfo			*/
+#define CFG_CMD_CACHE		0x00000010U	/* icache, dcache		*/
+#define CFG_CMD_FLASH		0x00000020U	/* flinfo, erase, protect	*/
+#define CFG_CMD_MEMORY		0x00000040U	/* md, mm, nm, mw, cp, cmp,	*/
 						/* crc, base, loop, mtest	*/
-#define CFG_CMD_NET		0x00000080	/* bootp, tftpboot, rarpboot	*/
-#define CFG_CMD_ENV		0x00000100	/* saveenv			*/
-#define CFG_CMD_KGDB		0x00000200	/* kgdb				*/
-#define CFG_CMD_PCMCIA		0x00000400	/* PCMCIA support		*/
-#define CFG_CMD_IDE		0x00000800	/* IDE harddisk support		*/
-#define CFG_CMD_PCI		0x00001000	/* pciinfo			*/
-#define CFG_CMD_IRQ		0x00002000	/* irqinfo			*/
-#define CFG_CMD_BOOTD		0x00004000	/* bootd			*/
-#define CFG_CMD_CONSOLE		0x00008000	/* coninfo			*/
-#define CFG_CMD_EEPROM		0x00010000	/* EEPROM read/write support	*/
-#define CFG_CMD_ASKENV		0x00020000	/* ask for env variable		*/
-#define CFG_CMD_RUN		0x00040000	/* run command in env variable	*/
-#define CFG_CMD_ECHO		0x00080000	/* echo arguments		*/
-#define CFG_CMD_I2C		0x00100000	/* I2C serial bus support	*/
-#define CFG_CMD_REGINFO		0x00200000	/* Register dump		*/
-#define CFG_CMD_IMMAP		0x00400000	/* IMMR dump support		*/
-#define CFG_CMD_DATE		0x00800000	/* support for RTC, date/time...*/
-#define CFG_CMD_DHCP		0x01000000	/* DHCP Support			*/
-#define CFG_CMD_BEDBUG		0x02000000	/* Include BedBug Debugger	*/
-#define CFG_CMD_FDC		0x04000000	/* Floppy Disk Support		*/
-#define CFG_CMD_SCSI		0x08000000	/* SCSI Support			*/
-#define CFG_CMD_AUTOSCRIPT	0x10000000	/* Autoscript Support		*/
-#define CFG_CMD_MII		0x20000000	/* MII support			*/
-#define CFG_CMD_SETGETDCR	0x40000000	/* DCR support on 4xx		*/
-#define CFG_CMD_BSP		0x80000000	/* Board Specific functions	*/
+#define CFG_CMD_NET		0x00000080U	/* bootp, tftpboot, rarpboot	*/
+#define CFG_CMD_ENV		0x00000100U	/* saveenv			*/
+#define CFG_CMD_KGDB		0x00000200U	/* kgdb				*/
+#define CFG_CMD_PCMCIA		0x00000400U	/* PCMCIA support		*/
+#define CFG_CMD_IDE		0x00000800U	/* IDE harddisk support		*/
+#define CFG_CMD_PCI		0x00001000U	/* pciinfo			*/
+#define CFG_CMD_IRQ		0x00002000U	/* irqinfo			*/
+#define CFG_CMD_BOOTD		0x00004000U	/* bootd			*/
+#define CFG_CMD_CONSOLE		0x00008000U	/* coninfo			*/
+#define CFG_CMD_EEPROM		0x00010000U	/* EEPROM read/write support	*/
+#define CFG_CMD_ASKENV		0x00020000U	/* ask for env variable		*/
+#define CFG_CMD_RUN		0x00040000U	/* run command in env variable	*/
+#define CFG_CMD_ECHO		0x00080000U	/* echo arguments		*/
+#define CFG_CMD_I2C		0x00100000U	/* I2C serial bus support	*/
+#define CFG_CMD_REGINFO		0x00200000U	/* Register dump		*/
+#define CFG_CMD_IMMAP		0x00400000U	/* IMMR dump support		*/
+#define CFG_CMD_DATE		0x00800000U	/* support for RTC, date/time...*/
+#define CFG_CMD_DHCP		0x01000000U	/* DHCP Support			*/
+#define CFG_CMD_BEDBUG		0x02000000U	/* Include BedBug Debugger	*/
+#define CFG_CMD_FDC		0x04000000U	/* Floppy Disk Support		*/
+#define CFG_CMD_SCSI		0x08000000U	/* SCSI Support			*/
+#define CFG_CMD_AUTOSCRIPT	0x10000000U	/* Autoscript Support		*/
+#define CFG_CMD_MII		0x20000000U	/* MII support			*/
+#define CFG_CMD_SETGETDCR	0x40000000U	/* DCR support on 4xx		*/
+#define CFG_CMD_BSP		0x80000000U	/* Board Specific functions	*/
 
-#define CFG_CMD_ELF	0x0000000100000000	/* ELF (VxWorks) load/boot cmd	*/
-#define CFG_CMD_MISC	0x0000000200000000	/* Misc functions like sleep etc*/
-#define CFG_CMD_USB	0x0000000400000000	/* USB Support			*/
-#define CFG_CMD_DOC	0x0000000800000000	/* Disk-On-Chip Support		*/
-#define CFG_CMD_JFFS2	0x0000001000000000	/* JFFS2 Support		*/
-#define CFG_CMD_DTT	0x0000002000000000	/* Digital Therm and Thermostat */
-#define CFG_CMD_SDRAM	0x0000004000000000	/* SDRAM DIMM SPD info printout */
-#define CFG_CMD_DIAG	0x0000008000000000	/* Diagnostics			*/
-#define CFG_CMD_FPGA	0x0000010000000000	/* FPGA configuration Support	*/
-#define CFG_CMD_HWFLOW	0x0000020000000000	/* RTS/CTS hw flow control	*/
-#define CFG_CMD_SAVES	0x0000040000000000	/* save S record dump		*/
-#define CFG_CMD_SPI	0x0000100000000000	/* SPI utility			*/
-#define CFG_CMD_FDOS	0x0000200000000000	/* Floppy DOS support		*/
-#define CFG_CMD_VFD	0x0000400000000000	/* VFD support (TRAB)		*/
-#define CFG_CMD_NAND	0x0000800000000000	/* NAND support        		*/
-#define CFG_CMD_BMP	0x0001000000000000	/* BMP support			*/
-#define CFG_CMD_PORTIO	0x0002000000000000	/* Port I/O		        */
-#define CFG_CMD_PING	0x0004000000000000	/* ping support			*/
-#define CFG_CMD_MMC	0x0008000000000000	/* MMC support			*/
-#define CFG_CMD_FAT	0x0010000000000000	/* FAT support			*/
+#define CFG_CMD_ELF	0x0000000100000000U	/* ELF (VxWorks) load/boot cmd	*/
+#define CFG_CMD_MISC	0x0000000200000000U	/* Misc functions like sleep etc*/
+#define CFG_CMD_USB	0x0000000400000000U	/* USB Support			*/
+#define CFG_CMD_DOC	0x0000000800000000U	/* Disk-On-Chip Support		*/
+#define CFG_CMD_JFFS2	0x0000001000000000U	/* JFFS2 Support		*/
+#define CFG_CMD_DTT	0x0000002000000000U	/* Digital Therm and Thermostat */
+#define CFG_CMD_SDRAM	0x0000004000000000U	/* SDRAM DIMM SPD info printout */
+#define CFG_CMD_DIAG	0x0000008000000000U	/* Diagnostics			*/
+#define CFG_CMD_FPGA	0x0000010000000000U	/* FPGA configuration Support	*/
+#define CFG_CMD_HWFLOW	0x0000020000000000U	/* RTS/CTS hw flow control	*/
+#define CFG_CMD_SAVES	0x0000040000000000U	/* save S record dump		*/
+#define CFG_CMD_SPI	0x0000100000000000U	/* SPI utility			*/
+#define CFG_CMD_FDOS	0x0000200000000000U	/* Floppy DOS support		*/
+#define CFG_CMD_VFD	0x0000400000000000U	/* VFD support (TRAB)		*/
+#define CFG_CMD_NAND	0x0000800000000000U	/* NAND support        		*/
+#define CFG_CMD_BMP	0x0001000000000000U	/* BMP support			*/
+#define CFG_CMD_PORTIO	0x0002000000000000U	/* Port I/O		        */
+#define CFG_CMD_PING	0x0004000000000000U	/* ping support			*/
+#define CFG_CMD_MMC	0x0008000000000000U	/* MMC support			*/
+#define CFG_CMD_FAT	0x0010000000000000U	/* FAT support			*/
 
-#define CFG_CMD_ALL	0xFFFFFFFFFFFFFFFF	/* ALL commands			*/
+#define CFG_CMD_ALL	0xFFFFFFFFFFFFFFFFU	/* ALL commands			*/
 
 /* Commands that are considered "non-standard" for some reason
  * (memory hogs, requires special hardware, not fully tested, etc.)
diff --git a/include/configs/hymod.h b/include/configs/hymod.h
index dc7de44..62b025c 100644
--- a/include/configs/hymod.h
+++ b/include/configs/hymod.h
@@ -219,7 +219,7 @@
 #define	CONFIG_KGDB_EXTC_RATE	3686400	/* serial ext clk rate in Hz */
 #define	CONFIG_KGDB_EXTC_PINSEL	0	/* pin select 0=CLK3/CLK9,1=CLK5/CLK15*/
 # if defined(CONFIG_KGDB_USE_EXTC)
-#define CONFIG_KGDB_BAUDRATE	230400	/* speed to run kgdb serial port at */
+#define CONFIG_KGDB_BAUDRATE	115200	/* speed to run kgdb serial port at */
 # else
 #define CONFIG_KGDB_BAUDRATE	9600	/* speed to run kgdb serial port at */
 # endif
@@ -384,7 +384,7 @@
 #define CFG_FLASH_WRITE_TOUT	500	/* Flash Write Timeout (in ms)	*/
 
 #define	CFG_ENV_IS_IN_FLASH	1
-#define	CFG_ENV_SIZE		0x1000	/* Total Size of Environment Sector */
+#define	CFG_ENV_SIZE		0x40000	/* Total Size of Environment Sector */
 #define CFG_ENV_SECT_SIZE	0x40000	/* see README - env sect real size */
 #define	CFG_ENV_ADDR	(CFG_FLASH_BASE+CFG_MONITOR_LEN-CFG_ENV_SECT_SIZE)
 
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h
index 5023a9f..3751758 100644
--- a/include/linux/mtd/nftl.h
+++ b/include/linux/mtd/nftl.h
@@ -90,7 +90,7 @@
 	__u16 lastEUN;                  /* should be suppressed */
 	__u16 numfreeEUNs;
 	__u16 LastFreeEUN; 		/* To speed up finding a free EUN */
-	__u32 long nr_sects;
+	__u32 nr_sects;
 	int head,sect,cyl;
 	__u16 *EUNtable; 		/* [numvunits]: First EUN for each virtual unit  */
 	__u16 *ReplUnitTable; 		/* [numEUNs]: ReplUnitNumber for each */
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index f70c023..409adff 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -385,7 +385,7 @@
 {
 	int fd, fdr, rc, otherdev, len, resid;
 	erase_info_t erase;
-	char *data;
+	char *data = NULL;
 
 	if ((fd = open (DEVNAME (curdev), mode)) < 0) {
 		fprintf (stderr,