Commit d52fb7e3d135704334bd6f97f3444e824665b76f

Authored by Wolfgang Denk
1 parent 4367a01036

Some code cleanup for GCC 4.x

Showing 24 changed files with 67 additions and 59 deletions Side-by-side Diff

... ... @@ -2,6 +2,8 @@
2 2 Changes since U-Boot 1.1.4:
3 3 ======================================================================
4 4  
  5 +* Some code cleanup for GCC 4.x
  6 +
5 7 * Fixes to support environment in NAND flash;
6 8 enable NAND flash based environment for delta board.
7 9  
board/at91rm9200dk/at45.c
... ... @@ -593,7 +593,7 @@
593 593 if (AT91F_DataFlashWaitReady(pDataFlash->pDataFlashDesc, AT91C_TIMEOUT_WRDY) != DATAFLASH_OK)
594 594 return -1;
595 595  
596   - if (AT91F_DataFlashContinuousRead (pDataFlash, addr, buffer, SizeToRead) != DATAFLASH_OK)
  596 + if (AT91F_DataFlashContinuousRead (pDataFlash, addr, (uchar *)buffer, SizeToRead) != DATAFLASH_OK)
597 597 return -1;
598 598  
599 599 size -= SizeToRead;
board/at91rm9200dk/flash.c
... ... @@ -393,8 +393,7 @@
393 393 * Copy memory to flash
394 394 */
395 395  
396   -volatile static int write_word (flash_info_t * info, ulong dest,
397   - ulong data)
  396 +static int write_word (flash_info_t * info, ulong dest, ulong data)
398 397 {
399 398 volatile u16 *addr = (volatile u16 *) dest;
400 399 ulong result;
... ... @@ -408,7 +407,6 @@
408 407 result = *addr;
409 408 if ((result & data) != data)
410 409 return ERR_NOT_ERASED;
411   -
412 410  
413 411 /*
414 412 * Disable interrupts which might cause a timeout
board/cmc_pu2/load_sernum_ethaddr.c
... ... @@ -69,8 +69,8 @@
69 69 void load_sernum_ethaddr (void)
70 70 {
71 71 struct manufacturer_data data;
72   - unsigned char serial [9];
73   - unsigned char ethaddr[18];
  72 + char ethaddr[18];
  73 + char serial [9];
74 74 unsigned short chksum;
75 75 unsigned char *p;
76 76 unsigned short i, is, id;
... ... @@ -229,7 +229,7 @@
229 229 }
230 230 }
231 231  
232   -static void dfc_clear_nddb()
  232 +static void dfc_clear_nddb(void)
233 233 {
234 234 NDCR &= ~NDCR_ND_RUN;
235 235 wait_us(CFG_NAND_OTHER_TO);
... ... @@ -263,7 +263,7 @@
263 263 }
264 264  
265 265 /* we don't always wan't to do this */
266   -static void dfc_new_cmd()
  266 +static void dfc_new_cmd(void)
267 267 {
268 268 int retry = 0;
269 269 unsigned long status;
... ... @@ -398,7 +398,7 @@
398 398 return;
399 399 }
400 400  
401   -static void dfc_gpio_init()
  401 +static void dfc_gpio_init(void)
402 402 {
403 403 DFC_DEBUG2("Setting up DFC GPIO's.\n");
404 404  
... ... @@ -348,7 +348,7 @@
348 348 * Copy memory to flash
349 349 */
350 350  
351   -volatile static int write_word (flash_info_t *info, ulong dest, ulong data)
  351 +static int write_word (flash_info_t *info, ulong dest, ulong data)
352 352 {
353 353 vu_long *addr = (vu_long *)dest;
354 354 ulong result;
board/lpd7a40x/flash.c
... ... @@ -351,8 +351,7 @@
351 351 * Copy memory to flash
352 352 */
353 353  
354   -volatile static int write_word (flash_info_t * info, ulong dest,
355   - ulong data)
  354 +static int write_word (flash_info_t * info, ulong dest, ulong data)
356 355 {
357 356 vu_long *addr = (vu_long *) dest;
358 357 ulong result;
No preview for this file type
board/netstar/eeprom
No preview for this file type
board/netstar/flash.c
... ... @@ -230,7 +230,7 @@
230 230 * Copy memory to flash
231 231 */
232 232  
233   -volatile static int write_hword(flash_info_t *info, ulong dest, ushort data)
  233 +static int write_hword(flash_info_t *info, ulong dest, ushort data)
234 234 {
235 235 vu_short *addr = (vu_short *) dest;
236 236 ushort result;
board/netstar/nand.c
... ... @@ -48,10 +48,12 @@
48 48 /*
49 49 * chip R/B detection
50 50 */
  51 +/***
51 52 static int netstar_nand_ready(struct mtd_info *mtd)
52 53 {
53 54 return (*(volatile ushort *)GPIO_DATA_INPUT_REG) & 0x02;
54 55 }
  56 +***/
55 57  
56 58 void board_nand_init(struct nand_chip *nand)
57 59 {
board/shannon/flash.c
... ... @@ -315,7 +315,7 @@
315 315 * Copy memory to flash
316 316 */
317 317  
318   -volatile static int write_word (flash_info_t *info, ulong dest, ulong data)
  318 +static int write_word (flash_info_t *info, ulong dest, ulong data)
319 319 {
320 320 vu_long *addr = (vu_long *)dest;
321 321 ulong result;
... ... @@ -112,7 +112,8 @@
112 112 */
113 113 int saveenv(void)
114 114 {
115   - int total, ret = 0;
  115 + ulong total;
  116 + int ret = 0;
116 117  
117 118 puts ("Erasing Nand...");
118 119 if (nand_erase(&nand_info[0], CFG_ENV_OFFSET, CFG_ENV_SIZE))
... ... @@ -120,8 +121,7 @@
120 121  
121 122 puts ("Writing to Nand... ");
122 123 total = CFG_ENV_SIZE;
123   - ret = nand_write(&nand_info[0], CFG_ENV_OFFSET, &total,
124   - (u_char*) env_ptr);
  124 + ret = nand_write(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);
125 125 if (ret || total != CFG_ENV_SIZE)
126 126 return 1;
127 127  
128 128  
... ... @@ -138,11 +138,11 @@
138 138 void env_relocate_spec (void)
139 139 {
140 140 #if !defined(ENV_IS_EMBEDDED)
141   - int ret, total;
  141 + ulong total;
  142 + int ret;
142 143  
143 144 total = CFG_ENV_SIZE;
144   - ret = nand_read(&nand_info[0], CFG_ENV_OFFSET, &total,
145   - (u_char*) env_ptr);
  145 + ret = nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);
146 146 if (ret || total != CFG_ENV_SIZE)
147 147 return use_default();
148 148  
cpu/arm920t/at91rm9200/i2c.c
... ... @@ -111,7 +111,7 @@
111 111 int
112 112 i2c_probe(unsigned char chip)
113 113 {
114   - char buffer[1];
  114 + unsigned char buffer[1];
115 115  
116 116 return at91_xfer(chip, 0, 0, buffer, 1, 1);
117 117 }
... ... @@ -191,7 +191,7 @@
191 191  
192 192 uchar i2c_reg_read(uchar i2c_addr, uchar reg)
193 193 {
194   - char buf;
  194 + unsigned char buf;
195 195  
196 196 i2c_read(i2c_addr, reg, 1, &buf, 1);
197 197  
... ... @@ -174,8 +174,7 @@
174 174 /* Function Name : AT91F_DataflashSelect */
175 175 /* Object : Select the correct device */
176 176 /*------------------------------------------------------------------------------*/
177   -AT91PS_DataFlash AT91F_DataflashSelect (AT91PS_DataFlash pFlash,
178   - unsigned int *addr)
  177 +AT91PS_DataFlash AT91F_DataflashSelect (AT91PS_DataFlash pFlash, unsigned long *addr)
179 178 {
180 179 char addr_valid = 0;
181 180 int i;
... ... @@ -291,7 +290,7 @@
291 290 /*------------------------------------------------------------------------------*/
292 291 int read_dataflash (unsigned long addr, unsigned long size, char *result)
293 292 {
294   - int AddrToRead = addr;
  293 + unsigned long AddrToRead = addr;
295 294 AT91PS_DataFlash pFlash = &DataFlashInst;
296 295  
297 296 pFlash = AT91F_DataflashSelect (pFlash, &AddrToRead);
... ... @@ -313,7 +312,7 @@
313 312 int write_dataflash (unsigned long addr_dest, unsigned long addr_src,
314 313 unsigned long size)
315 314 {
316   - int AddrToWrite = addr_dest;
  315 + unsigned long AddrToWrite = addr_dest;
317 316 AT91PS_DataFlash pFlash = &DataFlashInst;
318 317  
319 318 pFlash = AT91F_DataflashSelect (pFlash, &AddrToWrite);
... ... @@ -330,7 +329,7 @@
330 329 if (AddrToWrite == -1)
331 330 return -1;
332 331  
333   - return AT91F_DataFlashWrite (pFlash, (char *) addr_src, AddrToWrite, size);
  332 + return AT91F_DataFlashWrite (pFlash, (uchar *)addr_src, AddrToWrite, size);
334 333 }
335 334  
336 335  
... ... @@ -185,21 +185,21 @@
185 185 . If an EEPROM is present it really should be consulted.
186 186 */
187 187 int smc_get_ethaddr(bd_t *bd);
188   -int get_rom_mac(char *v_rom_mac);
  188 +int get_rom_mac(unsigned char *v_rom_mac);
189 189  
190 190 /* ------------------------------------------------------------
191 191 * Internal routines
192 192 * ------------------------------------------------------------
193 193 */
194 194  
195   -static char smc_mac_addr[] = { 0xc0, 0x00, 0x00, 0x1b, 0x62, 0x9c };
  195 +static unsigned char smc_mac_addr[] = { 0xc0, 0x00, 0x00, 0x1b, 0x62, 0x9c };
196 196  
197 197 /*
198 198 * This function must be called before smc_open() if you want to override
199 199 * the default mac address.
200 200 */
201 201  
202   -void smc_set_mac_addr (const char *addr)
  202 +void smc_set_mac_addr (const unsigned char *addr)
203 203 {
204 204 int i;
205 205  
... ... @@ -883,7 +883,7 @@
883 883 char *s = NULL;
884 884 char *e = NULL;
885 885 char *v_mac, es[] = "11:22:33:44:55:66";
886   - uchar s_env_mac[64];
  886 + char s_env_mac[64];
887 887 uchar v_env_mac[6];
888 888 uchar v_rom_mac[6];
889 889  
... ... @@ -905,7 +905,7 @@
905 905  
906 906 if (!env_present) { /* if NO env */
907 907 if (rom_valid) { /* but ROM is valid */
908   - v_mac = v_rom_mac;
  908 + v_mac = (char *)v_rom_mac;
909 909 sprintf (s_env_mac, "%02X:%02X:%02X:%02X:%02X:%02X",
910 910 v_mac[0], v_mac[1], v_mac[2], v_mac[3],
911 911 v_mac[4], v_mac[5]);
... ... @@ -915,7 +915,7 @@
915 915 return (-1);
916 916 }
917 917 } else { /* good env, don't care ROM */
918   - v_mac = v_env_mac; /* always use a good env over a ROM */
  918 + v_mac = (char *)v_env_mac; /* always use a good env over a ROM */
919 919 }
920 920  
921 921 if (env_present && rom_valid) { /* if both env and ROM are good */
... ... @@ -935,7 +935,7 @@
935 935 }
936 936 }
937 937 memcpy (bd->bi_enetaddr, v_mac, 6); /* update global address to match env (allows env changing) */
938   - smc_set_mac_addr (v_mac); /* use old function to update smc default */
  938 + smc_set_mac_addr ((unsigned char *)v_mac); /* use old function to update smc default */
939 939 PRINTK("Using MAC Address %02X:%02X:%02X:%02X:%02X:%02X\n", v_mac[0], v_mac[1],
940 940 v_mac[2], v_mac[3], v_mac[4], v_mac[5]);
941 941 return (0);
... ... @@ -946,7 +946,7 @@
946 946 * Note, this has omly been tested for the OMAP730 P2.
947 947 */
948 948  
949   -int get_rom_mac (char *v_rom_mac)
  949 +int get_rom_mac (unsigned char *v_rom_mac)
950 950 {
951 951 #ifdef HARDCODE_MAC /* used for testing or to supress run time warnings */
952 952 char hw_mac_addr[] = { 0x02, 0x80, 0xad, 0x20, 0x31, 0xb8 };
... ... @@ -51,7 +51,7 @@
51 51 * in order to override the default mac address.
52 52 */
53 53  
54   -void smc_set_mac_addr(const char *addr);
  54 +void smc_set_mac_addr(const unsigned char *addr);
55 55  
56 56  
57 57 /* I want some simple types */
drivers/nand/nand_base.c
... ... @@ -897,7 +897,7 @@
897 897 int i, status;
898 898 u_char ecc_code[32];
899 899 int eccmode = oobsel->useecc ? this->eccmode : NAND_ECC_NONE;
900   - int *oob_config = oobsel->eccpos;
  900 + uint *oob_config = oobsel->eccpos;
901 901 int datidx = 0, eccidx = 0, eccsteps = this->eccsteps;
902 902 int eccbytes = 0;
903 903  
... ... @@ -1119,7 +1119,8 @@
1119 1119 u_char ecc_calc[32];
1120 1120 u_char ecc_code[32];
1121 1121 int eccmode, eccsteps;
1122   - int *oob_config, datidx;
  1122 + unsigned *oob_config;
  1123 + int datidx;
1123 1124 int blockcheck = (1 << (this->phys_erase_shift - this->page_shift)) - 1;
1124 1125 int eccbytes;
1125 1126 int compareecc = 1;
... ... @@ -210,7 +210,7 @@
210 210 . If an EEPROM is present it really should be consulted.
211 211 */
212 212 int smc_get_ethaddr(bd_t *bd);
213   -int get_rom_mac(char *v_rom_mac);
  213 +int get_rom_mac(uchar *v_rom_mac);
214 214  
215 215 /*
216 216 ------------------------------------------------------------
217 217  
218 218  
219 219  
... ... @@ -276,17 +276,23 @@
276 276  
277 277 static inline void SMC_insw(dword offset, volatile uchar* buf, dword len)
278 278 {
  279 + volatile word *p = (volatile word *)buf;
  280 +
279 281 while (len-- > 0) {
280   - *((word*)buf)++ = SMC_inw(offset);
281   - barrier(); *((volatile u32*)(0xc0000000));
  282 + *p++ = SMC_inw(offset);
  283 + barrier();
  284 + *((volatile u32*)(0xc0000000));
282 285 }
283 286 }
284 287  
285 288 static inline void SMC_outsw(dword offset, uchar* buf, dword len)
286 289 {
  290 + volatile word *p = (volatile word *)buf;
  291 +
287 292 while (len-- > 0) {
288   - SMC_outw(*((word*)buf)++, offset);
289   - barrier(); *(volatile u32*)(0xc0000000);
  293 + SMC_outw(*p++, offset);
  294 + barrier();
  295 + *(volatile u32*)(0xc0000000);
290 296 }
291 297 }
292 298 #endif /* CONFIG_SMC_USE_IOFUNCS */
... ... @@ -298,7 +304,7 @@
298 304 * the default mac address.
299 305 */
300 306  
301   -void smc_set_mac_addr(const char *addr) {
  307 +void smc_set_mac_addr(const unsigned char *addr) {
302 308 int i;
303 309  
304 310 for (i=0; i < sizeof(smc_mac_addr); i++){
... ... @@ -1524,7 +1530,8 @@
1524 1530 {
1525 1531 int env_size, rom_valid, env_present = 0, reg;
1526 1532 char *s = NULL, *e, *v_mac, es[] = "11:22:33:44:55:66";
1527   - uchar s_env_mac[64], v_env_mac[6], v_rom_mac[6];
  1533 + char s_env_mac[64];
  1534 + uchar v_env_mac[6], v_rom_mac[6];
1528 1535  
1529 1536 env_size = getenv_r ("ethaddr", s_env_mac, sizeof (s_env_mac));
1530 1537 if ((env_size > 0) && (env_size < sizeof (es))) { /* exit if env is bad */
... ... @@ -1547,7 +1554,7 @@
1547 1554  
1548 1555 if (!env_present) { /* if NO env */
1549 1556 if (rom_valid) { /* but ROM is valid */
1550   - v_mac = v_rom_mac;
  1557 + v_mac = (char *)v_rom_mac;
1551 1558 sprintf (s_env_mac, "%02X:%02X:%02X:%02X:%02X:%02X",
1552 1559 v_mac[0], v_mac[1], v_mac[2], v_mac[3],
1553 1560 v_mac[4], v_mac[5]);
... ... @@ -1557,7 +1564,7 @@
1557 1564 return (-1);
1558 1565 }
1559 1566 } else { /* good env, don't care ROM */
1560   - v_mac = v_env_mac; /* always use a good env over a ROM */
  1567 + v_mac = (char *)v_env_mac; /* always use a good env over a ROM */
1561 1568 }
1562 1569  
1563 1570 if (env_present && rom_valid) { /* if both env and ROM are good */
1564 1571  
... ... @@ -1577,13 +1584,13 @@
1577 1584 }
1578 1585 }
1579 1586 memcpy (bd->bi_enetaddr, v_mac, 6); /* update global address to match env (allows env changing) */
1580   - smc_set_mac_addr (v_mac); /* use old function to update smc default */
  1587 + smc_set_mac_addr ((uchar *)v_mac); /* use old function to update smc default */
1581 1588 PRINTK("Using MAC Address %02X:%02X:%02X:%02X:%02X:%02X\n", v_mac[0], v_mac[1],
1582 1589 v_mac[2], v_mac[3], v_mac[4], v_mac[5]);
1583 1590 return (0);
1584 1591 }
1585 1592  
1586   -int get_rom_mac (char *v_rom_mac)
  1593 +int get_rom_mac (uchar *v_rom_mac)
1587 1594 {
1588 1595 #ifdef HARDCODE_MAC /* used for testing or to supress run time warnings */
1589 1596 char hw_mac_addr[] = { 0x02, 0x80, 0xad, 0x20, 0x31, 0xb8 };
... ... @@ -49,7 +49,7 @@
49 49 * in order to override the default mac address.
50 50 */
51 51  
52   -void smc_set_mac_addr(const char *addr);
  52 +void smc_set_mac_addr (const unsigned char *addr);
53 53  
54 54  
55 55 /* I want some simple types */
include/asm-arm/arch-arm720t/s3c4510b.h
... ... @@ -267,8 +267,6 @@
267 267 void (*m_func)( void *data);
268 268 };
269 269  
270   -extern struct _irq_handler IRQ_HANDLER[];
271   -
272 270 #endif
273 271  
274 272 #endif /* __S3C4510_h */
... ... @@ -124,7 +124,7 @@
124 124 checksum = ntohl (hdr->ih_hcrc);
125 125 hdr->ih_hcrc = 0;
126 126  
127   - if (crc32 (0, (char *) data, len) != checksum) {
  127 + if (crc32 (0, (unsigned char *) data, len) != checksum) {
128 128 printf ("Bad Header Checksum\n");
129 129 SHOW_BOOT_PROGRESS (-11);
130 130 do_reset (cmdtp, flag, argc, argv);
... ... @@ -148,7 +148,7 @@
148 148 ulong csum = 0;
149 149  
150 150 printf (" Verifying Checksum ... ");
151   - csum = crc32 (0, (char *) data, len);
  151 + csum = crc32 (0, (unsigned char *) data, len);
152 152 if (csum != ntohl (hdr->ih_dcrc)) {
153 153 printf ("Bad Data CRC\n");
154 154 SHOW_BOOT_PROGRESS (-12);
... ... @@ -121,7 +121,7 @@
121 121  
122 122 static int init_baudrate (void)
123 123 {
124   - uchar tmp[64]; /* long enough for environment variables */
  124 + char tmp[64]; /* long enough for environment variables */
125 125 int i = getenv_r ("baudrate", tmp, sizeof (tmp));
126 126 gd->bd->bi_baudrate = gd->baudrate = (i > 0)
127 127 ? (int) simple_strtoul (tmp, NULL, 10)
128 128  
... ... @@ -235,9 +235,11 @@
235 235  
236 236 void start_armboot (void)
237 237 {
238   - ulong size;
239 238 init_fnc_t **init_fnc_ptr;
240 239 char *s;
  240 +#ifndef CFG_NO_FLASH
  241 + ulong size;
  242 +#endif
241 243 #if defined(CONFIG_VFD) || defined(CONFIG_LCD)
242 244 unsigned long addr;
243 245 #endif
... ... @@ -320,7 +322,7 @@
320 322 int i;
321 323 ulong reg;
322 324 char *s, *e;
323   - uchar tmp[64];
  325 + char tmp[64];
324 326  
325 327 i = getenv_r ("ethaddr", tmp, sizeof (tmp));
326 328 s = (i > 0) ? tmp : NULL;
... ... @@ -73,7 +73,7 @@
73 73 static int setup_done = 0;
74 74  
75 75 static int
76   -rs5c372_readram(char *buf, int len)
  76 +rs5c372_readram(unsigned char *buf, int len)
77 77 {
78 78 int ret;
79 79  
... ... @@ -128,7 +128,7 @@
128 128 }
129 129  
130 130 static void
131   -rs5c372_convert_to_time(struct rtc_time *dt, char *buf)
  131 +rs5c372_convert_to_time(struct rtc_time *dt, unsigned char *buf)
132 132 {
133 133 /* buf[0] is register 15 */
134 134 dt->tm_sec = bcd2bin(buf[1]);