aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/time.c
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2012-03-15 14:18:00 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-03-20 20:16:11 -0400
commitf5339277eb8d3aed37f12a27988366f68ab68930 (patch)
tree4b8f14bb6144b128a2d3741aad21bfe24ba15b0d /arch/powerpc/kernel/time.c
parentec86b45af464d2d3c00d1125b220d6c3b6ca93d8 (diff)
powerpc: Remove FW_FEATURE ISERIES from arch code
This is no longer selectable, so just remove all the dependent code. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/time.c')
-rw-r--r--arch/powerpc/kernel/time.c108
1 files changed, 3 insertions, 105 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index f81c81b92f0e..2c42cd72d0f5 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -17,8 +17,7 @@
17 * 17 *
18 * TODO (not necessarily in this file): 18 * TODO (not necessarily in this file):
19 * - improve precision and reproducibility of timebase frequency 19 * - improve precision and reproducibility of timebase frequency
20 * measurement at boot time. (for iSeries, we calibrate the timebase 20 * measurement at boot time.
21 * against the Titan chip's clock.)
22 * - for astronomical applications: add a new function to get 21 * - for astronomical applications: add a new function to get
23 * non ambiguous timestamps even around leap seconds. This needs 22 * non ambiguous timestamps even around leap seconds. This needs
24 * a new timestamp format and a good name. 23 * a new timestamp format and a good name.
@@ -70,10 +69,6 @@
70#include <asm/vdso_datapage.h> 69#include <asm/vdso_datapage.h>
71#include <asm/firmware.h> 70#include <asm/firmware.h>
72#include <asm/cputime.h> 71#include <asm/cputime.h>
73#ifdef CONFIG_PPC_ISERIES
74#include <asm/iseries/it_lp_queue.h>
75#include <asm/iseries/hv_call_xm.h>
76#endif
77 72
78/* powerpc clocksource/clockevent code */ 73/* powerpc clocksource/clockevent code */
79 74
@@ -117,14 +112,6 @@ static struct clock_event_device decrementer_clockevent = {
117DEFINE_PER_CPU(u64, decrementers_next_tb); 112DEFINE_PER_CPU(u64, decrementers_next_tb);
118static DEFINE_PER_CPU(struct clock_event_device, decrementers); 113static DEFINE_PER_CPU(struct clock_event_device, decrementers);
119 114
120#ifdef CONFIG_PPC_ISERIES
121static unsigned long __initdata iSeries_recal_titan;
122static signed long __initdata iSeries_recal_tb;
123
124/* Forward declaration is only needed for iSereis compiles */
125static void __init clocksource_init(void);
126#endif
127
128#define XSEC_PER_SEC (1024*1024) 115#define XSEC_PER_SEC (1024*1024)
129 116
130#ifdef CONFIG_PPC64 117#ifdef CONFIG_PPC64
@@ -423,74 +410,6 @@ unsigned long profile_pc(struct pt_regs *regs)
423EXPORT_SYMBOL(profile_pc); 410EXPORT_SYMBOL(profile_pc);
424#endif 411#endif
425 412
426#ifdef CONFIG_PPC_ISERIES
427
428/*
429 * This function recalibrates the timebase based on the 49-bit time-of-day
430 * value in the Titan chip. The Titan is much more accurate than the value
431 * returned by the service processor for the timebase frequency.
432 */
433
434static int __init iSeries_tb_recal(void)
435{
436 unsigned long titan, tb;
437
438 /* Make sure we only run on iSeries */
439 if (!firmware_has_feature(FW_FEATURE_ISERIES))
440 return -ENODEV;
441
442 tb = get_tb();
443 titan = HvCallXm_loadTod();
444 if ( iSeries_recal_titan ) {
445 unsigned long tb_ticks = tb - iSeries_recal_tb;
446 unsigned long titan_usec = (titan - iSeries_recal_titan) >> 12;
447 unsigned long new_tb_ticks_per_sec = (tb_ticks * USEC_PER_SEC)/titan_usec;
448 unsigned long new_tb_ticks_per_jiffy =
449 DIV_ROUND_CLOSEST(new_tb_ticks_per_sec, HZ);
450 long tick_diff = new_tb_ticks_per_jiffy - tb_ticks_per_jiffy;
451 char sign = '+';
452 /* make sure tb_ticks_per_sec and tb_ticks_per_jiffy are consistent */
453 new_tb_ticks_per_sec = new_tb_ticks_per_jiffy * HZ;
454
455 if ( tick_diff < 0 ) {
456 tick_diff = -tick_diff;
457 sign = '-';
458 }
459 if ( tick_diff ) {
460 if ( tick_diff < tb_ticks_per_jiffy/25 ) {
461 printk( "Titan recalibrate: new tb_ticks_per_jiffy = %lu (%c%ld)\n",
462 new_tb_ticks_per_jiffy, sign, tick_diff );
463 tb_ticks_per_jiffy = new_tb_ticks_per_jiffy;
464 tb_ticks_per_sec = new_tb_ticks_per_sec;
465 calc_cputime_factors();
466 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec;
467 setup_cputime_one_jiffy();
468 }
469 else {
470 printk( "Titan recalibrate: FAILED (difference > 4 percent)\n"
471 " new tb_ticks_per_jiffy = %lu\n"
472 " old tb_ticks_per_jiffy = %lu\n",
473 new_tb_ticks_per_jiffy, tb_ticks_per_jiffy );
474 }
475 }
476 }
477 iSeries_recal_titan = titan;
478 iSeries_recal_tb = tb;
479
480 /* Called here as now we know accurate values for the timebase */
481 clocksource_init();
482 return 0;
483}
484late_initcall(iSeries_tb_recal);
485
486/* Called from platform early init */
487void __init iSeries_time_init_early(void)
488{
489 iSeries_recal_tb = get_tb();
490 iSeries_recal_titan = HvCallXm_loadTod();
491}
492#endif /* CONFIG_PPC_ISERIES */
493
494#ifdef CONFIG_IRQ_WORK 413#ifdef CONFIG_IRQ_WORK
495 414
496/* 415/*
@@ -547,16 +466,6 @@ void arch_irq_work_raise(void)
547#endif /* CONFIG_IRQ_WORK */ 466#endif /* CONFIG_IRQ_WORK */
548 467
549/* 468/*
550 * For iSeries shared processors, we have to let the hypervisor
551 * set the hardware decrementer. We set a virtual decrementer
552 * in the lppaca and call the hypervisor if the virtual
553 * decrementer is less than the current value in the hardware
554 * decrementer. (almost always the new decrementer value will
555 * be greater than the current hardware decementer so the hypervisor
556 * call will not be needed)
557 */
558
559/*
560 * timer_interrupt - gets called when the decrementer overflows, 469 * timer_interrupt - gets called when the decrementer overflows,
561 * with interrupts disabled. 470 * with interrupts disabled.
562 */ 471 */
@@ -599,20 +508,10 @@ void timer_interrupt(struct pt_regs * regs)
599 irq_work_run(); 508 irq_work_run();
600 } 509 }
601 510
602#ifdef CONFIG_PPC_ISERIES
603 if (firmware_has_feature(FW_FEATURE_ISERIES))
604 get_lppaca()->int_dword.fields.decr_int = 0;
605#endif
606
607 *next_tb = ~(u64)0; 511 *next_tb = ~(u64)0;
608 if (evt->event_handler) 512 if (evt->event_handler)
609 evt->event_handler(evt); 513 evt->event_handler(evt);
610 514
611#ifdef CONFIG_PPC_ISERIES
612 if (firmware_has_feature(FW_FEATURE_ISERIES) && hvlpevent_is_pending())
613 process_hvlpevents();
614#endif
615
616#ifdef CONFIG_PPC64 515#ifdef CONFIG_PPC64
617 /* collect purr register values often, for accurate calculations */ 516 /* collect purr register values often, for accurate calculations */
618 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 517 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
@@ -984,9 +883,8 @@ void __init time_init(void)
984 */ 883 */
985 start_cpu_decrementer(); 884 start_cpu_decrementer();
986 885
987 /* Register the clocksource, if we're not running on iSeries */ 886 /* Register the clocksource */
988 if (!firmware_has_feature(FW_FEATURE_ISERIES)) 887 clocksource_init();
989 clocksource_init();
990 888
991 init_decrementer_clockevent(); 889 init_decrementer_clockevent();
992} 890}