ppc/85xx: Don't enable interrupts before we're ready
[oweals/u-boot.git] / cpu / mpc5xx / cpu.c
index cc695118e043a4c4aff42d0657940037e37928fc..7fffebcc1e552d16c9d3da573b697b2063bb6932 100644 (file)
@@ -34,6 +34,7 @@
 #include <command.h>
 #include <mpc5xx.h>
 
+DECLARE_GLOBAL_DATA_PTR;
 
 #if (defined(CONFIG_MPC555))
 #  define      ID_STR  "MPC555/556"
@@ -62,8 +63,6 @@ static int check_cpu_version (long clock, uint pvr, uint immr)
  */
 int checkcpu (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        ulong clock = gd->cpu_clk;
        uint immr = get_immr (0);       /* Return full IMMR contents */
        uint pvr = get_pvr ();          /* Retrieve PVR register */
@@ -81,7 +80,7 @@ void watchdog_reset (void)
 {
        int re_enable = disable_interrupts ();
 
-       reset_5xx_watchdog ((immap_t *) CFG_IMMR);
+       reset_5xx_watchdog ((immap_t *) CONFIG_SYS_IMMR);
        if (re_enable)
                enable_interrupts ();
 }
@@ -104,15 +103,14 @@ void reset_5xx_watchdog (volatile immap_t * immr)
  */
 unsigned long get_tbclk (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-       volatile immap_t *immr = (volatile immap_t *) CFG_IMMR;
+       volatile immap_t *immr = (volatile immap_t *) CONFIG_SYS_IMMR;
        ulong oscclk, factor;
 
        if (immr->im_clkrst.car_sccr & SCCR_TBS) {
                return (gd->cpu_clk / 16);
        }
 
-       factor = (((CFG_PLPRCR) & PLPRCR_MF_MSK) >> PLPRCR_MF_SHIFT) + 1;
+       factor = (((CONFIG_SYS_PLPRCR) & PLPRCR_MF_MSK) >> PLPRCR_MF_SHIFT) + 1;
 
        oscclk = gd->cpu_clk / factor;
 
@@ -122,12 +120,30 @@ unsigned long get_tbclk (void)
        return (oscclk / 16);
 }
 
+void dcache_enable (void)
+{
+       return;
+}
+
+void dcache_disable (void)
+{
+       return;
+}
+
+int dcache_status (void)
+{
+       return 0;       /* always off */
+}
 
 /*
  * Reset board
  */
 int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 {
+#if defined(CONFIG_PATI)
+       volatile ulong *addr = (ulong *) CONFIG_SYS_RESET_ADDRESS;
+       *addr = 1;
+#else
        ulong addr;
 
        /* Interrupts off, enable reset */
@@ -139,16 +155,17 @@ int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
         * Trying to execute the next instruction at a non-existing address
         * should cause a machine check, resulting in reset
         */
-#ifdef CFG_RESET_ADDRESS
-       addr = CFG_RESET_ADDRESS;
+#ifdef CONFIG_SYS_RESET_ADDRESS
+       addr = CONFIG_SYS_RESET_ADDRESS;
 #else
        /*
-        * note: when CFG_MONITOR_BASE points to a RAM address, CFG_MONITOR_BASE         * - sizeof (ulong) is usually a valid address. Better pick an address
-        * known to be invalid on your system and assign it to CFG_RESET_ADDRESS.
+        * note: when CONFIG_SYS_MONITOR_BASE points to a RAM address, CONFIG_SYS_MONITOR_BASE         * - sizeof (ulong) is usually a valid address. Better pick an address
+        * known to be invalid on your system and assign it to CONFIG_SYS_RESET_ADDRESS.
         * "(ulong)-1" used to be a good choice for many systems...
         */
-       addr = CFG_MONITOR_BASE - sizeof (ulong);
+       addr = CONFIG_SYS_MONITOR_BASE - sizeof (ulong);
 #endif
        ((void (*) (void)) addr) ();
+#endif  /* #if defined(CONFIG_PATI) */
        return 1;
 }