From a63c31cff5147f1eca19d884ee120005775fbffc Mon Sep 17 00:00:00 2001
From: Wolfgang Denk <wd@pollux.denx.de>
Date: Mon, 26 Jun 2006 10:54:52 +0200
Subject: [PATCH] Cleanup trab board for GCC-4.x

---
 CHANGELOG                |  2 ++
 MAKEALL                  |  2 +-
 board/trab/auto_update.c |  9 +++++----
 board/trab/cmd_trab.c    | 16 ++++++++--------
 board/trab/memory.c      |  8 ++++----
 board/trab/trab.c        | 22 +++++++++++-----------
 board/trab/trab_fkt.c    | 24 ++++++++++++------------
 include/s3c2400.h        | 34 +++++++++++++++++-----------------
 8 files changed, 60 insertions(+), 57 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 160437605b..e008c04afb 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,8 @@
 Changes since U-Boot 1.1.4:
 ======================================================================
 
+* Cleanup trab board for GCC-4.x
+
 * VoiceBlue update: use new MTD flash partitioning methods, use more
   reasonable TEXT_BASE, update default environment and enable keyed
   autoboot.
diff --git a/MAKEALL b/MAKEALL
index 804ea1221e..f110b2eaff 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -301,7 +301,7 @@ build_target() {
 	${MAKE} distclean >/dev/null
 	${MAKE} ${target}_config
 	${MAKE} ${JOBS} all 2>&1 >LOG/$target.MAKELOG | tee LOG/$target.ERR
-#	${CROSS_COMPILE:-ppc_8xx-}size u-boot | tee -a LOG/$target.MAKELOG
+	${CROSS_COMPILE:-ppc_8xx-}size u-boot | tee -a LOG/$target.MAKELOG
 }
 
 #-----------------------------------------------------------------------
diff --git a/board/trab/auto_update.c b/board/trab/auto_update.c
index 056e562bfe..442c5550ac 100644
--- a/board/trab/auto_update.c
+++ b/board/trab/auto_update.c
@@ -222,7 +222,7 @@ au_check_cksum_valid(int idx, long nbytes)
 	/* check the data CRC */
 	checksum = ntohl(hdr->ih_dcrc);
 
-	if (crc32 (0, (char *)(LOAD_ADDR + sizeof(*hdr)), ntohl(hdr->ih_size))
+	if (crc32 (0, (uchar *)(LOAD_ADDR + sizeof(*hdr)), ntohl(hdr->ih_size))
 		!= checksum)
 	{
 		printf ("Image %s bad data checksum\n", aufile[idx]);
@@ -261,7 +261,7 @@ au_check_header_valid(int idx, long nbytes)
 	checksum = ntohl(hdr->ih_hcrc);
 	hdr->ih_hcrc = 0;
 
-	if (crc32 (0, (char *)hdr, sizeof(*hdr)) != checksum) {
+	if (crc32 (0, (uchar *)hdr, sizeof(*hdr)) != checksum) {
 		printf ("Image %s bad header checksum\n", aufile[idx]);
 		return -1;
 	}
@@ -397,7 +397,7 @@ au_do_update(int idx, long sz)
 	}
 
 	/* check the dcrc of the copy */
-	if (crc32 (0, (char *)(start + off), ntohl(hdr->ih_size)) != ntohl(hdr->ih_dcrc)) {
+	if (crc32 (0, (uchar *)(start + off), ntohl(hdr->ih_size)) != ntohl(hdr->ih_dcrc)) {
 		printf ("Image %s Bad Data Checksum After COPY\n", aufile[idx]);
 		return -1;
 	}
@@ -613,7 +613,8 @@ do_auto_update(void)
 #define VFD_LOGO_WIDTH 112
 #define VFD_LOGO_HEIGHT 72
 				/* must call transfer_pic directly */
-				transfer_pic(3, env, VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH);
+				transfer_pic(3, (unsigned char *)env,
+					     VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH);
 			}
 			bitmap_first = 1;
 		}
diff --git a/board/trab/cmd_trab.c b/board/trab/cmd_trab.c
index edea8f01b6..b82c8edef7 100644
--- a/board/trab/cmd_trab.c
+++ b/board/trab/cmd_trab.c
@@ -147,11 +147,11 @@ u8 status;
 u16 pass_cycles;
 u16 first_error_cycle;
 u8 first_error_num;
-unsigned char first_error_name[16];
+char first_error_name[16];
 u16 act_cycle;
 
 typedef struct test_function_s {
-	unsigned char *name;
+	char *name;
 	int (*pf)(void);
 } test_function_t;
 
@@ -376,7 +376,7 @@ int do_burn_in_status (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		return (1);
 	}
 	if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NAME,
-			       1, first_error_name,
+			       1, (unsigned char*)first_error_name,
 			       sizeof (first_error_name))) {
 		return (1);
 	}
@@ -537,7 +537,7 @@ static int test_eeprom (void)
 
 	/* write test string 1, read back and verify */
 	if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1,
-				EEPROM_TEST_STRING_1,
+				(unsigned char*)EEPROM_TEST_STRING_1,
 				sizeof (EEPROM_TEST_STRING_1))) {
 		return (1);
 	}
@@ -547,7 +547,7 @@ static int test_eeprom (void)
 		return (1);
 	}
 
-	if (strcmp (temp, EEPROM_TEST_STRING_1) != 0) {
+	if (strcmp ((char *)temp, EEPROM_TEST_STRING_1) != 0) {
 		result = 1;
 		printf ("%s: error; read_str = \"%s\"\n", __FUNCTION__, temp);
 	}
@@ -555,7 +555,7 @@ static int test_eeprom (void)
 	/* write test string 2, read back and verify */
 	if (result == 0) {
 		if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_TEST, 1,
-					EEPROM_TEST_STRING_2,
+					(unsigned char*)EEPROM_TEST_STRING_2,
 					sizeof (EEPROM_TEST_STRING_2))) {
 			return (1);
 		}
@@ -565,7 +565,7 @@ static int test_eeprom (void)
 			return (1);
 		}
 
-		if (strcmp (temp, EEPROM_TEST_STRING_2) != 0) {
+		if (strcmp ((char *)temp, EEPROM_TEST_STRING_2) != 0) {
 			result = 1;
 			printf ("%s: error; read str = \"%s\"\n",
 				__FUNCTION__, temp);
@@ -777,7 +777,7 @@ static int global_vars_write_to_eeprom (void)
 		return (1);
 	}
 	if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, EE_ADDR_FIRST_ERROR_NAME,
-				1, first_error_name,
+				1, (unsigned char*) first_error_name,
 				sizeof(first_error_name))) {
 		return (1);
 	}
diff --git a/board/trab/memory.c b/board/trab/memory.c
index 4097892b9e..58bd99500a 100644
--- a/board/trab/memory.c
+++ b/board/trab/memory.c
@@ -419,14 +419,14 @@ int memory_post_tests (unsigned long start, unsigned long size)
 	int ret = 0;
 
 	if (ret == 0)
-		ret = memory_post_dataline ((long long *)start);
+		ret = memory_post_dataline ((unsigned long long *)start);
 	WATCHDOG_RESET ();
 	if (ret == 0)
-		ret = memory_post_addrline ((long *)start, (long *)start, size);
+		ret = memory_post_addrline ((ulong *)start, (ulong *)start, size);
 	WATCHDOG_RESET ();
 	if (ret == 0)
-		ret = memory_post_addrline ((long *)(start + size - 8),
-					    (long *)start, size);
+		ret = memory_post_addrline ((ulong *)(start + size - 8),
+					    (ulong *)start, size);
 	WATCHDOG_RESET ();
 	if (ret == 0)
 		ret = memory_post_test1 (start, size, 0x00000000);
diff --git a/board/trab/trab.c b/board/trab/trab.c
index 346406eaad..26e52d29e8 100644
--- a/board/trab/trab.c
+++ b/board/trab/trab.c
@@ -152,13 +152,13 @@ int dram_init (void)
 
 #define KBD_DATA	(((*(volatile ulong *)0x04020000) >> 16) & 0xF)
 
-static uchar *key_match (ulong);
+static char *key_match (ulong);
 
 int misc_init_r (void)
 {
 	ulong kbd_data = KBD_DATA;
-	uchar keybd_env[KEYBD_KEY_NUM + 1];
-	uchar *str;
+	char *str;
+	char keybd_env[KEYBD_KEY_NUM + 1];
 	int i;
 
 #ifdef CONFIG_VERSION_VARIABLE
@@ -208,7 +208,7 @@ int misc_init_r (void)
 static uchar kbd_magic_prefix[] = "key_magic";
 static uchar kbd_command_prefix[] = "key_cmd";
 
-static int compare_magic (ulong kbd_data, uchar *str)
+static int compare_magic (ulong kbd_data, char *str)
 {
 	uchar key_mask;
 
@@ -254,12 +254,12 @@ static int compare_magic (ulong kbd_data, uchar *str)
  * Note: the string points to static environment data and must be
  * saved before you call any function that modifies the environment.
  */
-static uchar *key_match (ulong kbd_data)
+static char *key_match (ulong kbd_data)
 {
-	uchar magic[sizeof (kbd_magic_prefix) + 1];
-	uchar cmd_name[sizeof (kbd_command_prefix) + 1];
-	uchar *suffix;
-	uchar *kbd_magic_keys;
+	char magic[sizeof (kbd_magic_prefix) + 1];
+	char cmd_name[sizeof (kbd_command_prefix) + 1];
+	char *suffix;
+	char *kbd_magic_keys;
 
 	/*
 	 * The following string defines the characters that can pe appended
@@ -304,7 +304,7 @@ static uchar *key_match (ulong kbd_data)
 int do_kbd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 {
 	ulong kbd_data = KBD_DATA;
-	uchar keybd_env[KEYBD_KEY_NUM + 1];
+	char keybd_env[KEYBD_KEY_NUM + 1];
 	int i;
 
 	puts ("Keys:");
@@ -404,7 +404,7 @@ static void tsc2000_write(unsigned int page, unsigned int reg,
 
 static void tsc2000_set_brightness(void)
 {
-	uchar tmp[10];
+	char tmp[10];
 	int i, br;
 
 	spi_init();
diff --git a/board/trab/trab_fkt.c b/board/trab/trab_fkt.c
index abb3b29c8c..71be6e03e5 100644
--- a/board/trab/trab_fkt.c
+++ b/board/trab/trab_fkt.c
@@ -967,21 +967,21 @@ static int touch_write_clibration_values (int calib_point, int x, int y)
 
 	if (calib_point == CALIB_TL) {
 		if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1,
-			       (char *)&x, 2)) {
+			       (unsigned char *)&x, 2)) {
 			return 1;
 		}
 		if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1,
-			       (char *)&y, 2)) {
+			       (unsigned char *)&y, 2)) {
 			return 1;
 		}
 
 		/* verify written values */
 		if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X0, 1,
-			      (char *)&x_verify, 2)) {
+			      (unsigned char *)&x_verify, 2)) {
 			return 1;
 		}
 		if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y0, 1,
-			       (char *)&y_verify, 2)) {
+			       (unsigned char *)&y_verify, 2)) {
 			return 1;
 		}
 		if ((y != y_verify) || (x != x_verify)) {
@@ -993,21 +993,21 @@ static int touch_write_clibration_values (int calib_point, int x, int y)
 	}
 	else if (calib_point == CALIB_DR) {
 		  if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1,
-			       (char *)&x, 2)) {
+			       (unsigned char *)&x, 2)) {
 			return 1;
 		  }
 		if (i2c_write_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1,
-			       (char *)&y, 2)) {
+			       (unsigned char *)&y, 2)) {
 			return 1;
 		}
 
 		/* verify written values */
 		if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_X1, 1,
