From patchwork Thu Oct 18 17:18:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12355 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 C7BCF241AD for ; Thu, 18 Oct 2012 17:25:53 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 3F65EA19506 for ; Thu, 18 Oct 2012 17:25:53 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so6303585iag.11 for ; Thu, 18 Oct 2012 10:25:52 -0700 (PDT) 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:mime-version:content-type :x-gm-message-state; bh=nitx9BbnDC22XWcdbRtoiKy/lTvGS8zyqDqGyqnnGbA=; b=HUG62qUBgl7LpPtdQGgHMGU5PJ71P62ZopOpB02soyVxbiRmDrE7cmaEXzdx31tMkq /MX53S6grLu755QtDU3bbK/SVFXx+U7+AVGH+h4CcCo0L6qwJgdZC9OCUQBRWx7ssEkR 0B+Sbqjr98I4opeV3tIHIinZ0JYpexA9jzVbPy69ay3DzZyz5yoePVLL6JH8G5gofPDA rU36AR/Ih5botA16dwOhGyy9b4CTHkkwvzvTWYDJLOmLv7fKjs9qiumtmWtAVe0tFQOr GECfktd9KaF/KYN0/vQcexsaGVlaSsHKwB7rfTZguyfsM7PNeBdtxoAsiR7fl8hU0BDM yFjA== Received: by 10.42.145.66 with SMTP id e2mr17699184icv.18.1350581151666; Thu, 18 Oct 2012 10:25:51 -0700 (PDT) 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 n20csp1111328igt; Thu, 18 Oct 2012 10:25:50 -0700 (PDT) Received: by 10.204.152.25 with SMTP id e25mr6725621bkw.70.1350581149097; Thu, 18 Oct 2012 10:25:49 -0700 (PDT) Received: from eu1sys200aog109.obsmtp.com (eu1sys200aog109.obsmtp.com [207.126.144.127]) by mx.google.com with SMTP id fk9si40949788bkc.17.2012.10.18.10.25.40 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Oct 2012 10:25:49 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.127 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.127; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.127 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob109.postini.com ([207.126.147.11]) with SMTP ID DSNKUIA6A8bby8rAcPfTF/IWcSlpbclRqCGB@postini.com; Thu, 18 Oct 2012 17:25:48 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id C04289A; Thu, 18 Oct 2012 17:10:43 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 98CF8DFF; Thu, 18 Oct 2012 17:18:55 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id DC50224C07D; Thu, 18 Oct 2012 19:18:45 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Thu, 18 Oct 2012 19:18:54 +0200 From: Linus Walleij To: , Cc: Anmar Oueja , Linus Walleij , Alessandro Rubini Subject: [PATCH 3/8] ARM: plat-nomadik: use DIV_ROUND_CLOSEST() Date: Thu, 18 Oct 2012 19:18:52 +0200 Message-ID: <1350580732-8409-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkRqDyJW/M8AUjozvHnAzopDktLDtPR9vj6/i7h0j3kjgaXyjfTeUZJLW3hJmdIzrRyhyDn From: Linus Walleij Use DIV_ROUND_CLOSEST() to calculate the cycle counter for the periodic mode instead of relying on homebrew reimplementation. Cc: Alessandro Rubini Signed-off-by: Linus Walleij --- arch/arm/plat-nomadik/timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c index 0ae2b06..f911430 100644 --- a/arch/arm/plat-nomadik/timer.c +++ b/arch/arm/plat-nomadik/timer.c @@ -201,7 +201,8 @@ void __init nmdk_timer_init(void __iomem *base, int irq) clk_prescale = MTU_CRn_PRESCALE_1; } - nmdk_cycle = (rate + HZ/2) / HZ; + /* Cycles for periodic mode */ + nmdk_cycle = DIV_ROUND_CLOSEST(rate, HZ); /* Timer 0 is the free running clocksource */