diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-mips/mc146818-time.h | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/include/asm-mips/mc146818-time.h b/include/asm-mips/mc146818-time.h index 47214861093b..41ac8d363c67 100644 --- a/include/asm-mips/mc146818-time.h +++ b/include/asm-mips/mc146818-time.h | |||
@@ -86,43 +86,14 @@ static inline int mc146818_set_rtc_mmss(unsigned long nowtime) | |||
86 | return retval; | 86 | return retval; |
87 | } | 87 | } |
88 | 88 | ||
89 | /* | ||
90 | * Returns true if a clock update is in progress | ||
91 | */ | ||
92 | static inline unsigned char rtc_is_updating(void) | ||
93 | { | ||
94 | unsigned char uip; | ||
95 | unsigned long flags; | ||
96 | |||
97 | spin_lock_irqsave(&rtc_lock, flags); | ||
98 | uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP); | ||
99 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
100 | return uip; | ||
101 | } | ||
102 | |||
103 | static inline unsigned long mc146818_get_cmos_time(void) | 89 | static inline unsigned long mc146818_get_cmos_time(void) |
104 | { | 90 | { |
105 | unsigned int year, mon, day, hour, min, sec; | 91 | unsigned int year, mon, day, hour, min, sec; |
106 | int i; | ||
107 | unsigned long flags; | 92 | unsigned long flags; |
108 | 93 | ||
109 | /* | ||
110 | * The Linux interpretation of the CMOS clock register contents: | ||
111 | * When the Update-In-Progress (UIP) flag goes from 1 to 0, the | ||
112 | * RTC registers show the second which has precisely just started. | ||
113 | * Let's hope other operating systems interpret the RTC the same way. | ||
114 | */ | ||
115 | |||
116 | /* read RTC exactly on falling edge of update flag */ | ||
117 | for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ | ||
118 | if (rtc_is_updating()) | ||
119 | break; | ||
120 | for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */ | ||
121 | if (!rtc_is_updating()) | ||
122 | break; | ||
123 | |||
124 | spin_lock_irqsave(&rtc_lock, flags); | 94 | spin_lock_irqsave(&rtc_lock, flags); |
125 | do { /* Isn't this overkill ? UIP above should guarantee consistency */ | 95 | |
96 | do { | ||
126 | sec = CMOS_READ(RTC_SECONDS); | 97 | sec = CMOS_READ(RTC_SECONDS); |
127 | min = CMOS_READ(RTC_MINUTES); | 98 | min = CMOS_READ(RTC_MINUTES); |
128 | hour = CMOS_READ(RTC_HOURS); | 99 | hour = CMOS_READ(RTC_HOURS); |