diff options
Diffstat (limited to 'arch/ppc/platforms/chrp_time.c')
-rw-r--r-- | arch/ppc/platforms/chrp_time.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/arch/ppc/platforms/chrp_time.c b/arch/ppc/platforms/chrp_time.c index c8627770af13..e103a36e11a5 100644 --- a/arch/ppc/platforms/chrp_time.c +++ b/arch/ppc/platforms/chrp_time.c | |||
@@ -119,33 +119,15 @@ int chrp_set_rtc_time(unsigned long nowtime) | |||
119 | unsigned long chrp_get_rtc_time(void) | 119 | unsigned long chrp_get_rtc_time(void) |
120 | { | 120 | { |
121 | unsigned int year, mon, day, hour, min, sec; | 121 | unsigned int year, mon, day, hour, min, sec; |
122 | int uip, i; | ||
123 | 122 | ||
124 | /* The Linux interpretation of the CMOS clock register contents: | 123 | do { |
125 | * When the Update-In-Progress (UIP) flag goes from 1 to 0, the | ||
126 | * RTC registers show the second which has precisely just started. | ||
127 | * Let's hope other operating systems interpret the RTC the same way. | ||
128 | */ | ||
129 | |||
130 | /* Since the UIP flag is set for about 2.2 ms and the clock | ||
131 | * is typically written with a precision of 1 jiffy, trying | ||
132 | * to obtain a precision better than a few milliseconds is | ||
133 | * an illusion. Only consistency is interesting, this also | ||
134 | * allows to use the routine for /dev/rtc without a potential | ||
135 | * 1 second kernel busy loop triggered by any reader of /dev/rtc. | ||
136 | */ | ||
137 | |||
138 | for ( i = 0; i<1000000; i++) { | ||
139 | uip = chrp_cmos_clock_read(RTC_FREQ_SELECT); | ||
140 | sec = chrp_cmos_clock_read(RTC_SECONDS); | 124 | sec = chrp_cmos_clock_read(RTC_SECONDS); |
141 | min = chrp_cmos_clock_read(RTC_MINUTES); | 125 | min = chrp_cmos_clock_read(RTC_MINUTES); |
142 | hour = chrp_cmos_clock_read(RTC_HOURS); | 126 | hour = chrp_cmos_clock_read(RTC_HOURS); |
143 | day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH); | 127 | day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH); |
144 | mon = chrp_cmos_clock_read(RTC_MONTH); | 128 | mon = chrp_cmos_clock_read(RTC_MONTH); |
145 | year = chrp_cmos_clock_read(RTC_YEAR); | 129 | year = chrp_cmos_clock_read(RTC_YEAR); |
146 | uip |= chrp_cmos_clock_read(RTC_FREQ_SELECT); | 130 | } while (sec != chrp_cmos_clock_read(RTC_SECONDS)); |
147 | if ((uip & RTC_UIP)==0) break; | ||
148 | } | ||
149 | 131 | ||
150 | if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) | 132 | if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) |
151 | { | 133 | { |