summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-s3c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-s3c.c')
-rw-r--r--drivers/rtc/rtc-s3c.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 75c8c5033e08..04c68178c42d 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -225,13 +225,9 @@ retry_get_time:
225 s3c_rtc_disable_clk(info); 225 s3c_rtc_disable_clk(info);
226 226
227 rtc_tm->tm_year += 100; 227 rtc_tm->tm_year += 100;
228
229 dev_dbg(dev, "read time %04d.%02d.%02d %02d:%02d:%02d\n",
230 1900 + rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday,
231 rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec);
232
233 rtc_tm->tm_mon -= 1; 228 rtc_tm->tm_mon -= 1;
234 229
230 dev_dbg(dev, "read time %ptR\n", rtc_tm);
235 return 0; 231 return 0;
236} 232}
237 233
@@ -241,9 +237,7 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)
241 int year = tm->tm_year - 100; 237 int year = tm->tm_year - 100;
242 int ret; 238 int ret;
243 239
244 dev_dbg(dev, "set time %04d.%02d.%02d %02d:%02d:%02d\n", 240 dev_dbg(dev, "set time %ptR\n", tm);
245 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday,
246 tm->tm_hour, tm->tm_min, tm->tm_sec);
247 241
248 /* we get around y2k by simply not supporting it */ 242 /* we get around y2k by simply not supporting it */
249 243
@@ -292,10 +286,7 @@ static int s3c_rtc_getalarm(struct device *dev, struct rtc_wkalrm *alrm)
292 286
293 alrm->enabled = (alm_en & S3C2410_RTCALM_ALMEN) ? 1 : 0; 287 alrm->enabled = (alm_en & S3C2410_RTCALM_ALMEN) ? 1 : 0;
294 288
295 dev_dbg(dev, "read alarm %d, %04d.%02d.%02d %02d:%02d:%02d\n", 289 dev_dbg(dev, "read alarm %d, %ptR\n", alm_en, alm_tm);
296 alm_en,
297 1900 + alm_tm->tm_year, alm_tm->tm_mon, alm_tm->tm_mday,
298 alm_tm->tm_hour, alm_tm->tm_min, alm_tm->tm_sec);
299 290
300 /* decode the alarm enable field */ 291 /* decode the alarm enable field */
301 if (alm_en & S3C2410_RTCALM_SECEN) 292 if (alm_en & S3C2410_RTCALM_SECEN)
@@ -327,12 +318,8 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
327 struct rtc_time *tm = &alrm->time; 318 struct rtc_time *tm = &alrm->time;
328 unsigned int alrm_en; 319 unsigned int alrm_en;
329 int ret; 320 int ret;
330 int year = tm->tm_year - 100;
331 321
332 dev_dbg(dev, "s3c_rtc_setalarm: %d, %04d.%02d.%02d %02d:%02d:%02d\n", 322 dev_dbg(dev, "s3c_rtc_setalarm: %d, %ptR\n", alrm->enabled, tm);
333 alrm->enabled,
334 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday,
335 tm->tm_hour, tm->tm_min, tm->tm_sec);
336 323
337 ret = s3c_rtc_enable_clk(info); 324 ret = s3c_rtc_enable_clk(info);
338 if (ret) 325 if (ret)
@@ -356,11 +343,6 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
356 writeb(bin2bcd(tm->tm_hour), info->base + S3C2410_ALMHOUR); 343 writeb(bin2bcd(tm->tm_hour), info->base + S3C2410_ALMHOUR);
357 } 344 }
358 345
359 if (year < 100 && year >= 0) {
360 alrm_en |= S3C2410_RTCALM_YEAREN;
361 writeb(bin2bcd(year), info->base + S3C2410_ALMYEAR);
362 }
363
364 if (tm->tm_mon < 12 && tm->tm_mon >= 0) { 346 if (tm->tm_mon < 12 && tm->tm_mon >= 0) {
365 alrm_en |= S3C2410_RTCALM_MONEN; 347 alrm_en |= S3C2410_RTCALM_MONEN;
366 writeb(bin2bcd(tm->tm_mon + 1), info->base + S3C2410_ALMMON); 348 writeb(bin2bcd(tm->tm_mon + 1), info->base + S3C2410_ALMMON);