From patchwork Thu Nov 15 10:04:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 12861 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 5A11F4C177F for ; Thu, 15 Nov 2012 10:04:25 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 10148A18FAC for ; Thu, 15 Nov 2012 10:04:24 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so1914004iej.11 for ; Thu, 15 Nov 2012 02:04:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=Qgs2Epis2Daz+NFZETTiJUsD85kbgZNMepA950/XSTY=; b=RFsNc8Ovo5S9r2eltSISQ78QF3cNjAjAR2NowDu5+cMrag9PXnrHGDdTGJWjbQ1mxy k+r2isyVMVR1f5wA8sRa1n8D/RVpAYHT7/pm8b9263PtX6mSGF5WuSzDhIUnXGi4hbNO k0i5MI0QhI6lpBC86gL8+gr0VKM7qb1SzAEd+wx6wztOlajiqcs7tPWtKZOiH1zr6ZxG aUf5BN+HA3nFkMCZBSpye2BUOhhHwdSvDMWJQe0UIwKhR13y6Xl8umTA9lu1EUmEGZdh iudmnoYc4dRfWB2TvPHVQ5G5eQmLWJMpeQEXB/1Dr2BAfrP/3iOz2gFlz4EciCjHJvv0 vjYw== Received: by 10.50.140.97 with SMTP id rf1mr1947952igb.70.1352973864500; Thu, 15 Nov 2012 02:04:24 -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.50.67.148 with SMTP id n20csp801236igt; Thu, 15 Nov 2012 02:04:23 -0800 (PST) Received: by 10.216.30.11 with SMTP id j11mr273695wea.21.1352973863356; Thu, 15 Nov 2012 02:04:23 -0800 (PST) Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com [74.125.82.49]) by mx.google.com with ESMTPS id r61si1909014wed.21.2012.11.15.02.04.22 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Nov 2012 02:04:23 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.49 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.49; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.49 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-wg0-f49.google.com with SMTP id gg4so475874wgb.18 for ; Thu, 15 Nov 2012 02:04:22 -0800 (PST) Received: by 10.216.54.205 with SMTP id i55mr244187wec.201.1352973862810; Thu, 15 Nov 2012 02:04:22 -0800 (PST) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id r10sm6578968wiz.0.2012.11.15.02.04.21 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Nov 2012 02:04:22 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, jonas.aberg@stericsson.com, linux@arm.linux.org.uk, will.deacon@arm.com, Lee Jones Subject: [PATCH 2/2] clocksource: clksrc-dbx500-prcmu: Add boottime support Date: Thu, 15 Nov 2012 10:04:07 +0000 Message-Id: <1352973847-21605-3-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1352973847-21605-1-git-send-email-lee.jones@linaro.org> References: <1352973847-21605-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQmNNdshZ+b4jyq3S8sZieHfCjVc3tUx2sxsC2QOkFlfrh86PhulOMnNtTC8H7tdZkSRVGoa Create a call-back to provide boottime functionality with a means to gain access to CPU run time information. This call-back will be invoked numerous times during system boot in order to obtain and log various time increments throughout the booting process precisely. Based heavily on the original driver by Jonas Aaberg. Signed-off-by: Lee Jones --- drivers/clocksource/clksrc-dbx500-prcmu.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/clocksource/clksrc-dbx500-prcmu.c b/drivers/clocksource/clksrc-dbx500-prcmu.c index c26c369..0069cd9 100644 --- a/drivers/clocksource/clksrc-dbx500-prcmu.c +++ b/drivers/clocksource/clksrc-dbx500-prcmu.c @@ -14,6 +14,7 @@ */ #include #include +#include #include @@ -68,6 +69,23 @@ static u32 notrace dbx500_prcmu_sched_clock_read(void) #endif +#ifdef CONFIG_BOOTTIME +static unsigned long __init boottime_get_time(void) +{ + return div_s64(clocksource_cyc2ns(clocksource_dbx500_prcmu.read( + &clocksource_dbx500_prcmu), + clocksource_dbx500_prcmu.mult, + clocksource_dbx500_prcmu.shift), + 1000); +} + +static struct boottime_timer __initdata boottime_timer = { + .init = NULL, + .get_time = boottime_get_time, + .finalize = NULL, +}; +#endif + void __init clksrc_dbx500_prcmu_init(void __iomem *base) { clksrc_dbx500_timer_base = base; @@ -90,4 +108,6 @@ void __init clksrc_dbx500_prcmu_init(void __iomem *base) 32, RATE_32K); #endif clocksource_register_hz(&clocksource_dbx500_prcmu, RATE_32K); + + boottime_activate(&boottime_timer); }