mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans Ulli Kroll <ulli.kroll@googlemail.com>
To: Olof Johansson <olof@lixom.net>
Cc: arm@kernel.org, linux-kernel@vger.kernel.org,
	Arnd Bergmann <arnd@arndb.de>, Roman Yeryomin <roman@advem.lv>,
	linus.walleij@linaro.org,
	Hans Ulli Kroll <ulli.kroll@googlemail.com>
Subject: [PATCH 3/3] ARM:Gemini:setup timer3 as free running timer
Date: Tue, 11 Aug 2015 22:09:05 +0200	[thread overview]
Message-ID: <1439323745-8542-4-git-send-email-ulli.kroll@googlemail.com> (raw)
In-Reply-To: <1439323745-8542-1-git-send-email-ulli.kroll@googlemail.com>

In the original driver it is missed to setup a free running driver.
This timer is needed for the scheduler.
So setup it.

Signed-off-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>
---
 arch/arm/mach-gemini/time.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-gemini/time.c b/arch/arm/mach-gemini/time.c
index 5e2b1ba..f5f18df 100644
--- a/arch/arm/mach-gemini/time.c
+++ b/arch/arm/mach-gemini/time.c
@@ -15,6 +15,7 @@
 #include <asm/mach/time.h>
 #include <linux/clockchips.h>
 #include <linux/clocksource.h>
+#include <linux/sched_clock.h>
 
 /*
  * Register definitions for the timers
@@ -62,6 +63,11 @@
 
 static unsigned int tick_rate;
 
+static u64 notrace gemini_read_sched_clock(void)
+{
+	return readl(TIMER_COUNT(TIMER3_BASE));
+}
+
 static int gemini_timer_set_next_event(unsigned long cycles,
 				       struct clock_event_device *evt)
 {
@@ -206,8 +212,21 @@ void __init gemini_timer_init(void)
 	writel(TIMER_DEFAULT_FLAGS, TIMER_CR);
 
 	/*
-	 * Setup clockevent timer (interrupt-driven.)
+	 * Setup free-running clocksource timer (interrupts
+	 * disabled.)
 	 */
+	writel(0, TIMER_COUNT(TIMER3_BASE));
+	writel(0, TIMER_LOAD(TIMER3_BASE));
+	writel(0, TIMER_MATCH1(TIMER3_BASE));
+	writel(0, TIMER_MATCH2(TIMER3_BASE));
+	clocksource_mmio_init(TIMER_COUNT(TIMER3_BASE),
+			      "gemini_clocksource", tick_rate,
+			      300, 32, clocksource_mmio_readl_up);
+	sched_clock_register(gemini_read_sched_clock, 32, tick_rate);
+
+	/*
+	 * Setup clockevent timer (interrupt-driven.)
+	*/
 	writel(0, TIMER_COUNT(TIMER1_BASE));
 	writel(0, TIMER_LOAD(TIMER1_BASE));
 	writel(0, TIMER_MATCH1(TIMER1_BASE));
-- 
2.4.6


  parent reply	other threads:[~2015-08-11 20:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07 13:56 ARM:Gemini:clocksource update for 4.3 Hans Ulli Kroll
2015-08-07 13:56 ` [PATCH 1/3] ARM:Gemini:Add missing register definitions for gemini timer Hans Ulli Kroll
2015-08-07 13:56 ` [PATCH 2/3] ARM:Gemini:use timer1 for clockevent Hans Ulli Kroll
2015-08-07 13:56 ` [PATCH 3/3] ARM:Gemini:setup timer3 as free running timer Hans Ulli Kroll
2015-08-11 14:00 ` ARM:Gemini:clocksource update for 4.3 Olof Johansson
2015-08-11 20:09 ` ARM: gemini: clocksource update for 4.3 v2 Hans Ulli Kroll
2015-08-11 20:09   ` [PATCH 1/3] ARM:Gemini:Add missing register definitions for gemini timer Hans Ulli Kroll
2015-08-11 20:09   ` [PATCH 2/3] ARM:Gemini:use timer1 for clockevent Hans Ulli Kroll
2015-08-11 20:09   ` Hans Ulli Kroll [this message]
2015-08-12 12:41   ` ARM: gemini: clocksource update for 4.3 v2 Linus Walleij
2015-08-13  9:42     ` Olof Johansson
2015-08-13  9:42   ` Olof Johansson
2015-08-12 20:36 ` ARM:Gemini:clocksource update for 4.3 Roman Yeryomin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439323745-8542-4-git-send-email-ulli.kroll@googlemail.com \
    --to=ulli.kroll@googlemail.com \
    --cc=arm@kernel.org \
    --cc=arnd@arndb.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=roman@advem.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome