2012-11-08 21:02:15

by Stephen Warren

[permalink] [raw]
Subject: [RFC PATCH 00/11] arch_gettimeoffset and ARM timer rework

From: Stephen Warren <[email protected]>

The overall aim of this series is to allow ARM (or indeed any) timer
drivers to be moved into drivers/clocksource without requiring a
struct or function prototype for each individual driver in include/linux.
The intent is eventually to create a single e.g. of_clocksource_init()
function that determines which timer driver to initialize by scanning
the device dtree, much like the proposed irqchip_init() at:
http://www.spinics.net/lists/arm-kernel/msg203686.html

This requires some rework prior to implementing of_clocksource_init():

ARM uses struct sys_timer to represent the individual machine's timer
driver. Many of the patches in this series are ARM-specific changes to
get rid of this struct, leaving just a single init function instead.

One function pointer in the struct provides the implementation of
arch_gettimeoffset(). Removing the struct and moving drivers into the
generic drivers/clocksource directory requires an arch-agnostic way of
registering the implementation of this function. The first few patches
in the series provide that, and rework various architectures to make use
of this facility rather than implementing the same thing themselves.

It would probably be easiest to merge this whole series through the
arm-soc tree. Anything else would require some co-ordination.

Stephen Warren (11):
cris: move usec/nsec conversion to do_slow_gettimeoffset
time: convert arch_gettimeoffset to a pointer
m68k: set arch_gettimeoffset directly
ARM: set arch_gettimeoffset directly
ARM: at91: convert timer suspend/resume to clock_event_device
ARM: pxa: convert timer suspend/resume to clock_event_device
ARM: sa1100: convert timer suspend/resume to clock_event_device
ARM: ux500: convert timer suspend/resume to clock_event_device
ARM: samsung: register syscore_ops for timer resume directly
ARM: remove struct sys_timer suspend and resume fields
ARM: delete struct sys_timer

arch/arm/include/asm/mach/arch.h | 3 +-
arch/arm/include/asm/mach/time.h | 30 ------------
arch/arm/kernel/time.c | 53 +----------------------
arch/arm/mach-at91/at91sam926x_time.c | 47 +++++++++++---------
arch/arm/mach-at91/at91x40_time.c | 8 ++-
arch/arm/mach-ebsa110/core.c | 7 ++-
arch/arm/mach-ep93xx/core.c | 23 +++++-----
arch/arm/mach-h720x/common.c | 6 +-
arch/arm/mach-h720x/common.h | 2 +-
arch/arm/mach-h720x/cpu-h7201.c | 3 +-
arch/arm/mach-h720x/cpu-h7202.c | 3 +-
arch/arm/mach-pxa/time.c | 76 ++++++++++++++++----------------
arch/arm/mach-rpc/time.c | 6 +-
arch/arm/mach-sa1100/time.c | 66 ++++++++++++++--------------
arch/arm/mach-tegra/board-dt-tegra20.c | 2 +-
arch/arm/mach-tegra/board-dt-tegra30.c | 2 +-
arch/arm/mach-tegra/board.h | 2 +-
arch/arm/mach-tegra/timer.c | 6 +--
arch/arm/mach-ux500/timer.c | 7 ---
arch/arm/plat-samsung/time.c | 14 ++++--
arch/blackfin/kernel/time.c | 6 ++-
arch/cris/arch-v10/kernel/time.c | 10 +++--
arch/cris/kernel/time.c | 11 -----
arch/m32r/kernel/time.c | 4 +-
arch/m68k/amiga/config.c | 10 ++--
arch/m68k/apollo/config.c | 9 ++--
arch/m68k/atari/config.c | 4 +-
arch/m68k/atari/time.c | 6 +-
arch/m68k/bvme6000/config.c | 10 ++--
arch/m68k/hp300/config.c | 2 +-
arch/m68k/hp300/time.c | 4 +-
arch/m68k/hp300/time.h | 2 +-
arch/m68k/include/asm/machdep.h | 2 +-
arch/m68k/kernel/setup_mm.c | 1 -
arch/m68k/kernel/time.c | 15 ++----
arch/m68k/mac/config.c | 4 +-
arch/m68k/mac/via.c | 4 +-
arch/m68k/mvme147/config.c | 8 ++--
arch/m68k/mvme16x/config.c | 8 ++--
arch/m68k/q40/config.c | 8 ++--
arch/m68k/sun3/config.c | 4 +-
arch/m68k/sun3/intersil.c | 4 +-
arch/m68k/sun3x/config.c | 2 +-
arch/m68k/sun3x/time.c | 2 +-
arch/m68k/sun3x/time.h | 2 +-
drivers/clocksource/nomadik-mtu.c | 33 ++++++++-----
include/linux/time.h | 4 +-
kernel/time/timekeeping.c | 20 +++++++-
48 files changed, 249 insertions(+), 316 deletions(-)


2012-11-08 21:02:17

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 02/11] time: convert arch_gettimeoffset to a pointer

From: Stephen Warren <[email protected]>

Currently, whenever CONFIG_ARCH_USES_GETTIMEOFFSET is enabled, each
arch core provides a single implementation of arch_gettimeoffset(). In
many cases, different sub-architectures, different machines, or
different timer providers exist, and so the arch ends up implementing
arch_gettimeoffset() as a call-through-pointer anyway. Examples are
ARM, Cris, M68K, and it's arguable that the remaining architectures,
M32R and Blackfin, should be doing this anyway.

Modify arch_gettimeoffset so that it itself is a function pointer, which
the arch initializes. This will allow later changes to move the
initialization of this function into individual machine support or timer
drivers. This is particularly useful for code in drivers/clocksource
which should rely on an arch-independant mechanism to register their
implementation of arch_gettimeoffset().

This patch also converts the Cris architecture to set arch_gettimeoffset
directly to the final implementation in time_init(), because Cris already
had separate time_init() functions per sub-architecture. M68K and ARM
are converted to set arch_gettimeoffset the final implementation in later
patches, because they already have function pointers in place for this
purpose.

Cc: Russell King <[email protected]>
Cc: Mike Frysinger <[email protected]>
Cc: Mikael Starvik <[email protected]>
Cc: Jesper Nilsson <[email protected]>
Cc: Hirokazu Takata <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: John Stultz <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
---
arch/arm/kernel/time.c | 6 +++++-
arch/blackfin/kernel/time.c | 6 +++++-
arch/cris/arch-v10/kernel/time.c | 6 ++++--
arch/cris/kernel/time.c | 11 -----------
arch/m32r/kernel/time.c | 4 +++-
arch/m68k/kernel/time.c | 16 ++++++++++------
include/linux/time.h | 4 +---
kernel/time/timekeeping.c | 20 +++++++++++++++++---
8 files changed, 45 insertions(+), 28 deletions(-)

diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 09be0c3..b0190b4 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -70,7 +70,7 @@ EXPORT_SYMBOL(profile_pc);
#endif

#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
-u32 arch_gettimeoffset(void)
+static u32 arm_gettimeoffset(void)
{
if (system_timer->offset != NULL)
return system_timer->offset() * 1000;
@@ -164,6 +164,10 @@ device_initcall(timer_init_syscore_ops);

void __init time_init(void)
{
+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
+ arch_gettimeoffset = arm_gettimeoffset;
+#endif
+
system_timer = machine_desc->timer;
system_timer->init();
sched_clock_postinit();
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c
index 2310b24..3126b92 100644
--- a/arch/blackfin/kernel/time.c
+++ b/arch/blackfin/kernel/time.c
@@ -85,7 +85,7 @@ time_sched_init(irqreturn_t(*timer_routine) (int, void *))
/*
* Should return useconds since last timer tick
*/
-u32 arch_gettimeoffset(void)
+static u32 blackfin_gettimeoffset(void)
{
unsigned long offset;
unsigned long clocks_per_jiffy;
@@ -141,6 +141,10 @@ void read_persistent_clock(struct timespec *ts)

void __init time_init(void)
{
+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
+ arch_gettimeoffset = blackfin_gettimeoffset;
+#endif
+
#ifdef CONFIG_RTC_DRV_BFIN
/* [#2663] hack to filter junk RTC values that would cause
* userspace to have to deal with time values greater than
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index 162892f..fce7c54 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -55,9 +55,9 @@ unsigned long get_ns_in_jiffie(void)
return ns;
}

-unsigned long do_slow_gettimeoffset(void)
+static u32 cris_v10_gettimeoffset(void)
{
- unsigned long count;
+ u32 count;

/* The timer interrupt comes from Etrax timer 0. In order to get
* better precision, we check the current value. It might have
@@ -191,6 +191,8 @@ static struct irqaction irq2 = {
void __init
time_init(void)
{
+ arch_gettimeoffset = cris_v10_gettimeoffset;
+
/* probe for the RTC and read it if it exists
* Before the RTC can be probed the loops_per_usec variable needs
* to be initialized to make usleep work. A better value for
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index b063c92..fe6acda 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -39,17 +39,6 @@
extern unsigned long loops_per_jiffy; /* init/main.c */
unsigned long loops_per_usec;

-
-#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
-extern unsigned long do_slow_gettimeoffset(void);
-static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
-
-u32 arch_gettimeoffset(void)
-{
- return do_gettimeoffset();
-}
-#endif
-
int set_rtc_mmss(unsigned long nowtime)
{
D(printk(KERN_DEBUG "set_rtc_mmss(%lu)\n", nowtime));
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index 84dd040..1a15f81 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -57,7 +57,7 @@ extern void smp_local_timer_interrupt(void);

static unsigned long latch;

-u32 arch_gettimeoffset(void)
+static u32 m32r_gettimeoffset(void)
{
unsigned long elapsed_time = 0; /* [us] */

@@ -165,6 +165,8 @@ void read_persistent_clock(struct timespec *ts)

void __init time_init(void)
{
+ arch_gettimeoffset = m32r_gettimeoffset;
+
#if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \
|| defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \
|| defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 5d0bcaa..c2994c8 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -80,14 +80,9 @@ void read_persistent_clock(struct timespec *ts)
}
}

-void __init time_init(void)
-{
- mach_sched_init(timer_interrupt);
-}
-
#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET

-u32 arch_gettimeoffset(void)
+static u32 m68k_gettimeoffset(void)
{
return mach_gettimeoffset() * 1000;
}
@@ -106,3 +101,12 @@ static int __init rtc_init(void)
module_init(rtc_init);

#endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */
+
+void __init time_init(void)
+{
+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
+ arch_gettimeoffset = m68k_gettimeoffset;
+#endif
+
+ mach_sched_init(timer_interrupt);
+}
diff --git a/include/linux/time.h b/include/linux/time.h
index 4d358e9..05e32a7 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -142,9 +142,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta);
* finer then tick granular time.
*/
#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
-extern u32 arch_gettimeoffset(void);
-#else
-static inline u32 arch_gettimeoffset(void) { return 0; }
+extern u32 (*arch_gettimeoffset)(void);
#endif

extern void do_gettimeofday(struct timeval *tv);
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index e424970..9d00ace 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -140,6 +140,20 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock)
}

/* Timekeeper helper functions. */
+
+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
+u32 (*arch_gettimeoffset)(void);
+
+u32 gettimeoffset(void)
+{
+ if (likely(arch_gettimeoffset))
+ return arch_gettimeoffset();
+ return 0;
+}
+#else
+static inline u32 gettimeoffset(void) { return 0; }
+#endif
+
static inline s64 timekeeping_get_ns(struct timekeeper *tk)
{
cycle_t cycle_now, cycle_delta;
@@ -157,7 +171,7 @@ static inline s64 timekeeping_get_ns(struct timekeeper *tk)
nsec >>= tk->shift;

/* If arch requires, add in gettimeoffset() */
- return nsec + arch_gettimeoffset();
+ return nsec + gettimeoffset();
}

static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
@@ -177,7 +191,7 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
nsec = clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift);

/* If arch requires, add in gettimeoffset() */
- return nsec + arch_gettimeoffset();
+ return nsec + gettimeoffset();
}

/* must hold write on timekeeper.lock */
@@ -211,7 +225,7 @@ static void timekeeping_forward_now(struct timekeeper *tk)
tk->xtime_nsec += cycle_delta * tk->mult;

/* If arch requires, add in gettimeoffset() */
- tk->xtime_nsec += (u64)arch_gettimeoffset() << tk->shift;
+ tk->xtime_nsec += (u64)gettimeoffset() << tk->shift;

tk_normalize_xtime(tk);

--
1.7.0.4

2012-11-08 21:02:22

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 03/11] m68k: set arch_gettimeoffset directly

From: Stephen Warren <[email protected]>

remove m68k's mach_gettimeoffset function pointer, and instead directly
set the arch_gettimeoffset function pointer. This requires multiplying
all function results by 1000, since the removed m68k_gettimeoffset() did
this. Also, s/unsigned long/u32/ just to make the function prototypes
exactly match that of arch_gettimeoffset.

Cc: Geert Uytterhoeven <[email protected]>
Cc: Philip Blundell <[email protected]>
Cc: Joshua Thompson <[email protected]>
Cc: Sam Creasey <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
---
arch/m68k/amiga/config.c | 10 +++++-----
arch/m68k/apollo/config.c | 9 ++++-----
arch/m68k/atari/config.c | 4 ++--
arch/m68k/atari/time.c | 6 +++---
arch/m68k/bvme6000/config.c | 10 +++++-----
arch/m68k/hp300/config.c | 2 +-
arch/m68k/hp300/time.c | 4 ++--
arch/m68k/hp300/time.h | 2 +-
arch/m68k/include/asm/machdep.h | 2 +-
arch/m68k/kernel/setup_mm.c | 1 -
arch/m68k/kernel/time.c | 9 ---------
arch/m68k/mac/config.c | 4 ++--
arch/m68k/mac/via.c | 4 ++--
arch/m68k/mvme147/config.c | 8 ++++----
arch/m68k/mvme16x/config.c | 8 ++++----
arch/m68k/q40/config.c | 8 ++++----
arch/m68k/sun3/config.c | 4 ++--
arch/m68k/sun3/intersil.c | 4 ++--
arch/m68k/sun3x/config.c | 2 +-
arch/m68k/sun3x/time.c | 2 +-
arch/m68k/sun3x/time.h | 2 +-
21 files changed, 47 insertions(+), 58 deletions(-)

diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index ee01b7a..b819390 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -95,7 +95,7 @@ static void amiga_sched_init(irq_handler_t handler);
static void amiga_get_model(char *model);
static void amiga_get_hardware_list(struct seq_file *m);
/* amiga specific timer functions */
-static unsigned long amiga_gettimeoffset(void);
+static u32 amiga_gettimeoffset(void);
extern void amiga_mksound(unsigned int count, unsigned int ticks);
static void amiga_reset(void);
extern void amiga_init_sound(void);
@@ -377,7 +377,7 @@ void __init config_amiga(void)
mach_init_IRQ = amiga_init_IRQ;
mach_get_model = amiga_get_model;
mach_get_hardware_list = amiga_get_hardware_list;
- mach_gettimeoffset = amiga_gettimeoffset;
+ arch_gettimeoffset = amiga_gettimeoffset;

/*
* default MAX_DMA=0xffffffff on all machines. If we don't do so, the SCSI
@@ -482,10 +482,10 @@ static void __init amiga_sched_init(irq_handler_t timer_routine)
#define TICK_SIZE 10000

/* This is always executed with interrupts disabled. */
-static unsigned long amiga_gettimeoffset(void)
+static u32 amiga_gettimeoffset(void)
{
unsigned short hi, lo, hi2;
- unsigned long ticks, offset = 0;
+ u32 ticks, offset = 0;

/* read CIA B timer A current value */
hi = ciab.tahi;
@@ -507,7 +507,7 @@ static unsigned long amiga_gettimeoffset(void)
ticks = jiffy_ticks - ticks;
ticks = (10000 * ticks) / jiffy_ticks;

- return ticks + offset;
+ return (ticks + offset) * 1000;
}

static void amiga_reset(void) __noreturn;
diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
index f5565d6..3ea56b9 100644
--- a/arch/m68k/apollo/config.c
+++ b/arch/m68k/apollo/config.c
@@ -26,7 +26,7 @@ u_long apollo_model;

extern void dn_sched_init(irq_handler_t handler);
extern void dn_init_IRQ(void);
-extern unsigned long dn_gettimeoffset(void);
+extern u32 dn_gettimeoffset(void);
extern int dn_dummy_hwclk(int, struct rtc_time *);
extern int dn_dummy_set_clock_mmss(unsigned long);
extern void dn_dummy_reset(void);
@@ -151,7 +151,7 @@ void __init config_apollo(void)

mach_sched_init=dn_sched_init; /* */
mach_init_IRQ=dn_init_IRQ;
- mach_gettimeoffset = dn_gettimeoffset;
+ arch_gettimeoffset = dn_gettimeoffset;
mach_max_dma_address = 0xffffffff;
mach_hwclk = dn_dummy_hwclk; /* */
mach_set_clock_mmss = dn_dummy_set_clock_mmss; /* */
@@ -203,10 +203,9 @@ void dn_sched_init(irq_handler_t timer_routine)
pr_err("Couldn't register timer interrupt\n");
}