-				       (char *)&x_verify, 2)) {
+				       (unsigned char *)&x_verify, 2)) {
 			return 1;
 		}
 		if (i2c_read_multiple (I2C_EEPROM_DEV_ADDR, TOUCH_Y1, 1,
-			       (char *)&y_verify, 2)) {
+			       (unsigned char *)&y_verify, 2)) {
 			return 1;
 		}
 		if ((y != y_verify) || (x != x_verify)) {
@@ -1110,7 +1110,7 @@ int do_serial_number (char **argv)
 
 	if (strcmp (argv[2], "read") == 0) {
 		if (i2c_read (I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1,
-			      (char *)&serial_number, 4)) {
+			      (unsigned char *)&serial_number, 4)) {
 			printf ("could not read from eeprom\n");
 			return (1);
 		}
@@ -1121,7 +1121,7 @@ int do_serial_number (char **argv)
 	else if (strcmp (argv[2], "write") == 0) {
 		serial_number = simple_strtoul(argv[3], NULL, 10);
 		if (i2c_write (I2C_EEPROM_DEV_ADDR, SERIAL_NUMBER, 1,
-			      (char *)&serial_number, 4)) {
+			      (unsigned char *)&serial_number, 4)) {
 			printf ("could not write to eeprom\n");
 			return (1);
 		}
@@ -1141,7 +1141,7 @@ int do_crc16 (void)
 {
 #if (CONFIG_COMMANDS & CFG_CMD_I2C)
 	int crc;
-	char buf[EEPROM_MAX_CRC_BUF];
+	unsigned char buf[EEPROM_MAX_CRC_BUF];
 
 	if (i2c_read (I2C_EEPROM_DEV_ADDR, 0, 1, buf, 60)) {
 		printf ("could not read from eeprom\n");
@@ -1153,7 +1153,7 @@ int do_crc16 (void)
 	print_identifier ();
 	printf ("crc16=%#04x\n", crc);
 
-	if (i2c_write (I2C_EEPROM_DEV_ADDR, CRC16, 1, (char *)&crc,
+	if (i2c_write (I2C_EEPROM_DEV_ADDR, CRC16, 1, (unsigned char *)&crc,
 		       sizeof (crc))) {
 		printf ("could not read from eeprom\n");
 		return (1);
diff --git a/include/s3c2400.h b/include/s3c2400.h
index bc1f1e94bf..4fdc62ec11 100644
--- a/include/s3c2400.h
+++ b/include/s3c2400.h
@@ -63,71 +63,71 @@ typedef enum {
 #include <s3c24x0.h>
 
 
-static inline S3C24X0_MEMCTL * const S3C24X0_GetBase_MEMCTL(void)
+static inline S3C24X0_MEMCTL * S3C24X0_GetBase_MEMCTL(void)
 {
 	return (S3C24X0_MEMCTL * const)S3C24X0_MEMCTL_BASE;
 }
-static inline S3C24X0_USB_HOST * const S3C24X0_GetBase_USB_HOST(void)
+static inline S3C24X0_USB_HOST * S3C24X0_GetBase_USB_HOST(void)
 {
 	return (S3C24X0_USB_HOST * const)S3C24X0_USB_HOST_BASE;
 }
-static inline S3C24X0_INTERRUPT * const S3C24X0_GetBase_INTERRUPT(void)
+static inline S3C24X0_INTERRUPT * S3C24X0_GetBase_INTERRUPT(void)
 {
 	return (S3C24X0_INTERRUPT * const)S3C24X0_INTERRUPT_BASE;
 }
-static inline S3C24X0_DMAS * const S3C24X0_GetBase_DMAS(void)
+static inline S3C24X0_DMAS * S3C24X0_GetBase_DMAS(void)
 {
 	return (S3C24X0_DMAS * const)S3C24X0_DMA_BASE;
 }
-static inline S3C24X0_CLOCK_POWER * const S3C24X0_GetBase_CLOCK_POWER(void)
+static inline S3C24X0_CLOCK_POWER * S3C24X0_GetBase_CLOCK_POWER(void)
 {
 	return (S3C24X0_CLOCK_POWER * const)S3C24X0_CLOCK_POWER_BASE;
 }
-static inline S3C24X0_LCD * const S3C24X0_GetBase_LCD(void)
+static inline S3C24X0_LCD * S3C24X0_GetBase_LCD(void)
 {
 	return (S3C24X0_LCD * const)S3C24X0_LCD_BASE;
 }
-static inline S3C24X0_UART * const S3C24X0_GetBase_UART(S3C24X0_UARTS_NR nr)
+static inline S3C24X0_UART * S3C24X0_GetBase_UART(S3C24X0_UARTS_NR nr)
 {
 	return (S3C24X0_UART * const)(S3C24X0_UART_BASE + (nr * 0x4000));
 }
-static inline S3C24X0_TIMERS * const S3C24X0_GetBase_TIMERS(void)
+static inline S3C24X0_TIMERS * S3C24X0_GetBase_TIMERS(void)
 {
 	return (S3C24X0_TIMERS * const)S3C24X0_TIMER_BASE;
 }
-static inline S3C24X0_USB_DEVICE * const S3C24X0_GetBase_USB_DEVICE(void)
+static inline S3C24X0_USB_DEVICE * S3C24X0_GetBase_USB_DEVICE(void)
 {
 	return (S3C24X0_USB_DEVICE * const)S3C24X0_USB_DEVICE_BASE;
 }
-static inline S3C24X0_WATCHDOG * const S3C24X0_GetBase_WATCHDOG(void)
+static inline S3C24X0_WATCHDOG * S3C24X0_GetBase_WATCHDOG(void)
 {
 	return (S3C24X0_WATCHDOG * const)S3C24X0_WATCHDOG_BASE;
 }
-static inline S3C24X0_I2C * const S3C24X0_GetBase_I2C(void)
+static inline S3C24X0_I2C * S3C24X0_GetBase_I2C(void)
 {
 	return (S3C24X0_I2C * const)S3C24X0_I2C_BASE;
 }
-static inline S3C24X0_I2S * const S3C24X0_GetBase_I2S(void)
+static inline S3C24X0_I2S * S3C24X0_GetBase_I2S(void)
 {
 	return (S3C24X0_I2S * const)S3C24X0_I2S_BASE;
 }
-static inline S3C24X0_GPIO * const S3C24X0_GetBase_GPIO(void)
+static inline S3C24X0_GPIO * S3C24X0_GetBase_GPIO(void)
 {
 	return (S3C24X0_GPIO * const)S3C24X0_GPIO_BASE;
 }
-static inline S3C24X0_RTC * const S3C24X0_GetBase_RTC(void)
+static inline S3C24X0_RTC * S3C24X0_GetBase_RTC(void)
 {
 	return (S3C24X0_RTC * const)S3C24X0_RTC_BASE;
 }
-static inline S3C2400_ADC * const S3C2400_GetBase_ADC(void)
+static inline S3C2400_ADC * S3C2400_GetBase_ADC(void)
 {
 	return (S3C2400_ADC * const)S3C24X0_ADC_BASE;
 }
-static inline S3C24X0_SPI * const S3C24X0_GetBase_SPI(void)
+static inline S3C24X0_SPI * S3C24X0_GetBase_SPI(void)
 {
 	return (S3C24X0_SPI * const)S3C24X0_SPI_BASE;
 }
-static inline S3C2400_MMC * const S3C2400_GetBase_MMC(void)
+static inline S3C2400_MMC * S3C2400_GetBase_MMC(void)
 {
 	return (S3C2400_MMC * const)S3C2400_MMC_BASE;
 }
-- 
2.39.5