Skip to contentSkip to conversation

Remove inline arch_reset definitions from system.h

PATCH New Will Deacon 10 participants 79 messages Oct 28, 2011 – Nov 1, 2011

Subsystems (24)
lore
Share & tools
lore
#0 lore raw

cover Remove inline arch_reset definitions from system.h

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 <[email protected]>

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
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

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.

---
 arch/arm/include/asm/system.h |    1 +
 arch/arm/kernel/process.c     |   11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)
arch/arm/include/asm/system.h +1 -0
index 832888d..6838bd4 100644
@@ -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)
arch/arm/kernel/process.c +10 -1
index 1a347f4..13e68c5 100644
@@ -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)
 {
 }
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Quoted 6 lines · Will Deacon

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.

#3 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · Will Deacon

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

#4 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

In reply to Will Deacon
Quoted 6 lines · Will Deacon

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(-)
arch/arm/include/asm/system.h +1 -1
index 984014b..62a3c3d 100644
@@ -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)
arch/arm/kernel/process.c +17 -13
index fd08140..ba91ec4 100644
@@ -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)
#5 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Hi Russell,

Quoted 8 lines · Russell King - ARM Linux
Quoted 6 lines · Will Deacon

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.

Quoted 8 lines

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?

Quoted 3 lines

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.

Quoted 5 lines

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

#6 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Quoted 12 lines · Will Deacon

Hi Russell,

Quoted 8 lines · Russell King - ARM Linux

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().

Quoted 8 lines

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.

Quoted 3 lines

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.

#7 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Quoted 9 lines · Russell King - ARM Linux
Quoted 4 lines · Will Deacon

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

#8 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

In reply to Will Deacon
Quoted 10 lines · Will Deacon

Hi Russell,

Quoted 3 lines · Russell King - ARM Linux

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.

#9 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Will Deacon

Hi Russell,

Quoted 3 lines · Russell King - ARM Linux

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.

Quoted 6 lines
Quoted 3 lines

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.

Will

#10 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

In reply to Russell King - ARM Linux

Hi Russell,

Quoted 7 lines · Russell King - ARM Linux
Quoted 3 lines · Will Deacon

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

#11 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

In reply to Will Deacon
Quoted 2 lines · Will Deacon

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.

#12 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Hi Russell,

Quoted 38 lines · Russell King - ARM Linux
Quoted 2 lines · Will Deacon

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:

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

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

#13 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Quoted 7 lines · Jamie Iles

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")

#14 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

In reply to Russell King - ARM Linux
Quoted 14 lines · Russell King - ARM Linux
$ spatch -sp_file arch_reset-1.cocci arch/arm/*/include/*/system.h > arch_reset-1.diff

The diff it created contains:

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

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.

#15 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Quoted 16 lines · Rabin Vincent
Quoted 14 lines · Russell King - ARM Linux
$ spatch -sp_file arch_reset-1.cocci arch/arm/*/include/*/system.h > arch_reset-1.diff

The diff it created contains:

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

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
#16 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Quoted 5 lines · Russell King - ARM Linux
Quoted 1 line · Rabin Vincent

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$

#17 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Quoted 9 lines · Rabin Vincent
Quoted 5 lines · Russell King - ARM Linux
Quoted 1 line · Rabin Vincent

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.

#18 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

In reply to Russell King - ARM Linux
Quoted 8 lines · Russell King - ARM Linux
Quoted 2 lines · Will Deacon

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...

Quoted 8 lines

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;
@@

Quoted 6 lines

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

Looks good to me.

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

The diff it created contains:

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

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

#19 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Quoted 11 lines · Will Deacon
Quoted 8 lines · Russell King - ARM Linux
Quoted 2 lines · Will Deacon

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).

#20 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Quoted 3 lines · Russell King - ARM Linux

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?

Quoted 3 lines

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.

Quoted 2 lines

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

#21 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

Quoted 6 lines · Will Deacon
Quoted 3 lines · Russell King - ARM Linux

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();
...
}

Quoted 5 lines
Quoted 3 lines

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.)

Quoted 5 lines
Quoted 2 lines

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.

#22 lore raw

PATCH 1/51 ARM: reset: introduce arm_arch_reset function pointer

In reply to Will Deacon
Quoted 3 lines · Will Deacon

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

#23 lore raw

PATCH 2/51 ARM: mach-at91: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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(-)
arch/arm/mach-at91/at91cap9.c +3 -2
index bfc6844..d16da6a 100644
@@ -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);
 
arch/arm/mach-at91/at91rm9200.c +3 -2
index f73302d..4497e81 100644
@@ -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)
arch/arm/mach-at91/at91sam9260.c +2 -1
index cb397be..2f5e4c1 100644
@@ -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);
arch/arm/mach-at91/at91sam9261.c +2 -1
index 6c8e3b5..b7b0625 100644
@@ -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);
arch/arm/mach-at91/at91sam9263.c +2 -1
index 044f3c9..42b7380 100644
@@ -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);
 
arch/arm/mach-at91/at91sam9g45.c +3 -2
index e04c5fb..d13929c 100644
@@ -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);
 
arch/arm/mach-at91/at91sam9rl.c +2 -1
index a238105..f556331 100644
@@ -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);
 
arch/arm/mach-at91/generic.h +1 -2
index 938b34f..c15c9bb 100644
@@ -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;
arch/arm/mach-at91/include/mach/system.h +0 -5
index 36af14b..079eb12 100644
@@ -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
Signature · 1 line
1.7.4.1
#24 lore raw

PATCH 3/51 ARM: bcmring: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-bcmring/arch.c                |   27 +++++++++++++++++++++++++--
 arch/arm/mach-bcmring/include/mach/system.h |   20 --------------------
 2 files changed, 25 insertions(+), 22 deletions(-)
arch/arm/mach-bcmring/arch.c +25 -2
index a604b9e..4b90876 100644
@@ -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 */
arch/arm/mach-bcmring/include/mach/system.h +0 -20
index 38b3706..6cd872d 100644
@@ -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
Signature · 1 line
1.7.4.1
#25 lore raw

PATCH 4/51 ARM: mach-clps711x: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/mach-clps711x/Makefile +1 -1
index 4a19731..c3f224d 100644
@@ -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-			:=
arch/arm/mach-clps711x/include/mach/system.h +0 -1
index f916cd7..9982deb 100644
@@ -34,7 +34,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	cpu_reset(0);
 }
 
 #endif
arch/arm/mach-clps711x/system.c new file +23 -0
new file mode 100644
index 0000000..030d758
@@ -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);
Signature · 1 line
1.7.4.1
#26 lore raw

PATCH 5/51 ARM: cns3xxx: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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(-)
arch/arm/mach-cns3xxx/cns3420vb.c +3 -0
index 3e7d149..e19bda7 100644
@@ -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;
 }
 
arch/arm/mach-cns3xxx/include/mach/system.h +3 -1
index 4f16c9b..092d774 100644
@@ -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
arch/arm/mach-cns3xxx/pm.c +1 -1
index 0c04678..a3e01f9 100644
@@ -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
Signature · 1 line
1.7.4.1
#27 lore raw

PATCH 6/51 ARM: mach-davinci: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-davinci/common.c              |    8 ++++++++
 arch/arm/mach-davinci/include/mach/system.h |    2 --
 2 files changed, 8 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/common.c +8 -0
index 1d25573..b0b1560 100644
@@ -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.
arch/arm/mach-davinci/include/mach/system.h +0 -2
index e65629c..6bd1dc0 100644
@@ -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 */
Signature · 1 line
1.7.4.1
#28 lore raw

PATCH 7/51 ARM: mach-dove: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-dove/common.c              |   18 ++++++++++++++++++
 arch/arm/mach-dove/include/mach/system.h |   13 -------------
 2 files changed, 18 insertions(+), 13 deletions(-)
arch/arm/mach-dove/common.c +18 -0
index a9e0dae..975f6f1 100644
@@ -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
arch/arm/mach-dove/include/mach/system.h +0 -13
index 356afda..ce3e749 100644
@@ -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
Signature · 1 line
1.7.4.1
#29 lore raw

PATCH 8/51 ARM: mach-ebsa110: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-ebsa110/core.c                |    6 ++++++
 arch/arm/mach-ebsa110/include/mach/system.h |    4 +++-
 2 files changed, 9 insertions(+), 1 deletions(-)
arch/arm/mach-ebsa110/core.c +6 -0
index 087bc77..c4d243f 100644
@@ -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));
 }
 
arch/arm/mach-ebsa110/include/mach/system.h +3 -1
index 9a26245..574e633 100644
@@ -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
Signature · 1 line
1.7.4.1
#30 lore raw

PATCH 9/51 ARM: mach-ep93xx: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-ep93xx/core.c                |   22 ++++++++++++++++++++++
 arch/arm/mach-ep93xx/include/mach/system.h |   10 ----------
 2 files changed, 22 insertions(+), 10 deletions(-)
arch/arm/mach-ep93xx/core.c +22 -0
index c60f081..5841c1d 100644
@@ -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);
arch/arm/mach-ep93xx/include/mach/system.h +0 -10
index 6d661fe..ce48083 100644
@@ -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)
-		;
 }
Signature · 1 line
1.7.4.1
#31 lore raw

PATCH 10/51 ARM: mach-footbridge: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/mach-footbridge/Makefile +1 -1
index 3afb1b2..39821ce 100644
@@ -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-			:=
arch/arm/mach-footbridge/include/mach/system.h +0 -46

50 lines not on this page · raw message

arch/arm/mach-footbridge/reset.c new file +69 -0

69 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#32 lore raw

PATCH 11/51 ARM: mach-gemini: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/mach-gemini/Makefile +1 -1
index c5b24b9..b6fc9a0 100644
@@ -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
arch/arm/mach-gemini/include/mach/system.h +0 -2
index 4d9c1f8..7df8e48 100644
@@ -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 */
arch/arm/mach-gemini/system.c new file +22 -0
new file mode 100644
index 0000000..f1bba7f
@@ -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);
Signature · 1 line
1.7.4.1
#33 lore raw

PATCH 12/51 ARM: mach-h720x: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-h720x/common.c              |   12 ++++++++++++
 arch/arm/mach-h720x/include/mach/system.h |    1 -
 2 files changed, 12 insertions(+), 1 deletions(-)
arch/arm/mach-h720x/common.c +12 -0
index 51d4e44..1ad66f2 100644
@@ -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);
arch/arm/mach-h720x/include/mach/system.h +0 -1
index a708d24..4c2fba9 100644
@@ -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
Signature · 1 line
1.7.4.1
#34 lore raw

