2012-11-19 18:31:21

by Stephen Warren

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

From: Stephen Warren <[email protected]>

Russell, I'm mainly reposting this to see if you have any comments or
opinion, in particular on the core ARM changes.

The aim of this series is to remove ARM's struct sys_timer. As a pre-
cursor, this requires a little re-arrangement of arch_gettimeoffset and
associated changes to other architectures.

The full series can be found in git at:
git://nv-tegra.nvidia.com/user/swarren/linux-2.6 arm_timer_rework

This is based on next-20121115. The plan is to rebase it onto 3.8-rc1
once it is released, and pull this series into arm-soc.git as a baseline
for any future SoC additions.

Cc: Mikael Starvik <[email protected]>
Cc: [email protected]
Cc: Russell King <[email protected]>
Cc: Mike Frysinger <[email protected]>
Cc: Mikael Starvik <[email protected]>
Cc: Hirokazu Takata <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Joshua Thompson <[email protected]>
Cc: Sam Creasey <[email protected]>
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]>
Cc: Andrew Victor <[email protected]>
Cc: Nicolas Ferre <[email protected]>
Cc: Russell King <[email protected]>
Cc: Haojian Zhuang <[email protected]>
Cc: Srinidhi Kasagar <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Ben Dooks <[email protected]>
Cc: Kukjin Kim <[email protected]>


2012-11-19 18:31:25

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V3 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: Hirokazu Takata <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
Acked-by: Jesper Nilsson <[email protected]>
Acked-by: John Stultz <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
---
v2:
* s/gettimeoffset/get_arch_timeoffset/ to make the name less generic
and more arch-specific.
---
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 | 26 ++++++++++++++++++++------
8 files changed, 48 insertions(+), 31 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..00b58c7 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 get_arch_timeoffset(void)
+{
+ if (likely(arch_gettimeoffset))
+ return arch_gettimeoffset();
+ return 0;
+}
+#else
+static inline u32 get_arch_timeoffset(void) { return 0; }
+#endif
+
static inline s64 timekeeping_get_ns(struct timekeeper *tk)
{
cycle_t cycle_now, cycle_delta;
@@ -156,8 +170,8 @@ static inline s64 timekeeping_get_ns(struct timekeeper *tk)
nsec = cycle_delta * tk->mult + tk->xtime_nsec;
nsec >>= tk->shift;

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

static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
@@ -176,8 +190,8 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
/* convert delta to nanoseconds. */
nsec = clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift);

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

/* must hold write on timekeeper.lock */
@@ -210,8 +224,8 @@ 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;
+ /* If arch requires, add in get_arch_timeoffset() */
+ tk->xtime_nsec += (u64)get_arch_timeoffset() << tk->shift;

tk_normalize_xtime(tk);

--
1.7.10.4

2012-11-19 18:31:33

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V3 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: Russell King <[email protected]>
Cc: Haojian Zhuang <[email protected]>
Acked-by: Eric Miao <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
---
arch/arm/mach-pxa/time.c | 76 +++++++++++++++++++++++-----------------------
1 file 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.10.4

2012-11-19 18:31:42

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V3 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, 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.10.4

2012-11-19 18:31:36

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V3 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 8914c3c..025afc6 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.10.4

2012-11-19 18:31:40

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V3 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 file changed, 6 insertions(+), 1 deletion(-)

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.10.4

2012-11-19 18:31:55

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V3 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]>
Tested-by: Robert Jarzmik <[email protected]>
---
v3: Minor merge conflicts due to rebasing onto next-20121115.
v2: Converted all platforms, not just Tegra.

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 single machine
example. The full series can be found at:

git://nv-tegra.nvidia.com/user/swarren/linux-2.6 arm_timer_rework
---
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 | 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 +-
492 files changed, 622 insertions(+), 1199 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-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index aaa443b..a83c5cf 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -215,8 +215,3 @@ void __init at91rm9200_timer_init(void)
/* register clocksource */
clocksource_register_hz(&clk32k, AT91_SLOW_CLOCK);
}
-
-struct sys_timer at91rm9200_timer = {
- .init = at91rm9200_timer_init,
-};
-
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c
index b99b575..35ab632 100644
--- a/arch/arm/mach-at91/board-1arm.c
+++ b/arch/arm/mach-at91/board-1arm.c
@@ -90,7 +90,7 @@ static void __init onearm_board_init(void)

MACHINE_START(ONEARM, "Ajeco 1ARM single board computer")
/* Maintainer: Lennert Buytenhek <[email protected]> */
- .timer = &at91rm9200_timer,
+ .init_time = at91rm9200_timer_init,
.map_io = at91_map_io,
.handle_irq = at91_aic_handle_irq,
.init_early = onearm_init_early,
diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c
index bc19f12c..7f796d8f 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.10.4

2012-11-19 18:32:56

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V3 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 file 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.10.4

2012-11-19 18:31:30

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V3 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]>
---
v2: Fix comment in ep93xx_gettimeoffset.
---
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 | 29 ++++++++++++++++++-----------
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, 42 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 0e57e44..fb3c701 100644
--- a/arch/arm/mach-at91/at91x40_time.c
+++ b/arch/arm/mach-at91/at91x40_time.c
@@ -42,9 +42,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)
@@ -64,6 +65,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;
@@ -82,6 +85,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..6f48b87 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -140,11 +140,29 @@ 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;
+
+ /*
+ * 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.
+ */
+ 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 +176,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.10.4

2012-11-19 18:34:14

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V3 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]>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
---
arch/arm/mach-at91/at91sam926x_time.c | 47 ++++++++++++++++++---------------
1 file changed, 26 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
index 358412f..f7191e1 100644
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ b/arch/arm/mach-at91/at91sam926x_time.c
@@ -104,12 +104,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,
};


@@ -150,19 +176,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" },
@@ -250,12 +263,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)
@@ -275,6 +282,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.10.4

2012-11-19 18:37:06

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V3 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: Joshua Thompson <[email protected]>
Cc: Sam Creasey <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
Acked-by: Phil Blundell <[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.10.4

2012-11-19 18:37:40

by Stephen Warren

[permalink] [raw]
Subject: [PATCH V3 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: [email protected]
Acked-by: Jesper Nilsson <[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.10.4

2012-11-21 04:43:07

by Haojian Zhuang

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

On Tue, Nov 20, 2012 at 2:31 AM, Stephen Warren <[email protected]> wrote:
> 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]>
> Tested-by: Robert Jarzmik <[email protected]>
> ---
> v3: Minor merge conflicts due to rebasing onto next-20121115.
> v2: Converted all platforms, not just Tegra.
>
> 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 single machine
> example. The full series can be found at:
>
> git://nv-tegra.nvidia.com/user/swarren/linux-2.6 arm_timer_rework
> ---
> 492 files changed, 622 insertions(+), 1199 deletions(-)

I checked the patch for mach-mmp.

@@ -69,7 +65,7 @@ static const char *mmp_dt_board_compat[] __initdata = {
DT_MACHINE_START(PXA168_DT, "Marvell PXA168 (Device Tree Support)")
.map_io = mmp_map_io,
.init_irq = mmp_dt_irq_init,
- .timer = &mmp_dt_timer,
+ .init_time = mmp_dt_init_timer,
.init_machine = pxa168_dt_init,
.dt_compat = mmp_dt_board_compat,
MACHINE_END
@@ -77,7 +73,7 @@ MACHINE_END
DT_MACHINE_START(PXA910_DT, "Marvell PXA910 (Device Tree Support)")
.map_io = mmp_map_io,
.init_irq = mmp_dt_irq_init,
- .timer = &mmp_dt_timer,
+ .init_time = mmp_dt_timer_init,
.init_machine = pxa910_dt_init,
.dt_compat = mmp_dt_board_compat,
MACHINE_END

This first init_time is assigned by mmp_dt_init_timer. But the second
init_time is
assigned by mmp_dt_timer_init. I think it's a typo error. Could you
help to fix this?

Regards
Haojian

2012-11-21 08:14:25

by Linus Walleij

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

On Mon, Nov 19, 2012 at 7:31 PM, Stephen Warren <[email protected]> wrote:

> 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]>

Acked-by: Linus Walleij <[email protected]>

We have a comment on the .resume member but I'll find
the right patch and comment there.

Yours,
Linus Walleij

2012-11-21 08:21:07

by Linus Walleij

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

On Mon, Nov 19, 2012 at 7:31 PM, Stephen Warren <[email protected]> wrote:

> 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]>

Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2012-11-21 08:28:17

by Linus Walleij

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

Oh and there was this comment/TODO:

On Mon, Nov 19, 2012 at 7:31 PM, Stephen Warren <[email protected]> wrote:

> @@ -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);
> };

