aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rtc/rtc-s3c.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index aacbfea98678..2c7de79c83b9 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -153,24 +153,25 @@ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
153static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) 153static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)
154{ 154{
155 void __iomem *base = s3c_rtc_base; 155 void __iomem *base = s3c_rtc_base;
156 int year = tm->tm_year - 100;
156 157
157 /* the rtc gets round the y2k problem by just not supporting it */ 158 pr_debug("set time %02d.%02d.%02d %02d/%02d/%02d\n",
159 tm->tm_year, tm->tm_mon, tm->tm_mday,
160 tm->tm_hour, tm->tm_min, tm->tm_sec);
161
162 /* we get around y2k by simply not supporting it */
158 163
159 if (tm->tm_year > 100) { 164 if (year < 0 || year >= 100) {
160 dev_err(dev, "rtc only supports 100 years\n"); 165 dev_err(dev, "rtc only supports 100 years\n");
161 return -EINVAL; 166 return -EINVAL;
162 } 167 }
163 168
164 pr_debug("set time %02d.%02d.%02d %02d/%02d/%02d\n",
165 tm->tm_year, tm->tm_mon, tm->tm_mday,
166 tm->tm_hour, tm->tm_min, tm->tm_sec);
167
168 writeb(BIN2BCD(tm->tm_sec), base + S3C2410_RTCSEC); 169 writeb(BIN2BCD(tm->tm_sec), base + S3C2410_RTCSEC);
169 writeb(BIN2BCD(tm->tm_min), base + S3C2410_RTCMIN); 170 writeb(BIN2BCD(tm->tm_min), base + S3C2410_RTCMIN);
170 writeb(BIN2BCD(tm->tm_hour), base + S3C2410_RTCHOUR); 171 writeb(BIN2BCD(tm->tm_hour), base + S3C2410_RTCHOUR);
171 writeb(BIN2BCD(tm->tm_mday), base + S3C2410_RTCDATE); 172 writeb(BIN2BCD(tm->tm_mday), base + S3C2410_RTCDATE);
172 writeb(BIN2BCD(tm->tm_mon + 1), base + S3C2410_RTCMON); 173 writeb(BIN2BCD(tm->tm_mon + 1), base + S3C2410_RTCMON);
173 writeb(BIN2BCD(tm->tm_year - 100), base + S3C2410_RTCYEAR); 174 writeb(BIN2BCD(year), base + S3C2410_RTCYEAR);
174 175
175 return 0; 176 return 0;
176} 177}