Blackfin: unify cpu and boot modes
[oweals/u-boot.git] / lib_blackfin / board.c
index 1538da3f29a6f6a0317e9ff7d75d23322baf0161..140ec07cfe22a0ecea1794090df2181af54709e2 100644 (file)
 #include <i2c.h>
 #include "blackfin_board.h"
 #include <asm/cplb.h>
-#include "../drivers/smc91111.h"
+#include "../drivers/net/smc91111.h"
 
-#if defined(CONFIG_BF537)&&defined(CONFIG_POST)
+#if defined(CONFIG_POST)
 #include <post.h>
 int post_flag;
 #endif
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #ifndef CFG_NO_FLASH
 extern flash_info_t flash_info[];
 #endif
@@ -114,6 +116,7 @@ static int display_banner(void)
 {
        sprintf(version_string, VERSION_STRING_FORMAT, VERSION_STRING);
        printf("%s\n", version_string);
+       printf("CPU:   ADSP " MK_STR(CONFIG_BFIN_CPU) " (Detected Rev: 0.%d)\n", bfin_revid());
        return (0);
 }
 
@@ -126,8 +129,6 @@ static void display_flash_config(ulong size)
 
 static int init_baudrate(void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        char tmp[64];
        int i = getenv_r("baudrate", tmp, sizeof(tmp));
        gd->bd->bi_baudrate = gd->baudrate = (i > 0)
@@ -139,7 +140,6 @@ static int init_baudrate(void)
 #ifdef DEBUG
 static void display_global_data(void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
        bd_t *bd;
        bd = gd->bd;
        printf("--flags:%x\n", gd->flags);
@@ -192,21 +192,8 @@ void init_cplbtables(void)
                }
                j++;
        }
-#if defined(CONFIG_BF561)
-       /* MAC space */
-       icplb_table[j][0] = 0x2C000000;
-       icplb_table[j][1] = SDRAM_INON_CHBL;
-       j++;
-       /* Async Memory space */
-       for (i = 0; i < 3; i++) {
-               icplb_table[j][0] = 0x20000000 + i * 4 * 1024 * 1024;
-               icplb_table[j][1] = SDRAM_INON_CHBL;
-               j++;
-       }
-#else
        icplb_table[j][0] = 0x20000000;
        icplb_table[j][1] = SDRAM_INON_CHBL;
-#endif
        j = 0;
        dcplb_table[j][0] = 0xFF800000;
        dcplb_table[j][1] = L1_DMEMORY;
@@ -223,22 +210,8 @@ void init_cplbtables(void)
                j++;
        }
 
-#if defined(CONFIG_BF561)
-       /* MAC space */
-       dcplb_table[j][0] = 0x2C000000;
-       dcplb_table[j][1] = SDRAM_EBIU;
-       j++;
-
-       /* Flash space */
-       for (i = 0; i < 3; i++) {
-               dcplb_table[j][0] = 0x20000000 + i * 4 * 1024 * 1024;
-               dcplb_table[j][1] = SDRAM_EBIU;
-               j++;
-       }
-#else
        dcplb_table[j][0] = 0x20000000;
        dcplb_table[j][1] = SDRAM_EBIU;
-#endif
 }
 
 /*
@@ -256,7 +229,6 @@ void init_cplbtables(void)
 
 void board_init_f(ulong bootflag)
 {
-       DECLARE_GLOBAL_DATA_PTR;
        ulong addr;
        bd_t *bd;
        int i;
@@ -276,7 +248,7 @@ void board_init_f(ulong bootflag)
        memset((void *)bd, 0, sizeof(bd_t));
 
        /* Initialize */
-       init_IRQ();
+       irq_init();
        env_init();             /* initialize environment */
        init_baudrate();        /* initialze baudrate settings */
        serial_init();          /* serial communications setup */
@@ -297,7 +269,7 @@ void board_init_f(ulong bootflag)
        }
 
        checkboard();
-#if defined(CONFIG_RTC_BF533) && (CONFIG_COMMANDS & CFG_CMD_DATE)
+#if defined(CONFIG_RTC_BF533) && defined(CONFIG_CMD_DATE)
        rtc_init();
 #endif
        timer_init();
@@ -305,7 +277,7 @@ void board_init_f(ulong bootflag)
               get_vco() / 1000000, get_cclk() / 1000000, get_sclk() / 1000000);
        printf("SDRAM: ");
        print_size(initdram(0), "\n");
-#if defined(CONFIG_BF537)&&defined(CONFIG_POST)
+#if defined(CONFIG_POST)
        post_init_f();
        post_bootmode_init();
        post_run(NULL, POST_ROM | post_bootmode_get(0));
@@ -325,7 +297,6 @@ static int init_func_i2c(void)
 
 void board_init_r(gd_t * id, ulong dest_addr)
 {
-       DECLARE_GLOBAL_DATA_PTR;
        ulong size;
        extern void malloc_bin_reloc(void);
        char *s, *e;
@@ -335,12 +306,12 @@ void board_init_r(gd_t * id, ulong dest_addr)
        gd->flags |= GD_FLG_RELOC;      /* tell others: relocation done */
        bd = gd->bd;
 
-#if    defined(CONFIG_BF537) && defined(CONFIG_POST)
+#if defined(CONFIG_POST)
        post_output_backlog();
        post_reloc();
 #endif
 
-#if    (CONFIG_STAMP || CONFIG_BF537 || CONFIG_EZKIT561) && !defined(CFG_NO_FLASH)
+#if    !defined(CFG_NO_FLASH)
        /* There are some other pointer constants we must deal with */
        /* configure available FLASH banks */
        size = flash_init();
@@ -391,13 +362,13 @@ void board_init_r(gd_t * id, ulong dest_addr)
        if ((s = getenv("loadaddr")) != NULL) {
                load_addr = simple_strtoul(s, NULL, 16);
        }
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
        if ((s = getenv("bootfile")) != NULL) {
                copy_filename(BootFile, s, sizeof(BootFile));
        }
 #endif
 
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if defined(CONFIG_CMD_NAND)
        puts("NAND:  ");
        nand_init();            /* go init the NAND */
 #endif
@@ -407,7 +378,7 @@ void board_init_r(gd_t * id, ulong dest_addr)
        misc_init_r();
 #endif
 
-#if ((BFIN_CPU == ADSP_BF537) || (BFIN_CPU == ADSP_BF536))
+#ifdef CONFIG_CMD_NET
        printf("Net:    ");
        eth_initialize(bd);
 #endif
@@ -436,7 +407,7 @@ void board_init_r(gd_t * id, ulong dest_addr)
        display_global_data();
 #endif
 
-#if defined(CONFIG_BF537) && defined(CONFIG_POST)
+#if defined(CONFIG_POST)
        if (post_flag)
                post_run(NULL, POST_RAM | post_bootmode_get(0));
 #endif