-unsigned long dn_gettimeoffset(void) {
-
+u32 dn_gettimeoffset(void)
+{
return 0xdeadbeef;
-
}

int dn_dummy_hwclk(int op, struct rtc_time *t) {
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index d8eb327..037c11c 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -74,7 +74,7 @@ static void atari_heartbeat(int on);

/* atari specific timer functions (in time.c) */
extern void atari_sched_init(irq_handler_t);
-extern unsigned long atari_gettimeoffset (void);
+extern u32 atari_gettimeoffset(void);
extern int atari_mste_hwclk (int, struct rtc_time *);
extern int atari_tt_hwclk (int, struct rtc_time *);
extern int atari_mste_set_clock_mmss (unsigned long);
@@ -204,7 +204,7 @@ void __init config_atari(void)
mach_init_IRQ = atari_init_IRQ;
mach_get_model = atari_get_model;
mach_get_hardware_list = atari_get_hardware_list;
- mach_gettimeoffset = atari_gettimeoffset;
+ arch_gettimeoffset = atari_gettimeoffset;
mach_reset = atari_reset;
mach_max_dma_address = 0xffffff;
#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
diff --git a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c
index c0cc68a..da8f981 100644
--- a/arch/m68k/atari/time.c
+++ b/arch/m68k/atari/time.c
@@ -42,9 +42,9 @@ atari_sched_init(irq_handler_t timer_routine)
#define TICK_SIZE 10000

/* This is always executed with interrupts disabled. */
-unsigned long atari_gettimeoffset (void)
+u32 atari_gettimeoffset(void)
{
- unsigned long ticks, offset = 0;
+ u32 ticks, offset = 0;

/* read MFP timer C current value */
ticks = st_mfp.tim_dt_c;
@@ -57,7 +57,7 @@ unsigned long atari_gettimeoffset (void)
ticks = INT_TICKS - ticks;
ticks = ticks * 10000L / INT_TICKS;

- return ticks + offset;
+ return (ticks + offset) * 1000;
}


diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c
index 0bf850a..8943aa4 100644
--- a/arch/m68k/bvme6000/config.c
+++ b/arch/m68k/bvme6000/config.c
@@ -38,7 +38,7 @@

static void bvme6000_get_model(char *model);
extern void bvme6000_sched_init(irq_handler_t handler);
-extern unsigned long bvme6000_gettimeoffset (void);
+extern u32 bvme6000_gettimeoffset(void);
extern int bvme6000_hwclk (int, struct rtc_time *);
extern int bvme6000_set_clock_mmss (unsigned long);
extern void bvme6000_reset (void);
@@ -110,7 +110,7 @@ void __init config_bvme6000(void)
mach_max_dma_address = 0xffffffff;
mach_sched_init = bvme6000_sched_init;
mach_init_IRQ = bvme6000_init_IRQ;
- mach_gettimeoffset = bvme6000_gettimeoffset;
+ arch_gettimeoffset = bvme6000_gettimeoffset;
mach_hwclk = bvme6000_hwclk;
mach_set_clock_mmss = bvme6000_set_clock_mmss;
mach_reset = bvme6000_reset;
@@ -216,13 +216,13 @@ void bvme6000_sched_init (irq_handler_t timer_routine)
* results...
*/

-unsigned long bvme6000_gettimeoffset (void)
+u32 bvme6000_gettimeoffset(void)
{
volatile RtcPtr_t rtc = (RtcPtr_t)BVME_RTC_BASE;
volatile PitRegsPtr pit = (PitRegsPtr)BVME_PIT_BASE;
unsigned char msr = rtc->msr & 0xc0;
unsigned char t1int, t1op;
- unsigned long v = 800000, ov;
+ u32 v = 800000, ov;

rtc->msr = 0; /* Ensure timer registers accessible */

@@ -246,7 +246,7 @@ unsigned long bvme6000_gettimeoffset (void)
v += 10000; /* Int pending, + 10ms */
rtc->msr = msr;

- return v;
+ return v * 1000;
}

/*
diff --git a/arch/m68k/hp300/config.c b/arch/m68k/hp300/config.c
index bf16af1..b7609f7 100644
--- a/arch/m68k/hp300/config.c
+++ b/arch/m68k/hp300/config.c
@@ -251,7 +251,7 @@ void __init config_hp300(void)
mach_sched_init = hp300_sched_init;
mach_init_IRQ = hp300_init_IRQ;
mach_get_model = hp300_get_model;
- mach_gettimeoffset = hp300_gettimeoffset;
+ arch_gettimeoffset = hp300_gettimeoffset;
mach_hwclk = hp300_hwclk;
mach_get_ss = hp300_get_ss;
mach_reset = hp300_reset;
diff --git a/arch/m68k/hp300/time.c b/arch/m68k/hp300/time.c
index 29a71be..749543b 100644
--- a/arch/m68k/hp300/time.c
+++ b/arch/m68k/hp300/time.c
@@ -46,7 +46,7 @@ static irqreturn_t hp300_tick(int irq, void *dev_id)
return vector(irq, NULL);
}

-unsigned long hp300_gettimeoffset(void)
+u32 hp300_gettimeoffset(void)
{
/* Read current timer 1 value */
unsigned char lsb, msb1, msb2;
@@ -59,7 +59,7 @@ unsigned long hp300_gettimeoffset(void)
/* A carry happened while we were reading. Read it again */
lsb = in_8(CLOCKBASE + 7);
ticks = INTVAL - ((msb2 << 8) | lsb);
- return (USECS_PER_JIFFY * ticks) / INTVAL;
+ return ((USECS_PER_JIFFY * ticks) / INTVAL) * 1000;
}

void __init hp300_sched_init(irq_handler_t vector)
diff --git a/arch/m68k/hp300/time.h b/arch/m68k/hp300/time.h
index 7b98242..f5583ec 100644
--- a/arch/m68k/hp300/time.h
+++ b/arch/m68k/hp300/time.h
@@ -1,2 +1,2 @@
extern void hp300_sched_init(irq_handler_t vector);
-extern unsigned long hp300_gettimeoffset(void);
+extern u32 hp300_gettimeoffset(void);
diff --git a/arch/m68k/include/asm/machdep.h b/arch/m68k/include/asm/machdep.h
index 825c1c8..953ca21 100644
--- a/arch/m68k/include/asm/machdep.h
+++ b/arch/m68k/include/asm/machdep.h
@@ -3,6 +3,7 @@

#include <linux/seq_file.h>
#include <linux/interrupt.h>
+#include <linux/time.h>

struct pt_regs;
struct mktime;
@@ -16,7 +17,6 @@ extern void (*mach_init_IRQ) (void);
extern void (*mach_get_model) (char *model);
extern void (*mach_get_hardware_list) (struct seq_file *m);
/* machine dependent timer functions */
-extern unsigned long (*mach_gettimeoffset)(void);
extern int (*mach_hwclk)(int, struct rtc_time*);
extern unsigned int (*mach_get_ss)(void);
extern int (*mach_get_rtc_pll)(struct rtc_pll_info *);
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index d872ce4..80cfbe5 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -84,7 +84,6 @@ void (*mach_init_IRQ) (void) __initdata = NULL;
void (*mach_get_model) (char *model);
void (*mach_get_hardware_list) (struct seq_file *m);
/* machine dependent timer functions */
-unsigned long (*mach_gettimeoffset) (void);
int (*mach_hwclk) (int, struct rtc_time*);
EXPORT_SYMBOL(mach_hwclk);
int (*mach_set_clock_mmss) (unsigned long);
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index c2994c8..bea6bcf 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -82,11 +82,6 @@ void read_persistent_clock(struct timespec *ts)

#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET

-static u32 m68k_gettimeoffset(void)
-{
- return mach_gettimeoffset() * 1000;
-}
-
static int __init rtc_init(void)
{
struct platform_device *pdev;
@@ -104,9 +99,5 @@ module_init(rtc_init);

void __init time_init(void)
{
-#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
- arch_gettimeoffset = m68k_gettimeoffset;
-#endif
-
mach_sched_init(timer_interrupt);
}
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index d9f62e0..afb95d5 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -52,7 +52,7 @@ struct mac_booter_data mac_bi_data;
static unsigned long mac_orig_videoaddr;

/* Mac specific timer functions */
-extern unsigned long mac_gettimeoffset(void);
+extern u32 mac_gettimeoffset(void);
extern int mac_hwclk(int, struct rtc_time *);
extern int mac_set_clock_mmss(unsigned long);
extern void iop_preinit(void);
@@ -177,7 +177,7 @@ void __init config_mac(void)
mach_sched_init = mac_sched_init;
mach_init_IRQ = mac_init_IRQ;
mach_get_model = mac_get_model;
- mach_gettimeoffset = mac_gettimeoffset;
+ arch_gettimeoffset = mac_gettimeoffset;
mach_hwclk = mac_hwclk;
mach_set_clock_mmss = mac_set_clock_mmss;
mach_reset = mac_reset;
diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
index 2d85662..5d1458b 100644
--- a/arch/m68k/mac/via.c
+++ b/arch/m68k/mac/via.c
@@ -327,7 +327,7 @@ void via_debug_dump(void)
* TBI: get time offset between scheduling timer ticks
*/

-unsigned long mac_gettimeoffset (void)
+u32 mac_gettimeoffset(void)
{
unsigned long ticks, offset = 0;

@@ -341,7 +341,7 @@ unsigned long mac_gettimeoffset (void)
ticks = MAC_CLOCK_TICK - ticks;
ticks = ticks * 10000L / MAC_CLOCK_TICK;

- return ticks + offset;
+ return (ticks + offset) * 1000;
}

/*
diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
index a41c091..1c62628 100644
--- a/arch/m68k/mvme147/config.c
+++ b/arch/m68k/mvme147/config.c
@@ -37,7 +37,7 @@

static void mvme147_get_model(char *model);
extern void mvme147_sched_init(irq_handler_t handler);
-extern unsigned long mvme147_gettimeoffset (void);
+extern u32 mvme147_gettimeoffset(void);
extern int mvme147_hwclk (int, struct rtc_time *);
extern int mvme147_set_clock_mmss (unsigned long);
extern void mvme147_reset (void);
@@ -88,7 +88,7 @@ void __init config_mvme147(void)
mach_max_dma_address = 0x01000000;
mach_sched_init = mvme147_sched_init;
mach_init_IRQ = mvme147_init_IRQ;
- mach_gettimeoffset = mvme147_gettimeoffset;
+ arch_gettimeoffset = mvme147_gettimeoffset;
mach_hwclk = mvme147_hwclk;
mach_set_clock_mmss = mvme147_set_clock_mmss;
mach_reset = mvme147_reset;
@@ -127,7 +127,7 @@ void mvme147_sched_init (irq_handler_t timer_routine)

/* This is always executed with interrupts disabled. */
/* XXX There are race hazards in this code XXX */
-unsigned long mvme147_gettimeoffset (void)
+u32 mvme147_gettimeoffset(void)
{
volatile unsigned short *cp = (volatile unsigned short *)0xfffe1012;
unsigned short n;
@@ -137,7 +137,7 @@ unsigned long mvme147_gettimeoffset (void)
n = *cp;

n -= PCC_TIMER_PRELOAD;
- return (unsigned long)n * 25 / 4;
+ return ((unsigned long)n * 25 / 4) * 1000;
}

static int bcd2int (unsigned char b)
diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
index b6d7d8a..080a342 100644
--- a/arch/m68k/mvme16x/config.c
+++ b/arch/m68k/mvme16x/config.c
@@ -43,7 +43,7 @@ static MK48T08ptr_t volatile rtc = (MK48T08ptr_t)MVME_RTC_BASE;

static void mvme16x_get_model(char *model);
extern void mvme16x_sched_init(irq_handler_t handler);
-extern unsigned long mvme16x_gettimeoffset (void);
+extern u32 mvme16x_gettimeoffset(void);
extern int mvme16x_hwclk (int, struct rtc_time *);
extern int mvme16x_set_clock_mmss (unsigned long);
extern void mvme16x_reset (void);
@@ -289,7 +289,7 @@ void __init config_mvme16x(void)
mach_max_dma_address = 0xffffffff;
mach_sched_init = mvme16x_sched_init;
mach_init_IRQ = mvme16x_init_IRQ;
- mach_gettimeoffset = mvme16x_gettimeoffset;
+ arch_gettimeoffset = mvme16x_gettimeoffset;
mach_hwclk = mvme16x_hwclk;
mach_set_clock_mmss = mvme16x_set_clock_mmss;
mach_reset = mvme16x_reset;
@@ -405,9 +405,9 @@ void mvme16x_sched_init (irq_handler_t timer_routine)


/* This is always executed with interrupts disabled. */
-unsigned long mvme16x_gettimeoffset (void)
+u32 mvme16x_gettimeoffset(void)
{
- return (*(volatile unsigned long *)0xfff42008);
+ return (*(volatile u32 *)0xfff42008) * 1000;
}

int bcd2int (unsigned char b)
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index 1adb5b7..658542b 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -40,7 +40,7 @@ extern void q40_init_IRQ(void);
static void q40_get_model(char *model);
extern void q40_sched_init(irq_handler_t handler);

-static unsigned long q40_gettimeoffset(void);
+static u32 q40_gettimeoffset(void);
static int q40_hwclk(int, struct rtc_time *);
static unsigned int q40_get_ss(void);
static int q40_set_clock_mmss(unsigned long);
@@ -170,7 +170,7 @@ void __init config_q40(void)
mach_sched_init = q40_sched_init;

mach_init_IRQ = q40_init_IRQ;
- mach_gettimeoffset = q40_gettimeoffset;
+ arch_gettimeoffset = q40_gettimeoffset;
mach_hwclk = q40_hwclk;
mach_get_ss = q40_get_ss;
mach_get_rtc_pll = q40_get_rtc_pll;
@@ -204,9 +204,9 @@ int q40_parse_bootinfo(const struct bi_record *rec)
}


-static unsigned long q40_gettimeoffset(void)
+static u32 q40_gettimeoffset(void)
{
- return 5000 * (ql_ticks != 0);
+ return 5000 * (ql_ticks != 0) * 1000;
}


diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
index 2ca25bd..f59ec58 100644
--- a/arch/m68k/sun3/config.c
+++ b/arch/m68k/sun3/config.c
@@ -36,7 +36,7 @@

char sun3_reserved_pmeg[SUN3_PMEGS_NUM];

-extern unsigned long sun3_gettimeoffset(void);
+extern u32 sun3_gettimeoffset(void);
static void sun3_sched_init(irq_handler_t handler);
extern void sun3_get_model (char* model);
extern int sun3_hwclk(int set, struct rtc_time *t);
@@ -141,7 +141,7 @@ void __init config_sun3(void)
mach_sched_init = sun3_sched_init;
mach_init_IRQ = sun3_init_IRQ;
mach_reset = sun3_reboot;
- mach_gettimeoffset = sun3_gettimeoffset;
+ arch_gettimeoffset = sun3_gettimeoffset;
mach_get_model = sun3_get_model;
mach_hwclk = sun3_hwclk;
mach_halt = sun3_halt;
diff --git a/arch/m68k/sun3/intersil.c b/arch/m68k/sun3/intersil.c
index 94fe801..889829e 100644
--- a/arch/m68k/sun3/intersil.c
+++ b/arch/m68k/sun3/intersil.c
@@ -23,9 +23,9 @@
#define START_VAL (INTERSIL_RUN | INTERSIL_INT_ENABLE | INTERSIL_24H_MODE)

/* does this need to be implemented? */
-unsigned long sun3_gettimeoffset(void)
+u32 sun3_gettimeoffset(void)
{
- return 1;
+ return 1000;
}


diff --git a/arch/m68k/sun3x/config.c b/arch/m68k/sun3x/config.c
index dd306c8..0532d64 100644
--- a/arch/m68k/sun3x/config.c
+++ b/arch/m68k/sun3x/config.c
@@ -48,7 +48,7 @@ void __init config_sun3x(void)
mach_sched_init = sun3x_sched_init;
mach_init_IRQ = sun3_init_IRQ;

- mach_gettimeoffset = sun3x_gettimeoffset;
+ arch_gettimeoffset = sun3x_gettimeoffset;
mach_reset = sun3x_reboot;

mach_hwclk = sun3x_hwclk;
diff --git a/arch/m68k/sun3x/time.c b/arch/m68k/sun3x/time.c
index 1d0a724..c8eb08a 100644
--- a/arch/m68k/sun3x/time.c
+++ b/arch/m68k/sun3x/time.c
@@ -71,7 +71,7 @@ int sun3x_hwclk(int set, struct rtc_time *t)
return 0;
}
/* Not much we can do here */
-unsigned long sun3x_gettimeoffset (void)
+u32 sun3x_gettimeoffset(void)
{
return 0L;
}
diff --git a/arch/m68k/sun3x/time.h b/arch/m68k/sun3x/time.h
index 6909e12..a4f9126 100644
--- a/arch/m68k/sun3x/time.h
+++ b/arch/m68k/sun3x/time.h
@@ -2,7 +2,7 @@
#define SUN3X_TIME_H

extern int sun3x_hwclk(int set, struct rtc_time *t);
-unsigned long sun3x_gettimeoffset (void);
+u32 sun3x_gettimeoffset(void);
void sun3x_sched_init(irq_handler_t vector);

struct mostek_dt {
--
1.7.0.4

2012-11-08 21:02:31

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 08/11] ARM: ux500: convert timer suspend/resume to clock_event_device

From: Stephen Warren <[email protected]>

Move ux500's timer suspend/resume functions from struct sys_timer
ux500_timer into struct clock_event_device nmdk_clkevt. This
will allow the sys_timer suspend/resume fields to be removed, and
eventually lead to a complete removal of struct sys_timer.

Cc: Srinidhi Kasagar <[email protected]>
Cc: Linus Walleij <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
---
arch/arm/mach-ux500/timer.c | 7 -------
drivers/clocksource/nomadik-mtu.c | 33 ++++++++++++++++++++-------------
2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c
index 875309a..46a7244 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -100,13 +100,6 @@ dt_fail:
ux500_twd_init();
}

-static void ux500_timer_reset(void)
-{
- nmdk_clkevt_reset();
- nmdk_clksrc_reset();
-}
-
struct sys_timer ux500_timer = {
.init = ux500_timer_init,
- .resume = ux500_timer_reset,
};
diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c
index 23c780b..a60b077 100644
--- a/drivers/clocksource/nomadik-mtu.c
+++ b/drivers/clocksource/nomadik-mtu.c
@@ -134,12 +134,32 @@ static void nmdk_clkevt_mode(enum clock_event_mode mode,
}
}

+void nmdk_clksrc_reset(void)
+{
+ /* Disable */
+ writel(0, mtu_base + MTU_CR(0));
+
+ /* ClockSource: configure load and background-load, and fire it up */
+ writel(nmdk_cycle, mtu_base + MTU_LR(0));
+ writel(nmdk_cycle, mtu_base + MTU_BGLR(0));
+
+ writel(clk_prescale | MTU_CRn_32BITS | MTU_CRn_ENA,
+ mtu_base + MTU_CR(0));
+}
+
+static void nmdk_clkevt_resume(struct clock_event_device *cedev)
+{
+ nmdk_clkevt_reset();
+ nmdk_clksrc_reset();
+}
+
static struct clock_event_device nmdk_clkevt = {
.name = "mtu_1",
.features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
.rating = 200,
.set_mode = nmdk_clkevt_mode,
.set_next_event = nmdk_clkevt_next,
+ .resume = nmdk_clkevt_resume,
};

/*
@@ -161,19 +181,6 @@ static struct irqaction nmdk_timer_irq = {
.dev_id = &nmdk_clkevt,
};

-void nmdk_clksrc_reset(void)
-{
- /* Disable */
- writel(0, mtu_base + MTU_CR(0));
-
- /* ClockSource: configure load and background-load, and fire it up */
- writel(nmdk_cycle, mtu_base + MTU_LR(0));
- writel(nmdk_cycle, mtu_base + MTU_BGLR(0));
-
- writel(clk_prescale | MTU_CRn_32BITS | MTU_CRn_ENA,
- mtu_base + MTU_CR(0));
-}
-
void __init nmdk_timer_init(void __iomem *base, int irq)
{
unsigned long rate;
--
1.7.0.4

2012-11-08 21:02:27

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 06/11] ARM: pxa: convert timer suspend/resume to clock_event_device

From: Stephen Warren <[email protected]>

Move PXA's timer suspend/resume functions from struct sys_timer
pxa_timer into struct clock_event_device ckevt_pxa_osmr0. This
will allow the sys_timer suspend/resume fields to be removed, and
eventually lead to a complete removal of struct sys_timer.

Cc: Eric Miao <[email protected]>
Cc: Russell King <[email protected]>
Cc: Haojian Zhuang <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
---
arch/arm/mach-pxa/time.c | 76 +++++++++++++++++++++++-----------------------
1 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index 4bc47d6..ce58bc9 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -89,12 +89,50 @@ pxa_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *dev)
}
}

+#ifdef CONFIG_PM
+static unsigned long osmr[4], oier, oscr;
+
+static void pxa_timer_suspend(struct clock_event_device *cedev)
+{
+ osmr[0] = readl_relaxed(OSMR0);
+ osmr[1] = readl_relaxed(OSMR1);
+ osmr[2] = readl_relaxed(OSMR2);
+ osmr[3] = readl_relaxed(OSMR3);
+ oier = readl_relaxed(OIER);
+ oscr = readl_relaxed(OSCR);
+}
+
+static void pxa_timer_resume(struct clock_event_device *cedev)
+{
+ /*
+ * Ensure that we have at least MIN_OSCR_DELTA between match
+ * register 0 and the OSCR, to guarantee that we will receive
+ * the one-shot timer interrupt. We adjust OSMR0 in preference
+ * to OSCR to guarantee that OSCR is monotonically incrementing.
+ */
+ if (osmr[0] - oscr < MIN_OSCR_DELTA)
+ osmr[0] += MIN_OSCR_DELTA;
+
+ writel_relaxed(osmr[0], OSMR0);
+ writel_relaxed(osmr[1], OSMR1);
+ writel_relaxed(osmr[2], OSMR2);
+ writel_relaxed(osmr[3], OSMR3);
+ writel_relaxed(oier, OIER);
+ writel_relaxed(oscr, OSCR);
+}
+#else
+#define pxa_timer_suspend NULL
+#define pxa_timer_resume NULL
+#endif
+
static struct clock_event_device ckevt_pxa_osmr0 = {
.name = "osmr0",
.features = CLOCK_EVT_FEAT_ONESHOT,
.rating = 200,
.set_next_event = pxa_osmr0_set_next_event,
.set_mode = pxa_osmr0_set_mode,
+ .suspend = pxa_timer_suspend,
+ .resume = pxa_timer_resume,
};

static struct irqaction pxa_ost0_irq = {
@@ -127,44 +165,6 @@ static void __init pxa_timer_init(void)
clockevents_register_device(&ckevt_pxa_osmr0);
}

-#ifdef CONFIG_PM
-static unsigned long osmr[4], oier, oscr;
-
-static void pxa_timer_suspend(void)
-{
- osmr[0] = readl_relaxed(OSMR0);
- osmr[1] = readl_relaxed(OSMR1);
- osmr[2] = readl_relaxed(OSMR2);
- osmr[3] = readl_relaxed(OSMR3);
- oier = readl_relaxed(OIER);
- oscr = readl_relaxed(OSCR);
-}
-
-static void pxa_timer_resume(void)
-{
- /*
- * Ensure that we have at least MIN_OSCR_DELTA between match
- * register 0 and the OSCR, to guarantee that we will receive
- * the one-shot timer interrupt. We adjust OSMR0 in preference
- * to OSCR to guarantee that OSCR is monotonically incrementing.
- */
- if (osmr[0] - oscr < MIN_OSCR_DELTA)
- osmr[0] += MIN_OSCR_DELTA;
-
- writel_relaxed(osmr[0], OSMR0);
- writel_relaxed(osmr[1], OSMR1);
- writel_relaxed(osmr[2], OSMR2);
- writel_relaxed(osmr[3], OSMR3);
- writel_relaxed(oier, OIER);
- writel_relaxed(oscr, OSCR);
-}
-#else
-#define pxa_timer_suspend NULL
-#define pxa_timer_resume NULL
-#endif
-
struct sys_timer pxa_timer = {
.init = pxa_timer_init,
- .suspend = pxa_timer_suspend,
- .resume = pxa_timer_resume,
};
--
1.7.0.4

2012-11-08 21:02:36

by Stephen Warren

[permalink] [raw]
Subject: [RFC PATCH 11/11] ARM: delete struct sys_timer

From: Stephen Warren <[email protected]>

Now that the only field in struct sys_timer is .init, delete the struct,
and replace the machine descriptor .timer field with the initialization
function itself.

This will enable moving timer drivers into drivers/clocksource without
having to place a public prototype of each struct sys_timer object into
include/linux; the intent is to create a single of_clocksource_init()
function that determines which timer driver to initialize by scanning
the device dtree, much like the proposed irqchip_init() at:
http://www.spinics.net/lists/arm-kernel/msg203686.html

RFC: This will be quite a large patch since it'll end up touching tens
or hundreds of ARM board files, timer drivers, etc. Perhaps it'd be
better to create patches that:

1) Add .init_time field to machine descriptor, update ARM's time_init to
use that if present, else fall back to .timer.init.
2) 1 patch per ARM sub-architecture to convert to from .timer to
.init_time.
3) Remove sys_timer and machine descriptor .timer field.

For now, this patch only converts Tegra as an example of my intent.

Signed-off-by: Stephen Warren <[email protected]>
---
arch/arm/include/asm/mach/arch.h | 3 +--
arch/arm/include/asm/mach/time.h | 16 ----------------
arch/arm/kernel/time.c | 9 +--------
arch/arm/mach-tegra/board-dt-tegra20.c | 2 +-
arch/arm/mach-tegra/board-dt-tegra30.c | 2 +-
arch/arm/mach-tegra/board.h | 2 +-
arch/arm/mach-tegra/timer.c | 6 +-----
7 files changed, 6 insertions(+), 34 deletions(-)

diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 917d4fc..308ad7d 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -12,7 +12,6 @@

struct tag;
struct meminfo;
-struct sys_timer;
struct pt_regs;
struct smp_operations;
#ifdef CONFIG_SMP
@@ -48,7 +47,7 @@ struct machine_desc {
void (*map_io)(void);/* IO mapping function */
void (*init_early)(void);
void (*init_irq)(void);
- struct sys_timer *timer; /* system tick timer */
+ void (*init_time)(void);
void (*init_machine)(void);
void (*init_late)(void);
#ifdef CONFIG_MULTI_IRQ_HANDLER
diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h
index d316d76..90c12e1 100644
--- a/arch/arm/include/asm/mach/time.h
+++ b/arch/arm/include/asm/mach/time.h
@@ -10,22 +10,6 @@
#ifndef __ASM_ARM_MACH_TIME_H
#define __ASM_ARM_MACH_TIME_H

-/*
- * This is our kernel timer structure.
- *
- * - init
- * Initialise the kernels jiffy timer source, claim interrupt
- * using setup_irq. This is called early on during initialisation
- * while interrupts are still disabled on the local CPU.
- * - offset
- * Return the timer offset in microseconds since the last timer
- * interrupt. Note: this must take account of any unprocessed
- * timer interrupt which may be pending.
- */
-struct sys_timer {
- void (*init)(void);
-};
-
extern void timer_tick(void);

struct timespec;
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 0b51a7c..955d92d 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -30,11 +30,6 @@
#include <asm/mach/arch.h>
#include <asm/mach/time.h>

-/*
- * Our system timer.
- */
-static struct sys_timer *system_timer;
-
#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \
defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE)
/* this needs a better home */
@@ -120,8 +115,6 @@ int __init register_persistent_clock(clock_access_fn read_boot,

void __init time_init(void)
{
- system_timer = machine_desc->timer;
- system_timer->init();
+ machine_desc->init_time();
sched_clock_postinit();
}
-
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index 22f5a9b..3777b03 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -192,7 +192,7 @@ DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)")
.init_early = tegra20_init_early,
.init_irq = tegra_dt_init_irq,
.handle_irq = gic_handle_irq,
- .timer = &tegra_sys_timer,
+ .init_time = tegra_init_timer,
.init_machine = tegra_dt_init,
.init_late = tegra_dt_init_late,
.restart = tegra_assert_system_reset,
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c
index cd30338..08d3b19 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -104,7 +104,7 @@ DT_MACHINE_START(TEGRA30_DT, "NVIDIA Tegra30 (Flattened Device Tree)")
.init_early = tegra30_init_early,
.init_irq = tegra_dt_init_irq,
.handle_irq = gic_handle_irq,
- .timer = &tegra_sys_timer,
+ .init_time = tegra_init_timer,
.init_machine = tegra30_dt_init,
.init_late = tegra_init_late,
.restart = tegra_assert_system_reset,
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index 91fbe73..744cdd2 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -55,5 +55,5 @@ static inline int harmony_pcie_init(void) { return 0; }

void __init tegra_paz00_wifikill_init(void);

-extern struct sys_timer tegra_sys_timer;
+extern void tegra_init_timer(void);
#endif
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index e4863f3..b0036e5 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -168,7 +168,7 @@ static const struct of_device_id rtc_match[] __initconst = {
{}
};

-static void __init tegra_init_timer(void)
+void __init tegra_init_timer(void)
{
struct device_node *np;
struct clk *clk;
@@ -273,10 +273,6 @@ static void __init tegra_init_timer(void)
register_persistent_clock(NULL, tegra_read_persistent_clock);
}

-struct sys_timer tegra_sys_timer = {
- .init = tegra_init_timer,
-};
-
#ifdef CONFIG_PM
static u32 usec_config;

--
1.7.0.4

2012-11-08 21:02:51

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 10/11] ARM: remove struct sys_timer suspend and resume fields

From: Stephen Warren <[email protected]>

These fields duplicate e.g. struct clock_event_device's suspend and
resume fields, so remove them now that nothing is using them. The aim
is to remove all fields from struct sys_timer except .init, then replace
the ARM machine descriptor's .timer field with a .init_time function
instead, and delete struct sys_timer.

Signed-off-by: Stephen Warren <[email protected]>
---
arch/arm/include/asm/mach/time.h | 11 -----------
arch/arm/kernel/time.c | 34 ----------------------------------
2 files changed, 0 insertions(+), 45 deletions(-)

diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h
index cac8d9c..d316d76 100644
--- a/arch/arm/include/asm/mach/time.h
+++ b/arch/arm/include/asm/mach/time.h
@@ -17,15 +17,6 @@
* Initialise the kernels jiffy timer source, claim interrupt
* using setup_irq. This is called early on during initialisation
* while interrupts are still disabled on the local CPU.
- * - suspend
- * Suspend the kernel jiffy timer source, if necessary. This
- * is called with interrupts disabled, after all normal devices
- * have been suspended. If no action is required, set this to
- * NULL.
- * - resume
- * Resume the kernel jiffy timer source, if necessary. This
- * is called with interrupts disabled before any normal devices
- * are resumed. If no action is required, set this to NULL.
* - offset
* Return the timer offset in microseconds since the last timer
* interrupt. Note: this must take account of any unprocessed
@@ -33,8 +24,6 @@
*/
struct sys_timer {
void (*init)(void);
- void (*suspend)(void);
- void (*resume)(void);
};

extern void timer_tick(void);
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index ea36bfa..0b51a7c 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -21,7 +21,6 @@
#include <linux/timex.h>
#include <linux/errno.h>
#include <linux/profile.h>
-#include <linux/syscore_ops.h>
#include <linux/timer.h>
#include <linux/irq.h>

@@ -119,39 +118,6 @@ int __init register_persistent_clock(clock_access_fn read_boot,
return -EINVAL;
}

-#if defined(CONFIG_PM) && !defined(CONFIG_GENERIC_CLOCKEVENTS)
-static int timer_suspend(void)
-{
- if (system_timer->suspend)
- system_timer->suspend();
-
- return 0;
-}
-
-static void timer_resume(void)
-{
- if (system_timer->resume)
- system_timer->resume();
-}
-#else
-#define timer_suspend NULL
-#define timer_resume NULL
-#endif
-
-static struct syscore_ops timer_syscore_ops = {
- .suspend = timer_suspend,
- .resume = timer_resume,
-};
-
-static int __init timer_init_syscore_ops(void)
-{
- register_syscore_ops(&timer_syscore_ops);
-
- return 0;
-}
-
-device_initcall(timer_init_syscore_ops);
-
void __init time_init(void)
{
system_timer = machine_desc->timer;
--
1.7.0.4

2012-11-08 21:03:21

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 09/11] ARM: samsung: register syscore_ops for timer resume directly

From: Stephen Warren <[email protected]>

Instead of using struct sys_timer's resume function, register syscore_ops
directly in s3c2410_timer_init(). This will allow the sys_timer suspend/
resume fields to be removed, and eventually lead to a complete removal of
struct sys_timer.

Cc: Ben Dooks <[email protected]>
Cc: Kukjin Kim <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
---
arch/arm/plat-samsung/time.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c
index 67206df..773745a 100644
--- a/arch/arm/plat-samsung/time.c
+++ b/arch/arm/plat-samsung/time.c
@@ -27,6 +27,7 @@
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/platform_device.h>
+#include <linux/syscore_ops.h>

#include <asm/mach-types.h>

@@ -271,6 +272,10 @@ static void __init s3c2410_timer_resources(void)
clk_enable(tin);
}

+static struct syscore_ops s3c24xx_syscore_ops = {
+ .resume = s3c2410_timer_setup,
+};
+
static void __init s3c2410_timer_init(void)
{
arch_gettimeoffset = s3c2410_gettimeoffset;
@@ -278,9 +283,9 @@ static void __init s3c2410_timer_init(void)
s3c2410_timer_resources();
s3c2410_timer_setup();
setup_irq(IRQ_TIMER4, &s3c2410_timer_irq);
+ register_syscore_ops(&s3c24xx_syscore_ops);
}

struct sys_timer s3c24xx_timer = {
.init = s3c2410_timer_init,
- .resume = s3c2410_timer_setup
};
--
1.7.0.4

2012-11-08 21:03:57

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 07/11] ARM: sa1100: convert timer suspend/resume to clock_event_device

From: Stephen Warren <[email protected]>

Move sa1100's timer suspend/resume functions from struct sys_timer
sa1100_timer into struct clock_event_device ckevt_sa1100_osmr0. This
will allow the sys_timer suspend/resume fields to be removed, and
eventually lead to a complete removal of struct sys_timer.

Signed-off-by: Stephen Warren <[email protected]>
---
arch/arm/mach-sa1100/time.c | 66 +++++++++++++++++++++---------------------
1 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index 80702c9..164f827 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -69,12 +69,45 @@ sa1100_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *c)
}
}

+#ifdef CONFIG_PM
+unsigned long osmr[4], oier;
+
+static void sa1100_timer_suspend(struct clock_event_device *cedev)
+{
+ osmr[0] = readl_relaxed(OSMR0);
+ osmr[1] = readl_relaxed(OSMR1);
+ osmr[2] = readl_relaxed(OSMR2);
+ osmr[3] = readl_relaxed(OSMR3);
+ oier = readl_relaxed(OIER);
+}
+
+static void sa1100_timer_resume(struct clock_event_device *cedev)
+{
+ writel_relaxed(0x0f, OSSR);
+ writel_relaxed(osmr[0], OSMR0);
+ writel_relaxed(osmr[1], OSMR1);
+ writel_relaxed(osmr[2], OSMR2);
+ writel_relaxed(osmr[3], OSMR3);
+ writel_relaxed(oier, OIER);
+
+ /*
+ * OSMR0 is the system timer: make sure OSCR is sufficiently behind
+ */
+ writel_relaxed(OSMR0 - LATCH, OSCR);
+}
+#else
+#define sa1100_timer_suspend NULL
+#define sa1100_timer_resume NULL
+#endif
+
static struct clock_event_device ckevt_sa1100_osmr0 = {
.name = "osmr0",
.features = CLOCK_EVT_FEAT_ONESHOT,
.rating = 200,
.set_next_event = sa1100_osmr0_set_next_event,
.set_mode = sa1100_osmr0_set_mode,
+ .suspend = sa1100_timer_suspend,
+ .resume = sa1100_timer_resume,
};

static struct irqaction sa1100_timer_irq = {
@@ -105,39 +138,6 @@ static void __init sa1100_timer_init(void)
clockevents_register_device(&ckevt_sa1100_osmr0);
}

-#ifdef CONFIG_PM
-unsigned long osmr[4], oier;
-
-static void sa1100_timer_suspend(void)
-{
- osmr[0] = readl_relaxed(OSMR0);
- osmr[1] = readl_relaxed(OSMR1);
- osmr[2] = readl_relaxed(OSMR2);
- osmr[3] = readl_relaxed(OSMR3);
- oier = readl_relaxed(OIER);
-}
-
-static void sa1100_timer_resume(void)
-{
- writel_relaxed(0x0f, OSSR);
- writel_relaxed(osmr[0], OSMR0);
- writel_relaxed(osmr[1], OSMR1);
- writel_relaxed(osmr[2], OSMR2);
- writel_relaxed(osmr[3], OSMR3);
- writel_relaxed(oier, OIER);
-
- /*
- * OSMR0 is the system timer: make sure OSCR is sufficiently behind
- */
- writel_relaxed(OSMR0 - LATCH, OSCR);
-}
-#else
-#define sa1100_timer_suspend NULL
-#define sa1100_timer_resume NULL
-#endif
-
struct sys_timer sa1100_timer = {
.init = sa1100_timer_init,
- .suspend = sa1100_timer_suspend,
- .resume = sa1100_timer_resume,
};
--
1.7.0.4

2012-11-08 21:04:16

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 05/11] ARM: at91: convert timer suspend/resume to clock_event_device

From: Stephen Warren <[email protected]>

Move at91's timer suspend/resume functions from struct sys_timer
at91sam926x_timer into struct clock_event_device pit_clkevt. This
will allow the sys_timer suspend/resume fields to be removed, and
eventually lead to a complete removal of struct sys_timer.

Cc: Andrew Victor <[email protected]>
Cc: Nicolas Ferre <[email protected]>
Cc: Jean-Christophe Plagniol-Villard <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
---
arch/arm/mach-at91/at91sam926x_time.c | 47 ++++++++++++++++++--------------
1 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
index ffc0957..2794882 100644
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ b/arch/arm/mach-at91/at91sam926x_time.c
@@ -94,12 +94,38 @@ pit_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev)
}
}

+static void at91sam926x_pit_suspend(struct clock_event_device *cedev)
+{
+ /* Disable timer */
+ pit_write(AT91_PIT_MR, 0);
+}
+
+static void at91sam926x_pit_reset(void)
+{
+ /* Disable timer and irqs */
+ pit_write(AT91_PIT_MR, 0);
+
+ /* Clear any pending interrupts, wait for PIT to stop counting */
+ while (PIT_CPIV(pit_read(AT91_PIT_PIVR)) != 0)
+ cpu_relax();
+
+ /* Start PIT but don't enable IRQ */
+ pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN);
+}
+
+static void at91sam926x_pit_resume(struct clock_event_device *cedev)
+{
+ at91sam926x_pit_reset();
+}
+
static struct clock_event_device pit_clkevt = {
.name = "pit",
.features = CLOCK_EVT_FEAT_PERIODIC,
.shift = 32,
.rating = 100,
.set_mode = pit_clkevt_mode,
+ .suspend = at91sam926x_pit_suspend,
+ .resume = at91sam926x_pit_resume,
};


@@ -140,19 +166,6 @@ static struct irqaction at91sam926x_pit_irq = {
.irq = NR_IRQS_LEGACY + AT91_ID_SYS,
};

-static void at91sam926x_pit_reset(void)
-{
- /* Disable timer and irqs */
- pit_write(AT91_PIT_MR, 0);
-
- /* Clear any pending interrupts, wait for PIT to stop counting */
- while (PIT_CPIV(pit_read(AT91_PIT_PIVR)) != 0)
- cpu_relax();
-
- /* Start PIT but don't enable IRQ */
- pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN);
-}
-
#ifdef CONFIG_OF
static struct of_device_id pit_timer_ids[] = {
{ .compatible = "atmel,at91sam9260-pit" },
@@ -240,12 +253,6 @@ static void __init at91sam926x_pit_init(void)
clockevents_register_device(&pit_clkevt);
}

-static void at91sam926x_pit_suspend(void)
-{
- /* Disable timer */
- pit_write(AT91_PIT_MR, 0);
-}
-
void __init at91sam926x_ioremap_pit(u32 addr)
{
#if defined(CONFIG_OF)
@@ -265,6 +272,4 @@ void __init at91sam926x_ioremap_pit(u32 addr)

struct sys_timer at91sam926x_timer = {
.init = at91sam926x_pit_init,
- .suspend = at91sam926x_pit_suspend,
- .resume = at91sam926x_pit_reset,
};
--
1.7.0.4

2012-11-08 21:04:33

by Stephen Warren

[permalink] [raw]
Subject: Re: [PATCH] ARM: delete struct sys_timer

On 11/08/2012 02:01 PM, Stephen Warren wrote:
> Now that the only field in struct sys_timer is .init, delete the struct,
> and replace the machine descriptor .timer field with the initialization
> function itself.

Oops. This one patch is a duplicate of 11/11 in the series I just sent.
Sorry.

2012-11-08 21:04:51

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 04/11] ARM: set arch_gettimeoffset directly

From: Stephen Warren <[email protected]>

remove ARM's struct sys_timer .offset function pointer, and instead
directly set the arch_gettimeoffset function pointer when the timer
driver is initialized. This requires multiplying all function results
by 1000, since the removed arm_gettimeoffset() did this. Also,
s/unsigned long/u32/ just to make the function prototypes exactly
match that of arch_gettimeoffset.

Cc: Russell King <[email protected]>
Cc: Andrew Victor <[email protected]>
Cc: Nicolas Ferre <[email protected]>
Cc: Jean-Christophe Plagniol-Villard <[email protected]>
Cc: Hartley Sweeten <[email protected]>
Cc: Ryan Mallon <[email protected]>
Cc: Ben Dooks <[email protected]>
Cc: Kukjin Kim <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
---
arch/arm/include/asm/mach/time.h | 3 ---
arch/arm/kernel/time.c | 14 --------------
arch/arm/mach-at91/at91x40_time.c | 8 +++++---
arch/arm/mach-ebsa110/core.c | 7 ++++---
arch/arm/mach-ep93xx/core.c | 23 ++++++++++++-----------
arch/arm/mach-h720x/common.c | 6 +++---
arch/arm/mach-h720x/common.h | 2 +-
arch/arm/mach-h720x/cpu-h7201.c | 3 ++-
arch/arm/mach-h720x/cpu-h7202.c | 3 ++-
arch/arm/mach-rpc/time.c | 6 +++---
arch/arm/plat-samsung/time.c | 7 ++++---
11 files changed, 36 insertions(+), 46 deletions(-)

diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h
index 6ca945f..cac8d9c 100644
--- a/arch/arm/include/asm/mach/time.h
+++ b/arch/arm/include/asm/mach/time.h
@@ -35,9 +35,6 @@ struct sys_timer {
void (*init)(void);
void (*suspend)(void);
void (*resume)(void);
-#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
- unsigned long (*offset)(void);
-#endif
};

extern void timer_tick(void);
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index b0190b4..ea36bfa 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -69,16 +69,6 @@ unsigned long profile_pc(struct pt_regs *regs)
EXPORT_SYMBOL(profile_pc);
#endif

-#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
-static u32 arm_gettimeoffset(void)
-{
- if (system_timer->offset != NULL)
- return system_timer->offset() * 1000;
-
- return 0;
-}
-#endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */
-
#ifndef CONFIG_GENERIC_CLOCKEVENTS
/*
* Kernel system timer support.
@@ -164,10 +154,6 @@ device_initcall(timer_init_syscore_ops);

void __init time_init(void)
{
-#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
- arch_gettimeoffset = arm_gettimeoffset;
-#endif
-
system_timer = machine_desc->timer;
system_timer->init();
sched_clock_postinit();
diff --git a/arch/arm/mach-at91/at91x40_time.c b/arch/arm/mach-at91/at91x40_time.c
index ee06d7b..eb6151e 100644
--- a/arch/arm/mach-at91/at91x40_time.c
+++ b/arch/arm/mach-at91/at91x40_time.c
@@ -41,9 +41,10 @@
#define AT91_TC_CLK1BASE 0x40
#define AT91_TC_CLK2BASE 0x80

-static unsigned long at91x40_gettimeoffset(void)
+static u32 at91x40_gettimeoffset(void)
{
- return (at91_tc_read(AT91_TC_CLK1BASE + AT91_TC_CV) * 1000000 / (AT91X40_MASTER_CLOCK / 128));
+ return (at91_tc_read(AT91_TC_CLK1BASE + AT91_TC_CV) * 1000000 /
+ (AT91X40_MASTER_CLOCK / 128)) * 1000;
}

static irqreturn_t at91x40_timer_interrupt(int irq, void *dev_id)
@@ -63,6 +64,8 @@ void __init at91x40_timer_init(void)
{
unsigned int v;

+ arch_gettimeoffset = at91x40_gettimeoffset;
+
at91_tc_write(AT91_TC_BCR, 0);
v = at91_tc_read(AT91_TC_BMR);
v = (v & ~AT91_TC_TC1XC1S) | AT91_TC_TC1XC1S_NONE;
@@ -81,6 +84,5 @@ void __init at91x40_timer_init(void)

struct sys_timer at91x40_timer = {
.init = at91x40_timer_init,
- .offset = at91x40_gettimeoffset,
};

diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index f0fe6b5..d96dd94 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -158,7 +158,7 @@ static void __init ebsa110_init_early(void)
* interrupt, then the PIT counter will roll over (ie, be negative).
* This actually works out to be convenient.
*/
-static unsigned long ebsa110_gettimeoffset(void)
+static u32 ebsa110_gettimeoffset(void)
{
unsigned long offset, count;

@@ -181,7 +181,7 @@ static unsigned long ebsa110_gettimeoffset(void)
*/
offset = offset * (1000000 / HZ) / COUNT;

- return offset;
+ return offset * 1000;
}

static irqreturn_t
@@ -215,6 +215,8 @@ static struct irqaction ebsa110_timer_irq = {
*/
static void __init ebsa110_timer_init(void)
{
+ arch_gettimeoffset = ebsa110_gettimeoffset;
+
/*
* Timer 1, mode 2, LSB/MSB
*/
@@ -227,7 +229,6 @@ static void __init ebsa110_timer_init(void)

static struct sys_timer ebsa110_timer = {
.init = ebsa110_timer_init,
- .offset = ebsa110_gettimeoffset,
};

static struct plat_serial8250_port serial_platform_data[] = {
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index e85bf17..c084acf 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -140,11 +140,23 @@ static struct irqaction ep93xx_timer_irq = {
.handler = ep93xx_timer_interrupt,
};

+static u32 ep93xx_gettimeoffset(void)
+{
+ int offset;
+
+ offset = __raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time;
+
+ /* Calculate (1000000 / 983040) * offset. */
+ return (offset + (53 * offset / 3072)) * 1000;
+}
+
static void __init ep93xx_timer_init(void)
{
u32 tmode = EP93XX_TIMER123_CONTROL_MODE |
EP93XX_TIMER123_CONTROL_CLKSEL;

+ arch_gettimeoffset = ep93xx_gettimeoffset;
+
/* Enable periodic HZ timer. */
__raw_writel(tmode, EP93XX_TIMER1_CONTROL);
__raw_writel(TIMER1_RELOAD, EP93XX_TIMER1_LOAD);
@@ -158,19 +170,8 @@ static void __init ep93xx_timer_init(void)
setup_irq(IRQ_EP93XX_TIMER1, &ep93xx_timer_irq);
}

-static unsigned long ep93xx_gettimeoffset(void)
-{
- int offset;
-
- offset = __raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time;
-
- /* Calculate (1000000 / 983040) * offset. */
- return offset + (53 * offset / 3072);
-}
-
struct sys_timer ep93xx_timer = {
.init = ep93xx_timer_init,
- .offset = ep93xx_gettimeoffset,
};


diff --git a/arch/arm/mach-h720x/common.c b/arch/arm/mach-h720x/common.c
index aa1331e..17ef91f 100644
--- a/arch/arm/mach-h720x/common.c
+++ b/arch/arm/mach-h720x/common.c
@@ -42,12 +42,12 @@ void __init arch_dma_init(dma_t *dma)
}

/*
- * Return usecs since last timer reload
+ * Return nsecs since last timer reload
* (timercount * (usecs perjiffie)) / (ticks per jiffie)
*/
-unsigned long h720x_gettimeoffset(void)
+u32 h720x_gettimeoffset(void)
{
- return (CPU_REG (TIMER_VIRT, TM0_COUNT) * tick_usec) / LATCH;
+ return ((CPU_REG(TIMER_VIRT, TM0_COUNT) * tick_usec) / LATCH) * 1000;
}

/*
diff --git a/arch/arm/mach-h720x/common.h b/arch/arm/mach-h720x/common.h
index 2489537..79cfb97 100644
--- a/arch/arm/mach-h720x/common.h
+++ b/arch/arm/mach-h720x/common.h
@@ -13,7 +13,7 @@
*
*/

-extern unsigned long h720x_gettimeoffset(void);
+extern u32 h720x_gettimeoffset(void);
extern void __init h720x_init_irq(void);
extern void __init h720x_map_io(void);
extern void h720x_restart(char, const char *);
diff --git a/arch/arm/mach-h720x/cpu-h7201.c b/arch/arm/mach-h720x/cpu-h7201.c
index 24df2a3..ba349cf 100644
--- a/arch/arm/mach-h720x/cpu-h7201.c
+++ b/arch/arm/mach-h720x/cpu-h7201.c
@@ -46,6 +46,8 @@ static struct irqaction h7201_timer_irq = {
*/
void __init h7201_init_time(void)
{
+ arch_gettimeoffset = h720x_gettimeoffset;
+
CPU_REG (TIMER_VIRT, TM0_PERIOD) = LATCH;
CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_RESET;
CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_REPEAT | TM_START;
@@ -56,5 +58,4 @@ void __init h7201_init_time(void)

struct sys_timer h7201_timer = {
.init = h7201_init_time,
- .offset = h720x_gettimeoffset,
};
diff --git a/arch/arm/mach-h720x/cpu-h7202.c b/arch/arm/mach-h720x/cpu-h7202.c
index c37d570..fb9ca76 100644
--- a/arch/arm/mach-h720x/cpu-h7202.c
+++ b/arch/arm/mach-h720x/cpu-h7202.c
@@ -180,6 +180,8 @@ static struct irqaction h7202_timer_irq = {
*/
void __init h7202_init_time(void)
{
+ arch_gettimeoffset = h720x_gettimeoffset;
+
CPU_REG (TIMER_VIRT, TM0_PERIOD) = LATCH;
CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_RESET;
CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_REPEAT | TM_START;
@@ -190,7 +192,6 @@ void __init h7202_init_time(void)

struct sys_timer h7202_timer = {
.init = h7202_init_time,
- .offset = h720x_gettimeoffset,
};

void __init h7202_init_irq (void)
diff --git a/arch/arm/mach-rpc/time.c b/arch/arm/mach-rpc/time.c
index 581fca9..6ddccb0 100644
--- a/arch/arm/mach-rpc/time.c
+++ b/arch/arm/mach-rpc/time.c
@@ -24,7 +24,7 @@

#include <asm/mach/time.h>

-unsigned long ioc_timer_gettimeoffset(void)
+static u32 ioc_timer_gettimeoffset(void)
{
unsigned int count1, count2, status;
long offset;
@@ -56,7 +56,7 @@ unsigned long ioc_timer_gettimeoffset(void)
}

offset = (LATCH - offset) * (tick_nsec / 1000);
- return (offset + LATCH/2) / LATCH;
+ return ((offset + LATCH/2) / LATCH) * 1000;
}

void __init ioctime_init(void)
@@ -84,12 +84,12 @@ static struct irqaction ioc_timer_irq = {
*/
static void __init ioc_timer_init(void)
{
+ arch_gettimeoffset = ioc_timer_gettimeoffset;
ioctime_init();
setup_irq(IRQ_TIMER0, &ioc_timer_irq);
}

struct sys_timer ioc_timer = {
.init = ioc_timer_init,
- .offset = ioc_timer_gettimeoffset,
};

diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c
index 60552e2..67206df 100644
--- a/arch/arm/plat-samsung/time.c
+++ b/arch/arm/plat-samsung/time.c
@@ -95,7 +95,7 @@ static inline unsigned long timer_ticks_to_usec(unsigned long ticks)
* IRQs are disabled before entering here from do_gettimeofday()
*/

-static unsigned long s3c2410_gettimeoffset (void)
+static u32 s3c2410_gettimeoffset(void)
{
unsigned long tdone;
unsigned long tval;
@@ -120,7 +120,7 @@ static unsigned long s3c2410_gettimeoffset (void)
tdone += timer_startval;
}

- return timer_ticks_to_usec(tdone);
+ return timer_ticks_to_usec(tdone) * 1000;
}


@@ -273,6 +273,8 @@ static void __init s3c2410_timer_resources(void)

static void __init s3c2410_timer_init(void)
{
+ arch_gettimeoffset = s3c2410_gettimeoffset;
+
s3c2410_timer_resources();
s3c2410_timer_setup();
setup_irq(IRQ_TIMER4, &s3c2410_timer_irq);
@@ -280,6 +282,5 @@ static void __init s3c2410_timer_init(void)

struct sys_timer s3c24xx_timer = {
.init = s3c2410_timer_init,
- .offset = s3c2410_gettimeoffset,
.resume = s3c2410_timer_setup
};
--
1.7.0.4

2012-11-08 21:02:13

by Stephen Warren

[permalink] [raw]
Subject: [PATCH] ARM: delete struct sys_timer

From: Stephen Warren <[email protected]>

Now that the only field in struct sys_timer is .init, delete the struct,
and replace the machine descriptor .timer field with the initialization
function itself.

This will enable moving timer drivers into drivers/clocksource without
having to place a public prototype of each struct sys_timer object into
include/linux; the intent is to create a single of_clocksource_init()
function that determines which timer driver to initialize by scanning
the device dtree, much like the proposed irqchip_init() at:
http://www.spinics.net/lists/arm-kernel/msg203686.html

RFC: This will be quite a large patch since it'll end up touching tens
or hundreds of ARM board files, timer drivers, etc. Perhaps it'd be
better to create patches that:

1) Add .init_time field to machine descriptor, update ARM's time_init to
use that if present, else fall back to .timer.init.
2) 1 patch per ARM sub-architecture to convert to from .timer to
.init_time.
3) Remove sys_timer and machine descriptor .timer field.

For now, this patch only converts Tegra as an example of my intent.

Signed-off-by: Stephen Warren <[email protected]>
---
arch/arm/include/asm/mach/arch.h | 3 +--
arch/arm/include/asm/mach/time.h | 16 ----------------
arch/arm/kernel/time.c | 9 +--------
arch/arm/mach-tegra/board-dt-tegra20.c | 2 +-
arch/arm/mach-tegra/board-dt-tegra30.c | 2 +-
arch/arm/mach-tegra/board.h | 2 +-
arch/arm/mach-tegra/timer.c | 6 +-----
7 files changed, 6 insertions(+), 34 deletions(-)

diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 917d4fc..308ad7d 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -12,7 +12,6 @@

struct tag;
struct meminfo;
-struct sys_timer;
struct pt_regs;
struct smp_operations;
#ifdef CONFIG_SMP
@@ -48,7 +47,7 @@ struct machine_desc {
void (*map_io)(void);/* IO mapping function */
void (*init_early)(void);
void (*init_irq)(void);
- struct sys_timer *timer; /* system tick timer */
+ void (*init_time)(void);
void (*init_machine)(void);
void (*init_late)(void);
#ifdef CONFIG_MULTI_IRQ_HANDLER
diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h
index d316d76..90c12e1 100644
--- a/arch/arm/include/asm/mach/time.h
+++ b/arch/arm/include/asm/mach/time.h
@@ -10,22 +10,6 @@
#ifndef __ASM_ARM_MACH_TIME_H
#define __ASM_ARM_MACH_TIME_H

-/*
- * This is our kernel timer structure.
- *
- * - init
- * Initialise the kernels jiffy timer source, claim interrupt
- * using setup_irq. This is called early on during initialisation
- * while interrupts are still disabled on the local CPU.
- * - offset
- * Return the timer offset in microseconds since the last timer
- * interrupt. Note: this must take account of any unprocessed
- * timer interrupt which may be pending.
- */
-struct sys_timer {
- void (*init)(void);
-};
-
extern void timer_tick(void);

struct timespec;
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 0b51a7c..955d92d 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -30,11 +30,6 @@
#include <asm/mach/arch.h>
#include <asm/mach/time.h>

-/*
- * Our system timer.
- */
-static struct sys_timer *system_timer;
-
#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \
defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE)
/* this needs a better home */
@@ -120,8 +115,6 @@ int __init register_persistent_clock(clock_access_fn read_boot,

void __init time_init(void)
{
- system_timer = machine_desc->timer;
- system_timer->init();
+ machine_desc->init_time();
sched_clock_postinit();
}
-
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index 22f5a9b..3777b03 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -192,7 +192,7 @@ DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)")
.init_early = tegra20_init_early,
.init_irq = tegra_dt_init_irq,
.handle_irq = gic_handle_irq,
- .timer = &tegra_sys_timer,
+ .init_time = tegra_init_timer,
.init_machine = tegra_dt_init,
.init_late = tegra_dt_init_late,
.restart = tegra_assert_system_reset,
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c
index cd30338..08d3b19 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -104,7 +104,7 @@ DT_MACHINE_START(TEGRA30_DT, "NVIDIA Tegra30 (Flattened Device Tree)")
.init_early = tegra30_init_early,
.init_irq = tegra_dt_init_irq,
.handle_irq = gic_handle_irq,
- .timer = &tegra_sys_timer,
+ .init_time = tegra_init_timer,
.init_machine = tegra30_dt_init,
.init_late = tegra_init_late,
.restart = tegra_assert_system_reset,
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index 91fbe73..744cdd2 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -55,5 +55,5 @@ static inline int harmony_pcie_init(void) { return 0; }

void __init tegra_paz00_wifikill_init(void);

-extern struct sys_timer tegra_sys_timer;
+extern void tegra_init_timer(void);
#endif
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index e4863f3..b0036e5 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -168,7 +168,7 @@ static const struct of_device_id rtc_match[] __initconst = {
{}
};

-static void __init tegra_init_timer(void)
+void __init tegra_init_timer(void)
{
struct device_node *np;
struct clk *clk;
@@ -273,10 +273,6 @@ static void __init tegra_init_timer(void)
register_persistent_clock(NULL, tegra_read_persistent_clock);
}

-struct sys_timer tegra_sys_timer = {
- .init = tegra_init_timer,
-};
-
#ifdef CONFIG_PM
static u32 usec_config;

--
1.7.0.4

2012-11-08 21:05:53

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 01/11] cris: move usec/nsec conversion to do_slow_gettimeoffset

From: Stephen Warren <[email protected]>

Move usec to nsec conversion from arch_gettimeoffset() to
do_slow_gettimeoffset(); in a future patch, do_slow_gettimeoffset()
will be used directly as the implementation of arch_gettimeoffset(),
so needs to perform all required calculations.

Cc: Mikael Starvik <[email protected]>
Cc: Jesper Nilsson <[email protected]>
Cc: [email protected]
Signed-off-by: Stephen Warren <[email protected]>
---
arch/cris/arch-v10/kernel/time.c | 4 ++--
arch/cris/kernel/time.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index bcffcb6..162892f 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -65,8 +65,8 @@ unsigned long do_slow_gettimeoffset(void)
*/
count = *R_TIMER0_DATA;

- /* Convert timer value to usec */
- return (TIMER0_DIV - count) * ((NSEC_PER_SEC/1000)/HZ)/TIMER0_DIV;
+ /* Convert timer value to nsec */
+ return (TIMER0_DIV - count) * (NSEC_PER_SEC/HZ)/TIMER0_DIV;
}

/* Excerpt from the Etrax100 HSDD about the built-in watchdog:
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index 277ffc4..b063c92 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -46,7 +46,7 @@ static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;

u32 arch_gettimeoffset(void)
{
- return do_gettimeoffset() * 1000;
+ return do_gettimeoffset();
}
#endif

--
1.7.0.4

2012-11-08 23:06:26

by Ryan Mallon

[permalink] [raw]
Subject: Re: [PATCH 04/11] ARM: set arch_gettimeoffset directly

On 09/11/12 08:01, Stephen Warren wrote:
> From: Stephen Warren <[email protected]>
>
> remove ARM's struct sys_timer .offset function pointer, and instead
> directly set the arch_gettimeoffset function pointer when the timer
> driver is initialized. This requires multiplying all function results
> by 1000, since the removed arm_gettimeoffset() did this. Also,
> s/unsigned long/u32/ just to make the function prototypes exactly
> match that of arch_gettimeoffset.
>
> Cc: Russell King <[email protected]>
> Cc: Andrew Victor <[email protected]>
> Cc: Nicolas Ferre <[email protected]>
> Cc: Jean-Christophe Plagniol-Villard <[email protected]>
> Cc: Hartley Sweeten <[email protected]>
> Cc: Ryan Mallon <[email protected]>
> Cc: Ben Dooks <[email protected]>
> Cc: Kukjin Kim <[email protected]>
> Signed-off-by: Stephen Warren <[email protected]>
> ---
> arch/arm/include/asm/mach/time.h | 3 ---
> arch/arm/kernel/time.c | 14 --------------
> arch/arm/mach-at91/at91x40_time.c | 8 +++++---
> arch/arm/mach-ebsa110/core.c | 7 ++++---
> arch/arm/mach-ep93xx/core.c | 23 ++++++++++++-----------
> arch/arm/mach-h720x/common.c | 6 +++---
> arch/arm/mach-h720x/common.h | 2 +-
> arch/arm/mach-h720x/cpu-h7201.c | 3 ++-
> arch/arm/mach-h720x/cpu-h7202.c | 3 ++-
> arch/arm/mach-rpc/time.c | 6 +++---
> arch/arm/plat-samsung/time.c | 7 ++++---
> 11 files changed, 36 insertions(+), 46 deletions(-)

<snip>

> +static u32 ep93xx_gettimeoffset(void)
> +{
> + int offset;
> +
> + offset = __raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time;
> +
> + /* Calculate (1000000 / 983040) * offset. */

This comment is now incorrect, it should say:

/* Calculate (1000000000 / 983040) * offset */

or perhaps to better explain what is being done:

/*
* Timer 4 is based on a 983.04 kHz reference clock,
* so dividing by 983040 gives a milli-second value.
* Refactor the calculation to avoid overflow.
*/

> + return (offset + (53 * offset / 3072)) * 1000;
> +}

~Ryan

2012-11-09 02:06:07

by Eric Miao

[permalink] [raw]
Subject: Re: [PATCH 06/11] ARM: pxa: convert timer suspend/resume to clock_event_device

On Fri, Nov 9, 2012 at 5:01 AM, Stephen Warren <[email protected]> wrote:
> From: Stephen Warren <[email protected]>
>
> Move PXA's timer suspend/resume functions from struct sys_timer
> pxa_timer into struct clock_event_device ckevt_pxa_osmr0. This
> will allow the sys_timer suspend/resume fields to be removed, and
> eventually lead to a complete removal of struct sys_timer.
>
> Cc: Eric Miao <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: Haojian Zhuang <[email protected]>
> Signed-off-by: Stephen Warren <[email protected]>

Acked-by: Eric Miao <[email protected]>

> ---
> arch/arm/mach-pxa/time.c | 76 +++++++++++++++++++++++-----------------------
> 1 files changed, 38 insertions(+), 38 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
> index 4bc47d6..ce58bc9 100644
> --- a/arch/arm/mach-pxa/time.c
> +++ b/arch/arm/mach-pxa/time.c
> @@ -89,12 +89,50 @@ pxa_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *dev)
> }
> }
>
> +#ifdef CONFIG_PM
> +static unsigned long osmr[4], oier, oscr;
> +
> +static void pxa_timer_suspend(struct clock_event_device *cedev)
> +{
> + osmr[0] = readl_relaxed(OSMR0);
> + osmr[1] = readl_relaxed(OSMR1);
> + osmr[2] = readl_relaxed(OSMR2);
> + osmr[3] = readl_relaxed(OSMR3);
> + oier = readl_relaxed(OIER);
> + oscr = readl_relaxed(OSCR);
> +}
> +
> +static void pxa_timer_resume(struct clock_event_device *cedev)
> +{
> + /*
> + * Ensure that we have at least MIN_OSCR_DELTA between match
> + * register 0 and the OSCR, to guarantee that we will receive
> + * the one-shot timer interrupt. We adjust OSMR0 in preference
> + * to OSCR to guarantee that OSCR is monotonically incrementing.
> + */
> + if (osmr[0] - oscr < MIN_OSCR_DELTA)
> + osmr[0] += MIN_OSCR_DELTA;
> +
> + writel_relaxed(osmr[0], OSMR0);
> + writel_relaxed(osmr[1], OSMR1);
> + writel_relaxed(osmr[2], OSMR2);
> + writel_relaxed(osmr[3], OSMR3);
> + writel_relaxed(oier, OIER);
> + writel_relaxed(oscr, OSCR);
> +}
> +#else
> +#define pxa_timer_suspend NULL
> +#define pxa_timer_resume NULL
> +#endif
> +
> static struct clock_event_device ckevt_pxa_osmr0 = {
> .name = "osmr0",
> .features = CLOCK_EVT_FEAT_ONESHOT,
> .rating = 200,
> .set_next_event = pxa_osmr0_set_next_event,
> .set_mode = pxa_osmr0_set_mode,
> + .suspend = pxa_timer_suspend,
> + .resume = pxa_timer_resume,
> };
>
> static struct irqaction pxa_ost0_irq = {
> @@ -127,44 +165,6 @@ static void __init pxa_timer_init(void)
> clockevents_register_device(&ckevt_pxa_osmr0);
> }
>
> -#ifdef CONFIG_PM
> -static unsigned long osmr[4], oier, oscr;
> -
> -static void pxa_timer_suspend(void)
> -{
> - osmr[0] = readl_relaxed(OSMR0);
> - osmr[1] = readl_relaxed(OSMR1);
> - osmr[2] = readl_relaxed(OSMR2);
> - osmr[3] = readl_relaxed(OSMR3);
> - oier = readl_relaxed(OIER);
> - oscr = readl_relaxed(OSCR);
> -}
> -
> -static void pxa_timer_resume(void)
> -{
> - /*
> - * Ensure that we have at least MIN_OSCR_DELTA between match
> - * register 0 and the OSCR, to guarantee that we will receive
> - * the one-shot timer interrupt. We adjust OSMR0 in preference
> - * to OSCR to guarantee that OSCR is monotonically incrementing.
> - */
> - if (osmr[0] - oscr < MIN_OSCR_DELTA)
> - osmr[0] += MIN_OSCR_DELTA;
> -
> - writel_relaxed(osmr[0], OSMR0);
> - writel_relaxed(osmr[1], OSMR1);
> - writel_relaxed(osmr[2], OSMR2);
> - writel_relaxed(osmr[3], OSMR3);
> - writel_relaxed(oier, OIER);
> - writel_relaxed(oscr, OSCR);
> -}
> -#else
> -#define pxa_timer_suspend NULL
> -#define pxa_timer_resume NULL
> -#endif
> -
> struct sys_timer pxa_timer = {
> .init = pxa_timer_init,
> - .suspend = pxa_timer_suspend,
> - .resume = pxa_timer_resume,
> };
> --
> 1.7.0.4
>

2012-11-09 20:56:16

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V2 11/11] ARM: delete struct sys_timer

From: Stephen Warren <[email protected]>

Now that the only field in struct sys_timer is .init, delete the struct,
and replace the machine descriptor .timer field with the initialization
function itself.

This will enable moving timer drivers into drivers/clocksource without
having to place a public prototype of each struct sys_timer object into
include/linux; the intent is to create a single of_clocksource_init()
function that determines which timer driver to initialize by scanning
the device dtree, much like the proposed irqchip_init() at:
http://www.spinics.net/lists/arm-kernel/msg203686.html

Signed-off-by: Stephen Warren <[email protected]>
---
v2: Converted all platforms, not just Tegra.

This is based on next-20121107, so would need to be rebased to actually
apply. Arnd, Olof, what do you think the best plan for merging this into
arm-soc would be?

The patch is very large, so I've trimmed it for the mailing list, leaving
only the core ARM changes, changes outside arch/arm, and a couple platforms
which had slightly less routine changes. The full series can be found at:

git://nv-tegra.nvidia.com/user/swarren/linux-2.6 arm_timer_rework

It'd be great if maintainers could test this on their boards to make sure
I didn't make any silly mistakes, although there are far too many to Cc.

---
arch/arm/include/asm/mach/arch.h | 3 +--
arch/arm/include/asm/mach/time.h | 16 ----------------
arch/arm/kernel/time.c | 9 +--------
arch/arm/mach-at91/at91rm9200_time.c | 5 -----
arch/arm/mach-at91/at91sam926x_time.c | 6 +-----
arch/arm/mach-at91/at91x40_time.c | 5 -----
arch/arm/mach-at91/board-1arm.c | 2 +-
arch/arm/mach-at91/board-afeb-9260v1.c | 2 +-
arch/arm/mach-at91/board-cam60.c | 2 +-
arch/arm/mach-at91/board-carmeva.c | 2 +-
arch/arm/mach-at91/board-cpu9krea.c | 2 +-
arch/arm/mach-at91/board-cpuat91.c | 2 +-
arch/arm/mach-at91/board-csb337.c | 2 +-
arch/arm/mach-at91/board-csb637.c | 2 +-
arch/arm/mach-at91/board-dt.c | 2 +-
arch/arm/mach-at91/board-eb01.c | 2 +-
arch/arm/mach-at91/board-eb9200.c | 2 +-
arch/arm/mach-at91/board-ecbat91.c | 2 +-
arch/arm/mach-at91/board-eco920.c | 2 +-
arch/arm/mach-at91/board-flexibity.c | 2 +-
arch/arm/mach-at91/board-foxg20.c | 2 +-
arch/arm/mach-at91/board-gsia18s.c | 2 +-
arch/arm/mach-at91/board-kafa.c | 2 +-
arch/arm/mach-at91/board-kb9202.c | 2 +-
arch/arm/mach-at91/board-neocore926.c | 2 +-
arch/arm/mach-at91/board-pcontrol-g20.c | 2 +-
arch/arm/mach-at91/board-picotux200.c | 2 +-
arch/arm/mach-at91/board-qil-a9260.c | 2 +-
arch/arm/mach-at91/board-rm9200dk.c | 2 +-
arch/arm/mach-at91/board-rm9200ek.c | 2 +-
arch/arm/mach-at91/board-rsi-ews.c | 2 +-
arch/arm/mach-at91/board-sam9-l9260.c | 2 +-
arch/arm/mach-at91/board-sam9260ek.c | 2 +-
arch/arm/mach-at91/board-sam9261ek.c | 2 +-
arch/arm/mach-at91/board-sam9263ek.c | 2 +-
arch/arm/mach-at91/board-sam9g20ek.c | 4 ++--
arch/arm/mach-at91/board-sam9m10g45ek.c | 2 +-
arch/arm/mach-at91/board-sam9rlek.c | 2 +-
arch/arm/mach-at91/board-snapper9260.c | 2 +-
arch/arm/mach-at91/board-stamp9g20.c | 4 ++--
arch/arm/mach-at91/board-usb-a926x.c | 6 +++---
arch/arm/mach-at91/board-yl-9200.c | 2 +-
arch/arm/mach-at91/generic.h | 7 +++----
arch/arm/mach-bcm2835/bcm2835.c | 2 +-
arch/arm/mach-clps711x/autcpu12.c | 2 +-
arch/arm/mach-clps711x/cdb89712.c | 2 +-
arch/arm/mach-clps711x/clep7312.c | 2 +-
arch/arm/mach-clps711x/common.c | 6 +-----
arch/arm/mach-clps711x/common.h | 4 +---
arch/arm/mach-clps711x/edb7211.c | 2 +-
arch/arm/mach-clps711x/fortunet.c | 2 +-
arch/arm/mach-clps711x/p720t.c | 2 +-
arch/arm/mach-cns3xxx/cns3420vb.c | 2 +-
arch/arm/mach-cns3xxx/core.c | 6 +-----
arch/arm/mach-cns3xxx/core.h | 2 +-
arch/arm/mach-davinci/board-da830-evm.c | 2 +-
arch/arm/mach-davinci/board-da850-evm.c | 2 +-
arch/arm/mach-davinci/board-dm355-evm.c | 2 +-
arch/arm/mach-davinci/board-dm355-leopard.c | 2 +-
arch/arm/mach-davinci/board-dm365-evm.c | 2 +-
arch/arm/mach-davinci/board-dm644x-evm.c | 2 +-
arch/arm/mach-davinci/board-dm646x-evm.c | 4 ++--
arch/arm/mach-davinci/board-mityomapl138.c | 2 +-
arch/arm/mach-davinci/board-neuros-osd2.c | 2 +-
arch/arm/mach-davinci/board-omapl138-hawk.c | 2 +-
arch/arm/mach-davinci/board-sffsdr.c | 2 +-
arch/arm/mach-davinci/board-tnetv107x-evm.c | 2 +-
arch/arm/mach-davinci/include/mach/common.h | 4 +---
arch/arm/mach-davinci/time.c | 7 +------
arch/arm/mach-dove/cm-a510.c | 2 +-
arch/arm/mach-dove/common.c | 8 ++------
arch/arm/mach-dove/common.h | 2 +-
arch/arm/mach-dove/dove-db-setup.c | 2 +-
arch/arm/mach-ebsa110/core.c | 8 ++------
arch/arm/mach-ep93xx/adssphere.c | 2 +-
arch/arm/mach-ep93xx/core.c | 6 +-----
arch/arm/mach-ep93xx/edb93xx.c | 16 ++++++++--------
arch/arm/mach-ep93xx/gesbc9312.c | 2 +-
arch/arm/mach-ep93xx/include/mach/platform.h | 2 +-
arch/arm/mach-ep93xx/micro9.c | 8 ++++----
arch/arm/mach-ep93xx/simone.c | 2 +-
arch/arm/mach-ep93xx/snappercl15.c | 2 +-
arch/arm/mach-ep93xx/ts72xx.c | 2 +-
arch/arm/mach-ep93xx/vision_ep9307.c | 2 +-
arch/arm/mach-exynos/common.h | 2 +-
arch/arm/mach-exynos/mach-armlex4210.c | 2 +-
arch/arm/mach-exynos/mach-exynos4-dt.c | 2 +-
arch/arm/mach-exynos/mach-exynos5-dt.c | 2 +-
arch/arm/mach-exynos/mach-nuri.c | 2 +-
arch/arm/mach-exynos/mach-origen.c | 2 +-
arch/arm/mach-exynos/mach-smdk4x12.c | 4 ++--
arch/arm/mach-exynos/mach-smdkv310.c | 4 ++--
arch/arm/mach-exynos/mach-universal_c210.c | 2 +-
arch/arm/mach-exynos/mct.c | 6 +-----
arch/arm/mach-footbridge/cats-hw.c | 2 +-
arch/arm/mach-footbridge/common.h | 4 ++--
arch/arm/mach-footbridge/dc21285-timer.c | 6 +-----
arch/arm/mach-footbridge/ebsa285.c | 2 +-
arch/arm/mach-footbridge/isa-timer.c | 6 +-----
arch/arm/mach-footbridge/netwinder-hw.c | 2 +-
arch/arm/mach-footbridge/personal.c | 2 +-
arch/arm/mach-gemini/board-nas4220b.c | 6 +-----
arch/arm/mach-gemini/board-rut1xx.c | 6 +-----
arch/arm/mach-gemini/board-wbd111.c | 6 +-----
arch/arm/mach-gemini/board-wbd222.c | 6 +-----
arch/arm/mach-h720x/common.h | 4 ++--
arch/arm/mach-h720x/cpu-h7201.c | 6 +-----
arch/arm/mach-h720x/cpu-h7202.c | 6 +-----
arch/arm/mach-h720x/h7201-eval.c | 2 +-
arch/arm/mach-h720x/h7202-eval.c | 2 +-
arch/arm/mach-highbank/highbank.c | 6 +-----
arch/arm/mach-imx/imx27-dt.c | 16 ++++++----------
arch/arm/mach-imx/imx31-dt.c | 11 +----------
arch/arm/mach-imx/imx51-dt.c | 16 ++++++----------
arch/arm/mach-imx/mach-apf9328.c | 6 +-----
arch/arm/mach-imx/mach-armadillo5x0.c | 6 +-----
arch/arm/mach-imx/mach-bug.c | 6 +-----
arch/arm/mach-imx/mach-cpuimx27.c | 6 +-----
arch/arm/mach-imx/mach-cpuimx35.c | 6 +-----
arch/arm/mach-imx/mach-cpuimx51sd.c | 6 +-----
arch/arm/mach-imx/mach-eukrea_cpuimx25.c | 6 +-----
arch/arm/mach-imx/mach-imx27_visstrim_m10.c | 6 +-----
arch/arm/mach-imx/mach-imx27ipcam.c | 6 +-----
arch/arm/mach-imx/mach-imx27lite.c | 6 +-----
arch/arm/mach-imx/mach-imx53.c | 16 ++++++----------
arch/arm/mach-imx/mach-imx6q.c | 6 +-----
arch/arm/mach-imx/mach-kzm_arm11_01.c | 6 +-----
arch/arm/mach-imx/mach-mx1ads.c | 8 ++------
arch/arm/mach-imx/mach-mx21ads.c | 6 +-----
arch/arm/mach-imx/mach-mx25_3ds.c | 6 +-----
arch/arm/mach-imx/mach-mx27_3ds.c | 6 +-----
arch/arm/mach-imx/mach-mx27ads.c | 6 +-----
arch/arm/mach-imx/mach-mx31_3ds.c | 6 +-----
arch/arm/mach-imx/mach-mx31ads.c | 6 +-----
arch/arm/mach-imx/mach-mx31lilly.c | 6 +-----
arch/arm/mach-imx/mach-mx31lite.c | 6 +-----
arch/arm/mach-imx/mach-mx31moboard.c | 6 +-----
arch/arm/mach-imx/mach-mx35_3ds.c | 6 +-----
arch/arm/mach-imx/mach-mx50_rdp.c | 6 +-----
arch/arm/mach-imx/mach-mx51_3ds.c | 6 +-----
arch/arm/mach-imx/mach-mx51_babbage.c | 6 +-----
arch/arm/mach-imx/mach-mxt_td60.c | 6 +-----
arch/arm/mach-imx/mach-pca100.c | 6 +-----
arch/arm/mach-imx/mach-pcm037.c | 6 +-----
arch/arm/mach-imx/mach-pcm038.c | 6 +-----
arch/arm/mach-imx/mach-pcm043.c | 6 +-----
arch/arm/mach-imx/mach-qong.c | 6 +-----
arch/arm/mach-imx/mach-scb9328.c | 6 +-----
arch/arm/mach-imx/mach-vpr200.c | 6 +-----
arch/arm/mach-integrator/integrator_ap.c | 16 ++++------------
arch/arm/mach-integrator/integrator_cp.c | 16 ++++------------
arch/arm/mach-iop13xx/iq81340mc.c | 6 +-----
arch/arm/mach-iop13xx/iq81340sc.c | 6 +-----
arch/arm/mach-iop32x/em7210.c | 6 +-----
arch/arm/mach-iop32x/glantank.c | 6 +-----
arch/arm/mach-iop32x/iq31244.c | 8 ++------
arch/arm/mach-iop32x/iq80321.c | 6 +-----
arch/arm/mach-iop32x/n2100.c | 6 +-----
arch/arm/mach-iop33x/iq80331.c | 6 +-----
arch/arm/mach-iop33x/iq80332.c | 6 +-----
arch/arm/mach-ixp4xx/avila-setup.c | 4 ++--
arch/arm/mach-ixp4xx/common.c | 4 ----
arch/arm/mach-ixp4xx/coyote-setup.c | 4 ++--
arch/arm/mach-ixp4xx/dsmg600-setup.c | 6 +-----
arch/arm/mach-ixp4xx/fsg-setup.c | 2 +-
arch/arm/mach-ixp4xx/gateway7001-setup.c | 2 +-
arch/arm/mach-ixp4xx/goramo_mlr.c | 2 +-
arch/arm/mach-ixp4xx/gtwx5715-setup.c | 2 +-
arch/arm/mach-ixp4xx/include/mach/platform.h | 3 ---
arch/arm/mach-ixp4xx/ixdp425-setup.c | 8 ++++----
arch/arm/mach-ixp4xx/nas100d-setup.c | 2 +-
arch/arm/mach-ixp4xx/nslu2-setup.c | 6 +-----
arch/arm/mach-ixp4xx/omixp-setup.c | 6 +++---
arch/arm/mach-ixp4xx/vulcan-setup.c | 2 +-
arch/arm/mach-ixp4xx/wg302v2-setup.c | 2 +-
arch/arm/mach-kirkwood/board-dt.c | 2 +-
arch/arm/mach-kirkwood/common.c | 6 +-----
arch/arm/mach-kirkwood/common.h | 2 +-
arch/arm/mach-kirkwood/d2net_v2-setup.c | 2 +-
arch/arm/mach-kirkwood/db88f6281-bp-setup.c | 2 +-
arch/arm/mach-kirkwood/dockstar-setup.c | 2 +-
arch/arm/mach-kirkwood/guruplug-setup.c | 2 +-
arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c | 2 +-
arch/arm/mach-kirkwood/netspace_v2-setup.c | 6 +++---
arch/arm/mach-kirkwood/netxbig_v2-setup.c | 4 ++--
arch/arm/mach-kirkwood/openrd-setup.c | 6 +++---
arch/arm/mach-kirkwood/rd88f6192-nas-setup.c | 2 +-
arch/arm/mach-kirkwood/rd88f6281-setup.c | 2 +-
arch/arm/mach-kirkwood/sheevaplug-setup.c | 4 ++--
arch/arm/mach-kirkwood/t5325-setup.c | 2 +-
arch/arm/mach-kirkwood/ts219-setup.c | 2 +-
arch/arm/mach-kirkwood/ts41x-setup.c | 2 +-
arch/arm/mach-ks8695/board-acs5k.c | 2 +-
arch/arm/mach-ks8695/board-dsm320.c | 2 +-
arch/arm/mach-ks8695/board-micrel.c | 2 +-
arch/arm/mach-ks8695/board-og.c | 10 +++++-----
arch/arm/mach-ks8695/board-sg.c | 6 +++---
arch/arm/mach-ks8695/generic.h | 2 +-
arch/arm/mach-ks8695/time.c | 6 +-----
arch/arm/mach-lpc32xx/common.h | 2 +-
arch/arm/mach-lpc32xx/phy3250.c | 2 +-
arch/arm/mach-lpc32xx/timer.c | 7 +------
arch/arm/mach-mmp/aspenite.c | 4 ++--
arch/arm/mach-mmp/avengers_lite.c | 2 +-
arch/arm/mach-mmp/brownstone.c | 2 +-
arch/arm/mach-mmp/common.h | 2 --
arch/arm/mach-mmp/flint.c | 2 +-
arch/arm/mach-mmp/gplugd.c | 2 +-
arch/arm/mach-mmp/include/mach/mmp2.h | 4 +---
arch/arm/mach-mmp/include/mach/pxa168.h | 4 +---
arch/arm/mach-mmp/include/mach/pxa910.h | 4 +---
arch/arm/mach-mmp/jasper.c | 2 +-
arch/arm/mach-mmp/mmp-dt.c | 8 ++------
arch/arm/mach-mmp/mmp2-dt.c | 6 +-----
arch/arm/mach-mmp/mmp2.c | 6 +-----
arch/arm/mach-mmp/pxa168.c | 6 +-----
arch/arm/mach-mmp/pxa910.c | 6 +-----
arch/arm/mach-mmp/tavorevb.c | 2 +-
arch/arm/mach-mmp/teton_bga.c | 2 +-
arch/arm/mach-mmp/ttc_dkb.c | 2 +-
arch/arm/mach-msm/board-dt-8660.c | 2 +-
arch/arm/mach-msm/board-dt-8960.c | 2 +-
arch/arm/mach-msm/board-halibut.c | 2 +-
arch/arm/mach-msm/board-mahimahi.c | 4 ++--
arch/arm/mach-msm/board-msm7x30.c | 6 +++---
arch/arm/mach-msm/board-qsd8x50.c | 4 ++--
arch/arm/mach-msm/board-sapphire.c | 4 ++--
arch/arm/mach-msm/board-trout.c | 2 +-
arch/arm/mach-msm/common.h | 8 ++++----
arch/arm/mach-msm/timer.c | 24 ++++--------------------
arch/arm/mach-mv78xx0/buffalo-wxl-setup.c | 2 +-
arch/arm/mach-mv78xx0/common.c | 6 +-----
arch/arm/mach-mv78xx0/common.h | 2 +-
arch/arm/mach-mv78xx0/db78x00-bp-setup.c | 2 +-
arch/arm/mach-mv78xx0/rd78x00-masa-setup.c | 2 +-
arch/arm/mach-mvebu/armada-370-xp.c | 6 +-----
arch/arm/mach-mxs/mach-mxs.c | 12 ++----------
arch/arm/mach-netx/generic.h | 3 +--
arch/arm/mach-netx/nxdb500.c | 2 +-
arch/arm/mach-netx/nxdkn.c | 2 +-
arch/arm/mach-netx/nxeb500hmi.c | 2 +-
arch/arm/mach-netx/time.c | 6 +-----
arch/arm/mach-nomadik/board-nhk8815.c | 6 +-----
arch/arm/mach-omap1/board-ams-delta.c | 2 +-
arch/arm/mach-omap1/board-fsample.c | 2 +-
arch/arm/mach-omap1/board-generic.c | 2 +-
arch/arm/mach-omap1/board-h2.c | 2 +-
arch/arm/mach-omap1/board-h3.c | 2 +-
arch/arm/mach-omap1/board-htcherald.c | 2 +-
arch/arm/mach-omap1/board-innovator.c | 2 +-
arch/arm/mach-omap1/board-nokia770.c | 2 +-
arch/arm/mach-omap1/board-osk.c | 2 +-
arch/arm/mach-omap1/board-palmte.c | 2 +-
arch/arm/mach-omap1/board-palmtt.c | 2 +-
arch/arm/mach-omap1/board-palmz71.c | 2 +-
arch/arm/mach-omap1/board-perseus2.c | 2 +-
arch/arm/mach-omap1/board-sx1.c | 2 +-
arch/arm/mach-omap1/board-voiceblue.c | 2 +-
arch/arm/mach-omap1/common.h | 2 +-
arch/arm/mach-omap1/time.c | 6 +-----
arch/arm/mach-omap2/board-2430sdp.c | 2 +-
arch/arm/mach-omap2/board-3430sdp.c | 2 +-
arch/arm/mach-omap2/board-3630sdp.c | 2 +-
arch/arm/mach-omap2/board-4430sdp.c | 2 +-
arch/arm/mach-omap2/board-am3517crane.c | 2 +-
arch/arm/mach-omap2/board-am3517evm.c | 2 +-
arch/arm/mach-omap2/board-apollon.c | 2 +-
arch/arm/mach-omap2/board-cm-t35.c | 4 ++--
arch/arm/mach-omap2/board-cm-t3517.c | 2 +-
arch/arm/mach-omap2/board-devkit8000.c | 2 +-
arch/arm/mach-omap2/board-generic.c | 12 ++++++------
arch/arm/mach-omap2/board-h4.c | 2 +-
arch/arm/mach-omap2/board-igep0020.c | 4 ++--
arch/arm/mach-omap2/board-ldp.c | 2 +-
arch/arm/mach-omap2/board-n8x0.c | 6 +++---
arch/arm/mach-omap2/board-omap3beagle.c | 2 +-
arch/arm/mach-omap2/board-omap3evm.c | 2 +-
arch/arm/mach-omap2/board-omap3logic.c | 4 ++--
arch/arm/mach-omap2/board-omap3pandora.c | 2 +-
arch/arm/mach-omap2/board-omap3stalker.c | 2 +-
arch/arm/mach-omap2/board-omap3touchbook.c | 2 +-
arch/arm/mach-omap2/board-omap4panda.c | 2 +-
arch/arm/mach-omap2/board-overo.c | 2 +-
arch/arm/mach-omap2/board-rm680.c | 4 ++--
arch/arm/mach-omap2/board-rx51.c | 2 +-
arch/arm/mach-omap2/board-ti8168evm.c | 4 ++--
arch/arm/mach-omap2/board-zoom.c | 4 ++--
arch/arm/mach-omap2/common.h | 12 ++++++------
arch/arm/mach-omap2/timer.c | 17 +++--------------
arch/arm/mach-orion5x/common.c | 6 +-----
arch/arm/mach-orion5x/common.h | 2 +-
arch/arm/mach-orion5x/d2net-setup.c | 4 ++--
arch/arm/mach-orion5x/db88f5281-setup.c | 2 +-
arch/arm/mach-orion5x/dns323-setup.c | 2 +-
arch/arm/mach-orion5x/edmini_v2-setup.c | 2 +-
arch/arm/mach-orion5x/kurobox_pro-setup.c | 4 ++--
arch/arm/mach-orion5x/ls-chl-setup.c | 2 +-
arch/arm/mach-orion5x/ls_hgl-setup.c | 2 +-
arch/arm/mach-orion5x/lsmini-setup.c | 2 +-
arch/arm/mach-orion5x/mss2-setup.c | 2 +-
arch/arm/mach-orion5x/mv2120-setup.c | 2 +-
arch/arm/mach-orion5x/net2big-setup.c | 2 +-
arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c | 2 +-
arch/arm/mach-orion5x/rd88f5181l-ge-setup.c | 2 +-
arch/arm/mach-orion5x/rd88f5182-setup.c | 2 +-
arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c | 2 +-
arch/arm/mach-orion5x/terastation_pro2-setup.c | 2 +-
arch/arm/mach-orion5x/ts209-setup.c | 2 +-
arch/arm/mach-orion5x/ts409-setup.c | 2 +-
arch/arm/mach-orion5x/ts78xx-setup.c | 2 +-
arch/arm/mach-orion5x/wnr854t-setup.c | 2 +-
arch/arm/mach-orion5x/wrt350n-v2-setup.c | 2 +-
arch/arm/mach-picoxcell/common.c | 2 +-
arch/arm/mach-picoxcell/common.h | 2 +-
arch/arm/mach-prima2/common.c | 2 +-
arch/arm/mach-prima2/common.h | 2 +-
arch/arm/mach-prima2/timer.c | 8 ++------
arch/arm/mach-pxa/balloon3.c | 2 +-
arch/arm/mach-pxa/capc7117.c | 2 +-
arch/arm/mach-pxa/cm-x2xx.c | 2 +-
arch/arm/mach-pxa/cm-x300.c | 2 +-
arch/arm/mach-pxa/colibri-pxa270.c | 4 ++--
arch/arm/mach-pxa/colibri-pxa300.c | 2 +-
arch/arm/mach-pxa/colibri-pxa320.c | 2 +-
arch/arm/mach-pxa/corgi.c | 6 +++---
arch/arm/mach-pxa/csb726.c | 2 +-
arch/arm/mach-pxa/em-x270.c | 4 ++--
arch/arm/mach-pxa/eseries.c | 12 ++++++------
arch/arm/mach-pxa/ezx.c | 12 ++++++------
arch/arm/mach-pxa/generic.h | 3 +--
arch/arm/mach-pxa/gumstix.c | 2 +-
arch/arm/mach-pxa/h5000.c | 2 +-
arch/arm/mach-pxa/himalaya.c | 2 +-
arch/arm/mach-pxa/hx4700.c | 2 +-
arch/arm/mach-pxa/icontrol.c | 2 +-
arch/arm/mach-pxa/idp.c | 2 +-
arch/arm/mach-pxa/littleton.c | 2 +-
arch/arm/mach-pxa/lpd270.c | 2 +-
arch/arm/mach-pxa/lubbock.c | 2 +-
arch/arm/mach-pxa/magician.c | 2 +-
arch/arm/mach-pxa/mainstone.c | 2 +-
arch/arm/mach-pxa/mioa701.c | 2 +-
arch/arm/mach-pxa/mp900.c | 2 +-
arch/arm/mach-pxa/palmld.c | 2 +-
arch/arm/mach-pxa/palmt5.c | 2 +-
arch/arm/mach-pxa/palmtc.c | 2 +-
arch/arm/mach-pxa/palmte2.c | 2 +-
arch/arm/mach-pxa/palmtreo.c | 4 ++--
arch/arm/mach-pxa/palmtx.c | 2 +-
arch/arm/mach-pxa/palmz72.c | 2 +-
arch/arm/mach-pxa/pcm027.c | 2 +-
arch/arm/mach-pxa/poodle.c | 2 +-
arch/arm/mach-pxa/pxa-dt.c | 2 +-
arch/arm/mach-pxa/raumfeld.c | 6 +++---
arch/arm/mach-pxa/saar.c | 2 +-
arch/arm/mach-pxa/saarb.c | 2 +-
arch/arm/mach-pxa/spitz.c | 6 +++---
arch/arm/mach-pxa/stargate2.c | 4 ++--
arch/arm/mach-pxa/tavorevb.c | 2 +-
arch/arm/mach-pxa/tavorevb3.c | 2 +-
arch/arm/mach-pxa/time.c | 6 +-----
arch/arm/mach-pxa/tosa.c | 2 +-
arch/arm/mach-pxa/trizeps4.c | 4 ++--
arch/arm/mach-pxa/viper.c | 2 +-
arch/arm/mach-pxa/vpac270.c | 2 +-
arch/arm/mach-pxa/xcep.c | 2 +-
arch/arm/mach-pxa/z2.c | 2 +-
arch/arm/mach-pxa/zeus.c | 2 +-
arch/arm/mach-pxa/zylonite.c | 2 +-
arch/arm/mach-realview/realview_eb.c | 6 +-----
arch/arm/mach-realview/realview_pb1176.c | 6 +-----
arch/arm/mach-realview/realview_pb11mp.c | 6 +-----
arch/arm/mach-realview/realview_pba8.c | 6 +-----
arch/arm/mach-realview/realview_pbx.c | 6 +-----
arch/arm/mach-rpc/riscpc.c | 4 ++--
arch/arm/mach-rpc/time.c | 7 +------
arch/arm/mach-s3c24xx/mach-amlm5900.c | 2 +-
arch/arm/mach-s3c24xx/mach-anubis.c | 2 +-
arch/arm/mach-s3c24xx/mach-at2440evb.c | 2 +-
arch/arm/mach-s3c24xx/mach-bast.c | 2 +-
arch/arm/mach-s3c24xx/mach-gta02.c | 2 +-
arch/arm/mach-s3c24xx/mach-h1940.c | 2 +-
arch/arm/mach-s3c24xx/mach-jive.c | 2 +-
arch/arm/mach-s3c24xx/mach-mini2440.c | 2 +-
arch/arm/mach-s3c24xx/mach-n30.c | 4 ++--
arch/arm/mach-s3c24xx/mach-nexcoder.c | 2 +-
arch/arm/mach-s3c24xx/mach-osiris.c | 2 +-
arch/arm/mach-s3c24xx/mach-otom.c | 2 +-
arch/arm/mach-s3c24xx/mach-qt2410.c | 2 +-
arch/arm/mach-s3c24xx/mach-rx1950.c | 2 +-
arch/arm/mach-s3c24xx/mach-rx3715.c | 2 +-
arch/arm/mach-s3c24xx/mach-smdk2410.c | 2 +-
arch/arm/mach-s3c24xx/mach-smdk2413.c | 6 +++---
arch/arm/mach-s3c24xx/mach-smdk2416.c | 2 +-
arch/arm/mach-s3c24xx/mach-smdk2440.c | 2 +-
arch/arm/mach-s3c24xx/mach-smdk2443.c | 2 +-
arch/arm/mach-s3c24xx/mach-tct_hammer.c | 2 +-
arch/arm/mach-s3c24xx/mach-vr1000.c | 2 +-
arch/arm/mach-s3c24xx/mach-vstms.c | 2 +-
arch/arm/mach-s3c64xx/mach-anw6410.c | 2 +-
arch/arm/mach-s3c64xx/mach-crag6410.c | 2 +-
arch/arm/mach-s3c64xx/mach-hmt.c | 2 +-
arch/arm/mach-s3c64xx/mach-mini6410.c | 2 +-
arch/arm/mach-s3c64xx/mach-ncp.c | 2 +-
arch/arm/mach-s3c64xx/mach-real6410.c | 2 +-
arch/arm/mach-s3c64xx/mach-smartq5.c | 2 +-
arch/arm/mach-s3c64xx/mach-smartq7.c | 2 +-
arch/arm/mach-s3c64xx/mach-smdk6400.c | 2 +-
arch/arm/mach-s3c64xx/mach-smdk6410.c | 2 +-
arch/arm/mach-s5p64x0/mach-smdk6440.c | 2 +-
arch/arm/mach-s5p64x0/mach-smdk6450.c | 2 +-
arch/arm/mach-s5pc100/mach-smdkc100.c | 2 +-
arch/arm/mach-s5pv210/mach-aquila.c | 2 +-
arch/arm/mach-s5pv210/mach-goni.c | 2 +-
arch/arm/mach-s5pv210/mach-smdkc110.c | 2 +-
arch/arm/mach-s5pv210/mach-smdkv210.c | 2 +-
arch/arm/mach-s5pv210/mach-torbreck.c | 2 +-
arch/arm/mach-sa1100/assabet.c | 2 +-
arch/arm/mach-sa1100/badge4.c | 2 +-
arch/arm/mach-sa1100/cerf.c | 2 +-
arch/arm/mach-sa1100/collie.c | 2 +-
arch/arm/mach-sa1100/generic.h | 4 +---
arch/arm/mach-sa1100/h3100.c | 2 +-
arch/arm/mach-sa1100/h3600.c | 2 +-
arch/arm/mach-sa1100/hackkit.c | 2 +-
arch/arm/mach-sa1100/jornada720.c | 2 +-
arch/arm/mach-sa1100/lart.c | 2 +-
arch/arm/mach-sa1100/nanoengine.c | 2 +-
arch/arm/mach-sa1100/pleb.c | 2 +-
arch/arm/mach-sa1100/shannon.c | 2 +-
arch/arm/mach-sa1100/simpad.c | 2 +-
arch/arm/mach-sa1100/time.c | 6 +-----
arch/arm/mach-shark/core.c | 6 +-----
arch/arm/mach-shmobile/board-ag5evm.c | 2 +-
arch/arm/mach-shmobile/board-ap4evb.c | 2 +-
arch/arm/mach-shmobile/board-armadillo800eva.c | 5 +----
arch/arm/mach-shmobile/board-bonito.c | 5 +----
arch/arm/mach-shmobile/board-kota2.c | 2 +-
arch/arm/mach-shmobile/board-kzm9d.c | 2 +-
arch/arm/mach-shmobile/board-kzm9g.c | 2 +-
arch/arm/mach-shmobile/board-mackerel.c | 2 +-
arch/arm/mach-shmobile/board-marzen.c | 2 +-
arch/arm/mach-shmobile/include/mach/common.h | 5 ++++-
arch/arm/mach-shmobile/setup-emev2.c | 2 +-
arch/arm/mach-shmobile/setup-r8a7740.c | 11 +----------
arch/arm/mach-shmobile/setup-r8a7779.c | 5 +----
arch/arm/mach-shmobile/setup-sh7372.c | 7 ++-----
arch/arm/mach-shmobile/setup-sh73a0.c | 5 +----
arch/arm/mach-shmobile/timer.c | 6 +-----
arch/arm/mach-socfpga/socfpga.c | 2 +-
arch/arm/mach-spear13xx/include/mach/generic.h | 2 +-
arch/arm/mach-spear13xx/spear1310.c | 2 +-
arch/arm/mach-spear13xx/spear1340.c | 2 +-
arch/arm/mach-spear13xx/spear13xx.c | 6 +-----
arch/arm/mach-spear3xx/include/mach/generic.h | 2 +-
arch/arm/mach-spear3xx/spear300.c | 2 +-
arch/arm/mach-spear3xx/spear310.c | 2 +-
arch/arm/mach-spear3xx/spear320.c | 2 +-
arch/arm/mach-spear3xx/spear3xx.c | 6 +-----
arch/arm/mach-spear6xx/spear6xx.c | 8 ++------
arch/arm/mach-tegra/board-dt-tegra20.c | 2 +-
arch/arm/mach-tegra/board-dt-tegra30.c | 2 +-
arch/arm/mach-tegra/board.h | 2 +-
arch/arm/mach-tegra/timer.c | 6 +-----
arch/arm/mach-u300/core.c | 2 +-
arch/arm/mach-u300/timer.c | 10 +---------
arch/arm/mach-u300/timer.h | 2 +-
arch/arm/mach-ux500/board-mop500.c | 8 ++++----
arch/arm/mach-ux500/cpu-db8500.c | 2 +-
arch/arm/mach-ux500/include/mach/setup.h | 3 +--
arch/arm/mach-ux500/timer.c | 6 +-----
arch/arm/mach-versatile/core.c | 7 +------
arch/arm/mach-versatile/core.h | 2 +-
arch/arm/mach-versatile/versatile_ab.c | 2 +-
arch/arm/mach-versatile/versatile_dt.c | 2 +-
arch/arm/mach-versatile/versatile_pb.c | 2 +-
arch/arm/mach-vexpress/v2m.c | 12 ++----------
arch/arm/mach-vt8500/vt8500.c | 6 +-----
arch/arm/mach-w90x900/mach-nuc910evb.c | 2 +-
arch/arm/mach-w90x900/mach-nuc950evb.c | 2 +-
arch/arm/mach-w90x900/mach-nuc960evb.c | 2 +-
arch/arm/mach-w90x900/nuc9xx.h | 3 +--
arch/arm/mach-w90x900/time.c | 6 +-----
arch/arm/mach-zynq/common.c | 2 +-
arch/arm/mach-zynq/common.h | 2 +-
arch/arm/mach-zynq/timer.c | 9 +--------
arch/arm/plat-samsung/include/plat/cpu.h | 3 +--
arch/arm/plat-samsung/include/plat/s5p-time.h | 2 +-
arch/arm/plat-samsung/s5p-time.c | 6 +-----
arch/arm/plat-samsung/time.c | 6 +-----
drivers/clocksource/bcm2835_timer.c | 6 +-----
drivers/clocksource/dw_apb_timer_of.c | 6 +-----
include/linux/bcm2835_timer.h | 2 +-
include/linux/dw_apb_timer.h | 2 +-
494 files changed, 624 insertions(+), 1201 deletions(-)

diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 917d4fc..308ad7d 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -12,7 +12,6 @@

