diff options
| author | Vikas Sajjan <vikas.sajjan@linaro.org> | 2014-03-03 18:38:31 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-03-04 10:55:48 -0500 |
| commit | 40d2d968e99aa267ac1e5d70deb97faa41a7dfc8 (patch) | |
| tree | d1fa6f70dcf09386109c250ed96cd1225bc29e97 /drivers/rtc | |
| parent | 0f55159d091cb1e555ee52abc1b2455f301b99a8 (diff) | |
drivers/rtc/rtc-s3c.c: fix incorrect way of save/restore of S3C2410_TICNT for TYPE_S3C64XX
On exynos5250, exynos5420 and exynos5260 it was observed that, after 1
cycle of S2R, the rtc-tick occurs at a very fast rate as compared to the
rtc-tick occuring before S2R.
This patch fixes the above issue by correcting the wrong way of
save/restore of S3C2410_TICNT for TYPE_S3C64XX.
Signed-off-by: Vikas Sajjan <vikas.sajjan@samsung.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
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 | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 7afd373b9595..c4cde9c08f1f 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
| @@ -580,10 +580,12 @@ static int s3c_rtc_suspend(struct device *dev) | |||
| 580 | 580 | ||
| 581 | clk_enable(rtc_clk); | 581 | clk_enable(rtc_clk); |
| 582 | /* save TICNT for anyone using periodic interrupts */ | 582 | /* save TICNT for anyone using periodic interrupts */ |
| 583 | ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); | ||
| 584 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { | 583 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { |
| 585 | ticnt_en_save = readw(s3c_rtc_base + S3C2410_RTCCON); | 584 | ticnt_en_save = readw(s3c_rtc_base + S3C2410_RTCCON); |
| 586 | ticnt_en_save &= S3C64XX_RTCCON_TICEN; | 585 | ticnt_en_save &= S3C64XX_RTCCON_TICEN; |
| 586 | ticnt_save = readl(s3c_rtc_base + S3C2410_TICNT); | ||
| 587 | } else { | ||
| 588 | ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); | ||
| 587 | } | 589 | } |
| 588 | s3c_rtc_enable(pdev, 0); | 590 | s3c_rtc_enable(pdev, 0); |
| 589 | 591 | ||
| @@ -605,10 +607,15 @@ static int s3c_rtc_resume(struct device *dev) | |||
| 605 | 607 | ||
| 606 | clk_enable(rtc_clk); | 608 | clk_enable(rtc_clk); |
| 607 | s3c_rtc_enable(pdev, 1); | 609 | s3c_rtc_enable(pdev, 1); |
| 608 | writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); | 610 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { |
| 609 | if (s3c_rtc_cpu_type == TYPE_S3C64XX && ticnt_en_save) { | 611 | writel(ticnt_save, s3c_rtc_base + S3C2410_TICNT); |
| 610 | tmp = readw(s3c_rtc_base + S3C2410_RTCCON); | 612 | if (ticnt_en_save) { |
| 611 | writew(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); | 613 | tmp = readw(s3c_rtc_base + S3C2410_RTCCON); |
| 614 | writew(tmp | ticnt_en_save, | ||
| 615 | s3c_rtc_base + S3C2410_RTCCON); | ||
| 616 | } | ||
| 617 | } else { | ||
| 618 | writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); | ||
| 612 | } | 619 | } |
| 613 | 620 | ||
| 614 | if (device_may_wakeup(dev) && wake_en) { | 621 | if (device_may_wakeup(dev) && wake_en) { |