So from the above it is quite clear that the sys_timer is breaking
the suspend_noirq/resume_noirq naming convention from
runtime PM as IRQs are disabled on these paths.

The same goes for struct clock_event_device ...

So while this looks just as bad after as before the patch,
we should take a mental notice to rename the .suspend
and .resume hooks in the clock_event_device to
.suspend_noirq and .resume_noirq at some point.

I was thinking that if your patch set is introducing a
plethora of new users of these hooks we should maybe
stick a patch at the beginning of the series renaming the
hooks to *_noirq, but if it's a major obstacle it can surely wait.

Yours,
Linus Walleij

2012-11-26 19:15:27

by Stephen Warren

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

On 11/20/2012 09:43 PM, Haojian Zhuang wrote:
> On Tue, Nov 20, 2012 at 2:31 AM, Stephen Warren <[email protected]> wrote:
>> 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
...
> I checked the patch for mach-mmp.
>
> @@ -69,7 +65,7 @@ static const char *mmp_dt_board_compat[] __initdata = {
> DT_MACHINE_START(PXA168_DT, "Marvell PXA168 (Device Tree Support)")
> .map_io = mmp_map_io,
> .init_irq = mmp_dt_irq_init,
> - .timer = &mmp_dt_timer,
> + .init_time = mmp_dt_init_timer,
> .init_machine = pxa168_dt_init,
> .dt_compat = mmp_dt_board_compat,
> MACHINE_END
> @@ -77,7 +73,7 @@ MACHINE_END
> DT_MACHINE_START(PXA910_DT, "Marvell PXA910 (Device Tree Support)")
> .map_io = mmp_map_io,
> .init_irq = mmp_dt_irq_init,
> - .timer = &mmp_dt_timer,
> + .init_time = mmp_dt_timer_init,
> .init_machine = pxa910_dt_init,
> .dt_compat = mmp_dt_board_compat,
> MACHINE_END
>
> This first init_time is assigned by mmp_dt_init_timer. But the second
> init_time is
> assigned by mmp_dt_timer_init. I think it's a typo error. Could you
> help to fix this?

Thanks, I've fixed that up locally.

2012-11-26 19:25:12

by Stephen Warren

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

On 11/21/2012 01:28 AM, Linus Walleij wrote:
> Oh and there was this comment/TODO:
>
> On Mon, Nov 19, 2012 at 7:31 PM, Stephen Warren <[email protected]> wrote:
>
>> @@ -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);
>> };
>
> So from the above it is quite clear that the sys_timer is breaking
> the suspend_noirq/resume_noirq naming convention from
> runtime PM as IRQs are disabled on these paths.
>
> The same goes for struct clock_event_device ...
>
> So while this looks just as bad after as before the patch,
> we should take a mental notice to rename the .suspend
> and .resume hooks in the clock_event_device to
> .suspend_noirq and .resume_noirq at some point.
>
> I was thinking that if your patch set is introducing a
> plethora of new users of these hooks we should maybe
> stick a patch at the beginning of the series renaming the
> hooks to *_noirq, but if it's a major obstacle it can surely wait.

I think I'd prefer to keep that rename separate and do it later; while
this series does introduce a few new users of the type, there are many
more pre-existing users. Renaming all the users would end up making this
series potentially conflict with addition of new users in tip.git or
elsewhere, whereas any possible current conflicts from this series
should be resolvable in arm-soc pretty easily I hope, so I'd rather
create a separate series that does the rename, and probably apply it to
tip.git, probably for 3.10?

2012-11-26 21:26:14

by Linus Walleij

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

On Mon, Nov 26, 2012 at 8:25 PM, Stephen Warren <[email protected]> wrote:
> On 11/21/2012 01:28 AM, Linus Walleij wrote:

>> Oh and there was this comment/TODO:
>> I was thinking that if your patch set is introducing a
>> plethora of new users of these hooks we should maybe
>> stick a patch at the beginning of the series renaming the
>> hooks to *_noirq, but if it's a major obstacle it can surely wait.
>
> I think I'd prefer to keep that rename separate and do it later; while
> this series does introduce a few new users of the type, there are many
> more pre-existing users. Renaming all the users would end up making this
> series potentially conflict with addition of new users in tip.git or
> elsewhere, whereas any possible current conflicts from this series
> should be resolvable in arm-soc pretty easily I hope, so I'd rather
> create a separate series that does the rename, and probably apply it to
> tip.git, probably for 3.10?

Sure no big deal.
Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij