Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 73010
b: refs/heads/master
c: d9eec1a
h: refs/heads/master
v: v3
  • Loading branch information
Atsushi Nemoto authored and Ralf Baechle committed Nov 2, 2007
1 parent 7b516bc commit 353904a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 60 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1d0a909cfc41f17175023b939b28322e427746b4
refs/heads/master: d9eec1a5d6ae54b0f7562ffe07008a33ac39e8fe
57 changes: 11 additions & 46 deletions trunk/arch/mips/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
* Copyright (c) 2003, 2004 Maciej W. Rozycki
*
* Common time service routines for MIPS machines. See
* Documentation/mips/time.README.
* Common time service routines for MIPS machines.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
Expand All @@ -18,28 +17,17 @@
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/param.h>
#include <linux/profile.h>
#include <linux/time.h>
#include <linux/timex.h>
#include <linux/smp.h>
#include <linux/kernel_stat.h>
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/kallsyms.h>

#include <asm/bootinfo.h>
#include <asm/cache.h>
#include <asm/compiler.h>
#include <asm/cpu.h>
#include <asm/cpu-features.h>
#include <asm/div64.h>
#include <asm/sections.h>
#include <asm/smtc_ipi.h>
#include <asm/time.h>

#include <irq.h>

/*
* forward reference
*/
Expand All @@ -62,14 +50,6 @@ int update_persistent_clock(struct timespec now)
return rtc_mips_set_mmss(now.tv_sec);
}

/*
* Null high precision timer functions for systems lacking one.
*/
static cycle_t null_hpt_read(void)
{
return 0;
}

/*
* High precision timer functions for a R4k-compatible timer.
*/
Expand Down Expand Up @@ -104,6 +84,13 @@ EXPORT_SYMBOL(perf_irq);

unsigned int mips_hpt_frequency;

static struct clocksource clocksource_mips = {
.name = "MIPS",
.read = c0_hpt_read,
.mask = CLOCKSOURCE_MASK(32),
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};

static unsigned int __init calibrate_hpt(void)
{
cycle_t frequency, hpt_start, hpt_end, hpt_count, hz;
Expand Down Expand Up @@ -146,12 +133,6 @@ static unsigned int __init calibrate_hpt(void)
return frequency >> log_2_loops;
}

struct clocksource clocksource_mips = {
.name = "MIPS",
.mask = CLOCKSOURCE_MASK(32),
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};

void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock)
{
u64 temp;
Expand Down Expand Up @@ -187,9 +168,6 @@ void __cpuinit clockevent_set_clock(struct clock_event_device *cd,

static void __init init_mips_clocksource(void)
{
if (!mips_hpt_frequency || clocksource_mips.read == null_hpt_read)
return;

/* Calclate a somewhat reasonable rating value */
clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;

Expand All @@ -211,7 +189,7 @@ void __init __weak plat_time_init(void)
* setup_irq calls and each clock_event_device should use its own
* struct irqrequest.
*/
void __init plat_timer_setup(struct irqaction *irq)
void __init plat_timer_setup(void)
{
BUG();
}
Expand All @@ -220,30 +198,17 @@ void __init time_init(void)
{
plat_time_init();

/* Choose appropriate high precision timer routines. */
if (!cpu_has_counter && !clocksource_mips.read)
/* No high precision timer -- sorry. */
clocksource_mips.read = null_hpt_read;
else if (!mips_hpt_frequency && !mips_timer_state) {
/* A high precision timer of unknown frequency. */
if (!clocksource_mips.read)
/* No external high precision timer -- use R4k. */
clocksource_mips.read = c0_hpt_read;
} else {
if (cpu_has_counter && (mips_hpt_frequency || mips_timer_state)) {
/* We know counter frequency. Or we can get it. */
if (!clocksource_mips.read) {
/* No external high precision timer -- use R4k. */
clocksource_mips.read = c0_hpt_read;
}
if (!mips_hpt_frequency)
mips_hpt_frequency = calibrate_hpt();

/* Report the high precision timer rate for a reference. */
printk("Using %u.%03u MHz high precision timer.\n",
((mips_hpt_frequency + 500) / 1000) / 1000,
((mips_hpt_frequency + 500) / 1000) % 1000);
init_mips_clocksource();
}

init_mips_clocksource();
mips_clockevent_init();
}
1 change: 1 addition & 0 deletions trunk/arch/mips/qemu/q-irq.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/linkage.h>

#include <asm/i8259.h>
Expand Down
13 changes: 0 additions & 13 deletions trunk/include/asm-mips/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* Please refer to Documentation/mips/time.README.
*/
#ifndef _ASM_TIME_H
#define _ASM_TIME_H

#include <linux/interrupt.h>
#include <linux/linkage.h>
#include <linux/ptrace.h>
#include <linux/rtc.h>
#include <linux/spinlock.h>
#include <linux/clockchips.h>
Expand All @@ -38,20 +33,12 @@ extern int rtc_mips_set_mmss(unsigned long);
/*
* Timer interrupt functions.
* mips_timer_state is needed for high precision timer calibration.
* mips_timer_ack may be NULL if the interrupt is self-recoverable.
*/
extern int (*mips_timer_state)(void);

/*
* High precision timer clocksource.
* If .read is NULL, an R4k-compatible timer setup is attempted.
*/
extern struct clocksource clocksource_mips;

/*
* board specific routines required by time_init().
*/
struct irqaction;
extern void plat_time_init(void);

/*
Expand Down

0 comments on commit 353904a

Please sign in to comment.