linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/51] Remove inline arch_reset definitions from system.h
@ 2011-10-28 14:43 Will Deacon
  2011-10-28 14:43 ` [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer Will Deacon
                   ` (51 more replies)
  0 siblings, 52 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

Well, looks like I finally made it and I reckon I've managed to preserve
my sanity.

This patch series removes the inline arch_reset definitions from the
mach/system.h files, which is currently a blocker for the single zImage
work. Nicolas has some patches doing a similar thing for arch_idle. In
cases where a new file has been introduced and it looks like arch_idle
could co-exist in there, I've named the new file system.c but it will
mean that Nicolas will need to rebase his stuff on top of this.

I think I've compile-tested this whenever I could identify the right
defconfig, but my brain stopped working about 25% of the way through.

Thanks to Paul Walmsley for saving me from the OMAP changes.

Comments / suggestions / fixups welcome.

Will

Cc: Nicolas Pitre <nicolas.pitre@linaro.org>


Paul Walmsley (1):
  ARM: OMAP: convert reset to use arm_arch_reset

Will Deacon (50):
  ARM: reset: introduce arm_arch_reset function pointer
  ARM: mach-at91: use arm_arch_reset instead of arch_reset
  ARM: bcmring: use arm_arch_reset instead of arch_reset
  ARM: mach-clps711x: use arm_arch_reset instead of arch_reset
  ARM: cns3xxx: use arm_arch_reset instead of arch_reset
  ARM: mach-davinci: use arm_arch_reset instead of arch_reset
  ARM: mach-dove: use arm_arch_reset instead of arch_reset
  ARM: mach-ebsa110: use arm_arch_reset instead of arch_reset
  ARM: mach-ep93xx: use arm_arch_reset instead of arch_reset
  ARM: mach-footbridge: use arm_arch_reset instead of arch_reset
  ARM: mach-gemini: use arm_arch_reset instead of arch_reset
  ARM: mach-h720x: use arm_arch_reset instead of arch_reset
  ARM: mach-integrator: use arm_arch_reset instead of arch_reset
  ARM: mach-iop13xx: use arm_arch_reset instead of arch_reset
  ARM: mach-iop32x: use arm_arch_reset instead of arch_reset
  ARM: mach-iop33x: use arm_arch_reset instead of arch_reset
  ARM: mach-ixp2000: use arm_arch_reset instead of arch_reset
  ARM: mach-ixp23xx: use arm_arch_reset instead of arch_reset
  ARM: mach-ixp4xx: use arm_arch_reset instead of arch_reset
  ARM: mach-kirkwood: use arm_arch_reset instead of arch_reset
  ARM: mach-ks8695: use arm_arch_reset instead of arch_reset
  ARM: mach-lpc32xx: use arm_arch_reset instead of arch_reset
  ARM: mach-mmp: use arm_arch_reset instead of arch_reset
  ARM: mach-mv78xx0: use arm_arch_reset instead of arch_reset
  ARM: mach-msm: use arm_arch_reset instead of arch_reset
  ARM: mach-mxs: use arm_arch_reset instead of arch_reset
  ARM: mach-netx: use arm_arch_reset instead of arch_reset
  ARM: mach-nomadik: use arm_arch_reset instead of arch_reset
  ARM: mach-nuc93x: use arm_arch_reset instead of arch_reset
  ARM: mach-orion5x: use arm_arch_reset instead of arch_reset
  ARM: mach-pnx4008: use arm_arch_reset instead of arch_reset
  ARM: mach-prima2: use arm_arch_reset instead of arch_reset
  ARM: mach-pxa: use arm_arch_reset instead of arch_reset
  ARM: mach-realview: use arm_arch_reset instead of arch_reset
  ARM: mach-rpc: use arm_arch_reset instead of arch_reset
  ARM: mach-s3c64xx: use arm_arch_reset instead of arch_reset
  ARM: mach-sa1100: use arm_arch_reset instead of arch_reset
  ARM: mach-shark: use arm_arch_reset instead of arch_reset
  ARM: mach-shmobile: use arm_arch_reset instead of arch_reset
  ARM: mach-tegra: use arm_arch_reset instead of arch_reset
  ARM: mach-u300: use arm_arch_reset instead of arch_reset
  ARM: mach-versatile: use arm_arch_reset instead of arch_reset
  ARM: mach-vt8500: use arm_arch_reset instead of arch_reset
  ARM: mach-w90x900: use arm_arch_reset instead of arch_reset
  ARM: plat-spear: use arm_arch_reset instead of arch_reset
  ARM: plat-tcc: use arm_arch_reset instead of arch_reset
  ARM: plat-s5p: use arm_arch_reset instead of arch_reset
  ARM: plat-mxc: use arm_arch_reset instead of arch_reset
  ARM: plat-s3c24xx: use arm_arch_reset instead of arch_reset
  ARM: reset: remove empty arch_reset definitions

 arch/arm/include/asm/system.h                      |    1 +
 arch/arm/kernel/process.c                          |    6 ++-
 arch/arm/mach-at91/at91cap9.c                      |    5 +-
 arch/arm/mach-at91/at91rm9200.c                    |    5 +-
 arch/arm/mach-at91/at91sam9260.c                   |    3 +-
 arch/arm/mach-at91/at91sam9261.c                   |    3 +-
 arch/arm/mach-at91/at91sam9263.c                   |    3 +-
 arch/arm/mach-at91/at91sam9g45.c                   |    5 +-
 arch/arm/mach-at91/at91sam9rl.c                    |    3 +-
 arch/arm/mach-at91/generic.h                       |    3 +-
 arch/arm/mach-at91/include/mach/system.h           |    9 ---
 arch/arm/mach-bcmring/arch.c                       |   27 +++++++-
 arch/arm/mach-bcmring/include/mach/system.h        |   24 -------
 arch/arm/mach-clps711x/Makefile                    |    2 +-
 arch/arm/mach-clps711x/include/mach/system.h       |    5 --
 arch/arm/mach-clps711x/system.c                    |   23 +++++++
 arch/arm/mach-cns3xxx/cns3420vb.c                  |    3 +
 arch/arm/mach-cns3xxx/include/mach/system.h        |    2 -
 arch/arm/mach-cns3xxx/pm.c                         |    2 +-
 arch/arm/mach-davinci/common.c                     |    8 ++
 arch/arm/mach-davinci/include/mach/system.h        |    6 --
 arch/arm/mach-dove/common.c                        |   18 +++++
 arch/arm/mach-dove/include/mach/system.h           |   17 -----
 arch/arm/mach-ebsa110/core.c                       |    6 ++
 arch/arm/mach-ebsa110/include/mach/system.h        |    2 -
 arch/arm/mach-ep93xx/core.c                        |   22 ++++++
 arch/arm/mach-ep93xx/include/mach/system.h         |   14 ----
 arch/arm/mach-exynos4/include/mach/system.h        |    2 -
 arch/arm/mach-footbridge/Makefile                  |    2 +-
 arch/arm/mach-footbridge/include/mach/system.h     |   50 --------------
 arch/arm/mach-footbridge/reset.c                   |   69 ++++++++++++++++++++
 arch/arm/mach-gemini/Makefile                      |    2 +-
 arch/arm/mach-gemini/include/mach/system.h         |    6 --
 arch/arm/mach-gemini/system.c                      |   22 ++++++
 arch/arm/mach-h720x/common.c                       |   12 ++++
 arch/arm/mach-h720x/include/mach/system.h          |    6 --
 arch/arm/mach-integrator/core.c                    |   11 +++
 arch/arm/mach-integrator/include/mach/system.h     |    9 ---
 arch/arm/mach-iop13xx/include/mach/system.h        |   13 ----
 arch/arm/mach-iop13xx/setup.c                      |   14 ++++
 arch/arm/mach-iop32x/Makefile                      |    2 +-
 arch/arm/mach-iop32x/include/mach/system.h         |   17 -----
 arch/arm/mach-iop32x/reset.c                       |   33 +++++++++
 arch/arm/mach-iop33x/Makefile                      |    2 +-
 arch/arm/mach-iop33x/include/mach/system.h         |    8 --
 arch/arm/mach-iop33x/reset.c                       |   24 +++++++
 arch/arm/mach-ixp2000/core.c                       |   38 +++++++++++
 arch/arm/mach-ixp2000/include/mach/system.h        |   34 ----------
 arch/arm/mach-ixp23xx/core.c                       |   15 ++++
 arch/arm/mach-ixp23xx/include/mach/system.h        |   16 -----
 arch/arm/mach-ixp4xx/common.c                      |   22 ++++++
 arch/arm/mach-ixp4xx/include/mach/system.h         |   24 -------
 arch/arm/mach-kirkwood/common.c                    |   17 +++++
 arch/arm/mach-kirkwood/include/mach/system.h       |   18 -----
 arch/arm/mach-ks8695/Makefile                      |    2 +-
 arch/arm/mach-ks8695/include/mach/system.h         |   21 ------
 arch/arm/mach-ks8695/reset.c                       |   33 +++++++++
 arch/arm/mach-lpc32xx/common.c                     |   30 +++++++++
 arch/arm/mach-lpc32xx/include/mach/system.h        |   25 -------
 arch/arm/mach-mmp/common.c                         |   16 +++++
 arch/arm/mach-mmp/include/mach/system.h            |    8 --
 arch/arm/mach-msm/include/mach/system.h            |   10 ---
 arch/arm/mach-msm/smd.c                            |    6 ++
 arch/arm/mach-mv78xx0/common.c                     |   17 +++++
 arch/arm/mach-mv78xx0/include/mach/system.h        |   16 -----
 arch/arm/mach-mxs/include/mach/system.h            |    2 -
 arch/arm/mach-mxs/system.c                         |    4 +-
 arch/arm/mach-netx/generic.c                       |    7 ++
 arch/arm/mach-netx/include/mach/system.h           |   10 ---
 arch/arm/mach-nomadik/cpu-8815.c                   |   12 ++++
 arch/arm/mach-nomadik/include/mach/system.h        |   13 ----
 arch/arm/mach-nuc93x/cpu.c                         |   12 ++++
 arch/arm/mach-nuc93x/include/mach/system.h         |    8 --
 arch/arm/mach-omap1/board-voiceblue.c              |    2 +-
 arch/arm/mach-omap1/io.c                           |    4 +
 arch/arm/mach-omap1/reset.c                        |    2 -
 arch/arm/mach-omap2/io.c                           |    7 ++-
 arch/arm/mach-omap2/prcm.c                         |    4 +-
 arch/arm/mach-orion5x/common.c                     |   17 +++++
 arch/arm/mach-orion5x/include/mach/system.h        |   12 ----
 arch/arm/mach-pnx4008/core.c                       |    6 ++
 arch/arm/mach-pnx4008/include/mach/system.h        |    9 ---
 arch/arm/mach-prima2/Makefile                      |    1 +
 arch/arm/mach-prima2/include/mach/system.h         |   10 ---
 arch/arm/mach-prima2/reset.c                       |   22 ++++++
 arch/arm/mach-pxa/include/mach/system.h            |    5 --
 arch/arm/mach-pxa/reset.c                          |    8 ++-
 arch/arm/mach-realview/core.c                      |   20 ++++++
 arch/arm/mach-realview/include/mach/system.h       |   17 -----
 arch/arm/mach-rpc/include/mach/system.h            |   14 ----
 arch/arm/mach-rpc/riscpc.c                         |   14 ++++
 arch/arm/mach-s3c2410/include/mach/system-reset.h  |   32 ---------
 arch/arm/mach-s3c2410/include/mach/system.h        |    2 -
 arch/arm/mach-s3c64xx/Makefile                     |    1 +
 arch/arm/mach-s3c64xx/include/mach/system.h        |   11 ---
 arch/arm/mach-s3c64xx/reset.c                      |   26 +++++++
 arch/arm/mach-s5p64x0/include/mach/system.h        |    2 -
 arch/arm/mach-s5pc100/include/mach/system.h        |    2 -
 arch/arm/mach-s5pv210/include/mach/system.h        |    2 -
 arch/arm/mach-sa1100/generic.c                     |   13 ++++
 arch/arm/mach-sa1100/include/mach/system.h         |   12 ----
 arch/arm/mach-shark/core.c                         |    5 +-
 arch/arm/mach-shark/include/mach/system.h          |    2 -
 arch/arm/mach-shmobile/Makefile                    |    2 +-
 arch/arm/mach-shmobile/include/mach/system.h       |    5 --
 arch/arm/mach-shmobile/reset.c                     |   18 +++++
 arch/arm/mach-tegra/common.c                       |    4 +-
 arch/arm/mach-tegra/include/mach/system.h          |    3 -
 arch/arm/mach-u300/Makefile                        |    2 +-
 arch/arm/mach-u300/include/mach/system.h           |   28 --------
 arch/arm/mach-u300/reset.c                         |   42 ++++++++++++
 arch/arm/mach-ux500/include/mach/system.h          |    5 --
 arch/arm/mach-versatile/core.c                     |   14 ++++
 arch/arm/mach-versatile/include/mach/system.h      |   12 ----
 arch/arm/mach-vexpress/include/mach/system.h       |    4 -
 arch/arm/mach-vt8500/Makefile                      |    2 +-
 arch/arm/mach-vt8500/include/mach/system.h         |    9 ---
 arch/arm/mach-vt8500/reset.c                       |   21 ++++++
 arch/arm/mach-w90x900/Makefile                     |    2 +-
 arch/arm/mach-w90x900/include/mach/system.h        |   21 ------
 arch/arm/mach-w90x900/reset.c                      |   31 +++++++++
 arch/arm/mach-zynq/include/mach/system.h           |    5 --
 arch/arm/plat-mxc/include/mach/system.h            |    2 -
 arch/arm/plat-mxc/system.c                         |    3 +-
 arch/arm/plat-omap/include/plat/system.h           |    3 +-
 arch/arm/plat-s3c24xx/cpu.c                        |   23 ++++++-
 arch/arm/plat-s5p/Makefile                         |    1 +
 .../plat/system-reset.h => system-reset.c}         |   17 ++++-
 arch/arm/plat-spear/Makefile                       |    2 +-
 arch/arm/plat-spear/include/plat/system.h          |   15 ----
 arch/arm/plat-spear/reset.c                        |   29 ++++++++
 arch/arm/plat-tcc/include/mach/system.h            |    9 ---
 arch/arm/plat-tcc/system.c                         |   10 +++-
 133 files changed, 901 insertions(+), 694 deletions(-)
 create mode 100644 arch/arm/mach-clps711x/system.c
 create mode 100644 arch/arm/mach-footbridge/reset.c
 create mode 100644 arch/arm/mach-gemini/system.c
 create mode 100644 arch/arm/mach-iop32x/reset.c
 create mode 100644 arch/arm/mach-iop33x/reset.c
 create mode 100644 arch/arm/mach-ks8695/reset.c
 create mode 100644 arch/arm/mach-prima2/reset.c
 delete mode 100644 arch/arm/mach-s3c2410/include/mach/system-reset.h
 create mode 100644 arch/arm/mach-s3c64xx/reset.c
 create mode 100644 arch/arm/mach-shmobile/reset.c
 create mode 100644 arch/arm/mach-u300/reset.c
 create mode 100644 arch/arm/mach-vt8500/reset.c
 create mode 100644 arch/arm/mach-w90x900/reset.c
 rename arch/arm/plat-s5p/{include/plat/system-reset.h => system-reset.c} (66%)
 create mode 100644 arch/arm/plat-spear/reset.c

-- 
1.7.4.1

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 21:38   ` Jean-Christophe PLAGNIOL-VILLARD
  2011-10-29 10:21   ` Russell King - ARM Linux
  2011-10-28 14:43 ` [PATCH 02/51] ARM: mach-at91: use arm_arch_reset instead of arch_reset Will Deacon
                   ` (50 subsequent siblings)
  51 siblings, 2 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

arch_reset is a static inline function defined in mach/system.h and, as
such, is a blocker for the single zImage work.

This patch introduces an arm_arch_reset function pointer to which
platforms can assign their reset function rather than define it in the
header file.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/include/asm/system.h |    1 +
 arch/arm/kernel/process.c     |   11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 832888d..6838bd4 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -108,6 +108,7 @@ extern int cpu_architecture(void);
 extern void cpu_init(void);
 
 void arm_machine_restart(char mode, const char *cmd);
+extern void (*arm_arch_reset)(char mode, const char *cmd);
 extern void (*arm_pm_restart)(char str, const char *cmd);
 
 #define UDBG_UNDEFINED	(1 << 0)
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 1a347f4..13e68c5 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -117,7 +117,8 @@ void arm_machine_restart(char mode, const char *cmd)
 	/*
 	 * Now call the architecture specific reboot code.
 	 */
-	arch_reset(mode, cmd);
+	if (arm_arch_reset)
+		arm_arch_reset(mode, cmd);
 
 	/*
 	 * Whoops - the architecture was unable to reboot.
@@ -128,6 +129,11 @@ void arm_machine_restart(char mode, const char *cmd)
 	while (1);
 }
 
+static void temporary_arm_arch_reset(char mode, const char *cmd)
+{
+	arch_reset(mode, cmd);
+}
+
 /*
  * Function pointers to optional machine specific functions
  */
@@ -137,6 +143,9 @@ EXPORT_SYMBOL(pm_power_off);
 void (*arm_pm_restart)(char str, const char *cmd) = arm_machine_restart;
 EXPORT_SYMBOL_GPL(arm_pm_restart);
 
+void (*arm_arch_reset)(char mode, const char *cmd) = temporary_arm_arch_reset;
+EXPORT_SYMBOL_GPL(arm_arch_reset);
+
 static void do_nothing(void *unused)
 {
 }
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 02/51] ARM: mach-at91: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
  2011-10-28 14:43 ` [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 03/51] ARM: bcmring: " Will Deacon
                   ` (49 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-at91 to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-at91/at91cap9.c            |    5 +++--
 arch/arm/mach-at91/at91rm9200.c          |    5 +++--
 arch/arm/mach-at91/at91sam9260.c         |    3 ++-
 arch/arm/mach-at91/at91sam9261.c         |    3 ++-
 arch/arm/mach-at91/at91sam9263.c         |    3 ++-
 arch/arm/mach-at91/at91sam9g45.c         |    5 +++--
 arch/arm/mach-at91/at91sam9rl.c          |    3 ++-
 arch/arm/mach-at91/generic.h             |    3 +--
 arch/arm/mach-at91/include/mach/system.h |    5 -----
 9 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
index bfc6844..d16da6a 100644
--- a/arch/arm/mach-at91/at91cap9.c
+++ b/arch/arm/mach-at91/at91cap9.c
@@ -16,6 +16,7 @@
 #include <linux/pm.h>
 
 #include <asm/irq.h>
+#include <asm/system.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
@@ -311,7 +312,7 @@ static struct at91_gpio_bank at91cap9_gpio[] = {
 	}
 };
 
-static void at91cap9_reset(void)
+static void at91cap9_reset(char mode, const char *cmd)
 {
 	at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
 }
@@ -333,7 +334,7 @@ static void __init at91cap9_map_io(void)
 
 static void __init at91cap9_initialize(void)
 {
-	at91_arch_reset = at91cap9_reset;
+	arm_arch_reset = at91cap9_reset;
 	pm_power_off = at91cap9_poweroff;
 	at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1);
 
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index f73302d..4497e81 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 
 #include <asm/irq.h>
+#include <asm/system.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <mach/at91rm9200.h>
@@ -286,7 +287,7 @@ static struct at91_gpio_bank at91rm9200_gpio[] = {
 	}
 };
 
-static void at91rm9200_reset(void)
+static void at91rm9200_reset(char mode, const char *cmd)
 {
 	/*
 	 * Perform a hardware reset with the use of the Watchdog timer.
@@ -307,7 +308,7 @@ static void __init at91rm9200_map_io(void)
 
 static void __init at91rm9200_initialize(void)
 {
-	at91_arch_reset = at91rm9200_reset;
+	arm_arch_reset = at91rm9200_reset;
 	at91_extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1)
 			| (1 << AT91RM9200_ID_IRQ2) | (1 << AT91RM9200_ID_IRQ3)
 			| (1 << AT91RM9200_ID_IRQ4) | (1 << AT91RM9200_ID_IRQ5)
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index cb397be..2f5e4c1 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -14,6 +14,7 @@
 #include <linux/pm.h>
 
 #include <asm/irq.h>
+#include <asm/system.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <mach/cpu.h>
@@ -317,7 +318,7 @@ static void __init at91sam9260_map_io(void)
 
 static void __init at91sam9260_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arm_arch_reset = at91sam9_alt_reset;
 	pm_power_off = at91sam9260_poweroff;
 	at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
 			| (1 << AT91SAM9260_ID_IRQ2);
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 6c8e3b5..b7b0625 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -14,6 +14,7 @@
 #include <linux/pm.h>
 
 #include <asm/irq.h>
+#include <asm/system.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <mach/cpu.h>
@@ -286,7 +287,7 @@ static void __init at91sam9261_map_io(void)
 
 static void __init at91sam9261_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arm_arch_reset = at91sam9_alt_reset;
 	pm_power_off = at91sam9261_poweroff;
 	at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
 			| (1 << AT91SAM9261_ID_IRQ2);
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 044f3c9..42b7380 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -14,6 +14,7 @@
 #include <linux/pm.h>
 
 #include <asm/irq.h>
+#include <asm/system.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <mach/at91sam9263.h>
@@ -303,7 +304,7 @@ static void __init at91sam9263_map_io(void)
 
 static void __init at91sam9263_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arm_arch_reset = at91sam9_alt_reset;
 	pm_power_off = at91sam9263_poweroff;
 	at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1);
 
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index e04c5fb..d13929c 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -14,6 +14,7 @@
 #include <linux/pm.h>
 
 #include <asm/irq.h>
+#include <asm/system.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <mach/at91sam9g45.h>
@@ -301,7 +302,7 @@ static struct at91_gpio_bank at91sam9g45_gpio[] = {
 	}
 };
 
-static void at91sam9g45_reset(void)
+static void at91sam9g45_reset(char mode, const char *cmd)
 {
 	at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
 }
@@ -323,7 +324,7 @@ static void __init at91sam9g45_map_io(void)
 
 static void __init at91sam9g45_initialize(void)
 {
-	at91_arch_reset = at91sam9g45_reset;
+	arm_arch_reset = at91sam9g45_reset;
 	pm_power_off = at91sam9g45_poweroff;
 	at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0);
 
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index a238105..f556331 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -13,6 +13,7 @@
 #include <linux/pm.h>
 
 #include <asm/irq.h>
+#include <asm/system.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <mach/cpu.h>
@@ -292,7 +293,7 @@ static void __init at91sam9rl_map_io(void)
 
 static void __init at91sam9rl_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arm_arch_reset = at91sam9_alt_reset;
 	pm_power_off = at91sam9rl_poweroff;
 	at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0);
 
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 938b34f..c15c9bb 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -57,7 +57,7 @@ extern void at91_irq_suspend(void);
 extern void at91_irq_resume(void);
 
 /* reset */
-extern void at91sam9_alt_reset(void);
+extern void at91sam9_alt_reset(char mode, const char *cmd);
 
  /* GPIO */
 #define AT91RM9200_PQFP		3	/* AT91RM9200 PQFP package has 3 banks */
@@ -71,5 +71,4 @@ struct at91_gpio_bank {
 extern void __init at91_gpio_init(struct at91_gpio_bank *, int nr_banks);
 extern void __init at91_gpio_irq_setup(void);
 
-extern void (*at91_arch_reset)(void);
 extern int at91_extern_irq;
diff --git a/arch/arm/mach-at91/include/mach/system.h b/arch/arm/mach-at91/include/mach/system.h
index 36af14b..079eb12 100644
--- a/arch/arm/mach-at91/include/mach/system.h
+++ b/arch/arm/mach-at91/include/mach/system.h
@@ -47,13 +47,8 @@ static inline void arch_idle(void)
 #endif
 }
 
-void (*at91_arch_reset)(void);
-
 static inline void arch_reset(char mode, const char *cmd)
 {
-	/* call the CPU-specific reset function */
-	if (at91_arch_reset)
-		(at91_arch_reset)();
 }
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 03/51] ARM: bcmring: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
  2011-10-28 14:43 ` [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer Will Deacon
  2011-10-28 14:43 ` [PATCH 02/51] ARM: mach-at91: use arm_arch_reset instead of arch_reset Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 04/51] ARM: mach-clps711x: " Will Deacon
                   ` (48 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-bcmring to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-bcmring/arch.c                |   27 +++++++++++++++++++++++++--
 arch/arm/mach-bcmring/include/mach/system.h |   20 --------------------
 2 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-bcmring/arch.c b/arch/arm/mach-bcmring/arch.c
index a604b9e..4b90876 100644
--- a/arch/arm/mach-bcmring/arch.c
+++ b/arch/arm/mach-bcmring/arch.c
@@ -49,7 +49,7 @@ HW_DECLARE_SPINLOCK(gpio)
 #endif
 
 /* sysctl */
-int bcmring_arch_warm_reboot;	/* do a warm reboot on hard reset */
+static int bcmring_arch_warm_reboot;	/* do a warm reboot on hard reset */
 
 static struct ctl_table_header *bcmring_sysctl_header;
 
@@ -105,6 +105,29 @@ static struct platform_device *devices[] __initdata = {
 	&pmu_device,
 };
 
+static void bcmring_arch_reset(char mode, const char *cmd)
+{
+	printk("arch_reset:%c %x\n", mode, bcmring_arch_warm_reboot);
+
+	if (mode == 'h') {
+		/* Reboot configured in proc entry */
+		if (bcmring_arch_warm_reboot) {
+			printk("warm reset\n");
+			/* Issue Warm reset (do not reset ethernet switch, keep alive) */
+			chipcHw_reset(chipcHw_REG_SOFT_RESET_CHIP_WARM);
+		} else {
+			/* Force reset of everything */
+			printk("force reset\n");
+			chipcHw_reset(chipcHw_REG_SOFT_RESET_CHIP_SOFT);
+		}
+	} else {
+		/* Force reset of everything */
+		printk("force reset\n");
+		chipcHw_reset(chipcHw_REG_SOFT_RESET_CHIP_SOFT);
+	}
+}
+
+
 /****************************************************************************
 *
 *   Called from the customize_machine function in arch/arm/kernel/setup.c
@@ -116,7 +139,7 @@ static struct platform_device *devices[] __initdata = {
 *****************************************************************************/
 static void __init bcmring_init_machine(void)
 {
-
+	arm_arch_reset = bcmring_arch_reset;
 	bcmring_sysctl_header = register_sysctl_table(bcmring_sysctl_reboot);
 
 	/* Enable spread spectrum */
diff --git a/arch/arm/mach-bcmring/include/mach/system.h b/arch/arm/mach-bcmring/include/mach/system.h
index 38b3706..6cd872d 100644
--- a/arch/arm/mach-bcmring/include/mach/system.h
+++ b/arch/arm/mach-bcmring/include/mach/system.h
@@ -22,8 +22,6 @@
 
 #include <mach/csp/chipcHw_inline.h>
 
-extern int bcmring_arch_warm_reboot;
-
 static inline void arch_idle(void)
 {
 	cpu_do_idle();
@@ -31,24 +29,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	printk("arch_reset:%c %x\n", mode, bcmring_arch_warm_reboot);
-
-	if (mode == 'h') {
-		/* Reboot configured in proc entry */
-		if (bcmring_arch_warm_reboot) {
-			printk("warm reset\n");
-			/* Issue Warm reset (do not reset ethernet switch, keep alive) */
-			chipcHw_reset(chipcHw_REG_SOFT_RESET_CHIP_WARM);
-		} else {
-			/* Force reset of everything */
-			printk("force reset\n");
-			chipcHw_reset(chipcHw_REG_SOFT_RESET_CHIP_SOFT);
-		}
-	} else {
-		/* Force reset of everything */
-		printk("force reset\n");
-		chipcHw_reset(chipcHw_REG_SOFT_RESET_CHIP_SOFT);
-	}
 }
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 04/51] ARM: mach-clps711x: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (2 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 03/51] ARM: bcmring: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 05/51] ARM: cns3xxx: " Will Deacon
                   ` (47 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-clps711x to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-clps711x/Makefile              |    2 +-
 arch/arm/mach-clps711x/include/mach/system.h |    1 -
 arch/arm/mach-clps711x/system.c              |   23 +++++++++++++++++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-clps711x/system.c

diff --git a/arch/arm/mach-clps711x/Makefile b/arch/arm/mach-clps711x/Makefile
index 4a19731..c3f224d 100644
--- a/arch/arm/mach-clps711x/Makefile
+++ b/arch/arm/mach-clps711x/Makefile
@@ -4,7 +4,7 @@
 
 # Object file lists.
 
-obj-y			:= irq.o mm.o time.o
+obj-y			:= irq.o mm.o system.o time.o
 obj-m			:=
 obj-n			:=
 obj-			:=
diff --git a/arch/arm/mach-clps711x/include/mach/system.h b/arch/arm/mach-clps711x/include/mach/system.h
index f916cd7..9982deb 100644
--- a/arch/arm/mach-clps711x/include/mach/system.h
+++ b/arch/arm/mach-clps711x/include/mach/system.h
@@ -34,7 +34,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	cpu_reset(0);
 }
 
 #endif
diff --git a/arch/arm/mach-clps711x/system.c b/arch/arm/mach-clps711x/system.c
new file mode 100644
index 0000000..030d758
--- /dev/null
+++ b/arch/arm/mach-clps711x/system.c
@@ -0,0 +1,23 @@
+/*
+ * arch/arm/mach-clps711x/system.c
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <mach/hardware.h>
+
+#include <asm/system.h>
+#include <asm/hardware/clps7111.h>
+
+static void clps711x_arch_reset(char mode, const char *cmd)
+{
+	cpu_reset(0);
+}
+
+static int __init clps711x_arch_reset_init(void)
+{
+	arm_arch_reset = clps711x_arch_reset;
+	return 0;
+}
+
+arch_initcall(clps711x_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 05/51] ARM: cns3xxx: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (3 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 04/51] ARM: mach-clps711x: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 06/51] ARM: mach-davinci: " Will Deacon
                   ` (46 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-cns3xxx to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-cns3xxx/cns3420vb.c           |    3 +++
 arch/arm/mach-cns3xxx/include/mach/system.h |    4 +++-
 arch/arm/mach-cns3xxx/pm.c                  |    2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c
index 3e7d149..e19bda7 100644
--- a/arch/arm/mach-cns3xxx/cns3420vb.c
+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
@@ -167,6 +167,8 @@ static struct platform_device *cns3420_pdevs[] __initdata = {
 	&cns3xxx_usb_ohci_device,
 };
 
+extern void cns3xxx_arch_reset(char mode, const char *cmd);
+
 static void __init cns3420_init(void)
 {
 	cns3xxx_l2x0_init();
@@ -176,6 +178,7 @@ static void __init cns3420_init(void)
 	cns3xxx_ahci_init();
 	cns3xxx_sdhci_init();
 
+	arm_arch_reset = cns3xxx_arch_reset;
 	pm_power_off = cns3xxx_power_off;
 }
 
diff --git a/arch/arm/mach-cns3xxx/include/mach/system.h b/arch/arm/mach-cns3xxx/include/mach/system.h
index 4f16c9b..092d774 100644
--- a/arch/arm/mach-cns3xxx/include/mach/system.h
+++ b/arch/arm/mach-cns3xxx/include/mach/system.h
@@ -23,6 +23,8 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-void arch_reset(char mode, const char *cmd);
+static inline void arch_reset(char mode, const char *cmd)
+{
+}
 
 #endif
diff --git a/arch/arm/mach-cns3xxx/pm.c b/arch/arm/mach-cns3xxx/pm.c
index 0c04678..a3e01f9 100644
--- a/arch/arm/mach-cns3xxx/pm.c
+++ b/arch/arm/mach-cns3xxx/pm.c
@@ -89,7 +89,7 @@ void cns3xxx_pwr_soft_rst(unsigned int block)
 }
 EXPORT_SYMBOL(cns3xxx_pwr_soft_rst);
 
-void arch_reset(char mode, const char *cmd)
+void cns3xxx_arch_reset(char mode, const char *cmd)
 {
 	/*
 	 * To reset, we hit the on-board reset register
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 06/51] ARM: mach-davinci: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (4 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 05/51] ARM: cns3xxx: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 07/51] ARM: mach-dove: " Will Deacon
                   ` (45 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-davinci to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-davinci/common.c              |    8 ++++++++
 arch/arm/mach-davinci/include/mach/system.h |    2 --
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c
index 1d25573..b0b1560 100644
--- a/arch/arm/mach-davinci/common.c
+++ b/arch/arm/mach-davinci/common.c
@@ -71,6 +71,12 @@ static int __init davinci_init_id(struct davinci_soc_info *soc_info)
 	return -EINVAL;
 }
 
+static void davinci_arch_reset(char mode, const char *cmd)
+{
+	if (davinci_soc_info.reset)
+		davinci_soc_info.reset(davinci_soc_info.reset_device);
+}
+
 void __init davinci_common_init(struct davinci_soc_info *soc_info)
 {
 	int ret;
@@ -97,6 +103,8 @@ void __init davinci_common_init(struct davinci_soc_info *soc_info)
 	if (!davinci_soc_info.reset)
 		davinci_soc_info.reset = davinci_watchdog_reset;
 
+	arm_arch_reset = davinci_arch_reset;
+
 	/*
 	 * We want to check CPU revision early for cpu_is_xxxx() macros.
 	 * IO space mapping must be initialized before we can do that.
diff --git a/arch/arm/mach-davinci/include/mach/system.h b/arch/arm/mach-davinci/include/mach/system.h
index e65629c..6bd1dc0 100644
--- a/arch/arm/mach-davinci/include/mach/system.h
+++ b/arch/arm/mach-davinci/include/mach/system.h
@@ -20,8 +20,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	if (davinci_soc_info.reset)
-		davinci_soc_info.reset(davinci_soc_info.reset_device);
 }
 
 #endif /* __ASM_ARCH_SYSTEM_H */
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 07/51] ARM: mach-dove: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (5 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 06/51] ARM: mach-davinci: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 08/51] ARM: mach-ebsa110: " Will Deacon
                   ` (44 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-dove to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-dove/common.c              |   18 ++++++++++++++++++
 arch/arm/mach-dove/include/mach/system.h |   13 -------------
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index a9e0dae..975f6f1 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -273,6 +273,22 @@ void __init dove_sdio1_init(void)
 	platform_device_register(&dove_sdio1);
 }
 
+static void dove_arch_reset(char mode, const char *cmd)
+{
+	/*
+	 * Enable soft reset to assert RSTOUTn.
+	 */
+	writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
+
+	/*
+	 * Assert soft reset.
+	 */
+	writel(SOFT_RESET, SYSTEM_SOFT_RESET);
+
+	while (1)
+		;
+}
+
 void __init dove_init(void)
 {
 	int tclk;
@@ -282,6 +298,8 @@ void __init dove_init(void)
 	printk(KERN_INFO "Dove 88AP510 SoC, ");
 	printk(KERN_INFO "TCLK = %dMHz\n", (tclk + 499999) / 1000000);
 
+	arm_arch_reset = dove_arch_reset;
+
 #ifdef CONFIG_CACHE_TAUROS2
 	tauros2_init();
 #endif
diff --git a/arch/arm/mach-dove/include/mach/system.h b/arch/arm/mach-dove/include/mach/system.h
index 356afda..ce3e749 100644
--- a/arch/arm/mach-dove/include/mach/system.h
+++ b/arch/arm/mach-dove/include/mach/system.h
@@ -18,19 +18,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	/*
-	 * Enable soft reset to assert RSTOUTn.
-	 */
-	writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
-
-	/*
-	 * Assert soft reset.
-	 */
-	writel(SOFT_RESET, SYSTEM_SOFT_RESET);
-
-	while (1)
-		;
 }
 
-
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 08/51] ARM: mach-ebsa110: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (6 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 07/51] ARM: mach-dove: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 09/51] ARM: mach-ep93xx: " Will Deacon
                   ` (43 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-ebsa110 to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-ebsa110/core.c                |    6 ++++++
 arch/arm/mach-ebsa110/include/mach/system.h |    4 +++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index 087bc77..c4d243f 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -271,8 +271,14 @@ static struct platform_device *ebsa110_devices[] = {
 	&am79c961_device,
 };
 
+static void ebsa110_arch_reset(char mode, const char *cmd)
+{
+	cpu_reset(0x80000000);
+}
+
 static int __init ebsa110_init(void)
 {
+	arm_arch_reset = ebsa110_arch_reset;
 	return platform_add_devices(ebsa110_devices, ARRAY_SIZE(ebsa110_devices));
 }
 
diff --git a/arch/arm/mach-ebsa110/include/mach/system.h b/arch/arm/mach-ebsa110/include/mach/system.h
index 9a26245..574e633 100644
--- a/arch/arm/mach-ebsa110/include/mach/system.h
+++ b/arch/arm/mach-ebsa110/include/mach/system.h
@@ -34,6 +34,8 @@ static inline void arch_idle(void)
 	asm volatile ("mcr p15, 0, ip, c15, c1, 2" : : : "cc");
 }
 
-#define arch_reset(mode, cmd)	cpu_reset(0x80000000)
+static inline void arch_reset(char mode, const char *cmd)
+{
+}
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 09/51] ARM: mach-ep93xx: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (7 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 08/51] ARM: mach-ebsa110: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 10/51] ARM: mach-footbridge: " Will Deacon
                   ` (42 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-ep93xx to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-ep93xx/core.c                |   22 ++++++++++++++++++++++
 arch/arm/mach-ep93xx/include/mach/system.h |   10 ----------
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index c60f081..5841c1d 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -904,3 +904,25 @@ void __init ep93xx_init_devices(void)
 	platform_device_register(&ep93xx_ohci_device);
 	platform_device_register(&ep93xx_leds);
 }
+
+static void ep93xx_arch_reset(char mode, const char *cmd)
+{
+	local_irq_disable();
+
+	/*
+	 * Set then clear the SWRST bit to initiate a software reset
+	 */
+	ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_SWRST);
+	ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_SWRST);
+
+	while (1)
+		;
+}
+
+static int __init ep93xx_arch_reset_init(void)
+{
+	arm_arch_reset = ep93xx_arch_reset;
+	return 0;
+}
+
+arch_initcall(ep93xx_arch_reset_init);
diff --git a/arch/arm/mach-ep93xx/include/mach/system.h b/arch/arm/mach-ep93xx/include/mach/system.h
index 6d661fe..ce48083 100644
--- a/arch/arm/mach-ep93xx/include/mach/system.h
+++ b/arch/arm/mach-ep93xx/include/mach/system.h
@@ -11,14 +11,4 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	local_irq_disable();
-
-	/*
-	 * Set then clear the SWRST bit to initiate a software reset
-	 */
-	ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_SWRST);
-	ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_SWRST);
-
-	while (1)
-		;
 }
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 10/51] ARM: mach-footbridge: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (8 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 09/51] ARM: mach-ep93xx: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 11/51] ARM: mach-gemini: " Will Deacon
                   ` (41 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-footbridge to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-footbridge/Makefile              |    2 +-
 arch/arm/mach-footbridge/include/mach/system.h |   46 ----------------
 arch/arm/mach-footbridge/reset.c               |   69 ++++++++++++++++++++++++
 3 files changed, 70 insertions(+), 47 deletions(-)
 create mode 100644 arch/arm/mach-footbridge/reset.c

diff --git a/arch/arm/mach-footbridge/Makefile b/arch/arm/mach-footbridge/Makefile
index 3afb1b2..39821ce 100644
--- a/arch/arm/mach-footbridge/Makefile
+++ b/arch/arm/mach-footbridge/Makefile
@@ -4,7 +4,7 @@
 
 # Object file lists.
 
-obj-y			:= common.o dc21285.o dma.o isa-irq.o
+obj-y			:= common.o dc21285.o dma.o isa-irq.o reset.o
 obj-m			:=
 obj-n			:=
 obj-			:=
diff --git a/arch/arm/mach-footbridge/include/mach/system.h b/arch/arm/mach-footbridge/include/mach/system.h
index 0b29315..0c19392 100644
--- a/arch/arm/mach-footbridge/include/mach/system.h
+++ b/arch/arm/mach-footbridge/include/mach/system.h
@@ -20,50 +20,4 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	if (mode == 's') {
-		/*
-		 * Jump into the ROM
-		 */
-		cpu_reset(0x41000000);
-	} else {
-		if (machine_is_netwinder()) {
-			/* open up the SuperIO chip
-			 */
-			outb(0x87, 0x370);
-			outb(0x87, 0x370);
-
-			/* aux function group 1 (logical device 7)
-			 */
-			outb(0x07, 0x370);
-			outb(0x07, 0x371);
-
-			/* set GP16 for WD-TIMER output
-			 */
-			outb(0xe6, 0x370);
-			outb(0x00, 0x371);
-
-			/* set a RED LED and toggle WD_TIMER for rebooting
-			 */
-			outb(0xc4, 0x338);
-		} else {
-			/* 
-			 * Force the watchdog to do a CPU reset.
-			 *
-			 * After making sure that the watchdog is disabled
-			 * (so we can change the timer registers) we first
-			 * enable the timer to autoreload itself.  Next, the
-			 * timer interval is set really short and any
-			 * current interrupt request is cleared (so we can
-			 * see an edge transition).  Finally, TIMER4 is
-			 * enabled as the watchdog.
-			 */
-			*CSR_SA110_CNTL &= ~(1 << 13);
-			*CSR_TIMER4_CNTL = TIMER_CNTL_ENABLE |
-					   TIMER_CNTL_AUTORELOAD |
-					   TIMER_CNTL_DIV16;
-			*CSR_TIMER4_LOAD = 0x2;
-			*CSR_TIMER4_CLR  = 0;
-			*CSR_SA110_CNTL |= (1 << 13);
-		}
-	}
 }
diff --git a/arch/arm/mach-footbridge/reset.c b/arch/arm/mach-footbridge/reset.c
new file mode 100644
index 0000000..f61e559
--- /dev/null
+++ b/arch/arm/mach-footbridge/reset.c
@@ -0,0 +1,69 @@
+/*
+ * arch/arm/mach-footbridge/reset.c
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/spinlock.h>
+#include <asm/hardware/dec21285.h>
+#include <mach/hardware.h>
+#include <asm/leds.h>
+#include <asm/mach-types.h>
+#include <asm/proc-fns.h>
+
+static void footbridge_arch_reset(char mode, const char *cmd)
+{
+	if (mode == 's') {
+		/*
+		 * Jump into the ROM
+		 */
+		cpu_reset(0x41000000);
+	} else {
+		if (machine_is_netwinder()) {
+			/* open up the SuperIO chip
+			 */
+			outb(0x87, 0x370);
+			outb(0x87, 0x370);
+
+			/* aux function group 1 (logical device 7)
+			 */
+			outb(0x07, 0x370);
+			outb(0x07, 0x371);
+
+			/* set GP16 for WD-TIMER output
+			 */
+			outb(0xe6, 0x370);
+			outb(0x00, 0x371);
+
+			/* set a RED LED and toggle WD_TIMER for rebooting
+			 */
+			outb(0xc4, 0x338);
+		} else {
+			/*
+			 * Force the watchdog to do a CPU reset.
+			 *
+			 * After making sure that the watchdog is disabled
+			 * (so we can change the timer registers) we first
+			 * enable the timer to autoreload itself.  Next, the
+			 * timer interval is set really short and any
+			 * current interrupt request is cleared (so we can
+			 * see an edge transition).  Finally, TIMER4 is
+			 * enabled as the watchdog.
+			 */
+			*CSR_SA110_CNTL &= ~(1 << 13);
+			*CSR_TIMER4_CNTL = TIMER_CNTL_ENABLE |
+					   TIMER_CNTL_AUTORELOAD |
+					   TIMER_CNTL_DIV16;
+			*CSR_TIMER4_LOAD = 0x2;
+			*CSR_TIMER4_CLR  = 0;
+			*CSR_SA110_CNTL |= (1 << 13);
+		}
+	}
+}
+
+static int __init footbridge_arch_reset_init(void)
+{
+	arm_arch_reset = footbridge_arch_reset;
+	return 0;
+}
+arch_initcall(footbridge_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 11/51] ARM: mach-gemini: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (9 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 10/51] ARM: mach-footbridge: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 12/51] ARM: mach-h720x: " Will Deacon
                   ` (40 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-gemini to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-gemini/Makefile              |    2 +-
 arch/arm/mach-gemini/include/mach/system.h |    2 --
 arch/arm/mach-gemini/system.c              |   22 ++++++++++++++++++++++
 3 files changed, 23 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-gemini/system.c

diff --git a/arch/arm/mach-gemini/Makefile b/arch/arm/mach-gemini/Makefile
index c5b24b9..b6fc9a0 100644
--- a/arch/arm/mach-gemini/Makefile
+++ b/arch/arm/mach-gemini/Makefile
@@ -4,7 +4,7 @@
 
 # Object file lists.
 
-obj-y			:= irq.o mm.o time.o devices.o gpio.o
+obj-y			:= irq.o mm.o time.o devices.o gpio.o system.o
 
 # Board-specific support
 obj-$(CONFIG_MACH_NAS4220B)	+= board-nas4220b.o
diff --git a/arch/arm/mach-gemini/include/mach/system.h b/arch/arm/mach-gemini/include/mach/system.h
index 4d9c1f8..7df8e48 100644
--- a/arch/arm/mach-gemini/include/mach/system.h
+++ b/arch/arm/mach-gemini/include/mach/system.h
@@ -30,8 +30,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	__raw_writel(RESET_GLOBAL | RESET_CPU1,
-		     IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_RESET);
 }
 
 #endif /* __MACH_SYSTEM_H */
diff --git a/arch/arm/mach-gemini/system.c b/arch/arm/mach-gemini/system.c
new file mode 100644
index 0000000..f1bba7f
--- /dev/null
+++ b/arch/arm/mach-gemini/system.c
@@ -0,0 +1,22 @@
+/*
+ * arch/arm/mach-gemini/system.c
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <mach/hardware.h>
+#include <mach/global_reg.h>
+#include <asm/system.h>
+
+static void gemini_arch_reset(char mode, const char *cmd)
+{
+	__raw_writel(RESET_GLOBAL | RESET_CPU1,
+		     IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_RESET);
+}
+
+static int __init gemini_arch_reset_init(void)
+{
+	arm_arch_reset = gemini_arch_reset;
+	return 0;
+}
+arch_initcall(gemini_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 12/51] ARM: mach-h720x: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (10 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 11/51] ARM: mach-gemini: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 13/51] ARM: mach-integrator: " Will Deacon
                   ` (39 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-h720x to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-h720x/common.c              |   12 ++++++++++++
 arch/arm/mach-h720x/include/mach/system.h |    1 -
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-h720x/common.c b/arch/arm/mach-h720x/common.c
index 51d4e44..1ad66f2 100644
--- a/arch/arm/mach-h720x/common.c
+++ b/arch/arm/mach-h720x/common.c
@@ -242,3 +242,15 @@ void __init h720x_map_io(void)
 {
 	iotable_init(h720x_io_desc,ARRAY_SIZE(h720x_io_desc));
 }
+
+static void h720x_arch_reset(char mode, const char *cmd)
+{
+	CPU_REG (PMU_BASE, PMU_STAT) |= PMU_WARMRESET;
+}
+
+static int __init h720x_arch_reset_init(void)
+{
+	arm_arch_reset = h720x_arch_reset;
+	return 0;
+}
+arch_initcall(h720x_arch_reset_init);
diff --git a/arch/arm/mach-h720x/include/mach/system.h b/arch/arm/mach-h720x/include/mach/system.h
index a708d24..4c2fba9 100644
--- a/arch/arm/mach-h720x/include/mach/system.h
+++ b/arch/arm/mach-h720x/include/mach/system.h
@@ -27,7 +27,6 @@ static void arch_idle(void)
 
 static __inline__ void arch_reset(char mode, const char *cmd)
 {
-	CPU_REG (PMU_BASE, PMU_STAT) |= PMU_WARMRESET;
 }
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 13/51] ARM: mach-integrator: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (11 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 12/51] ARM: mach-h720x: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 14/51] ARM: mach-iop13xx: " Will Deacon
                   ` (38 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-integrator to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-integrator/core.c                |   11 +++++++++++
 arch/arm/mach-integrator/include/mach/system.h |    5 -----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 77315b9..86f09cb 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -149,6 +149,15 @@ void __init integrator_init_early(void)
 	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
 }
 
+static void integrator_arch_reset(char mode, const char *cmd)
+{
+	/*
+	 * To reset, we hit the on-board reset register
+	 * in the system FPGA
+	 */
+	cm_control(CM_CTRL_RESET, CM_CTRL_RESET);
+}
+
 static int __init integrator_init(void)
 {
 	int i;
@@ -158,6 +167,8 @@ static int __init integrator_init(void)
 		amba_device_register(d, &iomem_resource);
 	}
 
+	arm_arch_reset = integrator_arch_reset;
+
 	return 0;
 }
 
diff --git a/arch/arm/mach-integrator/include/mach/system.h b/arch/arm/mach-integrator/include/mach/system.h
index e1551b8..6e5adbf 100644
--- a/arch/arm/mach-integrator/include/mach/system.h
+++ b/arch/arm/mach-integrator/include/mach/system.h
@@ -34,11 +34,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	/*
-	 * To reset, we hit the on-board reset register
-	 * in the system FPGA
-	 */
-	cm_control(CM_CTRL_RESET, CM_CTRL_RESET);
 }
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 14/51] ARM: mach-iop13xx: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (12 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 13/51] ARM: mach-integrator: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 15/51] ARM: mach-iop32x: " Will Deacon
                   ` (37 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-iop13xx to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-iop13xx/include/mach/system.h |    9 ---------
 arch/arm/mach-iop13xx/setup.c               |   14 ++++++++++++++
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-iop13xx/include/mach/system.h b/arch/arm/mach-iop13xx/include/mach/system.h
index d0c66ef..6b9bba7 100644
--- a/arch/arm/mach-iop13xx/include/mach/system.h
+++ b/arch/arm/mach-iop13xx/include/mach/system.h
@@ -15,13 +15,4 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	/*
-	 * Reset the internal bus (warning both cores are reset)
-	 */
-	write_wdtcr(IOP_WDTCR_EN_ARM);
-	write_wdtcr(IOP_WDTCR_EN);
-	write_wdtsr(IOP13XX_WDTSR_WRITE_EN | IOP13XX_WDTCR_IB_RESET);
-	write_wdtcr(0x1000);
-
-	for(;;);
 }
diff --git a/arch/arm/mach-iop13xx/setup.c b/arch/arm/mach-iop13xx/setup.c
index a5b9897..58388da 100644
--- a/arch/arm/mach-iop13xx/setup.c
+++ b/arch/arm/mach-iop13xx/setup.c
@@ -367,6 +367,19 @@ void __init iop13xx_map_io(void)
 	iotable_init(iop13xx_std_desc, ARRAY_SIZE(iop13xx_std_desc));
 }
 
+static void iop13xx_arch_reset(char mode, const char *cmd)
+{
+	/*
+	 * Reset the internal bus (warning both cores are reset)
+	 */
+	write_wdtcr(IOP_WDTCR_EN_ARM);
+	write_wdtcr(IOP_WDTCR_EN);
+	write_wdtsr(IOP13XX_WDTSR_WRITE_EN | IOP13XX_WDTCR_IB_RESET);
+	write_wdtcr(0x1000);
+
+	for(;;);
+}
+
 static int init_uart;
 static int init_i2c;
 static int init_adma;
@@ -517,6 +530,7 @@ void __init iop13xx_platform_init(void)
 #endif
 
 	platform_add_devices(iop13xx_devices, plat_idx);
+	arm_arch_reset = iop13xx_arch_reset;
 }
 
 static int __init iop13xx_init_uart_setup(char *str)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 15/51] ARM: mach-iop32x: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (13 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 14/51] ARM: mach-iop13xx: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 16/51] ARM: mach-iop33x: " Will Deacon
                   ` (36 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-iop32x to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-iop32x/Makefile              |    2 +-
 arch/arm/mach-iop32x/include/mach/system.h |   13 -----------
 arch/arm/mach-iop32x/reset.c               |   33 ++++++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 14 deletions(-)
 create mode 100644 arch/arm/mach-iop32x/reset.c

diff --git a/arch/arm/mach-iop32x/Makefile b/arch/arm/mach-iop32x/Makefile
index cfdf8a1..29574bc 100644
--- a/arch/arm/mach-iop32x/Makefile
+++ b/arch/arm/mach-iop32x/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-obj-y			:= irq.o
+obj-y			:= irq.o reset.o
 obj-m			:=
 obj-n			:=
 obj-			:=
diff --git a/arch/arm/mach-iop32x/include/mach/system.h b/arch/arm/mach-iop32x/include/mach/system.h
index a4b808f..094714d 100644
--- a/arch/arm/mach-iop32x/include/mach/system.h
+++ b/arch/arm/mach-iop32x/include/mach/system.h
@@ -18,17 +18,4 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	local_irq_disable();
-
-	if (machine_is_n2100()) {
-		gpio_line_set(N2100_HARDWARE_RESET, GPIO_LOW);
-		gpio_line_config(N2100_HARDWARE_RESET, GPIO_OUT);
-		while (1)
-			;
-	}
-
-	*IOP3XX_PCSR = 0x30;
-
-	/* Jump into ROM at address 0 */
-	cpu_reset(0);
 }
diff --git a/arch/arm/mach-iop32x/reset.c b/arch/arm/mach-iop32x/reset.c
new file mode 100644
index 0000000..3df8dfe
--- /dev/null
+++ b/arch/arm/mach-iop32x/reset.c
@@ -0,0 +1,33 @@
+/*
+ * arch/arm/mach-iop32x/reset.c
+ */
+#include <linux/init.h>
+#include <asm/mach-types.h>
+#include <asm/proc-fns.h>
+#include <asm/system.h>
+#include <asm/hardware/iop3xx.h>
+#include <mach/n2100.h>
+
+static void iop32x_arch_reset(char mode, const char *cmd)
+{
+	local_irq_disable();
+
+	if (machine_is_n2100()) {
+		gpio_line_set(N2100_HARDWARE_RESET, GPIO_LOW);
+		gpio_line_config(N2100_HARDWARE_RESET, GPIO_OUT);
+		while (1)
+			;
+	}
+
+	*IOP3XX_PCSR = 0x30;
+
+	/* Jump into ROM at address 0 */
+	cpu_reset(0);
+}
+
+static int __init iop32x_arch_reset_init(void)
+{
+	arm_arch_reset = iop32x_arch_reset;
+	return 0;
+}
+arch_initcall(iop32x_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 16/51] ARM: mach-iop33x: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (14 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 15/51] ARM: mach-iop32x: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 17/51] ARM: OMAP: convert reset to use arm_arch_reset Will Deacon
                   ` (35 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-iop33x to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-iop33x/Makefile              |    2 +-
 arch/arm/mach-iop33x/include/mach/system.h |    4 ----
 arch/arm/mach-iop33x/reset.c               |   24 ++++++++++++++++++++++++
 3 files changed, 25 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/mach-iop33x/reset.c

diff --git a/arch/arm/mach-iop33x/Makefile b/arch/arm/mach-iop33x/Makefile
index 90081d8..5b72c19 100644
--- a/arch/arm/mach-iop33x/Makefile
+++ b/arch/arm/mach-iop33x/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-obj-y			:= irq.o uart.o
+obj-y			:= irq.o reset.o uart.o
 obj-m			:=
 obj-n			:=
 obj-			:=
diff --git a/arch/arm/mach-iop33x/include/mach/system.h b/arch/arm/mach-iop33x/include/mach/system.h
index f192a34..df98c56 100644
--- a/arch/arm/mach-iop33x/include/mach/system.h
+++ b/arch/arm/mach-iop33x/include/mach/system.h
@@ -16,8 +16,4 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	*IOP3XX_PCSR = 0x30;
-
-	/* Jump into ROM at address 0 */
-	cpu_reset(0);
 }
diff --git a/arch/arm/mach-iop33x/reset.c b/arch/arm/mach-iop33x/reset.c
new file mode 100644
index 0000000..9d71166
--- /dev/null
+++ b/arch/arm/mach-iop33x/reset.c
@@ -0,0 +1,24 @@
+/*
+ * arch/arm/mach-iop33x/reset.c
+ */
+
+#include <linux/init.h>
+#include <asm/proc-fns.h>
+#include <asm/system.h>
+#include <asm/hardware/iop3xx.h>
+
+static void iop33x_arch_reset(char mode, const char *cmd)
+{
+	*IOP3XX_PCSR = 0x30;
+
+	/* Jump into ROM at address 0 */
+	cpu_reset(0);
+}
+
+static int __init iop33x_arch_reset_init(void)
+{
+	arm_arch_reset = iop33x_arch_reset;
+	return 0;
+}
+
+arch_initcall(iop33x_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 17/51] ARM: OMAP: convert reset to use arm_arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (15 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 16/51] ARM: mach-iop33x: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 18/51] ARM: mach-ixp2000: use arm_arch_reset instead of arch_reset Will Deacon
                   ` (34 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

From: Paul Walmsley <paul@pwsan.com>

Align the OMAP reset code with Will Deacon's "ARM: reset: introduce
arm_arch_reset function pointer" cleanup patch.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-omap1/board-voiceblue.c    |    2 +-
 arch/arm/mach-omap1/io.c                 |    4 ++++
 arch/arm/mach-omap1/reset.c              |    2 --
 arch/arm/mach-omap2/io.c                 |    7 ++++++-
 arch/arm/mach-omap2/prcm.c               |    4 +---
 arch/arm/plat-omap/include/plat/system.h |    6 +++++-
 6 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 036edc0e..e2a24a0 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -296,7 +296,7 @@ static void __init voiceblue_init(void)
 	omap_writeb(0x00, OMAP_LPG1_LCR);
 	omap_writeb(0x00, OMAP_LPG1_PMR);	/* Disable clock */
 
-	arch_reset = voiceblue_reset;
+	arm_arch_reset = voiceblue_reset;
 }
 
 MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index 870886a..d3b54da 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -15,8 +15,10 @@
 
 #include <asm/tlb.h>
 #include <asm/mach/map.h>
+#include <asm/system.h>
 #include <plat/mux.h>
 #include <plat/tc.h>
+#include <plat/system.h>
 
 #include "clock.h"
 
@@ -140,6 +142,8 @@ void __init omap1_init_common_hw(void)
 	omap1_clk_init();
 
 	omap1_mux_init();
+
+	arm_arch_reset = omap1_arch_reset;
 }
 
 /*
diff --git a/arch/arm/mach-omap1/reset.c b/arch/arm/mach-omap1/reset.c
index ad951ee..a5ed979 100644
--- a/arch/arm/mach-omap1/reset.c
+++ b/arch/arm/mach-omap1/reset.c
@@ -21,5 +21,3 @@ void omap1_arch_reset(char mode, const char *cmd)
 
 	omap_writew(1, ARM_RSTCT1);
 }
-
-void (*arch_reset)(char, const char *) = omap1_arch_reset;
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 2ce1ce6..b94e1a2 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -31,6 +31,7 @@
 #include <plat/sram.h>
 #include <plat/sdrc.h>
 #include <plat/serial.h>
+#include <plat/system.h>
 
 #include "clock2xxx.h"
 #include "clock3xxx.h"
@@ -44,6 +45,8 @@
 #include <plat/omap_hwmod.h>
 #include <plat/multi.h>
 
+#include "prcm-common.h"
+
 /*
  * The machine specific code may provide the extra mapping besides the
  * default mapping provided here.
@@ -358,7 +361,9 @@ void __init omap2_init_common_infrastructure(void)
 		omap44xx_hwmod_init();
 	} else {
 		pr_err("Could not init hwmod data - unknown SoC\n");
-        }
+	}
+
+	arm_arch_reset = omap_prcm_arch_reset;
 
 	/* Set the default postsetup state for all hwmods */
 #ifdef CONFIG_PM_RUNTIME
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 2e40a5c..ad3ac5c 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -58,7 +58,7 @@ u32 omap_prcm_get_reset_sources(void)
 EXPORT_SYMBOL(omap_prcm_get_reset_sources);
 
 /* Resets clock rates and reboots the system. Only called from system.h */
-static void omap_prcm_arch_reset(char mode, const char *cmd)
+void omap_prcm_arch_reset(char mode, const char *cmd)
 {
 	s16 prcm_offs = 0;
 
@@ -109,8 +109,6 @@ static void omap_prcm_arch_reset(char mode, const char *cmd)
 	omap2_prm_read_mod_reg(prcm_offs, OMAP2_RM_RSTCTRL); /* OCP barrier */
 }
 
-void (*arch_reset)(char, const char *) = omap_prcm_arch_reset;
-
 /**
  * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness
  * @reg: physical address of module IDLEST register
diff --git a/arch/arm/plat-omap/include/plat/system.h b/arch/arm/plat-omap/include/plat/system.h
index c5fa9e9..ac32d88 100644
--- a/arch/arm/plat-omap/include/plat/system.h
+++ b/arch/arm/plat-omap/include/plat/system.h
@@ -12,6 +12,10 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-extern void (*arch_reset)(char, const char *);
+/* To be removed in a future ARM-wide cleanup */
+static inline void arch_reset(char mode, const char *cmd) {}
+
+extern void omap1_arch_reset(char mode, const char *cmd);
+extern void omap_prcm_arch_reset(char mode, const char *cmd);
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 18/51] ARM: mach-ixp2000: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (16 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 17/51] ARM: OMAP: convert reset to use arm_arch_reset Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 19/51] ARM: mach-ixp23xx: " Will Deacon
                   ` (33 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-ixp2000 to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-ixp2000/core.c                |   38 +++++++++++++++++++++++++++
 arch/arm/mach-ixp2000/include/mach/system.h |   30 ---------------------
 2 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index 4068166..59e987f 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -28,6 +28,7 @@
 
 #include <asm/types.h>
 #include <asm/setup.h>
+#include <asm/mach-types.h>
 #include <asm/memory.h>
 #include <mach/hardware.h>
 #include <asm/irq.h>
@@ -514,3 +515,40 @@ void __init ixp2000_init_irq(void)
 	}
 }
 
+static void ixp2000_arch_reset(char mode, const char *cmd)
+{
+	local_irq_disable();
+
+	/*
+	 * Reset flash banking register so that we are pointing at
+	 * RedBoot bank.
+	 */
+	if (machine_is_ixdp2401()) {
+		ixp2000_reg_write(IXDP2X01_CPLD_FLASH_REG,
+					((0 >> IXDP2X01_FLASH_WINDOW_BITS)
+						| IXDP2X01_CPLD_FLASH_INTERN));
+		ixp2000_reg_wrb(IXDP2X01_CPLD_RESET_REG, 0xffffffff);
+	}
+
+	/*
+	 * On IXDP2801 we need to write this magic sequence to the CPLD
+	 * to cause a complete reset of the CPU and all external devices
+	 * and move the flash bank register back to 0.
+	 */
+	if (machine_is_ixdp2801() || machine_is_ixdp28x5()) {
+		unsigned long reset_reg = *IXDP2X01_CPLD_RESET_REG;
+
+		reset_reg = 0x55AA0000 | (reset_reg & 0x0000FFFF);
+		ixp2000_reg_write(IXDP2X01_CPLD_RESET_REG, reset_reg);
+		ixp2000_reg_wrb(IXDP2X01_CPLD_RESET_REG, 0x80000000);
+	}
+
+	ixp2000_reg_wrb(IXP2000_RESET0, RSTALL);
+}
+
+static int __init ixp2000_arch_reset_init(void)
+{
+	arm_arch_reset = ixp2000_arch_reset;
+	return 0;
+}
+arch_initcall(ixp2000_arch_reset_init);
diff --git a/arch/arm/mach-ixp2000/include/mach/system.h b/arch/arm/mach-ixp2000/include/mach/system.h
index de37099..d79c7ad 100644
--- a/arch/arm/mach-ixp2000/include/mach/system.h
+++ b/arch/arm/mach-ixp2000/include/mach/system.h
@@ -9,9 +9,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <mach/hardware.h>
-#include <asm/mach-types.h>
-
 static inline void arch_idle(void)
 {
 	cpu_do_idle();
@@ -19,31 +16,4 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	local_irq_disable();
-
-	/*
-	 * Reset flash banking register so that we are pointing at
-	 * RedBoot bank.
-	 */
-	if (machine_is_ixdp2401()) {
-		ixp2000_reg_write(IXDP2X01_CPLD_FLASH_REG,
-					((0 >> IXDP2X01_FLASH_WINDOW_BITS)
-						| IXDP2X01_CPLD_FLASH_INTERN));
-		ixp2000_reg_wrb(IXDP2X01_CPLD_RESET_REG, 0xffffffff);
-	}
-
-	/*
-	 * On IXDP2801 we need to write this magic sequence to the CPLD
-	 * to cause a complete reset of the CPU and all external devices
-	 * and move the flash bank register back to 0.
-	 */
-	if (machine_is_ixdp2801() || machine_is_ixdp28x5()) {
-		unsigned long reset_reg = *IXDP2X01_CPLD_RESET_REG;
-
-		reset_reg = 0x55AA0000 | (reset_reg & 0x0000FFFF);
-		ixp2000_reg_write(IXDP2X01_CPLD_RESET_REG, reset_reg);
-		ixp2000_reg_wrb(IXDP2X01_CPLD_RESET_REG, 0x80000000);
-	}
-
-	ixp2000_reg_wrb(IXP2000_RESET0, RSTALL);
 }
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 19/51] ARM: mach-ixp23xx: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (17 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 18/51] ARM: mach-ixp2000: use arm_arch_reset instead of arch_reset Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 20/51] ARM: mach-ixp4xx: " Will Deacon
                   ` (32 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-ixp23xx to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-ixp23xx/core.c                |   15 +++++++++++++++
 arch/arm/mach-ixp23xx/include/mach/system.h |   12 ------------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-ixp23xx/core.c b/arch/arm/mach-ixp23xx/core.c
index a1bee33..e72c089 100644
--- a/arch/arm/mach-ixp23xx/core.c
+++ b/arch/arm/mach-ixp23xx/core.c
@@ -32,6 +32,7 @@
 #include <asm/types.h>
 #include <asm/setup.h>
 #include <asm/memory.h>
+#include <asm/mach-types.h>
 #include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/system.h>
@@ -439,8 +440,22 @@ static struct platform_device *ixp23xx_devices[] __initdata = {
 	&ixp23xx_uart,
 };
 
+static void ixp23xx_arch_reset(char mode, const char *cmd)
+{
+	/* First try machine specific support */
+	if (machine_is_ixdp2351()) {
+		*IXDP2351_CPLD_RESET1_REG = IXDP2351_CPLD_RESET1_MAGIC;
+		(void) *IXDP2351_CPLD_RESET1_REG;
+		*IXDP2351_CPLD_RESET1_REG = IXDP2351_CPLD_RESET1_ENABLE;
+	}
+
+	/* Use on-chip reset capability */
+	*IXP23XX_RESET0 |= IXP23XX_RST_ALL;
+}
+
 void __init ixp23xx_sys_init(void)
 {
 	*IXP23XX_EXP_UNIT_FUSE |= 0xf;
 	platform_add_devices(ixp23xx_devices, ARRAY_SIZE(ixp23xx_devices));
+	arm_arch_reset = ixp23xx_arch_reset;
 }
diff --git a/arch/arm/mach-ixp23xx/include/mach/system.h b/arch/arm/mach-ixp23xx/include/mach/system.h
index 8920ff2..4569003 100644
--- a/arch/arm/mach-ixp23xx/include/mach/system.h
+++ b/arch/arm/mach-ixp23xx/include/mach/system.h
@@ -8,9 +8,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <mach/hardware.h>
-#include <asm/mach-types.h>
-
 static inline void arch_idle(void)
 {
 #if 0
@@ -21,13 +18,4 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	/* First try machine specific support */
-	if (machine_is_ixdp2351()) {
-		*IXDP2351_CPLD_RESET1_REG = IXDP2351_CPLD_RESET1_MAGIC;
-		(void) *IXDP2351_CPLD_RESET1_REG;
-		*IXDP2351_CPLD_RESET1_REG = IXDP2351_CPLD_RESET1_ENABLE;
-	}
-
-	/* Use on-chip reset capability */
-	*IXP23XX_RESET0 |= IXP23XX_RST_ALL;
 }
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 20/51] ARM: mach-ixp4xx: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (18 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 19/51] ARM: mach-ixp23xx: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 21/51] ARM: mach-kirkwood: " Will Deacon
                   ` (31 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-ixp4xx to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-ixp4xx/common.c              |   22 ++++++++++++++++++++++
 arch/arm/mach-ixp4xx/include/mach/system.h |   19 -------------------
 2 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 0777257..9e38334 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -375,6 +375,26 @@ static struct platform_device *ixp46x_devices[] __initdata = {
 unsigned long ixp4xx_exp_bus_size;
 EXPORT_SYMBOL(ixp4xx_exp_bus_size);
 
+static void ixp4xx_arch_reset(char mode, const char *cmd)
+{
+	if ( 1 && mode == 's') {
+		/* Jump into ROM at address 0 */
+		cpu_reset(0);
+	} else {
+		/* Use on-chip reset capability */
+
+		/* set the "key" register to enable access to
+		 * "timer" and "enable" registers
+		 */
+		*IXP4XX_OSWK = IXP4XX_WDT_KEY;
+
+		/* write 0 to the timer register for an immediate reset */
+		*IXP4XX_OSWT = 0;
+
+		*IXP4XX_OSWE = IXP4XX_WDT_RESET_ENABLE | IXP4XX_WDT_COUNT_ENABLE;
+	}
+}
+
 void __init ixp4xx_sys_init(void)
 {
 	ixp4xx_exp_bus_size = SZ_16M;
@@ -397,6 +417,8 @@ void __init ixp4xx_sys_init(void)
 
 	printk("IXP4xx: Using %luMiB expansion bus window size\n",
 			ixp4xx_exp_bus_size >> 20);
+
+	arm_arch_reset = ixp4xx_arch_reset;
 }
 
 /*
diff --git a/arch/arm/mach-ixp4xx/include/mach/system.h b/arch/arm/mach-ixp4xx/include/mach/system.h
index 54c0af7..ed5964c 100644
--- a/arch/arm/mach-ixp4xx/include/mach/system.h
+++ b/arch/arm/mach-ixp4xx/include/mach/system.h
@@ -9,8 +9,6 @@
  *
  */
 
-#include <mach/hardware.h>
-
 static inline void arch_idle(void)
 {
 	/* ixp4xx does not implement the XScale PWRMODE register,
@@ -24,21 +22,4 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	if ( 1 && mode == 's') {
-		/* Jump into ROM at address 0 */
-		cpu_reset(0);
-	} else {
-		/* Use on-chip reset capability */
-
-		/* set the "key" register to enable access to
-		 * "timer" and "enable" registers
-		 */
-		*IXP4XX_OSWK = IXP4XX_WDT_KEY;
-
-		/* write 0 to the timer register for an immediate reset */
-		*IXP4XX_OSWT = 0;
-
-		*IXP4XX_OSWE = IXP4XX_WDT_RESET_ENABLE | IXP4XX_WDT_COUNT_ENABLE;
-	}
 }
-
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 21/51] ARM: mach-kirkwood: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (19 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 20/51] ARM: mach-ixp4xx: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 22/51] ARM: mach-ks8695: " Will Deacon
                   ` (30 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-kirkwood to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-kirkwood/common.c              |   17 +++++++++++++++++
 arch/arm/mach-kirkwood/include/mach/system.h |   14 --------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index f3248cf..5fcfbde 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -448,6 +448,22 @@ static void __init kirkwood_l2_init(void)
 #endif
 }
 
+static void kirkwood_arch_reset(char mode, const char *cmd)
+{
+	/*
+	 * Enable soft reset to assert RSTOUTn.
+	 */
+	writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
+
+	/*
+	 * Assert soft reset.
+	 */
+	writel(SOFT_RESET, SYSTEM_SOFT_RESET);
+
+	while (1)
+		;
+}
+
 void __init kirkwood_init(void)
 {
 	printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n",
@@ -478,6 +494,7 @@ void __init kirkwood_init(void)
 #ifdef CONFIG_KEXEC 
 	kexec_reinit = kirkwood_enable_pcie;
 #endif
+	arm_arch_reset = kirkwood_arch_reset;
 }
 
 static int __init kirkwood_clock_gate(void)
diff --git a/arch/arm/mach-kirkwood/include/mach/system.h b/arch/arm/mach-kirkwood/include/mach/system.h
index 7568e95..f094431 100644
--- a/arch/arm/mach-kirkwood/include/mach/system.h
+++ b/arch/arm/mach-kirkwood/include/mach/system.h
@@ -9,8 +9,6 @@
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H
 
-#include <mach/bridge-regs.h>
-
 static inline void arch_idle(void)
 {
 	cpu_do_idle();
@@ -18,18 +16,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	/*
-	 * Enable soft reset to assert RSTOUTn.
-	 */
-	writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
-
-	/*
-	 * Assert soft reset.
-	 */
-	writel(SOFT_RESET, SYSTEM_SOFT_RESET);
-
-	while (1)
-		;
 }
 
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 22/51] ARM: mach-ks8695: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (20 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 21/51] ARM: mach-kirkwood: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 23/51] ARM: mach-lpc32xx: " Will Deacon
                   ` (29 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-ks8695 to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-ks8695/Makefile              |    2 +-
 arch/arm/mach-ks8695/include/mach/system.h |   19 +---------------
 arch/arm/mach-ks8695/reset.c               |   33 ++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 19 deletions(-)
 create mode 100644 arch/arm/mach-ks8695/reset.c

diff --git a/arch/arm/mach-ks8695/Makefile b/arch/arm/mach-ks8695/Makefile
index 7e3e816..c2dcdde 100644
--- a/arch/arm/mach-ks8695/Makefile
+++ b/arch/arm/mach-ks8695/Makefile
@@ -3,7 +3,7 @@
 # Makefile for KS8695 architecture support
 #
 
-obj-y				:= cpu.o irq.o time.o gpio.o devices.o
+obj-y				:= cpu.o irq.o time.o gpio.o devices.o reset.o
 obj-m				:=
 obj-n				:=
 obj-				:=
diff --git a/arch/arm/mach-ks8695/include/mach/system.h b/arch/arm/mach-ks8695/include/mach/system.h
index fb1dda9..b73ee70 100644
--- a/arch/arm/mach-ks8695/include/mach/system.h
+++ b/arch/arm/mach-ks8695/include/mach/system.h
@@ -14,9 +14,6 @@
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H
 
-#include <linux/io.h>
-#include <mach/regs-timer.h>
-
 static void arch_idle(void)
 {
 	/*
@@ -27,22 +24,8 @@ static void arch_idle(void)
 
 }
 
-static void arch_reset(char mode, const char *cmd)
+static inline void arch_reset(char mode, const char *cmd)
 {
-	unsigned int reg;
-
-	if (mode == 's')
-		cpu_reset(0);
-
-	/* disable timer0 */
-	reg = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
-	__raw_writel(reg & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
-
-	/* enable watchdog mode */
-	__raw_writel((10 << 8) | T0TC_WATCHDOG, KS8695_TMR_VA + KS8695_T0TC);
-
-	/* re-enable timer0 */
-	__raw_writel(reg | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
 }
 
 #endif
diff --git a/arch/arm/mach-ks8695/reset.c b/arch/arm/mach-ks8695/reset.c
new file mode 100644
index 0000000..911eb95
--- /dev/null
+++ b/arch/arm/mach-ks8695/reset.c
@@ -0,0 +1,33 @@
+/*
+ * arch/arm/mach-ks8695/reset.c
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <asm/proc-fns.h>
+#include <mach/regs-timer.h>
+
+static void ks8695_arch_reset(char mode, const char *cmd)
+{
+	unsigned int reg;
+
+	if (mode == 's')
+		cpu_reset(0);
+
+	/* disable timer0 */
+	reg = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
+	__raw_writel(reg & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
+
+	/* enable watchdog mode */
+	__raw_writel((10 << 8) | T0TC_WATCHDOG, KS8695_TMR_VA + KS8695_T0TC);
+
+	/* re-enable timer0 */
+	__raw_writel(reg | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
+}
+
+static int __init ks8695_arch_reset_init(void)
+{
+	arm_arch_reset = ks8695_arch_reset;
+	return 0;
+}
+arch_initcall(ks8695_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 23/51] ARM: mach-lpc32xx: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (21 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 22/51] ARM: mach-ks8695: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 24/51] ARM: mach-mmp: " Will Deacon
                   ` (28 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-lpc32xx to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-lpc32xx/common.c              |   30 +++++++++++++++++++++++++++
 arch/arm/mach-lpc32xx/include/mach/system.h |   21 ------------------
 2 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c
index 205b2db..200bd51 100644
--- a/arch/arm/mach-lpc32xx/common.c
+++ b/arch/arm/mach-lpc32xx/common.c
@@ -311,3 +311,33 @@ void __init lpc32xx_map_io(void)
 {
 	iotable_init(lpc32xx_io_desc, ARRAY_SIZE(lpc32xx_io_desc));
 }
+
+static void lpc32xx_arch_reset(char mode, const char *cmd)
+{
+	switch (mode) {
+	case 's':
+	case 'h':
+		printk(KERN_CRIT "RESET: Rebooting system\n");
+
+		/* Disable interrupts */
+		local_irq_disable();
+
+		lpc32xx_watchdog_reset();
+		break;
+
+	default:
+		/* Do nothing */
+		break;
+	}
+
+	/* Wait for watchdog to reset system */
+	while (1)
+		;
+}
+
+static int __init lpc32xx_arch_reset_init(void)
+{
+	arm_arch_reset = lpc32xx_arch_reset;
+	return 0;
+}
+arch_initcall(lpc32xx_arch_reset_init);
diff --git a/arch/arm/mach-lpc32xx/include/mach/system.h b/arch/arm/mach-lpc32xx/include/mach/system.h
index df3b0de..9c6cc0c 100644
--- a/arch/arm/mach-lpc32xx/include/mach/system.h
+++ b/arch/arm/mach-lpc32xx/include/mach/system.h
@@ -26,27 +26,6 @@ static void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	extern void lpc32xx_watchdog_reset(void);
-
-	switch (mode) {
-	case 's':
-	case 'h':
-		printk(KERN_CRIT "RESET: Rebooting system\n");
-
-		/* Disable interrupts */
-		local_irq_disable();
-
-		lpc32xx_watchdog_reset();
-		break;
-
-	default:
-		/* Do nothing */
-		break;
-	}
-
-	/* Wait for watchdog to reset system */
-	while (1)
-		;
 }
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 24/51] ARM: mach-mmp: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (22 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 23/51] ARM: mach-lpc32xx: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 25/51] ARM: mach-mv78xx0: " Will Deacon
                   ` (27 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-mmp to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-mmp/common.c              |   16 ++++++++++++++++
 arch/arm/mach-mmp/include/mach/system.h |    4 ----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-mmp/common.c b/arch/arm/mach-mmp/common.c
index 0ec0ca8..1d3df64 100644
--- a/arch/arm/mach-mmp/common.c
+++ b/arch/arm/mach-mmp/common.c
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 
 #include <asm/page.h>
+#include <asm/proc-fns.h>
 #include <asm/mach/map.h>
 #include <mach/addr-map.h>
 #include <mach/cputype.h>
@@ -45,3 +46,18 @@ void __init mmp_map_io(void)
 	/* this is early, initialize mmp_chip_id here */
 	mmp_chip_id = __raw_readl(MMP_CHIPID);
 }
+
+static void mmp_arch_reset(char mode, const char *cmd)
+{
+	if (cpu_is_pxa168())
+		cpu_reset(0xffff0000);
+	else
+		cpu_reset(0);
+}
+
+static int __init mmp_arch_reset_init(void)
+{
+	arm_arch_reset = mmp_arch_reset;
+	return 0;
+}
+arch_initcall(mmp_arch_reset_init);
diff --git a/arch/arm/mach-mmp/include/mach/system.h b/arch/arm/mach-mmp/include/mach/system.h
index 1a8a25e..b09c19a 100644
--- a/arch/arm/mach-mmp/include/mach/system.h
+++ b/arch/arm/mach-mmp/include/mach/system.h
@@ -18,9 +18,5 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	if (cpu_is_pxa168())
-		cpu_reset(0xffff0000);
-	else
-		cpu_reset(0);
 }
 #endif /* __ASM_MACH_SYSTEM_H */
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 25/51] ARM: mach-mv78xx0: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (23 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 24/51] ARM: mach-mmp: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 26/51] ARM: mach-msm: " Will Deacon
                   ` (26 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-mv78xx0 to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-mv78xx0/common.c              |   17 +++++++++++++++++
 arch/arm/mach-mv78xx0/include/mach/system.h |   12 ------------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index 23d3980..c3d5dd4 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -375,6 +375,22 @@ static int __init is_l2_writethrough(void)
 	return !!(readl(CPU_CONTROL) & L2_WRITETHROUGH);
 }
 
+static void mv78xx0_arch_reset(char mode, const char *cmd)
+{
+	/*
+	 * Enable soft reset to assert RSTOUTn.
+	 */
+	writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
+
+	/*
+	 * Assert soft reset.
+	 */
+	writel(SOFT_RESET, SYSTEM_SOFT_RESET);
+
+	while (1)
+		;
+}
+
 void __init mv78xx0_init(void)
 {
 	int core_index;
@@ -400,4 +416,5 @@ void __init mv78xx0_init(void)
 #ifdef CONFIG_CACHE_FEROCEON_L2
 	feroceon_l2_init(is_l2_writethrough());
 #endif
+	arm_arch_reset = mv78xx0_arch_reset;
 }
diff --git a/arch/arm/mach-mv78xx0/include/mach/system.h b/arch/arm/mach-mv78xx0/include/mach/system.h
index 66e7ce4..1a41dc5 100644
--- a/arch/arm/mach-mv78xx0/include/mach/system.h
+++ b/arch/arm/mach-mv78xx0/include/mach/system.h
@@ -18,18 +18,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	/*
-	 * Enable soft reset to assert RSTOUTn.
-	 */
-	writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
-
-	/*
-	 * Assert soft reset.
-	 */
-	writel(SOFT_RESET, SYSTEM_SOFT_RESET);
-
-	while (1)
-		;
 }
 
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 26/51] ARM: mach-msm: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (24 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 25/51] ARM: mach-mv78xx0: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 27/51] ARM: mach-mxs: " Will Deacon
                   ` (25 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-msm to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-msm/include/mach/system.h |    6 ------
 arch/arm/mach-msm/smd.c                 |    6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-msm/include/mach/system.h b/arch/arm/mach-msm/include/mach/system.h
index d2e83f4..ab6590b 100644
--- a/arch/arm/mach-msm/include/mach/system.h
+++ b/arch/arm/mach-msm/include/mach/system.h
@@ -19,10 +19,4 @@ void arch_idle(void);
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	for (;;) ;  /* depends on IPC w/ other core */
 }
-
-/* low level hardware reset hook -- for example, hitting the
- * PSHOLD line on the PMIC to hard reset the system
- */
-extern void (*msm_hw_reset_hook)(void);
diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c
index 657be73..4f0e919 100644
--- a/arch/arm/mach-msm/smd.c
+++ b/arch/arm/mach-msm/smd.c
@@ -1029,8 +1029,14 @@ static struct platform_driver msm_smd_driver = {
 	},
 };
 
+static void msm_arch_reset(char mode, const char *cmd)
+{
+	for (;;) ;  /* depends on IPC w/ other core */
+}
+
 static int __init msm_smd_init(void)
 {
+	arm_arch_reset = msm_arch_reset;
 	return platform_driver_register(&msm_smd_driver);
 }
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 27/51] ARM: mach-mxs: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (25 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 26/51] ARM: mach-msm: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 28/51] ARM: mach-netx: " Will Deacon
                   ` (24 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-mxs to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-mxs/include/mach/system.h |    4 +++-
 arch/arm/mach-mxs/system.c              |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mxs/include/mach/system.h b/arch/arm/mach-mxs/include/mach/system.h
index 0e42823..bcd8989 100644
--- a/arch/arm/mach-mxs/include/mach/system.h
+++ b/arch/arm/mach-mxs/include/mach/system.h
@@ -22,6 +22,8 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-void arch_reset(char mode, const char *cmd);
+static inline void arch_reset(char mode, const char *cmd)
+{
+}
 
 #endif /* __MACH_MXS_SYSTEM_H__ */
diff --git a/arch/arm/mach-mxs/system.c b/arch/arm/mach-mxs/system.c
index 20ec3bd..add6428 100644
--- a/arch/arm/mach-mxs/system.c
+++ b/arch/arm/mach-mxs/system.c
@@ -42,7 +42,7 @@ static void __iomem *mxs_clkctrl_reset_addr;
 /*
  * Reset the system. It is called by machine_restart().
  */
-void arch_reset(char mode, const char *cmd)
+static void mxs_arch_reset(char mode, const char *cmd)
 {
 	/* reset the chip */
 	__mxs_setl(MXS_CLKCTRL_RESET_CHIP, mxs_clkctrl_reset_addr);
@@ -68,6 +68,8 @@ static int __init mxs_arch_reset_init(void)
 	if (!IS_ERR(clk))
 		clk_enable(clk);
 
+	arm_arch_reset = mxs_arch_reset;
+
 	return 0;
 }
 core_initcall(mxs_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 28/51] ARM: mach-netx: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (26 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 27/51] ARM: mach-mxs: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 29/51] ARM: mach-nomadik: " Will Deacon
                   ` (23 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-netx to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-netx/generic.c             |    7 +++++++
 arch/arm/mach-netx/include/mach/system.h |    6 ------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-netx/generic.c b/arch/arm/mach-netx/generic.c
index 00023b5..13ed7a3 100644
--- a/arch/arm/mach-netx/generic.c
+++ b/arch/arm/mach-netx/generic.c
@@ -180,8 +180,15 @@ void __init netx_init_irq(void)
 	irq_set_chained_handler(NETX_IRQ_HIF, netx_hif_demux_handler);
 }
 
+static void netx_arch_reset(char mode, const char *cmd)
+{
+	writel(NETX_SYSTEM_RES_CR_FIRMW_RES_EN | NETX_SYSTEM_RES_CR_FIRMW_RES,
+	       NETX_SYSTEM_RES_CR);
+}
+
 static int __init netx_init(void)
 {
+	arm_arch_reset = netx_arch_reset;
 	return platform_add_devices(devices, ARRAY_SIZE(devices));
 }
 
diff --git a/arch/arm/mach-netx/include/mach/system.h b/arch/arm/mach-netx/include/mach/system.h
index dc7b4bc..83ae2b1 100644
--- a/arch/arm/mach-netx/include/mach/system.h
+++ b/arch/arm/mach-netx/include/mach/system.h
@@ -19,10 +19,6 @@
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H
 
-#include <linux/io.h>
-#include <mach/hardware.h>
-#include "netx-regs.h"
-
 static inline void arch_idle(void)
 {
 	cpu_do_idle();
@@ -30,8 +26,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	writel(NETX_SYSTEM_RES_CR_FIRMW_RES_EN | NETX_SYSTEM_RES_CR_FIRMW_RES,
-	       NETX_SYSTEM_RES_CR);
 }
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 29/51] ARM: mach-nomadik: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (27 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 28/51] ARM: mach-netx: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 30/51] ARM: mach-nuc93x: " Will Deacon
                   ` (22 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-nomadik to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-nomadik/cpu-8815.c            |   12 ++++++++++++
 arch/arm/mach-nomadik/include/mach/system.h |    9 ---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index ac58e3b..a9c2406 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -18,6 +18,7 @@
 
 #include <linux/types.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/device.h>
 #include <linux/amba/bus.h>
 #include <linux/platform_device.h>
@@ -113,6 +114,16 @@ static struct amba_device *amba_devs[] __initdata = {
 	&cpu8815_amba_rng
 };
 
+static void nmk_arch_reset(char mode, const char *cmd)
+{
+	void __iomem *src_rstsr = io_p2v(NOMADIK_SRC_BASE + 0x18);
+
+	/* FIXME: use egpio when implemented */
+
+	/* Write anything to Reset status register */
+	writel(1, src_rstsr);
+}
+
 static int __init cpu8815_init(void)
 {
 	int i;
@@ -120,6 +131,7 @@ static int __init cpu8815_init(void)
 	platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
 	for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
 		amba_device_register(amba_devs[i], &iomem_resource);
+	arm_arch_reset = nmk_arch_reset;
 	return 0;
 }
 arch_initcall(cpu8815_init);
diff --git a/arch/arm/mach-nomadik/include/mach/system.h b/arch/arm/mach-nomadik/include/mach/system.h
index 7119f68..16f59f6 100644
--- a/arch/arm/mach-nomadik/include/mach/system.h
+++ b/arch/arm/mach-nomadik/include/mach/system.h
@@ -20,9 +20,6 @@
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H
 
-#include <linux/io.h>
-#include <mach/hardware.h>
-
 static inline void arch_idle(void)
 {
 	/*
@@ -34,12 +31,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	void __iomem *src_rstsr = io_p2v(NOMADIK_SRC_BASE + 0x18);
-
-	/* FIXME: use egpio when implemented */
-
-	/* Write anything to Reset status register */
-	writel(1, src_rstsr);
 }
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 30/51] ARM: mach-nuc93x: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (28 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 29/51] ARM: mach-nomadik: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:43 ` [PATCH 31/51] ARM: mach-orion5x: " Will Deacon
                   ` (21 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-nuc93x to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-nuc93x/cpu.c                 |   12 ++++++++++++
 arch/arm/mach-nuc93x/include/mach/system.h |    6 +-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-nuc93x/cpu.c b/arch/arm/mach-nuc93x/cpu.c
index f6ff5d8..ccd7818 100644
--- a/arch/arm/mach-nuc93x/cpu.c
+++ b/arch/arm/mach-nuc93x/cpu.c
@@ -28,6 +28,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 #include <asm/irq.h>
+#include <asm/proc-fns.h>
 
 #include <mach/hardware.h>
 #include <mach/regs-serial.h>
@@ -133,3 +134,14 @@ void __init nuc93x_init_clocks(void)
 	clks_register(nuc932_clkregs, ARRAY_SIZE(nuc932_clkregs));
 }
 
+static void nuc93x_arch_reset(char mode, const char *cmd)
+{
+	cpu_reset(0);
+}
+
+static int __init nuc93x_arch_reset_init(void)
+{
+	arm_arch_reset = nuc93x_arch_reset;
+	return 0;
+}
+arch_initcall(nuc93x_arch_reset_init);
diff --git a/arch/arm/mach-nuc93x/include/mach/system.h b/arch/arm/mach-nuc93x/include/mach/system.h
index d26bd9a..a4d39a3 100644
--- a/arch/arm/mach-nuc93x/include/mach/system.h
+++ b/arch/arm/mach-nuc93x/include/mach/system.h
@@ -15,14 +15,10 @@
  *
  */
 
-#include <asm/proc-fns.h>
-
 static void arch_idle(void)
 {
 }
 
-static void arch_reset(char mode, const char *cmd)
+static inline void arch_reset(char mode, const char *cmd)
 {
-	cpu_reset(0);
 }
-
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 31/51] ARM: mach-orion5x: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (29 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 30/51] ARM: mach-nuc93x: " Will Deacon
@ 2011-10-28 14:43 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 32/51] ARM: mach-pnx4008: " Will Deacon
                   ` (20 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-orion5x to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-orion5x/common.c              |   17 +++++++++++++++++
 arch/arm/mach-orion5x/include/mach/system.h |    8 --------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 0ab531d..557e4eb 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/delay.h>
 #include <linux/dma-mapping.h>
 #include <linux/serial_8250.h>
 #include <linux/mbus.h>
@@ -268,6 +269,17 @@ static void __init orion5x_id(u32 *dev, u32 *rev, char **dev_name)
 	}
 }
 
+static void orion5x_arch_reset(char mode, const char *cmd)
+{
+	/*
+	 * Enable and issue soft reset
+	 */
+	orion5x_setbits(RSTOUTn_MASK, (1 << 2));
+	orion5x_setbits(CPU_SOFT_RESET, 1);
+	mdelay(200);
+	orion5x_clrbits(CPU_SOFT_RESET, 1);
+}
+
 void __init orion5x_init(void)
 {
 	char *dev_name;
@@ -302,6 +314,11 @@ void __init orion5x_init(void)
 	 * Register watchdog driver
 	 */
 	orion5x_wdt_init();
+
+	/*
+	 * Assign reset hook.
+	 */
+	arm_arch_reset = orion5x_arch_reset;
 }
 
 /*
diff --git a/arch/arm/mach-orion5x/include/mach/system.h b/arch/arm/mach-orion5x/include/mach/system.h
index a1d6e46..91a933c 100644
--- a/arch/arm/mach-orion5x/include/mach/system.h
+++ b/arch/arm/mach-orion5x/include/mach/system.h
@@ -20,14 +20,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	/*
-	 * Enable and issue soft reset
-	 */
-	orion5x_setbits(RSTOUTn_MASK, (1 << 2));
-	orion5x_setbits(CPU_SOFT_RESET, 1);
-	mdelay(200);
-	orion5x_clrbits(CPU_SOFT_RESET, 1);
 }
 
-
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 32/51] ARM: mach-pnx4008: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (30 preceding siblings ...)
  2011-10-28 14:43 ` [PATCH 31/51] ARM: mach-orion5x: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 33/51] ARM: mach-prima2: " Will Deacon
                   ` (19 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-pnx4008 to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-pnx4008/core.c                |    6 ++++++
 arch/arm/mach-pnx4008/include/mach/system.h |    5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-pnx4008/core.c b/arch/arm/mach-pnx4008/core.c
index 6339975..7184172 100644
--- a/arch/arm/mach-pnx4008/core.c
+++ b/arch/arm/mach-pnx4008/core.c
@@ -32,6 +32,7 @@
 #include <asm/mach-types.h>
 #include <asm/pgtable.h>
 #include <asm/page.h>
+#include <asm/proc-fns.h>
 #include <asm/system.h>
 
 #include <asm/mach/arch.h>
@@ -208,6 +209,10 @@ static struct platform_device *devices[] __initdata = {
 	&watchdog_device,
 };
 
+static void pnx4008_arch_reset(char mode, const char *cmd)
+{
+	cpu_reset(0);
+}
 
 extern void pnx4008_uart_init(void);
 
@@ -224,6 +229,7 @@ static void __init pnx4008_init(void)
 	spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
 	/* Switch on the UART clocks */
 	pnx4008_uart_init();
+	arm_arch_reset = pnx4008_arch_reset;
 }
 
 static struct map_desc pnx4008_io_desc[] __initdata = {
diff --git a/arch/arm/mach-pnx4008/include/mach/system.h b/arch/arm/mach-pnx4008/include/mach/system.h
index 5dda2bb..6710ed3 100644
--- a/arch/arm/mach-pnx4008/include/mach/system.h
+++ b/arch/arm/mach-pnx4008/include/mach/system.h
@@ -21,10 +21,6 @@
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H
 
-#include <linux/io.h>
-#include <mach/hardware.h>
-#include <mach/platform.h>
-
 static void arch_idle(void)
 {
 	cpu_do_idle();
@@ -32,7 +28,6 @@ static void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	cpu_reset(0);
 }
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 33/51] ARM: mach-prima2: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (31 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 32/51] ARM: mach-pnx4008: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-29  9:41   ` Barry Song
  2011-10-28 14:44 ` [PATCH 34/51] ARM: mach-pxa: " Will Deacon
                   ` (18 subsequent siblings)
  51 siblings, 1 reply; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-prima2 to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-prima2/Makefile              |    1 +
 arch/arm/mach-prima2/include/mach/system.h |    6 ------
 arch/arm/mach-prima2/reset.c               |   22 ++++++++++++++++++++++
 3 files changed, 23 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-prima2/reset.c

diff --git a/arch/arm/mach-prima2/Makefile b/arch/arm/mach-prima2/Makefile
index 7af7fc0..75a7127 100644
--- a/arch/arm/mach-prima2/Makefile
+++ b/arch/arm/mach-prima2/Makefile
@@ -2,6 +2,7 @@ obj-y := timer.o
 obj-y += irq.o
 obj-y += clock.o
 obj-y += rstc.o
+obj-y += reset.o
 obj-y += prima2.o
 obj-$(CONFIG_DEBUG_LL) += lluart.o
 obj-$(CONFIG_CACHE_L2X0) += l2x0.o
diff --git a/arch/arm/mach-prima2/include/mach/system.h b/arch/arm/mach-prima2/include/mach/system.h
index 0dbd257..1d14a77 100644
--- a/arch/arm/mach-prima2/include/mach/system.h
+++ b/arch/arm/mach-prima2/include/mach/system.h
@@ -9,11 +9,6 @@
 #ifndef __MACH_SYSTEM_H__
 #define __MACH_SYSTEM_H__
 
-#include <linux/bitops.h>
-#include <mach/hardware.h>
-
-#define SIRFSOC_SYS_RST_BIT  BIT(31)
-
 extern void __iomem *sirfsoc_rstc_base;
 
 static inline void arch_idle(void)
@@ -23,7 +18,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	writel(SIRFSOC_SYS_RST_BIT, sirfsoc_rstc_base);
 }
 
 #endif
diff --git a/arch/arm/mach-prima2/reset.c b/arch/arm/mach-prima2/reset.c
new file mode 100644
index 0000000..5473ae8
--- /dev/null
+++ b/arch/arm/mach-prima2/reset.c
@@ -0,0 +1,22 @@
+/*
+ * arch/arm/mach-prima2/reset.c
+ */
+
+#include <linux/init.h>
+#include <linux/bitops.h>
+#include <mach/hardware.h>
+#include <asm/system.h>
+
+#define SIRFSOC_SYS_RST_BIT  BIT(31)
+
+static void prima2_arch_reset(char mode, const char *cmd)
+{
+	writel(SIRFSOC_SYS_RST_BIT, sirfsoc_rstc_base);
+}
+
+static int __init prima2_arch_reset_init(void)
+{
+	arm_arch_reset = prima2_arch_reset;
+	return 0;
+}
+arch_initcall(prima2_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 34/51] ARM: mach-pxa: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (32 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 33/51] ARM: mach-prima2: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 22:12   ` Marek Vasut
  2011-10-28 14:44 ` [PATCH 35/51] ARM: mach-realview: " Will Deacon
                   ` (17 subsequent siblings)
  51 siblings, 1 reply; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-pxa to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-pxa/include/mach/system.h |    6 +++---
 arch/arm/mach-pxa/reset.c               |    8 +++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-pxa/include/mach/system.h b/arch/arm/mach-pxa/include/mach/system.h
index d1fce8b..0687110 100644
--- a/arch/arm/mach-pxa/include/mach/system.h
+++ b/arch/arm/mach-pxa/include/mach/system.h
@@ -11,8 +11,6 @@
  */
 
 #include <asm/proc-fns.h>
-#include "hardware.h"
-#include "pxa2xx-regs.h"
 
 static inline void arch_idle(void)
 {
@@ -20,4 +18,6 @@ static inline void arch_idle(void)
 }
 
 
-void arch_reset(char mode, const char *cmd);
+static inline void arch_reset(char mode, const char *cmd)
+{
+}
diff --git a/arch/arm/mach-pxa/reset.c b/arch/arm/mach-pxa/reset.c
index 01e9d64..075598a 100644
--- a/arch/arm/mach-pxa/reset.c
+++ b/arch/arm/mach-pxa/reset.c
@@ -81,7 +81,7 @@ static void do_hw_reset(void)
 	OSMR3 = OSCR + 368640;	/* ... in 100 ms */
 }
 
-void arch_reset(char mode, const char *cmd)
+static void pxa_arch_reset(char mode, const char *cmd)
 {
 	clear_reset_status(RESET_STATUS_ALL);
 
@@ -100,3 +100,9 @@ void arch_reset(char mode, const char *cmd)
 	}
 }
 
+static int __init pxa_arch_reset_init(void)
+{
+	arm_arch_reset = pxa_arch_reset;
+	return 0;
+}
+arch_initcall(pxa_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 35/51] ARM: mach-realview: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (33 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 34/51] ARM: mach-pxa: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 36/51] ARM: mach-rpc: " Will Deacon
                   ` (16 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-realview to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-realview/core.c                |   20 ++++++++++++++++++++
 arch/arm/mach-realview/include/mach/system.h |   13 -------------
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 5c23450..96b6f75 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -534,3 +534,23 @@ void realview_fixup(struct machine_desc *mdesc, struct tag *tags, char **from,
 	meminfo->nr_banks = 1;
 #endif
 }
+
+void (*realview_reset)(char mode);
+
+static void realview_arch_reset(char mode, const char *cmd)
+{
+	/*
+	 * To reset, we hit the on-board reset register
+	 * in the system FPGA
+	 */
+	if (realview_reset)
+		realview_reset(mode);
+	dsb();
+}
+
+static int __init realview_arch_reset_init(void)
+{
+	arm_arch_reset = realview_arch_reset;
+	return 0;
+}
+arch_initcall(realview_arch_reset_init);
diff --git a/arch/arm/mach-realview/include/mach/system.h b/arch/arm/mach-realview/include/mach/system.h
index 6657ff23..1630766 100644
--- a/arch/arm/mach-realview/include/mach/system.h
+++ b/arch/arm/mach-realview/include/mach/system.h
@@ -21,12 +21,6 @@
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H
 
-#include <linux/io.h>
-#include <mach/hardware.h>
-#include <mach/platform.h>
-
-void (*realview_reset)(char mode);
-
 static inline void arch_idle(void)
 {
 	/*
@@ -38,13 +32,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	/*
-	 * To reset, we hit the on-board reset register
-	 * in the system FPGA
-	 */
-	if (realview_reset)
-		realview_reset(mode);
-	dsb();
 }
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 36/51] ARM: mach-rpc: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (34 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 35/51] ARM: mach-realview: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 37/51] ARM: mach-s3c64xx: " Will Deacon
                   ` (15 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-rpc to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-rpc/include/mach/system.h |   10 ----------
 arch/arm/mach-rpc/riscpc.c              |   14 ++++++++++++++
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-rpc/include/mach/system.h b/arch/arm/mach-rpc/include/mach/system.h
index 45c7b93..e9fb593 100644
--- a/arch/arm/mach-rpc/include/mach/system.h
+++ b/arch/arm/mach-rpc/include/mach/system.h
@@ -7,10 +7,6 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#include <linux/io.h>
-#include <mach/hardware.h>
-#include <asm/hardware/iomd.h>
-
 static inline void arch_idle(void)
 {
 	cpu_do_idle();
@@ -18,10 +14,4 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	iomd_writeb(0, IOMD_ROMCR0);
-
-	/*
-	 * Jump into the ROM
-	 */
-	cpu_reset(0);
 }
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
index 580b3c7..2d9ac6e 100644
--- a/arch/arm/mach-rpc/riscpc.c
+++ b/arch/arm/mach-rpc/riscpc.c
@@ -25,9 +25,12 @@
 #include <asm/mach-types.h>
 #include <mach/hardware.h>
 #include <asm/page.h>
+#include <asm/proc-fns.h>
 #include <asm/domain.h>
 #include <asm/setup.h>
 
+#include <asm/hardware/iomd.h>
+
 #include <asm/mach/map.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
@@ -206,9 +209,20 @@ static struct i2c_board_info i2c_rtc = {
 	I2C_BOARD_INFO("pcf8583", 0x50)
 };
 
+static void rpc_arch_reset(char mode, const char *cmd)
+{
+	iomd_writeb(0, IOMD_ROMCR0);
+
+	/*
+	 * Jump into the ROM
+	 */
+	cpu_reset(0);
+}
+
 static int __init rpc_init(void)
 {
 	i2c_register_board_info(0, &i2c_rtc, 1);
+	arm_arch_reset = rpc_arch_reset;
 	return platform_add_devices(devs, ARRAY_SIZE(devs));
 }
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 37/51] ARM: mach-s3c64xx: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (35 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 36/51] ARM: mach-rpc: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 38/51] ARM: mach-sa1100: " Will Deacon
                   ` (14 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-s3c64xx to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-s3c64xx/Makefile              |    1 +
 arch/arm/mach-s3c64xx/include/mach/system.h |    7 -------
 arch/arm/mach-s3c64xx/reset.c               |   26 ++++++++++++++++++++++++++
 3 files changed, 27 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/mach-s3c64xx/reset.c

diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index 61b4034..ba2f2ac 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -14,6 +14,7 @@ obj-				:=
 obj-y				+= cpu.o
 obj-y				+= clock.o
 obj-y				+= gpiolib.o
+obj-y				+= reset.o
 
 # Core support for S3C6400 system
 
diff --git a/arch/arm/mach-s3c64xx/include/mach/system.h b/arch/arm/mach-s3c64xx/include/mach/system.h
index 2e58cb7..51bc8eb 100644
--- a/arch/arm/mach-s3c64xx/include/mach/system.h
+++ b/arch/arm/mach-s3c64xx/include/mach/system.h
@@ -11,8 +11,6 @@
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H __FILE__
 
-#include <plat/watchdog-reset.h>
-
 static void arch_idle(void)
 {
 	/* nothing here yet */
@@ -20,11 +18,6 @@ static void arch_idle(void)
 
 static void arch_reset(char mode, const char *cmd)
 {
-	if (mode != 's')
-		arch_wdt_reset();
-
-	/* if all else fails, or mode was for soft, jump to 0 */
-	cpu_reset(0);
 }
 
 #endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-s3c64xx/reset.c b/arch/arm/mach-s3c64xx/reset.c
new file mode 100644
index 0000000..2ea710c
--- /dev/null
+++ b/arch/arm/mach-s3c64xx/reset.c
@@ -0,0 +1,26 @@
+/*
+ * arch/arm/mach-s3c64xx/reset.c
+ */
+
+#include <linux/delay.h>
+#include <linux/init.h>
+
+#include <plat/watchdog-reset.h>
+
+#include <asm/proc-fns.h>
+
+static void s3c64xx_arch_reset(char mode, const char *cmd)
+{
+	if (mode != 's')
+		arch_wdt_reset();
+
+	/* if all else fails, or mode was for soft, jump to 0 */
+	cpu_reset(0);
+}
+
+static int __init s3c64xx_arch_reset_init(void)
+{
+	arm_arch_reset = s3c64xx_arch_reset;
+	return 0;
+}
+arch_initcall(s3c64xx_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 38/51] ARM: mach-sa1100: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (36 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 37/51] ARM: mach-s3c64xx: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 39/51] ARM: mach-shark: " Will Deacon
                   ` (13 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-sa1100 to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-sa1100/generic.c             |   13 +++++++++++++
 arch/arm/mach-sa1100/include/mach/system.h |    8 --------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index e21f347..fb49654 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -25,6 +25,7 @@
 #include <asm/mach/flash.h>
 #include <asm/irq.h>
 #include <asm/gpio.h>
+#include <asm/proc-fns.h>
 
 #include "generic.h"
 
@@ -126,6 +127,17 @@ static void sa1100_power_off(void)
 	PMCR = PMCR_SF;
 }
 
+static void sa1100_arch_reset(char mode, const char *cmd)
+{
+	if (mode == 's') {
+		/* Jump into ROM at address 0 */
+		cpu_reset(0);
+	} else {
+		/* Use on-chip reset capability */
+		RSRR = RSRR_SWR;
+	}
+}
+
 static void sa11x0_register_device(struct platform_device *dev, void *data)
 {
 	int err;
@@ -351,6 +363,7 @@ static struct platform_device *sa11x0_devices[] __initdata = {
 
 static int __init sa1100_init(void)
 {
+	arm_arch_reset = sa1100_arch_reset;
 	pm_power_off = sa1100_power_off;
 	return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
 }
diff --git a/arch/arm/mach-sa1100/include/mach/system.h b/arch/arm/mach-sa1100/include/mach/system.h
index ba9da9f..ac3bdb8 100644
--- a/arch/arm/mach-sa1100/include/mach/system.h
+++ b/arch/arm/mach-sa1100/include/mach/system.h
@@ -3,7 +3,6 @@
  *
  * Copyright (c) 1999 Nicolas Pitre <nico@fluxnic.net>
  */
-#include <mach/hardware.h>
 
 static inline void arch_idle(void)
 {
@@ -12,11 +11,4 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	if (mode == 's') {
-		/* Jump into ROM at address 0 */
-		cpu_reset(0);
-	} else {
-		/* Use on-chip reset capability */
-		RSRR = RSRR_SWR;
-	}
 }
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 39/51] ARM: mach-shark: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (37 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 38/51] ARM: mach-sa1100: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 40/51] ARM: mach-shmobile: " Will Deacon
                   ` (12 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-shark to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-shark/core.c                |    5 ++++-
 arch/arm/mach-shark/include/mach/system.h |    5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
index ac2873c..bbe4fc5 100644
--- a/arch/arm/mach-shark/core.c
+++ b/arch/arm/mach-shark/core.c
@@ -26,7 +26,7 @@
 #define ROMCARD_SIZE            0x08000000
 #define ROMCARD_START           0x10000000
 
-void arch_reset(char mode, const char *cmd)
+static void shark_arch_reset(char mode, const char *cmd)
 {
         short temp;
         local_irq_disable();
@@ -97,6 +97,9 @@ static int __init shark_init(void)
 		ret = platform_device_register(&serial_device);
 		if (ret) printk(KERN_ERR "Unable to register Serial device: %d\n", ret);
 	}
+
+	arm_arch_reset = shark_arch_reset;
+
 	return 0;
 }
 
diff --git a/arch/arm/mach-shark/include/mach/system.h b/arch/arm/mach-shark/include/mach/system.h
index 21c373b..2cc363a 100644
--- a/arch/arm/mach-shark/include/mach/system.h
+++ b/arch/arm/mach-shark/include/mach/system.h
@@ -6,8 +6,9 @@
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H
 
-/* Found in arch/mach-shark/core.c */
-extern void arch_reset(char mode, const char *cmd);
+static inline void arch_reset(char mode, const char *cmd)
+{
+}
 
 static inline void arch_idle(void)
 {
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 40/51] ARM: mach-shmobile: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (38 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 39/51] ARM: mach-shark: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 41/51] ARM: mach-tegra: " Will Deacon
                   ` (11 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-shmobile to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-shmobile/Makefile              |    2 +-
 arch/arm/mach-shmobile/include/mach/system.h |    1 -
 arch/arm/mach-shmobile/reset.c               |   18 ++++++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-shmobile/reset.c

diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 612b270..8f12b57 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -3,7 +3,7 @@
 #
 
 # Common objects
-obj-y				:= timer.o console.o clock.o pm_runtime.o
+obj-y				:= timer.o console.o clock.o pm_runtime.o reset.o
 
 # CPU objects
 obj-$(CONFIG_ARCH_SH7367)	+= setup-sh7367.o clock-sh7367.o intc-sh7367.o
diff --git a/arch/arm/mach-shmobile/include/mach/system.h b/arch/arm/mach-shmobile/include/mach/system.h
index 76a687e..4f2bea5 100644
--- a/arch/arm/mach-shmobile/include/mach/system.h
+++ b/arch/arm/mach-shmobile/include/mach/system.h
@@ -8,7 +8,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	cpu_reset(0);
 }
 
 #endif
diff --git a/arch/arm/mach-shmobile/reset.c b/arch/arm/mach-shmobile/reset.c
new file mode 100644
index 0000000..ab53fb9
--- /dev/null
+++ b/arch/arm/mach-shmobile/reset.c
@@ -0,0 +1,18 @@
+/*
+ * arch/arm/mach-shmobile/reset.c
+ */
+
+#include <linux/init.h>
+#include <asm/proc-fns.h>
+
+static void shmobile_arch_reset(char mode, const char *cmd)
+{
+	cpu_reset(0);
+}
+
+static int __init shmobile_arch_reset_init(void)
+{
+	arm_arch_reset = shmobile_arch_reset;
+	return 0;
+}
+arch_initcall(shmobile_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 41/51] ARM: mach-tegra: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (39 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 40/51] ARM: mach-shmobile: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 42/51] ARM: mach-u300: " Will Deacon
                   ` (10 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-tegra to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-tegra/common.c              |    4 ++--
 arch/arm/mach-tegra/include/mach/system.h |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index d5e3f89..aaf85c6 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -31,8 +31,6 @@
 #include "clock.h"
 #include "fuse.h"
 
-void (*arch_reset)(char mode, const char *cmd) = tegra_assert_system_reset;
-
 void tegra_assert_system_reset(char mode, const char *cmd)
 {
 	void __iomem *reset = IO_ADDRESS(TEGRA_CLK_RESET_BASE + 0x04);
@@ -80,4 +78,6 @@ void __init tegra_init_early(void)
 	tegra_init_clock();
 	tegra_clk_init_from_table(common_clk_init_table);
 	tegra_init_cache();
+
+	arm_arch_reset = tegra_assert_system_reset;
 }
diff --git a/arch/arm/mach-tegra/include/mach/system.h b/arch/arm/mach-tegra/include/mach/system.h
index 027c421..b87b8a4 100644
--- a/arch/arm/mach-tegra/include/mach/system.h
+++ b/arch/arm/mach-tegra/include/mach/system.h
@@ -21,9 +21,9 @@
 #ifndef __MACH_TEGRA_SYSTEM_H
 #define __MACH_TEGRA_SYSTEM_H
 
-#include <mach/iomap.h>
-
-extern void (*arch_reset)(char mode, const char *cmd);
+static inline void arch_reset(char mode, const char *cmd)
+{
+}
 
 static inline void arch_idle(void)
 {
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 42/51] ARM: mach-u300: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (40 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 41/51] ARM: mach-tegra: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 19:37   ` Linus Walleij
  2011-10-28 14:44 ` [PATCH 43/51] ARM: mach-versatile: " Will Deacon
                   ` (9 subsequent siblings)
  51 siblings, 1 reply; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-u300 to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-u300/Makefile              |    2 +-
 arch/arm/mach-u300/include/mach/system.h |   26 +-----------------
 arch/arm/mach-u300/reset.c               |   42 ++++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+), 26 deletions(-)
 create mode 100644 arch/arm/mach-u300/reset.c

diff --git a/arch/arm/mach-u300/Makefile b/arch/arm/mach-u300/Makefile
index 8fd354a..599f4eb 100644
--- a/arch/arm/mach-u300/Makefile
+++ b/arch/arm/mach-u300/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel, U300 machine.
 #
 
-obj-y		:= core.o clock.o timer.o padmux.o
+obj-y		:= core.o clock.o timer.o padmux.o reset.o
 obj-m		:=
 obj-n		:=
 obj-		:=
diff --git a/arch/arm/mach-u300/include/mach/system.h b/arch/arm/mach-u300/include/mach/system.h
index 8daf136..0ddf3cd 100644
--- a/arch/arm/mach-u300/include/mach/system.h
+++ b/arch/arm/mach-u300/include/mach/system.h
@@ -8,35 +8,11 @@
  * System shutdown and reset functions.
  * Author: Linus Walleij <linus.walleij@stericsson.com>
  */
-#include <mach/hardware.h>
-#include <asm/io.h>
-#include <asm/hardware/vic.h>
-#include <asm/irq.h>
-
-/* Forward declare this function from the watchdog */
-void coh901327_watchdog_reset(void);
-
 static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
 
-static void arch_reset(char mode, const char *cmd)
+static inline void arch_reset(char mode, const char *cmd)
 {
-	switch (mode) {
-	case 's':
-	case 'h':
-		printk(KERN_CRIT "RESET: shutting down/rebooting system\n");
-		/* Disable interrupts */
-		local_irq_disable();
-#ifdef CONFIG_COH901327_WATCHDOG
-		coh901327_watchdog_reset();
-#endif
-		break;
-	default:
-		/* Do nothing */
-		break;
-	}
-	/* Wait for system do die/reset. */
-	while (1);
 }
diff --git a/arch/arm/mach-u300/reset.c b/arch/arm/mach-u300/reset.c
new file mode 100644
index 0000000..607e7f8
--- /dev/null
+++ b/arch/arm/mach-u300/reset.c
@@ -0,0 +1,42 @@
+/*
+ * arch/arm/mach-u300/reset.c
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+
+#include <mach/hardware.h>
+
+#include <asm/io.h>
+#include <asm/hardware/vic.h>
+#include <asm/irq.h>
+
+/* Forward declare this function from the watchdog */
+void coh901327_watchdog_reset(void);
+
+static void u300_arch_reset(char mode, const char *cmd)
+{
+	switch (mode) {
+	case 's':
+	case 'h':
+		printk(KERN_CRIT "RESET: shutting down/rebooting system\n");
+		/* Disable interrupts */
+		local_irq_disable();
+#ifdef CONFIG_COH901327_WATCHDOG
+		coh901327_watchdog_reset();
+#endif
+		break;
+	default:
+		/* Do nothing */
+		break;
+	}
+	/* Wait for system do die/reset. */
+	while (1);
+}
+
+static int __init u300_arch_reset_init(void)
+{
+	arm_arch_reset = u300_arch_reset;
+	return 0;
+}
+arch_initcall(u300_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 43/51] ARM: mach-versatile: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (41 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 42/51] ARM: mach-u300: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 44/51] ARM: mach-vt8500: " Will Deacon
                   ` (8 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-versatile to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-versatile/core.c                |   14 ++++++++++++++
 arch/arm/mach-versatile/include/mach/system.h |    8 --------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index e340a54..5d97b6e 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -756,6 +756,18 @@ void __init versatile_init_early(void)
 	versatile_sched_clock_init(sys + VERSATILE_SYS_24MHz_OFFSET, 24000000);
 }
 
+static void versatile_arch_reset(char mode, const char *cmd)
+{
+	u32 val;
+
+	val = __raw_readl(IO_ADDRESS(VERSATILE_SYS_RESETCTL)) & ~0x7;
+	val |= 0x105;
+
+	__raw_writel(0xa05f, IO_ADDRESS(VERSATILE_SYS_LOCK));
+	__raw_writel(val, IO_ADDRESS(VERSATILE_SYS_RESETCTL));
+	__raw_writel(0, IO_ADDRESS(VERSATILE_SYS_LOCK));
+}
+
 void __init versatile_init(void)
 {
 	int i;
@@ -773,6 +785,8 @@ void __init versatile_init(void)
 #ifdef CONFIG_LEDS
 	leds_event = versatile_leds_event;
 #endif
+
+	arm_arch_reset = versatile_arch_reset;
 }
 
 /*
diff --git a/arch/arm/mach-versatile/include/mach/system.h b/arch/arm/mach-versatile/include/mach/system.h
index 8ffc12a..ebc6348 100644
--- a/arch/arm/mach-versatile/include/mach/system.h
+++ b/arch/arm/mach-versatile/include/mach/system.h
@@ -36,14 +36,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	u32 val;
-
-	val = __raw_readl(IO_ADDRESS(VERSATILE_SYS_RESETCTL)) & ~0x7;
-	val |= 0x105;
-
-	__raw_writel(0xa05f, IO_ADDRESS(VERSATILE_SYS_LOCK));
-	__raw_writel(val, IO_ADDRESS(VERSATILE_SYS_RESETCTL));
-	__raw_writel(0, IO_ADDRESS(VERSATILE_SYS_LOCK));
 }
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 44/51] ARM: mach-vt8500: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (42 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 43/51] ARM: mach-versatile: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 45/51] ARM: mach-w90x900: " Will Deacon
                   ` (7 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-vt8500 to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-vt8500/Makefile              |    2 +-
 arch/arm/mach-vt8500/include/mach/system.h |    5 -----
 arch/arm/mach-vt8500/reset.c               |   21 +++++++++++++++++++++
 3 files changed, 22 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-vt8500/reset.c

diff --git a/arch/arm/mach-vt8500/Makefile b/arch/arm/mach-vt8500/Makefile
index 81aedb7..1932b82 100644
--- a/arch/arm/mach-vt8500/Makefile
+++ b/arch/arm/mach-vt8500/Makefile
@@ -1,4 +1,4 @@
-obj-y += devices.o gpio.o irq.o timer.o
+obj-y += devices.o gpio.o irq.o reset.o timer.o
 
 obj-$(CONFIG_VTWM_VERSION_VT8500) += devices-vt8500.o
 obj-$(CONFIG_VTWM_VERSION_WM8505) += devices-wm8505.o
diff --git a/arch/arm/mach-vt8500/include/mach/system.h b/arch/arm/mach-vt8500/include/mach/system.h
index d6c757e..4bbcce4 100644
--- a/arch/arm/mach-vt8500/include/mach/system.h
+++ b/arch/arm/mach-vt8500/include/mach/system.h
@@ -2,10 +2,6 @@
  * arch/arm/mach-vt8500/include/mach/system.h
  *
  */
-#include <asm/io.h>
-
-/* PM Software Reset request register */
-#define VT8500_PMSR_VIRT	0xf8130060
 
 static inline void arch_idle(void)
 {
@@ -14,5 +10,4 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	writel(1, VT8500_PMSR_VIRT);
 }
diff --git a/arch/arm/mach-vt8500/reset.c b/arch/arm/mach-vt8500/reset.c
new file mode 100644
index 0000000..631721a
--- /dev/null
+++ b/arch/arm/mach-vt8500/reset.c
@@ -0,0 +1,21 @@
+/*
+ * arch/arm/mach-vt8500/reset.c
+ */
+
+#include <linux/init.h>
+#include <asm/io.h>
+
+/* PM Software Reset request register */
+#define VT8500_PMSR_VIRT	0xf8130060
+
+static void vt8500_arch_reset(char mode, const char *cmd)
+{
+	writel(1, VT8500_PMSR_VIRT);
+}
+
+static int __init vt8500_arch_reset_init(void)
+{
+	arm_arch_reset = vt8500_arch_reset;
+	return 0;
+}
+arch_initcall(vt8500_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 45/51] ARM: mach-w90x900: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (43 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 44/51] ARM: mach-vt8500: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 46/51] ARM: plat-spear: " Will Deacon
                   ` (6 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates mach-w90x900 to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-w90x900/Makefile              |    2 +-
 arch/arm/mach-w90x900/include/mach/system.h |   19 +---------------
 arch/arm/mach-w90x900/reset.c               |   31 +++++++++++++++++++++++++++
 3 files changed, 33 insertions(+), 19 deletions(-)
 create mode 100644 arch/arm/mach-w90x900/reset.c

diff --git a/arch/arm/mach-w90x900/Makefile b/arch/arm/mach-w90x900/Makefile
index 828c032..e771d1b 100644
--- a/arch/arm/mach-w90x900/Makefile
+++ b/arch/arm/mach-w90x900/Makefile
@@ -5,7 +5,7 @@
 # Object file lists.
 
 obj-y				:= irq.o time.o mfp.o gpio.o clock.o
-obj-y				+= clksel.o dev.o cpu.o
+obj-y				+= clksel.o dev.o cpu.o reset.o
 # W90X900 CPU support files
 
 obj-$(CONFIG_CPU_W90P910)	+= nuc910.o
diff --git a/arch/arm/mach-w90x900/include/mach/system.h b/arch/arm/mach-w90x900/include/mach/system.h
index ce228bd..ed3478b 100644
--- a/arch/arm/mach-w90x900/include/mach/system.h
+++ b/arch/arm/mach-w90x900/include/mach/system.h
@@ -15,27 +15,10 @@
  *
  */
 
-#include <linux/io.h>
-#include <asm/proc-fns.h>
-#include <mach/map.h>
-#include <mach/regs-timer.h>
-
-#define	WTCR	(TMR_BA + 0x1C)
-#define	WTCLK	(1 << 10)
-#define	WTE	(1 << 7)
-#define	WTRE	(1 << 1)
-
 static void arch_idle(void)
 {
 }
 
-static void arch_reset(char mode, const char *cmd)
+static inline void arch_reset(char mode, const char *cmd)
 {
-	if (mode == 's') {
-		/* Jump into ROM@address 0 */
-		cpu_reset(0);
-	} else {
-		__raw_writel(WTE | WTRE | WTCLK, WTCR);
-	}
 }
-
diff --git a/arch/arm/mach-w90x900/reset.c b/arch/arm/mach-w90x900/reset.c
new file mode 100644
index 0000000..08f1953
--- /dev/null
+++ b/arch/arm/mach-w90x900/reset.c
@@ -0,0 +1,31 @@
+/*
+ * arch/arm/mach-w90x900/reset.c
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <asm/proc-fns.h>
+#include <mach/map.h>
+#include <mach/regs-timer.h>
+
+#define	WTCR	(TMR_BA + 0x1C)
+#define	WTCLK	(1 << 10)
+#define	WTE	(1 << 7)
+#define	WTRE	(1 << 1)
+
+static void w90x900_arch_reset(char mode, const char *cmd)
+{
+	if (mode == 's') {
+		/* Jump into ROM@address 0 */
+		cpu_reset(0);
+	} else {
+		__raw_writel(WTE | WTRE | WTCLK, WTCR);
+	}
+}
+
+static int __init w90x900_arch_reset_init(void)
+{
+	arm_arch_reset = w90x900_arch_reset;
+	return 0;
+}
+arch_initcall(w90x900_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 46/51] ARM: plat-spear: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (44 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 45/51] ARM: mach-w90x900: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 47/51] ARM: plat-tcc: " Will Deacon
                   ` (5 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates plat-spear to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/plat-spear/Makefile              |    2 +-
 arch/arm/plat-spear/include/plat/system.h |   11 -----------
 arch/arm/plat-spear/reset.c               |   29 +++++++++++++++++++++++++++++
 3 files changed, 30 insertions(+), 12 deletions(-)
 create mode 100644 arch/arm/plat-spear/reset.c

diff --git a/arch/arm/plat-spear/Makefile b/arch/arm/plat-spear/Makefile
index b4f340b..cb70a42 100644
--- a/arch/arm/plat-spear/Makefile
+++ b/arch/arm/plat-spear/Makefile
@@ -3,6 +3,6 @@
 #
 
 # Common support
-obj-y	:= clock.o time.o
+obj-y	:= clock.o reset.o time.o
 
 obj-$(CONFIG_ARCH_SPEAR3XX)	+= shirq.o padmux.o
diff --git a/arch/arm/plat-spear/include/plat/system.h b/arch/arm/plat-spear/include/plat/system.h
index a235fa0..4a0d125 100644
--- a/arch/arm/plat-spear/include/plat/system.h
+++ b/arch/arm/plat-spear/include/plat/system.h
@@ -14,10 +14,6 @@
 #ifndef __PLAT_SYSTEM_H
 #define __PLAT_SYSTEM_H
 
-#include <linux/io.h>
-#include <asm/hardware/sp810.h>
-#include <mach/hardware.h>
-
 static inline void arch_idle(void)
 {
 	/*
@@ -29,13 +25,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	if (mode == 's') {
-		/* software reset, Jump into ROM at address 0 */
-		cpu_reset(0);
-	} else {
-		/* hardware reset, Use on-chip reset capability */
-		sysctl_soft_reset((void __iomem *)VA_SPEAR_SYS_CTRL_BASE);
-	}
 }
 
 #endif /* __PLAT_SYSTEM_H */
diff --git a/arch/arm/plat-spear/reset.c b/arch/arm/plat-spear/reset.c
new file mode 100644
index 0000000..607efb3
--- /dev/null
+++ b/arch/arm/plat-spear/reset.c
@@ -0,0 +1,29 @@
+/*
+ * arch/arm/plat-spear/reset.c
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+
+#include <asm/proc-fns.h>
+#include <asm/hardware/sp810.h>
+
+#include <mach/hardware.h>
+
+static void spear_arch_reset(char mode, const char *cmd)
+{
+	if (mode == 's') {
+		/* software reset, Jump into ROM at address 0 */
+		cpu_reset(0);
+	} else {
+		/* hardware reset, Use on-chip reset capability */
+		sysctl_soft_reset((void __iomem *)VA_SPEAR_SYS_CTRL_BASE);
+	}
+}
+
+static int __init spear_arch_reset_init(void)
+{
+	arm_arch_reset = spear_arch_reset;
+	return 0;
+}
+arch_initcall(spear_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 47/51] ARM: plat-tcc: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (45 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 46/51] ARM: plat-spear: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 48/51] ARM: plat-s5p: " Will Deacon
                   ` (4 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates plat-tcc to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/plat-tcc/include/mach/system.h |    5 -----
 arch/arm/plat-tcc/system.c              |   10 +++++++++-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-tcc/include/mach/system.h b/arch/arm/plat-tcc/include/mach/system.h
index 909e603..e97ae31 100644
--- a/arch/arm/plat-tcc/include/mach/system.h
+++ b/arch/arm/plat-tcc/include/mach/system.h
@@ -11,10 +11,6 @@
 
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H
-#include <linux/clk.h>
-
-#include <asm/mach-types.h>
-#include <mach/hardware.h>
 
 extern void plat_tcc_reboot(void);
 
@@ -25,7 +21,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	plat_tcc_reboot();
 }
 
 #endif
diff --git a/arch/arm/plat-tcc/system.c b/arch/arm/plat-tcc/system.c
index cc208fa..c3badd5 100644
--- a/arch/arm/plat-tcc/system.c
+++ b/arch/arm/plat-tcc/system.c
@@ -7,12 +7,13 @@
  *
  */
 
+#include <linux/init.h>
 #include <linux/io.h>
 
 #include <mach/tcc8k-regs.h>
 
 /* System reboot */
-void plat_tcc_reboot(void)
+static void plat_tcc_reboot(char mode, const char *cmd)
 {
 	/* Make sure clocks are on */
 	__raw_writel(0xffffffff, CKC_BASE + BCLKCTR0_OFFS);
@@ -23,3 +24,10 @@ void plat_tcc_reboot(void)
 	while(1)
 		;
 }
+
+static int __init plat_tcc_reboot_init(void)
+{
+	arm_arch_reset = plat_tcc_reboot;
+	return 0;
+}
+arch_initcall(plat_tcc_reboot);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 48/51] ARM: plat-s5p: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (46 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 47/51] ARM: plat-tcc: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 49/51] ARM: plat-mxc: " Will Deacon
                   ` (3 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates plat-s5p to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-exynos4/include/mach/system.h        |    2 --
 arch/arm/mach-s5p64x0/include/mach/system.h        |    2 --
 arch/arm/mach-s5pc100/include/mach/system.h        |    2 --
 arch/arm/mach-s5pv210/include/mach/system.h        |    2 --
 arch/arm/plat-s5p/Makefile                         |    1 +
 .../plat/system-reset.h => system-reset.c}         |   17 +++++++++++++----
 6 files changed, 14 insertions(+), 12 deletions(-)
 rename arch/arm/plat-s5p/{include/plat/system-reset.h => system-reset.c} (66%)

diff --git a/arch/arm/mach-exynos4/include/mach/system.h b/arch/arm/mach-exynos4/include/mach/system.h
index 5e3220c..0063a6d 100644
--- a/arch/arm/mach-exynos4/include/mach/system.h
+++ b/arch/arm/mach-exynos4/include/mach/system.h
@@ -13,8 +13,6 @@
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H __FILE__
 
-#include <plat/system-reset.h>
-
 static void arch_idle(void)
 {
 	/* nothing here yet */
diff --git a/arch/arm/mach-s5p64x0/include/mach/system.h b/arch/arm/mach-s5p64x0/include/mach/system.h
index 60f5753..cf26e09 100644
--- a/arch/arm/mach-s5p64x0/include/mach/system.h
+++ b/arch/arm/mach-s5p64x0/include/mach/system.h
@@ -13,8 +13,6 @@
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H __FILE__
 
-#include <plat/system-reset.h>
-
 static void arch_idle(void)
 {
 	/* nothing here yet */
diff --git a/arch/arm/mach-s5pc100/include/mach/system.h b/arch/arm/mach-s5pc100/include/mach/system.h
index a9ea57c..afc96c2 100644
--- a/arch/arm/mach-s5pc100/include/mach/system.h
+++ b/arch/arm/mach-s5pc100/include/mach/system.h
@@ -11,8 +11,6 @@
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H __FILE__
 
-#include <plat/system-reset.h>
-
 static void arch_idle(void)
 {
 	/* nothing here yet */
diff --git a/arch/arm/mach-s5pv210/include/mach/system.h b/arch/arm/mach-s5pv210/include/mach/system.h
index af8a200..bf288ce 100644
--- a/arch/arm/mach-s5pv210/include/mach/system.h
+++ b/arch/arm/mach-s5pv210/include/mach/system.h
@@ -13,8 +13,6 @@
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H __FILE__
 
-#include <plat/system-reset.h>
-
 static void arch_idle(void)
 {
 	/* nothing here yet */
diff --git a/arch/arm/plat-s5p/Makefile b/arch/arm/plat-s5p/Makefile
index 4b53e04..2511d58 100644
--- a/arch/arm/plat-s5p/Makefile
+++ b/arch/arm/plat-s5p/Makefile
@@ -16,6 +16,7 @@ obj-y				+= dev-pmu.o
 obj-y				+= dev-uart.o
 obj-y				+= cpu.o
 obj-y				+= clock.o
+obj-y				+= system-reset.o
 obj-y				+= irq.o
 obj-$(CONFIG_S5P_EXT_INT)	+= irq-eint.o
 obj-$(CONFIG_S5P_GPIO_INT)	+= irq-gpioint.o
diff --git a/arch/arm/plat-s5p/include/plat/system-reset.h b/arch/arm/plat-s5p/system-reset.c
similarity index 66%
rename from arch/arm/plat-s5p/include/plat/system-reset.h
rename to arch/arm/plat-s5p/system-reset.c
index f307f34..84a38ab 100644
--- a/arch/arm/plat-s5p/include/plat/system-reset.h
+++ b/arch/arm/plat-s5p/system-reset.c
@@ -1,22 +1,24 @@
-/* linux/arch/arm/plat-s5p/include/plat/system-reset.h
+/* linux/arch/arm/plat-s5p/system-reset.c
  *
  * Copyright (c) 2010 Samsung Electronics Co., Ltd.
  *		http://www.samsung.com
  *
  * Based on arch/arm/mach-s3c2410/include/mach/system-reset.h
  *
- * S5P - System define for arch_reset()
- *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
 */
 
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <asm/system.h>
+
 #include <plat/watchdog-reset.h>
 
 void (*s5p_reset_hook)(void);
 
-static void arch_reset(char mode, const char *cmd)
+static void s5p_arch_reset(char mode, const char *cmd)
 {
 	/* SWRESET support in s5p_reset_hook() */
 
@@ -29,3 +31,10 @@ static void arch_reset(char mode, const char *cmd)
 
 	arch_wdt_reset();
 }
+
+static int __init s5p_arch_reset_init(void)
+{
+	arm_arch_reset = s5p_arch_reset;
+	return 0;
+}
+arch_initcall(s5p_arch_reset_init);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 49/51] ARM: plat-mxc: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (47 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 48/51] ARM: plat-s5p: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 50/51] ARM: plat-s3c24xx: " Will Deacon
                   ` (2 subsequent siblings)
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates plat-mxc to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/plat-mxc/include/mach/system.h |    2 --
 arch/arm/plat-mxc/system.c              |    3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm/plat-mxc/include/mach/system.h b/arch/arm/plat-mxc/include/mach/system.h
index 51f02a9..0cce970 100644
--- a/arch/arm/plat-mxc/include/mach/system.h
+++ b/arch/arm/plat-mxc/include/mach/system.h
@@ -56,6 +56,4 @@ static inline void arch_idle(void)
 		cpu_do_idle();
 }
 
-void arch_reset(char mode, const char *cmd);
-
 #endif /* __ASM_ARCH_MXC_SYSTEM_H__ */
diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c
index 8024f2a..107e0a6 100644
--- a/arch/arm/plat-mxc/system.c
+++ b/arch/arm/plat-mxc/system.c
@@ -33,7 +33,7 @@ static void __iomem *wdog_base;
 /*
  * Reset the system. It is called by machine_restart().
  */
-void arch_reset(char mode, const char *cmd)
+static void mxc_arch_reset(char mode, const char *cmd)
 {
 	unsigned int wcr_enable;
 
@@ -73,4 +73,5 @@ void arch_reset(char mode, const char *cmd)
 void mxc_arch_reset_init(void __iomem *base)
 {
 	wdog_base = base;
+	arm_arch_reset = mxc_arch_reset;
 }
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 50/51] ARM: plat-s3c24xx: use arm_arch_reset instead of arch_reset
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (48 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 49/51] ARM: plat-mxc: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 14:44 ` [PATCH 51/51] ARM: reset: remove empty arch_reset definitions Will Deacon
  2011-10-28 22:08 ` [PATCH 00/51] Remove inline arch_reset definitions from system.h Deepak Saxena
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates plat-s3c24xx to use arm_arch_reset instead of
arch_reset.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mach-s3c2410/include/mach/system-reset.h |   32 ---------------------
 arch/arm/mach-s3c2410/include/mach/system.h       |    2 -
 arch/arm/mach-s3c64xx/include/mach/system.h       |    2 +-
 arch/arm/plat-s3c24xx/cpu.c                       |   23 +++++++++++++--
 4 files changed, 21 insertions(+), 38 deletions(-)
 delete mode 100644 arch/arm/mach-s3c2410/include/mach/system-reset.h

diff --git a/arch/arm/mach-s3c2410/include/mach/system-reset.h b/arch/arm/mach-s3c2410/include/mach/system-reset.h
deleted file mode 100644
index 6faadce..0000000
--- a/arch/arm/mach-s3c2410/include/mach/system-reset.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* arch/arm/mach-s3c2410/include/mach/system-reset.h
- *
- * Copyright (c) 2008 Simtec Electronics
- *	Ben Dooks <ben@simtec.co.uk>
- *
- * S3C2410 - System define for arch_reset() function
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#include <mach/hardware.h>
-#include <plat/watchdog-reset.h>
-
-extern void (*s3c24xx_reset_hook)(void);
-
-static void
-arch_reset(char mode, const char *cmd)
-{
-	if (mode == 's') {
-		cpu_reset(0);
-	}
-
-	if (s3c24xx_reset_hook)
-		s3c24xx_reset_hook();
-
-	arch_wdt_reset();
-
-	/* we'll take a jump through zero as a poor second */
-	cpu_reset(0);
-}
diff --git a/arch/arm/mach-s3c2410/include/mach/system.h b/arch/arm/mach-s3c2410/include/mach/system.h
index a8cbca6..a94e7a6 100644
--- a/arch/arm/mach-s3c2410/include/mach/system.h
+++ b/arch/arm/mach-s3c2410/include/mach/system.h
@@ -54,5 +54,3 @@ static void arch_idle(void)
 	else
 		s3c24xx_default_idle();
 }
-
-#include <mach/system-reset.h>
diff --git a/arch/arm/mach-s3c64xx/include/mach/system.h b/arch/arm/mach-s3c64xx/include/mach/system.h
index 51bc8eb..436a8b3 100644
--- a/arch/arm/mach-s3c64xx/include/mach/system.h
+++ b/arch/arm/mach-s3c64xx/include/mach/system.h
@@ -16,7 +16,7 @@ static void arch_idle(void)
 	/* nothing here yet */
 }
 
-static void arch_reset(char mode, const char *cmd)
+static inline void arch_reset(char mode, const char *cmd)
 {
 }
 
diff --git a/arch/arm/plat-s3c24xx/cpu.c b/arch/arm/plat-s3c24xx/cpu.c
index c1fc6c6..b8714db 100644
--- a/arch/arm/plat-s3c24xx/cpu.c
+++ b/arch/arm/plat-s3c24xx/cpu.c
@@ -38,8 +38,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/system-reset.h>
-
 #include <mach/regs-gpio.h>
 #include <plat/regs-serial.h>
 
@@ -51,6 +49,7 @@
 #include <plat/s3c2416.h>
 #include <plat/s3c244x.h>
 #include <plat/s3c2443.h>
+#include <plat/watchdog-reset.h>
 
 /* table of supported CPUs */
 
@@ -205,7 +204,7 @@ static void s3c24xx_pm_restart(char mode, const char *cmd)
 		__cpuc_flush_kern_all();
 		__cpuc_flush_user_all();
 
-		arch_reset(mode, cmd);
+		arm_arch_reset(mode, cmd);
 		local_irq_restore(flags);
 	}
 
@@ -213,6 +212,23 @@ static void s3c24xx_pm_restart(char mode, const char *cmd)
 	arm_machine_restart(mode, cmd);
 }
 
+extern void (*s3c24xx_reset_hook)(void);
+
+static void s3c24xx_arch_reset(char mode, const char *cmd)
+{
+	if (mode == 's') {
+		cpu_reset(0);
+	}
+
+	if (s3c24xx_reset_hook)
+		s3c24xx_reset_hook();
+
+	arch_wdt_reset();
+
+	/* we'll take a jump through zero as a poor second */
+	cpu_reset(0);
+}
+
 void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
 {
 	unsigned long idcode = 0x0;
@@ -227,6 +243,7 @@ void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
 		idcode = s3c24xx_read_idcode_v4();
 	}
 
+	arm_arch_reset = s3c24xx_arch_reset;
 	arm_pm_restart = s3c24xx_pm_restart;
 
 	s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 51/51] ARM: reset: remove empty arch_reset definitions
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (49 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 50/51] ARM: plat-s3c24xx: " Will Deacon
@ 2011-10-28 14:44 ` Will Deacon
  2011-10-28 22:08 ` [PATCH 00/51] Remove inline arch_reset definitions from system.h Deepak Saxena
  51 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-28 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

arch_reset is now an empty static inline function for all ARM platforms,
so remove it and the temporary_arm_arch_reset function.

I used this very basic Coccinelle script for the platform updates:

	@@
	@@
	- arch_reset(...) { }

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/kernel/process.c                      |    7 +------
 arch/arm/mach-at91/include/mach/system.h       |    4 ----
 arch/arm/mach-bcmring/include/mach/system.h    |    4 ----
 arch/arm/mach-clps711x/include/mach/system.h   |    4 ----
 arch/arm/mach-cns3xxx/include/mach/system.h    |    4 ----
 arch/arm/mach-davinci/include/mach/system.h    |    4 ----
 arch/arm/mach-dove/include/mach/system.h       |    4 ----
 arch/arm/mach-ebsa110/include/mach/system.h    |    4 ----
 arch/arm/mach-ep93xx/include/mach/system.h     |    4 ----
 arch/arm/mach-footbridge/include/mach/system.h |    4 ----
 arch/arm/mach-gemini/include/mach/system.h     |    4 ----
 arch/arm/mach-h720x/include/mach/system.h      |    5 -----
 arch/arm/mach-integrator/include/mach/system.h |    4 ----
 arch/arm/mach-iop13xx/include/mach/system.h    |    4 ----
 arch/arm/mach-iop32x/include/mach/system.h     |    4 ----
 arch/arm/mach-iop33x/include/mach/system.h     |    4 ----
 arch/arm/mach-ixp2000/include/mach/system.h    |    4 ----
 arch/arm/mach-ixp23xx/include/mach/system.h    |    4 ----
 arch/arm/mach-ixp4xx/include/mach/system.h     |    5 -----
 arch/arm/mach-kirkwood/include/mach/system.h   |    4 ----
 arch/arm/mach-ks8695/include/mach/system.h     |    4 ----
 arch/arm/mach-lpc32xx/include/mach/system.h    |    4 ----
 arch/arm/mach-mmp/include/mach/system.h        |    4 ----
 arch/arm/mach-msm/include/mach/system.h        |    4 ----
 arch/arm/mach-mv78xx0/include/mach/system.h    |    4 ----
 arch/arm/mach-mxs/include/mach/system.h        |    4 ----
 arch/arm/mach-netx/include/mach/system.h       |    4 ----
 arch/arm/mach-nomadik/include/mach/system.h    |    4 ----
 arch/arm/mach-nuc93x/include/mach/system.h     |    4 ----
 arch/arm/mach-orion5x/include/mach/system.h    |    4 ----
 arch/arm/mach-pnx4008/include/mach/system.h    |    4 ----
 arch/arm/mach-prima2/include/mach/system.h     |    4 ----
 arch/arm/mach-pxa/include/mach/system.h        |    5 -----
 arch/arm/mach-realview/include/mach/system.h   |    4 ----
 arch/arm/mach-rpc/include/mach/system.h        |    4 ----
 arch/arm/mach-s3c64xx/include/mach/system.h    |    4 ----
 arch/arm/mach-sa1100/include/mach/system.h     |    4 ----
 arch/arm/mach-shark/include/mach/system.h      |    3 ---
 arch/arm/mach-shmobile/include/mach/system.h   |    4 ----
 arch/arm/mach-tegra/include/mach/system.h      |    3 ---
 arch/arm/mach-u300/include/mach/system.h       |    4 ----
 arch/arm/mach-ux500/include/mach/system.h      |    5 -----
 arch/arm/mach-versatile/include/mach/system.h  |    4 ----
 arch/arm/mach-vexpress/include/mach/system.h   |    4 ----
 arch/arm/mach-vt8500/include/mach/system.h     |    4 ----
 arch/arm/mach-w90x900/include/mach/system.h    |    4 ----
 arch/arm/mach-zynq/include/mach/system.h       |    5 -----
 arch/arm/plat-omap/include/plat/system.h       |    3 ---
 arch/arm/plat-spear/include/plat/system.h      |    4 ----
 arch/arm/plat-tcc/include/mach/system.h        |    4 ----
 50 files changed, 1 insertions(+), 204 deletions(-)

diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 13e68c5..0594f4c 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -129,11 +129,6 @@ void arm_machine_restart(char mode, const char *cmd)
 	while (1);
 }
 
-static void temporary_arm_arch_reset(char mode, const char *cmd)
-{
-	arch_reset(mode, cmd);
-}
-
 /*
  * Function pointers to optional machine specific functions
  */
@@ -143,7 +138,7 @@ EXPORT_SYMBOL(pm_power_off);
 void (*arm_pm_restart)(char str, const char *cmd) = arm_machine_restart;
 EXPORT_SYMBOL_GPL(arm_pm_restart);
 
-void (*arm_arch_reset)(char mode, const char *cmd) = temporary_arm_arch_reset;
+void (*arm_arch_reset)(char mode, const char *cmd);
 EXPORT_SYMBOL_GPL(arm_arch_reset);
 
 static void do_nothing(void *unused)
diff --git a/arch/arm/mach-at91/include/mach/system.h b/arch/arm/mach-at91/include/mach/system.h
index 079eb12..cbd64f3 100644
--- a/arch/arm/mach-at91/include/mach/system.h
+++ b/arch/arm/mach-at91/include/mach/system.h
@@ -47,8 +47,4 @@ static inline void arch_idle(void)
 #endif
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-bcmring/include/mach/system.h b/arch/arm/mach-bcmring/include/mach/system.h
index 6cd872d..e7343c5 100644
--- a/arch/arm/mach-bcmring/include/mach/system.h
+++ b/arch/arm/mach-bcmring/include/mach/system.h
@@ -27,8 +27,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-clps711x/include/mach/system.h b/arch/arm/mach-clps711x/include/mach/system.h
index 9982deb..23d6ef8 100644
--- a/arch/arm/mach-clps711x/include/mach/system.h
+++ b/arch/arm/mach-clps711x/include/mach/system.h
@@ -32,8 +32,4 @@ static inline void arch_idle(void)
 	mov	r0, r0");
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-cns3xxx/include/mach/system.h b/arch/arm/mach-cns3xxx/include/mach/system.h
index 092d774..7f43a64 100644
--- a/arch/arm/mach-cns3xxx/include/mach/system.h
+++ b/arch/arm/mach-cns3xxx/include/mach/system.h
@@ -23,8 +23,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-davinci/include/mach/system.h b/arch/arm/mach-davinci/include/mach/system.h
index 6bd1dc0..fcb7a01 100644
--- a/arch/arm/mach-davinci/include/mach/system.h
+++ b/arch/arm/mach-davinci/include/mach/system.h
@@ -18,8 +18,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif /* __ASM_ARCH_SYSTEM_H */
diff --git a/arch/arm/mach-dove/include/mach/system.h b/arch/arm/mach-dove/include/mach/system.h
index ce3e749..21d651a 100644
--- a/arch/arm/mach-dove/include/mach/system.h
+++ b/arch/arm/mach-dove/include/mach/system.h
@@ -16,8 +16,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-ebsa110/include/mach/system.h b/arch/arm/mach-ebsa110/include/mach/system.h
index 574e633..2e4af65 100644
--- a/arch/arm/mach-ebsa110/include/mach/system.h
+++ b/arch/arm/mach-ebsa110/include/mach/system.h
@@ -34,8 +34,4 @@ static inline void arch_idle(void)
 	asm volatile ("mcr p15, 0, ip, c15, c1, 2" : : : "cc");
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-ep93xx/include/mach/system.h b/arch/arm/mach-ep93xx/include/mach/system.h
index ce48083..a2f0967 100644
--- a/arch/arm/mach-ep93xx/include/mach/system.h
+++ b/arch/arm/mach-ep93xx/include/mach/system.h
@@ -8,7 +8,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-footbridge/include/mach/system.h b/arch/arm/mach-footbridge/include/mach/system.h
index 0c19392..85f44ab 100644
--- a/arch/arm/mach-footbridge/include/mach/system.h
+++ b/arch/arm/mach-footbridge/include/mach/system.h
@@ -17,7 +17,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-gemini/include/mach/system.h b/arch/arm/mach-gemini/include/mach/system.h
index 7df8e48..3c4f114 100644
--- a/arch/arm/mach-gemini/include/mach/system.h
+++ b/arch/arm/mach-gemini/include/mach/system.h
@@ -28,8 +28,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif /* __MACH_SYSTEM_H */
diff --git a/arch/arm/mach-h720x/include/mach/system.h b/arch/arm/mach-h720x/include/mach/system.h
index 4c2fba9..16ac46e 100644
--- a/arch/arm/mach-h720x/include/mach/system.h
+++ b/arch/arm/mach-h720x/include/mach/system.h
@@ -24,9 +24,4 @@ static void arch_idle(void)
 	nop();
 }
 
-
-static __inline__ void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-integrator/include/mach/system.h b/arch/arm/mach-integrator/include/mach/system.h
index 6e5adbf..37314a2 100644
--- a/arch/arm/mach-integrator/include/mach/system.h
+++ b/arch/arm/mach-integrator/include/mach/system.h
@@ -32,8 +32,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-iop13xx/include/mach/system.h b/arch/arm/mach-iop13xx/include/mach/system.h
index 6b9bba7..9f0d83e 100644
--- a/arch/arm/mach-iop13xx/include/mach/system.h
+++ b/arch/arm/mach-iop13xx/include/mach/system.h
@@ -12,7 +12,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-iop32x/include/mach/system.h b/arch/arm/mach-iop32x/include/mach/system.h
index 094714d..0ee7dae 100644
--- a/arch/arm/mach-iop32x/include/mach/system.h
+++ b/arch/arm/mach-iop32x/include/mach/system.h
@@ -15,7 +15,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-iop33x/include/mach/system.h b/arch/arm/mach-iop33x/include/mach/system.h
index df98c56..04500c8 100644
--- a/arch/arm/mach-iop33x/include/mach/system.h
+++ b/arch/arm/mach-iop33x/include/mach/system.h
@@ -13,7 +13,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-ixp2000/include/mach/system.h b/arch/arm/mach-ixp2000/include/mach/system.h
index d79c7ad..47c8757 100644
--- a/arch/arm/mach-ixp2000/include/mach/system.h
+++ b/arch/arm/mach-ixp2000/include/mach/system.h
@@ -13,7 +13,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-ixp23xx/include/mach/system.h b/arch/arm/mach-ixp23xx/include/mach/system.h
index 4569003..3b89dd5 100644
--- a/arch/arm/mach-ixp23xx/include/mach/system.h
+++ b/arch/arm/mach-ixp23xx/include/mach/system.h
@@ -15,7 +15,3 @@ static inline void arch_idle(void)
 		cpu_do_idle();
 #endif
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-ixp4xx/include/mach/system.h b/arch/arm/mach-ixp4xx/include/mach/system.h
index ed5964c..5ac2578 100644
--- a/arch/arm/mach-ixp4xx/include/mach/system.h
+++ b/arch/arm/mach-ixp4xx/include/mach/system.h
@@ -18,8 +18,3 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 #endif
 }
-
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-kirkwood/include/mach/system.h b/arch/arm/mach-kirkwood/include/mach/system.h
index f094431..f85cf7f 100644
--- a/arch/arm/mach-kirkwood/include/mach/system.h
+++ b/arch/arm/mach-kirkwood/include/mach/system.h
@@ -14,9 +14,5 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 
 #endif
diff --git a/arch/arm/mach-ks8695/include/mach/system.h b/arch/arm/mach-ks8695/include/mach/system.h
index b73ee70..59fe992 100644
--- a/arch/arm/mach-ks8695/include/mach/system.h
+++ b/arch/arm/mach-ks8695/include/mach/system.h
@@ -24,8 +24,4 @@ static void arch_idle(void)
 
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-lpc32xx/include/mach/system.h b/arch/arm/mach-lpc32xx/include/mach/system.h
index 9c6cc0c..bf176c9 100644
--- a/arch/arm/mach-lpc32xx/include/mach/system.h
+++ b/arch/arm/mach-lpc32xx/include/mach/system.h
@@ -24,8 +24,4 @@ static void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-mmp/include/mach/system.h b/arch/arm/mach-mmp/include/mach/system.h
index b09c19a..f5add75 100644
--- a/arch/arm/mach-mmp/include/mach/system.h
+++ b/arch/arm/mach-mmp/include/mach/system.h
@@ -15,8 +15,4 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
 #endif /* __ASM_MACH_SYSTEM_H */
diff --git a/arch/arm/mach-msm/include/mach/system.h b/arch/arm/mach-msm/include/mach/system.h
index ab6590b..a8a53b2 100644
--- a/arch/arm/mach-msm/include/mach/system.h
+++ b/arch/arm/mach-msm/include/mach/system.h
@@ -16,7 +16,3 @@
 #include <mach/hardware.h>
 
 void arch_idle(void);
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-mv78xx0/include/mach/system.h b/arch/arm/mach-mv78xx0/include/mach/system.h
index 1a41dc5..dd7a016 100644
--- a/arch/arm/mach-mv78xx0/include/mach/system.h
+++ b/arch/arm/mach-mv78xx0/include/mach/system.h
@@ -16,9 +16,5 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 
 #endif
diff --git a/arch/arm/mach-mxs/include/mach/system.h b/arch/arm/mach-mxs/include/mach/system.h
index bcd8989..e7ad1bb 100644
--- a/arch/arm/mach-mxs/include/mach/system.h
+++ b/arch/arm/mach-mxs/include/mach/system.h
@@ -22,8 +22,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif /* __MACH_MXS_SYSTEM_H__ */
diff --git a/arch/arm/mach-netx/include/mach/system.h b/arch/arm/mach-netx/include/mach/system.h
index 83ae2b1..b38fa36 100644
--- a/arch/arm/mach-netx/include/mach/system.h
+++ b/arch/arm/mach-netx/include/mach/system.h
@@ -24,9 +24,5 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
 
diff --git a/arch/arm/mach-nomadik/include/mach/system.h b/arch/arm/mach-nomadik/include/mach/system.h
index 16f59f6..25e198b 100644
--- a/arch/arm/mach-nomadik/include/mach/system.h
+++ b/arch/arm/mach-nomadik/include/mach/system.h
@@ -29,8 +29,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-nuc93x/include/mach/system.h b/arch/arm/mach-nuc93x/include/mach/system.h
index a4d39a3..08188e7 100644
--- a/arch/arm/mach-nuc93x/include/mach/system.h
+++ b/arch/arm/mach-nuc93x/include/mach/system.h
@@ -18,7 +18,3 @@
 static void arch_idle(void)
 {
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-orion5x/include/mach/system.h b/arch/arm/mach-orion5x/include/mach/system.h
index 91a933c..997b13e 100644
--- a/arch/arm/mach-orion5x/include/mach/system.h
+++ b/arch/arm/mach-orion5x/include/mach/system.h
@@ -18,8 +18,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-pnx4008/include/mach/system.h b/arch/arm/mach-pnx4008/include/mach/system.h
index 6710ed3..60cfe71 100644
--- a/arch/arm/mach-pnx4008/include/mach/system.h
+++ b/arch/arm/mach-pnx4008/include/mach/system.h
@@ -26,8 +26,4 @@ static void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-prima2/include/mach/system.h b/arch/arm/mach-prima2/include/mach/system.h
index 1d14a77..98e5d83 100644
--- a/arch/arm/mach-prima2/include/mach/system.h
+++ b/arch/arm/mach-prima2/include/mach/system.h
@@ -16,8 +16,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-pxa/include/mach/system.h b/arch/arm/mach-pxa/include/mach/system.h
index 0687110..2ff62d6 100644
--- a/arch/arm/mach-pxa/include/mach/system.h
+++ b/arch/arm/mach-pxa/include/mach/system.h
@@ -16,8 +16,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-realview/include/mach/system.h b/arch/arm/mach-realview/include/mach/system.h
index 1630766..471b671 100644
--- a/arch/arm/mach-realview/include/mach/system.h
+++ b/arch/arm/mach-realview/include/mach/system.h
@@ -30,8 +30,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-rpc/include/mach/system.h b/arch/arm/mach-rpc/include/mach/system.h
index e9fb593..359bab9 100644
--- a/arch/arm/mach-rpc/include/mach/system.h
+++ b/arch/arm/mach-rpc/include/mach/system.h
@@ -11,7 +11,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-s3c64xx/include/mach/system.h b/arch/arm/mach-s3c64xx/include/mach/system.h
index 436a8b3..353ed43 100644
--- a/arch/arm/mach-s3c64xx/include/mach/system.h
+++ b/arch/arm/mach-s3c64xx/include/mach/system.h
@@ -16,8 +16,4 @@ static void arch_idle(void)
 	/* nothing here yet */
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-sa1100/include/mach/system.h b/arch/arm/mach-sa1100/include/mach/system.h
index ac3bdb8..6bcafe3 100644
--- a/arch/arm/mach-sa1100/include/mach/system.h
+++ b/arch/arm/mach-sa1100/include/mach/system.h
@@ -8,7 +8,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-shark/include/mach/system.h b/arch/arm/mach-shark/include/mach/system.h
index 2cc363a..c543685 100644
--- a/arch/arm/mach-shark/include/mach/system.h
+++ b/arch/arm/mach-shark/include/mach/system.h
@@ -6,9 +6,6 @@
 #ifndef __ASM_ARCH_SYSTEM_H
 #define __ASM_ARCH_SYSTEM_H
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
 
 static inline void arch_idle(void)
 {
diff --git a/arch/arm/mach-shmobile/include/mach/system.h b/arch/arm/mach-shmobile/include/mach/system.h
index 4f2bea5..e150937 100644
--- a/arch/arm/mach-shmobile/include/mach/system.h
+++ b/arch/arm/mach-shmobile/include/mach/system.h
@@ -6,8 +6,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-tegra/include/mach/system.h b/arch/arm/mach-tegra/include/mach/system.h
index b87b8a4..bc51978 100644
--- a/arch/arm/mach-tegra/include/mach/system.h
+++ b/arch/arm/mach-tegra/include/mach/system.h
@@ -21,9 +21,6 @@
 #ifndef __MACH_TEGRA_SYSTEM_H
 #define __MACH_TEGRA_SYSTEM_H
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
 
 static inline void arch_idle(void)
 {
diff --git a/arch/arm/mach-u300/include/mach/system.h b/arch/arm/mach-u300/include/mach/system.h
index 0ddf3cd..574d46e 100644
--- a/arch/arm/mach-u300/include/mach/system.h
+++ b/arch/arm/mach-u300/include/mach/system.h
@@ -12,7 +12,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-ux500/include/mach/system.h b/arch/arm/mach-ux500/include/mach/system.h
index c0cd800..258e5c9 100644
--- a/arch/arm/mach-ux500/include/mach/system.h
+++ b/arch/arm/mach-ux500/include/mach/system.h
@@ -17,9 +17,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-	/* yet to be implemented - TODO */
-}
-
 #endif
diff --git a/arch/arm/mach-versatile/include/mach/system.h b/arch/arm/mach-versatile/include/mach/system.h
index ebc6348..cc5cdd9 100644
--- a/arch/arm/mach-versatile/include/mach/system.h
+++ b/arch/arm/mach-versatile/include/mach/system.h
@@ -34,8 +34,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-vexpress/include/mach/system.h b/arch/arm/mach-vexpress/include/mach/system.h
index 899a4e6..f653a8e 100644
--- a/arch/arm/mach-vexpress/include/mach/system.h
+++ b/arch/arm/mach-vexpress/include/mach/system.h
@@ -30,8 +30,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
diff --git a/arch/arm/mach-vt8500/include/mach/system.h b/arch/arm/mach-vt8500/include/mach/system.h
index 4bbcce4..6daf809 100644
--- a/arch/arm/mach-vt8500/include/mach/system.h
+++ b/arch/arm/mach-vt8500/include/mach/system.h
@@ -7,7 +7,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-w90x900/include/mach/system.h b/arch/arm/mach-w90x900/include/mach/system.h
index ed3478b..da6e4e8 100644
--- a/arch/arm/mach-w90x900/include/mach/system.h
+++ b/arch/arm/mach-w90x900/include/mach/system.h
@@ -18,7 +18,3 @@
 static void arch_idle(void)
 {
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
diff --git a/arch/arm/mach-zynq/include/mach/system.h b/arch/arm/mach-zynq/include/mach/system.h
index 1b84d70..8e88e0b 100644
--- a/arch/arm/mach-zynq/include/mach/system.h
+++ b/arch/arm/mach-zynq/include/mach/system.h
@@ -20,9 +20,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-	/* Add architecture specific reset processing here */
-}
-
 #endif
diff --git a/arch/arm/plat-omap/include/plat/system.h b/arch/arm/plat-omap/include/plat/system.h
index ac32d88..91db6db 100644
--- a/arch/arm/plat-omap/include/plat/system.h
+++ b/arch/arm/plat-omap/include/plat/system.h
@@ -12,9 +12,6 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-/* To be removed in a future ARM-wide cleanup */
-static inline void arch_reset(char mode, const char *cmd) {}
-
 extern void omap1_arch_reset(char mode, const char *cmd);
 extern void omap_prcm_arch_reset(char mode, const char *cmd);
 
diff --git a/arch/arm/plat-spear/include/plat/system.h b/arch/arm/plat-spear/include/plat/system.h
index 4a0d125..86c6f83 100644
--- a/arch/arm/plat-spear/include/plat/system.h
+++ b/arch/arm/plat-spear/include/plat/system.h
@@ -23,8 +23,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif /* __PLAT_SYSTEM_H */
diff --git a/arch/arm/plat-tcc/include/mach/system.h b/arch/arm/plat-tcc/include/mach/system.h
index e97ae31..da3f019 100644
--- a/arch/arm/plat-tcc/include/mach/system.h
+++ b/arch/arm/plat-tcc/include/mach/system.h
@@ -19,8 +19,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 42/51] ARM: mach-u300: use arm_arch_reset instead of arch_reset
  2011-10-28 14:44 ` [PATCH 42/51] ARM: mach-u300: " Will Deacon
@ 2011-10-28 19:37   ` Linus Walleij
  0 siblings, 0 replies; 79+ messages in thread
From: Linus Walleij @ 2011-10-28 19:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Oct 28, 2011 at 4:44 PM, Will Deacon <will.deacon@arm.com> wrote:

> This patch updates mach-u300 to use arm_arch_reset instead of
> arch_reset.
>
> Signed-off-by: Will Deacon <will.deacon@arm.com>

Looks like a good idea so I applied patch 1 and this patch, and it JustWorks,
compiles, performs reset on the U300.

Tested-by: Linus Walleij <linus.walleij@linaro.org>
For patch 1 and 42.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-28 14:43 ` [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer Will Deacon
@ 2011-10-28 21:38   ` Jean-Christophe PLAGNIOL-VILLARD
  2011-10-29 13:59     ` Will Deacon
  2011-10-29 10:21   ` Russell King - ARM Linux
  1 sibling, 1 reply; 79+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-10-28 21:38 UTC (permalink / raw)
  To: linux-arm-kernel

On 15:43 Fri 28 Oct     , Will Deacon wrote:
> arch_reset is a static inline function defined in mach/system.h and, as
> such, is a blocker for the single zImage work.
> 
> This patch introduces an arm_arch_reset function pointer to which
> platforms can assign their reset function rather than define it in the
> header file.
this is a great cleanup but I think this should be done in the soc_desc
structure as propose before

Best Regards,
J.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 00/51] Remove inline arch_reset definitions from system.h
  2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
                   ` (50 preceding siblings ...)
  2011-10-28 14:44 ` [PATCH 51/51] ARM: reset: remove empty arch_reset definitions Will Deacon
@ 2011-10-28 22:08 ` Deepak Saxena
  2011-10-28 22:14   ` Deepak Saxena
  51 siblings, 1 reply; 79+ messages in thread
From: Deepak Saxena @ 2011-10-28 22:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Oct 28 2011, at 15:43, Will Deacon was caught saying:
> Well, looks like I finally made it and I reckon I've managed to preserve
> my sanity.
> 
> This patch series removes the inline arch_reset definitions from the
> mach/system.h files, which is currently a blocker for the single zImage
> work. Nicolas has some patches doing a similar thing for arch_idle. In
> cases where a new file has been introduced and it looks like arch_idle
> could co-exist in there, I've named the new file system.c but it will
> mean that Nicolas will need to rebase his stuff on top of this.
> 
> I think I've compile-tested this whenever I could identify the right
> defconfig, but my brain stopped working about 25% of the way through.
> 
> Thanks to Paul Walmsley for saving me from the OMAP changes.
> 
> Comments / suggestions / fixups welcome.

I like the idea, I'm wondering about having stuffing a pointer to 
an init function to assign the pointer into mach_desc? In the at91
case, we've got 7 board files assiging the same pointer. Instead
we could just have an at91_arch_reset_init() that only needs
to be in one .c file. 

Another idea is to just stuff the pointer to the machine's arch_reset
into the mach_desc and generic init code could read it. In the case 
of a some weird board version related quirk that can only be detected 
by some runtime register poking (i.e.  not via the DT machine 
compatability), we could update the pointer in machines' fixup() function.

~Deepak


-- 
"People think all we need to fix our predicament is a free source of
energy, but I think we need to change out behaviour. More energy would
just deplete the Earth's lifeblood faster." - Janine Benyius

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 34/51] ARM: mach-pxa: use arm_arch_reset instead of arch_reset
  2011-10-28 14:44 ` [PATCH 34/51] ARM: mach-pxa: " Will Deacon
@ 2011-10-28 22:12   ` Marek Vasut
  0 siblings, 0 replies; 79+ messages in thread
From: Marek Vasut @ 2011-10-28 22:12 UTC (permalink / raw)
  To: linux-arm-kernel

> This patch updates mach-pxa to use arm_arch_reset instead of
> arch_reset.
> 
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> ---
>  arch/arm/mach-pxa/include/mach/system.h |    6 +++---
>  arch/arm/mach-pxa/reset.c               |    8 +++++++-
>  2 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-pxa/include/mach/system.h
> b/arch/arm/mach-pxa/include/mach/system.h index d1fce8b..0687110 100644
> --- a/arch/arm/mach-pxa/include/mach/system.h
> +++ b/arch/arm/mach-pxa/include/mach/system.h
> @@ -11,8 +11,6 @@
>   */
> 
>  #include <asm/proc-fns.h>
> -#include "hardware.h"
> -#include "pxa2xx-regs.h"
> 
>  static inline void arch_idle(void)
>  {
> @@ -20,4 +18,6 @@ static inline void arch_idle(void)
>  }
> 
> 
> -void arch_reset(char mode, const char *cmd);
> +static inline void arch_reset(char mode, const char *cmd)
> +{
> +}
> diff --git a/arch/arm/mach-pxa/reset.c b/arch/arm/mach-pxa/reset.c
> index 01e9d64..075598a 100644
> --- a/arch/arm/mach-pxa/reset.c
> +++ b/arch/arm/mach-pxa/reset.c
> @@ -81,7 +81,7 @@ static void do_hw_reset(void)
>  	OSMR3 = OSCR + 368640;	/* ... in 100 ms */
>  }
> 
> -void arch_reset(char mode, const char *cmd)
> +static void pxa_arch_reset(char mode, const char *cmd)
>  {
>  	clear_reset_status(RESET_STATUS_ALL);
> 
> @@ -100,3 +100,9 @@ void arch_reset(char mode, const char *cmd)
>  	}
>  }
> 
> +static int __init pxa_arch_reset_init(void)
> +{
> +	arm_arch_reset = pxa_arch_reset;
> +	return 0;
> +}
> +arch_initcall(pxa_arch_reset_init);

Reviewed-by: Marek Vasut <marek.vasut@gmail.com>

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 00/51] Remove inline arch_reset definitions from system.h
  2011-10-28 22:08 ` [PATCH 00/51] Remove inline arch_reset definitions from system.h Deepak Saxena
@ 2011-10-28 22:14   ` Deepak Saxena
  0 siblings, 0 replies; 79+ messages in thread
From: Deepak Saxena @ 2011-10-28 22:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Oct 29, 2011 at 12:08 AM, Deepak Saxena <dsaxena@plexity.net> wrote:
> On Oct 28 2011, at 15:43, Will Deacon was caught saying:
>> Well, looks like I finally made it and I reckon I've managed to preserve
>> my sanity.
>>
>> This patch series removes the inline arch_reset definitions from the
>> mach/system.h files, which is currently a blocker for the single zImage
>> work. Nicolas has some patches doing a similar thing for arch_idle. In
>> cases where a new file has been introduced and it looks like arch_idle
>> could co-exist in there, I've named the new file system.c but it will
>> mean that Nicolas will need to rebase his stuff on top of this.
>>
>> I think I've compile-tested this whenever I could identify the right
>> defconfig, but my brain stopped working about 25% of the way through.
>>
>> Thanks to Paul Walmsley for saving me from the OMAP changes.
>>
>> Comments / suggestions / fixups welcome.
>
> I like the idea, I'm wondering about having stuffing a pointer to
> an init function to assign the pointer into mach_desc? In the at91
> case, we've got 7 board files assiging the same pointer. Instead
> we could just have an at91_arch_reset_init() that only needs
> to be in one .c file.

/ignore me. I missread the patch and though they were all being assigned
to the same function.

> Another idea is to just stuff the pointer to the machine's arch_reset
> into the mach_desc and generic init code could read it. In the case
> of a some weird board version related quirk that can only be detected
> by some runtime register poking (i.e. ?not via the DT machine
> compatability), we could update the pointer in machines' fixup() function.

~Deepak

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 33/51] ARM: mach-prima2: use arm_arch_reset instead of arch_reset
  2011-10-28 14:44 ` [PATCH 33/51] ARM: mach-prima2: " Will Deacon
@ 2011-10-29  9:41   ` Barry Song
  2011-10-29 13:58     ` Will Deacon
  0 siblings, 1 reply; 79+ messages in thread
From: Barry Song @ 2011-10-29  9:41 UTC (permalink / raw)
  To: linux-arm-kernel

2011/10/28 Will Deacon <will.deacon@arm.com>:
> This patch updates mach-prima2 to use arm_arch_reset instead of
> arch_reset.
>
> Signed-off-by: Will Deacon <will.deacon@arm.com>

Hi Will, i guess you can move the arch reset of prima2 to
arch/arm/mach-prima2/rstc.c instead of creating a new file. rstc is
the reset controller driver in prima2. so that is the right file to
place your codes. and you will not need to include system.h as well.

> ---
> ?arch/arm/mach-prima2/Makefile ? ? ? ? ? ? ?| ? ?1 +
> ?arch/arm/mach-prima2/include/mach/system.h | ? ?6 ------
> ?arch/arm/mach-prima2/reset.c ? ? ? ? ? ? ? | ? 22 ++++++++++++++++++++++
> ?3 files changed, 23 insertions(+), 6 deletions(-)
> ?create mode 100644 arch/arm/mach-prima2/reset.c
>
> diff --git a/arch/arm/mach-prima2/Makefile b/arch/arm/mach-prima2/Makefile
> index 7af7fc0..75a7127 100644
> --- a/arch/arm/mach-prima2/Makefile
> +++ b/arch/arm/mach-prima2/Makefile
> @@ -2,6 +2,7 @@ obj-y := timer.o
> ?obj-y += irq.o
> ?obj-y += clock.o
> ?obj-y += rstc.o
> +obj-y += reset.o
> ?obj-y += prima2.o
> ?obj-$(CONFIG_DEBUG_LL) += lluart.o
> ?obj-$(CONFIG_CACHE_L2X0) += l2x0.o
> diff --git a/arch/arm/mach-prima2/include/mach/system.h b/arch/arm/mach-prima2/include/mach/system.h
> index 0dbd257..1d14a77 100644
> --- a/arch/arm/mach-prima2/include/mach/system.h
> +++ b/arch/arm/mach-prima2/include/mach/system.h
> @@ -9,11 +9,6 @@
> ?#ifndef __MACH_SYSTEM_H__
> ?#define __MACH_SYSTEM_H__
>
> -#include <linux/bitops.h>
> -#include <mach/hardware.h>
> -
> -#define SIRFSOC_SYS_RST_BIT ?BIT(31)
> -
> ?extern void __iomem *sirfsoc_rstc_base;
>
> ?static inline void arch_idle(void)
> @@ -23,7 +18,6 @@ static inline void arch_idle(void)
>
> ?static inline void arch_reset(char mode, const char *cmd)
> ?{
> - ? ? ? writel(SIRFSOC_SYS_RST_BIT, sirfsoc_rstc_base);
> ?}
>
> ?#endif
> diff --git a/arch/arm/mach-prima2/reset.c b/arch/arm/mach-prima2/reset.c
> new file mode 100644
> index 0000000..5473ae8
> --- /dev/null
> +++ b/arch/arm/mach-prima2/reset.c
> @@ -0,0 +1,22 @@
> +/*
> + * arch/arm/mach-prima2/reset.c
> + */
> +
> +#include <linux/init.h>
> +#include <linux/bitops.h>
> +#include <mach/hardware.h>
> +#include <asm/system.h>
> +
> +#define SIRFSOC_SYS_RST_BIT ?BIT(31)
> +
> +static void prima2_arch_reset(char mode, const char *cmd)
> +{
> + ? ? ? writel(SIRFSOC_SYS_RST_BIT, sirfsoc_rstc_base);
> +}
> +
> +static int __init prima2_arch_reset_init(void)
> +{
> + ? ? ? arm_arch_reset = prima2_arch_reset;
> + ? ? ? return 0;
> +}
> +arch_initcall(prima2_arch_reset_init);
> --
> 1.7.4.1

Thanks
barry

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-28 14:43 ` [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer Will Deacon
  2011-10-28 21:38   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-10-29 10:21   ` Russell King - ARM Linux
  2011-10-29 13:56     ` Will Deacon
  1 sibling, 1 reply; 79+ messages in thread
From: Russell King - ARM Linux @ 2011-10-29 10:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Oct 28, 2011 at 03:43:29PM +0100, Will Deacon wrote:
> arch_reset is a static inline function defined in mach/system.h and, as
> such, is a blocker for the single zImage work.
> 
> This patch introduces an arm_arch_reset function pointer to which
> platforms can assign their reset function rather than define it in the
> header file.

I think this is slightly the wrong approach.  We already have:

void (*arm_pm_restart)(char str, const char *cmd) = arm_machine_restart;
EXPORT_SYMBOL_GPL(arm_pm_restart);

so why do we need a new function pointer?  We could convert the bulk of
arm_machine_restart() to a library function (setup_restart()), moving
the failure to reboot into machine_restart().

This would then allow everyone to hook into the restart via the same
method irrespective of what they want, and if they want the old
'arch_reset' way, call setup_restart() themselves.

IOW, something like this:

 arch/arm/include/asm/system.h |    2 +-
 arch/arm/kernel/process.c     |   30 +++++++++++++++++-------------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 984014b..62a3c3d 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -100,7 +100,7 @@ extern void __show_regs(struct pt_regs *);
 extern int __pure cpu_architecture(void);
 extern void cpu_init(void);
 
-void arm_machine_restart(char mode, const char *cmd);
+void setup_restart(char mode);
 extern void (*arm_pm_restart)(char str, const char *cmd);
 
 #define UDBG_UNDEFINED	(1 << 0)
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index fd08140..ba91ec4 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -92,7 +92,7 @@ static int __init hlt_setup(char *__unused)
 __setup("nohlt", nohlt_setup);
 __setup("hlt", hlt_setup);
 
-void arm_machine_restart(char mode, const char *cmd)
+void setup_restart(char mode)
 {
 	/* Disable interrupts first */
 	local_irq_disable();
@@ -113,19 +113,15 @@ void arm_machine_restart(char mode, const char *cmd)
 
 	/* Push out any further dirty data, and ensure cache is empty */
 	flush_cache_all();
+}
+EXPORT_SYMBOL_GPL(setup_restart);
 
-	/*
-	 * Now call the architecture specific reboot code.
-	 */
-	arch_reset(mode, cmd);
+static void default_restart(char mode, const char *cmd)
+{
+	setup_restart(mode);
 
-	/*
-	 * Whoops - the architecture was unable to reboot.
-	 * Tell the user!
-	 */
-	mdelay(1000);
-	printk("Reboot failed -- System halted\n");
-	while (1);
+	/* Now call the architecture specific reboot code. */
+	arch_reset(mode, cmd);
 }
 
 /*
@@ -134,7 +130,7 @@ void arm_machine_restart(char mode, const char *cmd)
 void (*pm_power_off)(void);
 EXPORT_SYMBOL(pm_power_off);
 
-void (*arm_pm_restart)(char str, const char *cmd) = arm_machine_restart;
+void (*arm_pm_restart)(char mode, const char *cmd) = default_restart;
 EXPORT_SYMBOL_GPL(arm_pm_restart);
 
 static void do_nothing(void *unused)
@@ -250,7 +246,15 @@ void machine_power_off(void)
 void machine_restart(char *cmd)
 {
 	machine_shutdown();
+
 	arm_pm_restart(reboot_mode, cmd);
+
+	/* Give a grace period for failure to restart of 1s */
+	mdelay(1000);
+
+	/* Whoops - the platform was unable to reboot. Tell the user! */
+	printk("Reboot failed -- System halted\n");
+	while (1);
 }
 
 void __show_regs(struct pt_regs *regs)

^ permalink raw reply related	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-29 10:21   ` Russell King - ARM Linux
@ 2011-10-29 13:56     ` Will Deacon
  2011-10-29 20:05       ` Russell King - ARM Linux
                         ` (3 more replies)
  0 siblings, 4 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-29 13:56 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Russell,

On Sat, Oct 29, 2011 at 11:21:08AM +0100, Russell King - ARM Linux wrote:
> On Fri, Oct 28, 2011 at 03:43:29PM +0100, Will Deacon wrote:
> > arch_reset is a static inline function defined in mach/system.h and, as
> > such, is a blocker for the single zImage work.
> > 
> > This patch introduces an arm_arch_reset function pointer to which
> > platforms can assign their reset function rather than define it in the
> > header file.
> 
> I think this is slightly the wrong approach.  We already have:
> 
> void (*arm_pm_restart)(char str, const char *cmd) = arm_machine_restart;
> EXPORT_SYMBOL_GPL(arm_pm_restart);
> 
> so why do we need a new function pointer?  We could convert the bulk of
> arm_machine_restart() to a library function (setup_restart()), moving
> the failure to reboot into machine_restart().

Funny you should mention this approach. I've been toying with something
similar for the kexec reset path but I hadn't managed to join the dots
between that and the arch_reset code.

I initially observed this in the idle code, where it looks to me like all
the pm_idle overrides could actually be done in the arch_idle hook (the only
slightly fiddly one is OMAP). Maybe Nicolas could use the same sort of
approach for that?

> This would then allow everyone to hook into the restart via the same
> method irrespective of what they want, and if they want the old
> 'arch_reset' way, call setup_restart() themselves.

Yup, it's a fantastic idea because it allows us to put all of the identity
mapping bits into setup_restart as well. So then platforms make the choice
about the mapping they want, rather than being told via the reboot mode.

The only downside is that I have to go over all of the platforms again
unless I can polish up my Coccinelle-fu. Ho-hum.

> IOW, something like this:
> 
>  arch/arm/include/asm/system.h |    2 +-
>  arch/arm/kernel/process.c     |   30 +++++++++++++++++-------------
>  2 files changed, 18 insertions(+), 14 deletions(-)

[...]

I'll give this a go for v2, thanks. Once this is sorted out I'll do a second
pass to clean up the reboot modes since I've already got some patches for
that.

Cheers,

Will

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 33/51] ARM: mach-prima2: use arm_arch_reset instead of arch_reset
  2011-10-29  9:41   ` Barry Song
@ 2011-10-29 13:58     ` Will Deacon
  0 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-29 13:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Oct 29, 2011 at 10:41:09AM +0100, Barry Song wrote:
> 2011/10/28 Will Deacon <will.deacon@arm.com>:
> > This patch updates mach-prima2 to use arm_arch_reset instead of
> > arch_reset.
> >
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> 
> Hi Will, i guess you can move the arch reset of prima2 to
> arch/arm/mach-prima2/rstc.c instead of creating a new file. rstc is
> the reset controller driver in prima2. so that is the right file to
> place your codes. and you will not need to include system.h as well.

Aha! rstc is a reset controller rather than a dyslexic realtime clock. Thanks,
I'll used that file for v2 if needed.

Will

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-28 21:38   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-10-29 13:59     ` Will Deacon
  0 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-29 13:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Oct 28, 2011 at 10:38:50PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 15:43 Fri 28 Oct     , Will Deacon wrote:
> > arch_reset is a static inline function defined in mach/system.h and, as
> > such, is a blocker for the single zImage work.
> > 
> > This patch introduces an arm_arch_reset function pointer to which
> > platforms can assign their reset function rather than define it in the
> > header file.
> this is a great cleanup but I think this should be done in the soc_desc
> structure as propose before

Right, but that's not in mainline. Given that it looks like arm_pm_restart
is the hook we're going to go with then we can always move it into the SoC
descriptor later on.

Will

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-29 13:56     ` Will Deacon
@ 2011-10-29 20:05       ` Russell King - ARM Linux
  2011-10-30 21:07         ` Will Deacon
  2011-10-31 12:06       ` Russell King - ARM Linux
                         ` (2 subsequent siblings)
  3 siblings, 1 reply; 79+ messages in thread
From: Russell King - ARM Linux @ 2011-10-29 20:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Oct 29, 2011 at 02:56:53PM +0100, Will Deacon wrote:
> Hi Russell,
> 
> On Sat, Oct 29, 2011 at 11:21:08AM +0100, Russell King - ARM Linux wrote:
> > I think this is slightly the wrong approach.  We already have:
> > 
> > void (*arm_pm_restart)(char str, const char *cmd) = arm_machine_restart;
> > EXPORT_SYMBOL_GPL(arm_pm_restart);
> > 
> > so why do we need a new function pointer?  We could convert the bulk of
> > arm_machine_restart() to a library function (setup_restart()), moving
> > the failure to reboot into machine_restart().
> 
> Funny you should mention this approach. I've been toying with something
> similar for the kexec reset path but I hadn't managed to join the dots
> between that and the arch_reset code.
> 
> I initially observed this in the idle code, where it looks to me like all
> the pm_idle overrides could actually be done in the arch_idle hook (the only
> slightly fiddly one is OMAP). Maybe Nicolas could use the same sort of
> approach for that?

Beware about changing the semantics of pm_idle - it's a cross-arch thing,
and we really shouldn't change those semantics without changing the other
architectures as well.

> I'll give this a go for v2, thanks. Once this is sorted out I'll do a second
> pass to clean up the reboot modes since I've already got some patches for
> that.

Great.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-29 20:05       ` Russell King - ARM Linux
@ 2011-10-30 21:07         ` Will Deacon
  0 siblings, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-30 21:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Oct 29, 2011 at 09:05:48PM +0100, Russell King - ARM Linux wrote:
> On Sat, Oct 29, 2011 at 02:56:53PM +0100, Will Deacon wrote:
> > I initially observed this in the idle code, where it looks to me like all
> > the pm_idle overrides could actually be done in the arch_idle hook (the only
> > slightly fiddly one is OMAP). Maybe Nicolas could use the same sort of
> > approach for that?
> 
> Beware about changing the semantics of pm_idle - it's a cross-arch thing,
> and we really shouldn't change those semantics without changing the other
> architectures as well.

Indeed. I'm not suggesting making any changes to pm_idle, I'm just pointing
out that all of the pm_idle overrides for ARM can be written as:

	if (!need_resched())
		do_magic_soc_specific_idle();
	local_irq_enable();

so the platform magic may as well just be implemented using arch_idle and we
can remove the ability to reassign pm_idle, therefore consolidating the
platform idle code into one function pointer.

Will

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-29 13:56     ` Will Deacon
  2011-10-29 20:05       ` Russell King - ARM Linux
@ 2011-10-31 12:06       ` Russell King - ARM Linux
  2011-10-31 13:53         ` Will Deacon
  2011-11-01 18:05         ` Will Deacon
  2011-10-31 14:13       ` Russell King - ARM Linux
  2011-10-31 22:43       ` Nicolas Pitre
  3 siblings, 2 replies; 79+ messages in thread
From: Russell King - ARM Linux @ 2011-10-31 12:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Oct 29, 2011 at 02:56:53PM +0100, Will Deacon wrote:
> Hi Russell,
> 
> On Sat, Oct 29, 2011 at 11:21:08AM +0100, Russell King - ARM Linux wrote:
> > This would then allow everyone to hook into the restart via the same
> > method irrespective of what they want, and if they want the old
> > 'arch_reset' way, call setup_restart() themselves.
> 
> Yup, it's a fantastic idea because it allows us to put all of the identity
> mapping bits into setup_restart as well. So then platforms make the choice
> about the mapping they want, rather than being told via the reboot mode.

I've now committed my patch, so if you'd like to give it an acked by,
and preferably a tested-by, I'll publish it out in a stable branch.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-31 12:06       ` Russell King - ARM Linux
@ 2011-10-31 13:53         ` Will Deacon
  2011-11-01 18:05         ` Will Deacon
  1 sibling, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-10-31 13:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 31, 2011 at 12:06:03PM +0000, Russell King - ARM Linux wrote:
> On Sat, Oct 29, 2011 at 02:56:53PM +0100, Will Deacon wrote:
> > Hi Russell,
> > 
> > On Sat, Oct 29, 2011 at 11:21:08AM +0100, Russell King - ARM Linux wrote:
> > > This would then allow everyone to hook into the restart via the same
> > > method irrespective of what they want, and if they want the old
> > > 'arch_reset' way, call setup_restart() themselves.
> > 
> > Yup, it's a fantastic idea because it allows us to put all of the identity
> > mapping bits into setup_restart as well. So then platforms make the choice
> > about the mapping they want, rather than being told via the reboot mode.
> 
> I've now committed my patch, so if you'd like to give it an acked by,
> and preferably a tested-by, I'll publish it out in a stable branch.

I gave it a spin on my Versatile Express and it reboots as expected.

Acked-and-tested-by: Will Deacon <will.deacon@arm.com>

Will

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-29 13:56     ` Will Deacon
  2011-10-29 20:05       ` Russell King - ARM Linux
  2011-10-31 12:06       ` Russell King - ARM Linux
@ 2011-10-31 14:13       ` Russell King - ARM Linux
  2011-10-31 14:26         ` Jamie Iles
                           ` (2 more replies)
  2011-10-31 22:43       ` Nicolas Pitre
  3 siblings, 3 replies; 79+ messages in thread
From: Russell King - ARM Linux @ 2011-10-31 14:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Oct 29, 2011 at 02:56:53PM +0100, Will Deacon wrote:
> The only downside is that I have to go over all of the platforms again
> unless I can polish up my Coccinelle-fu. Ho-hum.

Well, I've just given coccinelle a go, and having read all the hype about
it, I'm completely disappointed with it to the extent that I'm going to
uninstall the tool from my system (unless someone can point out what I'm
doing wrong.)

I thought I'd give it a spin on a nice simple change - deleting the
local_irq_disable() calls inside arch_reset() (irqs have already been
disabled by this time):

@@
identifier mode, cmd;
@@

arch_reset(char mode, const char *cmd)
{
...
- local_irq_disable();
...
}

$ spatch -sp_file arch_reset-1.cocci arch/arm/*/include/*/system.h > arch_reset-1.diff

The diff it created contains:

--- arch/arm/mach-ep93xx/include/mach/system.h  2011-03-04 19:52:46.419272878 +0000
+++ /tmp/cocci-output-380-f841cc-system.h       2011-10-31 13:54:52.066705107 +0000
...
--- arch/arm/mach-iop32x/include/mach/system.h  2011-03-04 19:52:46.445272534 +0000
+++ /tmp/cocci-output-380-c0e3f4-system.h       2011-10-31 13:54:52.072705051 +0000
...
--- arch/arm/mach-ixp2000/include/mach/system.h 2011-03-04 19:52:46.449272482 +0000
+++ /tmp/cocci-output-380-467f17-system.h       2011-10-31 13:54:52.079704984 +0000
...

which in total deletes 6 lines.  However, the patch is rejected by
git apply and gnu patch as it stands - it needs the filenames to be
edited to something more reasonable.  So that also takes six edits.

I might as well have used grep and an editor to do the job:

$ files=$(grep -l local_irq_disable arch/arm/*/include/*/system.h)
$ uemacs $files
$ git add $files
$ git commit

And for a more complex task, you're still going to have to mess about
editing filenames.  This seems (to me) to make the tool rather awkward
to use.  On the plus side, for complex changes it does help to make
you look at the generated patch rather than just believing it to be
correct.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-31 14:13       ` Russell King - ARM Linux
@ 2011-10-31 14:26         ` Jamie Iles
  2011-10-31 14:33           ` Russell King - ARM Linux
  2011-10-31 14:33         ` Rabin Vincent
  2011-10-31 14:37         ` Will Deacon
  2 siblings, 1 reply; 79+ messages in thread
From: Jamie Iles @ 2011-10-31 14:26 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Russell,

On Mon, Oct 31, 2011 at 02:13:22PM +0000, Russell King - ARM Linux wrote:
> On Sat, Oct 29, 2011 at 02:56:53PM +0100, Will Deacon wrote:
> > The only downside is that I have to go over all of the platforms again
> > unless I can polish up my Coccinelle-fu. Ho-hum.
> 
> Well, I've just given coccinelle a go, and having read all the hype about
> it, I'm completely disappointed with it to the extent that I'm going to
> uninstall the tool from my system (unless someone can point out what I'm
> doing wrong.)
> 
> I thought I'd give it a spin on a nice simple change - deleting the
> local_irq_disable() calls inside arch_reset() (irqs have already been
> disabled by this time):
> 
> @@
> identifier mode, cmd;
> @@
> 
> arch_reset(char mode, const char *cmd)
> {
> ...
> - local_irq_disable();
> ...
> }
> 
> $ spatch -sp_file arch_reset-1.cocci arch/arm/*/include/*/system.h > arch_reset-1.diff
> 
> The diff it created contains:
> 
> --- arch/arm/mach-ep93xx/include/mach/system.h  2011-03-04 19:52:46.419272878 +0000
> +++ /tmp/cocci-output-380-f841cc-system.h       2011-10-31 13:54:52.066705107 +0000
> ...
> --- arch/arm/mach-iop32x/include/mach/system.h  2011-03-04 19:52:46.445272534 +0000
> +++ /tmp/cocci-output-380-c0e3f4-system.h       2011-10-31 13:54:52.072705051 +0000
> ...
> --- arch/arm/mach-ixp2000/include/mach/system.h 2011-03-04 19:52:46.449272482 +0000
> +++ /tmp/cocci-output-380-467f17-system.h       2011-10-31 13:54:52.079704984 +0000
> ...
> 
> which in total deletes 6 lines.  However, the patch is rejected by
> git apply and gnu patch as it stands - it needs the filenames to be
> edited to something more reasonable.  So that also takes six edits.

I think you need:

spatch -sp_file arch_reset-1.cocci -patch .  arch/arm/*/include/*/system.h > \
arch_reset-1.diff

I've also used -in_place in the past then use git to generate the diff, 
but I guess it is nicer to have the patch self-contained.

Jamie

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-31 14:13       ` Russell King - ARM Linux
  2011-10-31 14:26         ` Jamie Iles
@ 2011-10-31 14:33         ` Rabin Vincent
  2011-10-31 14:39           ` Russell King - ARM Linux
  2011-10-31 14:37         ` Will Deacon
  2 siblings, 1 reply; 79+ messages in thread
From: Rabin Vincent @ 2011-10-31 14:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 31, 2011 at 19:43, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> $ spatch -sp_file arch_reset-1.cocci arch/arm/*/include/*/system.h > arch_reset-1.diff
>
> The diff it created contains:
>
> --- arch/arm/mach-ep93xx/include/mach/system.h ?2011-03-04 19:52:46.419272878 +0000
> +++ /tmp/cocci-output-380-f841cc-system.h ? ? ? 2011-10-31 13:54:52.066705107 +0000
> ...
> --- arch/arm/mach-iop32x/include/mach/system.h ?2011-03-04 19:52:46.445272534 +0000
> +++ /tmp/cocci-output-380-c0e3f4-system.h ? ? ? 2011-10-31 13:54:52.072705051 +0000
> ...
> --- arch/arm/mach-ixp2000/include/mach/system.h 2011-03-04 19:52:46.449272482 +0000
> +++ /tmp/cocci-output-380-467f17-system.h ? ? ? 2011-10-31 13:54:52.079704984 +0000
> ...
>
> which in total deletes 6 lines. ?However, the patch is rejected by
> git apply and gnu patch as it stands - it needs the filenames to be
> edited to something more reasonable. ?So that also takes six edits.

The above patch will apply with gnu patch if you use -p0.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-31 14:26         ` Jamie Iles
@ 2011-10-31 14:33           ` Russell King - ARM Linux
  0 siblings, 0 replies; 79+ messages in thread
From: Russell King - ARM Linux @ 2011-10-31 14:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 31, 2011 at 02:26:02PM +0000, Jamie Iles wrote:
> I think you need:
> 
> spatch -sp_file arch_reset-1.cocci -patch .  arch/arm/*/include/*/system.h > \
> arch_reset-1.diff
> 
> I've also used -in_place in the past then use git to generate the diff, 
> but I guess it is nicer to have the patch self-contained.

Ah, yes, that allows it to start generating more useful patches, thanks.

I tried -patch '', which the documentation said should be the current
directory:

  -patch                     <dir> path name with respect to which a patch should be created
    "" for a file in the current directory

except it instead spits out this error:

Fatal error: exception Invalid_argument("index out of bounds")

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-31 14:13       ` Russell King - ARM Linux
  2011-10-31 14:26         ` Jamie Iles
  2011-10-31 14:33         ` Rabin Vincent
@ 2011-10-31 14:37         ` Will Deacon
  2011-10-31 22:15           ` Russell King - ARM Linux
  2 siblings, 1 reply; 79+ messages in thread
From: Will Deacon @ 2011-10-31 14:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 31, 2011 at 02:13:22PM +0000, Russell King - ARM Linux wrote:
> On Sat, Oct 29, 2011 at 02:56:53PM +0100, Will Deacon wrote:
> > The only downside is that I have to go over all of the platforms again
> > unless I can polish up my Coccinelle-fu. Ho-hum.
> 
> Well, I've just given coccinelle a go, and having read all the hype about
> it, I'm completely disappointed with it to the extent that I'm going to
> uninstall the tool from my system (unless someone can point out what I'm
> doing wrong.)

I'm really new to it, so I'm by no means an expert...

> I thought I'd give it a spin on a nice simple change - deleting the
> local_irq_disable() calls inside arch_reset() (irqs have already been
> disabled by this time):
> 
> @@
> identifier mode, cmd;
> @@
> 
> arch_reset(char mode, const char *cmd)
> {
> ...
> - local_irq_disable();
> ...
> }

Looks good to me.

> $ spatch -sp_file arch_reset-1.cocci arch/arm/*/include/*/system.h > arch_reset-1.diff
> 
> The diff it created contains:
> 
> --- arch/arm/mach-ep93xx/include/mach/system.h  2011-03-04 19:52:46.419272878 +0000
> +++ /tmp/cocci-output-380-f841cc-system.h       2011-10-31 13:54:52.066705107 +0000
> ...
> --- arch/arm/mach-iop32x/include/mach/system.h  2011-03-04 19:52:46.445272534 +0000
> +++ /tmp/cocci-output-380-c0e3f4-system.h       2011-10-31 13:54:52.072705051 +0000
> ...
> --- arch/arm/mach-ixp2000/include/mach/system.h 2011-03-04 19:52:46.449272482 +0000
> +++ /tmp/cocci-output-380-467f17-system.h       2011-10-31 13:54:52.079704984 +0000
> ...
> 
> which in total deletes 6 lines.  However, the patch is rejected by
> git apply and gnu patch as it stands - it needs the filenames to be
> edited to something more reasonable.  So that also takes six edits.

Ah, yeah, that's not good. I tried using the -dir option but ran into
problems, since spatch only descends one level into the filesystem hierarchy.
In the end I used find and xargs :)

Will

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-31 14:33         ` Rabin Vincent
@ 2011-10-31 14:39           ` Russell King - ARM Linux
  2011-10-31 14:44             ` Rabin Vincent
  0 siblings, 1 reply; 79+ messages in thread
From: Russell King - ARM Linux @ 2011-10-31 14:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 31, 2011 at 08:03:26PM +0530, Rabin Vincent wrote:
> On Mon, Oct 31, 2011 at 19:43, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > $ spatch -sp_file arch_reset-1.cocci arch/arm/*/include/*/system.h > arch_reset-1.diff
> >
> > The diff it created contains:
> >
> > --- arch/arm/mach-ep93xx/include/mach/system.h ?2011-03-04 19:52:46.419272878 +0000
> > +++ /tmp/cocci-output-380-f841cc-system.h ? ? ? 2011-10-31 13:54:52.066705107 +0000
> > ...
> > --- arch/arm/mach-iop32x/include/mach/system.h ?2011-03-04 19:52:46.445272534 +0000
> > +++ /tmp/cocci-output-380-c0e3f4-system.h ? ? ? 2011-10-31 13:54:52.072705051 +0000
> > ...
> > --- arch/arm/mach-ixp2000/include/mach/system.h 2011-03-04 19:52:46.449272482 +0000
> > +++ /tmp/cocci-output-380-467f17-system.h ? ? ? 2011-10-31 13:54:52.079704984 +0000
> > ...
> >
> > which in total deletes 6 lines. ?However, the patch is rejected by
> > git apply and gnu patch as it stands - it needs the filenames to be
> > edited to something more reasonable. ?So that also takes six edits.
> 
> The above patch will apply with gnu patch if you use -p0.

$ patch -p0 -i arch_reset-1.diff --dry-run
patch: **** rejecting absolute target file name: /tmp/cocci-output-380-f841cc-system.h

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-31 14:39           ` Russell King - ARM Linux
@ 2011-10-31 14:44             ` Rabin Vincent
  2011-10-31 14:56               ` Russell King - ARM Linux
  0 siblings, 1 reply; 79+ messages in thread
From: Rabin Vincent @ 2011-10-31 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 31, 2011 at 20:09, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Mon, Oct 31, 2011 at 08:03:26PM +0530, Rabin Vincent wrote:
>> The above patch will apply with gnu patch if you use -p0.
>
> $ patch -p0 -i arch_reset-1.diff --dry-run
> patch: **** rejecting absolute target file name: /tmp/cocci-output-380-f841cc-system.h

Works for me, maybe a version difference?

~/kernel/arm$ cat arch_reset-1.diff  | head
--- arch/arm/mach-ep93xx/include/mach/system.h	2011-10-31
20:11:04.496237799 +0530
+++ /tmp/cocci-output-3559-9e5748-system.h	2011-10-31 20:12:08.120235486 +0530
@@ -11,8 +11,6 @@ static inline void arch_idle(void)

 static inline void arch_reset(char mode, const char *cmd)
 {
-	local_irq_disable();
-
 	/*
 	 * Set then clear the SWRST bit to initiate a software reset
~/kernel/arm$ patch -p0 -i arch_reset-1.diff --dry-run
patching file arch/arm/mach-ep93xx/include/mach/system.h
patching file arch/arm/mach-iop32x/include/mach/system.h
patching file arch/arm/mach-ixp2000/include/mach/system.h
~/kernel/arm$ patch --version
patch 2.6.1
Copyright (C) 1988 Larry Wall
Copyright (C) 2003, 2009 Free Software Foundation, Inc.

This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

written by Larry Wall and Paul Eggert
~/kernel/arm$

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-31 14:44             ` Rabin Vincent
@ 2011-10-31 14:56               ` Russell King - ARM Linux
  0 siblings, 0 replies; 79+ messages in thread
From: Russell King - ARM Linux @ 2011-10-31 14:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 31, 2011 at 08:14:14PM +0530, Rabin Vincent wrote:
> On Mon, Oct 31, 2011 at 20:09, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > On Mon, Oct 31, 2011 at 08:03:26PM +0530, Rabin Vincent wrote:
> >> The above patch will apply with gnu patch if you use -p0.
> >
> > $ patch -p0 -i arch_reset-1.diff --dry-run
> > patch: **** rejecting absolute target file name: /tmp/cocci-output-380-f841cc-system.h
> 
> Works for me, maybe a version difference?

Same version.  Some versions have become anal about security - and the
one in Fedora seems to be that.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-31 14:37         ` Will Deacon
@ 2011-10-31 22:15           ` Russell King - ARM Linux
  2011-11-01 12:40             ` Will Deacon
  0 siblings, 1 reply; 79+ messages in thread
From: Russell King - ARM Linux @ 2011-10-31 22:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 31, 2011 at 02:37:45PM +0000, Will Deacon wrote:
> On Mon, Oct 31, 2011 at 02:13:22PM +0000, Russell King - ARM Linux wrote:
> > On Sat, Oct 29, 2011 at 02:56:53PM +0100, Will Deacon wrote:
> > > The only downside is that I have to go over all of the platforms again
> > > unless I can polish up my Coccinelle-fu. Ho-hum.
> > 
> > Well, I've just given coccinelle a go, and having read all the hype about
> > it, I'm completely disappointed with it to the extent that I'm going to
> > uninstall the tool from my system (unless someone can point out what I'm
> > doing wrong.)
> 
> I'm really new to it, so I'm by no means an expert...

I've spent the rest of today trying to get it to do another trivial task -
adding setup_reboot(mode) to the start of the arch_reset() functions, and
failed to get it to place the call after local variable declarations.
I really don't like the way I seem to have to create a rule for each
possible perturbation of arch_reset (as a function pointer, as a
function, with local variables, without local variables.)

So far, my experiments with it have just resulted in frustration with
virtually zero productivity (just one commit to be precise).

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-29 13:56     ` Will Deacon
                         ` (2 preceding siblings ...)
  2011-10-31 14:13       ` Russell King - ARM Linux
@ 2011-10-31 22:43       ` Nicolas Pitre
  3 siblings, 0 replies; 79+ messages in thread
From: Nicolas Pitre @ 2011-10-31 22:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 29 Oct 2011, Will Deacon wrote:

> I'll give this a go for v2, thanks. Once this is sorted out I'll do a second
> pass to clean up the reboot modes since I've already got some patches for
> that.

OK great.  Please ask Russell to merge your series whenever you're ready 
after 3.2-rc1 and I'll rebase my arch_idle series on top of that.


Nicolas

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-31 22:15           ` Russell King - ARM Linux
@ 2011-11-01 12:40             ` Will Deacon
  2011-11-01 13:01               ` Russell King - ARM Linux
  0 siblings, 1 reply; 79+ messages in thread
From: Will Deacon @ 2011-11-01 12:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 31, 2011 at 10:15:13PM +0000, Russell King - ARM Linux wrote:
> I've spent the rest of today trying to get it to do another trivial task -
> adding setup_reboot(mode) to the start of the arch_reset() functions, and
> failed to get it to place the call after local variable declarations.

That sounds difficult. What pattern did you use to skip the declarations?

> I really don't like the way I seem to have to create a rule for each
> possible perturbation of arch_reset (as a function pointer, as a
> function, with local variables, without local variables.)

I was wondering if there was a way to avoid it, but I can't figure it out.

> So far, my experiments with it have just resulted in frustration with
> virtually zero productivity (just one commit to be precise).

I guess the tool is good in cases where you're performing a mindless rename,
but as you pointed out, grep and sed are good for that as well.

Will

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-11-01 12:40             ` Will Deacon
@ 2011-11-01 13:01               ` Russell King - ARM Linux
  0 siblings, 0 replies; 79+ messages in thread
From: Russell King - ARM Linux @ 2011-11-01 13:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 01, 2011 at 12:40:13PM +0000, Will Deacon wrote:
> On Mon, Oct 31, 2011 at 10:15:13PM +0000, Russell King - ARM Linux wrote:
> > I've spent the rest of today trying to get it to do another trivial task -
> > adding setup_reboot(mode) to the start of the arch_reset() functions, and
> > failed to get it to place the call after local variable declarations.
> 
> That sounds difficult. What pattern did you use to skip the declarations?

I've tried many different attempts, eventually the one which worked was:

@ rd3 @ identifier m, c, a; type t; @@
void arch_reset(char m, const char *c)
{
 t a;
+setup_restart();
...
}

@ depends on !rd3 @ identifier m, c; @@
void arch_reset(char m, const char *c)
{
+setup_restart();
...
}

> > I really don't like the way I seem to have to create a rule for each
> > possible perturbation of arch_reset (as a function pointer, as a
> > function, with local variables, without local variables.)
> 
> I was wondering if there was a way to avoid it, but I can't figure it out.

Having had a response from Julia this morning, it seems that there's no
way to consolidate the rules down - you have to list them separately.
It sucks still more when you realise that there's three different
perturbations.  (see omap, at91 and everything else.)

I've also ended up with three rules per perturbation as well, so I'm now
at nine rules to do the transformations I want, plus several rules to try
and detect each perturbation (and it still doesn't work.)

> > So far, my experiments with it have just resulted in frustration with
> > virtually zero productivity (just one commit to be precise).
> 
> I guess the tool is good in cases where you're performing a mindless rename,
> but as you pointed out, grep and sed are good for that as well.

I'm not even sure about that.  It doesn't seem to be capable of even the
most trivial transformation a developer might want to make.  For instance,
lets try and delete the argument to setup_mm_for_reboot() because it's
not used:

@@ expression e; @@
 setup_mm_for_reboot(
-e
 )

That does the call sites just fine (great).  However, what about the function
declaration and definition.  You'd have thought that:

@@ expression e; @@
 setup_mm_for_reboot(
-char e
 )

would have done it, but it causes coccinelle to spit out its cryptic and
plain "parse error" without explaining exactly _what_ is wrong with that:

Fatal error: exception Failure("minus: parse error:
 = File "arch_reset-1.5.cocci", line 3, column 6,  charpos = 48
    around = 'e', whole content = -char e
")

For this particular problem I just resorted to grep and a text editor,
which had I done so in the first instance, would've been far quicker than
my fruitless attempts with coccinelle.

Someone said to me yesterday: "The way to use coccinelle is to mail Julia
and describe the problem to her".  My experience so far corroborates that.

^ permalink raw reply	[flat|nested] 79+ messages in thread

* [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer
  2011-10-31 12:06       ` Russell King - ARM Linux
  2011-10-31 13:53         ` Will Deacon
@ 2011-11-01 18:05         ` Will Deacon
  1 sibling, 0 replies; 79+ messages in thread
From: Will Deacon @ 2011-11-01 18:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Russell,

On Mon, Oct 31, 2011 at 12:06:03PM +0000, Russell King - ARM Linux wrote:
> On Sat, Oct 29, 2011 at 02:56:53PM +0100, Will Deacon wrote:
> > Yup, it's a fantastic idea because it allows us to put all of the identity
> > mapping bits into setup_restart as well. So then platforms make the choice
> > about the mapping they want, rather than being told via the reboot mode.
> 
> I've now committed my patch, so if you'd like to give it an acked by,
> and preferably a tested-by, I'll publish it out in a stable branch.

Did you push this out to a stable branch? I should get time to look at this
tomorrow so it would be great to use your stuff as a base.

Appreciate you've been stuck with Coccinelle, for which I'm partly to blame!

Will

^ permalink raw reply	[flat|nested] 79+ messages in thread

end of thread, other threads:[~2011-11-01 18:05 UTC | newest]

Thread overview: 79+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28 14:43 [PATCH 00/51] Remove inline arch_reset definitions from system.h Will Deacon
2011-10-28 14:43 ` [PATCH 01/51] ARM: reset: introduce arm_arch_reset function pointer Will Deacon
2011-10-28 21:38   ` Jean-Christophe PLAGNIOL-VILLARD
2011-10-29 13:59     ` Will Deacon
2011-10-29 10:21   ` Russell King - ARM Linux
2011-10-29 13:56     ` Will Deacon
2011-10-29 20:05       ` Russell King - ARM Linux
2011-10-30 21:07         ` Will Deacon
2011-10-31 12:06       ` Russell King - ARM Linux
2011-10-31 13:53         ` Will Deacon
2011-11-01 18:05         ` Will Deacon
2011-10-31 14:13       ` Russell King - ARM Linux
2011-10-31 14:26         ` Jamie Iles
2011-10-31 14:33           ` Russell King - ARM Linux
2011-10-31 14:33         ` Rabin Vincent
2011-10-31 14:39           ` Russell King - ARM Linux
2011-10-31 14:44             ` Rabin Vincent
2011-10-31 14:56               ` Russell King - ARM Linux
2011-10-31 14:37         ` Will Deacon
2011-10-31 22:15           ` Russell King - ARM Linux
2011-11-01 12:40             ` Will Deacon
2011-11-01 13:01               ` Russell King - ARM Linux
2011-10-31 22:43       ` Nicolas Pitre
2011-10-28 14:43 ` [PATCH 02/51] ARM: mach-at91: use arm_arch_reset instead of arch_reset Will Deacon
2011-10-28 14:43 ` [PATCH 03/51] ARM: bcmring: " Will Deacon
2011-10-28 14:43 ` [PATCH 04/51] ARM: mach-clps711x: " Will Deacon
2011-10-28 14:43 ` [PATCH 05/51] ARM: cns3xxx: " Will Deacon
2011-10-28 14:43 ` [PATCH 06/51] ARM: mach-davinci: " Will Deacon
2011-10-28 14:43 ` [PATCH 07/51] ARM: mach-dove: " Will Deacon
2011-10-28 14:43 ` [PATCH 08/51] ARM: mach-ebsa110: " Will Deacon
2011-10-28 14:43 ` [PATCH 09/51] ARM: mach-ep93xx: " Will Deacon
2011-10-28 14:43 ` [PATCH 10/51] ARM: mach-footbridge: " Will Deacon
2011-10-28 14:43 ` [PATCH 11/51] ARM: mach-gemini: " Will Deacon
2011-10-28 14:43 ` [PATCH 12/51] ARM: mach-h720x: " Will Deacon
2011-10-28 14:43 ` [PATCH 13/51] ARM: mach-integrator: " Will Deacon
2011-10-28 14:43 ` [PATCH 14/51] ARM: mach-iop13xx: " Will Deacon
2011-10-28 14:43 ` [PATCH 15/51] ARM: mach-iop32x: " Will Deacon
2011-10-28 14:43 ` [PATCH 16/51] ARM: mach-iop33x: " Will Deacon
2011-10-28 14:43 ` [PATCH 17/51] ARM: OMAP: convert reset to use arm_arch_reset Will Deacon
2011-10-28 14:43 ` [PATCH 18/51] ARM: mach-ixp2000: use arm_arch_reset instead of arch_reset Will Deacon
2011-10-28 14:43 ` [PATCH 19/51] ARM: mach-ixp23xx: " Will Deacon
2011-10-28 14:43 ` [PATCH 20/51] ARM: mach-ixp4xx: " Will Deacon
2011-10-28 14:43 ` [PATCH 21/51] ARM: mach-kirkwood: " Will Deacon
2011-10-28 14:43 ` [PATCH 22/51] ARM: mach-ks8695: " Will Deacon
2011-10-28 14:43 ` [PATCH 23/51] ARM: mach-lpc32xx: " Will Deacon
2011-10-28 14:43 ` [PATCH 24/51] ARM: mach-mmp: " Will Deacon
2011-10-28 14:43 ` [PATCH 25/51] ARM: mach-mv78xx0: " Will Deacon
2011-10-28 14:43 ` [PATCH 26/51] ARM: mach-msm: " Will Deacon
2011-10-28 14:43 ` [PATCH 27/51] ARM: mach-mxs: " Will Deacon
2011-10-28 14:43 ` [PATCH 28/51] ARM: mach-netx: " Will Deacon
2011-10-28 14:43 ` [PATCH 29/51] ARM: mach-nomadik: " Will Deacon
2011-10-28 14:43 ` [PATCH 30/51] ARM: mach-nuc93x: " Will Deacon
2011-10-28 14:43 ` [PATCH 31/51] ARM: mach-orion5x: " Will Deacon
2011-10-28 14:44 ` [PATCH 32/51] ARM: mach-pnx4008: " Will Deacon
2011-10-28 14:44 ` [PATCH 33/51] ARM: mach-prima2: " Will Deacon
2011-10-29  9:41   ` Barry Song
2011-10-29 13:58     ` Will Deacon
2011-10-28 14:44 ` [PATCH 34/51] ARM: mach-pxa: " Will Deacon
2011-10-28 22:12   ` Marek Vasut
2011-10-28 14:44 ` [PATCH 35/51] ARM: mach-realview: " Will Deacon
2011-10-28 14:44 ` [PATCH 36/51] ARM: mach-rpc: " Will Deacon
2011-10-28 14:44 ` [PATCH 37/51] ARM: mach-s3c64xx: " Will Deacon
2011-10-28 14:44 ` [PATCH 38/51] ARM: mach-sa1100: " Will Deacon
2011-10-28 14:44 ` [PATCH 39/51] ARM: mach-shark: " Will Deacon
2011-10-28 14:44 ` [PATCH 40/51] ARM: mach-shmobile: " Will Deacon
2011-10-28 14:44 ` [PATCH 41/51] ARM: mach-tegra: " Will Deacon
2011-10-28 14:44 ` [PATCH 42/51] ARM: mach-u300: " Will Deacon
2011-10-28 19:37   ` Linus Walleij
2011-10-28 14:44 ` [PATCH 43/51] ARM: mach-versatile: " Will Deacon
2011-10-28 14:44 ` [PATCH 44/51] ARM: mach-vt8500: " Will Deacon
2011-10-28 14:44 ` [PATCH 45/51] ARM: mach-w90x900: " Will Deacon
2011-10-28 14:44 ` [PATCH 46/51] ARM: plat-spear: " Will Deacon
2011-10-28 14:44 ` [PATCH 47/51] ARM: plat-tcc: " Will Deacon
2011-10-28 14:44 ` [PATCH 48/51] ARM: plat-s5p: " Will Deacon
2011-10-28 14:44 ` [PATCH 49/51] ARM: plat-mxc: " Will Deacon
2011-10-28 14:44 ` [PATCH 50/51] ARM: plat-s3c24xx: " Will Deacon
2011-10-28 14:44 ` [PATCH 51/51] ARM: reset: remove empty arch_reset definitions Will Deacon
2011-10-28 22:08 ` [PATCH 00/51] Remove inline arch_reset definitions from system.h Deepak Saxena
2011-10-28 22:14   ` Deepak Saxena

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).