fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / asm-m68knommu / system.h
index e12f9eb..2a81449 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef _M68KNOMMU_SYSTEM_H
 #define _M68KNOMMU_SYSTEM_H
 
-#include <linux/config.h> /* get configuration macros */
 #include <linux/linkage.h>
 #include <asm/segment.h>
 #include <asm/entry.h>
@@ -57,9 +56,18 @@ asmlinkage void resume(void);
         : "cc", "%d0", "memory")
 #define local_irq_disable() __asm__ __volatile__ (             \
        "move %/sr,%%d0\n\t"                                    \
-       "ori.l  #0x0700,%%d0\n\t"                               \
+       "ori.l #0x0700,%%d0\n\t"                                \
        "move %%d0,%/sr\n"                                      \
-       : /* no inputs */                                       \
+       : /* no outputs */                                      \
+       :                                                       \
+       : "cc", "%d0", "memory")
+/* For spinlocks etc */
+#define local_irq_save(x) __asm__ __volatile__ (               \
+       "movew %%sr,%0\n\t"                                     \
+       "movew #0x0700,%%d0\n\t"                                \
+       "or.l  %0,%%d0\n\t"                                     \
+       "movew %%d0,%/sr"                                       \
+       : "=d" (x)                                              \
        :                                                       \
        : "cc", "%d0", "memory")
 #else
@@ -75,7 +83,9 @@ asmlinkage void resume(void);
 #define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory")
 
 /* For spinlocks etc */
+#ifndef local_irq_save
 #define local_irq_save(x) do { local_save_flags(x); local_irq_disable(); } while (0)
+#endif
 
 #define        irqs_disabled()                 \
 ({                                     \
@@ -96,7 +106,6 @@ asmlinkage void resume(void);
 #define wmb()  asm volatile (""   : : :"memory")
 #define set_rmb(var, value)    do { xchg(&var, value); } while (0)
 #define set_mb(var, value)     set_rmb(var, value)
-#define set_wmb(var, value)    do { var = value; wmb(); } while (0)
 
 #ifdef CONFIG_SMP
 #define smp_mb()       mb()
@@ -234,9 +243,9 @@ cmpxchg(volatile int *p, int old, int new)
 #ifdef CONFIG_COLDFIRE
 #if defined(CONFIG_M5272) && defined(CONFIG_NETtel)
 /*
- *     Need to account for broken early mask of 5272 silicon. So don't
- *     jump through the original start address. Jump strait into the
- *     known start of the FLASH code.
+ * Need to account for broken early mask of 5272 silicon. So don't
+ * jump through the original start address. Jump strait into the
+ * known start of the FLASH code.
  */
 #define HARD_RESET_NOW() ({            \
         asm("                          \
@@ -244,7 +253,9 @@ cmpxchg(volatile int *p, int old, int new)
         jmp 0xf0000400;                        \
         ");                            \
 })
-#elif defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || defined(CONFIG_CLEOPATRA)
+#elif defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \
+      defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || \
+      defined(CONFIG_CLEOPATRA)
 #define HARD_RESET_NOW() ({            \
         asm("                          \
        movew #0x2700, %sr;             \
@@ -257,6 +268,61 @@ cmpxchg(volatile int *p, int old, int new)
         jmp (%a0);                     \
         ");                            \
 })
+#elif defined(CONFIG_M5272)
+/*
+ * Retrieve the boot address in flash using CSBR0 and CSOR0
+ * find the reset vector at flash_address + 4 (e.g. 0x400)
+ * remap it in the flash's current location (e.g. 0xf0000400)
+ * and jump there.
+ */ 
+#define HARD_RESET_NOW() ({            \
+       asm("                           \
+       movew #0x2700, %%sr;            \
+       move.l  %0+0x40,%%d0;           \
+       and.l   %0+0x44,%%d0;           \
+       andi.l  #0xfffff000,%%d0;       \
+       mov.l   %%d0,%%a0;              \
+       or.l    4(%%a0),%%d0;           \
+       mov.l   %%d0,%%a0;              \
+       jmp (%%a0);"                    \
+       : /* No output */               \
+       : "o" (*(char *)MCF_MBAR) );    \
+})
+#elif defined(CONFIG_M528x)
+/*
+ * The MCF528x has a bit (SOFTRST) in memory (Reset Control Register RCR),
+ * that when set, resets the MCF528x.
+ */
+#define HARD_RESET_NOW() \
+({                                             \
+       unsigned char volatile *reset;          \
+       asm("move.w     #0x2700, %sr");         \
+       reset = ((volatile unsigned short *)(MCF_IPSBAR + 0x110000));   \
+       while(1)                                \
+       *reset |= (0x01 << 7);\
+})
+#elif defined(CONFIG_M523x)
+#define HARD_RESET_NOW() ({            \
+       asm("                           \
+       movew #0x2700, %sr;             \
+       movel #0x01000000, %sp;         \
+       moveal #0x40110000, %a0;        \
+       moveb #0x80, (%a0);             \
+       ");                             \
+})
+#elif defined(CONFIG_M520x)
+       /*
+        * The MCF5208 has a bit (SOFTRST) in memory (Reset Control Register 
+        * RCR), that when set, resets the MCF5208.
+        */
+#define HARD_RESET_NOW()               \
+({                                     \
+       unsigned char volatile *reset;  \
+       asm("move.w     #0x2700, %sr"); \
+       reset = ((volatile unsigned short *)(MCF_IPSBAR + 0xA0000));    \
+       while(1)                        \
+               *reset |= 0x80;         \
+})
 #else
 #define HARD_RESET_NOW() ({            \
         asm("                          \
@@ -268,5 +334,6 @@ cmpxchg(volatile int *p, int old, int new)
 })
 #endif
 #endif
+#define arch_align_stack(x) (x)
 
 #endif /* _M68KNOMMU_SYSTEM_H */