Add support for IDS "NC650" board
[oweals/u-boot.git] / lib_ppc / board.c
index ae0ecb29ebf1f54b91f35ea6bcf79f3b2e002633..419c12da433c4fc0ead8df6e2a7f7f66749617b5 100644 (file)
@@ -48,6 +48,7 @@
 #include <status_led.h>
 #endif
 #include <net.h>
+#include <serial.h>
 #ifdef CFG_ALLOC_DPRAM
 #if !(defined(CONFIG_8260)||defined(CONFIG_MPC8560))
 #include <commproc.h>
@@ -84,14 +85,16 @@ void nand_init (void);
 
 static char *failed = "*** failed ***\n";
 
+#if defined(CONFIG_OXC) || defined(CONFIG_PCU_E) || defined(CONFIG_RMU)
 extern flash_info_t flash_info[];
+#endif
 
 #include <environment.h>
 
 #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)) ) || \
+       (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
@@ -261,8 +264,11 @@ init_fnc_t *init_sequence[] = {
        board_early_init_f,
 #endif
 
-#if !defined(CONFIG_TQM866M)
+#if !defined(CONFIG_TQM866M) && !defined(CONFIG_NC650)
        get_clocks,             /* get CPU and bus clocks (etc.) */
+#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M)
+       adjust_sdram_tbs_8xx,
+#endif
        init_timebase,
 #endif
 #ifdef CFG_ALLOC_DPRAM
@@ -274,7 +280,7 @@ init_fnc_t *init_sequence[] = {
        board_postclk_init,
 #endif
        env_init,
-#if defined(CONFIG_TQM866M)
+#if defined(CONFIG_TQM866M) || defined(CONFIG_NC650)
        get_clocks_866,         /* get CPU and bus clocks according to the environment variable */
        sdram_adjust_866,       /* adjust sdram refresh rate according to the new clock */
        init_timebase,
@@ -348,6 +354,8 @@ void board_init_f (ulong bootflag)
 
        /* Pointer is writable since we allocated a register for it */
        gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
+       /* compiler optimization barrier needed for GCC >= 3.4 */
+       __asm__ __volatile__("": : :"memory");
 
 #if !(defined(CONFIG_8260) || defined(CONFIG_MPC8560))
        /* Clear initial global data */
@@ -508,27 +516,6 @@ void board_init_f (ulong bootflag)
 #if defined(CONFIG_405GP) || defined(CONFIG_405EP)
        bd->bi_pci_busfreq = get_PCI_freq ();
        bd->bi_opbfreq = get_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_iic_fast[0] = 0;
-       bd->bi_iic_fast[1] = 0;
-#endif
-
 #elif defined(CONFIG_XILINX_ML300)
        bd->bi_pci_busfreq = get_PCI_freq ();
 #endif
@@ -596,6 +583,10 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        monitor_flash_len = (ulong)&__init_end - dest_addr;
 
+#ifdef CONFIG_SERIAL_MULTI
+       serial_initialize();
+#endif
+
        /*
         * We have to relocate the command table manually
         */
@@ -741,6 +732,31 @@ void board_init_r (gd_t *id, ulong dest_addr)
         * where had to use getenv_r(), which can be pretty slow when
         * the environment is in EEPROM.
         */
+
+#if defined(CFG_EXTBDINFO)
+#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
+#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_iic_fast[0] = 0;
+       bd->bi_iic_fast[1] = 0;
+#endif /* CONFIG_I2CFAST */
+#endif /* CONFIG_405GP, CONFIG_405EP */
+#endif /* CFG_EXTBDINFO */
+
        s = getenv ("ethaddr");
 #if defined (CONFIG_MBX) || defined (CONFIG_RPXCLASSIC) || defined(CONFIG_IAD210)
        if (s == NULL)
@@ -764,7 +780,8 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
 
 #if defined(CFG_GT_6426x) || defined(CONFIG_PN62) || defined(CONFIG_PPCHAMELEONEVB) || \
-    defined(CONFIG_MPC8540ADS) || defined(CONFIG_MPC8560ADS) || defined(CONFIG_440_GX)
+    defined(CONFIG_MPC8540ADS) || defined(CONFIG_MPC8555CDS) || \
+    defined(CONFIG_MPC8560ADS) || defined(CONFIG_440_GX)
        /* handle the 2nd ethernet address */
 
        s = getenv ("eth1addr");
@@ -775,8 +792,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
                        s = (*e) ? e + 1 : e;
        }
 #endif
-#if defined(CFG_GT_6426x) || defined(CONFIG_MPC8540ADS) || defined(CONFIG_MPC8560ADS) || \
-       defined(CONFIG_440_GX)
+#if defined(CFG_GT_6426x) || defined(CONFIG_MPC8540ADS) || \
+    defined(CONFIG_MPC8555CDS) || defined(CONFIG_MPC8560ADS) || \
+    defined(CONFIG_440_GX)
        /* handle the 3rd ethernet address */
 
        s = getenv ("eth2addr");
@@ -808,7 +826,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
 
 #if defined(CONFIG_TQM8xxL) || defined(CONFIG_TQM8260) || \
-    defined(CONFIG_CCM)
+    defined(CONFIG_CCM) || defined(CONFIG_KUP4K) || defined(CONFIG_KUP4X)
        load_sernum_ethaddr ();
 #endif
        /* IP Address */
@@ -816,7 +834,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        WATCHDOG_RESET ();
 
-#if defined(CONFIG_PCI) && !defined(CONFIG_BAB7xx)
+#if defined(CONFIG_PCI) && !defined(CONFIG_BAB7xx) && !defined(CONFIG_CPC45)
        /*
         * Do pci configuration
         */
@@ -859,12 +877,12 @@ void board_init_r (gd_t *id, ulong dest_addr)
     defined(CONFIG_IP860)      || \
     defined(CONFIG_IVML24)     || \
     defined(CONFIG_IVMS8)      || \
-    defined(CONFIG_LWMON)      || \
     defined(CONFIG_MPC8260ADS) || \
     defined(CONFIG_MPC8266ADS) || \
     defined(CONFIG_MPC8560ADS) || \
     defined(CONFIG_PCU_E)      || \
     defined(CONFIG_RPXSUPER)   || \
+    defined(CONFIG_STXGP3)     || \
     defined(CONFIG_SPD823TS)   )
 
        WATCHDOG_RESET ();