Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* AT91 reboot code
@ 2011-11-01 14:40 Russell King - ARM Linux
  2011-11-02  5:43 ` Andrew Victor
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2011-11-01 14:40 UTC (permalink / raw)
  To: linux-arm-kernel

In arch/arm/mach-at91/include/mach/system.h, I find:

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

Is there any reason this can't just be:

void (*arch_reset)(char mode, const char *cmd);

and then change these:

arch/arm/mach-at91/at91rm9200.c:    at91_arch_reset = at91rm9200_reset;
arch/arm/mach-at91/at91sam9263.c:   at91_arch_reset = at91sam9_alt_reset;
arch/arm/mach-at91/at91sam9260.c:   at91_arch_reset = at91sam9_alt_reset;
arch/arm/mach-at91/at91sam9g45.c:   at91_arch_reset = at91sam9g45_reset;
arch/arm/mach-at91/at91cap9.c:      at91_arch_reset = at91cap9_reset;
arch/arm/mach-at91/at91sam9261.c:   at91_arch_reset = at91sam9_alt_reset;
arch/arm/mach-at91/at91sam9rl.c:    at91_arch_reset = at91sam9_alt_reset;

and the assigned function prototypes appropriately?  This level of
additional indirection is a right pain for trying to clean up stuff in
this area and it needs to die.

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

* AT91 reboot code
  2011-11-01 14:40 AT91 reboot code Russell King - ARM Linux
@ 2011-11-02  5:43 ` Andrew Victor
  2011-11-02 10:24   ` Will Deacon
  2011-11-02 14:59   ` Russell King - ARM Linux
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew Victor @ 2011-11-02  5:43 UTC (permalink / raw)
  To: linux-arm-kernel

hi Russell,

> Is there any reason this can't just be:
>
> void (*arch_reset)(char mode, const char *cmd);

I don't see any reason why not, except if arch_reset() can be called
early in the setup code (before the platform initialization).


Regards,
  Andrew Victor

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

* AT91 reboot code
  2011-11-02  5:43 ` Andrew Victor
@ 2011-11-02 10:24   ` Will Deacon
  2011-11-02 14:59   ` Russell King - ARM Linux
  1 sibling, 0 replies; 6+ messages in thread
From: Will Deacon @ 2011-11-02 10:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 02, 2011 at 05:43:28AM +0000, Andrew Victor wrote:
> hi Russell,
> 
> > Is there any reason this can't just be:
> >
> > void (*arch_reset)(char mode, const char *cmd);
> 
> I don't see any reason why not, except if arch_reset() can be called
> early in the setup code (before the platform initialization).

That's certainly the approach I took here:

http://lists.infradead.org/pipermail/linux-arm-kernel/2011-October/070729.html

but I only compile-tested it.

Will

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

* AT91 reboot code
  2011-11-02  5:43 ` Andrew Victor
  2011-11-02 10:24   ` Will Deacon
@ 2011-11-02 14:59   ` Russell King - ARM Linux
  2011-11-02 15:12     ` Russell King - ARM Linux
  1 sibling, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2011-11-02 14:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 02, 2011 at 07:43:28AM +0200, Andrew Victor wrote:
> hi Russell,
> 
> > Is there any reason this can't just be:
> >
> > void (*arch_reset)(char mode, const char *cmd);
> 
> I don't see any reason why not, except if arch_reset() can be called
> early in the setup code (before the platform initialization).

There is a case where it could happen - that is if you panic and you
have a non-zero panic timeout.

However, if you don't know how to restart your machine, then you're not
going to be able to do anything.  I'd therefore suggest this patch:

8<=======
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
ARM: restart: get rid of needless at91_arch_reset additional indirection

We don't need an additional level of indirection here, we can just
turn arch_reset into a function pointer directly and assign the
appropriate function (with appropriate arguments to it) just like
other platforms do.

However, ensure that it has a default to ensure that an early panic
doesn't cause an oops via a NULL pointer here and another panic.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-at91/at91cap9.c            |    4 ++--
 arch/arm/mach-at91/at91rm9200.c          |    4 ++--
 arch/arm/mach-at91/at91sam9260.c         |    2 +-
 arch/arm/mach-at91/at91sam9261.c         |    2 +-
 arch/arm/mach-at91/at91sam9263.c         |    2 +-
 arch/arm/mach-at91/at91sam9g45.c         |    4 ++--
 arch/arm/mach-at91/at91sam9rl.c          |    2 +-
 arch/arm/mach-at91/generic.h             |    2 +-
 arch/arm/mach-at91/include/mach/system.h |    9 ++-------
 arch/arm/mach-at91/setup.c               |    4 ++++
 10 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
index bfc6844..d45a877 100644
--- a/arch/arm/mach-at91/at91cap9.c
+++ b/arch/arm/mach-at91/at91cap9.c
@@ -311,7 +311,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 +333,7 @@ static void __init at91cap9_map_io(void)
 
 static void __init at91cap9_initialize(void)
 {
-	at91_arch_reset = at91cap9_reset;
+	arch_reset = at91cap9_reset;
 	pm_power_off = at91cap9_poweroff;
 	at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1);
 
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index f73302d..15161a2 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -286,7 +286,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 +307,7 @@ static void __init at91rm9200_map_io(void)
 
 static void __init at91rm9200_initialize(void)
 {
-	at91_arch_reset = at91rm9200_reset;
+	arch_reset = at91rm9200_reset;
 	at91_extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1)
 			| (1 << AT91RM9200_ID_IRQ2) | (1 << AT91RM9200_ID_IRQ3)
 			| (1 << AT91RM9200_ID_IRQ4) | (1 << AT91RM9200_ID_IRQ5)
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index cb397be..2301336 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -317,7 +317,7 @@ static void __init at91sam9260_map_io(void)
 
 static void __init at91sam9260_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arch_reset = at91sam9_alt_reset;
 	pm_power_off = at91sam9260_poweroff;
 	at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
 			| (1 << AT91SAM9260_ID_IRQ2);
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 6c8e3b5..771134b 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -286,7 +286,7 @@ static void __init at91sam9261_map_io(void)
 
 static void __init at91sam9261_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arch_reset = at91sam9_alt_reset;
 	pm_power_off = at91sam9261_poweroff;
 	at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
 			| (1 << AT91SAM9261_ID_IRQ2);
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 044f3c9..733abdd 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -303,7 +303,7 @@ static void __init at91sam9263_map_io(void)
 
 static void __init at91sam9263_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arch_reset = at91sam9_alt_reset;
 	pm_power_off = at91sam9263_poweroff;
 	at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1);
 
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index e04c5fb..9a02804 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -301,7 +301,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 +323,7 @@ static void __init at91sam9g45_map_io(void)
 
 static void __init at91sam9g45_initialize(void)
 {
-	at91_arch_reset = at91sam9g45_reset;
+	arch_reset = at91sam9g45_reset;
 	pm_power_off = at91sam9g45_poweroff;
 	at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0);
 
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index a238105..043d3ac 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -292,7 +292,7 @@ static void __init at91sam9rl_map_io(void)
 
 static void __init at91sam9rl_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arch_reset = at91sam9_alt_reset;
 	pm_power_off = at91sam9rl_poweroff;
 	at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0);
 
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 938b34f..80bc57f 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -57,7 +57,7 @@ extern void at91_irq_suspend(void);
 extern void at91_irq_resume(void);
 
 /* reset */
-extern void at91sam9_alt_reset(void);
+extern void at91sam9_alt_reset(char, const char *);
 
  /* GPIO */
 #define AT91RM9200_PQFP		3	/* AT91RM9200 PQFP package has 3 banks */
diff --git a/arch/arm/mach-at91/include/mach/system.h b/arch/arm/mach-at91/include/mach/system.h
index 36af14b..c03f05c 100644
--- a/arch/arm/mach-at91/include/mach/system.h
+++ b/arch/arm/mach-at91/include/mach/system.h
@@ -47,13 +47,8 @@ static inline void arch_idle(void)
 #endif
 }
 
-void (*at91_arch_reset)(void);
+extern void default_at91_reset(char, const char *);
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-	/* call the CPU-specific reset function */
-	if (at91_arch_reset)
-		(at91_arch_reset)();
-}
+void (*arch_reset)(char mode, const char *cmd) = default_at91_reset;
 
 #endif
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index aa64294..bdb4474 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -295,3 +295,7 @@ void __init at91_initialize(unsigned long main_clock)
 
 	at91_boot_soc.init();
 }
+
+void default_at91_reset(char mode, const char *cmd)
+{
+}
-- 
1.7.4.4

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

* AT91 reboot code
  2011-11-02 14:59   ` Russell King - ARM Linux
@ 2011-11-02 15:12     ` Russell King - ARM Linux
  2011-11-02 15:41       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2011-11-02 15:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 02, 2011 at 02:59:03PM +0000, Russell King - ARM Linux wrote:
> On Wed, Nov 02, 2011 at 07:43:28AM +0200, Andrew Victor wrote:
> > hi Russell,
> > 
> > > Is there any reason this can't just be:
> > >
> > > void (*arch_reset)(char mode, const char *cmd);
> > 
> > I don't see any reason why not, except if arch_reset() can be called
> > early in the setup code (before the platform initialization).
> 
> There is a case where it could happen - that is if you panic and you
> have a non-zero panic timeout.
> 
> However, if you don't know how to restart your machine, then you're not
> going to be able to do anything.  I'd therefore suggest this patch:

And we can do one better with this given the size of this change.
As all the AT91 reset handlers are using a hardware method, we can
do without the arm_machine_restart() indirection too.  And we can
get rid of the icache enable in the assembly restart code as this
will now be the case.  This is a replacement patch for the previous.

I've taken the liberty to rename _reset to _restart as well, so we
have a common naming for this operation across converted platforms.

 arch/arm/mach-at91/at91cap9.c            |    4 ++--
 arch/arm/mach-at91/at91rm9200.c          |    4 ++--
 arch/arm/mach-at91/at91sam9260.c         |    2 +-
 arch/arm/mach-at91/at91sam9261.c         |    2 +-
 arch/arm/mach-at91/at91sam9263.c         |    2 +-
 arch/arm/mach-at91/at91sam9_alt_reset.S  |    9 ++-------
 arch/arm/mach-at91/at91sam9g45.c         |    4 ++--
 arch/arm/mach-at91/at91sam9rl.c          |    2 +-
 arch/arm/mach-at91/generic.h             |    3 +--
 arch/arm/mach-at91/include/mach/system.h |    5 -----
 10 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
index bfc6844..d4427f8 100644
--- a/arch/arm/mach-at91/at91cap9.c
+++ b/arch/arm/mach-at91/at91cap9.c
@@ -311,7 +311,7 @@ static struct at91_gpio_bank at91cap9_gpio[] = {
 	}
 };
 
-static void at91cap9_reset(void)
+static void at91cap9_restart(char mode, const char *cmd)
 {
 	at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
 }
@@ -333,7 +333,7 @@ static void __init at91cap9_map_io(void)
 
 static void __init at91cap9_initialize(void)
 {
-	at91_arch_reset = at91cap9_reset;
+	arm_pm_restart = at91cap9_restart;
 	pm_power_off = at91cap9_poweroff;
 	at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1);
 
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index f73302d..0a7b3bb 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -286,7 +286,7 @@ static struct at91_gpio_bank at91rm9200_gpio[] = {
 	}
 };
 
-static void at91rm9200_reset(void)
+static void at91rm9200_restart(char mode, const char *cmd)
 {
 	/*
 	 * Perform a hardware reset with the use of the Watchdog timer.
@@ -307,7 +307,7 @@ static void __init at91rm9200_map_io(void)
 
 static void __init at91rm9200_initialize(void)
 {
-	at91_arch_reset = at91rm9200_reset;
+	arm_pm_restart = at91rm9200_restart;
 	at91_extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1)
 			| (1 << AT91RM9200_ID_IRQ2) | (1 << AT91RM9200_ID_IRQ3)
 			| (1 << AT91RM9200_ID_IRQ4) | (1 << AT91RM9200_ID_IRQ5)
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index cb397be..85c5826 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -317,7 +317,7 @@ static void __init at91sam9260_map_io(void)
 
 static void __init at91sam9260_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arm_pm_restart = at91sam9_alt_restart;
 	pm_power_off = at91sam9260_poweroff;
 	at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
 			| (1 << AT91SAM9260_ID_IRQ2);
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 6c8e3b5..054182b 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -286,7 +286,7 @@ static void __init at91sam9261_map_io(void)
 
 static void __init at91sam9261_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arm_pm_restart = at91sam9_alt_restart;
 	pm_power_off = at91sam9261_poweroff;
 	at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
 			| (1 << AT91SAM9261_ID_IRQ2);
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 044f3c9..cd3c407 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -303,7 +303,7 @@ static void __init at91sam9263_map_io(void)
 
 static void __init at91sam9263_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arm_pm_restart = at91sam9_alt_restart;
 	pm_power_off = at91sam9263_poweroff;
 	at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1);
 
diff --git a/arch/arm/mach-at91/at91sam9_alt_reset.S b/arch/arm/mach-at91/at91sam9_alt_reset.S
index e0256de..d3f931c 100644
--- a/arch/arm/mach-at91/at91sam9_alt_reset.S
+++ b/arch/arm/mach-at91/at91sam9_alt_reset.S
@@ -14,20 +14,15 @@
  */
 
 #include <linux/linkage.h>
-#include <asm/system.h>
 #include <mach/hardware.h>
 #include <mach/at91sam9_sdramc.h>
 #include <mach/at91_rstc.h>
 
 			.arm
 
-			.globl	at91sam9_alt_reset
+			.globl	at91sam9_alt_restart
 
-at91sam9_alt_reset:	mrc	p15, 0, r0, c1, c0, 0
-			orr	r0, r0, #CR_I
-			mcr	p15, 0, r0, c1, c0, 0		@ enable I-cache
-
-			ldr	r0, .at91_va_base_sdramc	@ preload constants
+at91sam9_alt_restart:	ldr	r0, .at91_va_base_sdramc	@ preload constants
 			ldr	r1, .at91_va_base_rstc_cr
 
 			mov	r2, #1
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index e04c5fb..8acaf7e 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -301,7 +301,7 @@ static struct at91_gpio_bank at91sam9g45_gpio[] = {
 	}
 };
 
-static void at91sam9g45_reset(void)
+static void at91sam9g45_restart(char mode, const char *cmd)
 {
 	at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
 }
@@ -323,7 +323,7 @@ static void __init at91sam9g45_map_io(void)
 
 static void __init at91sam9g45_initialize(void)
 {
-	at91_arch_reset = at91sam9g45_reset;
+	arm_pm_restart = at91sam9g45_restart;
 	pm_power_off = at91sam9g45_poweroff;
 	at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0);
 
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index a238105..61cbb46 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -292,7 +292,7 @@ static void __init at91sam9rl_map_io(void)
 
 static void __init at91sam9rl_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arm_pm_restart = at91sam9_alt_restart;
 	pm_power_off = at91sam9rl_poweroff;
 	at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0);
 
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 938b34f..7f4503b 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -57,7 +57,7 @@ extern void at91_irq_suspend(void);
 extern void at91_irq_resume(void);
 
 /* reset */
-extern void at91sam9_alt_reset(void);
+extern void at91sam9_alt_restart(char, const char *);
 
  /* GPIO */
 #define AT91RM9200_PQFP		3	/* AT91RM9200 PQFP package has 3 banks */
@@ -71,5 +71,4 @@ struct at91_gpio_bank {
 extern void __init at91_gpio_init(struct at91_gpio_bank *, int nr_banks);
 extern void __init at91_gpio_irq_setup(void);
 
-extern void (*at91_arch_reset)(void);
 extern int at91_extern_irq;
diff --git a/arch/arm/mach-at91/include/mach/system.h b/arch/arm/mach-at91/include/mach/system.h
index 36af14b..079eb12 100644
--- a/arch/arm/mach-at91/include/mach/system.h
+++ b/arch/arm/mach-at91/include/mach/system.h
@@ -47,13 +47,8 @@ static inline void arch_idle(void)
 #endif
 }
 
-void (*at91_arch_reset)(void);
-
 static inline void arch_reset(char mode, const char *cmd)
 {
-	/* call the CPU-specific reset function */
-	if (at91_arch_reset)
-		(at91_arch_reset)();
 }
 
 #endif

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

* AT91 reboot code
  2011-11-02 15:12     ` Russell King - ARM Linux
@ 2011-11-02 15:41       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-02 15:41 UTC (permalink / raw)
  To: linux-arm-kernel

On 15:12 Wed 02 Nov     , Russell King - ARM Linux wrote:
> On Wed, Nov 02, 2011 at 02:59:03PM +0000, Russell King - ARM Linux wrote:
> > On Wed, Nov 02, 2011 at 07:43:28AM +0200, Andrew Victor wrote:
> > > hi Russell,
> > > 
> > > > Is there any reason this can't just be:
> > > >
> > > > void (*arch_reset)(char mode, const char *cmd);
> > > 
> > > I don't see any reason why not, except if arch_reset() can be called
> > > early in the setup code (before the platform initialization).
> > 
> > There is a case where it could happen - that is if you panic and you
> > have a non-zero panic timeout.
> > 
> > However, if you don't know how to restart your machine, then you're not
> > going to be able to do anything.  I'd therefore suggest this patch:
> 
> And we can do one better with this given the size of this change.
> As all the AT91 reset handlers are using a hardware method, we can
> do without the arm_machine_restart() indirection too.  And we can
> get rid of the icache enable in the assembly restart code as this
> will now be the case.  This is a replacement patch for the previous.
> 
> I've taken the liberty to rename _reset to _restart as well, so we
> have a common naming for this operation across converted platforms.
> 
>  arch/arm/mach-at91/at91cap9.c            |    4 ++--
>  arch/arm/mach-at91/at91rm9200.c          |    4 ++--
>  arch/arm/mach-at91/at91sam9260.c         |    2 +-
>  arch/arm/mach-at91/at91sam9261.c         |    2 +-
>  arch/arm/mach-at91/at91sam9263.c         |    2 +-
>  arch/arm/mach-at91/at91sam9_alt_reset.S  |    9 ++-------
>  arch/arm/mach-at91/at91sam9g45.c         |    4 ++--
>  arch/arm/mach-at91/at91sam9rl.c          |    2 +-
>  arch/arm/mach-at91/generic.h             |    3 +--
>  arch/arm/mach-at91/include/mach/system.h |    5 -----
>  10 files changed, 13 insertions(+), 24 deletions(-)
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

I'll test it later this week

Best Regards,
J.

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

end of thread, other threads:[~2011-11-02 15:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-01 14:40 AT91 reboot code Russell King - ARM Linux
2011-11-02  5:43 ` Andrew Victor
2011-11-02 10:24   ` Will Deacon
2011-11-02 14:59   ` Russell King - ARM Linux
2011-11-02 15:12     ` Russell King - ARM Linux
2011-11-02 15:41       ` Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox