diff options
author | Krzysztof Kozlowski <k.kozlowski@samsung.com> | 2015-04-16 15:45:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-17 09:04:02 -0400 |
commit | 202fe4c27f427c48ca5660277d743ee8b43fc200 (patch) | |
tree | cd29a98058d369bf629aa635368594fbfdb47be5 /drivers/rtc | |
parent | 521fca18e828cddc94535a1ea5ac33460f1de679 (diff) |
drivers/rtc/rtc-s3c.c: fix failed first read of RTC time
Initialize the device time (if it is wrong) before registering RTC device
to fix following error message during rtc-s3c probe:
[ 2.215414] rtc (null): read_time: fail to read
[ 2.216322] s3c-rtc 10070000.rtc: rtc core: registered s3c as rtc1
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-s3c.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index fb0c569765c6..a313b9b5a27e 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -496,6 +496,22 @@ static int s3c_rtc_probe(struct platform_device *pdev) | |||
496 | 496 | ||
497 | device_init_wakeup(&pdev->dev, 1); | 497 | device_init_wakeup(&pdev->dev, 1); |
498 | 498 | ||
499 | /* Check RTC Time */ | ||
500 | s3c_rtc_gettime(&pdev->dev, &rtc_tm); | ||
501 | |||
502 | if (rtc_valid_tm(&rtc_tm)) { | ||
503 | rtc_tm.tm_year = 100; | ||
504 | rtc_tm.tm_mon = 0; | ||
505 | rtc_tm.tm_mday = 1; | ||
506 | rtc_tm.tm_hour = 0; | ||
507 | rtc_tm.tm_min = 0; | ||
508 | rtc_tm.tm_sec = 0; | ||
509 | |||
510 | s3c_rtc_settime(&pdev->dev, &rtc_tm); | ||
511 | |||
512 | dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n"); | ||
513 | } | ||
514 | |||
499 | /* register RTC and exit */ | 515 | /* register RTC and exit */ |
500 | info->rtc = devm_rtc_device_register(&pdev->dev, "s3c", &s3c_rtcops, | 516 | info->rtc = devm_rtc_device_register(&pdev->dev, "s3c", &s3c_rtcops, |
501 | THIS_MODULE); | 517 | THIS_MODULE); |
@@ -519,22 +535,6 @@ static int s3c_rtc_probe(struct platform_device *pdev) | |||
519 | goto err_nortc; | 535 | goto err_nortc; |
520 | } | 536 | } |
521 | 537 | ||
522 | /* Check RTC Time */ | ||
523 | s3c_rtc_gettime(&pdev->dev, &rtc_tm); | ||
524 | |||
525 | if (rtc_valid_tm(&rtc_tm)) { | ||
526 | rtc_tm.tm_year = 100; | ||
527 | rtc_tm.tm_mon = 0; | ||
528 | rtc_tm.tm_mday = 1; | ||
529 | rtc_tm.tm_hour = 0; | ||
530 | rtc_tm.tm_min = 0; | ||
531 | rtc_tm.tm_sec = 0; | ||
532 | |||
533 | s3c_rtc_settime(&pdev->dev, &rtc_tm); | ||
534 | |||
535 | dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n"); | ||
536 | } | ||
537 | |||
538 | if (info->data->select_tick_clk) | 538 | if (info->data->select_tick_clk) |
539 | info->data->select_tick_clk(info); | 539 | info->data->select_tick_clk(info); |
540 | 540 | ||