]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - lib_ppc/board.c
* Patches by Pantelis Antoniou, 30 Mar 2004:
[people/ms/u-boot.git] / lib_ppc / board.c
index a6305339aeabf913aed0b9562d44293aca8ad0fe..998c25cc9ff30d89c27fe12a3833bf4458398ea2 100644 (file)
@@ -32,7 +32,7 @@
 #ifdef CONFIG_5xx
 #include <mpc5xx.h>
 #endif
-#ifdef CONFIG_MPC5XXX
+#ifdef CONFIG_MPC5xxx
 #include <mpc5xxx.h>
 #endif
 #if (CONFIG_COMMANDS & CFG_CMD_IDE)
@@ -84,15 +84,17 @@ void nand_init (void);
 
 static char *failed = "*** failed ***\n";
 
-#if defined(CONFIG_PCU_E) || defined(CONFIG_OXC)
+#if defined(CONFIG_OXC) || defined(CONFIG_PCU_E) || defined(CONFIG_RMU)
 extern flash_info_t flash_info[];
 #endif
 
 #include <environment.h>
 
-#if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \
-      (CFG_ENV_ADDR >= (CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \
-    defined(CFG_ENV_IS_IN_NVRAM)
+#if defined(CFG_ENV_IS_EMBEDDED)
+#define TOTAL_MALLOC_LEN       CFG_MALLOC_LEN
+#elif ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \
+       (CFG_ENV_ADDR >= (CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \
+      defined(CFG_ENV_IS_IN_NVRAM)
 #define        TOTAL_MALLOC_LEN        (CFG_MALLOC_LEN + CFG_ENV_SIZE)
 #else
 #define        TOTAL_MALLOC_LEN        CFG_MALLOC_LEN
@@ -288,9 +290,9 @@ init_fnc_t *init_sequence[] = {
        prt_8260_clks,
 #endif /* CONFIG_8260 */
        checkcpu,
-#if defined(CONFIG_MPC5XXX)
+#if defined(CONFIG_MPC5xxx)
        prt_mpc5xxx_clks,
-#endif /* CONFIG_MPC5XXX */
+#endif /* CONFIG_MPC5xxx */
        checkboard,
        INIT_FUNC_WATCHDOG_INIT
 #if defined(CONFIG_MISC_INIT_F)
@@ -478,7 +480,7 @@ void board_init_f (ulong bootflag)
     defined(CONFIG_E500)
        bd->bi_immr_base = CFG_IMMR;    /* base  of IMMR register     */
 #endif
-#if defined(CONFIG_MPC5XXX)
+#if defined(CONFIG_MPC5xxx)
        bd->bi_mbar_base = CFG_MBAR;    /* base of internal registers */
 #endif
 
@@ -493,10 +495,10 @@ void board_init_f (ulong bootflag)
        bd->bi_sccfreq = gd->scc_clk;
        bd->bi_vco     = gd->vco_out;
 #endif /* CONFIG_8260 */
-#if defined(CONFIG_MPC5XXX)
+#if defined(CONFIG_MPC5xxx)
        bd->bi_ipbfreq = gd->ipb_clk;
        bd->bi_pcifreq = gd->pci_clk;
-#endif /* CONFIG_MPC5XXX */
+#endif /* CONFIG_MPC5xxx */
        bd->bi_baudrate = gd->baudrate; /* Console Baudrate     */
 
 #ifdef CFG_EXTBDINFO
@@ -507,14 +509,28 @@ void board_init_f (ulong bootflag)
        bd->bi_plb_busfreq = gd->bus_clk;
 #if defined(CONFIG_405GP) || defined(CONFIG_405EP)
        bd->bi_pci_busfreq = get_PCI_freq ();
+       bd->bi_opbfreq = get_OPB_freq ();
 
-#ifdef CFG_OPB_FREQ
-       bd->bi_opbfreq = CFG_OPB_FREQ;
+#if defined(CONFIG_I2CFAST)
+       /*
+        * set bi_iic_fast for linux taking environment variable
+        * "i2cfast" into account
+        */
+       {
+               char *s = getenv ("i2cfast");
+               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_opbfreq = 50000000;
-#endif
        bd->bi_iic_fast[0] = 0;
        bd->bi_iic_fast[1] = 0;
+#endif
+
 #elif defined(CONFIG_XILINX_ML300)
        bd->bi_pci_busfreq = get_PCI_freq ();
 #endif
@@ -670,10 +686,8 @@ void board_init_r (gd_t *id, ulong dest_addr)
                s = getenv ("flashchecksum");
                if (s && (*s == 'y')) {
                        printf ("  CRC: %08lX",
-                                       crc32 (0,
-                                                  (const unsigned char *) CFG_FLASH_BASE,
-                                                  flash_size)
-                                       );
+                               crc32 (0, (const unsigned char *) CFG_FLASH_BASE, flash_size)
+                       );
                }
                putc ('\n');
 # else /* !CFG_FLASH_CHECKSUM */
@@ -686,8 +700,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        bd->bi_flashstart = CFG_FLASH_BASE;     /* update start of FLASH memory    */
        bd->bi_flashsize = flash_size;  /* size of FLASH memory (final value) */
-# if defined(CONFIG_PCU_E) || defined(CONFIG_OXC)
-       bd->bi_flashoffset = 0;
+# if defined(CONFIG_PCU_E) || defined(CONFIG_OXC) || defined(CONFIG_RMU)
+       /* flash mapped at end of memory map */
+       bd->bi_flashoffset = TEXT_BASE + flash_size;
 # elif CFG_MONITOR_BASE == CFG_FLASH_BASE
        bd->bi_flashoffset = monitor_flash_len; /* reserved area for startup monitor  */
 # else
@@ -825,6 +840,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
     defined(CONFIG_CPCI405)    || \
     defined(CONFIG_EVB64260)   || \
     defined(CONFIG_KUP4K)      || \
+    defined(CONFIG_KUP4X)      || \
     defined(CONFIG_LWMON)      || \
     defined(CONFIG_PCU_E)      || \
     defined(CONFIG_W7O)                || \
@@ -886,8 +902,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        set_timer (0);
 
-       /* Insert function pointers now that we have relocated the code */
-
        /* Initialize from environment */
        if ((s = getenv ("loadaddr")) != NULL) {
                load_addr = simple_strtoul (s, NULL, 16);