linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislav Meduna <stano@meduna.org>
To: Shawn Guo <shawn.guo@linaro.org>
Cc: "linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: mxs: Setup scheduler clock
Date: Thu, 08 Nov 2012 23:45:45 +0100	[thread overview]
Message-ID: <509C3619.30701@meduna.org> (raw)
In-Reply-To: <20121106134630.GD27643@S2100-06.ap.freescale.net>

[-- Attachment #1: Type: text/plain, Size: 190 bytes --]

Hi,

OK, as the problem with 16-bit fast ticking timer looks to
be more complicated, I'd like to submit the patch for the 32-bit
ones.

Thanks
-- 
                                    Stano


[-- Attachment #2: 0001-ARM-mxs-Setup-scheduler-clock-for-MXS.patch --]
[-- Type: text/plain, Size: 1661 bytes --]

>From 74092cc0217a5bab6f80ee07aa188a54f5792634 Mon Sep 17 00:00:00 2001
From: Stanislav Meduna <stano@meduna.org>
Date: Mon, 8 Nov 2012 23:39:14 +0100
Subject: [PATCH] ARM: mxs: Setup scheduler clock

Setup scheduler clock on ARM MXS platforms with a 32-bit timrot
such as MX.28. This allows the scheduler to use sub-jiffy resolution.

The corresponding change for 16-bit v1 timrots is not possible
at the moment due to rounding issues with clock values wrapping
faster than once per several seconds in the common ARM platform code.

Signed-off-by: Stanislav Meduna <stano@meduna.org>
---
 arch/arm/mach-mxs/timer.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
index 564a632..4b6e36c 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -26,6 +26,7 @@
 #include <linux/clk.h>
 
 #include <asm/mach/time.h>
+#include <asm/sched_clock.h>
 #include <mach/mxs.h>
 #include <mach/common.h>
 
@@ -230,15 +231,22 @@ static struct clocksource clocksource_mxs = {
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
+static u32 notrace mxs_read_sched_clock_v2(void)
+{
+	return ~readl_relaxed(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1));
+}
+
 static int __init mxs_clocksource_init(struct clk *timer_clk)
 {
 	unsigned int c = clk_get_rate(timer_clk);
 
 	if (timrot_is_v1())
 		clocksource_register_hz(&clocksource_mxs, c);
-	else
+	else {
 		clocksource_mmio_init(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1),
 			"mxs_timer", c, 200, 32, clocksource_mmio_readl_down);
+		setup_sched_clock(mxs_read_sched_clock_v2, 32, c);
+	}
 
 	return 0;
 }
-- 
1.7.0.4


  parent reply	other threads:[~2012-11-08 22:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 21:41 Wakeup latency measured with SCHED_TRACER depends on HZ Stanislav Meduna
2012-11-02 14:29 ` Stanislav Meduna
2012-11-05  2:57   ` Shawn Guo
2012-11-05  9:14     ` scheduler clock for MXS [Was: Re: Wakeup latency measured with SCHED_TRACER depends on HZ] Stanislav Meduna
2012-11-05 13:46       ` Shawn Guo
2012-11-05 16:09         ` Stanislav Meduna
2012-11-05 22:28           ` Russell King - ARM Linux
2012-11-06  2:40             ` Shawn Guo
2012-11-06 10:12               ` Russell King - ARM Linux
2012-11-06 13:49                 ` Shawn Guo
2012-11-06 20:04                   ` Russell King - ARM Linux
2012-11-06  8:34             ` scheduler clock for MXS Stanislav Meduna
2012-11-06  9:45               ` Russell King - ARM Linux
2012-11-06 13:46               ` Shawn Guo
2012-11-06 20:20                 ` Russell King - ARM Linux
2012-11-06 22:30                   ` Stanislav Meduna
2012-11-06 22:46                     ` Russell King - ARM Linux
2012-11-07  7:13                       ` Shawn Guo
2012-11-08 21:27                       ` Stanislav Meduna
2012-11-08 22:11                         ` Russell King - ARM Linux
2012-11-08 22:45                 ` Stanislav Meduna [this message]
2012-11-12  1:54                   ` [PATCH] ARM: mxs: Setup scheduler clock Shawn Guo

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=509C3619.30701@meduna.org \
    --to=stano@meduna.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=shawn.guo@linaro.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;
as well as URLs for NNTP newsgroup(s).