mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	linux-s390@vger.kernel.org
Subject: [RFC][PATCH 1/3] clocksource: s390: Convert s390 to use clocksource_register_khz
Date: Mon, 23 Jan 2012 16:05:48 -0800	[thread overview]
Message-ID: <1327363550-19952-2-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1327363550-19952-1-git-send-email-john.stultz@linaro.org>

Converts s390 TOD clock to use clocksource_register_khz

The tod freq I calculated seems a bit fast. Need someone
to double check me here.

CC: Martin Schwidefsky <schwidefsky@de.ibm.com>
CC: linux-s390@vger.kernel.org
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 arch/s390/kernel/time.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index fa02f44..37e8ec5 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -207,8 +207,6 @@ static struct clocksource clocksource_tod = {
 	.rating		= 400,
 	.read		= read_tod_clock,
 	.mask		= -1ULL,
-	.mult		= 1000,
-	.shift		= 12,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -267,7 +265,16 @@ void __init time_init(void)
 	if (register_external_interrupt(0x1406, timing_alert_interrupt))
 		panic("Couldn't request external interrupt 0x1406");
 
-	if (clocksource_register(&clocksource_tod) != 0)
+	/* s390 TOD apparently runs at 4,096,000,000 cycs/sec
+	 * XXX - Brute forced tod freq from:
+	 *    2^shift/mult * NSEC_PER_SEC	= cyc/sec
+	 *    2^12 / 1000  * 1000000000		= cyc/sec
+	 *    2^12 * 1000000			= cyc/sec
+	 *    2^12 * 1000			= kcyc/sec
+	 *    1000<<12				= kcyc/sec
+	 * Could be totally wrong. -johnstul
+	 */
+	if (clocksource_register_khz(&clocksource_tod, (1000<<12) ) != 0)
 		panic("Could not register TOD clock source");
 
 	/* Enable TOD clock interrupts on the boot cpu. */
-- 
1.7.3.2.146.gca209


  reply	other threads:[~2012-01-24  0:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-24  0:05 [RFC][PATCH 0/3] Last of the clocksource_register_hz cleanups John Stultz
2012-01-24  0:05 ` John Stultz [this message]
2012-01-24  0:05 ` [RFC][PATCH 2/3] clocksource: scx200_hrt: Convert scx200 to use clocksource_register_hz John Stultz
2012-01-24 18:53   ` Jim Cromie
2012-01-24 23:00     ` John Stultz
2012-01-24 23:51       ` Jim Cromie
2012-01-25  0:14         ` John Stultz
2012-01-24  0:05 ` [PATCH 3/3] clocksource: Convert mips pnx8550 " John Stultz

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=1327363550-19952-2-git-send-email-john.stultz@linaro.org \
    --to=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /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