aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorAtul Dahiya <atul.dahiya@samsung.com>2010-07-20 06:32:51 -0400
committerKukjin Kim <kgene.kim@samsung.com>2010-08-05 05:32:51 -0400
commit2f3478f6579b3f8d4579b6d49d7a8e9376c48fc2 (patch)
tree7b5381077dc615e0a3b6cc180ce3c4a30c76a9b8 /drivers/rtc
parent002d31e6b623d08d707c7ba490f4ae0099285e9e (diff)
rtc: rtc-s3c: Updates driver for S3C64XX and newer SoCs
This Patch does followings. 1) Enables support for alarm and time tick pending register for periodic interrupt generation. 2) Changes writeb to writew beacuse the macro S3C64XX_RTCCON_TICEN (Tick Timer Enable) is 9th bit of register. 3) Changes writeb to writel as max_user_freq used in s3c64xx is 32768 and requires 15 bits to update the Tick Count Register. Signed-off-by: Atul Dahiya <atul.dahiya@samsung.com> Signed-off-by: Taekgyun Ko <taeggyun.ko@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> Cc: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-s3c.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index c032a15c84ab..204001769ebc 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -57,6 +57,10 @@ static irqreturn_t s3c_rtc_alarmirq(int irq, void *id)
57 struct rtc_device *rdev = id; 57 struct rtc_device *rdev = id;
58 58
59 rtc_update_irq(rdev, 1, RTC_AF | RTC_IRQF); 59 rtc_update_irq(rdev, 1, RTC_AF | RTC_IRQF);
60
61 if (s3c_rtc_cpu_type == TYPE_S3C64XX)
62 writeb(S3C2410_INTP_ALM, s3c_rtc_base + S3C2410_INTP);
63
60 return IRQ_HANDLED; 64 return IRQ_HANDLED;
61} 65}
62 66
@@ -65,6 +69,10 @@ static irqreturn_t s3c_rtc_tickirq(int irq, void *id)
65 struct rtc_device *rdev = id; 69 struct rtc_device *rdev = id;
66 70
67 rtc_update_irq(rdev, 1, RTC_PF | RTC_IRQF); 71 rtc_update_irq(rdev, 1, RTC_PF | RTC_IRQF);
72
73 if (s3c_rtc_cpu_type == TYPE_S3C64XX)
74 writeb(S3C2410_INTP_TIC, s3c_rtc_base + S3C2410_INTP);
75
68 return IRQ_HANDLED; 76 return IRQ_HANDLED;
69} 77}
70 78
@@ -98,7 +106,7 @@ static int s3c_rtc_setpie(struct device *dev, int enabled)
98 if (enabled) 106 if (enabled)
99 tmp |= S3C64XX_RTCCON_TICEN; 107 tmp |= S3C64XX_RTCCON_TICEN;
100 108
101 writeb(tmp, s3c_rtc_base + S3C2410_RTCCON); 109 writew(tmp, s3c_rtc_base + S3C2410_RTCCON);
102 } else { 110 } else {
103 tmp = readb(s3c_rtc_base + S3C2410_TICNT); 111 tmp = readb(s3c_rtc_base + S3C2410_TICNT);
104 tmp &= ~S3C2410_TICNT_ENABLE; 112 tmp &= ~S3C2410_TICNT_ENABLE;
@@ -132,7 +140,7 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)
132 140
133 tmp |= (rtc_dev->max_user_freq / freq)-1; 141 tmp |= (rtc_dev->max_user_freq / freq)-1;
134 142
135 writeb(tmp, s3c_rtc_base + S3C2410_TICNT); 143 writel(tmp, s3c_rtc_base + S3C2410_TICNT);
136 spin_unlock_irq(&s3c_rtc_pie_lock); 144 spin_unlock_irq(&s3c_rtc_pie_lock);
137 145
138 return 0; 146 return 0;