]> git.sur5r.net Git - u-boot/blobdiff - arch/powerpc/lib/board.c
powerpc: Cleanup BOOTFLAG_* references
[u-boot] / arch / powerpc / lib / board.c
index a30acee4febf5ee5c675953cfd2feeacfa8da8e7..c0c7fd4f6ee0caf89ae2d859e606ce39edc7e35a 100644 (file)
@@ -107,7 +107,7 @@ void doc_init (void);
 
 static char *failed = "*** failed ***\n";
 
-#if defined(CONFIG_OXC) || defined(CONFIG_PCU_E) || defined(CONFIG_RMU)
+#if defined(CONFIG_OXC) || defined(CONFIG_RMU)
 extern flash_info_t flash_info[];
 #endif
 
@@ -118,16 +118,6 @@ extern int board_start_ide(void);
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_ENV_IS_EMBEDDED)
-#define TOTAL_MALLOC_LEN       CONFIG_SYS_MALLOC_LEN
-#elif ( ((CONFIG_ENV_ADDR+CONFIG_ENV_SIZE) < CONFIG_SYS_MONITOR_BASE) || \
-       (CONFIG_ENV_ADDR >= (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)) ) || \
-      defined(CONFIG_ENV_IS_IN_NVRAM)
-#define        TOTAL_MALLOC_LEN        (CONFIG_SYS_MALLOC_LEN + CONFIG_ENV_SIZE)
-#else
-#define        TOTAL_MALLOC_LEN        CONFIG_SYS_MALLOC_LEN
-#endif
-
 #if !defined(CONFIG_SYS_MEM_TOP_HIDE)
 #define CONFIG_SYS_MEM_TOP_HIDE        0
 #endif
@@ -169,7 +159,7 @@ typedef int (init_fnc_t) (void);
 static int init_baudrate (void)
 {
        char tmp[64];   /* long enough for environment variables */
-       int i = getenv_("baudrate", tmp, sizeof (tmp));
+       int i = getenv_f("baudrate", tmp, sizeof (tmp));
 
        gd->baudrate = (i > 0)
                        ? (int) simple_strtoul (tmp, NULL, 10)
@@ -442,7 +432,7 @@ void board_init_f (ulong bootflag)
        /*
         * reserve protected RAM
         */
-       i = getenv_("pram", (char *)tmp, sizeof (tmp));
+       i = getenv_f("pram", (char *)tmp, sizeof (tmp));
        reg = (i > 0) ? simple_strtoul ((const char *)tmp, NULL, 10) : CONFIG_PRAM;
        addr -= (reg << 10);            /* size is in kB */
        debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
@@ -490,6 +480,7 @@ void board_init_f (ulong bootflag)
         */
        addr_sp -= sizeof (bd_t);
        bd = (bd_t *) addr_sp;
+       memset(bd, 0, sizeof(bd_t));
        gd->bd = bd;
        debug ("Reserving %zu Bytes for Board Info at: %08lx\n",
                        sizeof (bd_t), addr_sp);
@@ -519,15 +510,9 @@ void board_init_f (ulong bootflag)
        bd->bi_memstart  = CONFIG_SYS_SDRAM_BASE;       /* start of  DRAM memory        */
        bd->bi_memsize   = gd->ram_size;        /* size  of  DRAM memory in bytes */
 
-#ifdef CONFIG_IP860
-       bd->bi_sramstart = SRAM_BASE;   /* start of  SRAM memory        */
-       bd->bi_sramsize  = SRAM_SIZE;   /* size  of  SRAM memory        */
-#elif defined CONFIG_MPC8220
+#ifdef CONFIG_SYS_SRAM_BASE
        bd->bi_sramstart = CONFIG_SYS_SRAM_BASE;        /* start of  SRAM memory        */
        bd->bi_sramsize  = CONFIG_SYS_SRAM_SIZE;        /* size  of  SRAM memory        */
-#else
-       bd->bi_sramstart = 0;           /* FIXME */ /* start of  SRAM memory    */
-       bd->bi_sramsize  = 0;           /* FIXME */ /* size  of  SRAM memory    */
 #endif
 
 #if defined(CONFIG_8xx) || defined(CONFIG_8260) || defined(CONFIG_5xx) || \
@@ -561,8 +546,6 @@ void board_init_f (ulong bootflag)
        }
 #endif
 
-       bd->bi_bootflags = bootflag;    /* boot / reboot flag (for LynxOS)    */
-
        WATCHDOG_RESET ();
        bd->bi_intfreq = gd->cpu_clk;   /* Internal Freq, in Hz */
        bd->bi_busfreq = gd->bus_clk;   /* Bus Freq,      in Hz */
@@ -686,7 +669,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        WATCHDOG_RESET();
 
-#if defined(CONFIG_SYS_DELAYED_ICACHE) || defined(CONFIG_MPC83xx)
+#if defined(CONFIG_SYS_DELAYED_ICACHE)
        icache_enable ();       /* it's time to enable the instruction cache */
 #endif
 
@@ -694,11 +677,10 @@ void board_init_r (gd_t *id, ulong dest_addr)
        unlock_ram_in_cache();  /* it's time to unlock D-cache in e500 */
 #endif
 
-#if defined(CONFIG_BAB7xx) || defined(CONFIG_CPC45)
+#if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT)
        /*
-        * Do PCI configuration on BAB7xx and CPC45 _before_ the flash
-        * gets initialised, because we need the ISA resp. PCI_to_LOCAL bus
-        * bridge there.
+        * Do early PCI configuration _before_ the flash gets initialised,
+        * because PCU ressources are crucial for flash access on some boards.
         */
        pci_init ();
 #endif
@@ -748,19 +730,12 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
 
 
-# if defined(CONFIG_PCU_E) || defined(CONFIG_OXC) || defined(CONFIG_RMU)
+# if defined(CONFIG_OXC) || defined(CONFIG_RMU)
        /* flash mapped at end of memory map */
-       bd->bi_flashoffset = TEXT_BASE + flash_size;
+       bd->bi_flashoffset = CONFIG_SYS_TEXT_BASE + flash_size;
 # elif CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE
        bd->bi_flashoffset = monitor_flash_len; /* reserved area for startup monitor  */
-# else
-       bd->bi_flashoffset = 0;
 # endif
-#else  /* CONFIG_SYS_NO_FLASH */
-
-       bd->bi_flashsize = 0;
-       bd->bi_flashstart = 0;
-       bd->bi_flashoffset = 0;
 #endif /* !CONFIG_SYS_NO_FLASH */
 
        WATCHDOG_RESET ();
@@ -783,6 +758,17 @@ void board_init_r (gd_t *id, ulong dest_addr)
        nand_init();            /* go init the NAND */
 #endif
 
+#ifdef CONFIG_GENERIC_MMC
+/*
+ * MMC initialization is called before relocating env.
+ * Thus It is required that operations like pin multiplexer
+ * be put in board_init.
+ */
+       WATCHDOG_RESET ();
+       puts ("MMC:  ");
+       mmc_initialize (bd);
+#endif
+
        /* relocate environment function pointers etc. */
        env_relocate ();
 
@@ -790,7 +776,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
         * Fill in missing fields of bd_info.
         * We do this here, where we have "normal" access to the
         * environment; we used to do this still running from ROM,
-        * where had to use getenv_r(), which can be pretty slow when
+        * where had to use getenv_f(), which can be pretty slow when
         * the environment is in EEPROM.
         */
 
@@ -806,14 +792,8 @@ void board_init_r (gd_t *id, ulong dest_addr)
                if (s && ((*s == 'y') || (*s == 'Y'))) {
                        bd->bi_iic_fast[0] = 1;
                        bd->bi_iic_fast[1] = 1;
-               } else {
-                       bd->bi_iic_fast[0] = 0;
-                       bd->bi_iic_fast[1] = 0;
                }
        }
-#else
-       bd->bi_iic_fast[0] = 0;
-       bd->bi_iic_fast[1] = 0;
 #endif /* CONFIG_I2CFAST */
 #endif /* CONFIG_405GP, CONFIG_405EP */
 #endif /* CONFIG_SYS_EXTBDINFO */
@@ -858,7 +838,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        WATCHDOG_RESET ();
 
-#if defined(CONFIG_PCI) && !defined(CONFIG_BAB7xx) && !defined(CONFIG_CPC45)
+#if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
        /*
         * Do pci configuration
         */
@@ -903,13 +883,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
         */
        interrupt_init ();
 
-       /* Must happen after interrupts are initialized since
-        * an irq handler gets installed
-        */
-#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
-       serial_buffered_init();
-#endif
-
 #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
        status_led_set (STATUS_LED_BOOT, STATUS_LED_BLINKING);
 #endif
@@ -939,12 +912,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
        scsi_init ();
 #endif
 
-#ifdef CONFIG_GENERIC_MMC
-       WATCHDOG_RESET ();
-       puts ("MMC:  ");
-       mmc_initialize (bd);
-#endif
-
 #if defined(CONFIG_CMD_DOC)
        WATCHDOG_RESET ();
        puts ("DOC:   ");