RTC: class driver for Samsung S3C series SoC
RFC 1/1 RTC: class driver for Samsung S3C series SoC
This is a renamed and tested version of the previous S3C24XX RTC class driver.
The driver has been renamed from the original s3c2410-rtc, which is now too narrow for the range of devices supported.
The rtc-s3c has been chosen as there is the distinct possibility of this driver being carried forward into newer Samsung SoC silicon.
drivers/rtc/Kconfig +16 -0
@@ -172,6 +172,22 @@ config RTC_DRV_RS5C372 This driver can also be built as a module. If so, the module will be called rtc-rs5c372. +config RTC_DRV_S3C + tristate "Samsung S3C series SoC RTC" + depends on RTC_CLASS && ARCH_S3C2410 + help + RTC (Realtime Clock) driver for the clock inbuilt into the + Samsung S3C24XX series of SoCs. This can provide periodic + interrupt rates from 1Hz to 64Hz for user programs, and + wakeup from Alarm. + + The driver currently supports the common features on all the + S3C24XX range, such as the S3C2410, S3C2412, S3C2413, S3C2440 + and S3C2442. + + This driver can also be build as a module. If so, the module + will be called rtc-s3c. + config RTC_DRV_M48T86 tristate "ST M48T86/Dallas DS12887" depends on RTC_CLASS
drivers/rtc/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds17 obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o +obj-$(CONFIG_RTC_DRV_S3C) += rtc-s3c.o obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o
drivers/rtc/rtc-s3c.c +615 -0
615 lines not on this page · raw message
Quoted 13 lines · Ben Dooks
This is a renamed and tested version of the previous S3C24XX RTC class driver.
The driver has been renamed from the original s3c2410-rtc, which is now too narrow for the range of devices supported.
The rtc-s3c has been chosen as there is the distinct possibility of this driver being carried forward into newer Samsung SoC silicon.
Review
Quoted 2 lines
(quoted diff) +2
-0+#undef S3C24XX_VA_RTC +#define S3C24XX_VA_RTC s3c_rtc_base
This appears to be unused?
Review
Quoted 11 lines
(quoted diff) +11
-0+static int s3c_rtc_open(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct rtc_device *rtc_dev = platform_get_drvdata(pdev); + int ret; + + ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq, + SA_INTERRUPT, "s3c2410-rtc alarm", rtc_dev); + + if (ret) + dev_err(dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret);
I suspect you wanted a `return ret;' here.
Quoted 4 lines
(quoted diff) +4
-0+ ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq, + SA_INTERRUPT, "s3c2410-rtc tick", rtc_dev); + + if (ret) {
Review
Quoted 10 lines
(quoted diff) +10
-0+ dev_err(dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret); + goto tick_err; + } + + return ret; + + tick_err: + free_irq(s3c_rtc_alarmno, rtc_dev); + return ret; +}
Are you sure you want spaces in the interrupt identifiers? It'll make parsing of /proc/interrupts harder, although I don't know that we're at all consistent about that.
From: Andrew Morton <[email protected]>
---
drivers/rtc/rtc-s3c.c | 36 ++++++++++++++---------------------- 1 files changed, 14 insertions(+), 22 deletions(-)
drivers/rtc/rtc-s3c.c renamed from drivers/rtc/rtc-s3c.c~rtc-class-driver-for-samsung-s3c-series-soc-tidy +14 -22
@@ -34,9 +34,6 @@/* I have yet to find an S3C implementation with more than one * of these rtc blocks in */ -#undef S3C24XX_VA_RTC -#define S3C24XX_VA_RTC s3c_rtc_base -static struct resource *s3c_rtc_mem;static void __iomem *s3c_rtc_base;
@@ -45,6 +42,7 @@ static int s3c_rtc_tickno = NO_IRQ;static int s3c_rtc_freq =1 ;static DEFINE_SPINLOCK (s3c_rtc_pie_lock); +static unsigned int tick_count;/* IRQ Handlers */
@@ -56,8 +54,6 @@ static irqreturn_t s3c_rtc_alarmirq(intreturn IRQ_HANDLED ; } -static unsigned int tick_count; -static irqreturn_t s3c_rtc_tickirq (int irq,void *id,struct pt_regs *r) {struct rtc_device *rdev = id;
@@ -153,7 +149,6 @@ static int s3c_rtc_gettime(struct devicereturn 0 ; } -static int s3c_rtc_settime (struct device *dev,struct rtc_time *tm) {/* the rtc gets round the y2k problem by just not supporting it */
@@ -193,29 +188,25 @@ static int s3c_rtc_getalarm(struct devic/* decode the alarm enable field */ -if (alm_en &S3C2410_RTCALM_SECEN ) { +if (alm_en &S3C2410_RTCALM_SECEN )BCD_TO_BIN (alm_tm->tm_sec); - }else { +else alm_tm->tm_sec =0xff ; - } -if (alm_en &S3C2410_RTCALM_MINEN ) { +if (alm_en &S3C2410_RTCALM_MINEN )BCD_TO_BIN (alm_tm->tm_min); - }else { +else alm_tm->tm_min =0xff ; - } -if (alm_en &S3C2410_RTCALM_HOUREN ) { +if (alm_en &S3C2410_RTCALM_HOUREN )BCD_TO_BIN (alm_tm->tm_hour); - }else { +else alm_tm->tm_hour =0xff ; - } -if (alm_en &S3C2410_RTCALM_DAYEN ) { +if (alm_en &S3C2410_RTCALM_DAYEN )BCD_TO_BIN (alm_tm->tm_mday); - }else { +else alm_tm->tm_mday =0xff ; - }if (alm_en &S3C2410_RTCALM_MONEN ) {BCD_TO_BIN (alm_tm->tm_mon);
@@ -224,11 +215,10 @@ static int s3c_rtc_getalarm(struct devic alm_tm->tm_mon =0xff ; } -if (alm_en &S3C2410_RTCALM_YEAREN ) { +if (alm_en &S3C2410_RTCALM_YEAREN )BCD_TO_BIN (alm_tm->tm_year); - }else { +else alm_tm->tm_year =0xffff ; - }return 0 ; }
@@ -352,8 +342,10 @@ static int s3c_rtc_open(struct device *d ret =request_irq (s3c_rtc_alarmno, s3c_rtc_alarmirq,SA_INTERRUPT ,"s3c2410-rtc alarm" , rtc_dev); -if (ret) +if (ret) {dev_err (dev,"IRQ%d error %d\n" , s3c_rtc_alarmno, ret); +return ret; + } ret =request_irq (s3c_rtc_tickno, s3c_rtc_tickirq,SA_INTERRUPT ,"s3c2410-rtc tick" , rtc_dev);
_