PATCH 13/51 ARM: mach-integrator: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-integrator/core.c                |   11 +++++++++++
 arch/arm/mach-integrator/include/mach/system.h |    5 -----
 2 files changed, 11 insertions(+), 5 deletions(-)
arch/arm/mach-integrator/core.c +11 -0
index 77315b9..86f09cb 100644
@@ -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;
 }
 
arch/arm/mach-integrator/include/mach/system.h +0 -5
index e1551b8..6e5adbf 100644
@@ -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
Signature · 1 line
1.7.4.1
#35 lore raw

PATCH 14/51 ARM: mach-iop13xx: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-iop13xx/include/mach/system.h |    9 ---------
 arch/arm/mach-iop13xx/setup.c               |   14 ++++++++++++++
 2 files changed, 14 insertions(+), 9 deletions(-)
arch/arm/mach-iop13xx/include/mach/system.h +0 -9
index d0c66ef..6b9bba7 100644
@@ -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(;;);
 }
arch/arm/mach-iop13xx/setup.c +14 -0
index a5b9897..58388da 100644
@@ -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)
Signature · 1 line
1.7.4.1
#36 lore raw

PATCH 15/51 ARM: mach-iop32x: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/mach-iop32x/Makefile +1 -1
index cfdf8a1..29574bc 100644
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-obj-y			:= irq.o
+obj-y			:= irq.o reset.o
 obj-m			:=
 obj-n			:=
 obj-			:=
arch/arm/mach-iop32x/include/mach/system.h +0 -13
index a4b808f..094714d 100644
@@ -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);
 }
arch/arm/mach-iop32x/reset.c new file +33 -0
new file mode 100644
index 0000000..3df8dfe
@@ -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);
Signature · 1 line
1.7.4.1
#37 lore raw

PATCH 16/51 ARM: mach-iop33x: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/mach-iop33x/Makefile +1 -1
index 90081d8..5b72c19 100644
@@ -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-			:=
arch/arm/mach-iop33x/include/mach/system.h +0 -4
index f192a34..df98c56 100644
@@ -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);
 }
arch/arm/mach-iop33x/reset.c new file +24 -0
new file mode 100644
index 0000000..9d71166
@@ -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);
Signature · 1 line
1.7.4.1
#38 lore raw

PATCH 17/51 ARM: OMAP: convert reset to use arm_arch_reset

In reply to Will Deacon

From: Paul Walmsley <[email protected]>

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

---
 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(-)
arch/arm/mach-omap1/board-voiceblue.c +1 -1
index 036edc0e..e2a24a0 100644
@@ -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")
arch/arm/mach-omap1/io.c +4 -0
index 870886a..d3b54da 100644
@@ -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;
 }
 
 /*
arch/arm/mach-omap1/reset.c +0 -2
index ad951ee..a5ed979 100644
@@ -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;
arch/arm/mach-omap2/io.c +6 -1
index 2ce1ce6..b94e1a2 100644
@@ -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
arch/arm/mach-omap2/prcm.c +1 -3
index 2e40a5c..ad3ac5c 100644
@@ -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
arch/arm/plat-omap/include/plat/system.h +5 -1
index c5fa9e9..ac32d88 100644
@@ -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
Signature · 1 line
1.7.4.1
#39 lore raw

PATCH 18/51 ARM: mach-ixp2000: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-ixp2000/core.c                |   38 +++++++++++++++++++++++++++
 arch/arm/mach-ixp2000/include/mach/system.h |   30 ---------------------
 2 files changed, 38 insertions(+), 30 deletions(-)
arch/arm/mach-ixp2000/core.c +38 -0
index 4068166..59e987f 100644
@@ -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);
arch/arm/mach-ixp2000/include/mach/system.h +0 -30
index de37099..d79c7ad 100644
@@ -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);
 }
Signature · 1 line
1.7.4.1
#40 lore raw

PATCH 19/51 ARM: mach-ixp23xx: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-ixp23xx/core.c                |   15 +++++++++++++++
 arch/arm/mach-ixp23xx/include/mach/system.h |   12 ------------
 2 files changed, 15 insertions(+), 12 deletions(-)
arch/arm/mach-ixp23xx/core.c +15 -0
index a1bee33..e72c089 100644
@@ -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;
 }
arch/arm/mach-ixp23xx/include/mach/system.h +0 -12
index 8920ff2..4569003 100644
@@ -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;
 }
Signature · 1 line
1.7.4.1
#41 lore raw

PATCH 20/51 ARM: mach-ixp4xx: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-ixp4xx/common.c              |   22 ++++++++++++++++++++++
 arch/arm/mach-ixp4xx/include/mach/system.h |   19 -------------------
 2 files changed, 22 insertions(+), 19 deletions(-)
arch/arm/mach-ixp4xx/common.c +22 -0
index 0777257..9e38334 100644
@@ -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;
 }
 
 /*
arch/arm/mach-ixp4xx/include/mach/system.h +0 -19
index 54c0af7..ed5964c 100644
@@ -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;
-	}
 }
-
Signature · 1 line
1.7.4.1
#42 lore raw

PATCH 21/51 ARM: mach-kirkwood: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-kirkwood/common.c              |   17 +++++++++++++++++
 arch/arm/mach-kirkwood/include/mach/system.h |   14 --------------
 2 files changed, 17 insertions(+), 14 deletions(-)
arch/arm/mach-kirkwood/common.c +17 -0
index f3248cf..5fcfbde 100644
@@ -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)
arch/arm/mach-kirkwood/include/mach/system.h +0 -14
index 7568e95..f094431 100644
@@ -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)
-		;
 }
 
 
Signature · 1 line
1.7.4.1
#43 lore raw

PATCH 22/51 ARM: mach-ks8695: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/mach-ks8695/Makefile +1 -1
index 7e3e816..c2dcdde 100644
@@ -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-				:=
arch/arm/mach-ks8695/include/mach/system.h +1 -18
index fb1dda9..b73ee70 100644
@@ -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
arch/arm/mach-ks8695/reset.c new file +33 -0
new file mode 100644
index 0000000..911eb95
@@ -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);
Signature · 1 line
1.7.4.1
#44 lore raw

PATCH 23/51 ARM: mach-lpc32xx: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-lpc32xx/common.c              |   30 +++++++++++++++++++++++++++
 arch/arm/mach-lpc32xx/include/mach/system.h |   21 ------------------
 2 files changed, 30 insertions(+), 21 deletions(-)
arch/arm/mach-lpc32xx/common.c +30 -0
index 205b2db..200bd51 100644
@@ -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);
arch/arm/mach-lpc32xx/include/mach/system.h +0 -21
index df3b0de..9c6cc0c 100644
@@ -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
Signature · 1 line
1.7.4.1
#45 lore raw

PATCH 24/51 ARM: mach-mmp: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-mmp/common.c              |   16 ++++++++++++++++
 arch/arm/mach-mmp/include/mach/system.h |    4 ----
 2 files changed, 16 insertions(+), 4 deletions(-)
arch/arm/mach-mmp/common.c +16 -0
index 0ec0ca8..1d3df64 100644
@@ -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);
arch/arm/mach-mmp/include/mach/system.h +0 -4
index 1a8a25e..b09c19a 100644
@@ -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 */
Signature · 1 line
1.7.4.1
#46 lore raw

PATCH 25/51 ARM: mach-mv78xx0: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-mv78xx0/common.c              |   17 +++++++++++++++++
 arch/arm/mach-mv78xx0/include/mach/system.h |   12 ------------
 2 files changed, 17 insertions(+), 12 deletions(-)
arch/arm/mach-mv78xx0/common.c +17 -0
index 23d3980..c3d5dd4 100644
@@ -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;
 }
arch/arm/mach-mv78xx0/include/mach/system.h +0 -12
index 66e7ce4..1a41dc5 100644
@@ -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)
-		;
 }
 
 
Signature · 1 line
1.7.4.1
#47 lore raw

PATCH 26/51 ARM: mach-msm: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-msm/include/mach/system.h |    6 ------
 arch/arm/mach-msm/smd.c                 |    6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-msm/include/mach/system.h +0 -6
index d2e83f4..ab6590b 100644
@@ -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);
arch/arm/mach-msm/smd.c +6 -0
index 657be73..4f0e919 100644
@@ -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);
 }
 
Signature · 1 line
1.7.4.1
#48 lore raw

PATCH 27/51 ARM: mach-mxs: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-mxs/include/mach/system.h |    4 +++-
 arch/arm/mach-mxs/system.c              |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
arch/arm/mach-mxs/include/mach/system.h +3 -1
index 0e42823..bcd8989 100644
@@ -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__ */
arch/arm/mach-mxs/system.c +3 -1
index 20ec3bd..add6428 100644
@@ -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);
Signature · 1 line
1.7.4.1
#49 lore raw

PATCH 28/51 ARM: mach-netx: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-netx/generic.c             |    7 +++++++
 arch/arm/mach-netx/include/mach/system.h |    6 ------
 2 files changed, 7 insertions(+), 6 deletions(-)
arch/arm/mach-netx/generic.c +7 -0
index 00023b5..13ed7a3 100644
@@ -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));
 }
 
arch/arm/mach-netx/include/mach/system.h +0 -6
index dc7b4bc..83ae2b1 100644
@@ -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
Signature · 1 line
1.7.4.1
#50 lore raw

PATCH 29/51 ARM: mach-nomadik: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-nomadik/cpu-8815.c            |   12 ++++++++++++
 arch/arm/mach-nomadik/include/mach/system.h |    9 ---------
 2 files changed, 12 insertions(+), 9 deletions(-)
arch/arm/mach-nomadik/cpu-8815.c +12 -0
index ac58e3b..a9c2406 100644
@@ -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);
arch/arm/mach-nomadik/include/mach/system.h +0 -9
index 7119f68..16f59f6 100644
@@ -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
Signature · 1 line
1.7.4.1
#51 lore raw

PATCH 30/51 ARM: mach-nuc93x: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-nuc93x/cpu.c                 |   12 ++++++++++++
 arch/arm/mach-nuc93x/include/mach/system.h |    6 +-----
 2 files changed, 13 insertions(+), 5 deletions(-)
arch/arm/mach-nuc93x/cpu.c +12 -0
index f6ff5d8..ccd7818 100644
@@ -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);
arch/arm/mach-nuc93x/include/mach/system.h +1 -5
index d26bd9a..a4d39a3 100644
@@ -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);
 }
-
Signature · 1 line
1.7.4.1
#52 lore raw

PATCH 31/51 ARM: mach-orion5x: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-orion5x/common.c              |   17 +++++++++++++++++
 arch/arm/mach-orion5x/include/mach/system.h |    8 --------
 2 files changed, 17 insertions(+), 8 deletions(-)
arch/arm/mach-orion5x/common.c +17 -0
index 0ab531d..557e4eb 100644
@@ -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;
 }
 
 /*
arch/arm/mach-orion5x/include/mach/system.h +0 -8
index a1d6e46..91a933c 100644
@@ -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
Signature · 1 line
1.7.4.1
#53 lore raw

PATCH 32/51 ARM: mach-pnx4008: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-pnx4008/core.c                |    6 ++++++
 arch/arm/mach-pnx4008/include/mach/system.h |    5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)
arch/arm/mach-pnx4008/core.c +6 -0
index 6339975..7184172 100644
@@ -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 = {
arch/arm/mach-pnx4008/include/mach/system.h +0 -5
index 5dda2bb..6710ed3 100644
@@ -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
Signature · 1 line
1.7.4.1
#54 lore raw

PATCH 33/51 ARM: mach-prima2: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/mach-prima2/Makefile +1 -0
index 7af7fc0..75a7127 100644
@@ -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
arch/arm/mach-prima2/include/mach/system.h +0 -6
index 0dbd257..1d14a77 100644
@@ -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
arch/arm/mach-prima2/reset.c new file +22 -0
new file mode 100644
index 0000000..5473ae8
@@ -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);
Signature · 1 line
1.7.4.1
#55 lore raw

PATCH 33/51 ARM: mach-prima2: use arm_arch_reset instead of arch_reset

2011/10/28 Will Deacon <[email protected]>:

Quoted 4 lines

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

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.

Quoted 72 lines

---

?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

arch/arm/mach-prima2/Makefile +0 -0
index 7af7fc0..75a7127 100644
@@ -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

arch/arm/mach-prima2/include/mach/system.h +0 -0
index 0dbd257..1d14a77 100644
@@ -9,11 +9,6 @@

?#ifndef __MACH_SYSTEM_H__
?#define __MACH_SYSTEM_H__

arch/arm/mach-prima2/include/mach/system.h +0 -5
-#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)

arch/arm/mach-prima2/include/mach/system.h +0 -1
@@ -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

arch/arm/mach-prima2/reset.c new file +22 -1
new file mode 100644
index 0000000..5473ae8
@@ -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);
--
Quoted 1 line

1.7.4.1

Thanks
barry

#56 lore raw

PATCH 33/51 ARM: mach-prima2: use arm_arch_reset instead of arch_reset

Quoted 10 lines · Barry Song

2011/10/28 Will Deacon <[email protected]>:

Quoted 4 lines

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

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

#57 lore raw

PATCH 34/51 ARM: mach-pxa: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-pxa/include/mach/system.h |    6 +++---
 arch/arm/mach-pxa/reset.c               |    8 +++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)
arch/arm/mach-pxa/include/mach/system.h +3 -3
index d1fce8b..0687110 100644
@@ -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)
+{
+}
arch/arm/mach-pxa/reset.c +7 -1
index 01e9d64..075598a 100644
@@ -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);
Signature · 1 line
1.7.4.1
#58 lore raw

PATCH 34/51 ARM: mach-pxa: use arm_arch_reset instead of arch_reset

Quoted 44 lines

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

---
 arch/arm/mach-pxa/include/mach/system.h |    6 +++---
 arch/arm/mach-pxa/reset.c               |    8 +++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-pxa/include/mach/system.h index d1fce8b..0687110 100644

arch/arm/mach-pxa/include/mach/system.h +3 -3
@@ -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)
+{
+}
arch/arm/mach-pxa/reset.c +1 -1
index 01e9d64..075598a 100644
@@ -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);
 

arch/arm/mach-pxa/reset.c void arch_reset(char mode, const char *cmd) · line 108

Quoted 9 lines
arch/arm/mach-pxa/reset.c +6 -0
@@ -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);
#59 lore raw

PATCH 35/51 ARM: mach-realview: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-realview/core.c                |   20 ++++++++++++++++++++
 arch/arm/mach-realview/include/mach/system.h |   13 -------------
 2 files changed, 20 insertions(+), 13 deletions(-)
arch/arm/mach-realview/core.c +20 -0
index 5c23450..96b6f75 100644
@@ -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);
arch/arm/mach-realview/include/mach/system.h +0 -13
index 6657ff23..1630766 100644
@@ -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
Signature · 1 line
1.7.4.1
#60 lore raw

PATCH 36/51 ARM: mach-rpc: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-rpc/include/mach/system.h |   10 ----------
 arch/arm/mach-rpc/riscpc.c              |   14 ++++++++++++++
 2 files changed, 14 insertions(+), 10 deletions(-)
arch/arm/mach-rpc/include/mach/system.h +0 -10
index 45c7b93..e9fb593 100644
@@ -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);
 }
arch/arm/mach-rpc/riscpc.c +14 -0
index 580b3c7..2d9ac6e 100644
@@ -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));
 }
 
Signature · 1 line
1.7.4.1
#61 lore raw

PATCH 37/51 ARM: mach-s3c64xx: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/mach-s3c64xx/Makefile +1 -0
index 61b4034..ba2f2ac 100644
@@ -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
 
arch/arm/mach-s3c64xx/include/mach/system.h +0 -7
index 2e58cb7..51bc8eb 100644
@@ -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 */
arch/arm/mach-s3c64xx/reset.c new file +26 -0
new file mode 100644
index 0000000..2ea710c
@@ -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);
Signature · 1 line
1.7.4.1
#62 lore raw

PATCH 38/51 ARM: mach-sa1100: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-sa1100/generic.c             |   13 +++++++++++++
 arch/arm/mach-sa1100/include/mach/system.h |    8 --------
 2 files changed, 13 insertions(+), 8 deletions(-)
arch/arm/mach-sa1100/generic.c +13 -0
index e21f347..fb49654 100644
@@ -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));
 }
arch/arm/mach-sa1100/include/mach/system.h +0 -8
index ba9da9f..ac3bdb8 100644
@@ -3,7 +3,6 @@
  *
  * Copyright (c) 1999 Nicolas Pitre <[email protected]>
  */
-#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;
-	}
 }
Signature · 1 line
1.7.4.1
#63 lore raw

PATCH 39/51 ARM: mach-shark: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-shark/core.c                |    5 ++++-
 arch/arm/mach-shark/include/mach/system.h |    5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)
arch/arm/mach-shark/core.c +4 -1
index ac2873c..bbe4fc5 100644
@@ -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;
 }
 
arch/arm/mach-shark/include/mach/system.h +3 -2
index 21c373b..2cc363a 100644
@@ -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)
 {
Signature · 1 line
1.7.4.1
#64 lore raw

PATCH 40/51 ARM: mach-shmobile: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/mach-shmobile/Makefile +1 -1
index 612b270..8f12b57 100644
@@ -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
arch/arm/mach-shmobile/include/mach/system.h +0 -1
index 76a687e..4f2bea5 100644
@@ -8,7 +8,6 @@ static inline void arch_idle(void)
 
 static inline void arch_reset(char mode, const char *cmd)
 {
-	cpu_reset(0);
 }
 
 #endif
arch/arm/mach-shmobile/reset.c new file +18 -0
new file mode 100644
index 0000000..ab53fb9
@@ -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);
Signature · 1 line
1.7.4.1
#65 lore raw

PATCH 41/51 ARM: mach-tegra: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-tegra/common.c              |    4 ++--
 arch/arm/mach-tegra/include/mach/system.h |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/mach-tegra/common.c +2 -2
index d5e3f89..aaf85c6 100644
@@ -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;
 }
arch/arm/mach-tegra/include/mach/system.h +3 -3
index 027c421..b87b8a4 100644
@@ -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)
 {
Signature · 1 line
1.7.4.1
#66 lore raw

PATCH 42/51 ARM: mach-u300: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/mach-u300/Makefile +1 -1
index 8fd354a..599f4eb 100644
@@ -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-		:=
arch/arm/mach-u300/include/mach/system.h +1 -25
index 8daf136..0ddf3cd 100644
@@ -8,35 +8,11 @@
  * System shutdown and reset functions.
  * Author: Linus Walleij <[email protected]>
  */
-#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);
 }
arch/arm/mach-u300/reset.c new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#67 lore raw

PATCH 42/51 ARM: mach-u300: use arm_arch_reset instead of arch_reset

Quoted 4 lines · Will Deacon

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

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

For patch 1 and 42.

Yours,
Linus Walleij

#68 lore raw

PATCH 43/51 ARM: mach-versatile: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/mach-versatile/core.c                |   14 ++++++++++++++
 arch/arm/mach-versatile/include/mach/system.h |    8 --------
 2 files changed, 14 insertions(+), 8 deletions(-)
arch/arm/mach-versatile/core.c +14 -0
index e340a54..5d97b6e 100644
@@ -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;
 }
 
 /*
arch/arm/mach-versatile/include/mach/system.h +0 -8
index 8ffc12a..ebc6348 100644
@@ -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
Signature · 1 line
1.7.4.1
#69 lore raw

PATCH 44/51 ARM: mach-vt8500: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/mach-vt8500/Makefile +1 -1
index 81aedb7..1932b82 100644
@@ -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
arch/arm/mach-vt8500/include/mach/system.h +0 -5
index d6c757e..4bbcce4 100644
@@ -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);
 }
arch/arm/mach-vt8500/reset.c new file +21 -0
new file mode 100644
index 0000000..631721a
@@ -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);
Signature · 1 line
1.7.4.1
#70 lore raw

PATCH 45/51 ARM: mach-w90x900: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/mach-w90x900/Makefile +1 -1
index 828c032..e771d1b 100644
@@ -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
arch/arm/mach-w90x900/include/mach/system.h +1 -18
index ce228bd..ed3478b 100644
@@ -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);
-	}
 }
-
arch/arm/mach-w90x900/reset.c new file +31 -0
new file mode 100644
index 0000000..08f1953
@@ -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);
Signature · 1 line
1.7.4.1
#71 lore raw

PATCH 46/51 ARM: plat-spear: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/plat-spear/Makefile +1 -1
index b4f340b..cb70a42 100644
@@ -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
arch/arm/plat-spear/include/plat/system.h +0 -11
index a235fa0..4a0d125 100644
@@ -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 */
arch/arm/plat-spear/reset.c new file +29 -0
new file mode 100644
index 0000000..607efb3
@@ -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);
Signature · 1 line
1.7.4.1
#72 lore raw

PATCH 47/51 ARM: plat-tcc: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/plat-tcc/include/mach/system.h |    5 -----
 arch/arm/plat-tcc/system.c              |   10 +++++++++-
 2 files changed, 9 insertions(+), 6 deletions(-)
arch/arm/plat-tcc/include/mach/system.h +0 -5
index 909e603..e97ae31 100644
@@ -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
arch/arm/plat-tcc/system.c +9 -1
index cc208fa..c3badd5 100644
@@ -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);
Signature · 1 line
1.7.4.1
#73 lore raw

PATCH 48/51 ARM: plat-s5p: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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%)
arch/arm/mach-exynos4/include/mach/system.h +0 -2
index 5e3220c..0063a6d 100644
@@ -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 */
arch/arm/mach-s5p64x0/include/mach/system.h +0 -2
index 60f5753..cf26e09 100644
@@ -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 */
arch/arm/mach-s5pc100/include/mach/system.h +0 -2
index a9ea57c..afc96c2 100644
@@ -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 */
arch/arm/mach-s5pv210/include/mach/system.h +0 -2
index af8a200..bf288ce 100644
@@ -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 */
arch/arm/plat-s5p/Makefile +1 -0
index 4b53e04..2511d58 100644
@@ -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
arch/arm/plat-s5p/system-reset.c renamed from arch/arm/plat-s5p/include/plat/system-reset.h +13 -4
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
@@ -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);
Signature · 1 line
1.7.4.1
#74 lore raw

PATCH 49/51 ARM: plat-mxc: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 arch/arm/plat-mxc/include/mach/system.h |    2 --
 arch/arm/plat-mxc/system.c              |    3 ++-
 2 files changed, 2 insertions(+), 3 deletions(-)
arch/arm/plat-mxc/include/mach/system.h +0 -2
index 51f02a9..0cce970 100644
@@ -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__ */
arch/arm/plat-mxc/system.c +2 -1
index 8024f2a..107e0a6 100644
@@ -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;
 }
Signature · 1 line
1.7.4.1
#75 lore raw

PATCH 50/51 ARM: plat-s3c24xx: use arm_arch_reset instead of arch_reset

In reply to Will Deacon

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

---
 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
arch/arm/mach-s3c2410/include/mach/system-reset.h deleted +0 -32
deleted file mode 100644
index 6faadce..0000000
@@ -1,32 +0,0 @@
-/* arch/arm/mach-s3c2410/include/mach/system-reset.h
- *
- * Copyright (c) 2008 Simtec Electronics
- *	Ben Dooks <[email protected]>
- *
- * 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);
-}
arch/arm/mach-s3c2410/include/mach/system.h +0 -2
index a8cbca6..a94e7a6 100644
@@ -54,5 +54,3 @@ static void arch_idle(void)
 	else
 		s3c24xx_default_idle();
 }
-
-#include <mach/system-reset.h>
arch/arm/mach-s3c64xx/include/mach/system.h +1 -1
index 51bc8eb..436a8b3 100644
@@ -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)
 {
 }
 
arch/arm/plat-s3c24xx/cpu.c +20 -3
index c1fc6c6..b8714db 100644
@@ -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));
Signature · 1 line
1.7.4.1
#76 lore raw

PATCH 51/51 ARM: reset: remove empty arch_reset definitions

In reply to Will Deacon

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(...) { }
---
 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(-)
arch/arm/kernel/process.c +1 -6
index 13e68c5..0594f4c 100644
@@ -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)
arch/arm/mach-at91/include/mach/system.h +0 -4
index 079eb12..cbd64f3 100644
@@ -47,8 +47,4 @@ static inline void arch_idle(void)
 #endif
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-bcmring/include/mach/system.h +0 -4
index 6cd872d..e7343c5 100644
@@ -27,8 +27,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-clps711x/include/mach/system.h +0 -4
index 9982deb..23d6ef8 100644
@@ -32,8 +32,4 @@ static inline void arch_idle(void)
 	mov	r0, r0");
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-cns3xxx/include/mach/system.h +0 -4
index 092d774..7f43a64 100644
@@ -23,8 +23,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-davinci/include/mach/system.h +0 -4
index 6bd1dc0..fcb7a01 100644
@@ -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 */
arch/arm/mach-dove/include/mach/system.h +0 -4
index ce3e749..21d651a 100644
@@ -16,8 +16,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-ebsa110/include/mach/system.h +0 -4
index 574e633..2e4af65 100644
@@ -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
arch/arm/mach-ep93xx/include/mach/system.h +0 -4
index ce48083..a2f0967 100644
@@ -8,7 +8,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-footbridge/include/mach/system.h +0 -4
index 0c19392..85f44ab 100644
@@ -17,7 +17,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-gemini/include/mach/system.h +0 -4
index 7df8e48..3c4f114 100644
@@ -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 */
arch/arm/mach-h720x/include/mach/system.h +0 -5
index 4c2fba9..16ac46e 100644
@@ -24,9 +24,4 @@ static void arch_idle(void)
 	nop();
 }
 
-
-static __inline__ void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-integrator/include/mach/system.h +0 -4
index 6e5adbf..37314a2 100644
@@ -32,8 +32,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-iop13xx/include/mach/system.h +0 -4
index 6b9bba7..9f0d83e 100644
@@ -12,7 +12,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-iop32x/include/mach/system.h +0 -4
index 094714d..0ee7dae 100644
@@ -15,7 +15,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-iop33x/include/mach/system.h +0 -4
index df98c56..04500c8 100644
@@ -13,7 +13,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-ixp2000/include/mach/system.h +0 -4
index d79c7ad..47c8757 100644
@@ -13,7 +13,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-ixp23xx/include/mach/system.h +0 -4
index 4569003..3b89dd5 100644
@@ -15,7 +15,3 @@ static inline void arch_idle(void)
 		cpu_do_idle();
 #endif
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-ixp4xx/include/mach/system.h +0 -5
index ed5964c..5ac2578 100644
@@ -18,8 +18,3 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 #endif
 }
