aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-s3c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-s3c.c')
-rw-r--r--drivers/rtc/rtc-s3c.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index ead217b1857a..d0498a223f40 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -456,8 +456,8 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)
456static int __devinit s3c_rtc_probe(struct platform_device *pdev) 456static int __devinit s3c_rtc_probe(struct platform_device *pdev)
457{ 457{
458 struct rtc_device *rtc; 458 struct rtc_device *rtc;
459 struct rtc_time rtc_tm;
459 struct resource *res; 460 struct resource *res;
460 unsigned int tmp, i;
461 int ret; 461 int ret;
462 462
463 pr_debug("%s: probe=%p\n", __func__, pdev); 463 pr_debug("%s: probe=%p\n", __func__, pdev);
@@ -538,11 +538,19 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
538 538
539 /* Check RTC Time */ 539 /* Check RTC Time */
540 540
541 for (i = S3C2410_RTCSEC; i <= S3C2410_RTCYEAR; i += 0x4) { 541 s3c_rtc_gettime(NULL, &rtc_tm);
542 tmp = readb(s3c_rtc_base + i);
543 542
544 if ((tmp & 0xf) > 0x9 || ((tmp >> 4) & 0xf) > 0x9) 543 if (rtc_valid_tm(&rtc_tm)) {
545 writeb(0, s3c_rtc_base + i); 544 rtc_tm.tm_year = 100;
545 rtc_tm.tm_mon = 0;
546 rtc_tm.tm_mday = 1;
547 rtc_tm.tm_hour = 0;
548 rtc_tm.tm_min = 0;
549 rtc_tm.tm_sec = 0;
550
551 s3c_rtc_settime(NULL, &rtc_tm);
552
553 dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n");
546 } 554 }
547 555
548 if (s3c_rtc_cpu_type == TYPE_S3C64XX) 556 if (s3c_rtc_cpu_type == TYPE_S3C64XX)