]> git.sur5r.net Git - u-boot/blobdiff - arch/arm/lib/board.c
arm: Correct build error introduced by getenv_ulong() patch
[u-boot] / arch / arm / lib / board.c
index 14a56f6f0a921ee84f1616b6ba8c1ff3caa43fee..7434b34f9c3d03103b54729e9fa0664443b3ae80 100644 (file)
@@ -48,6 +48,8 @@
 #include <nand.h>
 #include <onenand_uboot.h>
 #include <mmc.h>
+#include <post.h>
+#include <logbuff.h>
 
 #ifdef CONFIG_BITBANGMII
 #include <miiphy.h>
@@ -87,22 +89,22 @@ extern void rtl8019_get_enetaddr (uchar * addr);
 inline void __coloured_LED_init(void) {}
 void coloured_LED_init(void)
        __attribute__((weak, alias("__coloured_LED_init")));
-inline void __red_LED_on(void) {}
-void red_LED_on(void) __attribute__((weak, alias("__red_LED_on")));
-inline void __red_LED_off(void) {}
-void red_LED_off(void) __attribute__((weak, alias("__red_LED_off")));
-inline void __green_LED_on(void) {}
-void green_LED_on(void) __attribute__((weak, alias("__green_LED_on")));
-inline void __green_LED_off(void) {}
-void green_LED_off(void) __attribute__((weak, alias("__green_LED_off")));
-inline void __yellow_LED_on(void) {}
-void yellow_LED_on(void) __attribute__((weak, alias("__yellow_LED_on")));
-inline void __yellow_LED_off(void) {}
-void yellow_LED_off(void) __attribute__((weak, alias("__yellow_LED_off")));
-inline void __blue_LED_on(void) {}
-void blue_LED_on(void) __attribute__((weak, alias("__blue_LED_on")));
-inline void __blue_LED_off(void) {}
-void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));
+inline void __red_led_on(void) {}
+void red_led_on(void) __attribute__((weak, alias("__red_led_on")));
+inline void __red_led_off(void) {}
+void red_led_off(void) __attribute__((weak, alias("__red_led_off")));
+inline void __green_led_on(void) {}
+void green_led_on(void) __attribute__((weak, alias("__green_led_on")));
+inline void __green_led_off(void) {}
+void green_led_off(void) __attribute__((weak, alias("__green_led_off")));
+inline void __yellow_led_on(void) {}
+void yellow_led_on(void) __attribute__((weak, alias("__yellow_led_on")));
+inline void __yellow_led_off(void) {}
+void yellow_led_off(void) __attribute__((weak, alias("__yellow_led_off")));
+inline void __blue_led_on(void) {}
+void blue_led_on(void) __attribute__((weak, alias("__blue_led_on")));
+inline void __blue_led_off(void) {}
+void blue_led_off(void) __attribute__((weak, alias("__blue_led_off")));
 
 /*
  ************************************************************************
@@ -116,16 +118,11 @@ void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));
 #if defined(CONFIG_ARM_DCC) && !defined(CONFIG_BAUDRATE)
 #define CONFIG_BAUDRATE 115200
 #endif
+
 static int init_baudrate(void)
 {
-       char tmp[64];   /* long enough for environment variables */
-       int i = getenv_f("baudrate", tmp, sizeof(tmp));
-
-       gd->baudrate = (i > 0)
-                       ? (int) simple_strtoul(tmp, NULL, 10)
-                       : CONFIG_BAUDRATE;
-
-       return (0);
+       gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
+       return 0;
 }
 
 static int display_banner(void)
@@ -265,6 +262,9 @@ void board_init_f(ulong bootflag)
        init_fnc_t **init_fnc_ptr;
        gd_t *id;
        ulong addr, addr_sp;
+#ifdef CONFIG_PRAM
+       ulong reg;
+#endif
 
        /* Pointer is writable since we allocated a register for it */
        gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR) & ~0x07);
@@ -275,10 +275,6 @@ void board_init_f(ulong bootflag)
 
        gd->mon_len = _bss_end_ofs;
 
-#ifdef CONFIG_MACH_TYPE
-       gd->bd->bi_arch_number = CONFIG_MACH_TYPE; /* board id for Linux */
-#endif
-
        for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
                if ((*init_fnc_ptr)() != 0) {
                        hang ();
@@ -319,9 +315,7 @@ void board_init_f(ulong bootflag)
        /*
         * reserve protected RAM
         */
-       i = getenv_r("pram", (char *)tmp, sizeof(tmp));
-       reg = (i > 0) ? simple_strtoul((const char *)tmp, NULL, 10) :
-               CONFIG_PRAM;
+       reg = getenv_ulong("pram", 10, CONFIG_PRAM);
        addr -= (reg << 10);            /* size is in kB */
        debug("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
 #endif /* CONFIG_PRAM */
@@ -376,6 +370,11 @@ void board_init_f(ulong bootflag)
        gd->bd = bd;
        debug("Reserving %zu Bytes for Board Info at: %08lx\n",
                        sizeof (bd_t), addr_sp);
+
+#ifdef CONFIG_MACH_TYPE
+       gd->bd->bi_arch_number = CONFIG_MACH_TYPE; /* board id for Linux */
+#endif
+
        addr_sp -= sizeof (gd_t);
        id = (gd_t *) addr_sp;
        debug("Reserving %zu Bytes for Global Data at: %08lx\n",
@@ -438,24 +437,19 @@ static char *failed = "*** failed ***\n";
 
 void board_init_r(gd_t *id, ulong dest_addr)
 {
-       char *s;
-       bd_t *bd;
        ulong malloc_start;
 #if !defined(CONFIG_SYS_NO_FLASH)
        ulong flash_size;
 #endif
 
        gd = id;
-       bd = gd->bd;
 
        gd->flags |= GD_FLG_RELOC;      /* tell others: relocation done */
 
        monitor_flash_len = _end_ofs;
-       /*
-        * Enable D$:
-        * I$, if needed, must be already enabled in start.S
-        */
-       dcache_enable();
+
+       /* Enable caches */
+       enable_caches();
 
        debug("monitor flash len: %08lX\n", monitor_flash_len);
        board_init();   /* Setup chipselects */
@@ -483,13 +477,14 @@ void board_init_r(gd_t *id, ulong dest_addr)
        flash_size = flash_init();
        if (flash_size > 0) {
 # ifdef CONFIG_SYS_FLASH_CHECKSUM
+               char *s = getenv("flashchecksum");
+
                print_size(flash_size, "");
                /*
                 * Compute and print flash CRC if flashchecksum is set to 'y'
                 *
                 * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
                 */
-               s = getenv("flashchecksum");
                if (s && (*s == 'y')) {
                        printf("  CRC: %08X", crc32(0,
                                (const unsigned char *) CONFIG_SYS_FLASH_BASE,
@@ -516,7 +511,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
 #ifdef CONFIG_GENERIC_MMC
        puts("MMC:   ");
-       mmc_initialize(bd);
+       mmc_initialize(gd->bd);
 #endif
 
 #ifdef CONFIG_HAS_DATAFLASH
@@ -570,13 +565,14 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #endif /* CONFIG_DRIVER_SMC91111 || CONFIG_DRIVER_LAN91C96 */
 
        /* Initialize from environment */
-       s = getenv("loadaddr");
-       if (s != NULL)
-               load_addr = simple_strtoul(s, NULL, 16);
+       load_addr = getenv_ulong("loadaddr", 16, load_addr);
 #if defined(CONFIG_CMD_NET)
-       s = getenv("bootfile");
-       if (s != NULL)
-               copy_filename(BootFile, s, sizeof(BootFile));
+       {
+               char *s = getenv("bootfile");
+
+               if (s != NULL)
+                       copy_filename(BootFile, s, sizeof(BootFile));
+       }
 #endif
 
 #ifdef BOARD_LATE_INIT
@@ -587,9 +583,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
        bb_miiphy_init();
 #endif
 #if defined(CONFIG_CMD_NET)
-#if defined(CONFIG_NET_MULTI)
        puts("Net:   ");
-#endif
        eth_initialize(gd->bd);
 #if defined(CONFIG_RESET_PHY_R)
        debug("Reset Ethernet PHY\n");
@@ -607,18 +601,11 @@ void board_init_r(gd_t *id, ulong dest_addr)
         * taking into account the protected RAM at top of memory
         */
        {
-               ulong pram;
+               ulong pram = 0;
                uchar memsz[32];
-#ifdef CONFIG_PRAM
-               char *s;
 
-               s = getenv("pram");
-               if (s != NULL)
-                       pram = simple_strtoul(s, NULL, 10);
-               else
-                       pram = CONFIG_PRAM;
-#else
-               pram = 0;
+#ifdef CONFIG_PRAM
+               pram = getenv_ulong("pram", 10, CONFIG_PRAM);
 #endif
 #ifdef CONFIG_LOGBUFFER
 #ifndef CONFIG_ALT_LB_ADDR
@@ -626,7 +613,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
                pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
 #endif
 #endif
-               sprintf((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
+               sprintf((char *)memsz, "%ldk", (gd->ram_size / 1024) - pram);
                setenv("mem", (char *)memsz);
        }
 #endif