mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans Ulli Kroll <ulli.kroll@googlemail.com>
To: linux-kernel@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
	linux-arm-kernel@lists.infradead.org,
	Hans Ulli Kroll <ulli.kroll@googlemail.com>
Subject: [PATCH 6/6] ARM:Gemini:add timer3 as sched_clock_source
Date: Sat,  6 Jun 2015 05:57:28 +0200	[thread overview]
Message-ID: <1433563048-21922-7-git-send-email-ulli.kroll@googlemail.com> (raw)
In-Reply-To: <1433563048-21922-1-git-send-email-ulli.kroll@googlemail.com>

This patch is based on openwrt patch found in
target/linux/gemini/patches-3.18/160-gemini-timers.patch

It setups a free running timer (timer3) for scheduler clock

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

diff --git a/arch/arm/mach-gemini/time.c b/arch/arm/mach-gemini/time.c
index 29ec2c3..e419dd4 100644
--- a/arch/arm/mach-gemini/time.c
+++ b/arch/arm/mach-gemini/time.c
@@ -15,6 +15,8 @@
 #include <asm/mach/time.h>
 #include <linux/clockchips.h>
 #include <linux/clocksource.h>
+#include <linux/sched_clock.h>
+
 
 /*
  * Register definitions for the timers
@@ -58,6 +60,11 @@
 
 static unsigned int tick_rate;
 
+static u64 notrace gemini_read_sched_clock(void)
+{
+	return readl(TIMER_COUNT(GEMINI_TIMER3_BASE));
+}
+
 static int gemini_timer_set_next_event(unsigned long cycles,
 				       struct clock_event_device *evt)
 {
@@ -196,6 +203,19 @@ void __init gemini_timer_init(void)
 		TIMER_CR);
 
 	/*
+	 * Setup free-running clocksource timer (interrupts
+	 * disabled.)
+	 */
+	writel(0, TIMER_COUNT(GEMINI_TIMER3_BASE));
+	writel(0, TIMER_LOAD(GEMINI_TIMER3_BASE));
+	writel(0, TIMER_MATCH1(GEMINI_TIMER3_BASE));
+	writel(0, TIMER_MATCH2(GEMINI_TIMER3_BASE));
+	clocksource_mmio_init(TIMER_COUNT(GEMINI_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(GEMINI_TIMER1_BASE));
-- 
2.4.2


      parent reply	other threads:[~2015-06-06  3:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-06  3:57 ARM:Gemini:fix/update timer clocksource Hans Ulli Kroll
2015-06-06  3:57 ` [PATCH 1/6] ARM:Gemini:move timer register definitions into the right place Hans Ulli Kroll
2015-06-06  3:57 ` [PATCH 2/6] ARM:Gemini:move IOADDRESS() into #define's Hans Ulli Kroll
2015-06-06  3:57 ` [PATCH 3/6] ARM:Gemini:add missing intr state and mask register Hans Ulli Kroll
2015-06-06  3:57 ` [PATCH 4/6] ARM:Gemini:remove index for timer control register Hans Ulli Kroll
2015-06-06  3:57 ` [PATCH 5/6] ARM:Gemini:use timer 1 as clockevent timer Hans Ulli Kroll
2015-06-06  3:57 ` Hans Ulli Kroll [this message]

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=1433563048-21922-7-git-send-email-ulli.kroll@googlemail.com \
    --to=ulli.kroll@googlemail.com \
    --cc=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®