diff options
author | Paul Mackerras <paulus@samba.org> | 2005-11-17 23:52:38 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-11-17 23:52:38 -0500 |
commit | 49e16b7becd6320bde51aa238c11815708f836d9 (patch) | |
tree | 38f6159992e890abe1134cecfff36b94146b4065 /arch/powerpc | |
parent | 6146eed1e972a7de93ce2e36adc5812de81e879c (diff) |
powerpc: time-of-day fixes for 32-bit CHRP systems
This makes 32-bit CHRP systems use the RTAS time-of-day routines if
available. It fixes a bug in the RTAS time-of-day routines where they
were storing a 64-bit timebase value in an unsigned long by making
those variables u64. Also, the direct-access time-of-day routines
had the wrong convention for the month and year in the struct rtc_time.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/rtas-rtc.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/chrp/setup.c | 11 | ||||
-rw-r--r-- | arch/powerpc/platforms/chrp/time.c | 3 |
3 files changed, 14 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/rtas-rtc.c b/arch/powerpc/kernel/rtas-rtc.c index 7b948662704c..635d3b9a8811 100644 --- a/arch/powerpc/kernel/rtas-rtc.c +++ b/arch/powerpc/kernel/rtas-rtc.c | |||
@@ -15,7 +15,7 @@ unsigned long __init rtas_get_boot_time(void) | |||
15 | { | 15 | { |
16 | int ret[8]; | 16 | int ret[8]; |
17 | int error, wait_time; | 17 | int error, wait_time; |
18 | unsigned long max_wait_tb; | 18 | u64 max_wait_tb; |
19 | 19 | ||
20 | max_wait_tb = get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT; | 20 | max_wait_tb = get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT; |
21 | do { | 21 | do { |
@@ -45,7 +45,7 @@ void rtas_get_rtc_time(struct rtc_time *rtc_tm) | |||
45 | { | 45 | { |
46 | int ret[8]; | 46 | int ret[8]; |
47 | int error, wait_time; | 47 | int error, wait_time; |
48 | unsigned long max_wait_tb; | 48 | u64 max_wait_tb; |
49 | 49 | ||
50 | max_wait_tb = get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT; | 50 | max_wait_tb = get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT; |
51 | do { | 51 | do { |
@@ -80,7 +80,7 @@ void rtas_get_rtc_time(struct rtc_time *rtc_tm) | |||
80 | int rtas_set_rtc_time(struct rtc_time *tm) | 80 | int rtas_set_rtc_time(struct rtc_time *tm) |
81 | { | 81 | { |
82 | int error, wait_time; | 82 | int error, wait_time; |
83 | unsigned long max_wait_tb; | 83 | u64 max_wait_tb; |
84 | 84 | ||
85 | max_wait_tb = get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT; | 85 | max_wait_tb = get_tb() + tb_ticks_per_usec * 1000 * MAX_RTC_WAIT; |
86 | do { | 86 | do { |
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c index 4099ddab9205..dda5f2c72c25 100644 --- a/arch/powerpc/platforms/chrp/setup.c +++ b/arch/powerpc/platforms/chrp/setup.c | |||
@@ -257,6 +257,13 @@ void __init chrp_setup_arch(void) | |||
257 | if (rtas_token("display-character") >= 0) | 257 | if (rtas_token("display-character") >= 0) |
258 | ppc_md.progress = rtas_progress; | 258 | ppc_md.progress = rtas_progress; |
259 | 259 | ||
260 | /* use RTAS time-of-day routines if available */ | ||
261 | if (rtas_token("get-time-of-day") != RTAS_UNKNOWN_SERVICE) { | ||
262 | ppc_md.get_boot_time = rtas_get_boot_time; | ||
263 | ppc_md.get_rtc_time = rtas_get_rtc_time; | ||
264 | ppc_md.set_rtc_time = rtas_set_rtc_time; | ||
265 | } | ||
266 | |||
260 | #ifdef CONFIG_BOOTX_TEXT | 267 | #ifdef CONFIG_BOOTX_TEXT |
261 | if (ppc_md.progress == NULL && boot_text_mapped) | 268 | if (ppc_md.progress == NULL && boot_text_mapped) |
262 | ppc_md.progress = btext_progress; | 269 | ppc_md.progress = btext_progress; |
@@ -505,9 +512,11 @@ void __init chrp_init(void) | |||
505 | ppc_md.halt = rtas_halt; | 512 | ppc_md.halt = rtas_halt; |
506 | 513 | ||
507 | ppc_md.time_init = chrp_time_init; | 514 | ppc_md.time_init = chrp_time_init; |
515 | ppc_md.calibrate_decr = chrp_calibrate_decr; | ||
516 | |||
517 | /* this may get overridden with rtas routines later... */ | ||
508 | ppc_md.set_rtc_time = chrp_set_rtc_time; | 518 | ppc_md.set_rtc_time = chrp_set_rtc_time; |
509 | ppc_md.get_rtc_time = chrp_get_rtc_time; | 519 | ppc_md.get_rtc_time = chrp_get_rtc_time; |
510 | ppc_md.calibrate_decr = chrp_calibrate_decr; | ||
511 | 520 | ||
512 | #ifdef CONFIG_SMP | 521 | #ifdef CONFIG_SMP |
513 | smp_ops = &chrp_smp_ops; | 522 | smp_ops = &chrp_smp_ops; |
diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c index 9e53535ddb82..737ee5d9f0aa 100644 --- a/arch/powerpc/platforms/chrp/time.c +++ b/arch/powerpc/platforms/chrp/time.c | |||
@@ -87,7 +87,6 @@ int chrp_set_rtc_time(struct rtc_time *tmarg) | |||
87 | 87 | ||
88 | chrp_cmos_clock_write((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT); | 88 | chrp_cmos_clock_write((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT); |
89 | 89 | ||
90 | tm.tm_year -= 1900; | ||
91 | if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { | 90 | if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { |
92 | BIN_TO_BCD(tm.tm_sec); | 91 | BIN_TO_BCD(tm.tm_sec); |
93 | BIN_TO_BCD(tm.tm_min); | 92 | BIN_TO_BCD(tm.tm_min); |
@@ -156,7 +155,7 @@ void chrp_get_rtc_time(struct rtc_time *tm) | |||
156 | BCD_TO_BIN(mon); | 155 | BCD_TO_BIN(mon); |
157 | BCD_TO_BIN(year); | 156 | BCD_TO_BIN(year); |
158 | } | 157 | } |
159 | if ((year += 1900) < 1970) | 158 | if (year < 70) |
160 | year += 100; | 159 | year += 100; |
161 | tm->tm_sec = sec; | 160 | tm->tm_sec = sec; |
162 | tm->tm_min = min; | 161 | tm->tm_min = min; |