linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 3/3] rtc: rtc-s3c: Add BCD register initialization codes
@ 2010-07-27 12:59 Kukjin Kim
  2010-07-27 17:46 ` [rtc-linux] " Alessandro Zummo
  0 siblings, 1 reply; 4+ messages in thread
From: Kukjin Kim @ 2010-07-27 12:59 UTC (permalink / raw)
  To: linux-arm-kernel

From: Taekgyun Ko <taeggyun.ko@samsung.com>

RTC needs to be initialized when BCD registers have invalid value.

Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
Changes since v1:
- Removed unnecessary parens around > operations as per Sergei Shtylyov

 drivers/rtc/rtc-s3c.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 2040017..e96e109 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -536,10 +536,20 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 
 	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
 
-	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
+	if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
 		rtc->max_user_freq = 32768;
-	else
+
+		/* Check RTC Time */
+
+		for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) {
+			tmp = readb(s3c_rtc_base + i);
+
+			if ((tmp & 0xf) > 0x9 || ((tmp >> 4) & 0xf) > 0x9)
+				writeb(0, s3c_rtc_base + i);
+		}
+	} else {
 		rtc->max_user_freq = 128;
+	}
 
 	platform_set_drvdata(pdev, rtc);
 
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-07-28  4:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-27 12:59 [PATCH v2 3/3] rtc: rtc-s3c: Add BCD register initialization codes Kukjin Kim
2010-07-27 17:46 ` [rtc-linux] " Alessandro Zummo
2010-07-28  4:30   ` Kukjin Kim
2010-07-28  4:48     ` Wan ZongShun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).