Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
[oweals/u-boot.git] / arch / sh / lib / board.c
index a302fc2e65808c858817c288aa0f7c463c682546..968566c6f5109b2f1665d7f1c0a0fc898d12af36 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007,2008
+ * Copyright (C) 2007, 2008, 2010
  * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  *
  * This program is free software; you can redistribute it and/or
@@ -32,6 +32,8 @@
 #include <miiphy.h>
 #endif
 
+DECLARE_GLOBAL_DATA_PTR;
+
 extern int cpu_init(void);
 extern int board_init(void);
 extern int dram_init(void);
@@ -43,10 +45,12 @@ unsigned long monitor_flash_len = CONFIG_SYS_MONITOR_LEN;
 
 static int sh_flash_init(void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        gd->bd->bi_flashsize = flash_init();
-       printf("FLASH: %ldMB\n", gd->bd->bi_flashsize / (1024*1024));
+
+       if (gd->bd->bi_flashsize >= (1024 * 1024))
+               printf("Flash: %ldMB\n", gd->bd->bi_flashsize / (1024*1024));
+       else
+               printf("Flash: %ldKB\n", gd->bd->bi_flashsize / 1024);
 
        return 0;
 }
@@ -89,7 +93,7 @@ static int sh_pci_init(void)
 
 static int sh_mem_env_init(void)
 {
-       mem_malloc_init(CONFIG_SYS_TEXT_BASE - CONFIG_SYS_GBL_DATA_SIZE -
+       mem_malloc_init(CONFIG_SYS_TEXT_BASE - GENERATED_GBL_DATA_SIZE -
                        CONFIG_SYS_MALLOC_LEN, CONFIG_SYS_MALLOC_LEN - 16);
        env_relocate();
        jumptable_init();
@@ -99,7 +103,6 @@ static int sh_mem_env_init(void)
 #if defined(CONFIG_CMD_NET)
 static int sh_net_init(void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
        gd->bd->bi_ip_addr = getenv_IPaddr("ipaddr");
        return 0;
 }
@@ -139,12 +142,10 @@ init_fnc_t *init_sequence[] =
 
 void sh_generic_init(void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        bd_t *bd;
        init_fnc_t **init_fnc_ptr;
 
-       memset(gd, 0, CONFIG_SYS_GBL_DATA_SIZE);
+       memset(gd, 0, GENERATED_GBL_DATA_SIZE);
 
        gd->flags |= GD_FLG_RELOC;      /* tell others: relocation done */