Commit 9c2aba48 authored by Greg Ungerer's avatar Greg Ungerer Committed by Linus Torvalds

[PATCH] m68knommu: optimized local_irq_disable, and platform reboot code

Switch to a space optimized version of local_irq_disable() for ColdFire
platforms. Also add reboot support for the Freescale M5272 platform.
Patch originally submitted by Philippe De Muyter <phdm@macqel.be>.

Add reboot support for the Freescale M523x ColdFire platform. Patch originally
submitted by Jate Sujjavanich.
Signed-off-by: default avatarGreg Ungerer <gerg@uclinux.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9f575747
...@@ -59,7 +59,16 @@ asmlinkage void resume(void); ...@@ -59,7 +59,16 @@ asmlinkage void resume(void);
"move %/sr,%%d0\n\t" \ "move %/sr,%%d0\n\t" \
"ori.l #0x0700,%%d0\n\t" \ "ori.l #0x0700,%%d0\n\t" \
"move %%d0,%/sr\n" \ "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") : "cc", "%d0", "memory")
#else #else
...@@ -75,7 +84,9 @@ asmlinkage void resume(void); ...@@ -75,7 +84,9 @@ asmlinkage void resume(void);
#define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory") #define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory")
/* For spinlocks etc */ /* For spinlocks etc */
#ifndef local_irq_save
#define local_irq_save(x) do { local_save_flags(x); local_irq_disable(); } while (0) #define local_irq_save(x) do { local_save_flags(x); local_irq_disable(); } while (0)
#endif
#define irqs_disabled() \ #define irqs_disabled() \
({ \ ({ \
...@@ -244,7 +255,9 @@ cmpxchg(volatile int *p, int old, int new) ...@@ -244,7 +255,9 @@ cmpxchg(volatile int *p, int old, int new)
jmp 0xf0000400; \ 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() ({ \ #define HARD_RESET_NOW() ({ \
asm(" \ asm(" \
movew #0x2700, %sr; \ movew #0x2700, %sr; \
...@@ -257,6 +270,26 @@ cmpxchg(volatile int *p, int old, int new) ...@@ -257,6 +270,26 @@ cmpxchg(volatile int *p, int old, int new)
jmp (%a0); \ 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) #elif defined(CONFIG_M528x)
/* /*
* The MCF528x has a bit (SOFTRST) in memory (Reset Control Register RCR), * The MCF528x has a bit (SOFTRST) in memory (Reset Control Register RCR),
...@@ -270,6 +303,15 @@ cmpxchg(volatile int *p, int old, int new) ...@@ -270,6 +303,15 @@ cmpxchg(volatile int *p, int old, int new)
while(1) \ while(1) \
*reset |= (0x01 << 7);\ *reset |= (0x01 << 7);\
}) })
#elif defined(CONFIG_M523x)
#define HARD_RESET_NOW() ({ \
asm(" \
movew #0x2700, %sr; \
movel #0x01000000, %sp; \
moveal #0x40110000, %a0; \
moveb #0x80, (%a0); \
"); \
})
#else #else
#define HARD_RESET_NOW() ({ \ #define HARD_RESET_NOW() ({ \
asm(" \ asm(" \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment