[POWERPC] Fix timekeeping on PowerPC 601
Recent changes to the timekeeping code broke support for the PowerPC 601 processor which doesn't have the usual timebase facility but a slightly different thing called (yuck) the RTC. This fixes it, boot tested on an old 601 based PowerMac 7200. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
7b5acbaac3
commit
c27da33969
2 changed files with 10 additions and 3 deletions
|
@ -239,7 +239,7 @@ static void snapshot_tb_and_purr(void *data)
|
||||||
struct cpu_purr_data *p = &__get_cpu_var(cpu_purr_data);
|
struct cpu_purr_data *p = &__get_cpu_var(cpu_purr_data);
|
||||||
|
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
p->tb = mftb();
|
p->tb = get_tb_or_rtc();
|
||||||
p->purr = mfspr(SPRN_PURR);
|
p->purr = mfspr(SPRN_PURR);
|
||||||
wmb();
|
wmb();
|
||||||
p->initialized = 1;
|
p->initialized = 1;
|
||||||
|
@ -317,7 +317,7 @@ static void snapshot_purr(void)
|
||||||
*/
|
*/
|
||||||
void snapshot_timebase(void)
|
void snapshot_timebase(void)
|
||||||
{
|
{
|
||||||
__get_cpu_var(last_jiffy) = get_tb();
|
__get_cpu_var(last_jiffy) = get_tb_or_rtc();
|
||||||
snapshot_purr();
|
snapshot_purr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,6 +684,8 @@ void timer_interrupt(struct pt_regs * regs)
|
||||||
|
|
||||||
write_seqlock(&xtime_lock);
|
write_seqlock(&xtime_lock);
|
||||||
tb_next_jiffy = tb_last_jiffy + tb_ticks_per_jiffy;
|
tb_next_jiffy = tb_last_jiffy + tb_ticks_per_jiffy;
|
||||||
|
if (__USE_RTC() && tb_next_jiffy >= 1000000000)
|
||||||
|
tb_next_jiffy -= 1000000000;
|
||||||
if (per_cpu(last_jiffy, cpu) >= tb_next_jiffy) {
|
if (per_cpu(last_jiffy, cpu) >= tb_next_jiffy) {
|
||||||
tb_last_jiffy = tb_next_jiffy;
|
tb_last_jiffy = tb_next_jiffy;
|
||||||
do_timer(1);
|
do_timer(1);
|
||||||
|
@ -977,7 +979,7 @@ void __init time_init(void)
|
||||||
tb_to_ns_scale = scale;
|
tb_to_ns_scale = scale;
|
||||||
tb_to_ns_shift = shift;
|
tb_to_ns_shift = shift;
|
||||||
/* Save the current timebase to pretty up CONFIG_PRINTK_TIME */
|
/* Save the current timebase to pretty up CONFIG_PRINTK_TIME */
|
||||||
boot_tb = get_tb();
|
boot_tb = get_tb_or_rtc();
|
||||||
|
|
||||||
tm = get_boot_time();
|
tm = get_boot_time();
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,11 @@ static inline u64 get_tb(void)
|
||||||
}
|
}
|
||||||
#endif /* !CONFIG_PPC64 */
|
#endif /* !CONFIG_PPC64 */
|
||||||
|
|
||||||
|
static inline u64 get_tb_or_rtc(void)
|
||||||
|
{
|
||||||
|
return __USE_RTC() ? get_rtc() : get_tb();
|
||||||
|
}
|
||||||
|
|
||||||
static inline void set_tb(unsigned int upper, unsigned int lower)
|
static inline void set_tb(unsigned int upper, unsigned int lower)
|
||||||
{
|
{
|
||||||
mtspr(SPRN_TBWL, 0);
|
mtspr(SPRN_TBWL, 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue