From patchwork Thu Oct 7 08:20:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kukjin Kim X-Patchwork-Id: 67010 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-fx0-f56.google.com (mail-fx0-f56.google.com [209.85.161.56]) by ozlabs.org (Postfix) with ESMTP id E3509B70D2 for ; Thu, 7 Oct 2010 19:29:51 +1100 (EST) Received: by fxm1 with SMTP id 1sf101859fxm.11 for ; Thu, 07 Oct 2010 01:29:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:mime-version:x-beenthere:received :received:received:received:received-spf:received:received:from:to :cc:subject:date:message-id:x-mailer:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=woau3TxdJYJxL+okxgHrUSqqDBUQT/Kbhybccd2gjmk=; b=g1c5VN5RWMkqxFl70NBAy5wqPrJcfSSipdc+TjuickCFY8V2z160wAmG/QPzDzfMB1 8nCRcVjM1H7r3aAK+eqVThjq3HUlUjpCpe7ONSks1NPuwbwD+c3xP1XF/jWlrLBFVdch OvjgNg1tt9fj6424EUC/dJHuFHko/zxmLQoxM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=mime-version:x-beenthere:received-spf:from:to:cc:subject:date :message-id:x-mailer:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; b=k6Dc16aeQ/le3hat7TYO2nmG/4+8pTSXZ4MA4pJu5Cv3QbuEYjcAN4ciWs00gqHR5n hwxkuNykWnBR2SrsX/egJaKZnqve/hJ6sE9ZuJpxQ6Mf/cAaOeBqn8EFAq9GM54Y97zo v0wHGnVKdj/K8AV8n2qoNhZ6PEge8VDLoVEWQ= Received: by 10.223.87.215 with SMTP id x23mr4789fal.10.1286440188226; Thu, 07 Oct 2010 01:29:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.223.27.83 with SMTP id h19ls2475599fac.0.p; Thu, 07 Oct 2010 01:29:47 -0700 (PDT) Received: by 10.223.125.200 with SMTP id z8mr15097far.28.1286440187665; Thu, 07 Oct 2010 01:29:47 -0700 (PDT) Received: by 10.223.125.200 with SMTP id z8mr15096far.28.1286440187645; Thu, 07 Oct 2010 01:29:47 -0700 (PDT) Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [213.95.27.120]) by gmr-mx.google.com with ESMTP id q13si502442faa.7.2010.10.07.01.29.47; Thu, 07 Oct 2010 01:29:47 -0700 (PDT) Received-SPF: neutral (google.com: 213.95.27.120 is neither permitted nor denied by best guess record for domain of kgene.kim@samsung.com) client-ip=213.95.27.120; Received: from uucp by ganesha.gnumonks.org with local-bsmtp (Exim 4.69) (envelope-from ) id 1P3lrD-0005P4-IY; Thu, 07 Oct 2010 10:29:43 +0200 Received: from [12.23.102.184] (helo=localhost.localdomain) by jackpot.kr.gnumonks.org with esmtp (Exim 4.69) (envelope-from ) id 1P3l6j-0001Vo-Uu; Thu, 07 Oct 2010 16:41:41 +0900 From: Kukjin Kim To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, rtc-linux@googlegroups.com Cc: ben-linux@fluff.org, p_gortmaker@yahoo.com, a.zummo@towertech.it, Changhwan Youn , Kukjin Kim Subject: [rtc-linux] [PATCH v2 1/3] rtc: rtc-s3c: Fix access unit from byte to word on RTCCON Date: Thu, 7 Oct 2010 17:20:06 +0900 Message-Id: <1286439608-22722-1-git-send-email-kgene.kim@samsung.com> X-Mailer: git-send-email 1.6.2.5 X-Original-Sender: kgene.kim@samsung.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 213.95.27.120 is neither permitted nor denied by best guess record for domain of kgene.kim@samsung.com) smtp.mail=kgene.kim@samsung.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , From: Changhwan Youn S3C2410_RTCCON of TYPE_S3C64XX RTC should be read/written by readw and writew, because TYPE_S3C64XX RTC uses bit 8 and 9. And TYPE_S3C2410 RTC also can access it by readw and writew. Signed-off-by: Changhwan Youn [atul.dahiya@samsung.com: tested on smdk2416] Tested-by: Atul Dahiya Signed-off-by: Kukjin Kim Cc: Ben Dooks --- Changes since v1: - Checked this patch on s3c24xx - Added some missing modifications in s3c_rtc_enable() drivers/rtc/rtc-s3c.c | 36 ++++++++++++++++++------------------ 1 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index f57a87f..4a0b875 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -100,7 +100,7 @@ static int s3c_rtc_setpie(struct device *dev, int enabled) spin_lock_irq(&s3c_rtc_pie_lock); if (s3c_rtc_cpu_type == TYPE_S3C64XX) { - tmp = readb(s3c_rtc_base + S3C2410_RTCCON); + tmp = readw(s3c_rtc_base + S3C2410_RTCCON); tmp &= ~S3C64XX_RTCCON_TICEN; if (enabled) @@ -318,7 +318,7 @@ static int s3c_rtc_proc(struct device *dev, struct seq_file *seq) unsigned int ticnt; if (s3c_rtc_cpu_type == TYPE_S3C64XX) { - ticnt = readb(s3c_rtc_base + S3C2410_RTCCON); + ticnt = readw(s3c_rtc_base + S3C2410_RTCCON); ticnt &= S3C64XX_RTCCON_TICEN; } else { ticnt = readb(s3c_rtc_base + S3C2410_TICNT); @@ -391,11 +391,11 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en) return; if (!en) { - tmp = readb(base + S3C2410_RTCCON); + tmp = readw(base + S3C2410_RTCCON); if (s3c_rtc_cpu_type == TYPE_S3C64XX) tmp &= ~S3C64XX_RTCCON_TICEN; tmp &= ~S3C2410_RTCCON_RTCEN; - writeb(tmp, base + S3C2410_RTCCON); + writew(tmp, base + S3C2410_RTCCON); if (s3c_rtc_cpu_type == TYPE_S3C2410) { tmp = readb(base + S3C2410_TICNT); @@ -405,25 +405,25 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en) } else { /* re-enable the device, and check it is ok */ - if ((readb(base+S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){ + if ((readw(base+S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){ dev_info(&pdev->dev, "rtc disabled, re-enabling\n"); - tmp = readb(base + S3C2410_RTCCON); - writeb(tmp|S3C2410_RTCCON_RTCEN, base+S3C2410_RTCCON); + tmp = readw(base + S3C2410_RTCCON); + writew(tmp|S3C2410_RTCCON_RTCEN, base+S3C2410_RTCCON); } - if ((readb(base + S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){ + if ((readw(base + S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){ dev_info(&pdev->dev, "removing RTCCON_CNTSEL\n"); - tmp = readb(base + S3C2410_RTCCON); - writeb(tmp& ~S3C2410_RTCCON_CNTSEL, base+S3C2410_RTCCON); + tmp = readw(base + S3C2410_RTCCON); + writew(tmp& ~S3C2410_RTCCON_CNTSEL, base+S3C2410_RTCCON); } - if ((readb(base + S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){ + if ((readw(base + S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){ dev_info(&pdev->dev, "removing RTCCON_CLKRST\n"); - tmp = readb(base + S3C2410_RTCCON); - writeb(tmp & ~S3C2410_RTCCON_CLKRST, base+S3C2410_RTCCON); + tmp = readw(base + S3C2410_RTCCON); + writew(tmp & ~S3C2410_RTCCON_CLKRST, base+S3C2410_RTCCON); } } } @@ -514,8 +514,8 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) s3c_rtc_enable(pdev, 1); - pr_debug("s3c2410_rtc: RTCCON=%02x\n", - readb(s3c_rtc_base + S3C2410_RTCCON)); + pr_debug("s3c2410_rtc: RTCCON=%02x\n", + readw(s3c_rtc_base + S3C2410_RTCCON)); device_init_wakeup(&pdev->dev, 1); @@ -578,7 +578,7 @@ static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state) /* 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 = readb(s3c_rtc_base + S3C2410_RTCCON); + ticnt_en_save = readw(s3c_rtc_base + S3C2410_RTCCON); ticnt_en_save &= S3C64XX_RTCCON_TICEN; } s3c_rtc_enable(pdev, 0); @@ -596,8 +596,8 @@ static int s3c_rtc_resume(struct platform_device *pdev) s3c_rtc_enable(pdev, 1); writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); if (s3c_rtc_cpu_type == TYPE_S3C64XX && ticnt_en_save) { - tmp = readb(s3c_rtc_base + S3C2410_RTCCON); - writeb(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); + tmp = readw(s3c_rtc_base + S3C2410_RTCCON); + writew(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); } if (device_may_wakeup(&pdev->dev))