Skip to content

Commit

Permalink
rtc: rtc-s3c: Updates driver for S3C64XX and newer SoCs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Atul Dahiya authored and Kukjin Kim committed Aug 5, 2010
1 parent 002d31e commit 2f3478f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/rtc/rtc-s3c.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ static irqreturn_t s3c_rtc_alarmirq(int irq, void *id)
struct rtc_device *rdev = id;

rtc_update_irq(rdev, 1, RTC_AF | RTC_IRQF);

if (s3c_rtc_cpu_type == TYPE_S3C64XX)
writeb(S3C2410_INTP_ALM, s3c_rtc_base + S3C2410_INTP);

return IRQ_HANDLED;
}

Expand All @@ -65,6 +69,10 @@ static irqreturn_t s3c_rtc_tickirq(int irq, void *id)
struct rtc_device *rdev = id;

rtc_update_irq(rdev, 1, RTC_PF | RTC_IRQF);

if (s3c_rtc_cpu_type == TYPE_S3C64XX)
writeb(S3C2410_INTP_TIC, s3c_rtc_base + S3C2410_INTP);

return IRQ_HANDLED;
}

Expand Down Expand Up @@ -98,7 +106,7 @@ static int s3c_rtc_setpie(struct device *dev, int enabled)
if (enabled)
tmp |= S3C64XX_RTCCON_TICEN;

writeb(tmp, s3c_rtc_base + S3C2410_RTCCON);
writew(tmp, s3c_rtc_base + S3C2410_RTCCON);
} else {
tmp = readb(s3c_rtc_base + S3C2410_TICNT);
tmp &= ~S3C2410_TICNT_ENABLE;
Expand Down Expand Up @@ -132,7 +140,7 @@ static int s3c_rtc_setfreq(struct device *dev, int freq)

tmp |= (rtc_dev->max_user_freq / freq)-1;

writeb(tmp, s3c_rtc_base + S3C2410_TICNT);
writel(tmp, s3c_rtc_base + S3C2410_TICNT);
spin_unlock_irq(&s3c_rtc_pie_lock);

return 0;
Expand Down

0 comments on commit 2f3478f

Please sign in to comment.