linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource: arm_global_timer: Allow DT to specify already reset timer counter
@ 2015-11-25  5:24 Jassi Brar
  2015-12-15 18:02 ` Daniel Lezcano
  2015-12-15 18:14 ` Mark Rutland
  0 siblings, 2 replies; 12+ messages in thread
From: Jassi Brar @ 2015-11-25  5:24 UTC (permalink / raw)
  To: linux-arm-kernel

The GT counter is common to every core in a cluster. There is a usecase
when Linux is spawned by a 'master' firmware/OS running on some core of
the same cluster and the GT is used by the both.
 Linux, upon boot, resetting the GT counter is obviously fatal to the
other OS. So provide a way for DT to tell Linux if it's running in that
'slave' mode and must not reset the counter.

Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
---
 Documentation/devicetree/bindings/arm/global_timer.txt |  6 ++++++
 drivers/clocksource/arm_global_timer.c                 | 12 +++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/global_timer.txt b/Documentation/devicetree/bindings/arm/global_timer.txt
index bdae3a8..bb897a9 100644
--- a/Documentation/devicetree/bindings/arm/global_timer.txt
+++ b/Documentation/devicetree/bindings/arm/global_timer.txt
@@ -17,6 +17,12 @@
 
 - clocks : Should be phandle to a clock.
 
+
+** Optional properties:
+
+- arm,gt_no_reset : Firmware/bootloader already initialized the
+	global timer-counter and expects it to be not reset again.
+
 Example:
 
 	timer at 2c000600 {
diff --git a/drivers/clocksource/arm_global_timer.c b/drivers/clocksource/arm_global_timer.c
index a2cb6fa..952bab6 100644
--- a/drivers/clocksource/arm_global_timer.c
+++ b/drivers/clocksource/arm_global_timer.c
@@ -51,6 +51,7 @@ static void __iomem *gt_base;
 static unsigned long gt_clk_rate;
 static int gt_ppi;
 static struct clock_event_device __percpu *gt_evt;
+static bool gt_reset_counter;
 
 /*
  * To get the value from the Global Timer Counter register proceed as follows:
@@ -212,9 +213,11 @@ static u64 notrace gt_sched_clock_read(void)
 
 static void __init gt_clocksource_init(void)
 {
-	writel(0, gt_base + GT_CONTROL);
-	writel(0, gt_base + GT_COUNTER0);
-	writel(0, gt_base + GT_COUNTER1);
+	if (gt_reset_counter) {
+		writel(0, gt_base + GT_CONTROL);
+		writel(0, gt_base + GT_COUNTER0);
+		writel(0, gt_base + GT_COUNTER1);
+	}
 	/* enables timer on all the cores */
 	writel(GT_CONTROL_TIMER_ENABLE, gt_base + GT_CONTROL);
 
@@ -303,6 +306,9 @@ static void __init global_timer_of_register(struct device_node *np)
 		goto out_irq;
 	}
 
+	/* See if we are told we can't reset the global timer counter */
+	gt_reset_counter = !of_property_read_bool(np, "arm,gt_no_reset");
+
 	/* Immediately configure the timer on the boot CPU */
 	gt_clocksource_init();
 	gt_clockevents_init(this_cpu_ptr(gt_evt));
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-12-17 11:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-25  5:24 [PATCH] clocksource: arm_global_timer: Allow DT to specify already reset timer counter Jassi Brar
2015-12-15 18:02 ` Daniel Lezcano
2015-12-16  4:11   ` Jassi Brar
2015-12-16  6:59     ` Daniel Lezcano
2015-12-17  9:37       ` Jassi Brar
2015-12-17 10:08         ` Marc Zyngier
2015-12-17 10:29           ` Jassi Brar
2015-12-17 10:16         ` Daniel Lezcano
2015-12-17 10:24           ` Jassi Brar
2015-12-17 11:02           ` Mark Rutland
2015-12-15 18:14 ` Mark Rutland
2015-12-16  4:17   ` Jassi Brar

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).