-
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-kirkwood/include/mach/system.h +0 -4
index f094431..f85cf7f 100644
@@ -14,9 +14,5 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 
 #endif
arch/arm/mach-ks8695/include/mach/system.h +0 -4
index b73ee70..59fe992 100644
@@ -24,8 +24,4 @@ static void arch_idle(void)
 
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-lpc32xx/include/mach/system.h +0 -4
index 9c6cc0c..bf176c9 100644
@@ -24,8 +24,4 @@ static void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-mmp/include/mach/system.h +0 -4
index b09c19a..f5add75 100644
@@ -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 */
arch/arm/mach-msm/include/mach/system.h +0 -4
index ab6590b..a8a53b2 100644
@@ -16,7 +16,3 @@
 #include <mach/hardware.h>
 
 void arch_idle(void);
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-mv78xx0/include/mach/system.h +0 -4
index 1a41dc5..dd7a016 100644
@@ -16,9 +16,5 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 
 #endif
arch/arm/mach-mxs/include/mach/system.h +0 -4
index bcd8989..e7ad1bb 100644
@@ -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__ */
arch/arm/mach-netx/include/mach/system.h +0 -4
index 83ae2b1..b38fa36 100644
@@ -24,9 +24,5 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
 
arch/arm/mach-nomadik/include/mach/system.h +0 -4
index 16f59f6..25e198b 100644
@@ -29,8 +29,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-nuc93x/include/mach/system.h +0 -4
index a4d39a3..08188e7 100644
@@ -18,7 +18,3 @@
 static void arch_idle(void)
 {
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-orion5x/include/mach/system.h +0 -4
index 91a933c..997b13e 100644
@@ -18,8 +18,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-pnx4008/include/mach/system.h +0 -4
index 6710ed3..60cfe71 100644
@@ -26,8 +26,4 @@ static void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-prima2/include/mach/system.h +0 -4
index 1d14a77..98e5d83 100644
@@ -16,8 +16,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-pxa/include/mach/system.h +0 -5
index 0687110..2ff62d6 100644
@@ -16,8 +16,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-realview/include/mach/system.h +0 -4
index 1630766..471b671 100644
@@ -30,8 +30,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-rpc/include/mach/system.h +0 -4
index e9fb593..359bab9 100644
@@ -11,7 +11,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-s3c64xx/include/mach/system.h +0 -4
index 436a8b3..353ed43 100644
@@ -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 */
arch/arm/mach-sa1100/include/mach/system.h +0 -4
index ac3bdb8..6bcafe3 100644
@@ -8,7 +8,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-shark/include/mach/system.h +0 -3
index 2cc363a..c543685 100644
@@ -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)
 {
arch/arm/mach-shmobile/include/mach/system.h +0 -4
index 4f2bea5..e150937 100644
@@ -6,8 +6,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-tegra/include/mach/system.h +0 -3
index b87b8a4..bc51978 100644
@@ -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)
 {
arch/arm/mach-u300/include/mach/system.h +0 -4
index 0ddf3cd..574d46e 100644
@@ -12,7 +12,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-ux500/include/mach/system.h +0 -5
index c0cd800..258e5c9 100644
@@ -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
arch/arm/mach-versatile/include/mach/system.h +0 -4
index ebc6348..cc5cdd9 100644
@@ -34,8 +34,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-vexpress/include/mach/system.h +0 -4
index 899a4e6..f653a8e 100644
@@ -30,8 +30,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
arch/arm/mach-vt8500/include/mach/system.h +0 -4
index 4bbcce4..6daf809 100644
@@ -7,7 +7,3 @@ static inline void arch_idle(void)
 {
 	cpu_do_idle();
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-w90x900/include/mach/system.h +0 -4
index ed3478b..da6e4e8 100644
@@ -18,7 +18,3 @@
 static void arch_idle(void)
 {
 }
-
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
arch/arm/mach-zynq/include/mach/system.h +0 -5
index 1b84d70..8e88e0b 100644
@@ -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
arch/arm/plat-omap/include/plat/system.h +0 -3
index ac32d88..91db6db 100644
@@ -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);
 
arch/arm/plat-spear/include/plat/system.h +0 -4
index 4a0d125..86c6f83 100644
@@ -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 */
arch/arm/plat-tcc/include/mach/system.h +0 -4
index e97ae31..da3f019 100644
@@ -19,8 +19,4 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-}
-
 #endif
Signature · 1 line
1.7.4.1
#77 lore raw

cover Remove inline arch_reset definitions from system.h

In reply to Will Deacon

On Oct 28 2011, at 15:43, Will Deacon was caught saying:

Quoted 10 lines

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.

Quoted 6 lines

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

Signature · 3 lines
"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
#78 lore raw

cover Remove inline arch_reset definitions from system.h

Quoted 16 lines · Deepak Saxena

On Oct 28 2011, at 15:43, Will Deacon was caught saying:

Quoted 15 lines

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.

Quoted 7 lines
Quoted 1 line

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.

Quoted 5 lines

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