struct tag;
struct meminfo;
-struct sys_timer;
struct pt_regs;
struct smp_operations;
#ifdef CONFIG_SMP
@@ -48,7 +47,7 @@ struct machine_desc {
void (*map_io)(void);/* IO mapping function */
void (*init_early)(void);
void (*init_irq)(void);
- struct sys_timer *timer; /* system tick timer */
+ void (*init_time)(void);
void (*init_machine)(void);
void (*init_late)(void);
#ifdef CONFIG_MULTI_IRQ_HANDLER
diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h
index d316d76..90c12e1 100644
--- a/arch/arm/include/asm/mach/time.h
+++ b/arch/arm/include/asm/mach/time.h
@@ -10,22 +10,6 @@
#ifndef __ASM_ARM_MACH_TIME_H
#define __ASM_ARM_MACH_TIME_H

-/*
- * This is our kernel timer structure.
- *
- * - init
- * Initialise the kernels jiffy timer source, claim interrupt
- * using setup_irq. This is called early on during initialisation
- * while interrupts are still disabled on the local CPU.
- * - offset
- * Return the timer offset in microseconds since the last timer
- * interrupt. Note: this must take account of any unprocessed
- * timer interrupt which may be pending.
- */
-struct sys_timer {
- void (*init)(void);
-};
-
extern void timer_tick(void);

struct timespec;
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 0b51a7c..955d92d 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -30,11 +30,6 @@
#include <asm/mach/arch.h>
#include <asm/mach/time.h>

-/*
- * Our system timer.
- */
-static struct sys_timer *system_timer;
-
#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \
defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE)
/* this needs a better home */
@@ -120,8 +115,6 @@ int __init register_persistent_clock(clock_access_fn read_boot,

void __init time_init(void)
{
- system_timer = machine_desc->timer;
- system_timer->init();
+ machine_desc->init_time();
sched_clock_postinit();
}
-
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index a8fce3c..3d2aa6f 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -628,6 +628,6 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
.init_irq = omap1_init_irq,
.init_machine = ams_delta_init,
.init_late = ams_delta_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 8b5800a..7a0f1f9 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -365,6 +365,6 @@ MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
.init_irq = omap1_init_irq,
.init_machine = omap_fsample_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 608e7d2..e1d9171 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -84,6 +84,6 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
.init_irq = omap1_init_irq,
.init_machine = omap_generic_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 9134b64..a7ed0ff 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -462,6 +462,6 @@ MACHINE_START(OMAP_H2, "TI-H2")
.init_irq = omap1_init_irq,
.init_machine = h2_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index bf213d1..ed08d75 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -455,6 +455,6 @@ MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
.init_irq = omap1_init_irq,
.init_machine = h3_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 356f816..35a2379 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -603,6 +603,6 @@ MACHINE_START(HERALD, "HTC Herald")
.init_irq = omap1_init_irq,
.init_machine = htcherald_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index c66334f..04513f5 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -459,6 +459,6 @@ MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
.init_irq = omap1_init_irq,
.init_machine = innovator_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 3e8ead6..d9fdb8a 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -254,6 +254,6 @@ MACHINE_START(NOKIA770, "Nokia 770")
.init_irq = omap1_init_irq,
.init_machine = omap_nokia770_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 872ea47..a7ce692 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -609,6 +609,6 @@ MACHINE_START(OMAP_OSK, "TI-OSK")
.init_irq = omap1_init_irq,
.init_machine = osk_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 584b6fa..9337ffc 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -268,6 +268,6 @@ MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
.init_irq = omap1_init_irq,
.init_machine = omap_palmte_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index fbc986b..a9a88f9 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -314,6 +314,6 @@ MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
.init_irq = omap1_init_irq,
.init_machine = omap_palmtt_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index 60d917a..e51b12c 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -330,6 +330,6 @@ MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
.init_irq = omap1_init_irq,
.init_machine = omap_palmz71_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 030bd48..f354f48 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -327,6 +327,6 @@ MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
.init_irq = omap1_init_irq,
.init_machine = omap_perseus2_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 1ebc7e0..d6c0c07 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -407,6 +407,6 @@ MACHINE_START(SX1, "OMAP310 based Siemens SX1")
.init_irq = omap1_init_irq,
.init_machine = omap_sx1_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = omap1_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index abf705f..6c116e1 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -289,6 +289,6 @@ MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
.init_irq = omap1_init_irq,
.init_machine = voiceblue_init,
.init_late = omap1_init_late,
- .timer = &omap1_timer,
+ .init_time = omap1_timer_init,
.restart = voiceblue_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
index d6ac18d..933016b 100644
--- a/arch/arm/mach-omap1/common.h
+++ b/arch/arm/mach-omap1/common.h
@@ -76,7 +76,7 @@ extern void __init omap_check_revision(void);
extern void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
unsigned int ctrl);

-extern struct sys_timer omap1_timer;
+extern void omap1_timer_init(void);
#ifdef CONFIG_OMAP_32K_TIMER
extern int omap_32k_timer_init(void);
#else
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 4d4816f..1d4512f 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -236,12 +236,8 @@ static inline void omap_mpu_timer_init(void)
* Timer initialization
* ---------------------------------------------------------------------------
*/
-static void __init omap1_timer_init(void)
+void __init omap1_timer_init(void)
{
if (omap_32k_timer_init() != 0)
omap_mpu_timer_init();
}
-
-struct sys_timer omap1_timer = {
- .init = omap1_timer_init,
-};
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 3fc6d83..717c5b0 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -285,6 +285,6 @@ MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
.handle_irq = omap2_intc_handle_irq,
.init_machine = omap_2430sdp_init,
.init_late = omap2430_init_late,
- .timer = &omap2_timer,
+ .init_time = omap2_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 79fd904..d11c1d8 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -596,6 +596,6 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap_3430sdp_init,
.init_late = omap3430_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
index 81871b1..d819935 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -211,6 +211,6 @@ MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap_sdp_init,
.init_late = omap3630_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index fd80d97..45086a4 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -880,6 +880,6 @@ MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
.handle_irq = gic_handle_irq,
.init_machine = omap_4430sdp_init,
.init_late = omap4430_init_late,
- .timer = &omap4_timer,
+ .init_time = omap4_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index 603503c..95012fd 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -92,6 +92,6 @@ MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
.handle_irq = omap3_intc_handle_irq,
.init_machine = am3517_crane_init,
.init_late = am35xx_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 96d6c5a..4994f9f 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -392,6 +392,6 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
.handle_irq = omap3_intc_handle_irq,
.init_machine = am3517_evm_init,
.init_late = am35xx_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 64cf1bd..ee7b610 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -337,6 +337,6 @@ MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
.handle_irq = omap2_intc_handle_irq,
.init_machine = omap_apollon_init,
.init_late = omap2420_init_late,
- .timer = &omap2_timer,
+ .init_time = omap2_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index cf9449b..5fbd927 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -752,7 +752,7 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
.handle_irq = omap3_intc_handle_irq,
.init_machine = cm_t35_init,
.init_late = omap35xx_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END

@@ -765,6 +765,6 @@ MACHINE_START(CM_T3730, "Compulab CM-T3730")
.handle_irq = omap3_intc_handle_irq,
.init_machine = cm_t3730_init,
.init_late = omap3630_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index 2786647..b3baf67 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -297,6 +297,6 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517")
.handle_irq = omap3_intc_handle_irq,
.init_machine = cm_t3517_init,
.init_late = am35xx_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 933479e..ee5e61f 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -642,6 +642,6 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
.handle_irq = omap3_intc_handle_irq,
.init_machine = devkit8000_init,
.init_late = omap35xx_init_late,
- .timer = &omap3_secure_timer,
+ .init_time = omap3_secure_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 601ecdf..2787cb6 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -55,7 +55,7 @@ DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
.init_irq = omap_intc_of_init,
.handle_irq = omap2_intc_handle_irq,
.init_machine = omap_generic_init,
- .timer = &omap2_timer,
+ .init_time = omap2_timer_init,
.dt_compat = omap242x_boards_compat,
.restart = omap_prcm_restart,
MACHINE_END
@@ -74,7 +74,7 @@ DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
.init_irq = omap_intc_of_init,
.handle_irq = omap2_intc_handle_irq,
.init_machine = omap_generic_init,
- .timer = &omap2_timer,
+ .init_time = omap2_timer_init,
.dt_compat = omap243x_boards_compat,
.restart = omap_prcm_restart,
MACHINE_END
@@ -93,7 +93,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
.init_irq = omap_intc_of_init,
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap_generic_init,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.dt_compat = omap3_boards_compat,
.restart = omap_prcm_restart,
MACHINE_END
@@ -112,7 +112,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
.init_irq = omap_intc_of_init,
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap_generic_init,
- .timer = &omap3_am33xx_timer,
+ .init_time = omap3_am33xx_timer_init,
.dt_compat = am33xx_boards_compat,
MACHINE_END
#endif
@@ -132,7 +132,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
.handle_irq = gic_handle_irq,
.init_machine = omap_generic_init,
.init_late = omap4430_init_late,
- .timer = &omap4_timer,
+ .init_time = omap4_timer_init,
.dt_compat = omap4_boards_compat,
.restart = omap_prcm_restart,
MACHINE_END
@@ -152,7 +152,7 @@ DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
.init_irq = omap_gic_of_init,
.handle_irq = gic_handle_irq,
.init_machine = omap_generic_init,
- .timer = &omap5_timer,
+ .init_time = omap5_timer_init,
.dt_compat = omap5_boards_compat,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index bd11b0a..c87df7a 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -385,6 +385,6 @@ MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
.handle_irq = omap2_intc_handle_irq,
.init_machine = omap_h4_init,
.init_late = omap2420_init_late,
- .timer = &omap2_timer,
+ .init_time = omap2_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index dbc705a..d524d61 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -650,7 +650,7 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = igep_init,
.init_late = omap35xx_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END

@@ -663,6 +663,6 @@ MACHINE_START(IGEP0030, "IGEP OMAP3 module")
.handle_irq = omap3_intc_handle_irq,
.init_machine = igep_init,
.init_late = omap35xx_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 1164b10..95d546f 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -435,6 +435,6 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap_ldp_init,
.init_late = omap3430_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index e3efcb8..5dbc236 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -689,7 +689,7 @@ MACHINE_START(NOKIA_N800, "Nokia N800")
.handle_irq = omap2_intc_handle_irq,
.init_machine = n8x0_init_machine,
.init_late = omap2420_init_late,
- .timer = &omap2_timer,
+ .init_time = omap2_timer_init,
.restart = omap_prcm_restart,
MACHINE_END

@@ -702,7 +702,7 @@ MACHINE_START(NOKIA_N810, "Nokia N810")
.handle_irq = omap2_intc_handle_irq,
.init_machine = n8x0_init_machine,
.init_late = omap2420_init_late,
- .timer = &omap2_timer,
+ .init_time = omap2_timer_init,
.restart = omap_prcm_restart,
MACHINE_END

@@ -715,6 +715,6 @@ MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
.handle_irq = omap2_intc_handle_irq,
.init_machine = n8x0_init_machine,
.init_late = omap2420_init_late,
- .timer = &omap2_timer,
+ .init_time = omap2_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 5a3800d..c11ce03 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -544,6 +544,6 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap3_beagle_init,
.init_late = omap3_init_late,
- .timer = &omap3_secure_timer,
+ .init_time = omap3_secure_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 3c0b9a9..cffca23 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -756,6 +756,6 @@ MACHINE_START(OMAP3EVM, "OMAP3 EVM")
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap3_evm_init,
.init_late = omap35xx_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index e84e2a8..21062e7 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -231,7 +231,7 @@ MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap3logic_init,
.init_late = omap35xx_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END

@@ -244,6 +244,6 @@ MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap3logic_init,
.init_late = omap35xx_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index ce31bd3..559580a 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -618,6 +618,6 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap3pandora_init,
.init_late = omap35xx_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index ba11245..0502d80 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -426,6 +426,6 @@ MACHINE_START(SBC3530, "OMAP3 STALKER")
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap3_stalker_init,
.init_late = omap35xx_init_late,
- .timer = &omap3_secure_timer,
+ .init_time = omap3_secure_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index a225d81..fc6a322 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -386,6 +386,6 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap3_touchbook_init,
.init_late = omap3430_init_late,
- .timer = &omap3_secure_timer,
+ .init_time = omap3_secure_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 8c00b99..c7cfed5 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -523,6 +523,6 @@ MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
.handle_irq = gic_handle_irq,
.init_machine = omap4_panda_init,
.init_late = omap4430_init_late,
- .timer = &omap4_timer,
+ .init_time = omap4_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 1cfb037..a3914ab 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -552,6 +552,6 @@ MACHINE_START(OVERO, "Gumstix Overo")
.handle_irq = omap3_intc_handle_irq,
.init_machine = overo_init,
.init_late = omap35xx_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
index 1997e0e..a79d140 100644
--- a/arch/arm/mach-omap2/board-rm680.c
+++ b/arch/arm/mach-omap2/board-rm680.c
@@ -147,7 +147,7 @@ MACHINE_START(NOKIA_RM680, "Nokia RM-680 board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = rm680_init,
.init_late = omap3630_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END

@@ -160,6 +160,6 @@ MACHINE_START(NOKIA_RM696, "Nokia RM-696 board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = rm680_init,
.init_late = omap3630_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index c388aec..4904da8 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -126,6 +126,6 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = rx51_init,
.init_late = omap3430_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
index 5e672c2..36460e1 100644
--- a/arch/arm/mach-omap2/board-ti8168evm.c
+++ b/arch/arm/mach-omap2/board-ti8168evm.c
@@ -43,7 +43,7 @@ MACHINE_START(TI8168EVM, "ti8168evm")
.map_io = ti81xx_map_io,
.init_early = ti81xx_init_early,
.init_irq = ti81xx_init_irq,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.init_machine = ti81xx_evm_init,
.init_late = ti81xx_init_late,
.restart = omap_prcm_restart,
@@ -55,7 +55,7 @@ MACHINE_START(TI8148EVM, "ti8148evm")
.map_io = ti81xx_map_io,
.init_early = ti81xx_init_early,
.init_irq = ti81xx_init_irq,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.init_machine = ti81xx_evm_init,
.init_late = ti81xx_init_late,
.restart = omap_prcm_restart,
diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c
index 8feb4d9..b716f05 100644
--- a/arch/arm/mach-omap2/board-zoom.c
+++ b/arch/arm/mach-omap2/board-zoom.c
@@ -137,7 +137,7 @@ MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap_zoom_init,
.init_late = omap3430_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END

@@ -150,6 +150,6 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap_zoom_init,
.init_late = omap3630_init_late,
- .timer = &omap3_timer,
+ .init_time = omap3_timer_init,
.restart = omap_prcm_restart,
MACHINE_END
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index c925c80..24df338 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -137,12 +137,12 @@ static inline void omap5_map_common_io(void)

extern void omap2_init_common_infrastructure(void);

-extern struct sys_timer omap2_timer;
-extern struct sys_timer omap3_timer;
-extern struct sys_timer omap3_secure_timer;
-extern struct sys_timer omap3_am33xx_timer;
-extern struct sys_timer omap4_timer;
-extern struct sys_timer omap5_timer;
+extern void omap2_timer_init(void);
+extern void omap3_timer_init(void);
+extern void omap3_secure_timer_init(void);
+extern void omap3_am33xx_timer_init(void);
+extern void omap4_timer_init(void);
+extern void omap5_timer_init(void);

void omap2420_init_early(void);
void omap2430_init_early(void);
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 565e575..6291bbf 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -435,33 +435,24 @@ static inline void __init realtime_counter_init(void)

#define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src, \
clksrc_nr, clksrc_src) \
-static void __init omap##name##_timer_init(void) \
+void __init omap##name##_timer_init(void) \
{ \
omap2_gp_clockevent_init((clkev_nr), clkev_src); \
omap2_clocksource_init((clksrc_nr), clksrc_src); \
}

-#define OMAP_SYS_TIMER(name) \
-struct sys_timer omap##name##_timer = { \
- .init = omap##name##_timer_init, \
-};
-
#ifdef CONFIG_ARCH_OMAP2
OMAP_SYS_TIMER_INIT(2, 1, OMAP2_CLKEV_SOURCE, 2, OMAP2_MPU_SOURCE)
-OMAP_SYS_TIMER(2)
#endif

#ifdef CONFIG_ARCH_OMAP3
OMAP_SYS_TIMER_INIT(3, 1, OMAP3_CLKEV_SOURCE, 2, OMAP3_MPU_SOURCE)
-OMAP_SYS_TIMER(3)
OMAP_SYS_TIMER_INIT(3_secure, OMAP3_SECURE_TIMER, OMAP3_CLKEV_SOURCE,
2, OMAP3_MPU_SOURCE)
-OMAP_SYS_TIMER(3_secure)
#endif

#ifdef CONFIG_SOC_AM33XX
OMAP_SYS_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, 2, OMAP4_MPU_SOURCE)
-OMAP_SYS_TIMER(3_am33xx)
#endif

#ifdef CONFIG_ARCH_OMAP4
@@ -470,7 +461,7 @@ static DEFINE_TWD_LOCAL_TIMER(twd_local_timer,
OMAP44XX_LOCAL_TWD_BASE, 29);
#endif

-static void __init omap4_timer_init(void)
+void __init omap4_timer_init(void)
{
omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE);
omap2_clocksource_init(2, OMAP4_MPU_SOURCE);
@@ -490,11 +481,10 @@ static void __init omap4_timer_init(void)
}
#endif
}
-OMAP_SYS_TIMER(4)
#endif

#ifdef CONFIG_SOC_OMAP5
-static void __init omap5_timer_init(void)
+void __init omap5_timer_init(void)
{
int err;

@@ -506,7 +496,6 @@ static void __init omap5_timer_init(void)
if (err)
pr_err("%s: arch_timer_register failed %d\n", __func__, err);
}
-OMAP_SYS_TIMER(5)
#endif

/**
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index 25eb88a..2809ce1 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -657,5 +657,5 @@ MACHINE_START(AG5EVM, "ag5evm")
.handle_irq = gic_handle_irq,
.init_machine = ag5evm_init,
.init_late = shmobile_init_late,
- .timer = &shmobile_timer,
+ .init_time = sh73a0_earlytimer_init,
MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 790dc68..2deda6c 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -1489,5 +1489,5 @@ MACHINE_START(AP4EVB, "ap4evb")
.handle_irq = shmobile_handle_irq_intc,
.init_machine = ap4evb_init,
.init_late = sh7372_pm_init_late,
- .timer = &shmobile_timer,
+ .init_time = sh7372_earlytimer_init,
MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 499e6e3..95b20e9 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -1224,9 +1224,6 @@ static void __init eva_earlytimer_init(void)
static void __init eva_add_early_devices(void)
{
r8a7740_add_early_devices();
-
- /* override timer setup with board-specific code */
- shmobile_timer.init = eva_earlytimer_init;
}

#define RESCNT2 IOMEM(0xe6188020)
@@ -1248,7 +1245,7 @@ DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
.handle_irq = shmobile_handle_irq_intc,
.init_machine = eva_init,
.init_late = shmobile_init_late,
- .timer = &shmobile_timer,
+ .init_time = eva_earlytimer_init,
.dt_compat = eva_boards_compat_dt,
.restart = eva_restart,
MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index cb8c994..331b7ce 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -499,9 +499,6 @@ static void __init bonito_earlytimer_init(void)
static void __init bonito_add_early_devices(void)
{
r8a7740_add_early_devices();
-
- /* override timer setup with board-specific code */
- shmobile_timer.init = bonito_earlytimer_init;
}

MACHINE_START(BONITO, "bonito")
@@ -511,5 +508,5 @@ MACHINE_START(BONITO, "bonito")
.handle_irq = shmobile_handle_irq_intc,
.init_machine = bonito_init,
.init_late = shmobile_init_late,
- .timer = &shmobile_timer,
+ .init_time = bonito_earlytimer_init,
MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kota2.c b/arch/arm/mach-shmobile/board-kota2.c
index bf88f9a..2f24994 100644
--- a/arch/arm/mach-shmobile/board-kota2.c
+++ b/arch/arm/mach-shmobile/board-kota2.c
@@ -553,5 +553,5 @@ MACHINE_START(KOTA2, "kota2")
.handle_irq = gic_handle_irq,
.init_machine = kota2_init,
.init_late = shmobile_init_late,
- .timer = &shmobile_timer,
+ .init_time = sh73a0_earlytimer_init,
MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9d.c b/arch/arm/mach-shmobile/board-kzm9d.c
index b52bc0d..59be864 100644
--- a/arch/arm/mach-shmobile/board-kzm9d.c
+++ b/arch/arm/mach-shmobile/board-kzm9d.c
@@ -92,6 +92,6 @@ DT_MACHINE_START(KZM9D_DT, "kzm9d")
.handle_irq = gic_handle_irq,
.init_machine = kzm9d_add_standard_devices,
.init_late = shmobile_init_late,
- .timer = &shmobile_timer,
+ .init_time = shmobile_timer_init,
.dt_compat = kzm9d_boards_compat_dt,
MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index f63f2ee..8fd59e3 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -795,7 +795,7 @@ DT_MACHINE_START(KZM9G_DT, "kzm9g")
.handle_irq = gic_handle_irq,
.init_machine = kzm_init,
.init_late = shmobile_init_late,
- .timer = &shmobile_timer,
+ .init_time = sh73a0_earlytimer_init,
.restart = kzm9g_restart,
.dt_compat = kzm9g_boards_compat_dt,
MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 39b8f2e..b61bfef 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -1663,6 +1663,6 @@ DT_MACHINE_START(MACKEREL_DT, "mackerel")
.handle_irq = shmobile_handle_irq_intc,
.init_machine = mackerel_init,
.init_late = sh7372_pm_init_late,
- .timer = &shmobile_timer,
+ .init_time = sh7372_earlytimer_init,
.dt_compat = mackerel_boards_compat_dt,
MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index 69f7f46..e6ed68d 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -201,5 +201,5 @@ MACHINE_START(MARZEN, "marzen")
.handle_irq = gic_handle_irq,
.init_machine = marzen_init,
.init_late = shmobile_init_late,
- .timer = &shmobile_timer,
+ .init_time = r8a7779_earlytimer_init,
MACHINE_END
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index dfeca79..a57439e 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -2,7 +2,7 @@
#define __ARCH_MACH_COMMON_H

extern void shmobile_earlytimer_init(void);
-extern struct sys_timer shmobile_timer;
+extern void shmobile_timer_init(void);
extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz,
unsigned int mult, unsigned int div);
struct twd_local_timer;
@@ -20,6 +20,7 @@ extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv);

extern void sh7372_init_irq(void);
extern void sh7372_map_io(void);
+extern void sh7372_earlytimer_init(void);
extern void sh7372_add_early_devices(void);
extern void sh7372_add_standard_devices(void);
extern void sh7372_clock_init(void);
@@ -32,6 +33,7 @@ extern struct clk sh7372_extal2_clk;

extern void sh73a0_init_irq(void);
extern void sh73a0_map_io(void);
+extern void sh73a0_earlytimer_init(void);
extern void sh73a0_add_early_devices(void);
extern void sh73a0_add_standard_devices(void);
extern void sh73a0_clock_init(void);
@@ -50,6 +52,7 @@ extern void r8a7740_pinmux_init(void);

extern void r8a7779_init_irq(void);
extern void r8a7779_map_io(void);
+extern void r8a7779_earlytimer_init(void);
extern void r8a7779_add_early_devices(void);
extern void r8a7779_add_standard_devices(void);
extern void r8a7779_clock_init(void);
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
index a47beeb..ea61cb6 100644
--- a/arch/arm/mach-shmobile/setup-emev2.c
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -467,7 +467,7 @@ DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
.init_irq = emev2_init_irq_dt,
.handle_irq = gic_handle_irq,
.init_machine = emev2_add_standard_devices_dt,
- .timer = &shmobile_timer,
+ .init_time = shmobile_timer_init,
.dt_compat = emev2_boards_compat_dt,
MACHINE_END

diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 6ac242c..c5b4003 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -711,12 +711,6 @@ void __init r8a7740_add_standard_devices(void)
rmobile_add_device_to_domain("A3SP", &i2c1_device);
}

-static void __init r8a7740_earlytimer_init(void)
-{
- r8a7740_clock_init(0);
- shmobile_earlytimer_init();
-}
-
void __init r8a7740_add_early_devices(void)
{
early_platform_add_devices(r8a7740_early_devices,
@@ -724,9 +718,6 @@ void __init r8a7740_add_early_devices(void)

/* setup early console here as well */
shmobile_setup_console();
-
- /* override timer setup with soc-specific code */
- shmobile_timer.init = r8a7740_earlytimer_init;
}

#ifdef CONFIG_USE_OF
@@ -769,7 +760,7 @@ DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
.init_irq = r8a7740_init_irq,
.handle_irq = shmobile_handle_irq_intc,
.init_machine = r8a7740_add_standard_devices_dt,
- .timer = &shmobile_timer,
+ .init_time = shmobile_timer_init,
.dt_compat = r8a7740_boards_compat_dt,
MACHINE_END

diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 7a1ad4f..a181ced 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -339,7 +339,7 @@ void __init r8a7779_add_standard_devices(void)
/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
void __init __weak r8a7779_register_twd(void) { }

-static void __init r8a7779_earlytimer_init(void)
+void __init r8a7779_earlytimer_init(void)
{
r8a7779_clock_init();
shmobile_earlytimer_init();
@@ -366,7 +366,4 @@ void __init r8a7779_add_early_devices(void)
* As a final step pass earlyprint=sh-sci.2,115200 on the kernel
* command line in case of the marzen board.
*/
-
- /* override timer setup with soc-specific code */
- shmobile_timer.init = r8a7779_earlytimer_init;
}
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index a360111..0437471 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -1060,7 +1060,7 @@ void __init sh7372_add_standard_devices(void)
ARRAY_SIZE(domain_devices));
}

-static void __init sh7372_earlytimer_init(void)
+void __init sh7372_earlytimer_init(void)
{
sh7372_clock_init();
shmobile_earlytimer_init();
@@ -1073,9 +1073,6 @@ void __init sh7372_add_early_devices(void)

/* setup early console here as well */
shmobile_setup_console();
-
- /* override timer setup with soc-specific code */
- shmobile_timer.init = sh7372_earlytimer_init;
}

#ifdef CONFIG_USE_OF
@@ -1119,7 +1116,7 @@ DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
.init_irq = sh7372_init_irq,
.handle_irq = shmobile_handle_irq_intc,
.init_machine = sh7372_add_standard_devices_dt,
- .timer = &shmobile_timer,
+ .init_time = shmobile_timer_init,
.dt_compat = sh7372_boards_compat_dt,
MACHINE_END

diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index db99a4a..8c2d642 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -796,7 +796,7 @@ void __init sh73a0_add_standard_devices(void)
/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
void __init __weak sh73a0_register_twd(void) { }

-static void __init sh73a0_earlytimer_init(void)
+void __init sh73a0_earlytimer_init(void)
{
sh73a0_clock_init();
shmobile_earlytimer_init();
@@ -810,7 +810,4 @@ void __init sh73a0_add_early_devices(void)

/* setup early console here as well */
shmobile_setup_console();
-
- /* override timer setup with soc-specific code */
- shmobile_timer.init = sh73a0_earlytimer_init;
}
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index a689197..fdbe54a 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -60,10 +60,6 @@ void __init shmobile_earlytimer_init(void)
late_time_init = shmobile_late_time_init;
}

-static void __init shmobile_timer_init(void)
+void __init shmobile_timer_init(void)
{
}
-
-struct sys_timer shmobile_timer = {
- .init = shmobile_timer_init,
-};
diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c
index bc19f12..7f796d8 100644
--- a/drivers/clocksource/bcm2835_timer.c
+++ b/drivers/clocksource/bcm2835_timer.c
@@ -101,7 +101,7 @@ static struct of_device_id bcm2835_time_match[] __initconst = {
{}
};

-static void __init bcm2835_time_init(void)
+void __init bcm2835_timer_init(void)
{
struct device_node *node;
void __iomem *base;
@@ -155,7 +155,3 @@ static void __init bcm2835_time_init(void)

pr_info("bcm2835: system timer (irq = %d)\n", irq);
}
-
-struct sys_timer bcm2835_timer = {
- .init = bcm2835_time_init,
-};
diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index f7dba5b..ab09ed3 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -107,7 +107,7 @@ static const struct of_device_id osctimer_ids[] __initconst = {
{},
};

-static void __init timer_init(void)
+void __init dw_apb_timer_init(void)
{
struct device_node *event_timer, *source_timer;

@@ -125,7 +125,3 @@ static void __init timer_init(void)

init_sched_clock();
}
-
-struct sys_timer dw_apb_timer = {
- .init = timer_init,
-};
diff --git a/include/linux/bcm2835_timer.h b/include/linux/bcm2835_timer.h
index 25680fe..ca17aa8 100644
--- a/include/linux/bcm2835_timer.h
+++ b/include/linux/bcm2835_timer.h
@@ -17,6 +17,6 @@

#include <asm/mach/time.h>

-extern struct sys_timer bcm2835_timer;
+extern void bcm2835_timer_init(void);

#endif
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
index 1148575..dd755ce 100644
--- a/include/linux/dw_apb_timer.h
+++ b/include/linux/dw_apb_timer.h
@@ -53,5 +53,5 @@ void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs);

-extern struct sys_timer dw_apb_timer;
+extern void dw_apb_timer_init(void);
#endif /* __DW_APB_TIMER_H__ */
--
1.7.0.4

2012-11-09 21:07:36

by Stephen Warren

[permalink] [raw]
Subject: Re: [PATCH 04/11] ARM: set arch_gettimeoffset directly

On 11/08/2012 04:06 PM, Ryan Mallon wrote:
> On 09/11/12 08:01, Stephen Warren wrote:
>> remove ARM's struct sys_timer .offset function pointer, and instead
>> directly set the arch_gettimeoffset function pointer when the timer
>> driver is initialized. This requires multiplying all function results
>> by 1000, since the removed arm_gettimeoffset() did this. Also,
>> s/unsigned long/u32/ just to make the function prototypes exactly
>> match that of arch_gettimeoffset.

>> +static u32 ep93xx_gettimeoffset(void)
>> +{
>> + int offset;
>> +
>> + offset = __raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time;
>> +
>> + /* Calculate (1000000 / 983040) * offset. */
>
> This comment is now incorrect, it should say:
>
> /* Calculate (1000000000 / 983040) * offset */
>
> or perhaps to better explain what is being done:
>
> /*
> * Timer 4 is based on a 983.04 kHz reference clock,
> * so dividing by 983040 gives a milli-second value.
> * Refactor the calculation to avoid overflow.
> */
>
>> + return (offset + (53 * offset / 3072)) * 1000;

Thanks. I expanded on that slightly and went for:

/*
* Timer 4 is based on a 983.04 kHz reference clock,
* so dividing by 983040 gives the fraction of a second,
* so dividing by 0.983040 converts to uS.
* Refactor the calculation to avoid overflow.
* Finally, multiply by 1000 to give nS.
*/

2012-11-09 23:14:02

by john stultz

[permalink] [raw]
Subject: Re: [PATCH 02/11] time: convert arch_gettimeoffset to a pointer

On 11/08/2012 01:01 PM, Stephen Warren wrote:
> From: Stephen Warren <[email protected]>
>
> Currently, whenever CONFIG_ARCH_USES_GETTIMEOFFSET is enabled, each
> arch core provides a single implementation of arch_gettimeoffset(). In
> many cases, different sub-architectures, different machines, or
> different timer providers exist, and so the arch ends up implementing
> arch_gettimeoffset() as a call-through-pointer anyway. Examples are
> ARM, Cris, M68K, and it's arguable that the remaining architectures,
> M32R and Blackfin, should be doing this anyway.
>
> Modify arch_gettimeoffset so that it itself is a function pointer, which
> the arch initializes. This will allow later changes to move the
> initialization of this function into individual machine support or timer
> drivers. This is particularly useful for code in drivers/clocksource
> which should rely on an arch-independant mechanism to register their
> implementation of arch_gettimeoffset().
>
> This patch also converts the Cris architecture to set arch_gettimeoffset
> directly to the final implementation in time_init(), because Cris already
> had separate time_init() functions per sub-architecture. M68K and ARM
> are converted to set arch_gettimeoffset the final implementation in later
> patches, because they already have function pointers in place for this
> purpose.
[snip]
> diff --git a/include/linux/time.h b/include/linux/time.h
> index 4d358e9..05e32a7 100644
> --- a/include/linux/time.h
> +++ b/include/linux/time.h
> @@ -142,9 +142,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta);
> * finer then tick granular time.
> */
> #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
> -extern u32 arch_gettimeoffset(void);
> -#else
> -static inline u32 arch_gettimeoffset(void) { return 0; }
> +extern u32 (*arch_gettimeoffset)(void);
> #endif
>
> extern void do_gettimeofday(struct timeval *tv);
> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> index e424970..9d00ace 100644
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -140,6 +140,20 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock)
> }
>
> /* Timekeeper helper functions. */
> +
> +#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
> +u32 (*arch_gettimeoffset)(void);
> +
> +u32 gettimeoffset(void)
> +{
> + if (likely(arch_gettimeoffset))
> + return arch_gettimeoffset();
> + return 0;
> +}
> +#else
> +static inline u32 gettimeoffset(void) { return 0; }
> +#endif

Minor nit-pick here, but get_arch_timeoffset() or get_arch_tickoffset()
might be clearer, as gettimeoffset() sounds a little generic, and could
be confused with the higher-level timekeeping_inject_offset() call.

Otherwise this looks ok to me (disclaimer: I'm back from a 4 week leave,
so I may not have my brain plugged in all the way yet).

thanks
-john

2012-11-10 03:38:48

by Ryan Mallon

[permalink] [raw]
Subject: Re: [PATCH 04/11] ARM: set arch_gettimeoffset directly

On 10/11/12 08:07, Stephen Warren wrote:

> On 11/08/2012 04:06 PM, Ryan Mallon wrote:
>> On 09/11/12 08:01, Stephen Warren wrote:
>>> remove ARM's struct sys_timer .offset function pointer, and instead
>>> directly set the arch_gettimeoffset function pointer when the timer
>>> driver is initialized. This requires multiplying all function results
>>> by 1000, since the removed arm_gettimeoffset() did this. Also,
>>> s/unsigned long/u32/ just to make the function prototypes exactly
>>> match that of arch_gettimeoffset.
>
>>> +static u32 ep93xx_gettimeoffset(void)
>>> +{
>>> + int offset;
>>> +
>>> + offset = __raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time;
>>> +
>>> + /* Calculate (1000000 / 983040) * offset. */
>>
>> This comment is now incorrect, it should say:
>>
>> /* Calculate (1000000000 / 983040) * offset */
>>
>> or perhaps to better explain what is being done:
>>
>> /*
>> * Timer 4 is based on a 983.04 kHz reference clock,
>> * so dividing by 983040 gives a milli-second value.
>> * Refactor the calculation to avoid overflow.
>> */
>>
>>> + return (offset + (53 * offset / 3072)) * 1000;
>
> Thanks. I expanded on that slightly and went for:
>
> /*
> * Timer 4 is based on a 983.04 kHz reference clock,
> * so dividing by 983040 gives the fraction of a second,
> * so dividing by 0.983040 converts to uS.
> * Refactor the calculation to avoid overflow.
> * Finally, multiply by 1000 to give nS.
> */
>


Looks good, thanks.

~Ryan

2012-11-11 09:45:58

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 02/11] time: convert arch_gettimeoffset to a pointer

On Thu, Nov 8, 2012 at 10:01 PM, Stephen Warren <[email protected]> wrote:
> From: Stephen Warren <[email protected]>
>
> Currently, whenever CONFIG_ARCH_USES_GETTIMEOFFSET is enabled, each
> arch core provides a single implementation of arch_gettimeoffset(). In
> many cases, different sub-architectures, different machines, or
> different timer providers exist, and so the arch ends up implementing
> arch_gettimeoffset() as a call-through-pointer anyway. Examples are
> ARM, Cris, M68K, and it's arguable that the remaining architectures,
> M32R and Blackfin, should be doing this anyway.
>
> Modify arch_gettimeoffset so that it itself is a function pointer, which
> the arch initializes. This will allow later changes to move the
> initialization of this function into individual machine support or timer
> drivers. This is particularly useful for code in drivers/clocksource
> which should rely on an arch-independant mechanism to register their
> implementation of arch_gettimeoffset().
>
> This patch also converts the Cris architecture to set arch_gettimeoffset
> directly to the final implementation in time_init(), because Cris already
> had separate time_init() functions per sub-architecture. M68K and ARM
> are converted to set arch_gettimeoffset the final implementation in later
> patches, because they already have function pointers in place for this
> purpose.
>
> Cc: Russell King <[email protected]>
> Cc: Mike Frysinger <[email protected]>
> Cc: Mikael Starvik <[email protected]>
> Cc: Jesper Nilsson <[email protected]>
> Cc: Hirokazu Takata <[email protected]>
> Cc: Geert Uytterhoeven <[email protected]>

The m68k changes look ok, so

Acked-by: Geert Uytterhoeven <[email protected]>
> Cc: John Stultz <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Signed-off-by: Stephen Warren <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2012-11-11 09:50:27

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 03/11] m68k: set arch_gettimeoffset directly

On Thu, Nov 8, 2012 at 10:01 PM, Stephen Warren <[email protected]> wrote:
> From: Stephen Warren <[email protected]>
>
> remove m68k's mach_gettimeoffset function pointer, and instead directly
> set the arch_gettimeoffset function pointer. This requires multiplying
> all function results by 1000, since the removed m68k_gettimeoffset() did
> this. Also, s/unsigned long/u32/ just to make the function prototypes
> exactly match that of arch_gettimeoffset.
>
> Cc: Geert Uytterhoeven <[email protected]>

Acked-by: Geert Uytterhoeven <[email protected]>

> Cc: Philip Blundell <[email protected]>
> Cc: Joshua Thompson <[email protected]>
> Cc: Sam Creasey <[email protected]>
> Signed-off-by: Stephen Warren <[email protected]>
> ---
> arch/m68k/amiga/config.c | 10 +++++-----
> arch/m68k/apollo/config.c | 9 ++++-----
> arch/m68k/atari/config.c | 4 ++--
> arch/m68k/atari/time.c | 6 +++---
> arch/m68k/bvme6000/config.c | 10 +++++-----
> arch/m68k/hp300/config.c | 2 +-
> arch/m68k/hp300/time.c | 4 ++--
> arch/m68k/hp300/time.h | 2 +-
> arch/m68k/include/asm/machdep.h | 2 +-
> arch/m68k/kernel/setup_mm.c | 1 -
> arch/m68k/kernel/time.c | 9 ---------
> arch/m68k/mac/config.c | 4 ++--
> arch/m68k/mac/via.c | 4 ++--
> arch/m68k/mvme147/config.c | 8 ++++----
> arch/m68k/mvme16x/config.c | 8 ++++----
> arch/m68k/q40/config.c | 8 ++++----
> arch/m68k/sun3/config.c | 4 ++--
> arch/m68k/sun3/intersil.c | 4 ++--
> arch/m68k/sun3x/config.c | 2 +-
> arch/m68k/sun3x/time.c | 2 +-
> arch/m68k/sun3x/time.h | 2 +-
> 21 files changed, 47 insertions(+), 58 deletions(-)
>
> diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
> index ee01b7a..b819390 100644
> --- a/arch/m68k/amiga/config.c
> +++ b/arch/m68k/amiga/config.c
> @@ -95,7 +95,7 @@ static void amiga_sched_init(irq_handler_t handler);
> static void amiga_get_model(char *model);
> static void amiga_get_hardware_list(struct seq_file *m);
> /* amiga specific timer functions */
> -static unsigned long amiga_gettimeoffset(void);
> +static u32 amiga_gettimeoffset(void);
> extern void amiga_mksound(unsigned int count, unsigned int ticks);
> static void amiga_reset(void);
> extern void amiga_init_sound(void);
> @@ -377,7 +377,7 @@ void __init config_amiga(void)
> mach_init_IRQ = amiga_init_IRQ;
> mach_get_model = amiga_get_model;
> mach_get_hardware_list = amiga_get_hardware_list;
> - mach_gettimeoffset = amiga_gettimeoffset;
> + arch_gettimeoffset = amiga_gettimeoffset;
>
> /*
> * default MAX_DMA=0xffffffff on all machines. If we don't do so, the SCSI
> @@ -482,10 +482,10 @@ static void __init amiga_sched_init(irq_handler_t timer_routine)
> #define TICK_SIZE 10000
>
> /* This is always executed with interrupts disabled. */
> -static unsigned long amiga_gettimeoffset(void)
> +static u32 amiga_gettimeoffset(void)
> {
> unsigned short hi, lo, hi2;
> - unsigned long ticks, offset = 0;
> + u32 ticks, offset = 0;
>
> /* read CIA B timer A current value */
> hi = ciab.tahi;
> @@ -507,7 +507,7 @@ static unsigned long amiga_gettimeoffset(void)
> ticks = jiffy_ticks - ticks;
> ticks = (10000 * ticks) / jiffy_ticks;
>
> - return ticks + offset;
> + return (ticks + offset) * 1000;
> }
>
> static void amiga_reset(void) __noreturn;
> diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
> index f5565d6..3ea56b9 100644
> --- a/arch/m68k/apollo/config.c
> +++ b/arch/m68k/apollo/config.c
> @@ -26,7 +26,7 @@ u_long apollo_model;
>
> extern void dn_sched_init(irq_handler_t handler);
> extern void dn_init_IRQ(void);
> -extern unsigned long dn_gettimeoffset(void);
> +extern u32 dn_gettimeoffset(void);
> extern int dn_dummy_hwclk(int, struct rtc_time *);
> extern int dn_dummy_set_clock_mmss(unsigned long);
> extern void dn_dummy_reset(void);
> @@ -151,7 +151,7 @@ void __init config_apollo(void)
>
> mach_sched_init=dn_sched_init; /* */
> mach_init_IRQ=dn_init_IRQ;
> - mach_gettimeoffset = dn_gettimeoffset;
> + arch_gettimeoffset = dn_gettimeoffset;
> mach_max_dma_address = 0xffffffff;
> mach_hwclk = dn_dummy_hwclk; /* */
> mach_set_clock_mmss = dn_dummy_set_clock_mmss; /* */
> @@ -203,10 +203,9 @@ void dn_sched_init(irq_handler_t timer_routine)
> pr_err("Couldn't register timer interrupt\n");
> }
>
> -unsigned long dn_gettimeoffset(void) {
> -
> +u32 dn_gettimeoffset(void)
> +{
> return 0xdeadbeef;
> -
> }
>
> int dn_dummy_hwclk(int op, struct rtc_time *t) {
> diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
> index d8eb327..037c11c 100644
> --- a/arch/m68k/atari/config.c
> +++ b/arch/m68k/atari/config.c
> @@ -74,7 +74,7 @@ static void atari_heartbeat(int on);
>
> /* atari specific timer functions (in time.c) */
> extern void atari_sched_init(irq_handler_t);
> -extern unsigned long atari_gettimeoffset (void);
> +extern u32 atari_gettimeoffset(void);
> extern int atari_mste_hwclk (int, struct rtc_time *);
> extern int atari_tt_hwclk (int, struct rtc_time *);
> extern int atari_mste_set_clock_mmss (unsigned long);
> @@ -204,7 +204,7 @@ void __init config_atari(void)
> mach_init_IRQ = atari_init_IRQ;
> mach_get_model = atari_get_model;
> mach_get_hardware_list = atari_get_hardware_list;
> - mach_gettimeoffset = atari_gettimeoffset;
> + arch_gettimeoffset = atari_gettimeoffset;
> mach_reset = atari_reset;
> mach_max_dma_address = 0xffffff;
> #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
> diff --git a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c
> index c0cc68a..da8f981 100644
> --- a/arch/m68k/atari/time.c
> +++ b/arch/m68k/atari/time.c
> @@ -42,9 +42,9 @@ atari_sched_init(irq_handler_t timer_routine)
> #define TICK_SIZE 10000
>
> /* This is always executed with interrupts disabled. */
> -unsigned long atari_gettimeoffset (void)
> +u32 atari_gettimeoffset(void)
> {
> - unsigned long ticks, offset = 0;
> + u32 ticks, offset = 0;
>
> /* read MFP timer C current value */
> ticks = st_mfp.tim_dt_c;
> @@ -57,7 +57,7 @@ unsigned long atari_gettimeoffset (void)
> ticks = INT_TICKS - ticks;
> ticks = ticks * 10000L / INT_TICKS;
>
> - return ticks + offset;
> + return (ticks + offset) * 1000;
> }
>
>
> diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c
> index 0bf850a..8943aa4 100644
> --- a/arch/m68k/bvme6000/config.c
> +++ b/arch/m68k/bvme6000/config.c
> @@ -38,7 +38,7 @@
>
> static void bvme6000_get_model(char *model);
> extern void bvme6000_sched_init(irq_handler_t handler);
> -extern unsigned long bvme6000_gettimeoffset (void);
> +extern u32 bvme6000_gettimeoffset(void);
> extern int bvme6000_hwclk (int, struct rtc_time *);
> extern int bvme6000_set_clock_mmss (unsigned long);
> extern void bvme6000_reset (void);
> @@ -110,7 +110,7 @@ void __init config_bvme6000(void)
> mach_max_dma_address = 0xffffffff;
> mach_sched_init = bvme6000_sched_init;
> mach_init_IRQ = bvme6000_init_IRQ;
> - mach_gettimeoffset = bvme6000_gettimeoffset;
> + arch_gettimeoffset = bvme6000_gettimeoffset;
> mach_hwclk = bvme6000_hwclk;
> mach_set_clock_mmss = bvme6000_set_clock_mmss;
> mach_reset = bvme6000_reset;
> @@ -216,13 +216,13 @@ void bvme6000_sched_init (irq_handler_t timer_routine)
> * results...
> */
>
> -unsigned long bvme6000_gettimeoffset (void)
> +u32 bvme6000_gettimeoffset(void)
> {
> volatile RtcPtr_t rtc = (RtcPtr_t)BVME_RTC_BASE;
> volatile PitRegsPtr pit = (PitRegsPtr)BVME_PIT_BASE;
> unsigned char msr = rtc->msr & 0xc0;
> unsigned char t1int, t1op;
> - unsigned long v = 800000, ov;
> + u32 v = 800000, ov;
>
> rtc->msr = 0; /* Ensure timer registers accessible */
>
> @@ -246,7 +246,7 @@ unsigned long bvme6000_gettimeoffset (void)
> v += 10000; /* Int pending, + 10ms */
> rtc->msr = msr;
>
> - return v;
> + return v * 1000;
> }
>
> /*
> diff --git a/arch/m68k/hp300/config.c b/arch/m68k/hp300/config.c
> index bf16af1..b7609f7 100644
> --- a/arch/m68k/hp300/config.c
> +++ b/arch/m68k/hp300/config.c
> @@ -251,7 +251,7 @@ void __init config_hp300(void)
> mach_sched_init = hp300_sched_init;
> mach_init_IRQ = hp300_init_IRQ;
> mach_get_model = hp300_get_model;
> - mach_gettimeoffset = hp300_gettimeoffset;
> + arch_gettimeoffset = hp300_gettimeoffset;
> mach_hwclk = hp300_hwclk;
> mach_get_ss = hp300_get_ss;
> mach_reset = hp300_reset;
> diff --git a/arch/m68k/hp300/time.c b/arch/m68k/hp300/time.c
> index 29a71be..749543b 100644
> --- a/arch/m68k/hp300/time.c
> +++ b/arch/m68k/hp300/time.c
> @@ -46,7 +46,7 @@ static irqreturn_t hp300_tick(int irq, void *dev_id)
> return vector(irq, NULL);
> }
>
> -unsigned long hp300_gettimeoffset(void)
> +u32 hp300_gettimeoffset(void)
> {
> /* Read current timer 1 value */
> unsigned char lsb, msb1, msb2;
> @@ -59,7 +59,7 @@ unsigned long hp300_gettimeoffset(void)
> /* A carry happened while we were reading. Read it again */
> lsb = in_8(CLOCKBASE + 7);
> ticks = INTVAL - ((msb2 << 8) | lsb);
> - return (USECS_PER_JIFFY * ticks) / INTVAL;
> + return ((USECS_PER_JIFFY * ticks) / INTVAL) * 1000;
> }
>
> void __init hp300_sched_init(irq_handler_t vector)
> diff --git a/arch/m68k/hp300/time.h b/arch/m68k/hp300/time.h
> index 7b98242..f5583ec 100644
> --- a/arch/m68k/hp300/time.h
> +++ b/arch/m68k/hp300/time.h
> @@ -1,2 +1,2 @@
> extern void hp300_sched_init(irq_handler_t vector);
> -extern unsigned long hp300_gettimeoffset(void);
> +extern u32 hp300_gettimeoffset(void);
> diff --git a/arch/m68k/include/asm/machdep.h b/arch/m68k/include/asm/machdep.h
> index 825c1c8..953ca21 100644
> --- a/arch/m68k/include/asm/machdep.h
> +++ b/arch/m68k/include/asm/machdep.h
> @@ -3,6 +3,7 @@
>
> #include <linux/seq_file.h>
> #include <linux/interrupt.h>
> +#include <linux/time.h>
>
> struct pt_regs;
> struct mktime;
> @@ -16,7 +17,6 @@ extern void (*mach_init_IRQ) (void);
> extern void (*mach_get_model) (char *model);
> extern void (*mach_get_hardware_list) (struct seq_file *m);
> /* machine dependent timer functions */
> -extern unsigned long (*mach_gettimeoffset)(void);
> extern int (*mach_hwclk)(int, struct rtc_time*);
> extern unsigned int (*mach_get_ss)(void);
> extern int (*mach_get_rtc_pll)(struct rtc_pll_info *);
> diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
> index d872ce4..80cfbe5 100644
> --- a/arch/m68k/kernel/setup_mm.c
> +++ b/arch/m68k/kernel/setup_mm.c
> @@ -84,7 +84,6 @@ void (*mach_init_IRQ) (void) __initdata = NULL;
> void (*mach_get_model) (char *model);
> void (*mach_get_hardware_list) (struct seq_file *m);
> /* machine dependent timer functions */
> -unsigned long (*mach_gettimeoffset) (void);
> int (*mach_hwclk) (int, struct rtc_time*);
> EXPORT_SYMBOL(mach_hwclk);
> int (*mach_set_clock_mmss) (unsigned long);
> diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
> index c2994c8..bea6bcf 100644
> --- a/arch/m68k/kernel/time.c
> +++ b/arch/m68k/kernel/time.c
> @@ -82,11 +82,6 @@ void read_persistent_clock(struct timespec *ts)
>
> #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
>
> -static u32 m68k_gettimeoffset(void)
> -{
> - return mach_gettimeoffset() * 1000;
> -}
> -
> static int __init rtc_init(void)
> {
> struct platform_device *pdev;
> @@ -104,9 +99,5 @@ module_init(rtc_init);
>
> void __init time_init(void)
> {
> -#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
> - arch_gettimeoffset = m68k_gettimeoffset;
> -#endif
> -
> mach_sched_init(timer_interrupt);
> }
> diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
> index d9f62e0..afb95d5 100644
> --- a/arch/m68k/mac/config.c
> +++ b/arch/m68k/mac/config.c
> @@ -52,7 +52,7 @@ struct mac_booter_data mac_bi_data;
> static unsigned long mac_orig_videoaddr;
>
> /* Mac specific timer functions */
> -extern unsigned long mac_gettimeoffset(void);
> +extern u32 mac_gettimeoffset(void);
> extern int mac_hwclk(int, struct rtc_time *);
> extern int mac_set_clock_mmss(unsigned long);
> extern void iop_preinit(void);
> @@ -177,7 +177,7 @@ void __init config_mac(void)
> mach_sched_init = mac_sched_init;
> mach_init_IRQ = mac_init_IRQ;
> mach_get_model = mac_get_model;
> - mach_gettimeoffset = mac_gettimeoffset;
> + arch_gettimeoffset = mac_gettimeoffset;
> mach_hwclk = mac_hwclk;
> mach_set_clock_mmss = mac_set_clock_mmss;
> mach_reset = mac_reset;
> diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
> index 2d85662..5d1458b 100644
> --- a/arch/m68k/mac/via.c
> +++ b/arch/m68k/mac/via.c
> @@ -327,7 +327,7 @@ void via_debug_dump(void)
> * TBI: get time offset between scheduling timer ticks
> */
>
> -unsigned long mac_gettimeoffset (void)
> +u32 mac_gettimeoffset(void)
> {
> unsigned long ticks, offset = 0;
>
> @@ -341,7 +341,7 @@ unsigned long mac_gettimeoffset (void)
> ticks = MAC_CLOCK_TICK - ticks;
> ticks = ticks * 10000L / MAC_CLOCK_TICK;
>
> - return ticks + offset;
> + return (ticks + offset) * 1000;
> }
>
> /*
> diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
> index a41c091..1c62628 100644
> --- a/arch/m68k/mvme147/config.c
> +++ b/arch/m68k/mvme147/config.c
> @@ -37,7 +37,7 @@
>
> static void mvme147_get_model(char *model);
> extern void mvme147_sched_init(irq_handler_t handler);
> -extern unsigned long mvme147_gettimeoffset (void);
> +extern u32 mvme147_gettimeoffset(void);
> extern int mvme147_hwclk (int, struct rtc_time *);
> extern int mvme147_set_clock_mmss (unsigned long);
> extern void mvme147_reset (void);
> @@ -88,7 +88,7 @@ void __init config_mvme147(void)
> mach_max_dma_address = 0x01000000;
> mach_sched_init = mvme147_sched_init;
> mach_init_IRQ = mvme147_init_IRQ;
> - mach_gettimeoffset = mvme147_gettimeoffset;
> + arch_gettimeoffset = mvme147_gettimeoffset;
> mach_hwclk = mvme147_hwclk;
> mach_set_clock_mmss = mvme147_set_clock_mmss;
> mach_reset = mvme147_reset;
> @@ -127,7 +127,7 @@ void mvme147_sched_init (irq_handler_t timer_routine)
>
> /* This is always executed with interrupts disabled. */
> /* XXX There are race hazards in this code XXX */
> -unsigned long mvme147_gettimeoffset (void)
> +u32 mvme147_gettimeoffset(void)
> {
> volatile unsigned short *cp = (volatile unsigned short *)0xfffe1012;
> unsigned short n;
> @@ -137,7 +137,7 @@ unsigned long mvme147_gettimeoffset (void)
> n = *cp;
>
> n -= PCC_TIMER_PRELOAD;
> - return (unsigned long)n * 25 / 4;
> + return ((unsigned long)n * 25 / 4) * 1000;
> }
>
> static int bcd2int (unsigned char b)
> diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
> index b6d7d8a..080a342 100644
> --- a/arch/m68k/mvme16x/config.c
> +++ b/arch/m68k/mvme16x/config.c
> @@ -43,7 +43,7 @@ static MK48T08ptr_t volatile rtc = (MK48T08ptr_t)MVME_RTC_BASE;
>
> static void mvme16x_get_model(char *model);
> extern void mvme16x_sched_init(irq_handler_t handler);
> -extern unsigned long mvme16x_gettimeoffset (void);
> +extern u32 mvme16x_gettimeoffset(void);
> extern int mvme16x_hwclk (int, struct rtc_time *);
> extern int mvme16x_set_clock_mmss (unsigned long);
> extern void mvme16x_reset (void);
> @@ -289,7 +289,7 @@ void __init config_mvme16x(void)
> mach_max_dma_address = 0xffffffff;
> mach_sched_init = mvme16x_sched_init;
> mach_init_IRQ = mvme16x_init_IRQ;
> - mach_gettimeoffset = mvme16x_gettimeoffset;
> + arch_gettimeoffset = mvme16x_gettimeoffset;
> mach_hwclk = mvme16x_hwclk;
> mach_set_clock_mmss = mvme16x_set_clock_mmss;
> mach_reset = mvme16x_reset;
> @@ -405,9 +405,9 @@ void mvme16x_sched_init (irq_handler_t timer_routine)
>
>
> /* This is always executed with interrupts disabled. */
> -unsigned long mvme16x_gettimeoffset (void)
> +u32 mvme16x_gettimeoffset(void)
> {
> - return (*(volatile unsigned long *)0xfff42008);
> + return (*(volatile u32 *)0xfff42008) * 1000;
> }
>
> int bcd2int (unsigned char b)
> diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
> index 1adb5b7..658542b 100644
> --- a/arch/m68k/q40/config.c
> +++ b/arch/m68k/q40/config.c
> @@ -40,7 +40,7 @@ extern void q40_init_IRQ(void);
> static void q40_get_model(char *model);
> extern void q40_sched_init(irq_handler_t handler);
>
> -static unsigned long q40_gettimeoffset(void);
> +static u32 q40_gettimeoffset(void);
> static int q40_hwclk(int, struct rtc_time *);
> static unsigned int q40_get_ss(void);
> static int q40_set_clock_mmss(unsigned long);
> @@ -170,7 +170,7 @@ void __init config_q40(void)
> mach_sched_init = q40_sched_init;
>
> mach_init_IRQ = q40_init_IRQ;
> - mach_gettimeoffset = q40_gettimeoffset;
> + arch_gettimeoffset = q40_gettimeoffset;
> mach_hwclk = q40_hwclk;
> mach_get_ss = q40_get_ss;
> mach_get_rtc_pll = q40_get_rtc_pll;
> @@ -204,9 +204,9 @@ int q40_parse_bootinfo(const struct bi_record *rec)
> }
>
>
> -static unsigned long q40_gettimeoffset(void)
> +static u32 q40_gettimeoffset(void)
> {
> - return 5000 * (ql_ticks != 0);
> + return 5000 * (ql_ticks != 0) * 1000;
> }
>
>
> diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
> index 2ca25bd..f59ec58 100644
> --- a/arch/m68k/sun3/config.c
> +++ b/arch/m68k/sun3/config.c
> @@ -36,7 +36,7 @@
>
> char sun3_reserved_pmeg[SUN3_PMEGS_NUM];
>
> -extern unsigned long sun3_gettimeoffset(void);
> +extern u32 sun3_gettimeoffset(void);
> static void sun3_sched_init(irq_handler_t handler);
> extern void sun3_get_model (char* model);
> extern int sun3_hwclk(int set, struct rtc_time *t);
> @@ -141,7 +141,7 @@ void __init config_sun3(void)
> mach_sched_init = sun3_sched_init;
> mach_init_IRQ = sun3_init_IRQ;
> mach_reset = sun3_reboot;
> - mach_gettimeoffset = sun3_gettimeoffset;
> + arch_gettimeoffset = sun3_gettimeoffset;
> mach_get_model = sun3_get_model;
> mach_hwclk = sun3_hwclk;
> mach_halt = sun3_halt;
> diff --git a/arch/m68k/sun3/intersil.c b/arch/m68k/sun3/intersil.c
> index 94fe801..889829e 100644
> --- a/arch/m68k/sun3/intersil.c
> +++ b/arch/m68k/sun3/intersil.c
> @@ -23,9 +23,9 @@
> #define START_VAL (INTERSIL_RUN | INTERSIL_INT_ENABLE | INTERSIL_24H_MODE)
>
> /* does this need to be implemented? */
> -unsigned long sun3_gettimeoffset(void)
> +u32 sun3_gettimeoffset(void)
> {
> - return 1;
> + return 1000;
> }
>
>
> diff --git a/arch/m68k/sun3x/config.c b/arch/m68k/sun3x/config.c
> index dd306c8..0532d64 100644
> --- a/arch/m68k/sun3x/config.c
> +++ b/arch/m68k/sun3x/config.c
> @@ -48,7 +48,7 @@ void __init config_sun3x(void)
> mach_sched_init = sun3x_sched_init;
> mach_init_IRQ = sun3_init_IRQ;
>
> - mach_gettimeoffset = sun3x_gettimeoffset;
> + arch_gettimeoffset = sun3x_gettimeoffset;
> mach_reset = sun3x_reboot;
>
> mach_hwclk = sun3x_hwclk;
> diff --git a/arch/m68k/sun3x/time.c b/arch/m68k/sun3x/time.c
> index 1d0a724..c8eb08a 100644
> --- a/arch/m68k/sun3x/time.c
> +++ b/arch/m68k/sun3x/time.c
> @@ -71,7 +71,7 @@ int sun3x_hwclk(int set, struct rtc_time *t)
> return 0;
> }
> /* Not much we can do here */
> -unsigned long sun3x_gettimeoffset (void)
> +u32 sun3x_gettimeoffset(void)
> {
> return 0L;
> }
> diff --git a/arch/m68k/sun3x/time.h b/arch/m68k/sun3x/time.h
> index 6909e12..a4f9126 100644
> --- a/arch/m68k/sun3x/time.h
> +++ b/arch/m68k/sun3x/time.h
> @@ -2,7 +2,7 @@
> #define SUN3X_TIME_H
>
> extern int sun3x_hwclk(int set, struct rtc_time *t);
> -unsigned long sun3x_gettimeoffset (void);
> +u32 sun3x_gettimeoffset(void);
> void sun3x_sched_init(irq_handler_t vector);
>
> struct mostek_dt {
> --

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2012-11-11 12:14:46

by Phil Blundell

[permalink] [raw]
Subject: Re: [PATCH 03/11] m68k: set arch_gettimeoffset directly

On Thu, 2012-11-08 at 14:01 -0700, Stephen Warren wrote:
> From: Stephen Warren <[email protected]>
>
> remove m68k's mach_gettimeoffset function pointer, and instead directly
> set the arch_gettimeoffset function pointer. This requires multiplying
> all function results by 1000, since the removed m68k_gettimeoffset() did
> this. Also, s/unsigned long/u32/ just to make the function prototypes
> exactly match that of arch_gettimeoffset.
>
> Cc: Geert Uytterhoeven <[email protected]>
> Cc: Philip Blundell <[email protected]>

Acked-by: Phil Blundell <[email protected]>

> Cc: Joshua Thompson <[email protected]>
> Cc: Sam Creasey <[email protected]>
> Signed-off-by: Stephen Warren <[email protected]>

2012-11-12 10:45:01

by Jesper Nilsson

[permalink] [raw]
Subject: Re: [PATCH 01/11] cris: move usec/nsec conversion to do_slow_gettimeoffset

On Thu, Nov 08, 2012 at 02:01:46PM -0700, Stephen Warren wrote:
> From: Stephen Warren <[email protected]>
>
> Move usec to nsec conversion from arch_gettimeoffset() to
> do_slow_gettimeoffset(); in a future patch, do_slow_gettimeoffset()
> will be used directly as the implementation of arch_gettimeoffset(),
> so needs to perform all required calculations.
>
> Cc: Mikael Starvik <[email protected]>
> Cc: Jesper Nilsson <[email protected]>

Acked-by: Jesper Nilsson <[email protected]>

> Cc: [email protected]
> Signed-off-by: Stephen Warren <[email protected]>
> ---
> arch/cris/arch-v10/kernel/time.c | 4 ++--
> arch/cris/kernel/time.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
> index bcffcb6..162892f 100644
> --- a/arch/cris/arch-v10/kernel/time.c
> +++ b/arch/cris/arch-v10/kernel/time.c
> @@ -65,8 +65,8 @@ unsigned long do_slow_gettimeoffset(void)
> */
> count = *R_TIMER0_DATA;
>
> - /* Convert timer value to usec */
> - return (TIMER0_DIV - count) * ((NSEC_PER_SEC/1000)/HZ)/TIMER0_DIV;
> + /* Convert timer value to nsec */
> + return (TIMER0_DIV - count) * (NSEC_PER_SEC/HZ)/TIMER0_DIV;
> }
>
> /* Excerpt from the Etrax100 HSDD about the built-in watchdog:
> diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
> index 277ffc4..b063c92 100644
> --- a/arch/cris/kernel/time.c
> +++ b/arch/cris/kernel/time.c
> @@ -46,7 +46,7 @@ static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
>
> u32 arch_gettimeoffset(void)
> {
> - return do_gettimeoffset() * 1000;
> + return do_gettimeoffset();
> }
> #endif
>
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

/^JN - Jesper Nilsson
--
Jesper Nilsson -- [email protected]

2012-11-12 10:46:30

by Jesper Nilsson

[permalink] [raw]
Subject: Re: [PATCH 02/11] time: convert arch_gettimeoffset to a pointer

On Thu, Nov 08, 2012 at 10:01:47PM +0100, Stephen Warren wrote:
> From: Stephen Warren <[email protected]>
>
> Currently, whenever CONFIG_ARCH_USES_GETTIMEOFFSET is enabled, each
> arch core provides a single implementation of arch_gettimeoffset(). In
> many cases, different sub-architectures, different machines, or
> different timer providers exist, and so the arch ends up implementing
> arch_gettimeoffset() as a call-through-pointer anyway. Examples are
> ARM, Cris, M68K, and it's arguable that the remaining architectures,
> M32R and Blackfin, should be doing this anyway.
>
> Modify arch_gettimeoffset so that it itself is a function pointer, which
> the arch initializes. This will allow later changes to move the
> initialization of this function into individual machine support or timer
> drivers. This is particularly useful for code in drivers/clocksource
> which should rely on an arch-independant mechanism to register their
> implementation of arch_gettimeoffset().
>
> This patch also converts the Cris architecture to set arch_gettimeoffset
> directly to the final implementation in time_init(), because Cris already
> had separate time_init() functions per sub-architecture. M68K and ARM
> are converted to set arch_gettimeoffset the final implementation in later
> patches, because they already have function pointers in place for this
> purpose.
>
> Cc: Russell King <[email protected]>
> Cc: Mike Frysinger <[email protected]>
> Cc: Mikael Starvik <[email protected]>

For the cris parts:

Acked-by: Jesper Nilsson <[email protected]>

> Cc: Hirokazu Takata <[email protected]>
> Cc: Geert Uytterhoeven <[email protected]>
> Cc: John Stultz <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Signed-off-by: Stephen Warren <[email protected]>
> ---
> arch/arm/kernel/time.c | 6 +++++-
> arch/blackfin/kernel/time.c | 6 +++++-
> arch/cris/arch-v10/kernel/time.c | 6 ++++--
> arch/cris/kernel/time.c | 11 -----------
> arch/m32r/kernel/time.c | 4 +++-
> arch/m68k/kernel/time.c | 16 ++++++++++------
> include/linux/time.h | 4 +---
> kernel/time/timekeeping.c | 20 +++++++++++++++++---
> 8 files changed, 45 insertions(+), 28 deletions(-)
>
> diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
> index 09be0c3..b0190b4 100644
> --- a/arch/arm/kernel/time.c
> +++ b/arch/arm/kernel/time.c
> @@ -70,7 +70,7 @@ EXPORT_SYMBOL(profile_pc);
> #endif
>
> #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
> -u32 arch_gettimeoffset(void)
> +static u32 arm_gettimeoffset(void)
> {
> if (system_timer->offset != NULL)
> return system_timer->offset() * 1000;
> @@ -164,6 +164,10 @@ device_initcall(timer_init_syscore_ops);
>
> void __init time_init(void)
> {
> +#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
> + arch_gettimeoffset = arm_gettimeoffset;
> +#endif
> +
> system_timer = machine_desc->timer;
> system_timer->init();
> sched_clock_postinit();
> diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c
> index 2310b24..3126b92 100644
> --- a/arch/blackfin/kernel/time.c
> +++ b/arch/blackfin/kernel/time.c
> @@ -85,7 +85,7 @@ time_sched_init(irqreturn_t(*timer_routine) (int, void *))
> /*
> * Should return useconds since last timer tick
> */
> -u32 arch_gettimeoffset(void)
> +static u32 blackfin_gettimeoffset(void)
> {
> unsigned long offset;
> unsigned long clocks_per_jiffy;
> @@ -141,6 +141,10 @@ void read_persistent_clock(struct timespec *ts)
>
> void __init time_init(void)
> {
> +#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
> + arch_gettimeoffset = blackfin_gettimeoffset;
> +#endif
> +
> #ifdef CONFIG_RTC_DRV_BFIN
> /* [#2663] hack to filter junk RTC values that would cause
> * userspace to have to deal with time values greater than
> diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
> index 162892f..fce7c54 100644
> --- a/arch/cris/arch-v10/kernel/time.c
> +++ b/arch/cris/arch-v10/kernel/time.c
> @@ -55,9 +55,9 @@ unsigned long get_ns_in_jiffie(void)
> return ns;
> }
>
> -unsigned long do_slow_gettimeoffset(void)
> +static u32 cris_v10_gettimeoffset(void)
> {
> - unsigned long count;
> + u32 count;
>
> /* The timer interrupt comes from Etrax timer 0. In order to get
> * better precision, we check the current value. It might have
> @@ -191,6 +191,8 @@ static struct irqaction irq2 = {
> void __init
> time_init(void)
> {
> + arch_gettimeoffset = cris_v10_gettimeoffset;
> +
> /* probe for the RTC and read it if it exists
> * Before the RTC can be probed the loops_per_usec variable needs
> * to be initialized to make usleep work. A better value for
> diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
> index b063c92..fe6acda 100644
> --- a/arch/cris/kernel/time.c
> +++ b/arch/cris/kernel/time.c
> @@ -39,17 +39,6 @@
> extern unsigned long loops_per_jiffy; /* init/main.c */
> unsigned long loops_per_usec;
>
> -
> -#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
> -extern unsigned long do_slow_gettimeoffset(void);
> -static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
> -
> -u32 arch_gettimeoffset(void)
> -{
> - return do_gettimeoffset();
> -}
> -#endif
> -
> int set_rtc_mmss(unsigned long nowtime)
> {
> D(printk(KERN_DEBUG "set_rtc_mmss(%lu)\n", nowtime));
> diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
> index 84dd040..1a15f81 100644
> --- a/arch/m32r/kernel/time.c
> +++ b/arch/m32r/kernel/time.c
> @@ -57,7 +57,7 @@ extern void smp_local_timer_interrupt(void);
>
> static unsigned long latch;
>
> -u32 arch_gettimeoffset(void)
> +static u32 m32r_gettimeoffset(void)
> {
> unsigned long elapsed_time = 0; /* [us] */
>
> @@ -165,6 +165,8 @@ void read_persistent_clock(struct timespec *ts)
>
> void __init time_init(void)
> {
> + arch_gettimeoffset = m32r_gettimeoffset;
> +
> #if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \
> || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \
> || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
> diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
> index 5d0bcaa..c2994c8 100644
> --- a/arch/m68k/kernel/time.c
> +++ b/arch/m68k/kernel/time.c
> @@ -80,14 +80,9 @@ void read_persistent_clock(struct timespec *ts)
> }
> }
>
> -void __init time_init(void)
> -{
> - mach_sched_init(timer_interrupt);
> -}
> -
> #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
>
> -u32 arch_gettimeoffset(void)
> +static u32 m68k_gettimeoffset(void)
> {
> return mach_gettimeoffset() * 1000;
> }
> @@ -106,3 +101,12 @@ static int __init rtc_init(void)
> module_init(rtc_init);
>
> #endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */
> +
> +void __init time_init(void)
> +{
> +#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
> + arch_gettimeoffset = m68k_gettimeoffset;
> +#endif
> +
> + mach_sched_init(timer_interrupt);
> +}
> diff --git a/include/linux/time.h b/include/linux/time.h
> index 4d358e9..05e32a7 100644
> --- a/include/linux/time.h
> +++ b/include/linux/time.h
> @@ -142,9 +142,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta);
> * finer then tick granular time.
> */
> #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
> -extern u32 arch_gettimeoffset(void);
> -#else
> -static inline u32 arch_gettimeoffset(void) { return 0; }
> +extern u32 (*arch_gettimeoffset)(void);
> #endif
>
> extern void do_gettimeofday(struct timeval *tv);
> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> index e424970..9d00ace 100644
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -140,6 +140,20 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock)
> }
>
> /* Timekeeper helper functions. */
> +
> +#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
> +u32 (*arch_gettimeoffset)(void);
> +
> +u32 gettimeoffset(void)
> +{
> + if (likely(arch_gettimeoffset))
> + return arch_gettimeoffset();
> + return 0;
> +}
> +#else
> +static inline u32 gettimeoffset(void) { return 0; }
> +#endif
> +
> static inline s64 timekeeping_get_ns(struct timekeeper *tk)
> {
> cycle_t cycle_now, cycle_delta;
> @@ -157,7 +171,7 @@ static inline s64 timekeeping_get_ns(struct timekeeper *tk)
> nsec >>= tk->shift;
>
> /* If arch requires, add in gettimeoffset() */
> - return nsec + arch_gettimeoffset();
> + return nsec + gettimeoffset();
> }
>
> static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
> @@ -177,7 +191,7 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
> nsec = clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift);
>
> /* If arch requires, add in gettimeoffset() */
> - return nsec + arch_gettimeoffset();
> + return nsec + gettimeoffset();
> }
>
> /* must hold write on timekeeper.lock */
> @@ -211,7 +225,7 @@ static void timekeeping_forward_now(struct timekeeper *tk)
> tk->xtime_nsec += cycle_delta * tk->mult;
>
> /* If arch requires, add in gettimeoffset() */
> - tk->xtime_nsec += (u64)arch_gettimeoffset() << tk->shift;
> + tk->xtime_nsec += (u64)gettimeoffset() << tk->shift;
>
> tk_normalize_xtime(tk);
>
> --
> 1.7.0.4

/^JN - Jesper Nilsson
--
Jesper Nilsson -- [email protected]

2012-11-12 14:18:15

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [RFC PATCH 00/11] arch_gettimeoffset and ARM timer rework

On Thursday 08 November 2012, Stephen Warren wrote:
> It would probably be easiest to merge this whole series through the
> arm-soc tree. Anything else would require some co-ordination.

Fine with me. The patches all look good to me, so let's give people a
little more time to weigh in with Acks and possible objections.

In particular, I hope Russell can comment if he has an opionion on these.

Arnd

Subject: Re: [PATCH 05/11] ARM: at91: convert timer suspend/resume to clock_event_device

On 14:01 Thu 08 Nov , Stephen Warren wrote:
> From: Stephen Warren <[email protected]>
>
> Move at91's timer suspend/resume functions from struct sys_timer
> at91sam926x_timer into struct clock_event_device pit_clkevt. This
> will allow the sys_timer suspend/resume fields to be removed, and
> eventually lead to a complete removal of struct sys_timer.
>
> Cc: Andrew Victor <[email protected]>
> Cc: Nicolas Ferre <[email protected]>
> Cc: Jean-Christophe Plagniol-Villard <[email protected]>
> Signed-off-by: Stephen Warren <[email protected]>
> ---
look fine

Acked-by: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>

Best Regards,
J.