From 98ed4ceb93ba22268f35ebcbb7de0cb1c7e70231 Mon Sep 17 00:00:00 2001 From: Pawel Moll Date: Wed, 25 Jan 2012 15:37:29 +0000 Subject: ARM: vexpress: Get rid of MMIO_P2V This patch gets rid of the MMIO_P2V and __MMIO_P2V macros, defining constant virtual base for motherboard and tile peripherals instead. Additionally, in preparation for the new motherboard memory map, the motherboard peripherals are using base pointers calculated in runtime, instead of compile-time calculated values. Signed-off-by: Pawel Moll --- arch/arm/include/asm/hardware/arm_timer.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'arch/arm/include') diff --git a/arch/arm/include/asm/hardware/arm_timer.h b/arch/arm/include/asm/hardware/arm_timer.h index c0f4e7bf22de..d6030ff599db 100644 --- a/arch/arm/include/asm/hardware/arm_timer.h +++ b/arch/arm/include/asm/hardware/arm_timer.h @@ -9,7 +9,12 @@ * * Integrator AP has 16-bit timers, Integrator CP, Versatile and Realview * can have 16-bit or 32-bit selectable via a bit in the control register. + * + * Every SP804 contains two identical timers. */ +#define TIMER_1_BASE 0x00 +#define TIMER_2_BASE 0x20 + #define TIMER_LOAD 0x00 /* ACVR rw */ #define TIMER_VALUE 0x04 /* ACVR ro */ #define TIMER_CTRL 0x08 /* ACVR rw */ -- cgit v1.2.3 From abde710ca8776f851e41c3dfe78ad7dcafa26dc9 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Tue, 10 Jan 2012 19:07:28 +0000 Subject: ARM: smp_twd: make local_timer_stop a symbol instead of a #define When CONFIG_HAVE_ARM_TWD is selected, local_timer_stop is a #define, while all other local timers are using a real function. Convert it to an alias of twd_timer_stop, as it helps converting all local timers to another internal API in a sane way. Signed-off-by: Marc Zyngier --- arch/arm/include/asm/localtimer.h | 6 +----- arch/arm/include/asm/smp_twd.h | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'arch/arm/include') diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h index c6a18424888e..7e1b2c5f7d17 100644 --- a/arch/arm/include/asm/localtimer.h +++ b/arch/arm/include/asm/localtimer.h @@ -26,17 +26,13 @@ void percpu_timer_setup(void); #include "smp_twd.h" -#define local_timer_stop(c) twd_timer_stop((c)) - -#else +#endif /* * Stop the local timer */ void local_timer_stop(struct clock_event_device *); -#endif - /* * Setup a local timer interrupt for a CPU. */ diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h index ef9ffba97ad8..bf8449da480a 100644 --- a/arch/arm/include/asm/smp_twd.h +++ b/arch/arm/include/asm/smp_twd.h @@ -23,6 +23,5 @@ struct clock_event_device; extern void __iomem *twd_base; void twd_timer_setup(struct clock_event_device *); -void twd_timer_stop(struct clock_event_device *); #endif -- cgit v1.2.3 From 0ef330e10dcdbca8f4566e9eaf77015f8ce039d3 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Tue, 10 Jan 2012 19:26:45 +0000 Subject: ARM: local timers: introduce a new registration interface In order to switch to a runtime selectable local timer, add a registration interface that timer drivers can use to register to the core. local_timer_setup() and local_timer_stop() are made weak symbols in order not to break existing setups. Signed-off-by: Marc Zyngier --- arch/arm/include/asm/localtimer.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'arch/arm/include') diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h index 7e1b2c5f7d17..f088d63b92c7 100644 --- a/arch/arm/include/asm/localtimer.h +++ b/arch/arm/include/asm/localtimer.h @@ -15,6 +15,11 @@ struct clock_event_device; +struct local_timer_ops { + int (*setup)(struct clock_event_device *); + void (*stop)(struct clock_event_device *); +}; + /* * Setup a per-cpu timer, whether it be a local timer or dummy broadcast */ @@ -38,6 +43,11 @@ void local_timer_stop(struct clock_event_device *); */ int local_timer_setup(struct clock_event_device *); +/* + * Register a local timer driver + */ +int local_timer_register(struct local_timer_ops *); + #else static inline int local_timer_setup(struct clock_event_device *evt) @@ -48,6 +58,11 @@ static inline int local_timer_setup(struct clock_event_device *evt) static inline void local_timer_stop(struct clock_event_device *evt) { } + +static inline int local_timer_register(struct local_timer_ops *ops) +{ + return -ENXIO; +} #endif #endif -- cgit v1.2.3 From 81e46f7b6dcec485bcb1f988ba4dc5b20189573c Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Tue, 10 Jan 2012 19:39:26 +0000 Subject: ARM: smp_twd: add runtime registration support Add support for the new registration interface to smp_twd. Platforms can populate a struct twd_local_timer with MMIO and IRQ resources, and then call twd_local_timer_register() to have the timer registered with the core. Signed-off-by: Marc Zyngier --- arch/arm/include/asm/smp_twd.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'arch/arm/include') diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h index bf8449da480a..16c89b793f90 100644 --- a/arch/arm/include/asm/smp_twd.h +++ b/arch/arm/include/asm/smp_twd.h @@ -18,10 +18,26 @@ #define TWD_TIMER_CONTROL_PERIODIC (1 << 1) #define TWD_TIMER_CONTROL_IT_ENABLE (1 << 2) +#include + struct clock_event_device; extern void __iomem *twd_base; -void twd_timer_setup(struct clock_event_device *); +int twd_timer_setup(struct clock_event_device *); + +struct twd_local_timer { + struct resource res[2]; +}; + +#define DEFINE_TWD_LOCAL_TIMER(name,base,irq) \ +struct twd_local_timer name __initdata = { \ + .res = { \ + DEFINE_RES_MEM(base, 0x10), \ + DEFINE_RES_IRQ(irq), \ + }, \ +}; + +int twd_local_timer_register(struct twd_local_timer *); #endif -- cgit v1.2.3 From d8e0364364d333feb4564bb7d7d983182b34427e Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Tue, 10 Jan 2012 22:15:45 +0000 Subject: ARM: smp_twd: add device tree support Add bindings to support DT discovery of the ARM Timer Watchdog (aka TWD). Only the timer side is converted by this patch. Acked-by: Rob Herring Signed-off-by: Marc Zyngier --- arch/arm/include/asm/smp_twd.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'arch/arm/include') diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h index 16c89b793f90..8047e6e580b6 100644 --- a/arch/arm/include/asm/smp_twd.h +++ b/arch/arm/include/asm/smp_twd.h @@ -40,4 +40,12 @@ struct twd_local_timer name __initdata = { \ int twd_local_timer_register(struct twd_local_timer *); +#ifdef CONFIG_HAVE_ARM_TWD +void twd_local_timer_of_register(void); +#else +static inline void twd_local_timer_of_register(void) +{ +} +#endif + #endif -- cgit v1.2.3 From 9248510469b46bc17b90cf62cb8d9e7c9a5f9965 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Tue, 10 Jan 2012 23:00:54 +0000 Subject: ARM: smp_twd: remove old local timer interface Now that all users of the previous local timer interface have been converted to the runtime registration API, make this interface the only one supported for this driver. Signed-off-by: Marc Zyngier --- arch/arm/include/asm/localtimer.h | 8 -------- arch/arm/include/asm/smp_twd.h | 6 ------ 2 files changed, 14 deletions(-) (limited to 'arch/arm/include') diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h index f088d63b92c7..955eed10ffb5 100644 --- a/arch/arm/include/asm/localtimer.h +++ b/arch/arm/include/asm/localtimer.h @@ -11,7 +11,6 @@ #define __ASM_ARM_LOCALTIMER_H #include -#include struct clock_event_device; @@ -26,13 +25,6 @@ struct local_timer_ops { void percpu_timer_setup(void); #ifdef CONFIG_LOCAL_TIMERS - -#ifdef CONFIG_HAVE_ARM_TWD - -#include "smp_twd.h" - -#endif - /* * Stop the local timer */ diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h index 8047e6e580b6..0f01f4677bd2 100644 --- a/arch/arm/include/asm/smp_twd.h +++ b/arch/arm/include/asm/smp_twd.h @@ -20,12 +20,6 @@ #include -struct clock_event_device; - -extern void __iomem *twd_base; - -int twd_timer_setup(struct clock_event_device *); - struct twd_local_timer { struct resource res[2]; }; -- cgit v1.2.3 From d45785929f1248d2e769f959f180f0504e326622 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Tue, 10 Jan 2012 23:38:25 +0000 Subject: ARM: local timers: make the runtime registration interface mandatory Remove all traces of the compile-time local timer interface, and make the runtime selection mandatory. Signed-off-by: Marc Zyngier --- arch/arm/include/asm/localtimer.h | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'arch/arm/include') diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h index 955eed10ffb5..f77ffc1eb0c2 100644 --- a/arch/arm/include/asm/localtimer.h +++ b/arch/arm/include/asm/localtimer.h @@ -19,38 +19,12 @@ struct local_timer_ops { void (*stop)(struct clock_event_device *); }; -/* - * Setup a per-cpu timer, whether it be a local timer or dummy broadcast - */ -void percpu_timer_setup(void); - #ifdef CONFIG_LOCAL_TIMERS -/* - * Stop the local timer - */ -void local_timer_stop(struct clock_event_device *); - -/* - * Setup a local timer interrupt for a CPU. - */ -int local_timer_setup(struct clock_event_device *); - /* * Register a local timer driver */ int local_timer_register(struct local_timer_ops *); - #else - -static inline int local_timer_setup(struct clock_event_device *evt) -{ - return -ENXIO; -} - -static inline void local_timer_stop(struct clock_event_device *evt) -{ -} - static inline int local_timer_register(struct local_timer_ops *ops) { return -ENXIO; -- cgit v1.2.3