]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/blackfin/lib/board.c
Blackfin: move gd/bd to bss by default
[karo-tx-uboot.git] / arch / blackfin / lib / board.c
index 362b8c47eaa9143fe73fcf04bd80ef1c12d396dd..2d424a2da0b9029fe42576a354609beef6d14a3e 100644 (file)
 #include <common.h>
 #include <command.h>
 #include <stdio_dev.h>
+#include <serial.h>
 #include <environment.h>
 #include <malloc.h>
 #include <mmc.h>
 #include <net.h>
-#include <timestamp.h>
 #include <status_led.h>
 #include <version.h>
 
@@ -39,8 +39,6 @@ int post_flag;
 
 DECLARE_GLOBAL_DATA_PTR;
 
-const char version_string[] = U_BOOT_VERSION " ("U_BOOT_DATE" - "U_BOOT_TIME")";
-
 __attribute__((always_inline))
 static inline void serial_early_puts(const char *s)
 {
@@ -52,7 +50,7 @@ static inline void serial_early_puts(const char *s)
 
 static int display_banner(void)
 {
-       printf("\n\n%s\n\n", version_string);
+       display_options();
        printf("CPU:   ADSP %s "
                "(Detected Rev: 0.%d) "
                "(%s boot)\n",
@@ -64,11 +62,7 @@ static int display_banner(void)
 
 static int init_baudrate(void)
 {
-       char baudrate[15];
-       int i = getenv_f("baudrate", baudrate, sizeof(baudrate));
-       gd->bd->bi_baudrate = gd->baudrate = (i > 0)
-           ? simple_strtoul(baudrate, NULL, 10)
-           : CONFIG_BAUDRATE;
+       gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
        return 0;
 }
 
@@ -187,6 +181,46 @@ void init_cplbtables(void)
        }
 }
 
+static int global_board_data_init(void)
+{
+#ifndef CONFIG_SYS_GBL_DATA_ADDR
+# define CONFIG_SYS_GBL_DATA_ADDR 0
+#endif
+#ifndef CONFIG_SYS_BD_INFO_ADDR
+# define CONFIG_SYS_BD_INFO_ADDR 0
+#endif
+
+       bd_t *bd;
+
+       if (CONFIG_SYS_GBL_DATA_ADDR) {
+               gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR);
+               memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
+       } else {
+               static gd_t _bfin_gd;
+               gd = &_bfin_gd;
+       }
+
+       if (CONFIG_SYS_BD_INFO_ADDR) {
+               bd = (bd_t *) (CONFIG_SYS_BD_INFO_ADDR);
+               memset(bd, 0, GENERATED_BD_INFO_SIZE);
+       } else {
+               static bd_t _bfin_bd;
+               bd = &_bfin_bd;
+       }
+       gd->bd = bd;
+
+       bd->bi_r_version = version_string;
+       bd->bi_cpu = MK_STR(CONFIG_BFIN_CPU);
+       bd->bi_board_name = BFIN_BOARD_NAME;
+       bd->bi_vco = get_vco();
+       bd->bi_cclk = get_cclk();
+       bd->bi_sclk = get_sclk();
+       bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
+       bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE;
+
+       return 0;
+}
+
 /*
  * All attempts to come up with a "common" initialization sequence
  * that works for all boards and architectures failed: some of the
@@ -207,7 +241,6 @@ extern int timer_init(void);
 
 void board_init_f(ulong bootflag)
 {
-       bd_t *bd;
        char buf[32];
 
 #ifdef CONFIG_BOARD_EARLY_INIT_F
@@ -240,21 +273,8 @@ void board_init_f(ulong bootflag)
                hang();
 #endif
        serial_early_puts("Init global data\n");
-       gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR);
-       memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
-
-       bd = (bd_t *) (CONFIG_SYS_BD_INFO_ADDR);
-       gd->bd = bd;
-       memset((void *)bd, 0, GENERATED_BD_INFO_SIZE);
 
-       bd->bi_r_version = version_string;
-       bd->bi_cpu = MK_STR(CONFIG_BFIN_CPU);
-       bd->bi_board_name = BFIN_BOARD_NAME;
-       bd->bi_vco = get_vco();
-       bd->bi_cclk = get_cclk();
-       bd->bi_sclk = get_sclk();
-       bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE;
+       global_board_data_init();
 
        /* Initialize */
        serial_early_puts("IRQ init\n");
@@ -265,6 +285,9 @@ void board_init_f(ulong bootflag)
        init_baudrate();
        serial_early_puts("Serial init\n");
        serial_init();
+#ifdef CONFIG_SERIAL_MULTI
+       serial_initialize();
+#endif
        serial_early_puts("Console init flash\n");
        console_init_f();
        serial_early_puts("End of early debugging\n");
@@ -279,7 +302,7 @@ void board_init_f(ulong bootflag)
 
        if (CONFIG_MEM_SIZE) {
                printf("RAM:   ");
-               print_size(bd->bi_memsize, "\n");
+               print_size(gd->bd->bi_memsize, "\n");
        }
 
 #if defined(CONFIG_POST)
@@ -311,7 +334,6 @@ static void board_net_init_r(bd_t *bd)
 
 void board_init_r(gd_t * id, ulong dest_addr)
 {
-       char *s;
        bd_t *bd;
        gd = id;
        gd->flags |= GD_FLG_RELOC;      /* tell others: relocation done */
@@ -373,8 +395,7 @@ void board_init_r(gd_t * id, ulong dest_addr)
 #endif
 
        /* Initialize from environment */
-       if ((s = getenv("loadaddr")) != NULL)
-               load_addr = simple_strtoul(s, NULL, 16);
+       load_addr = getenv_ulong("loadaddr", 16, load_addr);
 
 #if defined(CONFIG_MISC_INIT_R)
        /* miscellaneous platform dependent initialisations */