Cleanup for GCC-4.x
diff --git a/common/cmd_autoscript.c b/common/cmd_autoscript.c
index 2d1f431..e325302 100644
--- a/common/cmd_autoscript.c
+++ b/common/cmd_autoscript.c
@@ -76,7 +76,7 @@
 	hdr->ih_hcrc = 0;
 	len = sizeof (image_header_t);
 	data = (ulong)hdr;
-	if (crc32(0, (char *)data, len) != crc) {
+	if (crc32(0, (uchar *)data, len) != crc) {
 		puts ("Bad header crc\n");
 		return 1;
 	}
@@ -85,7 +85,7 @@
 	len = ntohl(hdr->ih_size);
 
 	if (verify) {
-		if (crc32(0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+		if (crc32(0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
 			puts ("Bad data crc\n");
 			return 1;
 		}
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index ee1b5c1..558922c 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -201,7 +201,7 @@
 	checksum = ntohl(hdr->ih_hcrc);
 	hdr->ih_hcrc = 0;
 
-	if (crc32 (0, (char *)data, len) != checksum) {
+	if (crc32 (0, (uchar *)data, len) != checksum) {
 		puts ("Bad Header Checksum\n");
 		SHOW_BOOT_PROGRESS (-2);
 		return 1;
@@ -225,7 +225,7 @@
 
 	if (verify) {
 		puts ("   Verifying Checksum ... ");
-		if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+		if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
 			printf ("Bad Data CRC\n");
 			SHOW_BOOT_PROGRESS (-3);
 			return 1;
@@ -633,7 +633,7 @@
 		checksum = hdr->ih_hcrc;
 		hdr->ih_hcrc = 0;
 
-		if (crc32 (0, (char *)data, len) != checksum) {
+		if (crc32 (0, (uchar *)data, len) != checksum) {
 			puts ("Bad Header Checksum\n");
 			SHOW_BOOT_PROGRESS (-11);
 			do_reset (cmdtp, flag, argc, argv);
@@ -661,13 +661,13 @@
 
 				if (chunk > CHUNKSZ)
 					chunk = CHUNKSZ;
-				csum = crc32 (csum, (char *)cdata, chunk);
+				csum = crc32 (csum, (uchar *)cdata, chunk);
 				cdata += chunk;
 
 				WATCHDOG_RESET();
 			}
 #else	/* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
-			csum = crc32 (0, (char *)data, len);
+			csum = crc32 (0, (uchar *)data, len);
 #endif	/* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
 
 			if (csum != hdr->ih_dcrc) {
@@ -1079,7 +1079,7 @@
 	checksum = ntohl(hdr->ih_hcrc);
 	hdr->ih_hcrc = 0;
 
-	if (crc32 (0, (char *)data, len) != checksum) {
+	if (crc32 (0, (uchar *)data, len) != checksum) {
 		puts ("   Bad Header Checksum\n");
 		return 1;
 	}
@@ -1091,7 +1091,7 @@
 	len  = ntohl(hdr->ih_size);
 
 	puts ("   Verifying Checksum ... ");
-	if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+	if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
 		puts ("   Bad Data CRC\n");
 		return 1;
 	}
@@ -1136,7 +1136,7 @@
 			checksum = ntohl(header.ih_hcrc);
 			header.ih_hcrc = 0;
 
-			if (crc32 (0, (char *)&header, sizeof(image_header_t))
+			if (crc32 (0, (uchar *)&header, sizeof(image_header_t))
 			    != checksum)
 				goto next_sector;
 
@@ -1147,7 +1147,7 @@
 			len  = ntohl(hdr->ih_size);
 
 			puts ("   Verifying Checksum ... ");
-			if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
+			if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) {
 				puts ("   Bad Data CRC\n");
 			}
 			puts ("OK\n");
diff --git a/common/cmd_doc.c b/common/cmd_doc.c
index e5db1bc..5e9bea3 100644
--- a/common/cmd_doc.c
+++ b/common/cmd_doc.c
@@ -143,7 +143,7 @@
 			cmd ? "read" : "write", curr_device, off, size);
 
 		ret = doc_rw(doc_dev_desc + curr_device, cmd, off, size,
-			     &total, (u_char*)addr);
+			     (size_t *)&total, (u_char*)addr);
 
 		printf ("%d bytes %s: %s\n", total, cmd ? "read" : "write",
 			ret ? "ERROR" : "OK");
@@ -304,12 +304,12 @@
 
 		if (cmd)
 			ret = doc_read_ecc(this, from, len,
-					   &n, (u_char*)buf,
-					   noecc ? NULL : eccbuf);
+					   (size_t *)&n, (u_char*)buf,
+					   noecc ? (uchar *)NULL : (uchar *)eccbuf);
 		else
 			ret = doc_write_ecc(this, from, len,
-					    &n, (u_char*)buf,
-					    noecc ? NULL : eccbuf);
+					    (size_t *)&n, (u_char*)buf,
+					    noecc ? (uchar *)NULL : (uchar *)eccbuf);
 
 		if (ret)
 			break;
@@ -804,7 +804,7 @@
 		/* Check for ANAND header first. Then can whinge if it's found but later
 		   checks fail */
 		if ((ret = doc_read_ecc(nftl->mtd, block * nftl->EraseSize, SECTORSIZE,
-					&retlen, buf, NULL))) {
+					(size_t *)&retlen, buf, NULL))) {
 			static int warncount = 5;
 
 			if (warncount) {
@@ -829,7 +829,7 @@
 
 		/* To be safer with BIOS, also use erase mark as discriminant */
 		if ((ret = doc_read_oob(nftl->mtd, block * nftl->EraseSize + SECTORSIZE + 8,
-				8, &retlen, (char *)&h1) < 0)) {
+				8, (size_t *)&retlen, (uchar *)&h1) < 0)) {
 #ifdef NFTL_DEBUG
 			printf("ANAND header found at 0x%x, but OOB data read failed\n",
 			       block * nftl->EraseSize);
@@ -902,7 +902,7 @@
 				/* read one sector for every SECTORSIZE of blocks */
 				if ((ret = doc_read_ecc(nftl->mtd, block * nftl->EraseSize +
 						       i + SECTORSIZE, SECTORSIZE,
-						       &retlen, buf, (char *)&oob)) < 0) {
+						       (size_t *)&retlen, buf, (uchar *)&oob)) < 0) {
 					puts ("Read of bad sector table failed\n");
 					return -1;
 				}
diff --git a/common/cmd_ext2.c b/common/cmd_ext2.c
index af836cd..927e22f 100644
--- a/common/cmd_ext2.c
+++ b/common/cmd_ext2.c
@@ -231,7 +231,7 @@
 			return(1);
 		}
 
-		if (strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
+		if (strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) {
 			printf ("\n** Invalid partition type \"%.32s\""
 				" (expect \"" BOOT_PART_TYPE "\")\n",
 				info.type);
diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c
index c4b7392..9a01e7d 100644
--- a/common/cmd_fpga.c
+++ b/common/cmd_fpga.c
@@ -69,7 +69,7 @@
 	unsigned int i;
 	int rc;
 
-	dataptr = fpgadata;
+	dataptr = (unsigned char *)fpgadata;
 
 #if CFG_FPGA_XILINX
 	/* skip the first bytes of the bitsteam, their meaning is unknown */
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index 2e44c7f..c543bb5 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -461,7 +461,7 @@
 	 */
 	do {
 		printf("%08lx:", addr);
-		if(i2c_read(chip, addr, alen, (char *)&data, size) != 0) {
+		if(i2c_read(chip, addr, alen, (uchar *)&data, size) != 0) {
 			puts ("\nError reading the chip,\n");
 		} else {
 			data = cpu_to_be32(data);
@@ -510,7 +510,7 @@
 				 */
 				reset_cmd_timeout();
 #endif
-				if(i2c_write(chip, addr, alen, (char *)&data, size) != 0) {
+				if(i2c_write(chip, addr, alen, (uchar *)&data, size) != 0) {
 					puts ("Error writing the chip.\n");
 				}
 #ifdef CFG_EEPROM_PAGE_WRITE_DELAY_MS
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 1adfe2b..6663dea 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -417,8 +417,8 @@
 		SHOW_BOOT_PROGRESS (-1);
 		return 1;
 	}
-	if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
-	    (strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
+	if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
+	    (strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
 		printf ("\n** Invalid partition type \"%.32s\""
 			" (expect \"" BOOT_PART_TYPE "\")\n",
 			info.type);
@@ -450,7 +450,7 @@
 	checksum = ntohl(hdr->ih_hcrc);
 	hdr->ih_hcrc = 0;
 
-	if (crc32 (0, (char *)hdr, sizeof(image_header_t)) != checksum) {
+	if (crc32 (0, (uchar *)hdr, sizeof(image_header_t)) != checksum) {
 		puts ("\n** Bad Header Checksum **\n");
 		SHOW_BOOT_PROGRESS (-2);
 		return 1;
diff --git a/common/cmd_immap.c b/common/cmd_immap.c
index f1b0535..559d7b4 100644
--- a/common/cmd_immap.c
+++ b/common/cmd_immap.c
@@ -383,6 +383,7 @@
 	if (rcode == 0) {
 		iopin.port = port;
 		iopin.pin = pin;
+		iopin.flag = 0;
 		switch (cmd) {
 		case DIR:
 			if (value)
diff --git a/common/cmd_load.c b/common/cmd_load.c
index b85db69..7498497 100644
--- a/common/cmd_load.c
+++ b/common/cmd_load.c
@@ -166,7 +166,7 @@
 		    if (addr2info(store_addr)) {
 			int rc;
 
-			rc = flash_write((uchar *)binbuf,store_addr,binlen);
+			rc = flash_write((char *)binbuf,store_addr,binlen);
 			if (rc != 0) {
 				flash_perror (rc);
 				return (~0);
diff --git a/common/cmd_log.c b/common/cmd_log.c
index 57ef484..efc9689 100644
--- a/common/cmd_log.c
+++ b/common/cmd_log.c
@@ -179,7 +179,7 @@
 	case 2:
 		if (strcmp(argv[1],"show") == 0) {
 			for (i=0; i < (log_size&LOGBUFF_MASK); i++) {
-				s = log_buf+((log_start+i)&LOGBUFF_MASK);
+				s = (char *)log_buf+((log_start+i)&LOGBUFF_MASK);
 				putc (*s);
 			}
 			return 0;
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index bafb1d6..0f4f9b7 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -179,7 +179,7 @@
 		}
 #endif
 		puts ("    ");
-		cp = linebuf;
+		cp = (u_char *)linebuf;
 		for (i=0; i<linebytes; i++) {
 			if ((*cp < 0x20) || (*cp > 0x7e))
 				putc ('.');
@@ -430,7 +430,7 @@
 
 		puts ("Copy to Flash... ");
 
-		rc = flash_write ((uchar *)addr, dest, count*size);
+		rc = flash_write ((char *)addr, dest, count*size);
 		if (rc != 0) {
 			flash_perror (rc);
 			return (1);
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 5648ab2..b0c01d1 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -200,12 +200,12 @@
 			/* read out-of-band data */
 			if (cmd & NANDRW_READ) {
 				ret = nand_read_oob(nand_dev_desc + curr_device,
-						    off, size, &total,
+						    off, size, (size_t *)&total,
 						    (u_char*)addr);
 			}
 			else {
 				ret = nand_write_oob(nand_dev_desc + curr_device,
-						     off, size, &total,
+						     off, size, (size_t *)&total,
 						     (u_char*)addr);
 			}
 			return ret;
@@ -241,7 +241,7 @@
 			curr_device, off, size);
 
 		ret = nand_rw(nand_dev_desc + curr_device, cmd, off, size,
-			     &total, (u_char*)addr);
+			     (size_t *)&total, (u_char*)addr);
 
 		printf (" %d bytes %s: %s\n", total,
 			(cmd & NANDRW_READ) ? "read" : "written",
@@ -401,7 +401,7 @@
  */
 int check_block (struct nand_chip *nand, unsigned long pos)
 {
-	int retlen;
+	size_t retlen;
 	uint8_t oob_data;
 	uint16_t oob_data16[6];
 	int page0 = pos & (-nand->erasesize);
@@ -423,9 +423,9 @@
 			return 1;
 	} else {
 		/* Note - bad block marker can be on first or second page */
-		if (nand_read_oob(nand, page0 + badpos, 1, &retlen, &oob_data)
+		if (nand_read_oob(nand, page0 + badpos, 1, &retlen, (unsigned char *)&oob_data)
 		    || oob_data != 0xff
-		    || nand_read_oob (nand, page1 + badpos, 1, &retlen, &oob_data)
+		    || nand_read_oob (nand, page1 + badpos, 1, &retlen, (unsigned char *)&oob_data)
 		    || oob_data != 0xff)
 			return 1;
 	}
@@ -501,11 +501,11 @@
 		if (cmd & NANDRW_READ) {
 			ret = nand_read_ecc(nand, start,
 					   min(len, eblk + erasesize - start),
-					   &n, (u_char*)buf, eccbuf);
+					   (size_t *)&n, (u_char*)buf, (u_char *)eccbuf);
 		} else {
 			ret = nand_write_ecc(nand, start,
 					    min(len, eblk + erasesize - start),
-					    &n, (u_char*)buf, eccbuf);
+					    (size_t *)&n, (u_char*)buf, (u_char *)eccbuf);
 		}
 
 		if (ret)
@@ -1591,7 +1591,7 @@
 					l = NAND_JFFS2_OOB16_FSDALEN;
 				}
 
-				ret = nand_write_oob(nand, ofs + p, l, &n,
+				ret = nand_write_oob(nand, ofs + p, l, (size_t *)&n,
 						     (u_char *)&clean_marker);
 				/* quit here if write failed */
 				if (ret)
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 578b0ca..1babffe 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -124,7 +124,7 @@
 
 			for (nxt=j; env_get_char(nxt) != '\0'; ++nxt)
 				;
-			k = envmatch(name, j);
+			k = envmatch((uchar *)name, j);
 			if (k < 0) {
 				continue;
 			}
@@ -157,7 +157,7 @@
 	int   i, len, oldval;
 	int   console = -1;
 	uchar *env, *nxt = NULL;
-	uchar *name;
+	char *name;
 	bd_t *bd = gd->bd;
 
 	uchar *env_data = env_get_addr(0);
@@ -174,7 +174,7 @@
 	for (env=env_data; *env; env=nxt+1) {
 		for (nxt=env; *nxt; ++nxt)
 			;
-		if ((oldval = envmatch(name, env-env_data)) >= 0)
+		if ((oldval = envmatch((uchar *)name, env-env_data)) >= 0)
 			break;
 	}
 
@@ -191,7 +191,7 @@
 		if ( (strcmp (name, "serial#") == 0) ||
 		    ((strcmp (name, "ethaddr") == 0)
 #if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR)
-		     && (strcmp (env_get_addr(oldval),MK_STR(CONFIG_ETHADDR)) != 0)
+		     && (strcmp ((char *)env_get_addr(oldval),MK_STR(CONFIG_ETHADDR)) != 0)
 #endif	/* CONFIG_OVERWRITE_ETHADDR_ONCE && CONFIG_ETHADDR */
 		    ) ) {
 			printf ("Can't overwrite \"%s\"\n", name);
@@ -483,7 +483,7 @@
  * or NULL if not found
  */
 
-char *getenv (uchar *name)
+char *getenv (char *name)
 {
 	int i, nxt;
 
@@ -497,15 +497,15 @@
 				return (NULL);
 			}
 		}
-		if ((val=envmatch(name, i)) < 0)
+		if ((val=envmatch((uchar *)name, i)) < 0)
 			continue;
-		return (env_get_addr(val));
+		return ((char *)env_get_addr(val));
 	}
 
 	return (NULL);
 }
 
-int getenv_r (uchar *name, uchar *buf, unsigned len)
+int getenv_r (char *name, char *buf, unsigned len)
 {
 	int i, nxt;
 
@@ -517,7 +517,7 @@
 				return (-1);
 			}
 		}
-		if ((val=envmatch(name, i)) < 0)
+		if ((val=envmatch((uchar *)name, i)) < 0)
 			continue;
 		/* found; copy out */
 		n = 0;
diff --git a/common/cmd_pcmcia.c b/common/cmd_pcmcia.c
index 31f2ba2..62446d4 100644
--- a/common/cmd_pcmcia.c
+++ b/common/cmd_pcmcia.c
@@ -2681,7 +2681,7 @@
 #define	MAX_IDENT_FIELDS	4
 
 static uchar *known_cards[] = {
-	"ARGOSY PnPIDE D5",
+	(uchar *)"ARGOSY PnPIDE D5",
 	NULL
 };
 
@@ -2722,12 +2722,12 @@
 		else
 			break;
 	}
-	puts (id_str);
+	puts ((char *)id_str);
 	putc ('\n');
 
 	for (card=known_cards; *card; ++card) {
 		debug ("## Compare against \"%s\"\n", *card);
-		if (strcmp(*card, id_str) == 0) {	/* found! */
+		if (strcmp((char *)*card, (char *)id_str) == 0) {	/* found! */
 			debug ("## CARD FOUND ##\n");
 			return (1);
 		}
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index ec53790..e804861 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -247,8 +247,8 @@
 		printf("error reading partinfo\n");
 		return 1;
 	}
-	if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
-	    (strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
+	if ((strncmp((char *)(info.type), BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
+	    (strncmp((char *)(info.type), BOOT_PART_COMP, sizeof(info.type)) != 0)) {
 		printf ("\n** Invalid partition type \"%.32s\""
 			" (expect \"" BOOT_PART_TYPE "\")\n",
 			info.type);
@@ -277,7 +277,7 @@
 	checksum = ntohl(hdr->ih_hcrc);
 	hdr->ih_hcrc = 0;
 
-	if (crc32 (0, (char *)hdr, sizeof(image_header_t)) != checksum) {
+	if (crc32 (0, (uchar *)hdr, sizeof(image_header_t)) != checksum) {
 		puts ("\n** Bad Header Checksum **\n");
 		return 1;
 	}
diff --git a/common/cmd_spi.c b/common/cmd_spi.c
index 7b6faf7..a6fdf7f 100644
--- a/common/cmd_spi.c
+++ b/common/cmd_spi.c
@@ -119,7 +119,7 @@
 		printf("Error with the SPI transaction.\n");
 		rcode = 1;
 	} else {
-		cp = din;
+		cp = (char *)din;
 		for(j = 0; j < ((bitlen + 7) / 8); j++) {
 			printf("%02X", *cp++);
 		}
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 0738f55..fdfd042 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -362,15 +362,15 @@
 
 	if (get_partition_info (stor_dev, part, &info)) {
 		/* try to boot raw .... */
-		strncpy(&info.type[0], BOOT_PART_TYPE, sizeof(BOOT_PART_TYPE));
-		strncpy(&info.name[0], "Raw", 4);
+		strncpy((char *)&info.type[0], BOOT_PART_TYPE, sizeof(BOOT_PART_TYPE));
+		strncpy((char *)&info.name[0], "Raw", 4);
 		info.start=0;
 		info.blksz=0x200;
 		info.size=2880;
 		printf("error reading partinfo...try to boot raw\n");
 	}
-	if ((strncmp(info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
-	    (strncmp(info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
+	if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
+	    (strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
 		printf ("\n** Invalid partition type \"%.32s\""
 			" (expect \"" BOOT_PART_TYPE "\")\n",
 			info.type);
@@ -398,7 +398,7 @@
 	checksum = ntohl(hdr->ih_hcrc);
 	hdr->ih_hcrc = 0;
 
-	if (crc32 (0, (char *)hdr, sizeof(image_header_t)) != checksum) {
+	if (crc32 (0, (uchar *)hdr, sizeof(image_header_t)) != checksum) {
 		puts ("\n** Bad Header Checksum **\n");
 		return 1;
 	}
diff --git a/common/env_common.c b/common/env_common.c
index 9be4cc1..3201135 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -283,7 +283,7 @@
 		for (nxt=i; env_get_char(nxt) != '\0'; ++nxt)
 			;
 
-		lval = env_get_addr(i);
+		lval = (char *)env_get_addr(i);
 		rval = strchr(lval, '=');
 		if (rval != NULL) {
 			vallen = rval - lval;
diff --git a/common/env_flash.c b/common/env_flash.c
index d6257d0..a2ea9c4 100644
--- a/common/env_flash.c
+++ b/common/env_flash.c
@@ -202,7 +202,7 @@
 	debug (" %08lX ... %08lX ...",
 		(ulong)&(flash_addr_new->data),
 		sizeof(env_ptr->data)+(ulong)&(flash_addr_new->data));
-	if ((rc = flash_write(env_ptr->data,
+	if ((rc = flash_write((char *)env_ptr->data,
 			(ulong)&(flash_addr_new->data),
 			sizeof(env_ptr->data))) ||
 	    (rc = flash_write((char *)&(env_ptr->crc),
@@ -291,7 +291,7 @@
 	ulong	flash_offset;
 	uchar	env_buffer[CFG_ENV_SECT_SIZE];
 #else
-	uchar *env_buffer = (char *)env_ptr;
+	uchar *env_buffer = (uchar *)env_ptr;
 #endif	/* CFG_ENV_SECT_SIZE */
 	int rcode = 0;
 
@@ -337,7 +337,7 @@
 		return 1;
 
 	puts ("Writing to Flash... ");
-	rc = flash_write(env_buffer, flash_sect_addr, len);
+	rc = flash_write((char *)env_buffer, flash_sect_addr, len);
 	if (rc != 0) {
 		flash_perror (rc);
 		rcode = 1;
diff --git a/common/flash.c b/common/flash.c
index b308413..295fea2 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -135,7 +135,7 @@
  *			(only some targets require alignment)
  */
 int
-flash_write (uchar *src, ulong addr, ulong cnt)
+flash_write (char *src, ulong addr, ulong cnt)
 {
 #ifdef CONFIG_SPD823TS
 	return (ERR_TIMOUT);	/* any other error codes are possible as well */
@@ -174,7 +174,7 @@
 		len = info->start[0] + info->size - addr;
 		if (len > cnt)
 			len = cnt;
-		if ((i = write_buff(info, src, addr, len)) != 0) {
+		if ((i = write_buff(info, (uchar *)src, addr, len)) != 0) {
 			return (i);
 		}
 		cnt  -= len;
diff --git a/common/fpga.c b/common/fpga.c
index c41c6f8..02d3e42 100644
--- a/common/fpga.c
+++ b/common/fpga.c
@@ -53,8 +53,8 @@
 static fpga_desc desc_table[CONFIG_MAX_FPGA_DEVICES];
 
 /* Local static functions */
-static const fpga_desc * const fpga_get_desc( int devnum );
-static const fpga_desc * const fpga_validate( int devnum, void *buf,
+static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_get_desc( int devnum );
+static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_validate( int devnum, void *buf,
 					 size_t bsize, char *fn );
 static int fpga_dev_info( int devnum );
 
@@ -82,7 +82,7 @@
 /* fpga_get_desc
  *	map a device number to a descriptor
  */
-static const fpga_desc * const fpga_get_desc( int devnum )
+static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_get_desc( int devnum )
 {
 	fpga_desc *desc = (fpga_desc * )NULL;
 
@@ -99,10 +99,10 @@
 /* fpga_validate
  *	generic parameter checking code
  */
-static const fpga_desc * const fpga_validate( int devnum, void *buf,
+static __attribute__((__const__)) fpga_desc * __attribute__((__const__)) fpga_validate( int devnum, void *buf,
 					 size_t bsize, char *fn )
 {
-	const fpga_desc * const desc = fpga_get_desc( devnum );
+	fpga_desc * desc = fpga_get_desc( devnum );
 
 	if ( !desc ) {
 		printf( "%s: Invalid device number %d\n", fn, devnum );
@@ -147,7 +147,7 @@
 			printf( "Altera Device\nDescriptor @ 0x%p\n", desc );
 			ret_val = altera_info( desc->devdesc );
 #else
-			fpga_no_sup( __FUNCTION__, "Altera devices" );
+			fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
 #endif
 			break;
 		default:
@@ -185,7 +185,7 @@
 #if CONFIG_FPGA & CFG_FPGA_ALTERA
 		ret_val = altera_reloc( desc, reloc_off );
 #else
-		fpga_no_sup( __FUNCTION__, "Altera devices" );
+		fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
 #endif
 		break;
 	default:
@@ -216,7 +216,7 @@
 /* fpga_count
  * Basic interface function to get the current number of devices available.
  */
-const int fpga_count( void )
+int fpga_count( void )
 {
 	return next_desc;
 }
@@ -263,7 +263,7 @@
 int fpga_load( int devnum, void *buf, size_t bsize )
 {
 	int ret_val = FPGA_FAIL;           /* assume failure */
-	const fpga_desc * const desc = fpga_validate( devnum, buf, bsize, __FUNCTION__ );
+	fpga_desc * desc = fpga_validate( devnum, buf, bsize, (char *)__FUNCTION__ );
 
 	if ( desc ) {
 		switch ( desc->devtype ) {
@@ -278,7 +278,7 @@
 #if CONFIG_FPGA & CFG_FPGA_ALTERA
 			ret_val = altera_load( desc->devdesc, buf, bsize );
 #else
-			fpga_no_sup( __FUNCTION__, "Altera devices" );
+			fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
 #endif
 			break;
 		default:
@@ -296,7 +296,7 @@
 int fpga_dump( int devnum, void *buf, size_t bsize )
 {
 	int ret_val = FPGA_FAIL;           /* assume failure */
-	const fpga_desc * const desc = fpga_validate( devnum, buf, bsize, __FUNCTION__ );
+	fpga_desc * desc = fpga_validate( devnum, buf, bsize, (char *)__FUNCTION__ );
 
 	if ( desc ) {
 		switch ( desc->devtype ) {
@@ -311,7 +311,7 @@
 #if CONFIG_FPGA & CFG_FPGA_ALTERA
 			ret_val = altera_dump( desc->devdesc, buf, bsize );
 #else
-			fpga_no_sup( __FUNCTION__, "Altera devices" );
+			fpga_no_sup( (char *)__FUNCTION__, "Altera devices" );
 #endif
 			break;
 		default:
diff --git a/common/hush.c b/common/hush.c
index c10b117..bb5041a 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -296,7 +296,7 @@
 #endif
 
 /* "globals" within this file */
-static char *ifs;
+static uchar *ifs;
 static char map[256];
 #ifndef __U_BOOT__
 static int fake_mode;
@@ -3134,8 +3134,8 @@
 void update_ifs_map(void)
 {
 	/* char *ifs and char map[256] are both globals. */
-	ifs = getenv("IFS");
-	if (ifs == NULL) ifs=" \t\n";
+	ifs = (uchar *)getenv("IFS");
+	if (ifs == NULL) ifs=(uchar *)" \t\n";
 	/* Precompute a list of 'flow through' behavior so it can be treated
 	 * quickly up front.  Computation is necessary because of IFS.
 	 * Special case handling of IFS == " \t\n" is not implemented.
@@ -3144,11 +3144,11 @@
 	 */
 	memset(map,0,sizeof(map)); /* most characters flow through always */
 #ifndef __U_BOOT__
-	mapset("\\$'\"`", 3);      /* never flow through */
-	mapset("<>;&|(){}#", 1);   /* flow through if quoted */
+	mapset((uchar *)"\\$'\"`", 3);      /* never flow through */
+	mapset((uchar *)"<>;&|(){}#", 1);   /* flow through if quoted */
 #else
-	mapset("\\$'\"", 3);       /* never flow through */
-	mapset(";&|#", 1);         /* flow through if quoted */
+	mapset((uchar *)"\\$'\"", 3);       /* never flow through */
+	mapset((uchar *)";&|#", 1);         /* flow through if quoted */
 #endif
 	mapset(ifs, 2);            /* also flow through if quoted */
 }
@@ -3168,7 +3168,7 @@
 		ctx.type = flag;
 		initialize_context(&ctx);
 		update_ifs_map();
-		if (!(flag & FLAG_PARSE_SEMICOLON) || (flag & FLAG_REPARSING)) mapset(";$&|", 0);
+		if (!(flag & FLAG_PARSE_SEMICOLON) || (flag & FLAG_REPARSING)) mapset((uchar *)";$&|", 0);
 		inp->promptmode=1;
 		rcode = parse_stream(&temp, &ctx, inp, '\n');
 #ifdef __U_BOOT__
diff --git a/common/kgdb.c b/common/kgdb.c
index 06adb3e..6de6ec9 100644
--- a/common/kgdb.c
+++ b/common/kgdb.c
@@ -144,7 +144,7 @@
 	}
 	*buf = 0;
 	longjmp_on_fault = 0;
-	return buf;
+	return (unsigned char *)buf;
 }
 
 /* convert the hex array pointed to by buf into binary to be placed in mem
@@ -353,7 +353,7 @@
 		*ptr++ = hexchars[rp->num >> 4];
 		*ptr++ = hexchars[rp->num & 0xf];
 		*ptr++ = ':';
-		ptr = mem2hex((char *)&rp->val, ptr, 4);
+		ptr = (char *)mem2hex((char *)&rp->val, ptr, 4);
 		*ptr++ = ';';
 	}
 
@@ -364,7 +364,7 @@
 		printf("kgdb: remcomOutBuffer: %s\n", remcomOutBuffer);
 #endif
 
-	putpacket(remcomOutBuffer);
+	putpacket((unsigned char *)&remcomOutBuffer);
 
 	while (1) {
 		volatile int errnum;
@@ -508,7 +508,7 @@
 #endif
 
 		/* reply to the request */
-		putpacket(remcomOutBuffer);
+		putpacket((unsigned char *)&remcomOutBuffer);
 
 	} /* while(1) */
 }
@@ -548,7 +548,7 @@
 
 	buffer[0] = 'O';
 	mem2hex ((char *)s, &buffer[1], count);
-	putpacket(buffer);
+	putpacket((unsigned char *)&buffer);
 
 	return 1;
 }
diff --git a/common/lcd.c b/common/lcd.c
index 7bf7a63..e64972f 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -279,9 +279,9 @@
 static inline void lcd_puts_xy (ushort x, ushort y, uchar *s)
 {
 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
-	lcd_drawchars (x, y+BMP_LOGO_HEIGHT, s, strlen (s));
+	lcd_drawchars (x, y+BMP_LOGO_HEIGHT, s, strlen ((char *)s));
 #else
-	lcd_drawchars (x, y, s, strlen (s));
+	lcd_drawchars (x, y, s, strlen ((char *)s));
 #endif
 }
 
@@ -526,7 +526,7 @@
 		sizeof(bmp_logo_palette)/(sizeof(ushort)));
 
 	bmap = &bmp_logo_bitmap[0];
-	fb   = (char *)(lcd_base + y * lcd_line_length + x);
+	fb   = (uchar *)(lcd_base + y * lcd_line_length + x);
 
 	if (NBITS(panel_info.vl_bpix) < 12) {
 		/* Leave room for default color map */
@@ -710,15 +710,15 @@
 #ifdef CONFIG_MPC823
 # ifdef CONFIG_LCD_INFO
 	sprintf (info, "%s (%s - %s) ", U_BOOT_VERSION, __DATE__, __TIME__);
-	lcd_drawchars (LCD_INFO_X, LCD_INFO_Y, info, strlen(info));
+	lcd_drawchars (LCD_INFO_X, LCD_INFO_Y, (uchar *)info, strlen(info));
 
 	sprintf (info, "(C) 2004 DENX Software Engineering");
 	lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT,
-					info, strlen(info));
+					(uchar *)info, strlen(info));
 
 	sprintf (info, "    Wolfgang DENK, wd@denx.de");
 	lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 2,
-					info, strlen(info));
+					(uchar *)info, strlen(info));
 #  ifdef CONFIG_LCD_INFO_BELOW_LOGO
 	sprintf (info, "MPC823 CPU at %s MHz",
 		strmhz(temp, gd->cpu_clk));
@@ -737,7 +737,7 @@
 		gd->ram_size >> 20,
 		gd->bd->bi_flashsize >> 20 );
 	lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 4,
-					info, strlen(info));
+					(uchar *)info, strlen(info));
 
 #  endif /* CONFIG_LCD_INFO_BELOW_LOGO */
 # endif /* CONFIG_LCD_INFO */
diff --git a/common/main.c b/common/main.c
index 1389958..f042f3a 100644
--- a/common/main.c
+++ b/common/main.c
@@ -347,7 +347,7 @@
 #ifdef CONFIG_MODEM_SUPPORT
 	debug ("DEBUG: main_loop:   do_mdm_init=%d\n", do_mdm_init);
 	if (do_mdm_init) {
-		uchar *str = strdup(getenv("mdm_cmd"));
+		char *str = strdup(getenv("mdm_cmd"));
 		setenv ("preboot", str);  /* set or delete definition */
 		if (str != NULL)
 			free (str);
diff --git a/common/soft_i2c.c b/common/soft_i2c.c
index f7ca498..3d0e08c 100644
--- a/common/soft_i2c.c
+++ b/common/soft_i2c.c
@@ -399,7 +399,7 @@
  */
 uchar i2c_reg_read(uchar i2c_addr, uchar reg)
 {
-	char buf;
+	uchar buf;
 
 	i2c_read(i2c_addr, reg, 1, &buf, 1);
 
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 69d195a..99e4ab0 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -490,7 +490,7 @@
  */
 int usb_stor_CB_comdat(ccb *srb, struct us_data *us)
 {
-	int result;
+	int result = 0;
 	int dir_in,retry;
 	unsigned int pipe;
 	unsigned long status;
@@ -528,7 +528,7 @@
 
 		USB_STOR_PRINTF("CB_transport: control msg returned %d, direction is %s to go 0x%lx\n",result,dir_in ? "IN" : "OUT",srb->datalen);
 		if (srb->datalen) {
-			result = us_one_transfer(us, pipe, srb->pdata,srb->datalen);
+			result = us_one_transfer(us, pipe, (char *)srb->pdata,srb->datalen);
 			USB_STOR_PRINTF("CBI attempted to transfer data, result is %d status %lX, len %d\n", result,us->pusb_dev->status,us->pusb_dev->act_len);
 			if(!(us->pusb_dev->status & USB_ST_NAK_REC))
 				break;
@@ -847,7 +847,7 @@
 {
 	char *ptr;
 
-	ptr=srb->pdata;
+	ptr=(char *)srb->pdata;
 	memset(&srb->cmd[0],0,12);
 	srb->cmd[0]=SCSI_REQ_SENSE;
 	srb->cmd[1]=srb->lun<<5;
@@ -857,7 +857,7 @@
 	srb->cmdlen=12;
 	ss->transport(srb,ss);
 	USB_STOR_PRINTF("Request Sense returned %02X %02X %02X\n",srb->sense_buf[2],srb->sense_buf[12],srb->sense_buf[13]);
-	srb->pdata=ptr;
+	srb->pdata=(uchar *)ptr;
 	return 0;
 }
 
diff --git a/common/xilinx.c b/common/xilinx.c
index 40ce3bc..e03e78c 100644
--- a/common/xilinx.c
+++ b/common/xilinx.c
@@ -54,7 +54,7 @@
 {
 	int ret_val = FPGA_FAIL;	/* assume a failure */
 
-	if (!xilinx_validate (desc, __FUNCTION__)) {
+	if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
 		printf ("%s: Invalid device descriptor\n", __FUNCTION__);
 	} else
 		switch (desc->family) {
@@ -101,7 +101,7 @@
 {
 	int ret_val = FPGA_FAIL;	/* assume a failure */
 
-	if (!xilinx_validate (desc, __FUNCTION__)) {
+	if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
 		printf ("%s: Invalid device descriptor\n", __FUNCTION__);
 	} else
 		switch (desc->family) {
@@ -148,7 +148,7 @@
 {
 	int ret_val = FPGA_FAIL;
 
-	if (xilinx_validate (desc, __FUNCTION__)) {
+	if (xilinx_validate (desc, (char *)__FUNCTION__)) {
 		printf ("Family:        \t");
 		switch (desc->family) {
 		case Xilinx_Spartan2:
@@ -244,7 +244,7 @@
 {
 	int ret_val = FPGA_FAIL;	/* assume a failure */
 
-	if (!xilinx_validate (desc, __FUNCTION__)) {
+	if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
 		printf ("%s: Invalid device descriptor\n", __FUNCTION__);
 	} else
 		switch (desc->family) {