* [PATCH 00/15] Runtime registration for local timers
@ 2012-01-11 13:08 Marc Zyngier
2012-01-11 13:08 ` [PATCH 01/15] ARM: smp_twd: make local_timer_stop a symbol instead of a #define Marc Zyngier
` (14 more replies)
0 siblings, 15 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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 next-20120110.
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 | 29 ++++++
arch/arm/include/asm/localtimer.h | 37 ++-------
arch/arm/include/asm/smp_twd.h | 10 ++-
arch/arm/kernel/smp.c | 29 ++++++-
arch/arm/kernel/smp_twd.c | 114 ++++++++++++++++++++-----
arch/arm/mach-exynos/mct.c | 18 ++--
arch/arm/mach-highbank/Makefile | 1 -
arch/arm/mach-highbank/highbank.c | 12 +++
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 | 11 +++
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 | 33 ++++++-
arch/arm/mach-realview/realview_eb.c | 34 +++++++-
arch/arm/mach-realview/realview_pb11mp.c | 32 ++++++-
arch/arm/mach-realview/realview_pbx.c | 31 ++++++-
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-sh73a0.c | 32 ++++++-
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 | 34 ++++++-
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 | 39 +++++++--
arch/arm/mach-vexpress/ct-ca9x4.c | 30 ++++++-
arch/arm/plat-versatile/Makefile | 1 -
arch/arm/plat-versatile/localtimer.c | 27 ------
35 files changed, 480 insertions(+), 368 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] 38+ messages in thread
* [PATCH 01/15] ARM: smp_twd: make local_timer_stop a symbol instead of a #define
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-11 13:08 ` [PATCH 02/15] ARM: local timers: introduce a new registration interface Marc Zyngier
` (13 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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] 38+ messages in thread
* [PATCH 02/15] ARM: local timers: introduce a new registration interface
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
2012-01-11 13:08 ` [PATCH 01/15] ARM: smp_twd: make local_timer_stop a symbol instead of a #define Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-11 13:08 ` [PATCH 03/15] ARM: smp_twd: add runtime registration support Marc Zyngier
` (12 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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 | 25 +++++++++++++++++++++++++
2 files changed, 40 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..d36c978 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -475,6 +475,31 @@ static void __cpuinit broadcast_timer_setup(struct clock_event_device *evt)
clockevents_register_device(evt);
}
+static struct local_timer_ops *lt_ops;
+
+int local_timer_register(struct local_timer_ops *ops)
+{
+ if (lt_ops)
+ return -EBUSY;
+
+ lt_ops = ops;
+ return 0;
+}
+
+int __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] 38+ messages in thread
* [PATCH 03/15] ARM: smp_twd: add runtime registration support
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
2012-01-11 13:08 ` [PATCH 01/15] ARM: smp_twd: make local_timer_stop a symbol instead of a #define Marc Zyngier
2012-01-11 13:08 ` [PATCH 02/15] ARM: local timers: introduce a new registration interface Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-11 13:08 ` [PATCH 04/15] ARM: smp_twd: add device tree support Marc Zyngier
` (11 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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 | 10 +++++++-
arch/arm/kernel/smp_twd.c | 51 +++++++++++++++++++++++++++++++++++++--
2 files changed, 57 insertions(+), 4 deletions(-)
diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h
index bf8449d..9b6ff85 100644
--- a/arch/arm/include/asm/smp_twd.h
+++ b/arch/arm/include/asm/smp_twd.h
@@ -18,10 +18,18 @@
#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];
+};
+
+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..be245c7 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 = {
+ .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] 38+ messages in thread
* [PATCH 04/15] ARM: smp_twd: add device tree support
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
` (2 preceding siblings ...)
2012-01-11 13:08 ` [PATCH 03/15] ARM: smp_twd: add runtime registration support Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-11 21:05 ` Rob Herring
2012-01-11 13:08 ` [PATCH 05/15] ARM: OMAP4: convert to twd_local_timer_register() interface Marc Zyngier
` (10 subsequent siblings)
14 siblings, 1 reply; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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 | 29 +++++++++++
arch/arm/include/asm/smp_twd.h | 1 +
arch/arm/kernel/smp_twd.c | 68 ++++++++++++++++++++-----
3 files changed, 85 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..a9d5587
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/twd.txt
@@ -0,0 +1,29 @@
+* 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.
+
+Main node required properties:
+
+- compatible : Should be one of:
+ "arm,cortex-a9-twd"
+ "arm,cortex-a5-twd"
+ "arm,arm11mp-twd"
+ "arm,smp-twd"
+
+- interrupts : Two interrupts to each core, the first one for the
+ timer, the second one for the watchdog.
+
+- reg : Specify the base address and the size of the TWD.
+
+Example:
+
+ twd at 2c000600 {
+ compatible = "arm,arm11mp-twd", "arm,smp-twd";
+ reg = <0x2c000600 0x100>;
+ interrupts = <1 13 0xf01 1 14 0xf01>;
+ };
diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h
index 9b6ff85..e8998c9 100644
--- a/arch/arm/include/asm/smp_twd.h
+++ b/arch/arm/include/asm/smp_twd.h
@@ -31,5 +31,6 @@ struct twd_local_timer {
};
int twd_local_timer_register(struct twd_local_timer *);
+int twd_local_timer_of_register(void);
#endif
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index be245c7..53ddef8 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,77 @@ static struct local_timer_ops twd_lt_ops = {
.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,smp-twd", },
+ { .compatible = "arm,cortex-a9-twd", },
+ { .compatible = "arm,cortex-a5-twd", },
+ { .compatible = "arm,arm11mp-twd", },
+ { },
+};
+
+int __init twd_local_timer_of_register(void)
+{
+ struct device_node *np;
+
+ np = of_find_matching_node(NULL, twd_of_match);
+ if (!np)
+ return -ENODEV;
+
+ twd_ppi = irq_of_parse_and_map(np, 0);
+ if (!twd_ppi)
+ return -EINVAL;
+
+ twd_base = of_iomap(np, 0);
+ if (!twd_base)
+ return -ENOMEM;
+
+ return twd_local_timer_common_register();
+}
+#endif
--
1.7.7.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 05/15] ARM: OMAP4: convert to twd_local_timer_register() interface
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
` (3 preceding siblings ...)
2012-01-11 13:08 ` [PATCH 04/15] ARM: smp_twd: add device tree support Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-11 13:14 ` Shilimkar, Santosh
2012-01-11 13:08 ` [PATCH 06/15] ARM: plat-versatile: " Marc Zyngier
` (9 subsequent siblings)
14 siblings, 1 reply; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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>
Cc: 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 | 33 ++++++++++++++++++++++++++++-----
3 files changed, 28 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..5017e84 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,37 @@ 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 struct twd_local_timer twd_local_timer __initdata = {
+ .res = {
+ {
+ .start = OMAP44XX_LOCAL_TWD_BASE,
+ .end = OMAP44XX_LOCAL_TWD_BASE + 0x10,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = OMAP44XX_IRQ_LOCALTIMER,
+ .end = OMAP44XX_IRQ_LOCALTIMER,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+};
#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] 38+ messages in thread
* [PATCH 06/15] ARM: plat-versatile: convert to twd_local_timer_register() interface
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
` (4 preceding siblings ...)
2012-01-11 13:08 ` [PATCH 05/15] ARM: OMAP4: convert to twd_local_timer_register() interface Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-12 9:14 ` Russell King - ARM Linux
2012-01-11 13:08 ` [PATCH 07/15] ARM: tegra: " Marc Zyngier
` (8 subsequent siblings)
14 siblings, 1 reply; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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 | 34 ++++++++++++++++++++++++++---
arch/arm/mach-realview/realview_pb11mp.c | 32 ++++++++++++++++++++++++---
arch/arm/mach-realview/realview_pbx.c | 31 ++++++++++++++++++++++++--
arch/arm/mach-vexpress/ct-ca9x4.c | 30 +++++++++++++++++++++++--
arch/arm/plat-versatile/Makefile | 1 -
arch/arm/plat-versatile/localtimer.c | 27 -----------------------
6 files changed, 113 insertions(+), 42 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..6c5e61d 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,34 @@ static void realview_eb11mp_fixup(void)
realview_eb_isp1761_resources[1].end = IRQ_EB11MP_USB;
}
+#ifdef CONFIG_HAVE_ARM_TWD
+static struct twd_local_timer twd_local_timer __initdata = {
+ .res = {
+ {
+ .start = REALVIEW_EB11MP_TWD_BASE,
+ .end = REALVIEW_EB11MP_TWD_BASE + 0xff,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = IRQ_LOCALTIMER,
+ .end = IRQ_LOCALTIMER,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+};
+
+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 NULL
+#endif
+
static void __init realview_eb_timer_init(void)
{
unsigned int timer_irq;
@@ -398,9 +426,7 @@ static void __init realview_eb_timer_init(void)
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
+ late_time_init = realview_eb_twd_init;
timer_irq = IRQ_EB11MP_TIMER0_1;
} else
timer_irq = IRQ_EB_TIMER0_1;
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index 127a3fd..73840be 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,32 @@ static void __init gic_init_irq(void)
gic_cascade_irq(1, IRQ_TC11MP_PB_IRQ1);
}
+#ifdef CONFIG_HAVE_ARM_TWD
+static struct twd_local_timer twd_local_timer __initdata = {
+ .res = {
+ {
+ .start = REALVIEW_TC11MP_TWD_BASE,
+ .end = REALVIEW_TC11MP_TWD_BASE + 0x10,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = IRQ_LOCALTIMER,
+ .end = IRQ_LOCALTIMER,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+};
+
+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 NULL
+#endif
+
static void __init realview_pb11mp_timer_init(void)
{
timer0_va_base = __io_address(REALVIEW_PB11MP_TIMER0_1_BASE);
@@ -302,10 +328,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);
+ late_time_init = 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..ded5dda 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -298,6 +298,32 @@ static void __init gic_init_irq(void)
}
}
+#ifdef CONFIG_HAVE_ARM_TWD
+static struct twd_local_timer twd_local_timer __initdata = {
+ .res = {
+ {
+ .start = REALVIEW_PBX_TILE_TWD_BASE,
+ .end = REALVIEW_PBX_TILE_TWD_BASE + 0x10,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = IRQ_LOCALTIMER,
+ .end = IRQ_LOCALTIMER,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+};
+
+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 NULL
+#endif
+
static void __init realview_pbx_timer_init(void)
{
timer0_va_base = __io_address(REALVIEW_PBX_TIMER0_1_BASE);
@@ -305,10 +331,9 @@ 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
+ late_time_init = realview_pbx_twd_init;
+
realview_timer_init(IRQ_PBX_TIMER0_1);
}
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index 2b1e836..eed2a5b 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,36 @@ static struct platform_device pmu_device = {
.resource = pmu_resources,
};
+#ifdef CONFIG_HAVE_ARM_TWD
+static struct twd_local_timer twd_local_timer __initdata = {
+ .res = {
+ {
+ .start = A9_MPCORE_TWD,
+ .end = A9_MPCORE_TWD + 0x10,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = IRQ_LOCALTIMER,
+ .end = IRQ_LOCALTIMER,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+};
+
+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 NULL
+#endif
+
static void __init ct_ca9x4_init_early(void)
{
clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+ late_time_init = 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] 38+ messages in thread
* [PATCH 07/15] ARM: tegra: convert to twd_local_timer_register() interface
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
` (5 preceding siblings ...)
2012-01-11 13:08 ` [PATCH 06/15] ARM: plat-versatile: " Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-11 21:49 ` Stephen Warren
2012-01-11 13:08 ` [PATCH 08/15] ARM: shmobile: " Marc Zyngier
` (7 subsequent siblings)
14 siblings, 1 reply; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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 | 34 +++++++++++++++++++++++++++++-----
3 files changed, 30 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..f50e320 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,32 @@ static struct irqaction tegra_timer_irq = {
.irq = INT_TMR3,
};
+#ifdef CONFIG_HAVE_ARM_TWD
+static struct twd_local_timer twd_local_timer __initdata = {
+ .res = {
+ {
+ .start = TEGRA_ARM_PERIF_BASE + 0x600,
+ .end = TEGRA_ARM_PERIF_BASE + 0x610,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = IRQ_LOCALTIMER,
+ .end = IRQ_LOCALTIMER,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+};
+
+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 NULL
+#endif
+
static void __init tegra_init_timer(void)
{
struct clk *clk;
@@ -188,10 +214,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 +253,8 @@ 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);
+
+ late_time_init = tegra_twd_init;
}
struct sys_timer tegra_timer = {
--
1.7.7.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 08/15] ARM: shmobile: convert to twd_local_timer_register() interface
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
` (6 preceding siblings ...)
2012-01-11 13:08 ` [PATCH 07/15] ARM: tegra: " Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-12 9:19 ` Russell King - ARM Linux
2012-01-11 13:08 ` [PATCH 09/15] ARM: ux500: " Marc Zyngier
` (6 subsequent siblings)
14 siblings, 1 reply; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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-sh73a0.c | 32 +++++++++++++++++++++----
arch/arm/mach-shmobile/timer.c | 10 ++++++++
6 files changed, 39 insertions(+), 33 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 5ca1f9d..85c5166 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -14,7 +14,6 @@ obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o clock-sh73a0.o intc-sh73a0.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
# Pinmux setup
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index be78a2c..3dab2ec 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -52,4 +52,6 @@ extern void sh73a0_secondary_init(unsigned int cpu);
extern int sh73a0_boot_secondary(unsigned int cpu);
extern void sh73a0_smp_prepare_cpus(void);
+extern void shmobile_local_timer_register(void (*)(void));
+
#endif /* __ARCH_MACH_COMMON_H */
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 c49a833..928dd59 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-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index be1ade7..54903b9 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -41,6 +41,32 @@ static void __iomem *scu_base_addr(void)
static DEFINE_SPINLOCK(scu_lock);
static unsigned long tmp;
+#ifdef CONFIG_HAVE_ARM_TWD
+static struct twd_local_timer twd_local_timer __initdata = {
+ .res = {
+ {
+ .start = 0xf0000600,
+ .end = 0xf0000600 + 0x10,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = 29,
+ .end = 29,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+};
+
+static void __init sh73a0_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 sh73a0_twd_init NULL
+#endif
+
static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
{
void __iomem *scu_base = scu_base_addr();
@@ -59,11 +85,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_local_timer_register(sh73a0_twd_init);
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..fad385d 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -19,8 +19,11 @@
*
*/
#include <linux/platform_device.h>
+#include <mach/common.h>
#include <asm/mach/time.h>
+static void (*local_timer_hook)(void) __initdata;
+
static void __init shmobile_late_time_init(void)
{
/*
@@ -34,6 +37,8 @@ static void __init shmobile_late_time_init(void)
*/
early_platform_driver_register_all("earlytimer");
early_platform_driver_probe("earlytimer", 2, 0);
+ if (local_timer_hook)
+ local_timer_hook();
}
static void __init shmobile_timer_init(void)
@@ -41,6 +46,11 @@ static void __init shmobile_timer_init(void)
late_time_init = shmobile_late_time_init;
}
+void __init shmobile_local_timer_register(void (*hook)(void))
+{
+ local_timer_hook = hook;
+}
+
struct sys_timer shmobile_timer = {
.init = shmobile_timer_init,
};
--
1.7.7.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 09/15] ARM: ux500: convert to twd_local_timer_register() interface
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
` (7 preceding siblings ...)
2012-01-11 13:08 ` [PATCH 08/15] ARM: shmobile: " Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-11 23:53 ` Linus Walleij
2012-01-12 9:16 ` Russell King - ARM Linux
2012-01-11 13:08 ` [PATCH 10/15] ARM: highbank: " Marc Zyngier
` (5 subsequent siblings)
14 siblings, 2 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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.
Cc: 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 | 39 +++++++++++++++++++++++++++++++------
4 files changed, 32 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..a7667b1 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -8,27 +8,47 @@
#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 struct twd_local_timer twd_local_timer __initdata = {
+ .res = {
+ {
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = IRQ_LOCALTIMER,
+ .end = IRQ_LOCALTIMER,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+};
+
+static void __init ux500_twd_set_base(unsigned long base)
+{
+ twd_local_timer.res[0].start = base;
+ twd_local_timer.res[0].end = base + 0x10;
+}
+#else
+#define ux500_twd_set_base(b) 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
+ ux500_twd_set_base(U5500_TWD_BASE);
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
+ ux500_twd_set_base(U8500_TWD_BASE);
mtu_base = __io_address(U8500_MTU0_BASE);
prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE);
} else {
@@ -54,6 +74,11 @@ static void __init ux500_timer_init(void)
nmdk_timer_init();
clksrc_dbx500_prcmu_init(prcmu_timer_base);
+#ifdef CONFIG_HAVE_ARM_TWD
+ err = twd_local_timer_register(&twd_local_timer);
+ if (err)
+ pr_err("twd_local_timer_register failed %d\n", err);
+#endif
}
static void ux500_timer_reset(void)
--
1.7.7.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 10/15] ARM: highbank: convert to twd_local_timer_register() interface
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
` (8 preceding siblings ...)
2012-01-11 13:08 ` [PATCH 09/15] ARM: ux500: " Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-11 13:08 ` [PATCH 11/15] ARM: imx6q: " Marc Zyngier
` (4 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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.
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-highbank/Makefile | 1 -
arch/arm/mach-highbank/highbank.c | 12 ++++++++++
arch/arm/mach-highbank/localtimer.c | 40 -----------------------------------
3 files changed, 12 insertions(+), 41 deletions(-)
delete mode 100644 arch/arm/mach-highbank/localtimer.c
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..e244d51 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>
@@ -93,6 +94,15 @@ static void __init highbank_init_irq(void)
l2x0_of_init(0, ~0UL);
}
+#ifdef CONFIG_HAVE_ARM_SMP
+static void __init highbank_twd_init(void)
+{
+ twd_local_timer_of_register();
+}
+#else
+#define highbank_twd_init NULL
+#endif
+
static void __init highbank_timer_init(void)
{
int irq;
@@ -113,6 +123,8 @@ static void __init highbank_timer_init(void)
sp804_clocksource_init(timer_base + 0x20, "timer1");
sp804_clockevents_init(timer_base, irq, "timer0");
+
+ late_time_init = highbank_twd_init;
}
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] 38+ messages in thread
* [PATCH 11/15] ARM: imx6q: convert to twd_local_timer_register() interface
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
` (9 preceding siblings ...)
2012-01-11 13:08 ` [PATCH 10/15] ARM: highbank: " Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-12 9:21 ` Shawn Guo
2012-01-11 13:08 ` [PATCH 12/15] ARM: smp_twd: remove old local timer interface Marc Zyngier
` (3 subsequent siblings)
14 siblings, 1 reply; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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.
Cc: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/mach-imx/Makefile | 1 -
arch/arm/mach-imx/localtimer.c | 35 -----------------------------------
arch/arm/mach-imx/mach-imx6q.c | 11 +++++++++++
3 files changed, 11 insertions(+), 36 deletions(-)
delete mode 100644 arch/arm/mach-imx/localtimer.c
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 88531b6..a633e3f 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -71,7 +71,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
# i.MX5 based machines
obj-$(CONFIG_MACH_MX51_BABBAGE) += mach-mx51_babbage.o
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..5cd916c 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>
@@ -116,9 +117,19 @@ static void __init imx6q_init_irq(void)
of_irq_init(imx6q_irq_match);
}
+#ifdef CONFIG_HAVE_ARM_TWD
+static void __init imx6q_twd_init(void)
+{
+ twd_local_timer_of_register();
+}
+#else
+#define imx6q_twd_init NULL
+#endif
+
static void __init imx6q_timer_init(void)
{
mx6q_clocks_init();
+ late_time_init = imx6q_twd_init;
}
static struct sys_timer imx6q_timer = {
--
1.7.7.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 12/15] ARM: smp_twd: remove old local timer interface
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
` (10 preceding siblings ...)
2012-01-11 13:08 ` [PATCH 11/15] ARM: imx6q: " Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-11 13:08 ` [PATCH 13/15] ARM: local timers: convert exynos to runtime registration interface Marc Zyngier
` (2 subsequent siblings)
14 siblings, 0 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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 e8998c9..085a51d 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 53ddef8..65671bc 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] 38+ messages in thread
* [PATCH 13/15] ARM: local timers: convert exynos to runtime registration interface
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
` (11 preceding siblings ...)
2012-01-11 13:08 ` [PATCH 12/15] ARM: smp_twd: remove old local timer interface Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-11 13:08 ` [PATCH 14/15] ARM: local timers: convert MSM " Marc Zyngier
2012-01-11 13:08 ` [PATCH 15/15] ARM: local timers: make the runtime registration interface mandatory Marc Zyngier
14 siblings, 0 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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..1cf46eb 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 __initdata = {
+ .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] 38+ messages in thread
* [PATCH 14/15] ARM: local timers: convert MSM to runtime registration interface
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
` (12 preceding siblings ...)
2012-01-11 13:08 ` [PATCH 13/15] ARM: local timers: convert exynos to runtime registration interface Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
2012-01-13 0:13 ` David Brown
2012-01-11 13:08 ` [PATCH 15/15] ARM: local timers: make the runtime registration interface mandatory Marc Zyngier
14 siblings, 1 reply; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 UTC (permalink / raw)
To: linux-arm-kernel
Convert the MSM timers to the runtime registration interface.
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: 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..0b13bec 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 __initdata = {
+ .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] 38+ messages in thread
* [PATCH 15/15] ARM: local timers: make the runtime registration interface mandatory
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
` (13 preceding siblings ...)
2012-01-11 13:08 ` [PATCH 14/15] ARM: local timers: convert MSM " Marc Zyngier
@ 2012-01-11 13:08 ` Marc Zyngier
14 siblings, 0 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-11 13:08 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 | 10 ++++++----
2 files changed, 6 insertions(+), 30 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 d36c978..18e7878 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.
@@ -486,7 +488,7 @@ int local_timer_register(struct local_timer_ops *ops)
return 0;
}
-int __attribute__ ((weak)) local_timer_setup(struct clock_event_device *clk)
+static int local_timer_setup(struct clock_event_device *clk)
{
if (lt_ops)
return lt_ops->setup(clk);
@@ -494,13 +496,13 @@ int __attribute__ ((weak)) local_timer_setup(struct clock_event_device *clk)
return -ENXIO;
}
-void __attribute__ ((weak)) local_timer_stop(struct clock_event_device *clk)
+static void 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);
--
1.7.7.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 05/15] ARM: OMAP4: convert to twd_local_timer_register() interface
2012-01-11 13:08 ` [PATCH 05/15] ARM: OMAP4: convert to twd_local_timer_register() interface Marc Zyngier
@ 2012-01-11 13:14 ` Shilimkar, Santosh
0 siblings, 0 replies; 38+ messages in thread
From: Shilimkar, Santosh @ 2012-01-11 13:14 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jan 11, 2012 at 2:08 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
>
> 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>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 04/15] ARM: smp_twd: add device tree support
2012-01-11 13:08 ` [PATCH 04/15] ARM: smp_twd: add device tree support Marc Zyngier
@ 2012-01-11 21:05 ` Rob Herring
2012-01-12 14:36 ` Marc Zyngier
0 siblings, 1 reply; 38+ messages in thread
From: Rob Herring @ 2012-01-11 21:05 UTC (permalink / raw)
To: linux-arm-kernel
On 01/11/2012 07:08 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>
> ---
> Documentation/devicetree/bindings/arm/twd.txt | 29 +++++++++++
> arch/arm/include/asm/smp_twd.h | 1 +
> arch/arm/kernel/smp_twd.c | 68 ++++++++++++++++++++-----
> 3 files changed, 85 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..a9d5587
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/twd.txt
> @@ -0,0 +1,29 @@
> +* 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.
> +
> +Main node required properties:
> +
> +- compatible : Should be one of:
> + "arm,cortex-a9-twd"
> + "arm,cortex-a5-twd"
> + "arm,arm11mp-twd"
> + "arm,smp-twd"
> +
> +- interrupts : Two interrupts to each core, the first one for the
> + timer, the second one for the watchdog.
> +
> +- reg : Specify the base address and the size of the TWD.
> +
> +Example:
> +
> + twd at 2c000600 {
> + compatible = "arm,arm11mp-twd", "arm,smp-twd";
> + reg = <0x2c000600 0x100>;
> + interrupts = <1 13 0xf01 1 14 0xf01>;
> + };
Why not split the watchdog and timer into 2 nodes? It may not matter
since there is no driver for the timer. If there was, we would have a
problem as you can't match 2 drivers to 1 node.
Rob
> diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h
> index 9b6ff85..e8998c9 100644
> --- a/arch/arm/include/asm/smp_twd.h
> +++ b/arch/arm/include/asm/smp_twd.h
> @@ -31,5 +31,6 @@ struct twd_local_timer {
> };
>
> int twd_local_timer_register(struct twd_local_timer *);
> +int twd_local_timer_of_register(void);
>
> #endif
> diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
> index be245c7..53ddef8 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,77 @@ static struct local_timer_ops twd_lt_ops = {
> .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,smp-twd", },
> + { .compatible = "arm,cortex-a9-twd", },
> + { .compatible = "arm,cortex-a5-twd", },
> + { .compatible = "arm,arm11mp-twd", },
> + { },
> +};
> +
> +int __init twd_local_timer_of_register(void)
> +{
> + struct device_node *np;
> +
> + np = of_find_matching_node(NULL, twd_of_match);
> + if (!np)
> + return -ENODEV;
> +
> + twd_ppi = irq_of_parse_and_map(np, 0);
> + if (!twd_ppi)
> + return -EINVAL;
> +
> + twd_base = of_iomap(np, 0);
> + if (!twd_base)
> + return -ENOMEM;
> +
> + return twd_local_timer_common_register();
> +}
> +#endif
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 07/15] ARM: tegra: convert to twd_local_timer_register() interface
2012-01-11 13:08 ` [PATCH 07/15] ARM: tegra: " Marc Zyngier
@ 2012-01-11 21:49 ` Stephen Warren
0 siblings, 0 replies; 38+ messages in thread
From: Stephen Warren @ 2012-01-11 21:49 UTC (permalink / raw)
To: linux-arm-kernel
Marc Zyngier wrote at Wednesday, January 11, 2012 6:09 AM:
> Add support for the new smp_twd runtime registration interface
> to the tegra platforms, and remove the old compile-time support.
> Tested on Harmony.
...
> diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
...
> +#ifdef CONFIG_HAVE_ARM_TWD
> +static struct twd_local_timer twd_local_timer __initdata = {
> + .res = {
> + {
> + .start = TEGRA_ARM_PERIF_BASE + 0x600,
> + .end = TEGRA_ARM_PERIF_BASE + 0x610,
Don't you need to subtract 1 from .end there?
> + .flags = IORESOURCE_MEM,
> + },
--
nvpublic
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 09/15] ARM: ux500: convert to twd_local_timer_register() interface
2012-01-11 13:08 ` [PATCH 09/15] ARM: ux500: " Marc Zyngier
@ 2012-01-11 23:53 ` Linus Walleij
2012-01-12 13:59 ` Marc Zyngier
2012-01-12 9:16 ` Russell King - ARM Linux
1 sibling, 1 reply; 38+ messages in thread
From: Linus Walleij @ 2012-01-11 23:53 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jan 11, 2012 at 2:08 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> Add support for the new smp_twd runtime registration interface
> to the ux500 platforms, and remove the old compile-time support.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Looks good! There will be collisions with the plat-nomadik
timers I sent out yesterday, so I don't know if it makes sense
to bring all timer stuff on a single ARM-SoC branch?
(Or the SoC maintainers rely on git rerere...)
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 06/15] ARM: plat-versatile: convert to twd_local_timer_register() interface
2012-01-11 13:08 ` [PATCH 06/15] ARM: plat-versatile: " Marc Zyngier
@ 2012-01-12 9:14 ` Russell King - ARM Linux
2012-01-12 11:53 ` Marc Zyngier
0 siblings, 1 reply; 38+ messages in thread
From: Russell King - ARM Linux @ 2012-01-12 9:14 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jan 11, 2012 at 01:08:45PM +0000, Marc Zyngier wrote:
> 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 | 34 ++++++++++++++++++++++++++---
> arch/arm/mach-realview/realview_pb11mp.c | 32 ++++++++++++++++++++++++---
> arch/arm/mach-realview/realview_pbx.c | 31 ++++++++++++++++++++++++--
> arch/arm/mach-vexpress/ct-ca9x4.c | 30 +++++++++++++++++++++++--
> arch/arm/plat-versatile/Makefile | 1 -
> arch/arm/plat-versatile/localtimer.c | 27 -----------------------
> 6 files changed, 113 insertions(+), 42 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..6c5e61d 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,34 @@ static void realview_eb11mp_fixup(void)
> realview_eb_isp1761_resources[1].end = IRQ_EB11MP_USB;
> }
>
> +#ifdef CONFIG_HAVE_ARM_TWD
> +static struct twd_local_timer twd_local_timer __initdata = {
> + .res = {
> + {
> + .start = REALVIEW_EB11MP_TWD_BASE,
> + .end = REALVIEW_EB11MP_TWD_BASE + 0xff,
> + .flags = IORESOURCE_MEM,
> + },
DEFINE_RES_MEM() ?
> + {
> + .start = IRQ_LOCALTIMER,
> + .end = IRQ_LOCALTIMER,
> + .flags = IORESOURCE_IRQ,
> + },
DEFINE_RES_IRQ() ?
> + },
> +};
> +
> +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 NULL
> +#endif
> +
> static void __init realview_eb_timer_init(void)
> {
> unsigned int timer_irq;
> @@ -398,9 +426,7 @@ static void __init realview_eb_timer_init(void)
> 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
> + late_time_init = realview_eb_twd_init;
With Nicolas' IO space patches in mainline, is it still necessary to use
late_time_init() ?
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 09/15] ARM: ux500: convert to twd_local_timer_register() interface
2012-01-11 13:08 ` [PATCH 09/15] ARM: ux500: " Marc Zyngier
2012-01-11 23:53 ` Linus Walleij
@ 2012-01-12 9:16 ` Russell King - ARM Linux
2012-01-12 10:55 ` Marc Zyngier
1 sibling, 1 reply; 38+ messages in thread
From: Russell King - ARM Linux @ 2012-01-12 9:16 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jan 11, 2012 at 01:08:48PM +0000, Marc Zyngier wrote:
> +static void __init ux500_twd_set_base(unsigned long base)
> +{
> + twd_local_timer.res[0].start = base;
> + twd_local_timer.res[0].end = base + 0x10;
Does this local timer really occupy 0x11 bytes?
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 08/15] ARM: shmobile: convert to twd_local_timer_register() interface
2012-01-11 13:08 ` [PATCH 08/15] ARM: shmobile: " Marc Zyngier
@ 2012-01-12 9:19 ` Russell King - ARM Linux
2012-01-12 11:24 ` Marc Zyngier
0 siblings, 1 reply; 38+ messages in thread
From: Russell King - ARM Linux @ 2012-01-12 9:19 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jan 11, 2012 at 01:08:47PM +0000, Marc Zyngier wrote:
> static void __init shmobile_late_time_init(void)
> {
> /*
> @@ -34,6 +37,8 @@ static void __init shmobile_late_time_init(void)
> */
> early_platform_driver_register_all("earlytimer");
> early_platform_driver_probe("earlytimer", 2, 0);
> + if (local_timer_hook)
> + local_timer_hook();
This is why late_timer_init() should be avoided at all cost - you can
only have one of them and once you've used it once, you need to invent
new hooks to hook other stuff into there.
In any case, I don't think this is necessary for TWD as ioremap should
be available for regions which have already been statically mapped now
that Nicolas' patches are in mainline.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 11/15] ARM: imx6q: convert to twd_local_timer_register() interface
2012-01-11 13:08 ` [PATCH 11/15] ARM: imx6q: " Marc Zyngier
@ 2012-01-12 9:21 ` Shawn Guo
0 siblings, 0 replies; 38+ messages in thread
From: Shawn Guo @ 2012-01-12 9:21 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jan 11, 2012 at 01:08:50PM +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.
>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Tested on imx6q.
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Regards,
Shawn
> ---
> arch/arm/mach-imx/Makefile | 1 -
> arch/arm/mach-imx/localtimer.c | 35 -----------------------------------
> arch/arm/mach-imx/mach-imx6q.c | 11 +++++++++++
> 3 files changed, 11 insertions(+), 36 deletions(-)
> delete mode 100644 arch/arm/mach-imx/localtimer.c
>
> diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
> index 88531b6..a633e3f 100644
> --- a/arch/arm/mach-imx/Makefile
> +++ b/arch/arm/mach-imx/Makefile
> @@ -71,7 +71,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
>
> # i.MX5 based machines
> obj-$(CONFIG_MACH_MX51_BABBAGE) += mach-mx51_babbage.o
> 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..5cd916c 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>
> @@ -116,9 +117,19 @@ static void __init imx6q_init_irq(void)
> of_irq_init(imx6q_irq_match);
> }
>
> +#ifdef CONFIG_HAVE_ARM_TWD
> +static void __init imx6q_twd_init(void)
> +{
> + twd_local_timer_of_register();
> +}
> +#else
> +#define imx6q_twd_init NULL
> +#endif
> +
> static void __init imx6q_timer_init(void)
> {
> mx6q_clocks_init();
> + late_time_init = imx6q_twd_init;
> }
>
> static struct sys_timer imx6q_timer = {
> --
> 1.7.7.1
>
>
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 09/15] ARM: ux500: convert to twd_local_timer_register() interface
2012-01-12 9:16 ` Russell King - ARM Linux
@ 2012-01-12 10:55 ` Marc Zyngier
0 siblings, 0 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-12 10:55 UTC (permalink / raw)
To: linux-arm-kernel
On 12/01/12 09:16, Russell King - ARM Linux wrote:
> On Wed, Jan 11, 2012 at 01:08:48PM +0000, Marc Zyngier wrote:
>> +static void __init ux500_twd_set_base(unsigned long base)
>> +{
>> + twd_local_timer.res[0].start = base;
>> + twd_local_timer.res[0].end = base + 0x10;
>
> Does this local timer really occupy 0x11 bytes?
Good point, will fix.
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 08/15] ARM: shmobile: convert to twd_local_timer_register() interface
2012-01-12 9:19 ` Russell King - ARM Linux
@ 2012-01-12 11:24 ` Marc Zyngier
2012-01-12 12:00 ` Marc Zyngier
0 siblings, 1 reply; 38+ messages in thread
From: Marc Zyngier @ 2012-01-12 11:24 UTC (permalink / raw)
To: linux-arm-kernel
On 12/01/12 09:19, Russell King - ARM Linux wrote:
> On Wed, Jan 11, 2012 at 01:08:47PM +0000, Marc Zyngier wrote:
>> static void __init shmobile_late_time_init(void)
>> {
>> /*
>> @@ -34,6 +37,8 @@ static void __init shmobile_late_time_init(void)
>> */
>> early_platform_driver_register_all("earlytimer");
>> early_platform_driver_probe("earlytimer", 2, 0);
>> + if (local_timer_hook)
>> + local_timer_hook();
>
> This is why late_timer_init() should be avoided at all cost - you can
> only have one of them and once you've used it once, you need to invent
> new hooks to hook other stuff into there.
>
> In any case, I don't think this is necessary for TWD as ioremap should
> be available for regions which have already been statically mapped now
> that Nicolas' patches are in mainline.
Indeed, it should work now, and I'll remove the use of late_time_init.
shmobile has another problem though: it doesn't have the smp_twd clock,
which means we have to rely on calibration, and this will only work if
the global timer is already up and running (hence the ugly hook).
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 06/15] ARM: plat-versatile: convert to twd_local_timer_register() interface
2012-01-12 9:14 ` Russell King - ARM Linux
@ 2012-01-12 11:53 ` Marc Zyngier
0 siblings, 0 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-12 11:53 UTC (permalink / raw)
To: linux-arm-kernel
On 12/01/12 09:14, Russell King - ARM Linux wrote:
> On Wed, Jan 11, 2012 at 01:08:45PM +0000, Marc Zyngier wrote:
>> 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 | 34 ++++++++++++++++++++++++++---
>> arch/arm/mach-realview/realview_pb11mp.c | 32 ++++++++++++++++++++++++---
>> arch/arm/mach-realview/realview_pbx.c | 31 ++++++++++++++++++++++++--
>> arch/arm/mach-vexpress/ct-ca9x4.c | 30 +++++++++++++++++++++++--
>> arch/arm/plat-versatile/Makefile | 1 -
>> arch/arm/plat-versatile/localtimer.c | 27 -----------------------
>> 6 files changed, 113 insertions(+), 42 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..6c5e61d 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,34 @@ static void realview_eb11mp_fixup(void)
>> realview_eb_isp1761_resources[1].end = IRQ_EB11MP_USB;
>> }
>>
>> +#ifdef CONFIG_HAVE_ARM_TWD
>> +static struct twd_local_timer twd_local_timer __initdata = {
>> + .res = {
>> + {
>> + .start = REALVIEW_EB11MP_TWD_BASE,
>> + .end = REALVIEW_EB11MP_TWD_BASE + 0xff,
>> + .flags = IORESOURCE_MEM,
>> + },
>
> DEFINE_RES_MEM() ?
>
>> + {
>> + .start = IRQ_LOCALTIMER,
>> + .end = IRQ_LOCALTIMER,
>> + .flags = IORESOURCE_IRQ,
>> + },
>
> DEFINE_RES_IRQ() ?
Indeed. Actually, I'd like to have the following in smp_twd.h:
#define DEFINE_TWD_LOCAL_TIMER(name,base,irq) \
struct twd_local_timer name __initdata = { \
.res = { \
DEFINE_RES_MEM(base, 0x10), \
DEFINE_RES_IRQ(irq), \
}, \
};
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 08/15] ARM: shmobile: convert to twd_local_timer_register() interface
2012-01-12 11:24 ` Marc Zyngier
@ 2012-01-12 12:00 ` Marc Zyngier
0 siblings, 0 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-12 12:00 UTC (permalink / raw)
To: linux-arm-kernel
On 12/01/12 11:24, Marc Zyngier wrote:
> On 12/01/12 09:19, Russell King - ARM Linux wrote:
>> On Wed, Jan 11, 2012 at 01:08:47PM +0000, Marc Zyngier wrote:
>>> static void __init shmobile_late_time_init(void)
>>> {
>>> /*
>>> @@ -34,6 +37,8 @@ static void __init shmobile_late_time_init(void)
>>> */
>>> early_platform_driver_register_all("earlytimer");
>>> early_platform_driver_probe("earlytimer", 2, 0);
>>> + if (local_timer_hook)
>>> + local_timer_hook();
>>
>> This is why late_timer_init() should be avoided at all cost - you can
>> only have one of them and once you've used it once, you need to invent
>> new hooks to hook other stuff into there.
>>
>> In any case, I don't think this is necessary for TWD as ioremap should
>> be available for regions which have already been statically mapped now
>> that Nicolas' patches are in mainline.
>
> Indeed, it should work now, and I'll remove the use of late_time_init.
>
> shmobile has another problem though: it doesn't have the smp_twd clock,
> which means we have to rely on calibration, and this will only work if
> the global timer is already up and running (hence the ugly hook).
Actually, it should work just fine without the hook. The global timer
will be running by the time we call local_timer_setup(), so the hook can go.
I'll post an updated patch series later.
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 09/15] ARM: ux500: convert to twd_local_timer_register() interface
2012-01-11 23:53 ` Linus Walleij
@ 2012-01-12 13:59 ` Marc Zyngier
2012-01-14 11:43 ` Linus Walleij
0 siblings, 1 reply; 38+ messages in thread
From: Marc Zyngier @ 2012-01-12 13:59 UTC (permalink / raw)
To: linux-arm-kernel
On 11/01/12 23:53, Linus Walleij wrote:
> On Wed, Jan 11, 2012 at 2:08 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
>
>> Add support for the new smp_twd runtime registration interface
>> to the ux500 platforms, and remove the old compile-time support.
>>
>> Cc: Linus Walleij <linus.walleij@linaro.org>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>
> Looks good! There will be collisions with the plat-nomadik
> timers I sent out yesterday, so I don't know if it makes sense
> to bring all timer stuff on a single ARM-SoC branch?
> (Or the SoC maintainers rely on git rerere...)
I guess I could collect all timer patches in a single branch if that's
helpful to anyone.
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
Thanks Linus!
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 04/15] ARM: smp_twd: add device tree support
2012-01-11 21:05 ` Rob Herring
@ 2012-01-12 14:36 ` Marc Zyngier
2012-01-12 15:42 ` Rob Herring
0 siblings, 1 reply; 38+ messages in thread
From: Marc Zyngier @ 2012-01-12 14:36 UTC (permalink / raw)
To: linux-arm-kernel
Hi Rob,
On 11/01/12 21:05, Rob Herring wrote:
> On 01/11/2012 07:08 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>
>> ---
>> Documentation/devicetree/bindings/arm/twd.txt | 29 +++++++++++
>> arch/arm/include/asm/smp_twd.h | 1 +
>> arch/arm/kernel/smp_twd.c | 68 ++++++++++++++++++++-----
>> 3 files changed, 85 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..a9d5587
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/arm/twd.txt
>> @@ -0,0 +1,29 @@
>> +* 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.
>> +
>> +Main node required properties:
>> +
>> +- compatible : Should be one of:
>> + "arm,cortex-a9-twd"
>> + "arm,cortex-a5-twd"
>> + "arm,arm11mp-twd"
>> + "arm,smp-twd"
>> +
>> +- interrupts : Two interrupts to each core, the first one for the
>> + timer, the second one for the watchdog.
>> +
>> +- reg : Specify the base address and the size of the TWD.
>> +
>> +Example:
>> +
>> + twd at 2c000600 {
>> + compatible = "arm,arm11mp-twd", "arm,smp-twd";
>> + reg = <0x2c000600 0x100>;
>> + interrupts = <1 13 0xf01 1 14 0xf01>;
>> + };
>
> Why not split the watchdog and timer into 2 nodes? It may not matter
> since there is no driver for the timer. If there was, we would have a
> problem as you can't match 2 drivers to 1 node.
Don't we hit the opposite problem - two nodes with the same address?
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 04/15] ARM: smp_twd: add device tree support
2012-01-12 14:36 ` Marc Zyngier
@ 2012-01-12 15:42 ` Rob Herring
2012-01-12 16:00 ` Marc Zyngier
0 siblings, 1 reply; 38+ messages in thread
From: Rob Herring @ 2012-01-12 15:42 UTC (permalink / raw)
To: linux-arm-kernel
On 01/12/2012 08:36 AM, Marc Zyngier wrote:
> Hi Rob,
>
> On 11/01/12 21:05, Rob Herring wrote:
>> On 01/11/2012 07:08 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>
>>> ---
>>> Documentation/devicetree/bindings/arm/twd.txt | 29 +++++++++++
>>> arch/arm/include/asm/smp_twd.h | 1 +
>>> arch/arm/kernel/smp_twd.c | 68 ++++++++++++++++++++-----
>>> 3 files changed, 85 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..a9d5587
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/arm/twd.txt
>>> @@ -0,0 +1,29 @@
>>> +* 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.
>>> +
>>> +Main node required properties:
>>> +
>>> +- compatible : Should be one of:
>>> + "arm,cortex-a9-twd"
>>> + "arm,cortex-a5-twd"
>>> + "arm,arm11mp-twd"
>>> + "arm,smp-twd"
>>> +
>>> +- interrupts : Two interrupts to each core, the first one for the
>>> + timer, the second one for the watchdog.
>>> +
>>> +- reg : Specify the base address and the size of the TWD.
>>> +
>>> +Example:
>>> +
>>> + twd at 2c000600 {
>>> + compatible = "arm,arm11mp-twd", "arm,smp-twd";
>>> + reg = <0x2c000600 0x100>;
>>> + interrupts = <1 13 0xf01 1 14 0xf01>;
>>> + };
>>
>> Why not split the watchdog and timer into 2 nodes? It may not matter
>> since there is no driver for the timer. If there was, we would have a
>> problem as you can't match 2 drivers to 1 node.
>
> Don't we hit the opposite problem - two nodes with the same address?
No, because the timer is at 0x600-0x61f and the watchdog is at
0x620-0x63f. There's no DT requirement on address range start or size.
However, the current watchdog driver includes 0x20 in its register
offsets, so changing the base address would require a change to the
driver (but that shouldn't really influence the decision).
Rob
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 04/15] ARM: smp_twd: add device tree support
2012-01-12 15:42 ` Rob Herring
@ 2012-01-12 16:00 ` Marc Zyngier
2012-01-12 16:27 ` Rob Herring
0 siblings, 1 reply; 38+ messages in thread
From: Marc Zyngier @ 2012-01-12 16:00 UTC (permalink / raw)
To: linux-arm-kernel
On 12/01/12 15:42, Rob Herring wrote:
> On 01/12/2012 08:36 AM, Marc Zyngier wrote:
>> Hi Rob,
>>
>> On 11/01/12 21:05, Rob Herring wrote:
>>> On 01/11/2012 07:08 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>
>>>> ---
>>>> Documentation/devicetree/bindings/arm/twd.txt | 29 +++++++++++
>>>> arch/arm/include/asm/smp_twd.h | 1 +
>>>> arch/arm/kernel/smp_twd.c | 68 ++++++++++++++++++++-----
>>>> 3 files changed, 85 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..a9d5587
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/arm/twd.txt
>>>> @@ -0,0 +1,29 @@
>>>> +* 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.
>>>> +
>>>> +Main node required properties:
>>>> +
>>>> +- compatible : Should be one of:
>>>> + "arm,cortex-a9-twd"
>>>> + "arm,cortex-a5-twd"
>>>> + "arm,arm11mp-twd"
>>>> + "arm,smp-twd"
>>>> +
>>>> +- interrupts : Two interrupts to each core, the first one for the
>>>> + timer, the second one for the watchdog.
>>>> +
>>>> +- reg : Specify the base address and the size of the TWD.
>>>> +
>>>> +Example:
>>>> +
>>>> + twd at 2c000600 {
>>>> + compatible = "arm,arm11mp-twd", "arm,smp-twd";
>>>> + reg = <0x2c000600 0x100>;
>>>> + interrupts = <1 13 0xf01 1 14 0xf01>;
>>>> + };
>>>
>>> Why not split the watchdog and timer into 2 nodes? It may not matter
>>> since there is no driver for the timer. If there was, we would have a
>>> problem as you can't match 2 drivers to 1 node.
>>
>> Don't we hit the opposite problem - two nodes with the same address?
>
> No, because the timer is at 0x600-0x61f and the watchdog is at
> 0x620-0x63f. There's no DT requirement on address range start or size.
>
> However, the current watchdog driver includes 0x20 in its register
> offsets, so changing the base address would require a change to the
> driver (but that shouldn't really influence the decision).
Well, that's what triggered my question. On the other hand, I do not see
any in-tree user of the mpcore_wdt driver, so I suppose we could change
this register offset without too much harm.
How about something like:
twd-timer at 2c000600 {
compatible = "arm,arm11mp-twd", "arm,smp-twd";
reg = <0x2c000600 0x20>;
interrupts = <1 13 0xf01>;
};
twd-watchdog at 2c000620 {
compatible = "arm,arm11mp-wd", "arm,smp-wd";
reg = <0x2c000620 0x20>;
interrupts = <1 14 0xf01>;
};
I'm not sure about the compatible strings for the watchdog though. Any
better idea?
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 04/15] ARM: smp_twd: add device tree support
2012-01-12 16:00 ` Marc Zyngier
@ 2012-01-12 16:27 ` Rob Herring
2012-01-12 17:58 ` Marc Zyngier
0 siblings, 1 reply; 38+ messages in thread
From: Rob Herring @ 2012-01-12 16:27 UTC (permalink / raw)
To: linux-arm-kernel
Adding devicetree-discuss since we are talking bindings...
On 01/12/2012 10:00 AM, Marc Zyngier wrote:
> On 12/01/12 15:42, Rob Herring wrote:
>> On 01/12/2012 08:36 AM, Marc Zyngier wrote:
>>> Hi Rob,
>>>
>>> On 11/01/12 21:05, Rob Herring wrote:
>>>> On 01/11/2012 07:08 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>
>>>>> ---
>>>>> Documentation/devicetree/bindings/arm/twd.txt | 29 +++++++++++
>>>>> arch/arm/include/asm/smp_twd.h | 1 +
>>>>> arch/arm/kernel/smp_twd.c | 68 ++++++++++++++++++++-----
>>>>> 3 files changed, 85 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..a9d5587
>>>>> --- /dev/null
>>>>> +++ b/Documentation/devicetree/bindings/arm/twd.txt
>>>>> @@ -0,0 +1,29 @@
>>>>> +* 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.
>>>>> +
>>>>> +Main node required properties:
>>>>> +
>>>>> +- compatible : Should be one of:
>>>>> + "arm,cortex-a9-twd"
>>>>> + "arm,cortex-a5-twd"
>>>>> + "arm,arm11mp-twd"
>>>>> + "arm,smp-twd"
>>>>> +
>>>>> +- interrupts : Two interrupts to each core, the first one for the
>>>>> + timer, the second one for the watchdog.
>>>>> +
>>>>> +- reg : Specify the base address and the size of the TWD.
>>>>> +
>>>>> +Example:
>>>>> +
>>>>> + twd at 2c000600 {
>>>>> + compatible = "arm,arm11mp-twd", "arm,smp-twd";
>>>>> + reg = <0x2c000600 0x100>;
>>>>> + interrupts = <1 13 0xf01 1 14 0xf01>;
>>>>> + };
>>>>
>>>> Why not split the watchdog and timer into 2 nodes? It may not matter
>>>> since there is no driver for the timer. If there was, we would have a
>>>> problem as you can't match 2 drivers to 1 node.
>>>
>>> Don't we hit the opposite problem - two nodes with the same address?
>>
>> No, because the timer is at 0x600-0x61f and the watchdog is at
>> 0x620-0x63f. There's no DT requirement on address range start or size.
>>
>> However, the current watchdog driver includes 0x20 in its register
>> offsets, so changing the base address would require a change to the
>> driver (but that shouldn't really influence the decision).
>
> Well, that's what triggered my question. On the other hand, I do not see
> any in-tree user of the mpcore_wdt driver, so I suppose we could change
> this register offset without too much harm.
>
> How about something like:
>
> twd-timer at 2c000600 {
> compatible = "arm,arm11mp-twd", "arm,smp-twd";
> reg = <0x2c000600 0x20>;
> interrupts = <1 13 0xf01>;
> };
>
> twd-watchdog at 2c000620 {
> compatible = "arm,arm11mp-wd", "arm,smp-wd";
> reg = <0x2c000620 0x20>;
> interrupts = <1 14 0xf01>;
BTW, are these really edge triggered?
> };
>
> I'm not sure about the compatible strings for the watchdog though. Any
> better idea?
Some reason I did arm,smp-twd and arm-cortex-a9-wdt for highbank.dts
which wasn't very consistent.
How about *-twd-timer and *-twd-wdt?
Probably we should drop the generic "arm-smp-*" versions.
Rob
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 04/15] ARM: smp_twd: add device tree support
2012-01-12 16:27 ` Rob Herring
@ 2012-01-12 17:58 ` Marc Zyngier
0 siblings, 0 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-12 17:58 UTC (permalink / raw)
To: linux-arm-kernel
On 12/01/12 16:27, Rob Herring wrote:
> Adding devicetree-discuss since we are talking bindings...
>
> On 01/12/2012 10:00 AM, Marc Zyngier wrote:
>> On 12/01/12 15:42, Rob Herring wrote:
>>> On 01/12/2012 08:36 AM, Marc Zyngier wrote:
>>>> Hi Rob,
>>>>
>>>> On 11/01/12 21:05, Rob Herring wrote:
>>>>> On 01/11/2012 07:08 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>
>>>>>> ---
>>>>>> Documentation/devicetree/bindings/arm/twd.txt | 29 +++++++++++
>>>>>> arch/arm/include/asm/smp_twd.h | 1 +
>>>>>> arch/arm/kernel/smp_twd.c | 68 ++++++++++++++++++++-----
>>>>>> 3 files changed, 85 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..a9d5587
>>>>>> --- /dev/null
>>>>>> +++ b/Documentation/devicetree/bindings/arm/twd.txt
>>>>>> @@ -0,0 +1,29 @@
>>>>>> +* 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.
>>>>>> +
>>>>>> +Main node required properties:
>>>>>> +
>>>>>> +- compatible : Should be one of:
>>>>>> + "arm,cortex-a9-twd"
>>>>>> + "arm,cortex-a5-twd"
>>>>>> + "arm,arm11mp-twd"
>>>>>> + "arm,smp-twd"
>>>>>> +
>>>>>> +- interrupts : Two interrupts to each core, the first one for the
>>>>>> + timer, the second one for the watchdog.
>>>>>> +
>>>>>> +- reg : Specify the base address and the size of the TWD.
>>>>>> +
>>>>>> +Example:
>>>>>> +
>>>>>> + twd at 2c000600 {
>>>>>> + compatible = "arm,arm11mp-twd", "arm,smp-twd";
>>>>>> + reg = <0x2c000600 0x100>;
>>>>>> + interrupts = <1 13 0xf01 1 14 0xf01>;
>>>>>> + };
>>>>>
>>>>> Why not split the watchdog and timer into 2 nodes? It may not matter
>>>>> since there is no driver for the timer. If there was, we would have a
>>>>> problem as you can't match 2 drivers to 1 node.
>>>>
>>>> Don't we hit the opposite problem - two nodes with the same address?
>>>
>>> No, because the timer is at 0x600-0x61f and the watchdog is at
>>> 0x620-0x63f. There's no DT requirement on address range start or size.
>>>
>>> However, the current watchdog driver includes 0x20 in its register
>>> offsets, so changing the base address would require a change to the
>>> driver (but that shouldn't really influence the decision).
>>
>> Well, that's what triggered my question. On the other hand, I do not see
>> any in-tree user of the mpcore_wdt driver, so I suppose we could change
>> this register offset without too much harm.
>>
>> How about something like:
>>
>> twd-timer at 2c000600 {
>> compatible = "arm,arm11mp-twd", "arm,smp-twd";
>> reg = <0x2c000600 0x20>;
>> interrupts = <1 13 0xf01>;
>> };
>>
>> twd-watchdog at 2c000620 {
>> compatible = "arm,arm11mp-wd", "arm,smp-wd";
>> reg = <0x2c000620 0x20>;
>> interrupts = <1 14 0xf01>;
>
> BTW, are these really edge triggered?
Yes (on the 11MPcore):
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/CCHFHDJH.html
Other cores may be configured differently (A9 has some PPIs configured
as level-low, and others configured edge-rising):
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0407g/CCHEIGIC.html
All that is probably very SoC specific anyway.
>
>> };
>>
>> I'm not sure about the compatible strings for the watchdog though. Any
>> better idea?
>
> Some reason I did arm,smp-twd and arm-cortex-a9-wdt for highbank.dts
> which wasn't very consistent.
>
> How about *-twd-timer and *-twd-wdt?
Fine by me.
> Probably we should drop the generic "arm-smp-*" versions.
Agreed. I'll respin this patch series and add the necessary updates to
the affected platforms' DTS.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 14/15] ARM: local timers: convert MSM to runtime registration interface
2012-01-11 13:08 ` [PATCH 14/15] ARM: local timers: convert MSM " Marc Zyngier
@ 2012-01-13 0:13 ` David Brown
2012-01-13 0:27 ` David Brown
0 siblings, 1 reply; 38+ messages in thread
From: David Brown @ 2012-01-13 0:13 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jan 11, 2012 at 01:08:53PM +0000, Marc Zyngier wrote:
> Convert the MSM timers to the runtime registration interface.
>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: 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(-)
This change breaks cpuhotplug. I get a lockup if I try to shutdown
cpu 1. I'll see if I can figure out why.
David
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 14/15] ARM: local timers: convert MSM to runtime registration interface
2012-01-13 0:13 ` David Brown
@ 2012-01-13 0:27 ` David Brown
2012-01-13 10:11 ` Marc Zyngier
0 siblings, 1 reply; 38+ messages in thread
From: David Brown @ 2012-01-13 0:27 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jan 12, 2012 at 04:13:34PM -0800, David Brown wrote:
> On Wed, Jan 11, 2012 at 01:08:53PM +0000, Marc Zyngier wrote:
> > Convert the MSM timers to the runtime registration interface.
> >
> > Cc: Stephen Boyd <sboyd@codeaurora.org>
> > Cc: 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(-)
>
> This change breaks cpuhotplug. I get a lockup if I try to shutdown
> cpu 1. I'll see if I can figure out why.
This may be a false alarm. I am not able to reproduce this failure,
and have reset and brought the CPU1 on and offline multiple times.
So, in light of this:
Tested-by: David Brown <davidb@codeaurora.org>
Acked-by: David Brown <davidb@codeaurora.org>
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 14/15] ARM: local timers: convert MSM to runtime registration interface
2012-01-13 0:27 ` David Brown
@ 2012-01-13 10:11 ` Marc Zyngier
0 siblings, 0 replies; 38+ messages in thread
From: Marc Zyngier @ 2012-01-13 10:11 UTC (permalink / raw)
To: linux-arm-kernel
On 13/01/12 00:27, David Brown wrote:
> On Thu, Jan 12, 2012 at 04:13:34PM -0800, David Brown wrote:
>> On Wed, Jan 11, 2012 at 01:08:53PM +0000, Marc Zyngier wrote:
>>> Convert the MSM timers to the runtime registration interface.
>>>
>>> Cc: Stephen Boyd <sboyd@codeaurora.org>
>>> Cc: 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(-)
>>
>> This change breaks cpuhotplug. I get a lockup if I try to shutdown
>> cpu 1. I'll see if I can figure out why.
>
> This may be a false alarm. I am not able to reproduce this failure,
> and have reset and brought the CPU1 on and offline multiple times.
>
> So, in light of this:
>
> Tested-by: David Brown <davidb@codeaurora.org>
> Acked-by: David Brown <davidb@codeaurora.org>
Thanks David.
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 09/15] ARM: ux500: convert to twd_local_timer_register() interface
2012-01-12 13:59 ` Marc Zyngier
@ 2012-01-14 11:43 ` Linus Walleij
0 siblings, 0 replies; 38+ messages in thread
From: Linus Walleij @ 2012-01-14 11:43 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jan 12, 2012 at 2:59 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> On 11/01/12 23:53, Linus Walleij wrote:
>> On Wed, Jan 11, 2012 at 2:08 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
>>
>>> Add support for the new smp_twd runtime registration interface
>>> to the ux500 platforms, and remove the old compile-time support.
>>>
>>> Cc: Linus Walleij <linus.walleij@linaro.org>
>>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>>
>> Looks good! There will be collisions with the plat-nomadik
>> timers I sent out yesterday, so I don't know if it makes sense
>> to bring all timer stuff on a single ARM-SoC branch?
>> (Or the SoC maintainers rely on git rerere...)
>
> I guess I could collect all timer patches in a single branch if that's
> helpful to anyone.
I was more thinking along the lines of doing timer consolidation
on a single branch in ARM-SoC, so I'll include a note on that
when I ask Arnd+Olof to pull my changes, and let them decide.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2012-01-14 11:43 UTC | newest]
Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11 13:08 [PATCH 00/15] Runtime registration for local timers Marc Zyngier
2012-01-11 13:08 ` [PATCH 01/15] ARM: smp_twd: make local_timer_stop a symbol instead of a #define Marc Zyngier
2012-01-11 13:08 ` [PATCH 02/15] ARM: local timers: introduce a new registration interface Marc Zyngier
2012-01-11 13:08 ` [PATCH 03/15] ARM: smp_twd: add runtime registration support Marc Zyngier
2012-01-11 13:08 ` [PATCH 04/15] ARM: smp_twd: add device tree support Marc Zyngier
2012-01-11 21:05 ` Rob Herring
2012-01-12 14:36 ` Marc Zyngier
2012-01-12 15:42 ` Rob Herring
2012-01-12 16:00 ` Marc Zyngier
2012-01-12 16:27 ` Rob Herring
2012-01-12 17:58 ` Marc Zyngier
2012-01-11 13:08 ` [PATCH 05/15] ARM: OMAP4: convert to twd_local_timer_register() interface Marc Zyngier
2012-01-11 13:14 ` Shilimkar, Santosh
2012-01-11 13:08 ` [PATCH 06/15] ARM: plat-versatile: " Marc Zyngier
2012-01-12 9:14 ` Russell King - ARM Linux
2012-01-12 11:53 ` Marc Zyngier
2012-01-11 13:08 ` [PATCH 07/15] ARM: tegra: " Marc Zyngier
2012-01-11 21:49 ` Stephen Warren
2012-01-11 13:08 ` [PATCH 08/15] ARM: shmobile: " Marc Zyngier
2012-01-12 9:19 ` Russell King - ARM Linux
2012-01-12 11:24 ` Marc Zyngier
2012-01-12 12:00 ` Marc Zyngier
2012-01-11 13:08 ` [PATCH 09/15] ARM: ux500: " Marc Zyngier
2012-01-11 23:53 ` Linus Walleij
2012-01-12 13:59 ` Marc Zyngier
2012-01-14 11:43 ` Linus Walleij
2012-01-12 9:16 ` Russell King - ARM Linux
2012-01-12 10:55 ` Marc Zyngier
2012-01-11 13:08 ` [PATCH 10/15] ARM: highbank: " Marc Zyngier
2012-01-11 13:08 ` [PATCH 11/15] ARM: imx6q: " Marc Zyngier
2012-01-12 9:21 ` Shawn Guo
2012-01-11 13:08 ` [PATCH 12/15] ARM: smp_twd: remove old local timer interface Marc Zyngier
2012-01-11 13:08 ` [PATCH 13/15] ARM: local timers: convert exynos to runtime registration interface Marc Zyngier
2012-01-11 13:08 ` [PATCH 14/15] ARM: local timers: convert MSM " Marc Zyngier
2012-01-13 0:13 ` David Brown
2012-01-13 0:27 ` David Brown
2012-01-13 10:11 ` Marc Zyngier
2012-01-11 13:08 ` [PATCH 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).