Commit 376613e8 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, tsc: Skip TSC synchronization checks for tsc=reliable
  clocksource: Convert tcb_clksrc to use clocksource_register_hz/khz
  clocksource: cris: Convert to clocksource_register_khz
  clocksource: xtensa: Convert to clocksource_register_hz/khz
  clocksource: um: Convert to clocksource_register_hz/khz
  clocksource: parisc: Convert to clocksource_register_hz/khz
  clocksource: m86k: Convert to clocksource_register_hz/khz
  time: x86: Replace LATCH with PIT_LATCH in i8253 clocksource driver
  time: x86: Remove CLOCK_TICK_RATE from acpi_pm clocksource driver
  time: x86: Remove CLOCK_TICK_RATE from mach_timer.h
  time: x86: Remove CLOCK_TICK_RATE from tsc code
  time: Fix spelling mistakes in new comments
  time: fix bogus comment in timekeeping_get_ns_raw
parents 0db49b72 0518469d
...@@ -47,14 +47,12 @@ static struct clocksource cont_rotime = { ...@@ -47,14 +47,12 @@ static struct clocksource cont_rotime = {
.rating = 300, .rating = 300,
.read = read_cont_rotime, .read = read_cont_rotime,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
.shift = 10,
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
static int __init etrax_init_cont_rotime(void) static int __init etrax_init_cont_rotime(void)
{ {
cont_rotime.mult = clocksource_khz2mult(100000, cont_rotime.shift); clocksource_register_khz(&cont_rotime, 100000);
clocksource_register(&cont_rotime);
return 0; return 0;
} }
arch_initcall(etrax_init_cont_rotime); arch_initcall(etrax_init_cont_rotime);
......
...@@ -93,7 +93,6 @@ static struct clocksource m68328_clk = { ...@@ -93,7 +93,6 @@ static struct clocksource m68328_clk = {
.name = "timer", .name = "timer",
.rating = 250, .rating = 250,
.read = m68328_read_clk, .read = m68328_read_clk,
.shift = 20,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
...@@ -115,8 +114,7 @@ void hw_timer_init(void) ...@@ -115,8 +114,7 @@ void hw_timer_init(void)
/* Enable timer 1 */ /* Enable timer 1 */
TCTL |= TCTL_TEN; TCTL |= TCTL_TEN;
m68328_clk.mult = clocksource_hz2mult(TICKS_PER_JIFFY*HZ, m68328_clk.shift); clocksource_register_hz(&m68328_clk, TICKS_PER_JIFFY*HZ);
clocksource_register(&m68328_clk);
} }
/***************************************************************************/ /***************************************************************************/
......
...@@ -44,7 +44,6 @@ static struct clocksource clocksource_cf_dt = { ...@@ -44,7 +44,6 @@ static struct clocksource clocksource_cf_dt = {
.rating = 200, .rating = 200,
.read = cf_dt_get_cycles, .read = cf_dt_get_cycles,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
.shift = 20,
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
...@@ -60,9 +59,7 @@ static int __init init_cf_dt_clocksource(void) ...@@ -60,9 +59,7 @@ static int __init init_cf_dt_clocksource(void)
__raw_writeb(0x00, DTER0); __raw_writeb(0x00, DTER0);
__raw_writel(0x00000000, DTRR0); __raw_writel(0x00000000, DTRR0);
__raw_writew(DMA_DTMR_CLK_DIV_16 | DMA_DTMR_ENABLE, DTMR0); __raw_writew(DMA_DTMR_CLK_DIV_16 | DMA_DTMR_ENABLE, DTMR0);
clocksource_cf_dt.mult = clocksource_hz2mult(DMA_FREQ, return clocksource_register_hz(&clocksource_cf_dt, DMA_FREQ);
clocksource_cf_dt.shift);
return clocksource_register(&clocksource_cf_dt);
} }
arch_initcall(init_cf_dt_clocksource); arch_initcall(init_cf_dt_clocksource);
......
...@@ -144,7 +144,6 @@ static struct clocksource pit_clk = { ...@@ -144,7 +144,6 @@ static struct clocksource pit_clk = {
.name = "pit", .name = "pit",
.rating = 100, .rating = 100,
.read = pit_read_clk, .read = pit_read_clk,
.shift = 20,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
}; };
...@@ -162,8 +161,7 @@ void hw_timer_init(void) ...@@ -162,8 +161,7 @@ void hw_timer_init(void)
setup_irq(MCFINT_VECBASE + MCFINT_PIT1, &pit_irq); setup_irq(MCFINT_VECBASE + MCFINT_PIT1, &pit_irq);
pit_clk.mult = clocksource_hz2mult(FREQ, pit_clk.shift); clocksource_register_hz(&pit_clk, FREQ);
clocksource_register(&pit_clk);
} }
/***************************************************************************/ /***************************************************************************/
...@@ -114,7 +114,6 @@ static struct clocksource mcfslt_clk = { ...@@ -114,7 +114,6 @@ static struct clocksource mcfslt_clk = {
.name = "slt", .name = "slt",
.rating = 250, .rating = 250,
.read = mcfslt_read_clk, .read = mcfslt_read_clk,
.shift = 20,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
...@@ -136,8 +135,7 @@ void hw_timer_init(void) ...@@ -136,8 +135,7 @@ void hw_timer_init(void)
setup_irq(MCF_IRQ_TIMER, &mcfslt_timer_irq); setup_irq(MCF_IRQ_TIMER, &mcfslt_timer_irq);
mcfslt_clk.mult = clocksource_hz2mult(MCF_BUSCLK, mcfslt_clk.shift); clocksource_register_hz(&mcfslt_clk, MCF_BUSCLK);
clocksource_register(&mcfslt_clk);
#ifdef CONFIG_HIGHPROFILE #ifdef CONFIG_HIGHPROFILE
mcfslt_profile_init(); mcfslt_profile_init();
......
...@@ -88,7 +88,6 @@ static struct clocksource mcftmr_clk = { ...@@ -88,7 +88,6 @@ static struct clocksource mcftmr_clk = {
.name = "tmr", .name = "tmr",
.rating = 250, .rating = 250,
.read = mcftmr_read_clk, .read = mcftmr_read_clk,
.shift = 20,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
...@@ -109,8 +108,7 @@ void hw_timer_init(void) ...@@ -109,8 +108,7 @@ void hw_timer_init(void)
__raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 | __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR)); MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR));
mcftmr_clk.mult = clocksource_hz2mult(FREQ, mcftmr_clk.shift); clocksource_register_hz(&mcftmr_clk, FREQ);
clocksource_register(&mcftmr_clk);
setup_irq(MCF_IRQ_TIMER, &mcftmr_timer_irq); setup_irq(MCF_IRQ_TIMER, &mcftmr_timer_irq);
......
...@@ -198,8 +198,6 @@ static struct clocksource clocksource_cr16 = { ...@@ -198,8 +198,6 @@ static struct clocksource clocksource_cr16 = {
.rating = 300, .rating = 300,
.read = read_cr16, .read = read_cr16,
.mask = CLOCKSOURCE_MASK(BITS_PER_LONG), .mask = CLOCKSOURCE_MASK(BITS_PER_LONG),
.mult = 0, /* to be set */
.shift = 22,
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
...@@ -270,7 +268,5 @@ void __init time_init(void) ...@@ -270,7 +268,5 @@ void __init time_init(void)
/* register at clocksource framework */ /* register at clocksource framework */
current_cr16_khz = PAGE0->mem_10msec/10; /* kHz */ current_cr16_khz = PAGE0->mem_10msec/10; /* kHz */
clocksource_cr16.mult = clocksource_khz2mult(current_cr16_khz, clocksource_register_khz(&clocksource_cr16, current_cr16_khz);
clocksource_cr16.shift);
clocksource_register(&clocksource_cr16);
} }
...@@ -75,8 +75,6 @@ static struct clocksource itimer_clocksource = { ...@@ -75,8 +75,6 @@ static struct clocksource itimer_clocksource = {
.rating = 300, .rating = 300,
.read = itimer_read, .read = itimer_read,
.mask = CLOCKSOURCE_MASK(64), .mask = CLOCKSOURCE_MASK(64),
.mult = 1000,
.shift = 0,
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
...@@ -94,9 +92,9 @@ static void __init setup_itimer(void) ...@@ -94,9 +92,9 @@ static void __init setup_itimer(void)
clockevent_delta2ns(60 * HZ, &itimer_clockevent); clockevent_delta2ns(60 * HZ, &itimer_clockevent);
itimer_clockevent.min_delta_ns = itimer_clockevent.min_delta_ns =
clockevent_delta2ns(1, &itimer_clockevent); clockevent_delta2ns(1, &itimer_clockevent);
err = clocksource_register(&itimer_clocksource); err = clocksource_register_hz(&itimer_clocksource, USEC_PER_SEC);
if (err) { if (err) {
printk(KERN_ERR "clocksource_register returned %d\n", err); printk(KERN_ERR "clocksource_register_hz returned %d\n", err);
return; return;
} }
clockevents_register_device(&itimer_clockevent); clockevents_register_device(&itimer_clockevent);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#define CALIBRATE_TIME_MSEC 30 /* 30 msecs */ #define CALIBRATE_TIME_MSEC 30 /* 30 msecs */
#define CALIBRATE_LATCH \ #define CALIBRATE_LATCH \
((CLOCK_TICK_RATE * CALIBRATE_TIME_MSEC + 1000/2)/1000) ((PIT_TICK_RATE * CALIBRATE_TIME_MSEC + 1000/2)/1000)
static inline void mach_prepare_counter(void) static inline void mach_prepare_counter(void)
{ {
......
...@@ -51,6 +51,8 @@ extern int unsynchronized_tsc(void); ...@@ -51,6 +51,8 @@ extern int unsynchronized_tsc(void);
extern int check_tsc_unstable(void); extern int check_tsc_unstable(void);
extern unsigned long native_calibrate_tsc(void); extern unsigned long native_calibrate_tsc(void);
extern int tsc_clocksource_reliable;
/* /*
* Boot-time check whether the TSCs are synchronized across * Boot-time check whether the TSCs are synchronized across
* all CPUs/cores: * all CPUs/cores:
......
...@@ -35,7 +35,7 @@ static int __read_mostly tsc_unstable; ...@@ -35,7 +35,7 @@ static int __read_mostly tsc_unstable;
erroneous rdtsc usage on !cpu_has_tsc processors */ erroneous rdtsc usage on !cpu_has_tsc processors */
static int __read_mostly tsc_disabled = -1; static int __read_mostly tsc_disabled = -1;
static int tsc_clocksource_reliable; int tsc_clocksource_reliable;
/* /*
* Scheduler clock - returns current time in nanosec units. * Scheduler clock - returns current time in nanosec units.
*/ */
...@@ -178,11 +178,11 @@ static unsigned long calc_pmtimer_ref(u64 deltatsc, u64 pm1, u64 pm2) ...@@ -178,11 +178,11 @@ static unsigned long calc_pmtimer_ref(u64 deltatsc, u64 pm1, u64 pm2)
} }
#define CAL_MS 10 #define CAL_MS 10
#define CAL_LATCH (CLOCK_TICK_RATE / (1000 / CAL_MS)) #define CAL_LATCH (PIT_TICK_RATE / (1000 / CAL_MS))
#define CAL_PIT_LOOPS 1000 #define CAL_PIT_LOOPS 1000
#define CAL2_MS 50 #define CAL2_MS 50
#define CAL2_LATCH (CLOCK_TICK_RATE / (1000 / CAL2_MS)) #define CAL2_LATCH (PIT_TICK_RATE / (1000 / CAL2_MS))
#define CAL2_PIT_LOOPS 5000 #define CAL2_PIT_LOOPS 5000
......
...@@ -113,7 +113,7 @@ void __cpuinit check_tsc_sync_source(int cpu) ...@@ -113,7 +113,7 @@ void __cpuinit check_tsc_sync_source(int cpu)
if (unsynchronized_tsc()) if (unsynchronized_tsc())
return; return;
if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) { if (tsc_clocksource_reliable) {
if (cpu == (nr_cpu_ids-1) || system_state != SYSTEM_BOOTING) if (cpu == (nr_cpu_ids-1) || system_state != SYSTEM_BOOTING)
pr_info( pr_info(
"Skipped synchronization checks as TSC is reliable.\n"); "Skipped synchronization checks as TSC is reliable.\n");
...@@ -172,7 +172,7 @@ void __cpuinit check_tsc_sync_target(void) ...@@ -172,7 +172,7 @@ void __cpuinit check_tsc_sync_target(void)
{ {
int cpus = 2; int cpus = 2;
if (unsynchronized_tsc() || boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) if (unsynchronized_tsc() || tsc_clocksource_reliable)
return; return;
/* /*
......
...@@ -41,14 +41,6 @@ static struct clocksource ccount_clocksource = { ...@@ -41,14 +41,6 @@ static struct clocksource ccount_clocksource = {
.rating = 200, .rating = 200,
.read = ccount_read, .read = ccount_read,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
/*
* With a shift of 22 the lower limit of the cpu clock is
* 1MHz, where NSEC_PER_CCOUNT is 1000 or a bit less than
* 2^10: Since we have 32 bits and the multiplicator can
* already take up as much as 10 bits, this leaves us with
* remaining upper 22 bits.
*/
.shift = 22,
}; };
static irqreturn_t timer_interrupt(int irq, void *dev_id); static irqreturn_t timer_interrupt(int irq, void *dev_id);
...@@ -66,10 +58,7 @@ void __init time_init(void) ...@@ -66,10 +58,7 @@ void __init time_init(void)
printk("%d.%02d MHz\n", (int)ccount_per_jiffy/(1000000/HZ), printk("%d.%02d MHz\n", (int)ccount_per_jiffy/(1000000/HZ),
(int)(ccount_per_jiffy/(10000/HZ))%100); (int)(ccount_per_jiffy/(10000/HZ))%100);
#endif #endif
ccount_clocksource.mult = clocksource_register_hz(&ccount_clocksource, CCOUNT_PER_JIFFY * HZ);
clocksource_hz2mult(CCOUNT_PER_JIFFY * HZ,
ccount_clocksource.shift);
clocksource_register(&ccount_clocksource);
/* Initialize the linux timer interrupt. */ /* Initialize the linux timer interrupt. */
......
...@@ -143,7 +143,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_LE, ...@@ -143,7 +143,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_LE,
#ifndef CONFIG_X86_64 #ifndef CONFIG_X86_64
#include <asm/mach_timer.h> #include <asm/mach_timer.h>
#define PMTMR_EXPECTED_RATE \ #define PMTMR_EXPECTED_RATE \
((CALIBRATE_LATCH * (PMTMR_TICKS_PER_SEC >> 10)) / (CLOCK_TICK_RATE>>10)) ((CALIBRATE_LATCH * (PMTMR_TICKS_PER_SEC >> 10)) / (PIT_TICK_RATE>>10))
/* /*
* Some boards have the PMTMR running way too fast. We check * Some boards have the PMTMR running way too fast. We check
* the PMTMR rate against PIT channel 2 to catch these cases. * the PMTMR rate against PIT channel 2 to catch these cases.
......
...@@ -53,7 +53,7 @@ static cycle_t i8253_read(struct clocksource *cs) ...@@ -53,7 +53,7 @@ static cycle_t i8253_read(struct clocksource *cs)
count |= inb_p(PIT_CH0) << 8; count |= inb_p(PIT_CH0) << 8;
/* VIA686a test code... reset the latch if count > max + 1 */ /* VIA686a test code... reset the latch if count > max + 1 */
if (count > LATCH) { if (count > PIT_LATCH) {
outb_p(0x34, PIT_MODE); outb_p(0x34, PIT_MODE);
outb_p(PIT_LATCH & 0xff, PIT_CH0); outb_p(PIT_LATCH & 0xff, PIT_CH0);
outb_p(PIT_LATCH >> 8, PIT_CH0); outb_p(PIT_LATCH >> 8, PIT_CH0);
...@@ -114,8 +114,8 @@ static void init_pit_timer(enum clock_event_mode mode, ...@@ -114,8 +114,8 @@ static void init_pit_timer(enum clock_event_mode mode,
case CLOCK_EVT_MODE_PERIODIC: case CLOCK_EVT_MODE_PERIODIC:
/* binary, mode 2, LSB/MSB, ch 0 */ /* binary, mode 2, LSB/MSB, ch 0 */
outb_p(0x34, PIT_MODE); outb_p(0x34, PIT_MODE);
outb_p(LATCH & 0xff , PIT_CH0); /* LSB */ outb_p(PIT_LATCH & 0xff , PIT_CH0); /* LSB */
outb_p(LATCH >> 8 , PIT_CH0); /* MSB */ outb_p(PIT_LATCH >> 8 , PIT_CH0); /* MSB */
break; break;
case CLOCK_EVT_MODE_SHUTDOWN: case CLOCK_EVT_MODE_SHUTDOWN:
......
...@@ -59,7 +59,6 @@ static struct clocksource clksrc = { ...@@ -59,7 +59,6 @@ static struct clocksource clksrc = {
.rating = 200, .rating = 200,
.read = tc_get_cycles, .read = tc_get_cycles,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
.shift = 18,
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
...@@ -256,7 +255,6 @@ static int __init tcb_clksrc_init(void) ...@@ -256,7 +255,6 @@ static int __init tcb_clksrc_init(void)
best_divisor_idx = i; best_divisor_idx = i;
} }
clksrc.mult = clocksource_hz2mult(divided_rate, clksrc.shift);
printk(bootinfo, clksrc.name, CONFIG_ATMEL_TCB_CLKSRC_BLOCK, printk(bootinfo, clksrc.name, CONFIG_ATMEL_TCB_CLKSRC_BLOCK,
divided_rate / 1000000, divided_rate / 1000000,
...@@ -292,7 +290,7 @@ static int __init tcb_clksrc_init(void) ...@@ -292,7 +290,7 @@ static int __init tcb_clksrc_init(void)
__raw_writel(ATMEL_TC_SYNC, tcaddr + ATMEL_TC_BCR); __raw_writel(ATMEL_TC_SYNC, tcaddr + ATMEL_TC_BCR);
/* and away we go! */ /* and away we go! */
clocksource_register(&clksrc); clocksource_register_hz(&clksrc, divided_rate);
/* channel 2: periodic and oneshot timer support */ /* channel 2: periodic and oneshot timer support */
setup_clkevents(tc, clk32k_divisor_idx); setup_clkevents(tc, clk32k_divisor_idx);
......
...@@ -131,7 +131,7 @@ static inline s64 timekeeping_get_ns_raw(void) ...@@ -131,7 +131,7 @@ static inline s64 timekeeping_get_ns_raw(void)
/* calculate the delta since the last update_wall_time: */ /* calculate the delta since the last update_wall_time: */
cycle_delta = (cycle_now - clock->cycle_last) & clock->mask; cycle_delta = (cycle_now - clock->cycle_last) & clock->mask;
/* return delta convert to nanoseconds using ntp adjusted mult. */ /* return delta convert to nanoseconds. */
return clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift); return clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift);
} }
...@@ -813,11 +813,11 @@ static void timekeeping_adjust(s64 offset) ...@@ -813,11 +813,11 @@ static void timekeeping_adjust(s64 offset)
* First we shift it down from NTP_SHIFT to clocksource->shifted nsecs. * First we shift it down from NTP_SHIFT to clocksource->shifted nsecs.
* *
* Note we subtract one in the shift, so that error is really error*2. * Note we subtract one in the shift, so that error is really error*2.
* This "saves" dividing(shifting) intererval twice, but keeps the * This "saves" dividing(shifting) interval twice, but keeps the
* (error > interval) comparision as still measuring if error is * (error > interval) comparison as still measuring if error is
* larger then half an interval. * larger then half an interval.
* *
* Note: It does not "save" on aggrivation when reading the code. * Note: It does not "save" on aggravation when reading the code.
*/ */
error = timekeeper.ntp_error >> (timekeeper.ntp_error_shift - 1); error = timekeeper.ntp_error >> (timekeeper.ntp_error_shift - 1);
if (error > interval) { if (error > interval) {
...@@ -833,7 +833,7 @@ static void timekeeping_adjust(s64 offset) ...@@ -833,7 +833,7 @@ static void timekeeping_adjust(s64 offset)
* nanosecond, and store the amount rounded up into * nanosecond, and store the amount rounded up into
* the error. This causes the likely below to be unlikely. * the error. This causes the likely below to be unlikely.
* *
* The properfix is to avoid rounding up by using * The proper fix is to avoid rounding up by using
* the high precision timekeeper.xtime_nsec instead of * the high precision timekeeper.xtime_nsec instead of
* xtime.tv_nsec everywhere. Fixing this will take some * xtime.tv_nsec everywhere. Fixing this will take some
* time. * time.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment