From d894b89bf74322845f776bde4d72b70b58926886 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Sun, 19 Feb 2012 16:16:58 +1000 Subject: 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 --- arch/m68k/platform/coldfire/reset.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 arch/m68k/platform/coldfire/reset.c (limited to 'arch/m68k/platform/coldfire/reset.c') 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 @@ +/* + * reset.c -- common ColdFire SoC reset support + * + * (C) Copyright 2012, Greg Ungerer + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + */ + +#include +#include +#include +#include +#include +#include + +void mcf_cpu_reset(void) +{ + local_irq_disable(); + /* Set watchdog to soft reset, and enabled */ + __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); + for (;;) + /* wait for watchdog to timeout */; +} + +static int __init mcf_setup_reset(void) +{ + mach_reset = mcf_cpu_reset; + return 0; +} + +arch_initcall(mcf_setup_reset); -- cgit v1.2.3 From ae909ea4ad2431e085e6cc96446fbc1c1ae88498 Mon Sep 17 00:00:00 2001 From: Greg Ungerer Date: Sun, 19 Feb 2012 16:47:24 +1000 Subject: m68knommu: factor more common ColdFire cpu reset code Most of the more modern ColdFire cores use the same code to reset the CPU (but it is different to most of the earlier cores). Currently that is duplicated in each of the sub-arch files. Pull out this common code and out a single copy of it with the other common reset code. Signed-off-by: Greg Ungerer --- arch/m68k/platform/coldfire/reset.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'arch/m68k/platform/coldfire/reset.c') diff --git a/arch/m68k/platform/coldfire/reset.c b/arch/m68k/platform/coldfire/reset.c index 5ed78d3546d2..933e54eacc69 100644 --- a/arch/m68k/platform/coldfire/reset.c +++ b/arch/m68k/platform/coldfire/reset.c @@ -15,7 +15,15 @@ #include #include -void mcf_cpu_reset(void) +/* + * There are 2 common methods amongst the ColdFure parts for reseting + * the CPU. But there are couple of exceptions, the 5272 and the 547x + * have something completely special to them, and we let their specific + * subarch code handle them. + */ + +#ifdef MCFSIM_SYPCR +static void mcf_cpu_reset(void) { local_irq_disable(); /* Set watchdog to soft reset, and enabled */ @@ -23,6 +31,15 @@ void mcf_cpu_reset(void) for (;;) /* wait for watchdog to timeout */; } +#endif + +#ifdef MCF_RCR +static void mcf_cpu_reset(void) +{ + local_irq_disable(); + __raw_writeb(MCF_RCR_SWRESET, MCF_RCR); +} +#endif static int __init mcf_setup_reset(void) { -- cgit v1.2.3