Merge branch 'mpc85xx'
[oweals/u-boot.git] / cpu / mpc5xx / cpu.c
index 5b3bd26b433b1a8fb72666468c168b774ac5ffda..4bef90c48ad97755ce644736a31d1054df0baf6f 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, 
+ * Foundation,
  */
 
 /*
  * File:               cpu.c
- * 
- * Discription:                Some cpu specific function for watchdog, 
+ *
+ * Discription:                Some cpu specific function for watchdog,
  *                      cpu version test, clock setting ...
- * 
+ *
  */
 
 
@@ -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 */
@@ -74,7 +73,7 @@ int checkcpu (void)
 }
 
 /*
- * Called by macro WATCHDOG_RESET 
+ * Called by macro WATCHDOG_RESET
  */
 #if defined(CONFIG_WATCHDOG)
 void watchdog_reset (void)
@@ -93,7 +92,7 @@ void reset_5xx_watchdog (volatile immap_t * immr)
 {
        /* Use the MPC5xx Internal Watchdog */
        immr->im_siu_conf.sc_swsr = 0x556c;     /* Prevent SW time-out */
-       immr->im_siu_conf.sc_swsr = 0xaa39;    
+       immr->im_siu_conf.sc_swsr = 0xaa39;
 }
 
 #endif /* CONFIG_WATCHDOG */
@@ -104,7 +103,6 @@ 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;
        ulong oscclk, factor;
 
@@ -122,34 +120,52 @@ 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 
+ * Reset board
  */
 int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 {
+#if defined(CONFIG_PATI)
+       volatile ulong *addr = (ulong *) CFG_RESET_ADDRESS;
+       *addr = 1;
+#else
        ulong addr;
-       
+
        /* Interrupts off, enable reset */
-        __asm__ volatile       ("  mtspr       81, %r0         \n\t"
+       __asm__ volatile        ("  mtspr       81, %r0         \n\t"
                                 "  mfmsr       %r3             \n\t"
                                 "  rlwinm      %r31,%r3,0,25,23\n\t"
                                 "  mtmsr       %r31            \n\t");
-        /*
-         * Trying to execute the next instruction at a non-existing address
-         * should cause a machine check, resulting in reset
-         */
+       /*
+        * 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;
+       addr = CFG_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.
-         * "(ulong)-1" used to be a good choice for many systems...
-         */
-        addr = CFG_MONITOR_BASE - sizeof (ulong);
+       /*
+        * 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.
+        * "(ulong)-1" used to be a good choice for many systems...
+        */
+       addr = CFG_MONITOR_BASE - sizeof (ulong);
 #endif
        ((void (*) (void)) addr) ();
+#endif  /* #if defined(CONFIG_PATI) */
        return 1;
 }
-