Commit f61ae671 authored by Changhwan Youn's avatar Changhwan Youn Committed by Linus Torvalds

rtc: rtc-s3c: fix access unit from byte to word on RTCCON

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.

[atul.dahiya@samsung.com: tested on smdk2416]
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: default avatarChanghwan Youn <chaos.youn@samsung.com>
Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
Tested-by: default avatarAtul Dahiya <atul.dahiya@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent fa5b0782
...@@ -100,7 +100,7 @@ static int s3c_rtc_setpie(struct device *dev, int enabled) ...@@ -100,7 +100,7 @@ static int s3c_rtc_setpie(struct device *dev, int enabled)
spin_lock_irq(&s3c_rtc_pie_lock); spin_lock_irq(&s3c_rtc_pie_lock);
if (s3c_rtc_cpu_type == TYPE_S3C64XX) { 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; tmp &= ~S3C64XX_RTCCON_TICEN;
if (enabled) if (enabled)
...@@ -318,7 +318,7 @@ static int s3c_rtc_proc(struct device *dev, struct seq_file *seq) ...@@ -318,7 +318,7 @@ static int s3c_rtc_proc(struct device *dev, struct seq_file *seq)
unsigned int ticnt; unsigned int ticnt;
if (s3c_rtc_cpu_type == TYPE_S3C64XX) { 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; ticnt &= S3C64XX_RTCCON_TICEN;
} else { } else {
ticnt = readb(s3c_rtc_base + S3C2410_TICNT); ticnt = readb(s3c_rtc_base + S3C2410_TICNT);
...@@ -391,11 +391,11 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en) ...@@ -391,11 +391,11 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en)
return; return;
if (!en) { if (!en) {
tmp = readb(base + S3C2410_RTCCON); tmp = readw(base + S3C2410_RTCCON);
if (s3c_rtc_cpu_type == TYPE_S3C64XX) if (s3c_rtc_cpu_type == TYPE_S3C64XX)
tmp &= ~S3C64XX_RTCCON_TICEN; tmp &= ~S3C64XX_RTCCON_TICEN;
tmp &= ~S3C2410_RTCCON_RTCEN; tmp &= ~S3C2410_RTCCON_RTCEN;
writeb(tmp, base + S3C2410_RTCCON); writew(tmp, base + S3C2410_RTCCON);
if (s3c_rtc_cpu_type == TYPE_S3C2410) { if (s3c_rtc_cpu_type == TYPE_S3C2410) {
tmp = readb(base + S3C2410_TICNT); tmp = readb(base + S3C2410_TICNT);
...@@ -405,25 +405,28 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en) ...@@ -405,25 +405,28 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en)
} else { } else {
/* re-enable the device, and check it is ok */ /* 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"); dev_info(&pdev->dev, "rtc disabled, re-enabling\n");
tmp = readb(base + S3C2410_RTCCON); tmp = readw(base + S3C2410_RTCCON);
writeb(tmp|S3C2410_RTCCON_RTCEN, 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"); dev_info(&pdev->dev, "removing RTCCON_CNTSEL\n");
tmp = readb(base + S3C2410_RTCCON); tmp = readw(base + S3C2410_RTCCON);
writeb(tmp& ~S3C2410_RTCCON_CNTSEL, 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"); dev_info(&pdev->dev, "removing RTCCON_CLKRST\n");
tmp = readb(base + S3C2410_RTCCON); tmp = readw(base + S3C2410_RTCCON);
writeb(tmp & ~S3C2410_RTCCON_CLKRST, base+S3C2410_RTCCON); writew(tmp & ~S3C2410_RTCCON_CLKRST,
base + S3C2410_RTCCON);
} }
} }
} }
...@@ -515,7 +518,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) ...@@ -515,7 +518,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
s3c_rtc_enable(pdev, 1); s3c_rtc_enable(pdev, 1);
pr_debug("s3c2410_rtc: RTCCON=%02x\n", pr_debug("s3c2410_rtc: RTCCON=%02x\n",
readb(s3c_rtc_base + S3C2410_RTCCON)); readw(s3c_rtc_base + S3C2410_RTCCON));
device_init_wakeup(&pdev->dev, 1); device_init_wakeup(&pdev->dev, 1);
...@@ -578,7 +581,7 @@ static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -578,7 +581,7 @@ static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state)
/* save TICNT for anyone using periodic interrupts */ /* save TICNT for anyone using periodic interrupts */
ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT);
if (s3c_rtc_cpu_type == TYPE_S3C64XX) { 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; ticnt_en_save &= S3C64XX_RTCCON_TICEN;
} }
s3c_rtc_enable(pdev, 0); s3c_rtc_enable(pdev, 0);
...@@ -596,8 +599,8 @@ static int s3c_rtc_resume(struct platform_device *pdev) ...@@ -596,8 +599,8 @@ static int s3c_rtc_resume(struct platform_device *pdev)
s3c_rtc_enable(pdev, 1); s3c_rtc_enable(pdev, 1);
writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT);
if (s3c_rtc_cpu_type == TYPE_S3C64XX && ticnt_en_save) { if (s3c_rtc_cpu_type == TYPE_S3C64XX && ticnt_en_save) {
tmp = readb(s3c_rtc_base + S3C2410_RTCCON); tmp = readw(s3c_rtc_base + S3C2410_RTCCON);
writeb(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); writew(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON);
} }
if (device_may_wakeup(&pdev->dev)) if (device_may_wakeup(&pdev->dev))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment