From patchwork Wed Jun 11 08:37:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiubo Li X-Patchwork-Id: 4334991 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 009F5BEEAA for ; Wed, 11 Jun 2014 09:24:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 40384202EB for ; Wed, 11 Jun 2014 09:24:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 45359202E9 for ; Wed, 11 Jun 2014 09:24:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wuejj-0006i2-5y; Wed, 11 Jun 2014 09:22:27 +0000 Received: from mail-by2lp0235.outbound.protection.outlook.com ([207.46.163.235] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wueje-0006Zk-07 for linux-arm-kernel@lists.infradead.org; Wed, 11 Jun 2014 09:22:23 +0000 Received: from BY2PR03CA031.namprd03.prod.outlook.com (10.242.234.152) by BY2PR03MB508.namprd03.prod.outlook.com (10.141.143.27) with Microsoft SMTP Server (TLS) id 15.0.959.24; Wed, 11 Jun 2014 09:21:59 +0000 Received: from BL2FFO11FD033.protection.gbl (2a01:111:f400:7c09::189) by BY2PR03CA031.outlook.office365.com (2a01:111:e400:2c2c::24) with Microsoft SMTP Server (TLS) id 15.0.959.24 via Frontend Transport; Wed, 11 Jun 2014 09:21:58 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD033.mail.protection.outlook.com (10.173.161.129) with Microsoft SMTP Server (TLS) id 15.0.959.15 via Frontend Transport; Wed, 11 Jun 2014 09:21:58 +0000 Received: from rock.ap.freescale.net (rock.ap.freescale.net [10.193.20.106]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id s5B9Ls5N028752; Wed, 11 Jun 2014 02:21:55 -0700 From: Xiubo Li To: , , Subject: [PATCH] clocksource: arch_arm_timer: Fix timecounter initialization Date: Wed, 11 Jun 2014 16:37:41 +0800 Message-ID: <1402475861-15354-1-git-send-email-Li.Xiubo@freescale.com> X-Mailer: git-send-email 1.8.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(199002)(189002)(81542001)(50226001)(4396001)(26826002)(50466002)(31966008)(74502001)(50986999)(19580405001)(46102001)(83072002)(104166001)(44976005)(19580395003)(21056001)(97736001)(88136002)(104016001)(64706001)(36756003)(20776003)(102836001)(77096999)(47776003)(74662001)(89996001)(68736004)(79102001)(99396002)(80022001)(81342001)(48376002)(87286001)(77156001)(86362001)(93916002)(92726001)(92566001)(2201001)(87936001)(84676001)(83322001)(62966002)(85852003)(77982001)(76482001)(6806004); DIR:OUT; SFP:; SCL:1; SRVR:BY2PR03MB508; H:tx30smr01.am.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 0239D46DB6 Received-SPF: Fail (: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=Li.Xiubo@freescale.com; X-OriginatorOrg: freescale.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140611_022222_108775_195B5618 X-CRM114-Status: UNSURE ( 7.60 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: Xiubo Li , linux-kernel@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The third parameter(u64 start_tstamp) of timecounter_init() should be the start time by ns, not a cycle counter. Signed-off-by: Xiubo Li --- drivers/clocksource/arm_arch_timer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 5163ec1..6c3cfd8 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -426,7 +426,7 @@ struct timecounter *arch_timer_get_timecounter(void) static void __init arch_counter_register(unsigned type) { - u64 start_count; + u64 start_count, start_ns; /* Register the CP15 based counter if we have one */ if (type & ARCH_CP15_TIMER) @@ -438,7 +438,8 @@ static void __init arch_counter_register(unsigned type) clocksource_register_hz(&clocksource_counter, arch_timer_rate); cyclecounter.mult = clocksource_counter.mult; cyclecounter.shift = clocksource_counter.shift; - timecounter_init(&timecounter, &cyclecounter, start_count); + start_ns = cyclecounter_cyc2ns(&cyclecounter, start_count); + timecounter_init(&timecounter, &cyclecounter, start_ns); /* 56 bits minimum, so we assume worst case rollover */ sched_clock_register(arch_timer_read_counter, 56, arch_timer_rate);