reboot: Fix Realview ARM1176PB board reboot
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 reboot: Fix Realview ARM1176PB board reboot
Catalin,
Ping on this one! Is there anything else that I must do here other than the void* type cast that Russell asked me to correct?
Regards,
Philby
Quoted 12 lines · Catalin Marinas
Quoted 5 lines · philby john
The implementation is now as per your recommendations. Also I adopted the approach followed in
at91cap9.cwhere they use the function ptrat91_arch_reset(). But please note that I did not "export" this function ptr in the implementation, because I could not find the same inat91cap9.cand also I felt it wasn't required.That's strange, they define the pointer in the
system.hfile. Shouldn't this be an extern declaration and the pointer defined in a .c file?There are still a few (minor) issues, see below.
Quoted 11 lines
arch/arm/mach-realview/core.h extern void __iomem *timer3_va_base; · line 66
Quoted 8 lines
arch/arm/mach-realview/core.h +1
-1@@ -63,5 +63,5 @@ extern void __iomem *timer3_va_base;extern void realview_leds_event (led_event_t ledevt);extern void realview_timer_init (unsigned int timer_irq);extern int realview_flash_register (struct resource *res,u32 num); - +extern void (*realview_reset)(char );Maybe place this declaration in
system.hif no one argues that theat91cap9.ccase is wrong.
This I think is the correct place otherwise compiler would throw such errors..arch/arm/mach-realview/realview_pb11mp.c: In function 'realview_pb11mp_init':arch/arm/mach-realview/realview_pb11mp.c:337: error: 'realview_reset' undeclared (first use in this function) arch/arm/mach-realview/realview_pb1176.c: In function 'realview_pb1176_init':arch/arm/mach-realview/realview_pb1176.c:322: error: 'realview_reset' undeclared (first use in this function)
Quoted 11 lines
arch/arm/mach-realview/core.h extern void __iomem *timer3_va_base;
Quoted 8 lines
arch/arm/mach-realview/core.h +7
-0+static void realview_pb1176_reset (char mode) +{ +void __iomem *hdr_ctrl; +void __iomem *rst_hdr_ctrl; + + hdr_ctrl =__io_address (REALVIEW_SYS_BASE ) +REALVIEW_SYS_RESETCTL_OFFSET ; + rst_hdr_ctrl =__io_address (REALVIEW_SYS_BASE ) +REALVIEW_SYS_LOCK_OFFSET ;Can you not merge the above four lines into two? I.e. assign the values when you define the variable?
Changed.
Quoted 15 lines
arch/arm/mach-realview/core.h static void __init realview_pb1176_init(void) · line 292
Quoted 6 lines
arch/arm/mach-realview/core.h +1
-0@@ -278,6 +289,7 @@ static void __init realview_pb1176_init(void)#ifdef CONFIG_LEDS leds_event = realview_leds_event;#endif + realview_reset = (void *) realview_pb1176_reset;Minor point (it occurs a few times in this patch) - we don't leave a space after "(void *)".
Quoted 5 lines
include/asm-arm/arch-realview/board-pb1176.h +0
-0@@ -131,6 +131,11 @@#define NR_GIC_PB1176 2
Quoted 8 lines
include/asm-arm/arch-realview/board-pb1176.h line 136
Quoted 4 lines
include/asm-arm/arch-realview/board-pb1176.h +3
-0/* +* Control register SYS_RESETCTL is set to 1 to force a soft reset +*/ +#define REALVIEW_SYS_LOCKVAL_RSTCTL 0x0100If this value is specific to PB1176, could you change the name to
REALVIEW_PB1176_... to avoid future overlap with other RealView definitions? You could also move it before the IRQ_* definitions.
Done
Quoted 9 lines
Quoted 9 lines
include/asm-arm/arch-realview/board-pb11mp.h +0
-0@@ -164,6 +164,18 @@#define NR_GIC_PB11MP 2
Quoted 13 lines
include/asm-arm/arch-realview/board-pb11mp.h line 177
Quoted 11 lines
include/asm-arm/arch-realview/board-pb11mp.h +11
-0+/* +* Values for REALVIEW_SYS_RESET_CTRL +*/ +#define REALVIEW_SYS_CTRL_RESET_CONFIGCLR 0x01 +#define REALVIEW_SYS_CTRL_RESET_CONFIGINIT 0x02 +#define REALVIEW_SYS_CTRL_RESET_DLLRESET 0x03 +#define REALVIEW_SYS_CTRL_RESET_PLLRESET 0x04 +#define REALVIEW_SYS_CTRL_RESET_POR 0x05 +#define REALVIEW_SYS_CTRL_RESET_DoC 0x06 + +#define REALVIEW_SYS_CTRL_LED (1 << 0)Same as above, change names to REALVIEW_PB11MP_*
Done
Quoted 9 lines
Quoted 9 lines
include/asm-arm/arch-realview/system.h +0
-0@@ -25,6 +25,8 @@#include <asm/io.h> #include <asm/arch/platform.h>
Quoted 5 lines
include/asm-arm/arch-realview/system.h line 28
Quoted 1 line
include/asm-arm/arch-realview/system.h +1
-0+void (*realview_reset) (char mode) =NULL ;I would move this to
mach-realview/core.c(and remove the space after (*realview_reset)). No need for NULL declaration as the global variables will be automatically zero-initialised.
Done. Also a concern reviewers at Montavista had was that, they could not find a similar specific reset code for ARM1176EB, since all code setting reset control registers have been removed from arch_reset(). So they advised,
1)Retention of old reset method and fall back to executing the old method in arch_reset when realview_reset is NULL.
OR
2)Add proper stubs so that developers could add if they knew the proper register values.
Preferring option 1 to 2.
PATCH FOLLOWS
Quoted 1 line
From
3f538d22df06ac9c5afa0e28d9513686043e3c9eMon Sep 17 00:00:00 2001
From: pjohn <[email protected]>
Date: Wed, 8 Jul 2009 17:53:01 +0530
Subject: [PATCH] Fix Realview ARM1176PB board reboot
This is the fix for proper reboot of Realview ARM1176PB board when issuing the reboot command. Setting the eighth bit of control register SYS_RESETCTL to 1 to force a soft reset. arch_reset() is modified for realview machines to call machine specific reset function pointers.
--- arch/arm/mach-realview/core.h | 2 +- arch/arm/mach-realview/include/mach/board-pb1176.h | 5 +++++ arch/arm/mach-realview/include/mach/board-pb11mp.h | 12 ++++++++++++ arch/arm/mach-realview/include/mach/platform.h | 15 +-------------- arch/arm/mach-realview/include/mach/system.h | 10 ++++------ arch/arm/mach-realview/realview_pb1176.c | 11 +++++++++++ arch/arm/mach-realview/realview_pb11mp.c | 16 ++++++++++++++++ 7 files changed, 50 insertions(+), 21 deletions(-)
arch/arm/mach-realview/core.h +1 -1
@@ -61,5 +61,5 @@ extern void realview_timer_init(unsigned int timer_irq);extern int realview_flash_register (struct resource *res,u32 num);extern int realview_eth_register (const char *name,struct resource *res);extern int realview_usb_register (struct resource *res); - +extern void (*realview_reset)(char );#endif
arch/arm/mach-realview/include/mach/board-pb1176.h +5 -0
@@ -73,4 +73,9 @@#define REALVIEW_PB1176_GIC_DIST_BASE 0x10041000/* GIC distributor, on FPGA */ #define REALVIEW_PB1176_L220_BASE 0x10110000/* L220 registers */ +/* +* Control register SYS_RESETCTL is set to 1 to force a soft reset +*/ +#define REALVIEW_PB1176_SYS_LOCKVAL_RSTCTL 0x0100 +#endif /* __ASM_ARCH_BOARD_PB1176_H */
arch/arm/mach-realview/include/mach/board-pb11mp.h +12 -0
@@ -81,4 +81,16 @@#define REALVIEW_TC11MP_GIC_DIST_BASE 0x1F001000/* Test chip interrupt controller distributor */ #define REALVIEW_TC11MP_L220_BASE 0x1F002000/* L220 registers */ +/* +* Values for REALVIEW_SYS_RESET_CTRL +*/ +#define REALVIEW_PB11MP_SYS_CTRL_RESET_CONFIGCLR 0x01 +#define REALVIEW_PB11MP_SYS_CTRL_RESET_CONFIGINIT 0x02 +#define REALVIEW_PB11MP_SYS_CTRL_RESET_DLLRESET 0x03 +#define REALVIEW_PB11MP_SYS_CTRL_RESET_PLLRESET 0x04 +#define REALVIEW_PB11MP_SYS_CTRL_RESET_POR 0x05 +#define REALVIEW_PB11MP_SYS_CTRL_RESET_DoC 0x06 + +#define REALVIEW_PB11MP_SYS_CTRL_LED (1 << 0) +#endif /* __ASM_ARCH_BOARD_PB11MP_H */
arch/arm/mach-realview/include/mach/platform.h +1 -14
@@ -119,19 +119,6 @@#define REALVIEW_SYS_TEST_OSC3 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC3_OFFSET)#define REALVIEW_SYS_TEST_OSC4 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC4_OFFSET) -/* -* Values for REALVIEW_SYS_RESET_CTRL -*/ -#define REALVIEW_SYS_CTRL_RESET_CONFIGCLR 0x01 -#define REALVIEW_SYS_CTRL_RESET_CONFIGINIT 0x02 -#define REALVIEW_SYS_CTRL_RESET_DLLRESET 0x03 -#define REALVIEW_SYS_CTRL_RESET_PLLRESET 0x04 -#define REALVIEW_SYS_CTRL_RESET_POR 0x05 -#define REALVIEW_SYS_CTRL_RESET_DoC 0x06 - -#define REALVIEW_SYS_CTRL_LED (1 << 0) - -/* ------------------------------------------------------------------------ * RealView control registers * ------------------------------------------------------------------------
@@ -153,7 +140,7 @@* SYS_CLD, SYS_BOOTCS */ #define REALVIEW_SYS_LOCK_LOCKED (1 << 16) -#define REALVIEW_SYS_LOCKVAL_MASK 0xFFFF/* write 0xA05F to enable write access */ +#define REALVIEW_SYS_LOCKVAL_MASK 0xA05F/* Enable write access */ /* * REALVIEW_SYS_FLASH
arch/arm/mach-realview/include/mach/system.h +4 -6
@@ -25,6 +25,8 @@#include <mach/hardware.h> #include <mach/platform.h> +void (*realview_reset)(char mode); +static inline void arch_idle (void ) {/*
@@ -36,16 +38,12 @@ static inline void arch_idle(void)static inline void arch_reset (char mode,const char *cmd) { -void __iomem *hdr_ctrl =__io_address (REALVIEW_SYS_BASE ) +REALVIEW_SYS_RESETCTL_OFFSET ; -unsigned int val; -/* * To reset, we hit the on-board reset register * in the system FPGA */ - val =__raw_readl (hdr_ctrl); - val |=REALVIEW_SYS_CTRL_RESET_CONFIGCLR ; -__raw_writel (val, hdr_ctrl); +if (realview_reset) +realview_reset (mode); }#endif
arch/arm/mach-realview/realview_pb1176.c +11 -0
@@ -274,6 +274,16 @@ static struct sys_timer realview_pb1176_timer = { .init = realview_pb1176_timer_init, }; +static void realview_pb1176_reset (char mode) +{ +void __iomem *hdr_ctrl =__io_address (REALVIEW_SYS_BASE ) + +REALVIEW_SYS_RESETCTL_OFFSET ; +void __iomem *rst_hdr_ctrl =__io_address (REALVIEW_SYS_BASE ) + +REALVIEW_SYS_LOCK_OFFSET ; +__raw_writel (REALVIEW_SYS_LOCKVAL_MASK , rst_hdr_ctrl); +__raw_writel (REALVIEW_PB1176_SYS_LOCKVAL_RSTCTL , hdr_ctrl); +} +static void __init realview_pb1176_init (void ) {int i;
@@ -297,6 +307,7 @@ static void __init realview_pb1176_init(void)#ifdef CONFIG_LEDS leds_event = realview_leds_event;#endif + realview_reset = (void *)realview_pb1176_reset; }MACHINE_START (REALVIEW_PB1176 ,"ARM-RealView PB1176" )
arch/arm/mach-realview/realview_pb11mp.c +16 -0
@@ -283,6 +283,21 @@ static struct sys_timer realview_pb11mp_timer = { .init = realview_pb11mp_timer_init, }; +static void realview_pb11mp_reset (char mode) +{ +void __iomem *hdr_ctrl =__io_address (REALVIEW_SYS_BASE ) + +REALVIEW_SYS_RESETCTL_OFFSET ; +unsigned int val; + +/* +* To reset, we hit the on-board reset register +* in the system FPGA +*/ + val =__raw_readl (hdr_ctrl); + val |=REALVIEW_PB11MP_SYS_CTRL_RESET_CONFIGCLR ; +__raw_writel (val, hdr_ctrl); +} +static void __init realview_pb11mp_init (void ) {int i;
@@ -308,6 +323,7 @@ static void __init realview_pb11mp_init(void)#ifdef CONFIG_LEDS leds_event = realview_leds_event;#endif + realview_reset = (void *) realview_pb11mp_reset; }MACHINE_START (REALVIEW_PB11MP ,"ARM-RealView PB11MPCore" )
Signature · 1 line
1.6.3.3.MVISTA
PATCH 1/1 reboot: Fix Realview ARM1176PB board reboot
Quoted 2 lines · Philby John
Ping on this one! Is there anything else that I must do here other than the void* type cast that Russell asked me to correct?
It seems to be ok but I haven't had time to try it on hardware. Assuming that you did the testing:
Thanks.
Signature · 1 line
Catalin
PATCH 1/1 reboot: Fix Realview ARM1176PB board reboot
Quoted 7 lines · Catalin Marinas
Quoted 2 lines · Philby John
Ping on this one! Is there anything else that I must do here other than the void* type cast that Russell asked me to correct?
It seems to be ok but I haven't had time to try it on hardware. Assuming that you did the testing:
Yes, I did test it multiple times and so did Montavista QA.
Quoted 1 line
Acked-by Catalin Marinas <[email protected]>
Thanks
-Philby
PATCH 1/1 reboot: Fix Realview ARM1176PB board reboot
In reply to Catalin MarinasQuoted 1 line
From
5232cef61052a2d25fa7301d06397811365ad65dMon Sep 17 00:00:00 2001
From: pjohn <[email protected]>
Date: Wed, 8 Jul 2009 17:53:01 +0530
Subject: [PATCH] Fix Realview ARM1176PB board reboot
This is the fix for proper reboot of Realview ARM1176PB board when issuing the reboot command. Setting the eighth bit of control register SYS_RESETCTL to 1 to force a soft reset. arch_reset() is modified for realview machines to call machine specific reset function pointers.
--- arch/arm/mach-realview/core.h | 2 +- arch/arm/mach-realview/include/mach/board-pb1176.h | 5 +++++ arch/arm/mach-realview/include/mach/board-pb11mp.h | 12 ++++++++++++ arch/arm/mach-realview/include/mach/platform.h | 15 +-------------- arch/arm/mach-realview/include/mach/system.h | 10 ++++------ arch/arm/mach-realview/realview_pb1176.c | 11 +++++++++++ arch/arm/mach-realview/realview_pb11mp.c | 16 ++++++++++++++++ 7 files changed, 50 insertions(+), 21 deletions(-)
arch/arm/mach-realview/core.h +1 -1
@@ -61,5 +61,5 @@ extern void realview_timer_init(unsigned int timer_irq);extern int realview_flash_register (struct resource *res,u32 num);extern int realview_eth_register (const char *name,struct resource *res);extern int realview_usb_register (struct resource *res); - +extern void (*realview_reset)(char );#endif
arch/arm/mach-realview/include/mach/board-pb1176.h +5 -0
@@ -73,4 +73,9 @@#define REALVIEW_PB1176_GIC_DIST_BASE 0x10041000/* GIC distributor, on FPGA */ #define REALVIEW_PB1176_L220_BASE 0x10110000/* L220 registers */ +/* +* Control register SYS_RESETCTL is set to 1 to force a soft reset +*/ +#define REALVIEW_PB1176_SYS_LOCKVAL_RSTCTL 0x0100 +#endif /* __ASM_ARCH_BOARD_PB1176_H */
arch/arm/mach-realview/include/mach/board-pb11mp.h +12 -0
@@ -81,4 +81,16 @@#define REALVIEW_TC11MP_GIC_DIST_BASE 0x1F001000/* Test chip interrupt controller distributor */ #define REALVIEW_TC11MP_L220_BASE 0x1F002000/* L220 registers */ +/* +* Values for REALVIEW_SYS_RESET_CTRL +*/ +#define REALVIEW_PB11MP_SYS_CTRL_RESET_CONFIGCLR 0x01 +#define REALVIEW_PB11MP_SYS_CTRL_RESET_CONFIGINIT 0x02 +#define REALVIEW_PB11MP_SYS_CTRL_RESET_DLLRESET 0x03 +#define REALVIEW_PB11MP_SYS_CTRL_RESET_PLLRESET 0x04 +#define REALVIEW_PB11MP_SYS_CTRL_RESET_POR 0x05 +#define REALVIEW_PB11MP_SYS_CTRL_RESET_DoC 0x06 + +#define REALVIEW_PB11MP_SYS_CTRL_LED (1 << 0) +#endif /* __ASM_ARCH_BOARD_PB11MP_H */
arch/arm/mach-realview/include/mach/platform.h +1 -14
@@ -119,19 +119,6 @@#define REALVIEW_SYS_TEST_OSC3 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC3_OFFSET)#define REALVIEW_SYS_TEST_OSC4 (REALVIEW_SYS_BASE + REALVIEW_SYS_TEST_OSC4_OFFSET) -/* -* Values for REALVIEW_SYS_RESET_CTRL -*/ -#define REALVIEW_SYS_CTRL_RESET_CONFIGCLR 0x01 -#define REALVIEW_SYS_CTRL_RESET_CONFIGINIT 0x02 -#define REALVIEW_SYS_CTRL_RESET_DLLRESET 0x03 -#define REALVIEW_SYS_CTRL_RESET_PLLRESET 0x04 -#define REALVIEW_SYS_CTRL_RESET_POR 0x05 -#define REALVIEW_SYS_CTRL_RESET_DoC 0x06 - -#define REALVIEW_SYS_CTRL_LED (1 << 0) - -/* ------------------------------------------------------------------------ * RealView control registers * ------------------------------------------------------------------------
@@ -153,7 +140,7 @@* SYS_CLD, SYS_BOOTCS */ #define REALVIEW_SYS_LOCK_LOCKED (1 << 16) -#define REALVIEW_SYS_LOCKVAL_MASK 0xFFFF/* write 0xA05F to enable write access */ +#define REALVIEW_SYS_LOCKVAL_MASK 0xA05F/* Enable write access */ /* * REALVIEW_SYS_FLASH
arch/arm/mach-realview/include/mach/system.h +4 -6
@@ -25,6 +25,8 @@#include <mach/hardware.h> #include <mach/platform.h> +void (*realview_reset)(char mode); +static inline void arch_idle (void ) {/*
@@ -36,16 +38,12 @@ static inline void arch_idle(void)static inline void arch_reset (char mode,const char *cmd) { -void __iomem *hdr_ctrl =__io_address (REALVIEW_SYS_BASE ) +REALVIEW_SYS_RESETCTL_OFFSET ; -unsigned int val; -/* * To reset, we hit the on-board reset register * in the system FPGA */ - val =__raw_readl (hdr_ctrl); - val |=REALVIEW_SYS_CTRL_RESET_CONFIGCLR ; -__raw_writel (val, hdr_ctrl); +if (realview_reset) +realview_reset (mode); }#endif
arch/arm/mach-realview/realview_pb1176.c +11 -0
@@ -274,6 +274,16 @@ static struct sys_timer realview_pb1176_timer = { .init = realview_pb1176_timer_init, }; +static void realview_pb1176_reset (char mode) +{ +void __iomem *hdr_ctrl =__io_address (REALVIEW_SYS_BASE ) + +REALVIEW_SYS_RESETCTL_OFFSET ; +void __iomem *rst_hdr_ctrl =__io_address (REALVIEW_SYS_BASE ) + +REALVIEW_SYS_LOCK_OFFSET ; +__raw_writel (REALVIEW_SYS_LOCKVAL_MASK , rst_hdr_ctrl); +__raw_writel (REALVIEW_PB1176_SYS_LOCKVAL_RSTCTL , hdr_ctrl); +} +static void __init realview_pb1176_init (void ) {int i;
@@ -297,6 +307,7 @@ static void __init realview_pb1176_init(void)#ifdef CONFIG_LEDS leds_event = realview_leds_event;#endif + realview_reset = realview_pb1176_reset; }MACHINE_START (REALVIEW_PB1176 ,"ARM-RealView PB1176" )
arch/arm/mach-realview/realview_pb11mp.c +16 -0
@@ -283,6 +283,21 @@ static struct sys_timer realview_pb11mp_timer = { .init = realview_pb11mp_timer_init, }; +static void realview_pb11mp_reset (char mode) +{ +void __iomem *hdr_ctrl =__io_address (REALVIEW_SYS_BASE ) + +REALVIEW_SYS_RESETCTL_OFFSET ; +unsigned int val; + +/* +* To reset, we hit the on-board reset register +* in the system FPGA +*/ + val =__raw_readl (hdr_ctrl); + val |=REALVIEW_PB11MP_SYS_CTRL_RESET_CONFIGCLR ; +__raw_writel (val, hdr_ctrl); +} +static void __init realview_pb11mp_init (void ) {int i;
@@ -308,6 +323,7 @@ static void __init realview_pb11mp_init(void)#ifdef CONFIG_LEDS leds_event = realview_leds_event;#endif + realview_reset = realview_pb11mp_reset; }MACHINE_START (REALVIEW_PB11MP ,"ARM-RealView PB11MPCore" )
Signature · 1 line
1.6.3.3.MVISTA