9 #include <linux/kernel.h>
10 #include <linux/sched.h>
11 #include <linux/time.h>
13 #include <linux/rtc.h>
18 #define RTC_BASE 0xb0000000
19 #define RTC_SEC1 (RTC_BASE + 0)
20 #define RTC_SEC10 (RTC_BASE + 1)
21 #define RTC_MIN1 (RTC_BASE + 2)
22 #define RTC_MIN10 (RTC_BASE + 3)
23 #define RTC_HOU1 (RTC_BASE + 4)
24 #define RTC_HOU10 (RTC_BASE + 5)
25 #define RTC_WEE1 (RTC_BASE + 6)
26 #define RTC_DAY1 (RTC_BASE + 7)
27 #define RTC_DAY10 (RTC_BASE + 8)
28 #define RTC_MON1 (RTC_BASE + 9)
29 #define RTC_MON10 (RTC_BASE + 10)
30 #define RTC_YEA1 (RTC_BASE + 11)
31 #define RTC_YEA10 (RTC_BASE + 12)
32 #define RTC_YEA100 (RTC_BASE + 13)
33 #define RTC_YEA1000 (RTC_BASE + 14)
34 #define RTC_CTL (RTC_BASE + 15)
44 spin_lock(&sh03_rtc_lock);
56 if (year == 0 || mon < 1 || mon > 12 || day > 31 || day < 1 ||
57 hour > 23 || min > 59 || sec > 59) {
59 "SH-03 RTC: invalid value, resetting to 1 Jan 2000\n");
60 printk(
"year=%d, mon=%d, day=%d, hour=%d, min=%d, sec=%d\n",
61 year, mon, day, hour, min, sec);
76 spin_unlock(&sh03_rtc_lock);
77 return mktime(year, mon, day, hour, min, sec);
90 int real_seconds, real_minutes, cmos_minutes;
94 spin_lock(&sh03_rtc_lock);
95 for (i = 0 ; i < 1000000 ; i++)
99 real_seconds = nowtime % 60;
100 real_minutes = nowtime / 60;
101 if (((
abs(real_minutes - cmos_minutes) + 15)/30) & 1)
105 if (
abs(real_minutes - cmos_minutes) < 30) {
112 "set_rtc_mmss: can't update from %d to %d\n",
113 cmos_minutes, real_minutes);
116 spin_unlock(&sh03_rtc_lock);
123 unsigned long nowtime = secs;