diff options
author | Greg Ungerer <gerg@uclinux.org> | 2012-02-19 01:16:58 -0500 |
---|---|---|
committer | Greg Ungerer <gerg@uclinux.org> | 2012-03-04 19:41:48 -0500 |
commit | d894b89bf74322845f776bde4d72b70b58926886 (patch) | |
tree | 1ea0c9dc4a70ebc46fe3eda896b39143856b98d9 /arch/m68k/platform | |
parent | 440f6ffc061a84e81386a093c07af8a429c18702 (diff) |
m68knommu: factor some common ColdFire cpu reset code
A number of the early ColdFire cores use the same code to reset the CPU.
Currently that is duplicated in each of the sub-arch files. Pull out this
common code and use a single copy of it for all CPU types that use it.
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/m68k/platform')
-rw-r--r-- | arch/m68k/platform/5206/config.c | 12 | ||||
-rw-r--r-- | arch/m68k/platform/5249/config.c | 13 | ||||
-rw-r--r-- | arch/m68k/platform/5307/config.c | 12 | ||||
-rw-r--r-- | arch/m68k/platform/5407/config.c | 12 | ||||
-rw-r--r-- | arch/m68k/platform/coldfire/Makefile | 10 | ||||
-rw-r--r-- | arch/m68k/platform/coldfire/reset.c | 33 |
6 files changed, 39 insertions, 53 deletions
diff --git a/arch/m68k/platform/5206/config.c b/arch/m68k/platform/5206/config.c index c81dd51ff758..6bfbeebd231b 100644 --- a/arch/m68k/platform/5206/config.c +++ b/arch/m68k/platform/5206/config.c | |||
@@ -19,17 +19,6 @@ | |||
19 | 19 | ||
20 | /***************************************************************************/ | 20 | /***************************************************************************/ |
21 | 21 | ||
22 | void m5206_cpu_reset(void) | ||
23 | { | ||
24 | local_irq_disable(); | ||
25 | /* Set watchdog to soft reset, and enabled */ | ||
26 | __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); | ||
27 | for (;;) | ||
28 | /* wait for watchdog to timeout */; | ||
29 | } | ||
30 | |||
31 | /***************************************************************************/ | ||
32 | |||
33 | void __init config_BSP(char *commandp, int size) | 22 | void __init config_BSP(char *commandp, int size) |
34 | { | 23 | { |
35 | #if defined(CONFIG_NETtel) | 24 | #if defined(CONFIG_NETtel) |
@@ -38,7 +27,6 @@ void __init config_BSP(char *commandp, int size) | |||
38 | commandp[size-1] = 0; | 27 | commandp[size-1] = 0; |
39 | #endif /* CONFIG_NETtel */ | 28 | #endif /* CONFIG_NETtel */ |
40 | 29 | ||
41 | mach_reset = m5206_cpu_reset; | ||
42 | mach_sched_init = hw_timer_init; | 30 | mach_sched_init = hw_timer_init; |
43 | 31 | ||
44 | /* Only support the external interrupts on their primary level */ | 32 | /* Only support the external interrupts on their primary level */ |
diff --git a/arch/m68k/platform/5249/config.c b/arch/m68k/platform/5249/config.c index cda273383226..bbf05135bb98 100644 --- a/arch/m68k/platform/5249/config.c +++ b/arch/m68k/platform/5249/config.c | |||
@@ -83,21 +83,10 @@ static void __init m5249_smc91x_init(void) | |||
83 | 83 | ||
84 | /***************************************************************************/ | 84 | /***************************************************************************/ |
85 | 85 | ||
86 | void m5249_cpu_reset(void) | ||
87 | { | ||
88 | local_irq_disable(); | ||
89 | /* Set watchdog to soft reset, and enabled */ | ||
90 | __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); | ||
91 | for (;;) | ||
92 | /* wait for watchdog to timeout */; | ||
93 | } | ||
94 | |||
95 | /***************************************************************************/ | ||
96 | |||
97 | void __init config_BSP(char *commandp, int size) | 86 | void __init config_BSP(char *commandp, int size) |
98 | { | 87 | { |
99 | mach_reset = m5249_cpu_reset; | ||
100 | mach_sched_init = hw_timer_init; | 88 | mach_sched_init = hw_timer_init; |
89 | |||
101 | #ifdef CONFIG_M5249C3 | 90 | #ifdef CONFIG_M5249C3 |
102 | m5249_smc91x_init(); | 91 | m5249_smc91x_init(); |
103 | #endif | 92 | #endif |
diff --git a/arch/m68k/platform/5307/config.c b/arch/m68k/platform/5307/config.c index 5f4bf6cb017f..a568d2870d15 100644 --- a/arch/m68k/platform/5307/config.c +++ b/arch/m68k/platform/5307/config.c | |||
@@ -28,17 +28,6 @@ unsigned char ledbank = 0xff; | |||
28 | 28 | ||
29 | /***************************************************************************/ | 29 | /***************************************************************************/ |
30 | 30 | ||
31 | void m5307_cpu_reset(void) | ||
32 | { | ||
33 | local_irq_disable(); | ||
34 | /* Set watchdog to soft reset, and enabled */ | ||
35 | __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); | ||
36 | for (;;) | ||
37 | /* wait for watchdog to timeout */; | ||
38 | } | ||
39 | |||
40 | /***************************************************************************/ | ||
41 | |||
42 | void __init config_BSP(char *commandp, int size) | 31 | void __init config_BSP(char *commandp, int size) |
43 | { | 32 | { |
44 | #if defined(CONFIG_NETtel) || \ | 33 | #if defined(CONFIG_NETtel) || \ |
@@ -48,7 +37,6 @@ void __init config_BSP(char *commandp, int size) | |||
48 | commandp[size-1] = 0; | 37 | commandp[size-1] = 0; |
49 | #endif | 38 | #endif |
50 | 39 | ||
51 | mach_reset = m5307_cpu_reset; | ||
52 | mach_sched_init = hw_timer_init; | 40 | mach_sched_init = hw_timer_init; |
53 | 41 | ||
54 | /* Only support the external interrupts on their primary level */ | 42 | /* Only support the external interrupts on their primary level */ |
diff --git a/arch/m68k/platform/5407/config.c b/arch/m68k/platform/5407/config.c index 19c612557b98..bb6c746ae819 100644 --- a/arch/m68k/platform/5407/config.c +++ b/arch/m68k/platform/5407/config.c | |||
@@ -19,20 +19,8 @@ | |||
19 | 19 | ||
20 | /***************************************************************************/ | 20 | /***************************************************************************/ |
21 | 21 | ||
22 | void m5407_cpu_reset(void) | ||
23 | { | ||
24 | local_irq_disable(); | ||
25 | /* set watchdog to soft reset, and enabled */ | ||
26 | __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); | ||
27 | for (;;) | ||
28 | /* wait for watchdog to timeout */; | ||
29 | } | ||
30 | |||
31 | /***************************************************************************/ | ||
32 | |||
33 | void __init config_BSP(char *commandp, int size) | 22 | void __init config_BSP(char *commandp, int size) |
34 | { | 23 | { |
35 | mach_reset = m5407_cpu_reset; | ||
36 | mach_sched_init = hw_timer_init; | 24 | mach_sched_init = hw_timer_init; |
37 | 25 | ||
38 | /* Only support the external interrupts on their primary level */ | 26 | /* Only support the external interrupts on their primary level */ |
diff --git a/arch/m68k/platform/coldfire/Makefile b/arch/m68k/platform/coldfire/Makefile index 4572af29b6b7..bccab9331ee1 100644 --- a/arch/m68k/platform/coldfire/Makefile +++ b/arch/m68k/platform/coldfire/Makefile | |||
@@ -15,17 +15,17 @@ | |||
15 | asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1 | 15 | asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1 |
16 | 16 | ||
17 | obj-$(CONFIG_COLDFIRE) += cache.o clk.o device.o dma.o entry.o vectors.o | 17 | obj-$(CONFIG_COLDFIRE) += cache.o clk.o device.o dma.o entry.o vectors.o |
18 | obj-$(CONFIG_M5206) += timers.o intc.o | 18 | obj-$(CONFIG_M5206) += timers.o intc.o reset.o |
19 | obj-$(CONFIG_M5206e) += timers.o intc.o | 19 | obj-$(CONFIG_M5206e) += timers.o intc.o reset.o |
20 | obj-$(CONFIG_M520x) += pit.o intc-simr.o | 20 | obj-$(CONFIG_M520x) += pit.o intc-simr.o |
21 | obj-$(CONFIG_M523x) += pit.o dma_timer.o intc-2.o | 21 | obj-$(CONFIG_M523x) += pit.o dma_timer.o intc-2.o |
22 | obj-$(CONFIG_M5249) += timers.o intc.o | 22 | obj-$(CONFIG_M5249) += timers.o intc.o reset.o |
23 | obj-$(CONFIG_M527x) += pit.o intc-2.o | 23 | obj-$(CONFIG_M527x) += pit.o intc-2.o |
24 | obj-$(CONFIG_M5272) += timers.o | 24 | obj-$(CONFIG_M5272) += timers.o |
25 | obj-$(CONFIG_M528x) += pit.o intc-2.o | 25 | obj-$(CONFIG_M528x) += pit.o intc-2.o |
26 | obj-$(CONFIG_M5307) += timers.o intc.o | 26 | obj-$(CONFIG_M5307) += timers.o intc.o reset.o |
27 | obj-$(CONFIG_M532x) += timers.o intc-simr.o | 27 | obj-$(CONFIG_M532x) += timers.o intc-simr.o |
28 | obj-$(CONFIG_M5407) += timers.o intc.o | 28 | obj-$(CONFIG_M5407) += timers.o intc.o reset.o |
29 | obj-$(CONFIG_M54xx) += sltimers.o intc-2.o | 29 | obj-$(CONFIG_M54xx) += sltimers.o intc-2.o |
30 | 30 | ||
31 | obj-y += pinmux.o gpio.o | 31 | obj-y += pinmux.o gpio.o |
diff --git a/arch/m68k/platform/coldfire/reset.c b/arch/m68k/platform/coldfire/reset.c new file mode 100644 index 000000000000..5ed78d3546d2 --- /dev/null +++ b/arch/m68k/platform/coldfire/reset.c | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * reset.c -- common ColdFire SoC reset support | ||
3 | * | ||
4 | * (C) Copyright 2012, Greg Ungerer <gerg@uclinux.org> | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file COPYING in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/io.h> | ||
14 | #include <asm/machdep.h> | ||
15 | #include <asm/coldfire.h> | ||
16 | #include <asm/mcfsim.h> | ||
17 | |||
18 | void mcf_cpu_reset(void) | ||
19 | { | ||
20 | local_irq_disable(); | ||
21 | /* Set watchdog to soft reset, and enabled */ | ||
22 | __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); | ||
23 | for (;;) | ||
24 | /* wait for watchdog to timeout */; | ||
25 | } | ||
26 | |||
27 | static int __init mcf_setup_reset(void) | ||
28 | { | ||
29 | mach_reset = mcf_cpu_reset; | ||
30 | return 0; | ||
31 | } | ||
32 | |||
33 | arch_initcall(mcf_setup_reset); | ||