aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMatt Mackall <mpm@selenic.com>2006-03-28 04:56:02 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-28 12:16:00 -0500
commit59937bcdb2bd759d15c792d9798a00da03bf1f48 (patch)
treebecb72ca7fbbb07e4bd86097f6eb2f529fb3ef8e /arch
parent3dedf53bb16e27743e5d1f49dbfecf3e5897befa (diff)
[PATCH] RTC: Remove RTC UIP synchronization on PPC CHRP (arch/ppc)
Signed-off-by: Matt Mackall <mpm@selenic.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/ppc/platforms/chrp_time.c22
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)
119unsigned long chrp_get_rtc_time(void) 119unsigned 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 {