From patchwork Tue Jan 24 00:05:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 6355 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3316D2427F for ; Tue, 24 Jan 2012 00:06:41 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 23772A1807A for ; Tue, 24 Jan 2012 00:06:41 +0000 (UTC) Received: by mail-bk0-f52.google.com with SMTP id r19so3474661bka.11 for ; Mon, 23 Jan 2012 16:06:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.205.127.17 with SMTP id gy17mr3988477bkc.110.1327363600928; Mon, 23 Jan 2012 16:06:40 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.204.130.220 with SMTP id u28cs85859bks; Mon, 23 Jan 2012 16:06:40 -0800 (PST) Received: by 10.68.228.101 with SMTP id sh5mr25833667pbc.127.1327363598551; Mon, 23 Jan 2012 16:06:38 -0800 (PST) Received: from e31.co.us.ibm.com (e31.co.us.ibm.com. [32.97.110.149]) by mx.google.com with ESMTPS id 2si14025420pbd.86.2012.01.23.16.06.37 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Jan 2012 16:06:38 -0800 (PST) Received-SPF: pass (google.com: domain of jstultz@us.ibm.com designates 32.97.110.149 as permitted sender) client-ip=32.97.110.149; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jstultz@us.ibm.com designates 32.97.110.149 as permitted sender) smtp.mail=jstultz@us.ibm.com Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 23 Jan 2012 17:06:36 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 23 Jan 2012 17:06:32 -0700 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id F1D4E19D804A; Mon, 23 Jan 2012 17:06:28 -0700 (MST) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q0O06U4J110564; Mon, 23 Jan 2012 17:06:30 -0700 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q0O06TKb006183; Mon, 23 Jan 2012 17:06:30 -0700 Received: from kernel.beaverton.ibm.com (kernel.beaverton.ibm.com [9.47.67.96]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q0O06T2J006158; Mon, 23 Jan 2012 17:06:29 -0700 Received: by kernel.beaverton.ibm.com (Postfix, from userid 1056) id 97593BFE58; Mon, 23 Jan 2012 16:06:07 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Jim Cromie Subject: [RFC][PATCH 2/3] clocksource: scx200_hrt: Convert scx200 to use clocksource_register_hz Date: Mon, 23 Jan 2012 16:05:49 -0800 Message-Id: <1327363550-19952-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.3.2.146.gca209 In-Reply-To: <1327363550-19952-1-git-send-email-john.stultz@linaro.org> References: <1327363550-19952-1-git-send-email-john.stultz@linaro.org> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12012400-7282-0000-0000-000005DDD4C6 X-Gm-Message-State: ALoCoQm1bVDVxQSuIJaHPZYs57IpUMPoOdO0SSxuSVpY5XgUQ5GjLqETIGA+beHqsdSa03OGLI4F Converts the scx200 clocksource to using clocksource_register_hz. This wasn't a straight conversion, so would like some extra review by the maintainers. CC: Jim Cromie Signed-off-by: John Stultz --- drivers/clocksource/scx200_hrt.c | 19 ++++++------------- 1 files changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/clocksource/scx200_hrt.c b/drivers/clocksource/scx200_hrt.c index 27f4d96..24f884c 100644 --- a/drivers/clocksource/scx200_hrt.c +++ b/drivers/clocksource/scx200_hrt.c @@ -49,9 +49,6 @@ static cycle_t read_hrt(struct clocksource *cs) return (cycle_t) inl(scx200_cb_base + SCx200_TIMER_OFFSET); } -#define HRT_SHIFT_1 22 -#define HRT_SHIFT_27 26 - static struct clocksource cs_hrt = { .name = "scx200_hrt", .rating = 250, @@ -63,6 +60,7 @@ static struct clocksource cs_hrt = { static int __init init_hrt_clocksource(void) { + u32 freq; /* Make sure scx200 has initialized the configuration block */ if (!scx200_cb_present()) return -ENODEV; @@ -79,19 +77,14 @@ static int __init init_hrt_clocksource(void) outb(HR_TMEN | (mhz27 ? HR_TMCLKSEL : 0), scx200_cb_base + SCx200_TMCNFG_OFFSET); - if (mhz27) { - cs_hrt.shift = HRT_SHIFT_27; - cs_hrt.mult = clocksource_hz2mult((HRT_FREQ + ppm) * 27, - cs_hrt.shift); - } else { - cs_hrt.shift = HRT_SHIFT_1; - cs_hrt.mult = clocksource_hz2mult(HRT_FREQ + ppm, - cs_hrt.shift); - } + freq = (HRT_FREQ + ppm); + if (mhz27) + freq *= 27; + printk(KERN_INFO "enabling scx200 high-res timer (%s MHz +%d ppm)\n", mhz27 ? "27":"1", ppm); - return clocksource_register(&cs_hrt); + return clocksource_register_hz(&cs_hrt, freq); } module_init(init_hrt_clocksource);