From patchwork Thu Feb 20 09:51:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vikas C Sajjan X-Patchwork-Id: 24999 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E4D31203C6 for ; Thu, 20 Feb 2014 09:52:09 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id at1sf6380050iec.9 for ; Thu, 20 Feb 2014 01:52:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=E8Yt2HPTJJAG0OcMaPY+9LOLAfyixopgKyDA6U+kg9M=; b=jEoGW+oOa7eYoTM7KmQpk5eaG7Y5M1/AadSz6XqPrOOGyOTDlE1Yp0pfmQDm5ONDbj uQ/y4+xwu2raLt9jbZtB2NS5flgdRcJgn9NFyLPSpGl+gSGMKFQVyiTLsNc0clmq85QZ 59Qdc2m7XOOJzfbllh3JTJsa3wGZyp+Ellg9uW+VmAkFbX9OhQON5pdclw8M8MSNiu7L MymuvjuwMWzf5qqffJXhNI0zMrQUE076Yu6gnfyrRzSZ7U6zwKkWytHwvC2PBWQ327Un buJkinxYb9DLgisoMMGYjziZIzk9KDW6P4T8npAAJwLE8NAJUw3RQFhZ/aTPjUZRFeRt rFsQ== X-Gm-Message-State: ALoCoQlOH5YmNmpW5ifoAnQ6s0s1dxaAAVVKmXRyL2PKUXQTRu/bmd5c9Xoi7wprFJzwO93j0p8b X-Received: by 10.182.19.164 with SMTP id g4mr333591obe.21.1392889929067; Thu, 20 Feb 2014 01:52:09 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.22.139 with SMTP id 11ls403926qgn.84.gmail; Thu, 20 Feb 2014 01:52:09 -0800 (PST) X-Received: by 10.52.157.8 with SMTP id wi8mr413587vdb.46.1392889928974; Thu, 20 Feb 2014 01:52:08 -0800 (PST) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id y3si1250971vdo.32.2014.02.20.01.52.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Feb 2014 01:52:08 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.176; Received: by mail-ve0-f176.google.com with SMTP id jx11so1576342veb.21 for ; Thu, 20 Feb 2014 01:52:08 -0800 (PST) X-Received: by 10.220.191.134 with SMTP id dm6mr512531vcb.16.1392889928899; Thu, 20 Feb 2014 01:52:08 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp44107vcz; Thu, 20 Feb 2014 01:52:08 -0800 (PST) X-Received: by 10.194.250.34 with SMTP id yz2mr1032062wjc.18.1392889928100; Thu, 20 Feb 2014 01:52:08 -0800 (PST) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id jb14si2697330wic.3.2014.02.20.01.52.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Feb 2014 01:52:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WGQIH-0008Ip-LX; Thu, 20 Feb 2014 09:51:49 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WGQIF-0007sh-A1; Thu, 20 Feb 2014 09:51:47 +0000 Received: from mail-pd0-f172.google.com ([209.85.192.172]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WGQIC-0007s5-Qb for linux-arm-kernel@lists.infradead.org; Thu, 20 Feb 2014 09:51:45 +0000 Received: by mail-pd0-f172.google.com with SMTP id p10so1609256pdj.3 for ; Thu, 20 Feb 2014 01:51:20 -0800 (PST) X-Received: by 10.66.193.202 with SMTP id hq10mr859824pac.57.1392889877471; Thu, 20 Feb 2014 01:51:17 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id ns7sm9263890pbc.32.2014.02.20.01.51.11 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Feb 2014 01:51:16 -0800 (PST) From: Vikas Sajjan To: robherring2@gmail.com, grant.likely@linaro.org Subject: [PATCH] rtc: rtc-s3c: Fix incorrect way of save/restore of S3C2410_TICNT for TYPE_S3C64XX Date: Thu, 20 Feb 2014 15:36:01 +0545 Message-Id: <1392889861-5044-1-git-send-email-vikas.sajjan@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140220_045144_959249_66810FB9 X-CRM114-Status: GOOD ( 11.78 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.192.172 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: dianders@chromium.org, t.figa@samsung.com, jg1.han@samsung.com, joshi@samsung.com, linux-kernel@vger.kernel.org, kgene.kim@samsung.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vikas.sajjan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 On exynos5250, exynos5420 and exynos5260 it was observed that, after 1 cycle of S2R, the rtc-tick occurs at a very fast rate as compared to the rtc-tick occuring before S2R. This patch fixes the above issue by correcting the wrong way of save/restore of S3C2410_TICNT for TYPE_S3C64XX. Signed-off-by: Vikas Sajjan --- drivers/rtc/rtc-s3c.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 7afd373..c4cde9c 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -580,10 +580,12 @@ static int s3c_rtc_suspend(struct device *dev) clk_enable(rtc_clk); /* save TICNT for anyone using periodic interrupts */ - ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); if (s3c_rtc_cpu_type == TYPE_S3C64XX) { ticnt_en_save = readw(s3c_rtc_base + S3C2410_RTCCON); ticnt_en_save &= S3C64XX_RTCCON_TICEN; + ticnt_save = readl(s3c_rtc_base + S3C2410_TICNT); + } else { + ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); } s3c_rtc_enable(pdev, 0); @@ -605,10 +607,15 @@ static int s3c_rtc_resume(struct device *dev) clk_enable(rtc_clk); s3c_rtc_enable(pdev, 1); - writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); - if (s3c_rtc_cpu_type == TYPE_S3C64XX && ticnt_en_save) { - tmp = readw(s3c_rtc_base + S3C2410_RTCCON); - writew(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); + if (s3c_rtc_cpu_type == TYPE_S3C64XX) { + writel(ticnt_save, s3c_rtc_base + S3C2410_TICNT); + if (ticnt_en_save) { + tmp = readw(s3c_rtc_base + S3C2410_RTCCON); + writew(tmp | ticnt_en_save, + s3c_rtc_base + S3C2410_RTCCON); + } + } else { + writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); } if (device_may_wakeup(dev) && wake_en) {