Message ID | fcc4ac9c73ae4b408d43cc9f5ddf3cfc48482461.1367188423.git.julien.grall@linaro.org |
---|---|
State | Changes Requested, archived |
Headers | show |
On Mon, 2013-04-29 at 00:02 +0100, Julien Grall wrote: > This platform contains nearly nothing specific except the reset function. > > Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com> > +/* Board-specific: base address of system controller */ > +#define SP810_ADDRESS 0x1C020000 Even better would be if this is in DT. Ian.
On 04/29/2013 05:27 PM, Ian Campbell wrote: > On Mon, 2013-04-29 at 00:02 +0100, Julien Grall wrote: >> This platform contains nearly nothing specific except the reset function. >> >> Signed-off-by: Julien Grall <julien.grall@linaro.org> > > Acked-by: Ian Campbell <ian.campbell@citrix.com> > >> +/* Board-specific: base address of system controller */ >> +#define SP810_ADDRESS 0x1C020000 > > Even better would be if this is in DT. It seems there is an *arm,vexpress-reset* node in the device tree. It needs some work, so I will send a separate patch to add support for the vexpress-reset function.
On Mon, 2013-04-29 at 18:52 +0100, Julien Grall wrote: > On 04/29/2013 05:27 PM, Ian Campbell wrote: > > > On Mon, 2013-04-29 at 00:02 +0100, Julien Grall wrote: > >> This platform contains nearly nothing specific except the reset function. > >> > >> Signed-off-by: Julien Grall <julien.grall@linaro.org> > > > > Acked-by: Ian Campbell <ian.campbell@citrix.com> > > > >> +/* Board-specific: base address of system controller */ > >> +#define SP810_ADDRESS 0x1C020000 > > > > Even better would be if this is in DT. > > It seems there is an *arm,vexpress-reset* node in the device tree. > > It needs some work, so I will send a separate patch to add support for > the vexpress-reset function. That's fine. If you are respinning this patch you could add an "XXX get from DT" marker. Ian.
diff --git a/xen/arch/arm/platforms/vexpress.c b/xen/arch/arm/platforms/vexpress.c index fd4ce74..7a9cfec 100644 --- a/xen/arch/arm/platforms/vexpress.c +++ b/xen/arch/arm/platforms/vexpress.c @@ -18,6 +18,7 @@ */ #include <asm/platforms/vexpress.h> +#include <asm/platform.h> #include <xen/mm.h> #define DCC_SHIFT 26 @@ -90,6 +91,31 @@ out: return ret; } +static void vexpress_reset(void) +{ + /* Use the SP810 system controller to force a reset */ + volatile uint32_t *sp810; + set_fixmap(FIXMAP_MISC, SP810_ADDRESS >> PAGE_SHIFT, DEV_SHARED); + sp810 = ((uint32_t *) + (FIXMAP_ADDR(FIXMAP_MISC) + (SP810_ADDRESS & ~PAGE_MASK))); + sp810[0] = 0x3; /* switch to slow mode */ + dsb(); isb(); + sp810[1] = 0x1; /* writing any value to SCSYSSTAT reg will reset system */ + dsb(); isb(); + clear_fixmap(FIXMAP_MISC); +} + +static const char const *vexpress_dt_compat[] __initdata = +{ + "arm,vexpress", + NULL +}; + +PLATFORM_START(vexpress, "VERSATILE EXPRESS") + .compatible = vexpress_dt_compat, + .reset = vexpress_reset, +PLATFORM_END + /* * Local variables: * mode: C diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c index a5c2085..cf42902 100644 --- a/xen/arch/arm/shutdown.c +++ b/xen/arch/arm/shutdown.c @@ -3,25 +3,11 @@ #include <xen/cpu.h> #include <xen/delay.h> #include <xen/lib.h> -#include <xen/mm.h> #include <xen/smp.h> #include <asm/platform.h> static void raw_machine_reset(void) { - /* XXX get this from device tree */ -#ifdef SP810_ADDRESS - /* Use the SP810 system controller to force a reset */ - volatile uint32_t *sp810; - set_fixmap(FIXMAP_MISC, SP810_ADDRESS >> PAGE_SHIFT, DEV_SHARED); - sp810 = ((uint32_t *) - (FIXMAP_ADDR(FIXMAP_MISC) + (SP810_ADDRESS & ~PAGE_MASK))); - sp810[0] = 0x3; /* switch to slow mode */ - dsb(); isb(); - sp810[1] = 0x1; /* writing any value to SCSYSSTAT reg will reset system */ - dsb(); isb(); - clear_fixmap(FIXMAP_MISC); -#endif platform_reset(); } diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h index e49aac1..1f327c7 100644 --- a/xen/include/asm-arm/config.h +++ b/xen/include/asm-arm/config.h @@ -149,9 +149,6 @@ extern unsigned long frametable_virt_end; #define GIC_CR_OFFSET 0x2000 #define GIC_HR_OFFSET 0x4000 /* Guess work http://lists.infradead.org/pipermail/linux-arm-kernel/2011-September/064219.html */ #define GIC_VR_OFFSET 0x6000 /* Virtual Machine CPU interface) */ -/* Board-specific: base address of system controller */ -#define SP810_ADDRESS 0x1C020000 - #endif /* __ARM_CONFIG_H__ */ /* diff --git a/xen/include/asm-arm/platforms/vexpress.h b/xen/include/asm-arm/platforms/vexpress.h index 67f8fef..5cf3aba 100644 --- a/xen/include/asm-arm/platforms/vexpress.h +++ b/xen/include/asm-arm/platforms/vexpress.h @@ -23,6 +23,9 @@ #define V2M_SYS_CFG_OSC4 4 #define V2M_SYS_CFG_OSC5 5 +/* Board-specific: base address of system controller */ +#define SP810_ADDRESS 0x1C020000 + #ifndef __ASSEMBLY__ #include <xen/inttypes.h>
This platform contains nearly nothing specific except the reset function. Signed-off-by: Julien Grall <julien.grall@linaro.org> --- xen/arch/arm/platforms/vexpress.c | 26 ++++++++++++++++++++++++++ xen/arch/arm/shutdown.c | 14 -------------- xen/include/asm-arm/config.h | 3 --- xen/include/asm-arm/platforms/vexpress.h | 3 +++ 4 files changed, 29 insertions(+), 17 deletions(-)