* [PATCH v3 00/15] Runtime registration for local timers
@ 2012-01-16 13:52 Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 01/15] ARM: smp_twd: make local_timer_stop a symbol instead of a #define Marc Zyngier
` (14 more replies)
0 siblings, 15 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
This patches series switches the various local timers implementation
(TWD, MCT, MSM timer) to be registered at runtime instead of being
hardwired at compile time. In the process, TWD gets an OF binding that
is used by highbank and imx6q.
Tested on EB11MP, OMAP4, Tegra and Exynos4. Based on Linus' tree as of
some random point today.
Branch also available at:
git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git local_timers-v3.3-rc0
* From v2:
- Fix __initdata anotations that should have been __cpuinitdata
(reported by David Brown and Russell King)
- Fix interrupt trigger in DTS file for highbank and imx6q
(as requested by Rob Herring and Shawn Guo)
- Move warning to twd_local_timer_of_register()
(as requested by Rob Herring)
- Fix shmobile compilation fix (reported by Magnus Damm)
- Fold local_timer_{setup,stop}() into percpu_timer_{setup,stop}()
* From initial version:
- Moved away from late_time_init, making the code even simpler
- Added a DEFINE_TWD_LOCAL_TIMER() macro to reduce the init cluter
- Updated TWD DT support to have separate nodes for timer and watchdog
- Added support for the new r8a7779 shmobile that suddenly appeared
- Fixed a tiny dts bug on imx6q
Marc Zyngier (15):
ARM: smp_twd: make local_timer_stop a symbol instead of a #define
ARM: local timers: introduce a new registration interface
ARM: smp_twd: add runtime registration support
ARM: smp_twd: add device tree support
ARM: OMAP4: convert to twd_local_timer_register() interface
ARM: plat-versatile: convert to twd_local_timer_register() interface
ARM: tegra: convert to twd_local_timer_register() interface
ARM: shmobile: convert to twd_local_timer_register() interface
ARM: ux500: convert to twd_local_timer_register() interface
ARM: highbank: convert to twd_local_timer_register() interface
ARM: imx6q: convert to twd_local_timer_register() interface
ARM: smp_twd: remove old local timer interface
ARM: local timers: convert exynos to runtime registration interface
ARM: local timers: convert MSM to runtime registration interface
ARM: local timers: make the runtime registration interface mandatory
Documentation/devicetree/bindings/arm/twd.txt | 48 ++++++++++
arch/arm/boot/dts/highbank.dts | 8 +-
arch/arm/boot/dts/imx6q.dtsi | 6 +-
arch/arm/include/asm/localtimer.h | 37 ++------
arch/arm/include/asm/smp_twd.h | 25 ++++-
arch/arm/kernel/smp.c | 22 ++++-
arch/arm/kernel/smp_twd.c | 123 ++++++++++++++++++++-----
arch/arm/mach-exynos/mct.c | 18 ++--
arch/arm/mach-highbank/Makefile | 1 -
arch/arm/mach-highbank/highbank.c | 3 +
arch/arm/mach-highbank/localtimer.c | 40 --------
arch/arm/mach-imx/Makefile | 1 -
arch/arm/mach-imx/localtimer.c | 35 -------
arch/arm/mach-imx/mach-imx6q.c | 2 +
arch/arm/mach-msm/timer.c | 79 +++++++++-------
arch/arm/mach-omap2/Makefile | 1 -
arch/arm/mach-omap2/timer-mpu.c | 39 --------
arch/arm/mach-omap2/timer.c | 22 ++++-
arch/arm/mach-realview/realview_eb.c | 27 ++++-
arch/arm/mach-realview/realview_pb11mp.c | 21 ++++-
arch/arm/mach-realview/realview_pbx.c | 20 +++-
arch/arm/mach-shmobile/Makefile | 1 -
arch/arm/mach-shmobile/include/mach/common.h | 2 +
arch/arm/mach-shmobile/localtimer.c | 26 -----
arch/arm/mach-shmobile/platsmp.c | 1 -
arch/arm/mach-shmobile/smp-r8a7779.c | 8 +-
arch/arm/mach-shmobile/smp-sh73a0.c | 8 +-
arch/arm/mach-shmobile/timer.c | 10 ++
arch/arm/mach-tegra/Makefile | 2 +-
arch/arm/mach-tegra/localtimer.c | 26 -----
arch/arm/mach-tegra/timer.c | 22 ++++-
arch/arm/mach-ux500/Makefile | 1 -
arch/arm/mach-ux500/cpu.c | 1 -
arch/arm/mach-ux500/localtimer.c | 29 ------
arch/arm/mach-ux500/timer.c | 32 +++++--
arch/arm/mach-vexpress/ct-ca9x4.c | 17 +++-
arch/arm/plat-versatile/Makefile | 1 -
arch/arm/plat-versatile/localtimer.c | 27 ------
38 files changed, 407 insertions(+), 385 deletions(-)
create mode 100644 Documentation/devicetree/bindings/arm/twd.txt
delete mode 100644 arch/arm/mach-highbank/localtimer.c
delete mode 100644 arch/arm/mach-imx/localtimer.c
delete mode 100644 arch/arm/mach-omap2/timer-mpu.c
delete mode 100644 arch/arm/mach-shmobile/localtimer.c
delete mode 100644 arch/arm/mach-tegra/localtimer.c
delete mode 100644 arch/arm/mach-ux500/localtimer.c
delete mode 100644 arch/arm/plat-versatile/localtimer.c
--
1.7.7.1
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3 01/15] ARM: smp_twd: make local_timer_stop a symbol instead of a #define
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 02/15] ARM: local timers: introduce a new registration interface Marc Zyngier
` (13 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
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 <marc.zyngier@arm.com>
---
arch/arm/include/asm/localtimer.h | 6 +-----
arch/arm/include/asm/smp_twd.h | 1 -
arch/arm/kernel/smp_twd.c | 7 ++++++-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h
index c6a1842..7e1b2c5 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 ef9ffba9..bf8449d 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
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index c8e9385..95a0c14 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -87,12 +87,17 @@ int twd_timer_ack(void)
return 0;
}
-void twd_timer_stop(struct clock_event_device *clk)
+static void twd_timer_stop(struct clock_event_device *clk)
{
twd_set_mode(CLOCK_EVT_MODE_UNUSED, clk);
disable_percpu_irq(clk->irq);
}
+/* Temporary hack to be removed when all TWD users are converted to
+ the new registration interface */
+void local_timer_stop(struct clock_event_device *clk)
+ __attribute__ ((alias ("twd_timer_stop")));
+
#ifdef CONFIG_CPU_FREQ
/*
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 02/15] ARM: local timers: introduce a new registration interface
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 01/15] ARM: smp_twd: make local_timer_stop a symbol instead of a #define Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 03/15] ARM: smp_twd: add runtime registration support Marc Zyngier
` (12 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
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 <marc.zyngier@arm.com>
---
arch/arm/include/asm/localtimer.h | 15 +++++++++++++++
arch/arm/kernel/smp.c | 27 +++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h
index 7e1b2c5..f088d63 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
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 57db122..69d5f8b 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -475,6 +475,33 @@ static void __cpuinit broadcast_timer_setup(struct clock_event_device *evt)
clockevents_register_device(evt);
}
+static struct local_timer_ops *lt_ops;
+
+#ifdef CONFIG_LOCAL_TIMERS
+int local_timer_register(struct local_timer_ops *ops)
+{
+ if (lt_ops)
+ return -EBUSY;
+
+ lt_ops = ops;
+ return 0;
+}
+#endif
+
+int __cpuinit __attribute__ ((weak)) local_timer_setup(struct clock_event_device *clk)
+{
+ if (lt_ops)
+ return lt_ops->setup(clk);
+
+ return -ENXIO;
+}
+
+void __attribute__ ((weak)) local_timer_stop(struct clock_event_device *clk)
+{
+ if (lt_ops)
+ lt_ops->stop(clk);
+}
+
void __cpuinit percpu_timer_setup(void)
{
unsigned int cpu = smp_processor_id();
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 03/15] ARM: smp_twd: add runtime registration support
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 01/15] ARM: smp_twd: make local_timer_stop a symbol instead of a #define Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 02/15] ARM: local timers: introduce a new registration interface Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 04/15] ARM: smp_twd: add device tree support Marc Zyngier
` (11 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
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 <marc.zyngier@arm.com>
---
arch/arm/include/asm/smp_twd.h | 18 +++++++++++++-
arch/arm/kernel/smp_twd.c | 51 +++++++++++++++++++++++++++++++++++++--
2 files changed, 65 insertions(+), 4 deletions(-)
diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h
index bf8449d..16c89b7 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 <linux/ioport.h>
+
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
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 95a0c14..f105e91 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -32,6 +32,7 @@ static struct clk *twd_clk;
static unsigned long twd_timer_rate;
static struct clock_event_device __percpu **twd_evt;
+static int twd_ppi;
static void twd_set_mode(enum clock_event_mode mode,
struct clock_event_device *clk)
@@ -227,7 +228,7 @@ static struct clk *twd_get_clock(void)
/*
* Setup the local clock events for a CPU.
*/
-void __cpuinit twd_timer_setup(struct clock_event_device *clk)
+int __cpuinit twd_timer_setup(struct clock_event_device *clk)
{
struct clock_event_device **this_cpu_clk;
@@ -237,7 +238,7 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
twd_evt = alloc_percpu(struct clock_event_device *);
if (!twd_evt) {
pr_err("twd: can't allocate memory\n");
- return;
+ return -ENOMEM;
}
err = request_percpu_irq(clk->irq, twd_handler,
@@ -245,7 +246,7 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
if (err) {
pr_err("twd: can't register interrupt %d (%d)\n",
clk->irq, err);
- return;
+ return err;
}
}
@@ -263,6 +264,8 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
clk->rating = 350;
clk->set_mode = twd_set_mode;
clk->set_next_event = twd_set_next_event;
+ if (!clk->irq)
+ clk->irq = twd_ppi;
this_cpu_clk = __this_cpu_ptr(twd_evt);
*this_cpu_clk = clk;
@@ -270,4 +273,46 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
clockevents_config_and_register(clk, twd_timer_rate,
0xf, 0xffffffff);
enable_percpu_irq(clk->irq, 0);
+
+ return 0;
+}
+
+static struct local_timer_ops twd_lt_ops __cpuinitdata = {
+ .setup = twd_timer_setup,
+ .stop = twd_timer_stop,
+};
+
+int __init twd_local_timer_register(struct twd_local_timer *tlt)
+{
+ int err;
+
+ if (twd_base || twd_evt)
+ return -EBUSY;
+
+ twd_ppi = tlt->res[1].start;
+
+ twd_evt = alloc_percpu(struct clock_event_device *);
+ twd_base = ioremap(tlt->res[0].start, resource_size(&tlt->res[0]));
+ if (!twd_base || !twd_evt) {
+ err = -ENOMEM;
+ goto out;
+ }
+
+ err = request_percpu_irq(twd_ppi, twd_handler, "twd", twd_evt);
+ if (err) {
+ pr_err("twd: can't register interrupt %d (%d)\n", twd_ppi, err);
+ goto out;
+ }
+
+ err = local_timer_register(&twd_lt_ops);
+ if (err)
+ goto out;
+
+ return 0;
+
+out:
+ iounmap(twd_base);
+ free_percpu(twd_evt);
+ twd_base = twd_evt = NULL;
+ return err;
}
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 04/15] ARM: smp_twd: add device tree support
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
` (2 preceding siblings ...)
2012-01-16 13:52 ` [PATCH v3 03/15] ARM: smp_twd: add runtime registration support Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-16 15:59 ` Rob Herring
2012-01-16 13:52 ` [PATCH v3 05/15] ARM: OMAP4: convert to twd_local_timer_register() interface Marc Zyngier
` (10 subsequent siblings)
14 siblings, 1 reply; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
Add bindings to support DT discovery of the ARM Timer Watchdog
(aka TWD). Only the timer side is converted by this patch.
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
Documentation/devicetree/bindings/arm/twd.txt | 48 +++++++++++++++
arch/arm/include/asm/smp_twd.h | 8 +++
arch/arm/kernel/smp_twd.c | 77 ++++++++++++++++++++----
3 files changed, 120 insertions(+), 13 deletions(-)
create mode 100644 Documentation/devicetree/bindings/arm/twd.txt
diff --git a/Documentation/devicetree/bindings/arm/twd.txt b/Documentation/devicetree/bindings/arm/twd.txt
new file mode 100644
index 0000000..75b8610
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/twd.txt
@@ -0,0 +1,48 @@
+* ARM Timer Watchdog
+
+ARM 11MP, Cortex-A5 and Cortex-A9 are often associated with a per-core
+Timer-Watchdog (aka TWD), which provides both a per-cpu local timer
+and watchdog.
+
+The TWD is usually attached to a GIC to deliver its two per-processor
+interrupts.
+
+** Timer node required properties:
+
+- compatible : Should be one of:
+ "arm,cortex-a9-twd-timer"
+ "arm,cortex-a5-twd-timer"
+ "arm,arm11mp-twd-timer"
+
+- interrupts : One interrupt to each core
+
+- reg : Specify the base address and the size of the TWD timer
+ register window.
+
+Example:
+
+ twd-timer at 2c000600 {
+ compatible = "arm,arm11mp-twd-timer"";
+ reg = <0x2c000600 0x20>;
+ interrupts = <1 13 0xf01>;
+ };
+
+** Watchdog node properties:
+
+- compatible : Should be one of:
+ "arm,cortex-a9-twd-wdt"
+ "arm,cortex-a5-twd-wdt"
+ "arm,arm11mp-twd-wdt"
+
+- interrupts : One interrupt to each core
+
+- reg : Specify the base address and the size of the TWD watchdog
+ register window.
+
+Example:
+
+ twd-watchdog at 2c000620 {
+ compatible = "arm,arm11mp-twd-wdt";
+ reg = <0x2c000620 0x20>;
+ interrupts = <1 14 0xf01>;
+ };
diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h
index 16c89b7..23c5bc4 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 *);
+#if CONFIG_HAVE_ARM_TWD
+void twd_local_timer_of_register(void);
+#else
+static inline void twd_local_timer_of_register(void)
+{
+}
+#endif
+
#endif
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index f105e91..d2dce64 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -20,6 +20,8 @@
#include <linux/clockchips.h>
#include <linux/irq.h>
#include <linux/io.h>
+#include <linux/of_irq.h>
+#include <linux/of_address.h>
#include <asm/smp_twd.h>
#include <asm/localtimer.h>
@@ -282,37 +284,86 @@ static struct local_timer_ops twd_lt_ops __cpuinitdata = {
.stop = twd_timer_stop,
};
-int __init twd_local_timer_register(struct twd_local_timer *tlt)
+static int __init twd_local_timer_common_register(void)
{
int err;
- if (twd_base || twd_evt)
- return -EBUSY;
-
- twd_ppi = tlt->res[1].start;
-
twd_evt = alloc_percpu(struct clock_event_device *);
- twd_base = ioremap(tlt->res[0].start, resource_size(&tlt->res[0]));
- if (!twd_base || !twd_evt) {
+ if (!twd_evt) {
err = -ENOMEM;
- goto out;
+ goto out_free;
}
err = request_percpu_irq(twd_ppi, twd_handler, "twd", twd_evt);
if (err) {
pr_err("twd: can't register interrupt %d (%d)\n", twd_ppi, err);
- goto out;
+ goto out_free;
}
err = local_timer_register(&twd_lt_ops);
if (err)
- goto out;
+ goto out_irq;
return 0;
-out:
+out_irq:
+ free_percpu_irq(twd_ppi, twd_evt);
+out_free:
iounmap(twd_base);
+ twd_base = NULL;
free_percpu(twd_evt);
- twd_base = twd_evt = NULL;
+
return err;
}
+
+int __init twd_local_timer_register(struct twd_local_timer *tlt)
+{
+ if (twd_base || twd_evt)
+ return -EBUSY;
+
+ twd_ppi = tlt->res[1].start;
+
+ twd_base = ioremap(tlt->res[0].start, resource_size(&tlt->res[0]));
+ if (!twd_base)
+ return -ENOMEM;
+
+ return twd_local_timer_common_register();
+}
+
+#ifdef CONFIG_OF
+const static struct of_device_id twd_of_match[] __initconst = {
+ { .compatible = "arm,cortex-a9-twd-timer", },
+ { .compatible = "arm,cortex-a5-twd-timer", },
+ { .compatible = "arm,arm11mp-twd-timer", },
+ { },
+};
+
+void __init twd_local_timer_of_register(void)
+{
+ struct device_node *np;
+ int err;
+
+ np = of_find_matching_node(NULL, twd_of_match);
+ if (!np) {
+ err = -ENODEV;
+ goto out;
+ }
+
+ twd_ppi = irq_of_parse_and_map(np, 0);
+ if (!twd_ppi) {
+ err = -EINVAL;
+ goto out;
+ }
+
+ twd_base = of_iomap(np, 0);
+ if (!twd_base) {
+ err = -ENOMEM;
+ goto out;
+ }
+
+ err = twd_local_timer_common_register();
+
+out:
+ WARN(err, "twd_local_timer_of_register failed (%d)\n", err);
+}
+#endif
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 05/15] ARM: OMAP4: convert to twd_local_timer_register() interface
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
` (3 preceding siblings ...)
2012-01-16 13:52 ` [PATCH v3 04/15] ARM: smp_twd: add device tree support Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 06/15] ARM: plat-versatile: " Marc Zyngier
` (9 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
Add support for the new smp_twd runtime registration interface
to the OMAP4 platforms, and remove the old compile-time support.
Tested on Panda.
Cc: Tony Lindgren <tony@atomide.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-omap2/Makefile | 1 -
arch/arm/mach-omap2/timer-mpu.c | 39 ---------------------------------------
arch/arm/mach-omap2/timer.c | 22 +++++++++++++++++-----
3 files changed, 17 insertions(+), 45 deletions(-)
delete mode 100644 arch/arm/mach-omap2/timer-mpu.c
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index fc9b238..27ea7c2 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -23,7 +23,6 @@ obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
# SMP support ONLY available for OMAP4
obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o
-obj-$(CONFIG_LOCAL_TIMERS) += timer-mpu.o
obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o
obj-$(CONFIG_ARCH_OMAP4) += omap4-common.o omap-wakeupgen.o \
sleep44xx.o
diff --git a/arch/arm/mach-omap2/timer-mpu.c b/arch/arm/mach-omap2/timer-mpu.c
deleted file mode 100644
index 31c0ac4..0000000
--- a/arch/arm/mach-omap2/timer-mpu.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * The MPU local timer source file. In OMAP4, both cortex-a9 cores have
- * own timer in it's MPU domain. These timers will be driving the
- * linux kernel SMP tick framework when active. These timers are not
- * part of the wake up domain.
- *
- * Copyright (C) 2009 Texas Instruments, Inc.
- *
- * Author:
- * Santosh Shilimkar <santosh.shilimkar@ti.com>
- *
- * This file is based on arm realview smp platform file.
- * Copyright (C) 2002 ARM Ltd.
- *
- * 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/smp.h>
-#include <linux/clockchips.h>
-#include <asm/irq.h>
-#include <asm/smp_twd.h>
-#include <asm/localtimer.h>
-
-/*
- * Setup the local clock events for a CPU.
- */
-int __cpuinit local_timer_setup(struct clock_event_device *evt)
-{
- /* Local timers are not supprted on OMAP4430 ES1.0 */
- if (omap_rev() == OMAP4430_REV_ES1_0)
- return -ENXIO;
-
- evt->irq = OMAP44XX_IRQ_LOCALTIMER;
- twd_timer_setup(evt);
- return 0;
-}
-
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 6eeff0e..d07e733 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -39,7 +39,7 @@
#include <asm/mach/time.h>
#include <plat/dmtimer.h>
-#include <asm/localtimer.h>
+#include <asm/smp_twd.h>
#include <asm/sched_clock.h>
#include "common.h"
#include <plat/omap_hwmod.h>
@@ -324,14 +324,26 @@ OMAP_SYS_TIMER(3_secure)
#endif
#ifdef CONFIG_ARCH_OMAP4
-static void __init omap4_timer_init(void)
-{
#ifdef CONFIG_LOCAL_TIMERS
- twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_256);
- BUG_ON(!twd_base);
+static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
+ OMAP44XX_LOCAL_TWD_BASE,
+ OMAP44XX_IRQ_LOCALTIMER);
#endif
+
+static void __init omap4_timer_init(void)
+{
omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE);
omap2_gp_clocksource_init(2, OMAP4_MPU_SOURCE);
+#ifdef CONFIG_LOCAL_TIMERS
+ /* Local timers are not supprted on OMAP4430 ES1.0 */
+ if (omap_rev() != OMAP4430_REV_ES1_0) {
+ int err;
+
+ err = twd_local_timer_register(&twd_local_timer);
+ if (err)
+ pr_err("twd_local_timer_register failed %d\n", err);
+ }
+#endif
}
OMAP_SYS_TIMER(4)
#endif
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 06/15] ARM: plat-versatile: convert to twd_local_timer_register() interface
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
` (4 preceding siblings ...)
2012-01-16 13:52 ` [PATCH v3 05/15] ARM: OMAP4: convert to twd_local_timer_register() interface Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 07/15] ARM: tegra: " Marc Zyngier
` (8 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
Add support for the new smp_twd runtime registration interface
to the RealView/VE platforms, and remove the old compile-time support.
Tested on EB11MP.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-realview/realview_eb.c | 27 +++++++++++++++++++++------
arch/arm/mach-realview/realview_pb11mp.c | 21 +++++++++++++++++----
arch/arm/mach-realview/realview_pbx.c | 20 ++++++++++++++++----
arch/arm/mach-vexpress/ct-ca9x4.c | 17 ++++++++++++++---
arch/arm/plat-versatile/Makefile | 1 -
arch/arm/plat-versatile/localtimer.c | 27 ---------------------------
6 files changed, 68 insertions(+), 45 deletions(-)
delete mode 100644 arch/arm/plat-versatile/localtimer.c
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index e629621..9ae8a8c 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -36,7 +36,7 @@
#include <asm/pgtable.h>
#include <asm/hardware/gic.h>
#include <asm/hardware/cache-l2x0.h>
-#include <asm/localtimer.h>
+#include <asm/smp_twd.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
@@ -388,6 +388,23 @@ static void realview_eb11mp_fixup(void)
realview_eb_isp1761_resources[1].end = IRQ_EB11MP_USB;
}
+#ifdef CONFIG_HAVE_ARM_TWD
+static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
+ REALVIEW_EB11MP_TWD_BASE,
+ IRQ_LOCALTIMER);
+
+static void __init realview_eb_twd_init(void)
+{
+ if (core_tile_eb11mp() || core_tile_a9mp()) {
+ int err = twd_local_timer_register(&twd_local_timer);
+ if (err)
+ pr_err("twd_local_timer_register failed %d\n", err);
+ }
+}
+#else
+#define realview_eb_twd_init() do { } while(0)
+#endif
+
static void __init realview_eb_timer_init(void)
{
unsigned int timer_irq;
@@ -397,15 +414,13 @@ static void __init realview_eb_timer_init(void)
timer2_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE);
timer3_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE) + 0x20;
- if (core_tile_eb11mp() || core_tile_a9mp()) {
-#ifdef CONFIG_LOCAL_TIMERS
- twd_base = __io_address(REALVIEW_EB11MP_TWD_BASE);
-#endif
+ if (core_tile_eb11mp() || core_tile_a9mp())
timer_irq = IRQ_EB11MP_TIMER0_1;
- } else
+ else
timer_irq = IRQ_EB_TIMER0_1;
realview_timer_init(timer_irq);
+ realview_eb_twd_init();
}
static struct sys_timer realview_eb_timer = {
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index 127a3fd..fb08361 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -36,7 +36,7 @@
#include <asm/pgtable.h>
#include <asm/hardware/gic.h>
#include <asm/hardware/cache-l2x0.h>
-#include <asm/localtimer.h>
+#include <asm/smp_twd.h>
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
@@ -295,6 +295,21 @@ static void __init gic_init_irq(void)
gic_cascade_irq(1, IRQ_TC11MP_PB_IRQ1);
}
+#ifdef CONFIG_HAVE_ARM_TWD
+static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
+ REALVIEW_TC11MP_TWD_BASE,
+ IRQ_LOCALTIMER);
+
+static void __init realview_pb11mp_twd_init(void)
+{
+ int err = twd_local_timer_register(&twd_local_timer);
+ if (err)
+ pr_err("twd_local_timer_register failed %d\n", err);
+}
+#else
+#define realview_pb11mp_twd_init() do {} while(0)
+#endif
+
static void __init realview_pb11mp_timer_init(void)
{
timer0_va_base = __io_address(REALVIEW_PB11MP_TIMER0_1_BASE);
@@ -302,10 +317,8 @@ static void __init realview_pb11mp_timer_init(void)
timer2_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE);
timer3_va_base = __io_address(REALVIEW_PB11MP_TIMER2_3_BASE) + 0x20;
-#ifdef CONFIG_LOCAL_TIMERS
- twd_base = __io_address(REALVIEW_TC11MP_TWD_BASE);
-#endif
realview_timer_init(IRQ_TC11MP_TIMER0_1);
+ realview_pb11mp_twd_init();
}
static struct sys_timer realview_pb11mp_timer = {
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index ac71564..6ddcc61 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -298,6 +298,21 @@ static void __init gic_init_irq(void)
}
}
+#ifdef CONFIG_HAVE_ARM_TWD
+static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
+ REALVIEW_PBX_TILE_TWD_BASE,
+ IRQ_LOCALTIMER);
+
+static void __init realview_pbx_twd_init(void)
+{
+ int err = twd_local_timer_register(&twd_local_timer);
+ if (err)
+ pr_err("twd_local_timer_register failed %d\n", err);
+}
+#else
+#define realview_pbx_twd_init() do { } while(0)
+#endif
+
static void __init realview_pbx_timer_init(void)
{
timer0_va_base = __io_address(REALVIEW_PBX_TIMER0_1_BASE);
@@ -305,11 +320,8 @@ static void __init realview_pbx_timer_init(void)
timer2_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE);
timer3_va_base = __io_address(REALVIEW_PBX_TIMER2_3_BASE) + 0x20;
-#ifdef CONFIG_LOCAL_TIMERS
- if (core_tile_pbx11mp() || core_tile_pbxa9mp())
- twd_base = __io_address(REALVIEW_PBX_TILE_TWD_BASE);
-#endif
realview_timer_init(IRQ_PBX_TIMER0_1);
+ realview_pbx_twd_init();
}
static struct sys_timer realview_pbx_timer = {
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index 2b1e836..f8222cd 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -53,9 +53,6 @@ static struct map_desc ct_ca9x4_io_desc[] __initdata = {
static void __init ct_ca9x4_map_io(void)
{
-#ifdef CONFIG_LOCAL_TIMERS
- twd_base = MMIO_P2V(A9_MPCORE_TWD);
-#endif
iotable_init(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc));
}
@@ -191,9 +188,23 @@ static struct platform_device pmu_device = {
.resource = pmu_resources,
};
+#ifdef CONFIG_HAVE_ARM_TWD
+static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, A9_MPCORE_TWD, IRQ_LOCALTIMER);
+
+static void __init ca9x4_twd_init(void)
+{
+ int err = twd_local_timer_register(&twd_local_timer);
+ if (err)
+ pr_err("twd_local_timer_register failed %d\n", err);
+}
+#else
+#define ca9x4_twd_init do {} while(0)
+#endif
+
static void __init ct_ca9x4_init_early(void)
{
clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+ ca9x4_twd_init();
}
static void __init ct_ca9x4_init(void)
diff --git a/arch/arm/plat-versatile/Makefile b/arch/arm/plat-versatile/Makefile
index 69714db..a5cb194 100644
--- a/arch/arm/plat-versatile/Makefile
+++ b/arch/arm/plat-versatile/Makefile
@@ -1,5 +1,4 @@
obj-y := clock.o
-obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o
obj-$(CONFIG_PLAT_VERSATILE_FPGA_IRQ) += fpga-irq.o
obj-$(CONFIG_PLAT_VERSATILE_LEDS) += leds.o
diff --git a/arch/arm/plat-versatile/localtimer.c b/arch/arm/plat-versatile/localtimer.c
deleted file mode 100644
index 0fb3961..0000000
--- a/arch/arm/plat-versatile/localtimer.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * linux/arch/arm/plat-versatile/localtimer.c
- *
- * Copyright (C) 2002 ARM Ltd.
- * All Rights Reserved
- *
- * 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/smp.h>
-#include <linux/clockchips.h>
-
-#include <asm/smp_twd.h>
-#include <asm/localtimer.h>
-#include <mach/irqs.h>
-
-/*
- * Setup the local clock events for a CPU.
- */
-int __cpuinit local_timer_setup(struct clock_event_device *evt)
-{
- evt->irq = IRQ_LOCALTIMER;
- twd_timer_setup(evt);
- return 0;
-}
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 07/15] ARM: tegra: convert to twd_local_timer_register() interface
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
` (5 preceding siblings ...)
2012-01-16 13:52 ` [PATCH v3 06/15] ARM: plat-versatile: " Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 08/15] ARM: shmobile: " Marc Zyngier
` (7 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
Add support for the new smp_twd runtime registration interface
to the tegra platforms, and remove the old compile-time support.
Tested on Harmony.
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Colin Cross <ccross@android.com>
Cc: Olof Johansson <olof@lixom.net>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-tegra/Makefile | 2 +-
arch/arm/mach-tegra/localtimer.c | 26 --------------------------
arch/arm/mach-tegra/timer.c | 22 +++++++++++++++++-----
3 files changed, 18 insertions(+), 32 deletions(-)
delete mode 100644 arch/arm/mach-tegra/localtimer.c
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index e120ff5..f7d0443 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -13,7 +13,7 @@ obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o
obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += pinmux-tegra20-tables.o
obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += pinmux-tegra30-tables.o
obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o
-obj-$(CONFIG_SMP) += platsmp.o localtimer.o headsmp.o
+obj-$(CONFIG_SMP) += platsmp.o headsmp.o
obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o
obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o
diff --git a/arch/arm/mach-tegra/localtimer.c b/arch/arm/mach-tegra/localtimer.c
deleted file mode 100644
index e91d681..0000000
--- a/arch/arm/mach-tegra/localtimer.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * arch/arm/mach-tegra/localtimer.c
- *
- * Copyright (C) 2002 ARM Ltd.
- * All Rights Reserved
- *
- * 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/smp.h>
-#include <linux/clockchips.h>
-#include <asm/irq.h>
-#include <asm/smp_twd.h>
-#include <asm/localtimer.h>
-
-/*
- * Setup the local clock events for a CPU.
- */
-int __cpuinit local_timer_setup(struct clock_event_device *evt)
-{
- evt->irq = IRQ_LOCALTIMER;
- twd_timer_setup(evt);
- return 0;
-}
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index 1d1acda..1eed8d4 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -28,7 +28,7 @@
#include <linux/io.h>
#include <asm/mach/time.h>
-#include <asm/localtimer.h>
+#include <asm/smp_twd.h>
#include <asm/sched_clock.h>
#include <mach/iomap.h>
@@ -162,6 +162,21 @@ static struct irqaction tegra_timer_irq = {
.irq = INT_TMR3,
};
+#ifdef CONFIG_HAVE_ARM_TWD
+static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
+ TEGRA_ARM_PERIF_BASE + 0x600,
+ IRQ_LOCALTIMER);
+
+static void __init tegra_twd_init(void)
+{
+ int err = twd_local_timer_register(&twd_local_timer);
+ if (err)
+ pr_err("twd_local_timer_register failed %d\n", err);
+}
+#else
+#define tegra_twd_init() do {} while(0)
+#endif
+
static void __init tegra_init_timer(void)
{
struct clk *clk;
@@ -188,10 +203,6 @@ static void __init tegra_init_timer(void)
else
clk_enable(clk);
-#ifdef CONFIG_HAVE_ARM_TWD
- twd_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x600);
-#endif
-
switch (rate) {
case 12000000:
timer_writel(0x000b, TIMERUS_USEC_CFG);
@@ -231,6 +242,7 @@ static void __init tegra_init_timer(void)
tegra_clockevent.cpumask = cpu_all_mask;
tegra_clockevent.irq = tegra_timer_irq.irq;
clockevents_register_device(&tegra_clockevent);
+ tegra_twd_init();
}
struct sys_timer tegra_timer = {
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 08/15] ARM: shmobile: convert to twd_local_timer_register() interface
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
` (6 preceding siblings ...)
2012-01-16 13:52 ` [PATCH v3 07/15] ARM: tegra: " Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 09/15] ARM: ux500: " Marc Zyngier
` (6 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
Add support for the new smp_twd runtime registration interface
to the shmobile platforms, and remove the old compile-time support.
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-shmobile/Makefile | 1 -
arch/arm/mach-shmobile/include/mach/common.h | 2 ++
arch/arm/mach-shmobile/localtimer.c | 26 --------------------------
arch/arm/mach-shmobile/platsmp.c | 1 -
arch/arm/mach-shmobile/smp-r8a7779.c | 8 +++-----
arch/arm/mach-shmobile/smp-sh73a0.c | 8 +++-----
arch/arm/mach-shmobile/timer.c | 10 ++++++++++
7 files changed, 18 insertions(+), 38 deletions(-)
delete mode 100644 arch/arm/mach-shmobile/localtimer.c
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 7ad6954..e7c2590 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -16,7 +16,6 @@ obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o clock-r8a7779.o intc-r8a7779.o
# SMP objects
smp-y := platsmp.o headsmp.o
smp-$(CONFIG_HOTPLUG_CPU) += hotplug.o
-smp-$(CONFIG_LOCAL_TIMERS) += localtimer.o
smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o
smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index e4b945e..9fde3eb 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -2,6 +2,8 @@
#define __ARCH_MACH_COMMON_H
extern struct sys_timer shmobile_timer;
+struct twd_local_timer;
+void shmobile_twd_init(struct twd_local_timer *twd_local_timer);
extern void shmobile_setup_console(void);
extern void shmobile_secondary_vector(void);
extern int shmobile_platform_cpu_kill(unsigned int cpu);
diff --git a/arch/arm/mach-shmobile/localtimer.c b/arch/arm/mach-shmobile/localtimer.c
deleted file mode 100644
index ad9ccc9..0000000
--- a/arch/arm/mach-shmobile/localtimer.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * SMP support for R-Mobile / SH-Mobile - local timer portion
- *
- * Copyright (C) 2010 Magnus Damm
- *
- * Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved
- *
- * 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/smp.h>
-#include <linux/clockchips.h>
-#include <asm/smp_twd.h>
-#include <asm/localtimer.h>
-
-/*
- * Setup the local clock events for a CPU.
- */
-int __cpuinit local_timer_setup(struct clock_event_device *evt)
-{
- evt->irq = 29;
- twd_timer_setup(evt);
- return 0;
-}
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
index 9933812..45fa392 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -17,7 +17,6 @@
#include <linux/smp.h>
#include <linux/io.h>
#include <asm/hardware/gic.h>
-#include <asm/localtimer.h>
#include <asm/mach-types.h>
#include <mach/common.h>
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index cc97ef8..7e056d3 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -63,6 +63,8 @@ static void __iomem *scu_base_addr(void)
static DEFINE_SPINLOCK(scu_lock);
static unsigned long tmp;
+static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29);
+
static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
{
void __iomem *scu_base = scu_base_addr();
@@ -81,11 +83,7 @@ unsigned int __init r8a7779_get_core_count(void)
{
void __iomem *scu_base = scu_base_addr();
-#ifdef CONFIG_HAVE_ARM_TWD
- /* twd_base needs to be initialized before percpu_timer_setup() */
- twd_base = (void __iomem *)0xf0000600;
-#endif
-
+ shmobile_twd_init(&twd_local_timer);
return scu_get_core_count(scu_base);
}
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index be1ade7..8e0906f 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -41,6 +41,8 @@ static void __iomem *scu_base_addr(void)
static DEFINE_SPINLOCK(scu_lock);
static unsigned long tmp;
+static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29);
+
static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
{
void __iomem *scu_base = scu_base_addr();
@@ -59,11 +61,7 @@ unsigned int __init sh73a0_get_core_count(void)
{
void __iomem *scu_base = scu_base_addr();
-#ifdef CONFIG_HAVE_ARM_TWD
- /* twd_base needs to be initialized before percpu_timer_setup() */
- twd_base = (void __iomem *)0xf0000600;
-#endif
-
+ shmobile_twd_init(&twd_local_timer);
return scu_get_core_count(scu_base);
}
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index 895794b..be16231 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -20,6 +20,7 @@
*/
#include <linux/platform_device.h>
#include <asm/mach/time.h>
+#include <asm/smp_twd.h>
static void __init shmobile_late_time_init(void)
{
@@ -41,6 +42,15 @@ static void __init shmobile_timer_init(void)
late_time_init = shmobile_late_time_init;
}
+void __init shmobile_twd_init(struct twd_local_timer *twd_local_timer)
+{
+#ifdef CONFIG_HAVE_ARM_TWD
+ int err = twd_local_timer_register(twd_local_timer);
+ if (err)
+ pr_err("twd_local_timer_register failed %d\n", err);
+#endif
+}
+
struct sys_timer shmobile_timer = {
.init = shmobile_timer_init,
};
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 09/15] ARM: ux500: convert to twd_local_timer_register() interface
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
` (7 preceding siblings ...)
2012-01-16 13:52 ` [PATCH v3 08/15] ARM: shmobile: " Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 10/15] ARM: highbank: " Marc Zyngier
` (5 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
Add support for the new smp_twd runtime registration interface
to the ux500 platforms, and remove the old compile-time support.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-ux500/Makefile | 1 -
arch/arm/mach-ux500/cpu.c | 1 -
arch/arm/mach-ux500/localtimer.c | 29 -----------------------------
arch/arm/mach-ux500/timer.c | 32 +++++++++++++++++++++++++-------
4 files changed, 25 insertions(+), 38 deletions(-)
delete mode 100644 arch/arm/mach-ux500/localtimer.c
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 6bd2f45..35b3894 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -15,7 +15,6 @@ obj-$(CONFIG_MACH_U8500) += board-mop500.o board-mop500-sdi.o \
obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o
obj-$(CONFIG_SMP) += platsmp.o headsmp.o
obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
-obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
obj-$(CONFIG_U5500_MODEM_IRQ) += modem-irq-db5500.o
obj-$(CONFIG_U5500_MBOX) += mbox-db5500.o
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index f418574..851308b 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -14,7 +14,6 @@
#include <asm/hardware/gic.h>
#include <asm/mach/map.h>
-#include <asm/localtimer.h>
#include <mach/hardware.h>
#include <mach/setup.h>
diff --git a/arch/arm/mach-ux500/localtimer.c b/arch/arm/mach-ux500/localtimer.c
deleted file mode 100644
index 5ba1133..0000000
--- a/arch/arm/mach-ux500/localtimer.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2008-2009 ST-Ericsson
- * Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
- *
- * This file is heavily based on relaview platform, almost a copy.
- *
- * Copyright (C) 2002 ARM Ltd.
- *
- * 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/smp.h>
-#include <linux/clockchips.h>
-
-#include <asm/irq.h>
-#include <asm/smp_twd.h>
-#include <asm/localtimer.h>
-
-/*
- * Setup the local clock events for a CPU.
- */
-int __cpuinit local_timer_setup(struct clock_event_device *evt)
-{
- evt->irq = IRQ_LOCALTIMER;
- twd_timer_setup(evt);
- return 0;
-}
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c
index aea467d..cadf982 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -8,27 +8,44 @@
#include <linux/errno.h>
#include <linux/clksrc-dbx500-prcmu.h>
-#include <asm/localtimer.h>
+#include <asm/smp_twd.h>
#include <plat/mtu.h>
#include <mach/setup.h>
#include <mach/hardware.h>
+#ifdef CONFIG_HAVE_ARM_TWD
+static DEFINE_TWD_LOCAL_TIMER(u5500_twd_local_timer,
+ U5500_TWD_BASE, IRQ_LOCALTIMER);
+static DEFINE_TWD_LOCAL_TIMER(u8500_twd_local_timer,
+ U8500_TWD_BASE, IRQ_LOCALTIMER);
+
+static void __init ux500_twd_init(void)
+{
+ struct twd_local_timer *twd_local_timer;
+ int err;
+
+ twd_local_timer = cpu_is_u5500() ? &u5500_twd_local_timer :
+ &u8500_twd_local_timer;
+
+ err = twd_local_timer_register(twd_local_timer);
+ if (err)
+ pr_err("twd_local_timer_register failed %d\n", err);
+}
+#else
+#define ux500_twd_init() do { } while(0)
+#endif
+
static void __init ux500_timer_init(void)
{
void __iomem *prcmu_timer_base;
+ int err;
if (cpu_is_u5500()) {
-#ifdef CONFIG_LOCAL_TIMERS
- twd_base = __io_address(U5500_TWD_BASE);
-#endif
mtu_base = __io_address(U5500_MTU0_BASE);
prcmu_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE);
} else if (cpu_is_u8500()) {
-#ifdef CONFIG_LOCAL_TIMERS
- twd_base = __io_address(U8500_TWD_BASE);
-#endif
mtu_base = __io_address(U8500_MTU0_BASE);
prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE);
} else {
@@ -54,6 +71,7 @@ static void __init ux500_timer_init(void)
nmdk_timer_init();
clksrc_dbx500_prcmu_init(prcmu_timer_base);
+ ux500_twd_init();
}
static void ux500_timer_reset(void)
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 10/15] ARM: highbank: convert to twd_local_timer_register() interface
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
` (8 preceding siblings ...)
2012-01-16 13:52 ` [PATCH v3 09/15] ARM: ux500: " Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 11/15] ARM: imx6q: " Marc Zyngier
` (4 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
Add support for the new smp_twd runtime registration interface
to the highbank platforms, and remove the old compile-time support.
The highbank DTS file is updated to match the TWD DT documentation
and fixes the timer trigger (rising edge).
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/boot/dts/highbank.dts | 8 +++---
arch/arm/mach-highbank/Makefile | 1 -
arch/arm/mach-highbank/highbank.c | 3 ++
arch/arm/mach-highbank/localtimer.c | 40 -----------------------------------
4 files changed, 7 insertions(+), 45 deletions(-)
delete mode 100644 arch/arm/mach-highbank/localtimer.c
diff --git a/arch/arm/boot/dts/highbank.dts b/arch/arm/boot/dts/highbank.dts
index 305635b..37c0ff9 100644
--- a/arch/arm/boot/dts/highbank.dts
+++ b/arch/arm/boot/dts/highbank.dts
@@ -72,15 +72,15 @@
ranges;
timer at fff10600 {
- compatible = "arm,smp-twd";
+ compatible = "arm,cortex-a9-twd-timer";
reg = <0xfff10600 0x20>;
- interrupts = <1 13 0xf04>;
+ interrupts = <1 13 0xf01>;
};
watchdog at fff10620 {
- compatible = "arm,cortex-a9-wdt";
+ compatible = "arm,cortex-a9-twd-wdt";
reg = <0xfff10620 0x20>;
- interrupts = <1 14 0xf04>;
+ interrupts = <1 14 0xf01>;
};
intc: interrupt-controller at fff11000 {
diff --git a/arch/arm/mach-highbank/Makefile b/arch/arm/mach-highbank/Makefile
index 986958a..f8437dd 100644
--- a/arch/arm/mach-highbank/Makefile
+++ b/arch/arm/mach-highbank/Makefile
@@ -1,6 +1,5 @@
obj-y := clock.o highbank.o system.o
obj-$(CONFIG_DEBUG_HIGHBANK_UART) += lluart.o
obj-$(CONFIG_SMP) += platsmp.o
-obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
obj-$(CONFIG_PM_SLEEP) += pm.o
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 804c4a5..4f4f9c0 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -27,6 +27,7 @@
#include <asm/cacheflush.h>
#include <asm/unified.h>
#include <asm/smp_scu.h>
+#include <asm/smp_twd.h>
#include <asm/hardware/arm_timer.h>
#include <asm/hardware/timer-sp.h>
#include <asm/hardware/gic.h>
@@ -113,6 +114,8 @@ static void __init highbank_timer_init(void)
sp804_clocksource_init(timer_base + 0x20, "timer1");
sp804_clockevents_init(timer_base, irq, "timer0");
+
+ twd_local_timer_of_register();
}
static struct sys_timer highbank_timer = {
diff --git a/arch/arm/mach-highbank/localtimer.c b/arch/arm/mach-highbank/localtimer.c
deleted file mode 100644
index 5a00e79..0000000
--- a/arch/arm/mach-highbank/localtimer.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2010-2011 Calxeda, Inc.
- * Based on localtimer.c, Copyright (C) 2002 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <linux/init.h>
-#include <linux/clockchips.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
-#include <linux/of_irq.h>
-
-#include <asm/smp_twd.h>
-
-/*
- * Setup the local clock events for a CPU.
- */
-int __cpuinit local_timer_setup(struct clock_event_device *evt)
-{
- struct device_node *np;
-
- np = of_find_compatible_node(NULL, NULL, "arm,smp-twd");
- if (!twd_base) {
- twd_base = of_iomap(np, 0);
- WARN_ON(!twd_base);
- }
- evt->irq = irq_of_parse_and_map(np, 0);
- twd_timer_setup(evt);
- return 0;
-}
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 11/15] ARM: imx6q: convert to twd_local_timer_register() interface
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
` (9 preceding siblings ...)
2012-01-16 13:52 ` [PATCH v3 10/15] ARM: highbank: " Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-17 3:29 ` Shawn Guo
2012-01-16 13:52 ` [PATCH v3 12/15] ARM: smp_twd: remove old local timer interface Marc Zyngier
` (3 subsequent siblings)
14 siblings, 1 reply; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
Add support for the new smp_twd runtime registration interface
to the imx6q platforms, and remove the old compile-time support.
The imx6q DTS file is updated to match the TWD DT documentation.
Also present in this patch a DTS fix to the timer interrupt routing
(the PPI connection uses bits [15:8]) and trigger (rising edge).
Cc: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/boot/dts/imx6q.dtsi | 6 +++---
arch/arm/mach-imx/Makefile | 1 -
arch/arm/mach-imx/localtimer.c | 35 -----------------------------------
arch/arm/mach-imx/mach-imx6q.c | 2 ++
4 files changed, 5 insertions(+), 39 deletions(-)
delete mode 100644 arch/arm/mach-imx/localtimer.c
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index 263e8f3..4905f51 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -88,9 +88,9 @@
ranges;
timer at 00a00600 {
- compatible = "arm,smp-twd";
- reg = <0x00a00600 0x100>;
- interrupts = <1 13 0xf4>;
+ compatible = "arm,cortex-a9-twd-timer";
+ reg = <0x00a00600 0x20>;
+ interrupts = <1 13 0xf01>;
};
L2: l2-cache at 00a02000 {
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index f5920c2..dd46f07 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -69,7 +69,6 @@ obj-$(CONFIG_CPU_V7) += head-v7.o
AFLAGS_head-v7.o :=-Wa,-march=armv7-a
obj-$(CONFIG_SMP) += platsmp.o
obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
-obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
obj-$(CONFIG_SOC_IMX6Q) += clock-imx6q.o mach-imx6q.o
ifeq ($(CONFIG_PM),y)
diff --git a/arch/arm/mach-imx/localtimer.c b/arch/arm/mach-imx/localtimer.c
deleted file mode 100644
index 3a16351..0000000
--- a/arch/arm/mach-imx/localtimer.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2011 Freescale Semiconductor, Inc.
- * Copyright 2011 Linaro Ltd.
- *
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
- *
- * http://www.opensource.org/licenses/gpl-license.html
- * http://www.gnu.org/copyleft/gpl.html
- */
-
-#include <linux/init.h>
-#include <linux/clockchips.h>
-#include <linux/of_address.h>
-#include <linux/of_irq.h>
-#include <asm/smp_twd.h>
-
-/*
- * Setup the local clock events for a CPU.
- */
-int __cpuinit local_timer_setup(struct clock_event_device *evt)
-{
- struct device_node *np;
-
- np = of_find_compatible_node(NULL, NULL, "arm,smp-twd");
- if (!twd_base) {
- twd_base = of_iomap(np, 0);
- WARN_ON(!twd_base);
- }
- evt->irq = irq_of_parse_and_map(np, 0);
- twd_timer_setup(evt);
-
- return 0;
-}
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index c257281..a2eea86 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -21,6 +21,7 @@
#include <linux/of_platform.h>
#include <linux/phy.h>
#include <linux/micrel_phy.h>
+#include <asm/smp_twd.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/hardware/gic.h>
#include <asm/mach/arch.h>
@@ -119,6 +120,7 @@ static void __init imx6q_init_irq(void)
static void __init imx6q_timer_init(void)
{
mx6q_clocks_init();
+ twd_local_timer_of_register();
}
static struct sys_timer imx6q_timer = {
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 12/15] ARM: smp_twd: remove old local timer interface
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
` (10 preceding siblings ...)
2012-01-16 13:52 ` [PATCH v3 11/15] ARM: imx6q: " Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 13/15] ARM: local timers: convert exynos to runtime registration interface Marc Zyngier
` (2 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
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 <marc.zyngier@arm.com>
---
arch/arm/include/asm/localtimer.h | 8 --------
arch/arm/include/asm/smp_twd.h | 6 ------
arch/arm/kernel/smp_twd.c | 34 +++++-----------------------------
3 files changed, 5 insertions(+), 43 deletions(-)
diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h
index f088d63..955eed1 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 <linux/errno.h>
-#include <linux/interrupt.h>
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 23c5bc4..dae9db0 100644
--- a/arch/arm/include/asm/smp_twd.h
+++ b/arch/arm/include/asm/smp_twd.h
@@ -20,12 +20,6 @@
#include <linux/ioport.h>
-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];
};
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index d2dce64..66808c0 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -18,7 +18,7 @@
#include <linux/smp.h>
#include <linux/jiffies.h>
#include <linux/clockchips.h>
-#include <linux/irq.h>
+#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/of_irq.h>
#include <linux/of_address.h>
@@ -28,7 +28,7 @@
#include <asm/hardware/gic.h>
/* set up by the platform code */
-void __iomem *twd_base;
+static void __iomem *twd_base;
static struct clk *twd_clk;
static unsigned long twd_timer_rate;
@@ -80,7 +80,7 @@ static int twd_set_next_event(unsigned long evt,
* If a local timer interrupt has occurred, acknowledge and return 1.
* Otherwise, return 0.
*/
-int twd_timer_ack(void)
+static int twd_timer_ack(void)
{
if (__raw_readl(twd_base + TWD_TIMER_INTSTAT)) {
__raw_writel(1, twd_base + TWD_TIMER_INTSTAT);
@@ -96,11 +96,6 @@ static void twd_timer_stop(struct clock_event_device *clk)
disable_percpu_irq(clk->irq);
}
-/* Temporary hack to be removed when all TWD users are converted to
- the new registration interface */
-void local_timer_stop(struct clock_event_device *clk)
- __attribute__ ((alias ("twd_timer_stop")));
-
#ifdef CONFIG_CPU_FREQ
/*
@@ -230,28 +225,10 @@ static struct clk *twd_get_clock(void)
/*
* Setup the local clock events for a CPU.
*/
-int __cpuinit twd_timer_setup(struct clock_event_device *clk)
+static int __cpuinit twd_timer_setup(struct clock_event_device *clk)
{
struct clock_event_device **this_cpu_clk;
- if (!twd_evt) {
- int err;
-
- twd_evt = alloc_percpu(struct clock_event_device *);
- if (!twd_evt) {
- pr_err("twd: can't allocate memory\n");
- return -ENOMEM;
- }
-
- err = request_percpu_irq(clk->irq, twd_handler,
- "twd", twd_evt);
- if (err) {
- pr_err("twd: can't register interrupt %d (%d)\n",
- clk->irq, err);
- return err;
- }
- }
-
if (!twd_clk)
twd_clk = twd_get_clock();
@@ -266,8 +243,7 @@ int __cpuinit twd_timer_setup(struct clock_event_device *clk)
clk->rating = 350;
clk->set_mode = twd_set_mode;
clk->set_next_event = twd_set_next_event;
- if (!clk->irq)
- clk->irq = twd_ppi;
+ clk->irq = twd_ppi;
this_cpu_clk = __this_cpu_ptr(twd_evt);
*this_cpu_clk = clk;
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 13/15] ARM: local timers: convert exynos to runtime registration interface
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
` (11 preceding siblings ...)
2012-01-16 13:52 ` [PATCH v3 12/15] ARM: smp_twd: remove old local timer interface Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 14/15] ARM: local timers: convert MSM " Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 15/15] ARM: local timers: make the runtime registration interface mandatory Marc Zyngier
14 siblings, 0 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
Convert the Exynos MCT timers to the runtime registration interface.
Tested on Origen.
Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-exynos/mct.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c
index 85b5527..edc4b94 100644
--- a/arch/arm/mach-exynos/mct.c
+++ b/arch/arm/mach-exynos/mct.c
@@ -21,6 +21,7 @@
#include <linux/percpu.h>
#include <asm/hardware/gic.h>
+#include <asm/localtimer.h>
#include <plat/cpu.h>
@@ -375,7 +376,7 @@ static struct irqaction mct_tick1_event_irq = {
.handler = exynos4_mct_tick_isr,
};
-static void exynos4_mct_tick_init(struct clock_event_device *evt)
+static int __cpuinit exynos4_local_timer_setup(struct clock_event_device *evt)
{
struct mct_clock_event_device *mevt;
unsigned int cpu = smp_processor_id();
@@ -417,17 +418,11 @@ static void exynos4_mct_tick_init(struct clock_event_device *evt)
} else {
enable_percpu_irq(IRQ_MCT_LOCALTIMER, 0);
}
-}
-
-/* Setup the local clock events for a CPU */
-int __cpuinit local_timer_setup(struct clock_event_device *evt)
-{
- exynos4_mct_tick_init(evt);
return 0;
}
-void local_timer_stop(struct clock_event_device *evt)
+static void exynos4_local_timer_stop(struct clock_event_device *evt)
{
unsigned int cpu = smp_processor_id();
evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt);
@@ -439,6 +434,11 @@ void local_timer_stop(struct clock_event_device *evt)
else
disable_percpu_irq(IRQ_MCT_LOCALTIMER);
}
+
+static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = {
+ .setup = exynos4_local_timer_setup,
+ .stop = exynos4_local_timer_stop,
+};
#endif /* CONFIG_LOCAL_TIMERS */
static void __init exynos4_timer_resources(void)
@@ -458,6 +458,8 @@ static void __init exynos4_timer_resources(void)
WARN(err, "MCT: can't request IRQ %d (%d)\n",
IRQ_MCT_LOCALTIMER, err);
}
+
+ local_timer_register(&exynos4_mct_tick_ops);
#endif /* CONFIG_LOCAL_TIMERS */
}
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 14/15] ARM: local timers: convert MSM to runtime registration interface
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
` (12 preceding siblings ...)
2012-01-16 13:52 ` [PATCH v3 13/15] ARM: local timers: convert exynos to runtime registration interface Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 15/15] ARM: local timers: make the runtime registration interface mandatory Marc Zyngier
14 siblings, 0 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
Convert the MSM timers to the runtime registration interface.
Cc: Stephen Boyd <sboyd@codeaurora.org>
Tested-by: David Brown <davidb@codeaurora.org>
Acked-by: David Brown <davidb@codeaurora.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-msm/timer.c | 79 +++++++++++++++++++++++++--------------------
1 files changed, 44 insertions(+), 35 deletions(-)
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 11d0d8f..75f4be4 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -127,6 +127,45 @@ static struct clocksource msm_clocksource = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+#ifdef CONFIG_LOCAL_TIMERS
+static int __cpuinit msm_local_timer_setup(struct clock_event_device *evt)
+{
+ /* Use existing clock_event for cpu 0 */
+ if (!smp_processor_id())
+ return 0;
+
+ writel_relaxed(0, event_base + TIMER_ENABLE);
+ writel_relaxed(0, event_base + TIMER_CLEAR);
+ writel_relaxed(~0, event_base + TIMER_MATCH_VAL);
+ evt->irq = msm_clockevent.irq;
+ evt->name = "local_timer";
+ evt->features = msm_clockevent.features;
+ evt->rating = msm_clockevent.rating;
+ evt->set_mode = msm_timer_set_mode;
+ evt->set_next_event = msm_timer_set_next_event;
+ evt->shift = msm_clockevent.shift;
+ evt->mult = div_sc(GPT_HZ, NSEC_PER_SEC, evt->shift);
+ evt->max_delta_ns = clockevent_delta2ns(0xf0000000, evt);
+ evt->min_delta_ns = clockevent_delta2ns(4, evt);
+
+ *__this_cpu_ptr(msm_evt.percpu_evt) = evt;
+ clockevents_register_device(evt);
+ enable_percpu_irq(evt->irq, 0);
+ return 0;
+}
+
+static void msm_local_timer_stop(struct clock_event_device *evt)
+{
+ evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt);
+ disable_percpu_irq(evt->irq);
+}
+
+static struct local_timer_ops msm_local_timer_ops __cpuinitdata = {
+ .setup = msm_local_timer_setup,
+ .stop = msm_local_timer_stop,
+};
+#endif /* CONFIG_LOCAL_TIMERS */
+
static void __init msm_timer_init(void)
{
struct clock_event_device *ce = &msm_clockevent;
@@ -173,8 +212,12 @@ static void __init msm_timer_init(void)
*__this_cpu_ptr(msm_evt.percpu_evt) = ce;
res = request_percpu_irq(ce->irq, msm_timer_interrupt,
ce->name, msm_evt.percpu_evt);
- if (!res)
+ if (!res) {
enable_percpu_irq(ce->irq, 0);
+#ifdef CONFIG_LOCAL_TIMERS
+ local_timer_register(&msm_local_timer_ops);
+#endif
+ }
} else {
msm_evt.evt = ce;
res = request_irq(ce->irq, msm_timer_interrupt,
@@ -191,40 +234,6 @@ err:
pr_err("clocksource_register failed\n");
}
-#ifdef CONFIG_LOCAL_TIMERS
-int __cpuinit local_timer_setup(struct clock_event_device *evt)
-{
- /* Use existing clock_event for cpu 0 */
- if (!smp_processor_id())
- return 0;
-
- writel_relaxed(0, event_base + TIMER_ENABLE);
- writel_relaxed(0, event_base + TIMER_CLEAR);
- writel_relaxed(~0, event_base + TIMER_MATCH_VAL);
- evt->irq = msm_clockevent.irq;
- evt->name = "local_timer";
- evt->features = msm_clockevent.features;
- evt->rating = msm_clockevent.rating;
- evt->set_mode = msm_timer_set_mode;
- evt->set_next_event = msm_timer_set_next_event;
- evt->shift = msm_clockevent.shift;
- evt->mult = div_sc(GPT_HZ, NSEC_PER_SEC, evt->shift);
- evt->max_delta_ns = clockevent_delta2ns(0xf0000000, evt);
- evt->min_delta_ns = clockevent_delta2ns(4, evt);
-
- *__this_cpu_ptr(msm_evt.percpu_evt) = evt;
- clockevents_register_device(evt);
- enable_percpu_irq(evt->irq, 0);
- return 0;
-}
-
-void local_timer_stop(struct clock_event_device *evt)
-{
- evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt);
- disable_percpu_irq(evt->irq);
-}
-#endif /* CONFIG_LOCAL_TIMERS */
-
struct sys_timer msm_timer = {
.init = msm_timer_init
};
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 15/15] ARM: local timers: make the runtime registration interface mandatory
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
` (13 preceding siblings ...)
2012-01-16 13:52 ` [PATCH v3 14/15] ARM: local timers: convert MSM " Marc Zyngier
@ 2012-01-16 13:52 ` Marc Zyngier
14 siblings, 0 replies; 18+ messages in thread
From: Marc Zyngier @ 2012-01-16 13:52 UTC (permalink / raw)
To: linux-arm-kernel
Remove all traces of the compile-time local timer interface,
and make the runtime selection mandatory.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/include/asm/localtimer.h | 26 --------------------------
arch/arm/kernel/smp.c | 23 ++++++-----------------
2 files changed, 6 insertions(+), 43 deletions(-)
diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h
index 955eed1..f77ffc1 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;
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 69d5f8b..09c720e 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -260,6 +260,8 @@ static void __cpuinit smp_store_cpu_info(unsigned int cpuid)
store_cpu_topology(cpuid);
}
+static void percpu_timer_setup(void);
+
/*
* This is the secondary CPU boot entry. We're using this CPUs
* idle thread stack, but a set of temporary page tables.
@@ -488,21 +490,7 @@ int local_timer_register(struct local_timer_ops *ops)
}
#endif
-int __cpuinit __attribute__ ((weak)) local_timer_setup(struct clock_event_device *clk)
-{
- if (lt_ops)
- return lt_ops->setup(clk);
-
- return -ENXIO;
-}
-
-void __attribute__ ((weak)) local_timer_stop(struct clock_event_device *clk)
-{
- if (lt_ops)
- lt_ops->stop(clk);
-}
-
-void __cpuinit percpu_timer_setup(void)
+static void __cpuinit percpu_timer_setup(void)
{
unsigned int cpu = smp_processor_id();
struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu);
@@ -510,7 +498,7 @@ void __cpuinit percpu_timer_setup(void)
evt->cpumask = cpumask_of(cpu);
evt->broadcast = smp_timer_broadcast;
- if (local_timer_setup(evt))
+ if (!lt_ops || lt_ops->setup(evt))
broadcast_timer_setup(evt);
}
@@ -525,7 +513,8 @@ static void percpu_timer_stop(void)
unsigned int cpu = smp_processor_id();
struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu);
- local_timer_stop(evt);
+ if (lt_ops)
+ lt_ops->stop(evt);
}
#endif
--
1.7.7.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 04/15] ARM: smp_twd: add device tree support
2012-01-16 13:52 ` [PATCH v3 04/15] ARM: smp_twd: add device tree support Marc Zyngier
@ 2012-01-16 15:59 ` Rob Herring
0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2012-01-16 15:59 UTC (permalink / raw)
To: linux-arm-kernel
On 01/16/2012 07:52 AM, Marc Zyngier wrote:
> Add bindings to support DT discovery of the ARM Timer Watchdog
> (aka TWD). Only the timer side is converted by this patch.
>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
Acked-by: Rob Herring <rob.herring@calxeda.com>
> Documentation/devicetree/bindings/arm/twd.txt | 48 +++++++++++++++
> arch/arm/include/asm/smp_twd.h | 8 +++
> arch/arm/kernel/smp_twd.c | 77 ++++++++++++++++++++----
> 3 files changed, 120 insertions(+), 13 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/arm/twd.txt
>
> diff --git a/Documentation/devicetree/bindings/arm/twd.txt b/Documentation/devicetree/bindings/arm/twd.txt
> new file mode 100644
> index 0000000..75b8610
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/twd.txt
> @@ -0,0 +1,48 @@
> +* ARM Timer Watchdog
> +
> +ARM 11MP, Cortex-A5 and Cortex-A9 are often associated with a per-core
> +Timer-Watchdog (aka TWD), which provides both a per-cpu local timer
> +and watchdog.
> +
> +The TWD is usually attached to a GIC to deliver its two per-processor
> +interrupts.
> +
> +** Timer node required properties:
> +
> +- compatible : Should be one of:
> + "arm,cortex-a9-twd-timer"
> + "arm,cortex-a5-twd-timer"
> + "arm,arm11mp-twd-timer"
> +
> +- interrupts : One interrupt to each core
> +
> +- reg : Specify the base address and the size of the TWD timer
> + register window.
> +
> +Example:
> +
> + twd-timer at 2c000600 {
> + compatible = "arm,arm11mp-twd-timer"";
> + reg = <0x2c000600 0x20>;
> + interrupts = <1 13 0xf01>;
> + };
> +
> +** Watchdog node properties:
> +
> +- compatible : Should be one of:
> + "arm,cortex-a9-twd-wdt"
> + "arm,cortex-a5-twd-wdt"
> + "arm,arm11mp-twd-wdt"
> +
> +- interrupts : One interrupt to each core
> +
> +- reg : Specify the base address and the size of the TWD watchdog
> + register window.
> +
> +Example:
> +
> + twd-watchdog at 2c000620 {
> + compatible = "arm,arm11mp-twd-wdt";
> + reg = <0x2c000620 0x20>;
> + interrupts = <1 14 0xf01>;
> + };
> diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h
> index 16c89b7..23c5bc4 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 *);
>
> +#if CONFIG_HAVE_ARM_TWD
> +void twd_local_timer_of_register(void);
> +#else
> +static inline void twd_local_timer_of_register(void)
> +{
> +}
> +#endif
> +
> #endif
> diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
> index f105e91..d2dce64 100644
> --- a/arch/arm/kernel/smp_twd.c
> +++ b/arch/arm/kernel/smp_twd.c
> @@ -20,6 +20,8 @@
> #include <linux/clockchips.h>
> #include <linux/irq.h>
> #include <linux/io.h>
> +#include <linux/of_irq.h>
> +#include <linux/of_address.h>
>
> #include <asm/smp_twd.h>
> #include <asm/localtimer.h>
> @@ -282,37 +284,86 @@ static struct local_timer_ops twd_lt_ops __cpuinitdata = {
> .stop = twd_timer_stop,
> };
>
> -int __init twd_local_timer_register(struct twd_local_timer *tlt)
> +static int __init twd_local_timer_common_register(void)
> {
> int err;
>
> - if (twd_base || twd_evt)
> - return -EBUSY;
> -
> - twd_ppi = tlt->res[1].start;
> -
> twd_evt = alloc_percpu(struct clock_event_device *);
> - twd_base = ioremap(tlt->res[0].start, resource_size(&tlt->res[0]));
> - if (!twd_base || !twd_evt) {
> + if (!twd_evt) {
> err = -ENOMEM;
> - goto out;
> + goto out_free;
> }
>
> err = request_percpu_irq(twd_ppi, twd_handler, "twd", twd_evt);
> if (err) {
> pr_err("twd: can't register interrupt %d (%d)\n", twd_ppi, err);
> - goto out;
> + goto out_free;
> }
>
> err = local_timer_register(&twd_lt_ops);
> if (err)
> - goto out;
> + goto out_irq;
>
> return 0;
>
> -out:
> +out_irq:
> + free_percpu_irq(twd_ppi, twd_evt);
> +out_free:
> iounmap(twd_base);
> + twd_base = NULL;
> free_percpu(twd_evt);
> - twd_base = twd_evt = NULL;
> +
> return err;
> }
> +
> +int __init twd_local_timer_register(struct twd_local_timer *tlt)
> +{
> + if (twd_base || twd_evt)
> + return -EBUSY;
> +
> + twd_ppi = tlt->res[1].start;
> +
> + twd_base = ioremap(tlt->res[0].start, resource_size(&tlt->res[0]));
> + if (!twd_base)
> + return -ENOMEM;
> +
> + return twd_local_timer_common_register();
> +}
> +
> +#ifdef CONFIG_OF
> +const static struct of_device_id twd_of_match[] __initconst = {
> + { .compatible = "arm,cortex-a9-twd-timer", },
> + { .compatible = "arm,cortex-a5-twd-timer", },
> + { .compatible = "arm,arm11mp-twd-timer", },
> + { },
> +};
> +
> +void __init twd_local_timer_of_register(void)
> +{
> + struct device_node *np;
> + int err;
> +
> + np = of_find_matching_node(NULL, twd_of_match);
> + if (!np) {
> + err = -ENODEV;
> + goto out;
> + }
> +
> + twd_ppi = irq_of_parse_and_map(np, 0);
> + if (!twd_ppi) {
> + err = -EINVAL;
> + goto out;
> + }
> +
> + twd_base = of_iomap(np, 0);
> + if (!twd_base) {
> + err = -ENOMEM;
> + goto out;
> + }
> +
> + err = twd_local_timer_common_register();
> +
> +out:
> + WARN(err, "twd_local_timer_of_register failed (%d)\n", err);
> +}
> +#endif
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3 11/15] ARM: imx6q: convert to twd_local_timer_register() interface
2012-01-16 13:52 ` [PATCH v3 11/15] ARM: imx6q: " Marc Zyngier
@ 2012-01-17 3:29 ` Shawn Guo
0 siblings, 0 replies; 18+ messages in thread
From: Shawn Guo @ 2012-01-17 3:29 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jan 16, 2012 at 01:52:36PM +0000, Marc Zyngier wrote:
> Add support for the new smp_twd runtime registration interface
> to the imx6q platforms, and remove the old compile-time support.
>
> The imx6q DTS file is updated to match the TWD DT documentation.
> Also present in this patch a DTS fix to the timer interrupt routing
> (the PPI connection uses bits [15:8]) and trigger (rising edge).
>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
(Tested on imx6q)
Regards,
Shawn
> ---
> arch/arm/boot/dts/imx6q.dtsi | 6 +++---
> arch/arm/mach-imx/Makefile | 1 -
> arch/arm/mach-imx/localtimer.c | 35 -----------------------------------
> arch/arm/mach-imx/mach-imx6q.c | 2 ++
> 4 files changed, 5 insertions(+), 39 deletions(-)
> delete mode 100644 arch/arm/mach-imx/localtimer.c
>
> diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
> index 263e8f3..4905f51 100644
> --- a/arch/arm/boot/dts/imx6q.dtsi
> +++ b/arch/arm/boot/dts/imx6q.dtsi
> @@ -88,9 +88,9 @@
> ranges;
>
> timer at 00a00600 {
> - compatible = "arm,smp-twd";
> - reg = <0x00a00600 0x100>;
> - interrupts = <1 13 0xf4>;
> + compatible = "arm,cortex-a9-twd-timer";
> + reg = <0x00a00600 0x20>;
> + interrupts = <1 13 0xf01>;
> };
>
> L2: l2-cache at 00a02000 {
> diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
> index f5920c2..dd46f07 100644
> --- a/arch/arm/mach-imx/Makefile
> +++ b/arch/arm/mach-imx/Makefile
> @@ -69,7 +69,6 @@ obj-$(CONFIG_CPU_V7) += head-v7.o
> AFLAGS_head-v7.o :=-Wa,-march=armv7-a
> obj-$(CONFIG_SMP) += platsmp.o
> obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
> -obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
> obj-$(CONFIG_SOC_IMX6Q) += clock-imx6q.o mach-imx6q.o
>
> ifeq ($(CONFIG_PM),y)
> diff --git a/arch/arm/mach-imx/localtimer.c b/arch/arm/mach-imx/localtimer.c
> deleted file mode 100644
> index 3a16351..0000000
> --- a/arch/arm/mach-imx/localtimer.c
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -/*
> - * Copyright 2011 Freescale Semiconductor, Inc.
> - * Copyright 2011 Linaro Ltd.
> - *
> - * The code contained herein is licensed under the GNU General Public
> - * License. You may obtain a copy of the GNU General Public License
> - * Version 2 or later at the following locations:
> - *
> - * http://www.opensource.org/licenses/gpl-license.html
> - * http://www.gnu.org/copyleft/gpl.html
> - */
> -
> -#include <linux/init.h>
> -#include <linux/clockchips.h>
> -#include <linux/of_address.h>
> -#include <linux/of_irq.h>
> -#include <asm/smp_twd.h>
> -
> -/*
> - * Setup the local clock events for a CPU.
> - */
> -int __cpuinit local_timer_setup(struct clock_event_device *evt)
> -{
> - struct device_node *np;
> -
> - np = of_find_compatible_node(NULL, NULL, "arm,smp-twd");
> - if (!twd_base) {
> - twd_base = of_iomap(np, 0);
> - WARN_ON(!twd_base);
> - }
> - evt->irq = irq_of_parse_and_map(np, 0);
> - twd_timer_setup(evt);
> -
> - return 0;
> -}
> diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
> index c257281..a2eea86 100644
> --- a/arch/arm/mach-imx/mach-imx6q.c
> +++ b/arch/arm/mach-imx/mach-imx6q.c
> @@ -21,6 +21,7 @@
> #include <linux/of_platform.h>
> #include <linux/phy.h>
> #include <linux/micrel_phy.h>
> +#include <asm/smp_twd.h>
> #include <asm/hardware/cache-l2x0.h>
> #include <asm/hardware/gic.h>
> #include <asm/mach/arch.h>
> @@ -119,6 +120,7 @@ static void __init imx6q_init_irq(void)
> static void __init imx6q_timer_init(void)
> {
> mx6q_clocks_init();
> + twd_local_timer_of_register();
> }
>
> static struct sys_timer imx6q_timer = {
> --
> 1.7.7.1
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2012-01-17 3:29 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-16 13:52 [PATCH v3 00/15] Runtime registration for local timers Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 01/15] ARM: smp_twd: make local_timer_stop a symbol instead of a #define Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 02/15] ARM: local timers: introduce a new registration interface Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 03/15] ARM: smp_twd: add runtime registration support Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 04/15] ARM: smp_twd: add device tree support Marc Zyngier
2012-01-16 15:59 ` Rob Herring
2012-01-16 13:52 ` [PATCH v3 05/15] ARM: OMAP4: convert to twd_local_timer_register() interface Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 06/15] ARM: plat-versatile: " Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 07/15] ARM: tegra: " Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 08/15] ARM: shmobile: " Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 09/15] ARM: ux500: " Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 10/15] ARM: highbank: " Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 11/15] ARM: imx6q: " Marc Zyngier
2012-01-17 3:29 ` Shawn Guo
2012-01-16 13:52 ` [PATCH v3 12/15] ARM: smp_twd: remove old local timer interface Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 13/15] ARM: local timers: convert exynos to runtime registration interface Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 14/15] ARM: local timers: convert MSM " Marc Zyngier
2012-01-16 13:52 ` [PATCH v3 15/15] ARM: local timers: make the runtime registration interface mandatory Marc Zyngier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).