All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/19] Consolidate simple ARM MMIO clock sources
@ 2011-05-16 17:23 ` Russell King - ARM Linux
  0 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:23 UTC (permalink / raw)
  To: linux-arm-kernel, John Stultz, Thomas Gleixner
  Cc: Sascha Hauer, Kukjin Kim, Eric Miao, Linus Walleij, Erik Gilling,
	Nicolas Pitre, Tony Lindgren, Catalin Marinas, Krzysztof Halasa,
	Scott Branden, linux-omap, Hans J. Koch, Jiandong Zheng,
	Colin Cross, Olof Johansson, Imre Kaloz, Wan ZongShun,
	Lennert Buytenhek, Alessandro Rubini

This is a re-posting of the clocksource patches, which includes some
other updates.  This includes bcmring in the update.

In a similar light to the i8253 series, this consolidates 17 ARM
MMIO counter clocksources into a single common implementation.  This
common implementation caters for 32-bit and 16-bit register access
sizes, up and down counters, and various bit sizes of those counters.

Patch 1 is already in John Stultz tree, but is included for
completeness and to get rid of a build warning.

 arch/arm/Kconfig                         |   15 ++
 arch/arm/common/timer-sp.c               |   80 +++++++----
 arch/arm/include/asm/hardware/timer-sp.h |    4 +-
 arch/arm/mach-bcmring/core.c             |  220 +++++++-----------------------
 arch/arm/mach-integrator/Kconfig         |    1 +
 arch/arm/mach-integrator/integrator_ap.c |   21 +---
 arch/arm/mach-integrator/integrator_cp.c |   11 ++-
 arch/arm/mach-ixp4xx/common.c            |   16 +--
 arch/arm/mach-lpc32xx/timer.c            |   17 +--
 arch/arm/mach-mxs/timer.c                |   20 +--
 arch/arm/mach-netx/time.c                |   16 +--
 arch/arm/mach-omap1/time.c               |   69 +++-------
 arch/arm/mach-pxa/time.c                 |   17 +--
 arch/arm/mach-realview/core.c            |   13 ++-
 arch/arm/mach-sa1100/time.c              |   24 +---
 arch/arm/mach-tcc8k/time.c               |   16 +--
 arch/arm/mach-tegra/timer.c              |   16 +--
 arch/arm/mach-u300/timer.c               |   18 +--
 arch/arm/mach-versatile/core.c           |   13 ++-
 arch/arm/mach-vexpress/ct-ca9x4.c        |   17 ++-
 arch/arm/mach-vexpress/v2m.c             |   17 ++-
 arch/arm/mach-w90x900/time.c             |   17 +--
 arch/arm/plat-mxc/epit.c                 |   18 +--
 arch/arm/plat-mxc/time.c                 |   38 +----
 arch/arm/plat-nomadik/Kconfig            |    1 +
 arch/arm/plat-nomadik/timer.c            |   31 +----
 arch/arm/plat-omap/Kconfig               |    1 +
 arch/arm/plat-orion/time.c               |   21 +---
 arch/arm/plat-s5p/s5p-time.c             |   58 +++------
 arch/arm/plat-spear/time.c               |   16 +--
 drivers/Kconfig                          |    3 +
 drivers/clocksource/Kconfig              |    2 +
 drivers/clocksource/Makefile             |    1 +
 drivers/clocksource/mmio.c               |   73 ++++++++++
 include/linux/clocksource.h              |   10 ++-
 35 files changed, 354 insertions(+), 577 deletions(-)

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH v2 00/19] Consolidate simple ARM MMIO clock sources
@ 2011-05-16 17:23 ` Russell King - ARM Linux
  0 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:23 UTC (permalink / raw)
  To: linux-arm-kernel

This is a re-posting of the clocksource patches, which includes some
other updates.  This includes bcmring in the update.

In a similar light to the i8253 series, this consolidates 17 ARM
MMIO counter clocksources into a single common implementation.  This
common implementation caters for 32-bit and 16-bit register access
sizes, up and down counters, and various bit sizes of those counters.

Patch 1 is already in John Stultz tree, but is included for
completeness and to get rid of a build warning.

 arch/arm/Kconfig                         |   15 ++
 arch/arm/common/timer-sp.c               |   80 +++++++----
 arch/arm/include/asm/hardware/timer-sp.h |    4 +-
 arch/arm/mach-bcmring/core.c             |  220 +++++++-----------------------
 arch/arm/mach-integrator/Kconfig         |    1 +
 arch/arm/mach-integrator/integrator_ap.c |   21 +---
 arch/arm/mach-integrator/integrator_cp.c |   11 ++-
 arch/arm/mach-ixp4xx/common.c            |   16 +--
 arch/arm/mach-lpc32xx/timer.c            |   17 +--
 arch/arm/mach-mxs/timer.c                |   20 +--
 arch/arm/mach-netx/time.c                |   16 +--
 arch/arm/mach-omap1/time.c               |   69 +++-------
 arch/arm/mach-pxa/time.c                 |   17 +--
 arch/arm/mach-realview/core.c            |   13 ++-
 arch/arm/mach-sa1100/time.c              |   24 +---
 arch/arm/mach-tcc8k/time.c               |   16 +--
 arch/arm/mach-tegra/timer.c              |   16 +--
 arch/arm/mach-u300/timer.c               |   18 +--
 arch/arm/mach-versatile/core.c           |   13 ++-
 arch/arm/mach-vexpress/ct-ca9x4.c        |   17 ++-
 arch/arm/mach-vexpress/v2m.c             |   17 ++-
 arch/arm/mach-w90x900/time.c             |   17 +--
 arch/arm/plat-mxc/epit.c                 |   18 +--
 arch/arm/plat-mxc/time.c                 |   38 +----
 arch/arm/plat-nomadik/Kconfig            |    1 +
 arch/arm/plat-nomadik/timer.c            |   31 +----
 arch/arm/plat-omap/Kconfig               |    1 +
 arch/arm/plat-orion/time.c               |   21 +---
 arch/arm/plat-s5p/s5p-time.c             |   58 +++------
 arch/arm/plat-spear/time.c               |   16 +--
 drivers/Kconfig                          |    3 +
 drivers/clocksource/Kconfig              |    2 +
 drivers/clocksource/Makefile             |    1 +
 drivers/clocksource/mmio.c               |   73 ++++++++++
 include/linux/clocksource.h              |   10 ++-
 35 files changed, 354 insertions(+), 577 deletions(-)

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 01/19] Make clocksource name const
  2011-05-16 17:23 ` Russell King - ARM Linux
@ 2011-05-16 17:25   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:25 UTC (permalink / raw)
  To: linux-arm-kernel, John Stultz, Thomas Gleixner
  Cc: Kukjin Kim, Eric Miao, Linus Walleij, Erik Gilling,
	Nicolas Pitre, Tony Lindgren, Krzysztof Halasa, linux-omap,
	Hans J. Koch, Sascha Hauer, Colin Cross, Olof Johansson,
	Imre Kaloz, Wan ZongShun, Lennert Buytenhek, Alessandro Rubini

As nothing should be writing to the clocksource name string, make the
clocksource name pointer const.  Build-tested on ARM Versatile Express.

Cc: Alessandro Rubini <rubini@unipv.it>
Cc: Colin Cross <ccross@android.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Erik Gilling <konkers@android.com>
Cc: "Hans J. Koch" <hjk@hansjkoch.de>
Cc: Imre Kaloz <kaloz@openwrt.org>
Cc: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Cc: Linus Walleij <linus.walleij@stericsson.com>
Cc: linux-omap@vger.kernel.org
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Olof Johansson <olof@lixom.net>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Viresh Kumar <viresh.kumar@st.com>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 include/linux/clocksource.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index c37b21a..94c1f38 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -161,7 +161,7 @@ struct clocksource {
 	/*
 	 * First part of structure is read mostly
 	 */
-	char *name;
+	const char *name;
 	struct list_head list;
 	int rating;
 	cycle_t (*read)(struct clocksource *cs);
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 01/19] Make clocksource name const
@ 2011-05-16 17:25   ` Russell King - ARM Linux
  0 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:25 UTC (permalink / raw)
  To: linux-arm-kernel

As nothing should be writing to the clocksource name string, make the
clocksource name pointer const.  Build-tested on ARM Versatile Express.

Cc: Alessandro Rubini <rubini@unipv.it>
Cc: Colin Cross <ccross@android.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Erik Gilling <konkers@android.com>
Cc: "Hans J. Koch" <hjk@hansjkoch.de>
Cc: Imre Kaloz <kaloz@openwrt.org>
Cc: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Cc: Linus Walleij <linus.walleij@stericsson.com>
Cc: linux-omap at vger.kernel.org
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Olof Johansson <olof@lixom.net>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Viresh Kumar <viresh.kumar@st.com>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 include/linux/clocksource.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index c37b21a..94c1f38 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -161,7 +161,7 @@ struct clocksource {
 	/*
 	 * First part of structure is read mostly
 	 */
-	char *name;
+	const char *name;
 	struct list_head list;
 	int rating;
 	cycle_t (*read)(struct clocksource *cs);
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 02/19] ARM: s5p: consolidate selection of timer register
  2011-05-16 17:23 ` Russell King - ARM Linux
  (?)
  (?)
@ 2011-05-16 17:26 ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

s5p duplicates the runtime selection of the timer register three times.
Move this out into a separate function.

FIXME: It is unclear whether this code needs to support true runtime
selection of the timer register, or whether it can be selected once at
init time.

Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/plat-s5p/s5p-time.c |   58 ++++++++++++-----------------------------
 1 files changed, 17 insertions(+), 41 deletions(-)

diff --git a/arch/arm/plat-s5p/s5p-time.c b/arch/arm/plat-s5p/s5p-time.c
index 8090403..899a8cc 100644
--- a/arch/arm/plat-s5p/s5p-time.c
+++ b/arch/arm/plat-s5p/s5p-time.c
@@ -290,7 +290,7 @@ static void __init s5p_clockevent_init(void)
 	setup_irq(irq_number, &s5p_clock_event_irq);
 }
 
-static cycle_t s5p_timer_read(struct clocksource *cs)
+static void __iomem *s5p_timer_reg(void)
 {
 	unsigned long offset = 0;
 
@@ -308,10 +308,17 @@ static cycle_t s5p_timer_read(struct clocksource *cs)
 
 	default:
 		printk(KERN_ERR "Invalid Timer %d\n", timer_source.source_id);
-		return 0;
+		return NULL;
 	}
 
-	return (cycle_t) ~__raw_readl(S3C_TIMERREG(offset));
+	return S3C_TIMERREG(offset);
+}
+
+static cycle_t s5p_timer_read(struct clocksource *cs)
+{
+	void __iomem *reg = s5p_timer_reg();
+
+	return (cycle_t) (reg ? ~__raw_readl(reg) : 0);
 }
 
 /*
@@ -325,53 +332,22 @@ static DEFINE_CLOCK_DATA(cd);
 
 unsigned long long notrace sched_clock(void)
 {
-	u32 cyc;
-	unsigned long offset = 0;
-
-	switch (timer_source.source_id) {
-	case S5P_PWM0:
-	case S5P_PWM1:
-	case S5P_PWM2:
-	case S5P_PWM3:
-		offset = (timer_source.source_id * 0x0c) + 0x14;
-		break;
-
-	case S5P_PWM4:
-		offset = 0x40;
-		break;
+	void __iomem *reg = s5p_timer_reg();
 
-	default:
-		printk(KERN_ERR "Invalid Timer %d\n", timer_source.source_id);
+	if (!reg)
 		return 0;
-	}
 
-	cyc = ~__raw_readl(S3C_TIMERREG(offset));
-	return cyc_to_sched_clock(&cd, cyc, (u32)~0);
+	return cyc_to_sched_clock(&cd, ~__raw_readl(reg), (u32)~0);
 }
 
 static void notrace s5p_update_sched_clock(void)
 {
-	u32 cyc;
-	unsigned long offset = 0;
+	void __iomem *reg = s5p_timer_reg();
 
-	switch (timer_source.source_id) {
-	case S5P_PWM0:
-	case S5P_PWM1:
-	case S5P_PWM2:
-	case S5P_PWM3:
-		offset = (timer_source.source_id * 0x0c) + 0x14;
-		break;
-
-	case S5P_PWM4:
-		offset = 0x40;
-		break;
-
-	default:
-		printk(KERN_ERR "Invalid Timer %d\n", timer_source.source_id);
-	}
+	if (!reg)
+		return;
 
-	cyc = ~__raw_readl(S3C_TIMERREG(offset));
-	update_sched_clock(&cd, cyc, (u32)~0);
+	update_sched_clock(&cd, ~__raw_readl(reg), (u32)~0);
 }
 
 struct clocksource time_clocksource = {
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 03/19] ARM: omap1: delete useless interrupt handler
  2011-05-16 17:23 ` Russell King - ARM Linux
@ 2011-05-16 17:26   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:26 UTC (permalink / raw)
  To: linux-arm-kernel, John Stultz, Thomas Gleixner; +Cc: linux-omap

The OMAP1 clocksource interrupt handler just increments a variable
which otherwise isn't used, so this seems to be unnecessary.  Tony
Lindgren confirms, so lets remove it.

Acked-by: Kevin Hilman <khilman@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Cc: linux-omap@vger.kernel.org
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-omap1/time.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 6885d2f..e2c29b4 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -189,20 +189,6 @@ static __init void omap_init_mpu_timer(unsigned long rate)
  * ---------------------------------------------------------------------------
  */
 
-static unsigned long omap_mpu_timer2_overflows;
-
-static irqreturn_t omap_mpu_timer2_interrupt(int irq, void *dev_id)
-{
-	omap_mpu_timer2_overflows++;
-	return IRQ_HANDLED;
-}
-
-static struct irqaction omap_mpu_timer2_irq = {
-	.name		= "mpu_timer2",
-	.flags		= IRQF_DISABLED,
-	.handler	= omap_mpu_timer2_interrupt,
-};
-
 static cycle_t mpu_read(struct clocksource *cs)
 {
 	return ~omap_mpu_timer_read(1);
@@ -247,7 +233,6 @@ static void __init omap_init_clocksource(unsigned long rate)
 	static char err[] __initdata = KERN_ERR
 			"%s: can't register clocksource!\n";
 
-	setup_irq(INT_TIMER2, &omap_mpu_timer2_irq);
 	omap_mpu_timer_start(1, ~0, 1);
 	init_sched_clock(&cd, mpu_update_sched_clock, 32, rate);
 
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 03/19] ARM: omap1: delete useless interrupt handler
@ 2011-05-16 17:26   ` Russell King - ARM Linux
  0 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

The OMAP1 clocksource interrupt handler just increments a variable
which otherwise isn't used, so this seems to be unnecessary.  Tony
Lindgren confirms, so lets remove it.

Acked-by: Kevin Hilman <khilman@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Cc: linux-omap at vger.kernel.org
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-omap1/time.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 6885d2f..e2c29b4 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -189,20 +189,6 @@ static __init void omap_init_mpu_timer(unsigned long rate)
  * ---------------------------------------------------------------------------
  */
 
-static unsigned long omap_mpu_timer2_overflows;
-
-static irqreturn_t omap_mpu_timer2_interrupt(int irq, void *dev_id)
-{
-	omap_mpu_timer2_overflows++;
-	return IRQ_HANDLED;
-}
-
-static struct irqaction omap_mpu_timer2_irq = {
-	.name		= "mpu_timer2",
-	.flags		= IRQF_DISABLED,
-	.handler	= omap_mpu_timer2_interrupt,
-};
-
 static cycle_t mpu_read(struct clocksource *cs)
 {
 	return ~omap_mpu_timer_read(1);
@@ -247,7 +233,6 @@ static void __init omap_init_clocksource(unsigned long rate)
 	static char err[] __initdata = KERN_ERR
 			"%s: can't register clocksource!\n";
 
-	setup_irq(INT_TIMER2, &omap_mpu_timer2_irq);
 	omap_mpu_timer_start(1, ~0, 1);
 	init_sched_clock(&cd, mpu_update_sched_clock, 32, rate);
 
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 04/19] ARM: omap1: convert to using readl/writel instead of volatile struct
  2011-05-16 17:23 ` Russell King - ARM Linux
@ 2011-05-16 17:26   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:26 UTC (permalink / raw)
  To: linux-arm-kernel, John Stultz, Thomas Gleixner; +Cc: linux-omap

Tested-by: Tony Lindgren <tony@atomide.com>
Cc: linux-omap@vger.kernel.org
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-omap1/time.c |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index e2c29b4..e7ab616 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -68,49 +68,50 @@ typedef struct {
 } omap_mpu_timer_regs_t;
 
 #define omap_mpu_timer_base(n)							\
-((volatile omap_mpu_timer_regs_t*)OMAP1_IO_ADDRESS(OMAP_MPU_TIMER_BASE +	\
+((omap_mpu_timer_regs_t __iomem *)OMAP1_IO_ADDRESS(OMAP_MPU_TIMER_BASE +	\
 				 (n)*OMAP_MPU_TIMER_OFFSET))
 
 static inline unsigned long notrace omap_mpu_timer_read(int nr)
 {
-	volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
-	return timer->read_tim;
+	omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
+	return readl(&timer->read_tim);
 }
 
 static inline void omap_mpu_set_autoreset(int nr)
 {
-	volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
+	omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
 
-	timer->cntl = timer->cntl | MPU_TIMER_AR;
+	writel(readl(&timer->cntl) | MPU_TIMER_AR, &timer->cntl);
 }
 
 static inline void omap_mpu_remove_autoreset(int nr)
 {
-	volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
+	omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
 
-	timer->cntl = timer->cntl & ~MPU_TIMER_AR;
+	writel(readl(&timer->cntl) & ~MPU_TIMER_AR, &timer->cntl);
 }
 
 static inline void omap_mpu_timer_start(int nr, unsigned long load_val,
 					int autoreset)
 {
-	volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
-	unsigned int timerflags = (MPU_TIMER_CLOCK_ENABLE | MPU_TIMER_ST);
+	omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
+	unsigned int timerflags = MPU_TIMER_CLOCK_ENABLE | MPU_TIMER_ST;
 
-	if (autoreset) timerflags |= MPU_TIMER_AR;
+	if (autoreset)
+		timerflags |= MPU_TIMER_AR;
 
-	timer->cntl = MPU_TIMER_CLOCK_ENABLE;
+	writel(MPU_TIMER_CLOCK_ENABLE, &timer->cntl);
 	udelay(1);
-	timer->load_tim = load_val;
+	writel(load_val, &timer->load_tim);
         udelay(1);
-	timer->cntl = timerflags;
+	writel(timerflags, &timer->cntl);
 }
 
 static inline void omap_mpu_timer_stop(int nr)
 {
-	volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
+	omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
 
-	timer->cntl &= ~MPU_TIMER_ST;
+	writel(readl(&timer->cntl) & ~MPU_TIMER_ST, &timer->cntl);
 }
 
 /*
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 04/19] ARM: omap1: convert to using readl/writel instead of volatile struct
@ 2011-05-16 17:26   ` Russell King - ARM Linux
  0 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

Tested-by: Tony Lindgren <tony@atomide.com>
Cc: linux-omap at vger.kernel.org
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-omap1/time.c |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index e2c29b4..e7ab616 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -68,49 +68,50 @@ typedef struct {
 } omap_mpu_timer_regs_t;
 
 #define omap_mpu_timer_base(n)							\
-((volatile omap_mpu_timer_regs_t*)OMAP1_IO_ADDRESS(OMAP_MPU_TIMER_BASE +	\
+((omap_mpu_timer_regs_t __iomem *)OMAP1_IO_ADDRESS(OMAP_MPU_TIMER_BASE +	\
 				 (n)*OMAP_MPU_TIMER_OFFSET))
 
 static inline unsigned long notrace omap_mpu_timer_read(int nr)
 {
-	volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
-	return timer->read_tim;
+	omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
+	return readl(&timer->read_tim);
 }
 
 static inline void omap_mpu_set_autoreset(int nr)
 {
-	volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
+	omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
 
-	timer->cntl = timer->cntl | MPU_TIMER_AR;
+	writel(readl(&timer->cntl) | MPU_TIMER_AR, &timer->cntl);
 }
 
 static inline void omap_mpu_remove_autoreset(int nr)
 {
-	volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
+	omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
 
-	timer->cntl = timer->cntl & ~MPU_TIMER_AR;
+	writel(readl(&timer->cntl) & ~MPU_TIMER_AR, &timer->cntl);
 }
 
 static inline void omap_mpu_timer_start(int nr, unsigned long load_val,
 					int autoreset)
 {
-	volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
-	unsigned int timerflags = (MPU_TIMER_CLOCK_ENABLE | MPU_TIMER_ST);
+	omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
+	unsigned int timerflags = MPU_TIMER_CLOCK_ENABLE | MPU_TIMER_ST;
 
-	if (autoreset) timerflags |= MPU_TIMER_AR;
+	if (autoreset)
+		timerflags |= MPU_TIMER_AR;
 
-	timer->cntl = MPU_TIMER_CLOCK_ENABLE;
+	writel(MPU_TIMER_CLOCK_ENABLE, &timer->cntl);
 	udelay(1);
-	timer->load_tim = load_val;
+	writel(load_val, &timer->load_tim);
         udelay(1);
-	timer->cntl = timerflags;
+	writel(timerflags, &timer->cntl);
 }
 
 static inline void omap_mpu_timer_stop(int nr)
 {
-	volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
+	omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
 
-	timer->cntl &= ~MPU_TIMER_ST;
+	writel(readl(&timer->cntl) & ~MPU_TIMER_ST, &timer->cntl);
 }
 
 /*
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 05/19] ARM: update sa1100 to reflect PXA updates
  2011-05-16 17:23 ` Russell King - ARM Linux
                   ` (4 preceding siblings ...)
  (?)
@ 2011-05-16 17:27 ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:27 UTC (permalink / raw)
  To: linux-arm-kernel

Update sa1100 clockevents code to reflect what its later derivative
does with clockevents_calc_mult_shift().  Use OSSR_M* constants too.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-sa1100/time.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index ae4f3d8..51c0529 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -92,7 +92,6 @@ sa1100_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *c)
 static struct clock_event_device ckevt_sa1100_osmr0 = {
 	.name		= "osmr0",
 	.features	= CLOCK_EVT_FEAT_ONESHOT,
-	.shift		= 32,
 	.rating		= 200,
 	.set_next_event	= sa1100_osmr0_set_next_event,
 	.set_mode	= sa1100_osmr0_set_mode,
@@ -120,14 +119,13 @@ static struct irqaction sa1100_timer_irq = {
 
 static void __init sa1100_timer_init(void)
 {
-	OIER = 0;		/* disable any timer interrupts */
-	OSSR = 0xf;		/* clear status on all timers */
+	OIER = 0;
+	OSSR = OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3;
 
 	init_fixed_sched_clock(&cd, sa1100_update_sched_clock, 32,
 			       3686400, SC_MULT, SC_SHIFT);
 
-	ckevt_sa1100_osmr0.mult =
-		div_sc(3686400, NSEC_PER_SEC, ckevt_sa1100_osmr0.shift);
+	clockevents_calc_mult_shift(&ckevt_sa1100_osmr0, 3686400, 4);
 	ckevt_sa1100_osmr0.max_delta_ns =
 		clockevent_delta2ns(0x7fffffff, &ckevt_sa1100_osmr0);
 	ckevt_sa1100_osmr0.min_delta_ns =
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 06/19] clocksource: add common mmio clocksource
  2011-05-16 17:23 ` Russell King - ARM Linux
@ 2011-05-16 17:27   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:27 UTC (permalink / raw)
  To: linux-arm-kernel, John Stultz, Thomas Gleixner
  Cc: Alessandro Rubini, Kukjin Kim, Eric Miao, Linus Walleij,
	Erik Gilling, linux-omap, Colin Cross, Olof Johansson,
	Imre Kaloz, Wan ZongShun, Lennert Buytenhek, Krzysztof Halasa

Add a generic mmio clocksource, covering both 32-bit and 16-bit register
access sizes, for up or down counters.  This can be used to easily
create clocksources for simple counter-based implementations.

Cc: Alessandro Rubini <rubini@unipv.it>
Cc: Colin Cross <ccross@android.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Erik Gilling <konkers@android.com>
Acked-by: "Hans J. Koch" <hjk@hansjkoch.de>
Cc: Imre Kaloz <kaloz@openwrt.org>
Cc: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Cc: Linus Walleij <linus.walleij@stericsson.com>
Cc: linux-omap@vger.kernel.org
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Cc: Olof Johansson <olof@lixom.net>
Tested-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 drivers/Kconfig              |    3 ++
 drivers/clocksource/Kconfig  |    2 +
 drivers/clocksource/Makefile |    1 +
 drivers/clocksource/mmio.c   |   73 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/clocksource.h  |    8 ++++
 5 files changed, 87 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clocksource/Kconfig
 create mode 100644 drivers/clocksource/mmio.c

diff --git a/drivers/Kconfig b/drivers/Kconfig
index 177c7d1..557a469 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -119,4 +119,7 @@ source "drivers/platform/Kconfig"
 source "drivers/clk/Kconfig"
 
 source "drivers/hwspinlock/Kconfig"
+
+source "drivers/clocksource/Kconfig"
+
 endmenu
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
new file mode 100644
index 0000000..47f37b1
--- /dev/null
+++ b/drivers/clocksource/Kconfig
@@ -0,0 +1,2 @@
+config CLKSRC_MMIO
+	bool
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index be61ece..9b2ba29 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_CS5535_CLOCK_EVENT_SRC)	+= cs5535-clockevt.o
 obj-$(CONFIG_SH_TIMER_CMT)	+= sh_cmt.o
 obj-$(CONFIG_SH_TIMER_MTU2)	+= sh_mtu2.o
 obj-$(CONFIG_SH_TIMER_TMU)	+= sh_tmu.o
+obj-$(CONFIG_CLKSRC_MMIO)	+= mmio.o
diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c
new file mode 100644
index 0000000..c0e2512
--- /dev/null
+++ b/drivers/clocksource/mmio.c
@@ -0,0 +1,73 @@
+/*
+ * Generic MMIO clocksource support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/clocksource.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+
+struct clocksource_mmio {
+	void __iomem *reg;
+	struct clocksource clksrc;
+};
+
+static inline struct clocksource_mmio *to_mmio_clksrc(struct clocksource *c)
+{
+	return container_of(c, struct clocksource_mmio, clksrc);
+}
+
+cycle_t clocksource_mmio_readl_up(struct clocksource *c)
+{
+	return readl_relaxed(to_mmio_clksrc(c)->reg);
+}
+
+cycle_t clocksource_mmio_readl_down(struct clocksource *c)
+{
+	return ~readl_relaxed(to_mmio_clksrc(c)->reg);
+}
+
+cycle_t clocksource_mmio_readw_up(struct clocksource *c)
+{
+	return readw_relaxed(to_mmio_clksrc(c)->reg);
+}
+
+cycle_t clocksource_mmio_readw_down(struct clocksource *c)
+{
+	return ~(unsigned)readw_relaxed(to_mmio_clksrc(c)->reg);
+}
+
+/**
+ * clocksource_mmio_init - Initialize a simple mmio based clocksource
+ * @base:	Virtual address of the clock readout register
+ * @name:	Name of the clocksource
+ * @hz:		Frequency of the clocksource in Hz
+ * @rating:	Rating of the clocksource
+ * @bits:	Number of valid bits
+ * @read:	One of clocksource_mmio_read*() above
+ */
+int __init clocksource_mmio_init(void __iomem *base, const char *name,
+	unsigned long hz, int rating, unsigned bits,
+	cycle_t (*read)(struct clocksource *))
+{
+	struct clocksource_mmio *cs;
+
+	if (bits > 32 || bits < 16)
+		return -EINVAL;
+
+	cs = kzalloc(sizeof(struct clocksource_mmio), GFP_KERNEL);
+	if (!cs)
+		return -ENOMEM;
+
+	cs->reg = base;
+	cs->clksrc.name = name;
+	cs->clksrc.rating = rating;
+	cs->clksrc.read = read;
+	cs->clksrc.mask = CLOCKSOURCE_MASK(bits);
+	cs->clksrc.flags = CLOCK_SOURCE_IS_CONTINUOUS;
+
+	return clocksource_register_hz(&cs->clksrc, hz);
+}
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 94c1f38..a3558fd 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -341,4 +341,12 @@ static inline void update_vsyscall_tz(void)
 
 extern void timekeeping_notify(struct clocksource *clock);
 
+extern cycle_t clocksource_mmio_readl_up(struct clocksource *);
+extern cycle_t clocksource_mmio_readl_down(struct clocksource *);
+extern cycle_t clocksource_mmio_readw_up(struct clocksource *);
+extern cycle_t clocksource_mmio_readw_down(struct clocksource *);
+
+extern int clocksource_mmio_init(void __iomem *, const char *,
+	unsigned long, int, unsigned, cycle_t (*)(struct clocksource *));
+
 #endif /* _LINUX_CLOCKSOURCE_H */
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 06/19] clocksource: add common mmio clocksource
@ 2011-05-16 17:27   ` Russell King - ARM Linux
  0 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:27 UTC (permalink / raw)
  To: linux-arm-kernel

Add a generic mmio clocksource, covering both 32-bit and 16-bit register
access sizes, for up or down counters.  This can be used to easily
create clocksources for simple counter-based implementations.

Cc: Alessandro Rubini <rubini@unipv.it>
Cc: Colin Cross <ccross@android.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Erik Gilling <konkers@android.com>
Acked-by: "Hans J. Koch" <hjk@hansjkoch.de>
Cc: Imre Kaloz <kaloz@openwrt.org>
Cc: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Cc: Linus Walleij <linus.walleij@stericsson.com>
Cc: linux-omap at vger.kernel.org
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Cc: Olof Johansson <olof@lixom.net>
Tested-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 drivers/Kconfig              |    3 ++
 drivers/clocksource/Kconfig  |    2 +
 drivers/clocksource/Makefile |    1 +
 drivers/clocksource/mmio.c   |   73 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/clocksource.h  |    8 ++++
 5 files changed, 87 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clocksource/Kconfig
 create mode 100644 drivers/clocksource/mmio.c

diff --git a/drivers/Kconfig b/drivers/Kconfig
index 177c7d1..557a469 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -119,4 +119,7 @@ source "drivers/platform/Kconfig"
 source "drivers/clk/Kconfig"
 
 source "drivers/hwspinlock/Kconfig"
+
+source "drivers/clocksource/Kconfig"
+
 endmenu
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
new file mode 100644
index 0000000..47f37b1
--- /dev/null
+++ b/drivers/clocksource/Kconfig
@@ -0,0 +1,2 @@
+config CLKSRC_MMIO
+	bool
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index be61ece..9b2ba29 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_CS5535_CLOCK_EVENT_SRC)	+= cs5535-clockevt.o
 obj-$(CONFIG_SH_TIMER_CMT)	+= sh_cmt.o
 obj-$(CONFIG_SH_TIMER_MTU2)	+= sh_mtu2.o
 obj-$(CONFIG_SH_TIMER_TMU)	+= sh_tmu.o
+obj-$(CONFIG_CLKSRC_MMIO)	+= mmio.o
diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c
new file mode 100644
index 0000000..c0e2512
--- /dev/null
+++ b/drivers/clocksource/mmio.c
@@ -0,0 +1,73 @@
+/*
+ * Generic MMIO clocksource support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/clocksource.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+
+struct clocksource_mmio {
+	void __iomem *reg;
+	struct clocksource clksrc;
+};
+
+static inline struct clocksource_mmio *to_mmio_clksrc(struct clocksource *c)
+{
+	return container_of(c, struct clocksource_mmio, clksrc);
+}
+
+cycle_t clocksource_mmio_readl_up(struct clocksource *c)
+{
+	return readl_relaxed(to_mmio_clksrc(c)->reg);
+}
+
+cycle_t clocksource_mmio_readl_down(struct clocksource *c)
+{
+	return ~readl_relaxed(to_mmio_clksrc(c)->reg);
+}
+
+cycle_t clocksource_mmio_readw_up(struct clocksource *c)
+{
+	return readw_relaxed(to_mmio_clksrc(c)->reg);
+}
+
+cycle_t clocksource_mmio_readw_down(struct clocksource *c)
+{
+	return ~(unsigned)readw_relaxed(to_mmio_clksrc(c)->reg);
+}
+
+/**
+ * clocksource_mmio_init - Initialize a simple mmio based clocksource
+ * @base:	Virtual address of the clock readout register
+ * @name:	Name of the clocksource
+ * @hz:		Frequency of the clocksource in Hz
+ * @rating:	Rating of the clocksource
+ * @bits:	Number of valid bits
+ * @read:	One of clocksource_mmio_read*() above
+ */
+int __init clocksource_mmio_init(void __iomem *base, const char *name,
+	unsigned long hz, int rating, unsigned bits,
+	cycle_t (*read)(struct clocksource *))
+{
+	struct clocksource_mmio *cs;
+
+	if (bits > 32 || bits < 16)
+		return -EINVAL;
+
+	cs = kzalloc(sizeof(struct clocksource_mmio), GFP_KERNEL);
+	if (!cs)
+		return -ENOMEM;
+
+	cs->reg = base;
+	cs->clksrc.name = name;
+	cs->clksrc.rating = rating;
+	cs->clksrc.read = read;
+	cs->clksrc.mask = CLOCKSOURCE_MASK(bits);
+	cs->clksrc.flags = CLOCK_SOURCE_IS_CONTINUOUS;
+
+	return clocksource_register_hz(&cs->clksrc, hz);
+}
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 94c1f38..a3558fd 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -341,4 +341,12 @@ static inline void update_vsyscall_tz(void)
 
 extern void timekeeping_notify(struct clocksource *clock);
 
+extern cycle_t clocksource_mmio_readl_up(struct clocksource *);
+extern cycle_t clocksource_mmio_readl_down(struct clocksource *);
+extern cycle_t clocksource_mmio_readw_up(struct clocksource *);
+extern cycle_t clocksource_mmio_readw_down(struct clocksource *);
+
+extern int clocksource_mmio_init(void __iomem *, const char *,
+	unsigned long, int, unsigned, cycle_t (*)(struct clocksource *));
+
 #endif /* _LINUX_CLOCKSOURCE_H */
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 07/19] clocksource: convert ARM 32-bit up counting clocksources
  2011-05-16 17:23 ` Russell King - ARM Linux
                   ` (6 preceding siblings ...)
  (?)
@ 2011-05-16 17:27 ` Russell King - ARM Linux
  2011-05-16 18:30   ` Eric Miao
  2011-05-17  6:38   ` Sascha Hauer
  -1 siblings, 2 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:27 UTC (permalink / raw)
  To: linux-arm-kernel

Convert ixp4xx, lpc32xx, mxc, netx, pxa, sa1100, tcc8k, tegra and u300
to use the generic mmio clocksource recently introduced.

Cc: Imre Kaloz <kaloz@openwrt.org>
Cc: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Eric Miao <eric.y.miao@gmail.com>
Acked-by: "Hans J. Koch" <hjk@hansjkoch.de>
Acked-by: Colin Cross <ccross@android.com>
Cc: Erik Gilling <konkers@android.com>
Cc: Olof Johansson <olof@lixom.net>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/Kconfig              |    9 +++++++++
 arch/arm/mach-ixp4xx/common.c |   16 ++--------------
 arch/arm/mach-lpc32xx/timer.c |   17 +++--------------
 arch/arm/mach-netx/time.c     |   16 ++--------------
 arch/arm/mach-pxa/time.c      |   17 ++---------------
 arch/arm/mach-sa1100/time.c   |   16 ++--------------
 arch/arm/mach-tcc8k/time.c    |   16 ++--------------
 arch/arm/mach-tegra/timer.c   |   16 ++--------------
 arch/arm/mach-u300/timer.c    |   18 +++---------------
 arch/arm/plat-mxc/time.c      |   38 +++++++-------------------------------
 10 files changed, 34 insertions(+), 145 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 377a7a5..9aa5514 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -366,6 +366,7 @@ config ARCH_MXC
 	select GENERIC_CLOCKEVENTS
 	select ARCH_REQUIRE_GPIOLIB
 	select CLKDEV_LOOKUP
+	select CLKSRC_MMIO
 	select HAVE_SCHED_CLOCK
 	help
 	  Support for Freescale MXC/iMX-based family of processors
@@ -390,6 +391,7 @@ config ARCH_STMP3XXX
 
 config ARCH_NETX
 	bool "Hilscher NetX based"
+	select CLKSRC_MMIO
 	select CPU_ARM926T
 	select ARM_VIC
 	select GENERIC_CLOCKEVENTS
@@ -457,6 +459,7 @@ config ARCH_IXP2000
 config ARCH_IXP4XX
 	bool "IXP4xx-based"
 	depends on MMU
+	select CLKSRC_MMIO
 	select CPU_XSCALE
 	select GENERIC_GPIO
 	select GENERIC_CLOCKEVENTS
@@ -497,6 +500,7 @@ config ARCH_LOKI
 
 config ARCH_LPC32XX
 	bool "NXP LPC32XX"
+	select CLKSRC_MMIO
 	select CPU_ARM926T
 	select ARCH_REQUIRE_GPIOLIB
 	select HAVE_IDE
@@ -592,6 +596,7 @@ config ARCH_NUC93X
 config ARCH_TEGRA
 	bool "NVIDIA Tegra"
 	select CLKDEV_LOOKUP
+	select CLKSRC_MMIO
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_GPIO
@@ -617,6 +622,7 @@ config ARCH_PXA
 	select ARCH_MTD_XIP
 	select ARCH_HAS_CPUFREQ
 	select CLKDEV_LOOKUP
+	select CLKSRC_MMIO
 	select ARCH_REQUIRE_GPIOLIB
 	select GENERIC_CLOCKEVENTS
 	select HAVE_SCHED_CLOCK
@@ -667,6 +673,7 @@ config ARCH_RPC
 
 config ARCH_SA1100
 	bool "SA1100-based"
+	select CLKSRC_MMIO
 	select CPU_SA1100
 	select ISA
 	select ARCH_SPARSEMEM_ENABLE
@@ -803,6 +810,7 @@ config ARCH_SHARK
 
 config ARCH_TCC_926
 	bool "Telechips TCC ARM926-based systems"
+	select CLKSRC_MMIO
 	select CPU_ARM926T
 	select HAVE_CLK
 	select CLKDEV_LOOKUP
@@ -813,6 +821,7 @@ config ARCH_TCC_926
 config ARCH_U300
 	bool "ST-Ericsson U300 Series"
 	depends on MMU
+	select CLKSRC_MMIO
 	select CPU_ARM926T
 	select HAVE_SCHED_CLOCK
 	select HAVE_TCM
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index ed19bc3..74ed81a 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -419,26 +419,14 @@ static void notrace ixp4xx_update_sched_clock(void)
 /*
  * clocksource
  */
-static cycle_t ixp4xx_get_cycles(struct clocksource *cs)
-{
-	return *IXP4XX_OSTS;
-}
-
-static struct clocksource clocksource_ixp4xx = {
-	.name 		= "OSTS",
-	.rating		= 200,
-	.read		= ixp4xx_get_cycles,
-	.mask		= CLOCKSOURCE_MASK(32),
-	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ;
 EXPORT_SYMBOL(ixp4xx_timer_freq);
 static void __init ixp4xx_clocksource_init(void)
 {
 	init_sched_clock(&cd, ixp4xx_update_sched_clock, 32, ixp4xx_timer_freq);
 
-	clocksource_register_hz(&clocksource_ixp4xx, ixp4xx_timer_freq);
+	clocksource_mmio_init(&IXP4XX_OSTS, "OSTS", ixp4xx_timer_freq, 200, 32,
+			clocksource_mmio_readl_up);
 }
 
 /*
diff --git a/arch/arm/mach-lpc32xx/timer.c b/arch/arm/mach-lpc32xx/timer.c
index 6162ac3..b42c909 100644
--- a/arch/arm/mach-lpc32xx/timer.c
+++ b/arch/arm/mach-lpc32xx/timer.c
@@ -31,19 +31,6 @@
 #include <mach/platform.h>
 #include "common.h"
 
-static cycle_t lpc32xx_clksrc_read(struct clocksource *cs)
-{
-	return (cycle_t)__raw_readl(LCP32XX_TIMER_TC(LPC32XX_TIMER1_BASE));
-}
-
-static struct clocksource lpc32xx_clksrc = {
-	.name	= "lpc32xx_clksrc",
-	.rating	= 300,
-	.read	= lpc32xx_clksrc_read,
-	.mask	= CLOCKSOURCE_MASK(32),
-	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static int lpc32xx_clkevt_next_event(unsigned long delta,
     struct clock_event_device *dev)
 {
@@ -170,7 +157,9 @@ static void __init lpc32xx_timer_init(void)
 	__raw_writel(0, LCP32XX_TIMER_MCR(LPC32XX_TIMER1_BASE));
 	__raw_writel(LCP32XX_TIMER_CNTR_TCR_EN,
 		LCP32XX_TIMER_TCR(LPC32XX_TIMER1_BASE));
-	clocksource_register_hz(&lpc32xx_clksrc, clkrate);
+
+	clocksource_mmio_init(LCP32XX_TIMER_TC(LPC32XX_TIMER1_BASE),
+		"lpc32xx_clksrc", clkrate, 300, 32, clocksource_mmio_readl_up);
 }
 
 struct sys_timer lpc32xx_timer = {
diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c
index f12f22d..e24c141 100644
--- a/arch/arm/mach-netx/time.c
+++ b/arch/arm/mach-netx/time.c
@@ -104,19 +104,6 @@ static struct irqaction netx_timer_irq = {
 	.handler	= netx_timer_interrupt,
 };
 
-cycle_t netx_get_cycles(struct clocksource *cs)
-{
-	return readl(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE));
-}
-
-static struct clocksource clocksource_netx = {
-	.name		= "netx_timer",
-	.rating		= 200,
-	.read		= netx_get_cycles,
-	.mask		= CLOCKSOURCE_MASK(32),
-	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 /*
  * Set up timer interrupt
  */
@@ -150,7 +137,8 @@ static void __init netx_timer_init(void)
 	writel(NETX_GPIO_COUNTER_CTRL_RUN,
 			NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKSOURCE));
 
-	clocksource_register_hz(&clocksource_netx, CLOCK_TICK_RATE);
+	clocksource_mmio_init(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE),
+		"netx_timer", CLOCK_TICK_RATE, 200, 32, clocksource_mmio_readl_up);
 
 	netx_clockevent.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC,
 			netx_clockevent.shift);
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index 428da3f..de68470 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -105,19 +105,6 @@ static struct clock_event_device ckevt_pxa_osmr0 = {
 	.set_mode	= pxa_osmr0_set_mode,
 };
 
-static cycle_t pxa_read_oscr(struct clocksource *cs)
-{
-	return OSCR;
-}
-
-static struct clocksource cksrc_pxa_oscr0 = {
-	.name           = "oscr0",
-	.rating         = 200,
-	.read           = pxa_read_oscr,
-	.mask           = CLOCKSOURCE_MASK(32),
-	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static struct irqaction pxa_ost0_irq = {
 	.name		= "ost0",
 	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
@@ -134,7 +121,6 @@ static void __init pxa_timer_init(void)
 
 	init_sched_clock(&cd, pxa_update_sched_clock, 32, clock_tick_rate);
 
-	clocksource_calc_mult_shift(&cksrc_pxa_oscr0, clock_tick_rate, 4);
 	clockevents_calc_mult_shift(&ckevt_pxa_osmr0, clock_tick_rate, 4);
 	ckevt_pxa_osmr0.max_delta_ns =
 		clockevent_delta2ns(0x7fffffff, &ckevt_pxa_osmr0);
@@ -144,7 +130,8 @@ static void __init pxa_timer_init(void)
 
 	setup_irq(IRQ_OST0, &pxa_ost0_irq);
 
-	clocksource_register_hz(&cksrc_pxa_oscr0, clock_tick_rate);
+	clocksource_mmio_init(&OSCR, "oscr0", clock_tick_rate, 200, 32,
+		clocksource_mmio_readl_up);
 	clockevents_register_device(&ckevt_pxa_osmr0);
 }
 
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index 51c0529..fa66024 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -97,19 +97,6 @@ static struct clock_event_device ckevt_sa1100_osmr0 = {
 	.set_mode	= sa1100_osmr0_set_mode,
 };
 
-static cycle_t sa1100_read_oscr(struct clocksource *s)
-{
-	return OSCR;
-}
-
-static struct clocksource cksrc_sa1100_oscr = {
-	.name		= "oscr",
-	.rating		= 200,
-	.read		= sa1100_read_oscr,
-	.mask		= CLOCKSOURCE_MASK(32),
-	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static struct irqaction sa1100_timer_irq = {
 	.name		= "ost0",
 	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
@@ -134,7 +121,8 @@ static void __init sa1100_timer_init(void)
 
 	setup_irq(IRQ_OST0, &sa1100_timer_irq);
 
-	clocksource_register_hz(&cksrc_sa1100_oscr, CLOCK_TICK_RATE);
+	clocksource_mmio_init(&OSCR, "oscr", CLOCK_TICK_RATE, 200, 32,
+		clocksource_mmio_readl_up);
 	clockevents_register_device(&ckevt_sa1100_osmr0);
 }
 
diff --git a/arch/arm/mach-tcc8k/time.c b/arch/arm/mach-tcc8k/time.c
index e0a8d60..a96babe 100644
--- a/arch/arm/mach-tcc8k/time.c
+++ b/arch/arm/mach-tcc8k/time.c
@@ -25,19 +25,6 @@
 
 static void __iomem *timer_base;
 
-static cycle_t tcc_get_cycles(struct clocksource *cs)
-{
-	return __raw_readl(timer_base + TC32MCNT_OFFS);
-}
-
-static struct clocksource clocksource_tcc = {
-	.name		= "tcc_tc32",
-	.rating		= 200,
-	.read		= tcc_get_cycles,
-	.mask		= CLOCKSOURCE_MASK(32),
-	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static int tcc_set_next_event(unsigned long evt,
 			      struct clock_event_device *unused)
 {
@@ -102,7 +89,8 @@ static int __init tcc_clockevent_init(struct clk *clock)
 {
 	unsigned int c = clk_get_rate(clock);
 
-	clocksource_register_hz(&clocksource_tcc, c);
+	clocksource_mmio_init(timer_base + TC32MCNT_OFFS, "tcc_tc32", c,
+		200, 32, clocksource_mmio_readl_up);
 
 	clockevent_tcc.mult = div_sc(c, NSEC_PER_SEC,
 					clockevent_tcc.shift);
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index 0fcb1eb..9035042 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -98,11 +98,6 @@ static void tegra_timer_set_mode(enum clock_event_mode mode,
 	}
 }
 
-static cycle_t tegra_clocksource_read(struct clocksource *cs)
-{
-	return timer_readl(TIMERUS_CNTR_1US);
-}
-
 static struct clock_event_device tegra_clockevent = {
 	.name		= "timer0",
 	.rating		= 300,
@@ -111,14 +106,6 @@ static struct clock_event_device tegra_clockevent = {
 	.set_mode	= tegra_timer_set_mode,
 };
 
-static struct clocksource tegra_clocksource = {
-	.name	= "timer_us",
-	.rating	= 300,
-	.read	= tegra_clocksource_read,
-	.mask	= CLOCKSOURCE_MASK(32),
-	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static DEFINE_CLOCK_DATA(cd);
 
 /*
@@ -234,7 +221,8 @@ static void __init tegra_init_timer(void)
 	init_fixed_sched_clock(&cd, tegra_update_sched_clock, 32,
 			       1000000, SC_MULT, SC_SHIFT);
 
-	if (clocksource_register_hz(&tegra_clocksource, 1000000)) {
+	if (clocksource_mmio_init(timer_reg_base + TIMERUS_CNTR_1US,
+		"timer_us", 1000000, 300, 32, clocksource_mmio_readl_up)) {
 		printk(KERN_ERR "Failed to register clocksource\n");
 		BUG();
 	}
diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
index 3ec58bd..891cf44 100644
--- a/arch/arm/mach-u300/timer.c
+++ b/arch/arm/mach-u300/timer.c
@@ -333,20 +333,6 @@ static struct irqaction u300_timer_irq = {
 	.handler        = u300_timer_interrupt,
 };
 
-/* Use general purpose timer 2 as clock source */
-static cycle_t u300_get_cycles(struct clocksource *cs)
-{
-	return (cycles_t) readl(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC);
-}
-
-static struct clocksource clocksource_u300_1mhz = {
-	.name           = "GPT2",
-	.rating         = 300, /* Reasonably fast and accurate clock source */
-	.read           = u300_get_cycles,
-	.mask           = CLOCKSOURCE_MASK(32), /* 32 bits */
-	.flags          = CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 /*
  * Override the global weak sched_clock symbol with this
  * local implementation which uses the clocksource to get some
@@ -422,7 +408,9 @@ static void __init u300_timer_init(void)
 	writel(U300_TIMER_APP_EGPT2_TIMER_ENABLE,
 		U300_TIMER_APP_VBASE + U300_TIMER_APP_EGPT2);
 
-	if (clocksource_register_hz(&clocksource_u300_1mhz, rate))
+	/* Use general purpose timer 2 as clock source */
+	if (clocksource_mmio_init(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC,
+			"GPT2", rate, 300, 32, clocksource_mmio_readl_up))
 		printk(KERN_ERR "timer: failed to initialize clock "
 		       "source %s\n", clocksource_u300_1mhz.name);
 
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index 2237ff8..e4ac94a 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -106,56 +106,32 @@ static void gpt_irq_acknowledge(void)
 		__raw_writel(V2_TSTAT_OF1, timer_base + V2_TSTAT);
 }
 
-static cycle_t dummy_get_cycles(struct clocksource *cs)
-{
-	return 0;
-}
-
-static cycle_t mx1_2_get_cycles(struct clocksource *cs)
-{
-	return __raw_readl(timer_base + MX1_2_TCN);
-}
-
-static cycle_t v2_get_cycles(struct clocksource *cs)
-{
-	return __raw_readl(timer_base + V2_TCN);
-}
-
-static struct clocksource clocksource_mxc = {
-	.name 		= "mxc_timer1",
-	.rating		= 200,
-	.read		= dummy_get_cycles,
-	.mask		= CLOCKSOURCE_MASK(32),
-	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-};
+static void __iomem *sched_clock_reg;
 
 static DEFINE_CLOCK_DATA(cd);
 unsigned long long notrace sched_clock(void)
 {
-	cycle_t cyc = clocksource_mxc.read(&clocksource_mxc);
+	cycle_t cyc = sched_clock_reg ? __raw_readl(sched_clock_reg) : 0;
 
 	return cyc_to_sched_clock(&cd, cyc, (u32)~0);
 }
 
 static void notrace mxc_update_sched_clock(void)
 {
-	cycle_t cyc = clocksource_mxc.read(&clocksource_mxc);
+	cycle_t cyc = sched_clock_reg ? __raw_readl(sched_clock_reg) : 0;
 	update_sched_clock(&cd, cyc, (u32)~0);
 }
 
 static int __init mxc_clocksource_init(struct clk *timer_clk)
 {
 	unsigned int c = clk_get_rate(timer_clk);
+	void __iomem *reg = timer_base + (timer_is_v2() ? V2_TCN : MX1_2_TCN);
 
-	if (timer_is_v2())
-		clocksource_mxc.read = v2_get_cycles;
-	else
-		clocksource_mxc.read = mx1_2_get_cycles;
+	sched_clock_reg = reg;
 
 	init_sched_clock(&cd, mxc_update_sched_clock, 32, c);
-	clocksource_register_hz(&clocksource_mxc, c);
-
-	return 0;
+	return clocksource_mmio_init(reg, "mxc_timer1", c, 200, 32,
+			clocksource_mmio_readl_up);
 }
 
 /* clock event */
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 08/19] clocksource: convert ARM 32-bit down counting clocksources
  2011-05-16 17:23 ` Russell King - ARM Linux
                   ` (7 preceding siblings ...)
  (?)
@ 2011-05-16 17:28 ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:28 UTC (permalink / raw)
  To: linux-arm-kernel

Convert SP804, MXC, Nomadik and Orion 32-bit down-counting clocksources
to generic mmio clocksource infrastructure.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Alessandro Rubini <rubini@unipv.it>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/Kconfig              |    2 ++
 arch/arm/common/timer-sp.c    |   30 ++++++------------------------
 arch/arm/plat-mxc/epit.c      |   18 ++----------------
 arch/arm/plat-nomadik/Kconfig |    1 +
 arch/arm/plat-nomadik/timer.c |   31 +++----------------------------
 arch/arm/plat-orion/time.c    |   21 ++-------------------
 6 files changed, 16 insertions(+), 87 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9aa5514..0a05a57 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1042,6 +1042,7 @@ config PLAT_IOP
 
 config PLAT_ORION
 	bool
+	select CLKSRC_MMIO
 	select HAVE_SCHED_CLOCK
 
 config PLAT_PXA
@@ -1052,6 +1053,7 @@ config PLAT_VERSATILE
 
 config ARM_TIMER_SP804
 	bool
+	select CLKSRC_MMIO
 
 source arch/arm/mm/Kconfig
 
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index 6ef3342..445b05e 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -32,35 +32,17 @@
 #define TIMER_FREQ_KHZ	(1000)
 #define TIMER_RELOAD	(TIMER_FREQ_KHZ * 1000 / HZ)
 
-static void __iomem *clksrc_base;
-
-static cycle_t sp804_read(struct clocksource *cs)
-{
-	return ~readl(clksrc_base + TIMER_VALUE);
-}
-
-static struct clocksource clocksource_sp804 = {
-	.name		= "timer3",
-	.rating		= 200,
-	.read		= sp804_read,
-	.mask		= CLOCKSOURCE_MASK(32),
-	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 void __init sp804_clocksource_init(void __iomem *base)
 {
-	struct clocksource *cs = &clocksource_sp804;
-
-	clksrc_base = base;
-
 	/* setup timer 0 as free-running clocksource */
-	writel(0, clksrc_base + TIMER_CTRL);
-	writel(0xffffffff, clksrc_base + TIMER_LOAD);
-	writel(0xffffffff, clksrc_base + TIMER_VALUE);
+	writel(0, base + TIMER_CTRL);
+	writel(0xffffffff, base + TIMER_LOAD);
+	writel(0xffffffff, base + TIMER_VALUE);
 	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
-		clksrc_base + TIMER_CTRL);
+		base + TIMER_CTRL);
 
-	clocksource_register_khz(cs, TIMER_FREQ_KHZ);
+	clocksource_mmio_init(base + TIMER_VALUE, "timer3",
+		TIMER_FREQ_KHZ * 1000, 200, 32, clocksource_mmio_readl_down);
 }
 
 
diff --git a/arch/arm/plat-mxc/epit.c b/arch/arm/plat-mxc/epit.c
index d69d343..d3467f8 100644
--- a/arch/arm/plat-mxc/epit.c
+++ b/arch/arm/plat-mxc/epit.c
@@ -83,26 +83,12 @@ static void epit_irq_acknowledge(void)
 	__raw_writel(EPITSR_OCIF, timer_base + EPITSR);
 }
 
-static cycle_t epit_read(struct clocksource *cs)
-{
-	return 0 - __raw_readl(timer_base + EPITCNR);
-}
-
-static struct clocksource clocksource_epit = {
-	.name		= "epit",
-	.rating		= 200,
-	.read		= epit_read,
-	.mask		= CLOCKSOURCE_MASK(32),
-	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static int __init epit_clocksource_init(struct clk *timer_clk)
 {
 	unsigned int c = clk_get_rate(timer_clk);
 
-	clocksource_register_hz(&clocksource_epit, c);
-
-	return 0;
+	return clocksource_mmio_init(timer_base + EPITCNR, "epit", c, 200, 32,
+			clocksource_mmio_readl_down);
 }
 
 /* clock event */
diff --git a/arch/arm/plat-nomadik/Kconfig b/arch/arm/plat-nomadik/Kconfig
index 187f4e8..18296ee 100644
--- a/arch/arm/plat-nomadik/Kconfig
+++ b/arch/arm/plat-nomadik/Kconfig
@@ -5,6 +5,7 @@
 config PLAT_NOMADIK
 	bool
 	depends on ARCH_NOMADIK || ARCH_U8500
+	select CLKSRC_MMIO
 	default y
 	help
 	  Common platform code for Nomadik and other ST-Ericsson
diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c
index 4172340..ef74e15 100644
--- a/arch/arm/plat-nomadik/timer.c
+++ b/arch/arm/plat-nomadik/timer.c
@@ -26,29 +26,6 @@
 void __iomem *mtu_base; /* Assigned by machine code */
 
 /*
- * Kernel assumes that sched_clock can be called early
- * but the MTU may not yet be initialized.
- */
-static cycle_t nmdk_read_timer_dummy(struct clocksource *cs)
-{
-	return 0;
-}
-
-/* clocksource: MTU decrements, so we negate the value being read. */
-static cycle_t nmdk_read_timer(struct clocksource *cs)
-{
-	return -readl(mtu_base + MTU_VAL(0));
-}
-
-static struct clocksource nmdk_clksrc = {
-	.name		= "mtu_0",
-	.rating		= 200,
-	.read		= nmdk_read_timer_dummy,
-	.mask		= CLOCKSOURCE_MASK(32),
-	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
-/*
  * Override the global weak sched_clock symbol with this
  * local implementation which uses the clocksource to get some
  * better resolution when scheduling the kernel.
@@ -172,12 +149,10 @@ void __init nmdk_timer_init(void)
 	writel(0, mtu_base + MTU_BGLR(0));
 	writel(cr | MTU_CRn_ENA, mtu_base + MTU_CR(0));
 
-	/* Now the clock source is ready */
-	nmdk_clksrc.read = nmdk_read_timer;
-
-	if (clocksource_register_hz(&nmdk_clksrc, rate))
+	if (clocksource_mmio_init(mtu_base + MTU_VAL(0), "mtu_0",
+			rate, 200, 32, clocksource_mmio_readl_down))
 		pr_err("timer: failed to initialize clock source %s\n",
-		       nmdk_clksrc.name);
+		       "mtu_0");
 
 	init_sched_clock(&cd, nomadik_update_sched_clock, 32, rate);
 
diff --git a/arch/arm/plat-orion/time.c b/arch/arm/plat-orion/time.c
index 742b032..69a6136 100644
--- a/arch/arm/plat-orion/time.c
+++ b/arch/arm/plat-orion/time.c
@@ -81,24 +81,6 @@ static void __init setup_sched_clock(unsigned long tclk)
 }
 
 /*
- * Clocksource handling.
- */
-static cycle_t orion_clksrc_read(struct clocksource *cs)
-{
-	return 0xffffffff - readl(timer_base + TIMER0_VAL_OFF);
-}
-
-static struct clocksource orion_clksrc = {
-	.name		= "orion_clocksource",
-	.rating		= 300,
-	.read		= orion_clksrc_read,
-	.mask		= CLOCKSOURCE_MASK(32),
-	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
-
-
-/*
  * Clockevent handling.
  */
 static int
@@ -247,7 +229,8 @@ orion_time_init(u32 _bridge_base, u32 _bridge_timer1_clr_mask,
 	writel(u & ~BRIDGE_INT_TIMER0, bridge_base + BRIDGE_MASK_OFF);
 	u = readl(timer_base + TIMER_CTRL_OFF);
 	writel(u | TIMER0_EN | TIMER0_RELOAD_EN, timer_base + TIMER_CTRL_OFF);
-	clocksource_register_hz(&orion_clksrc, tclk);
+	clocksource_mmio_init(timer_base + TIMER0_VAL_OFF, "orion_clocksource",
+		tclk, 300, 32, clocksource_mmio_readl_down);
 
 	/*
 	 * Setup clockevent timer (interrupt-driven).
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 09/19] clocksource: convert W90x900 24-bit down counting clocksource
  2011-05-16 17:23 ` Russell King - ARM Linux
                   ` (8 preceding siblings ...)
  (?)
@ 2011-05-16 17:28 ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:28 UTC (permalink / raw)
  To: linux-arm-kernel

Convert the W90x900 24-bit down-counting clocksource to the generic
mmio clocksource infrastructure

Cc: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/Kconfig             |    1 +
 arch/arm/mach-w90x900/time.c |   17 ++---------------
 2 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0a05a57..bab25a0 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -575,6 +575,7 @@ config ARCH_W90X900
 	select CPU_ARM926T
 	select ARCH_REQUIRE_GPIOLIB
 	select CLKDEV_LOOKUP
+	select CLKSRC_MMIO
 	select GENERIC_CLOCKEVENTS
 	help
 	  Support for Nuvoton (Winbond logic dept.) ARM9 processor,
diff --git a/arch/arm/mach-w90x900/time.c b/arch/arm/mach-w90x900/time.c
index 4b089cb..a2c4e2d 100644
--- a/arch/arm/mach-w90x900/time.c
+++ b/arch/arm/mach-w90x900/time.c
@@ -43,7 +43,6 @@
 #define PRESCALE	0x63 /* Divider = prescale + 1 */
 
 #define	TDR_SHIFT	24
-#define	TDR_MASK	((1 << TDR_SHIFT) - 1)
 
 static unsigned int timer0_load;
 
@@ -143,19 +142,6 @@ static void __init nuc900_clockevents_init(void)
 	clockevents_register_device(&nuc900_clockevent_device);
 }
 
-static cycle_t nuc900_get_cycles(struct clocksource *cs)
-{
-	return (~__raw_readl(REG_TDR1)) & TDR_MASK;
-}
-
-static struct clocksource clocksource_nuc900 = {
-	.name	= "nuc900-timer1",
-	.rating	= 200,
-	.read	= nuc900_get_cycles,
-	.mask	= CLOCKSOURCE_MASK(TDR_SHIFT),
-	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static void __init nuc900_clocksource_init(void)
 {
 	unsigned int val;
@@ -175,7 +161,8 @@ static void __init nuc900_clocksource_init(void)
 	val |= (COUNTEN | PERIOD | PRESCALE);
 	__raw_writel(val, REG_TCSR1);
 
-	clocksource_register_hz(&clocksource_nuc900, rate);
+	clocksource_mmio_init(REG_TDR1, "nuc900-timer1", rate, 200,
+		TDR_SHIFT, clocksource_mmio_readl_down);
 }
 
 static void __init nuc900_timer_init(void)
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 10/19] clocksource: convert Integrator/AP 16-bit down counting clocksource
  2011-05-16 17:23 ` Russell King - ARM Linux
                   ` (9 preceding siblings ...)
  (?)
@ 2011-05-16 17:28 ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:28 UTC (permalink / raw)
  To: linux-arm-kernel

Convert the Integrator/AP 16-bit down-counting clocksource to the
generic clocksource infrastructure.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-integrator/Kconfig         |    1 +
 arch/arm/mach-integrator/integrator_ap.c |   21 +++------------------
 2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig
index d701d32..dfd18f3 100644
--- a/arch/arm/mach-integrator/Kconfig
+++ b/arch/arm/mach-integrator/Kconfig
@@ -4,6 +4,7 @@ menu "Integrator Options"
 
 config ARCH_INTEGRATOR_AP
 	bool "Support Integrator/AP and Integrator/PP2 platforms"
+	select CLKSRC_MMIO
 	select MIGHT_HAVE_PCI
 	help
 	  Include support for the ARM(R) Integrator/AP and
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 980803f..9c61acf 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -343,25 +343,9 @@ static void __init ap_init(void)
 
 static unsigned long timer_reload;
 
-static void __iomem * const clksrc_base = (void __iomem *)TIMER2_VA_BASE;
-
-static cycle_t timersp_read(struct clocksource *cs)
-{
-	return ~(readl(clksrc_base + TIMER_VALUE) & 0xffff);
-}
-
-static struct clocksource clocksource_timersp = {
-	.name		= "timer2",
-	.rating		= 200,
-	.read		= timersp_read,
-	.mask		= CLOCKSOURCE_MASK(16),
-	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static void integrator_clocksource_init(u32 khz)
 {
-	struct clocksource *cs = &clocksource_timersp;
-	void __iomem *base = clksrc_base;
+	void __iomem *base = (void __iomem *)TIMER2_VA_BASE;
 	u32 ctrl = TIMER_CTRL_ENABLE;
 
 	if (khz >= 1500) {
@@ -372,7 +356,8 @@ static void integrator_clocksource_init(u32 khz)
 	writel(ctrl, base + TIMER_CTRL);
 	writel(0xffff, base + TIMER_LOAD);
 
-	clocksource_register_khz(cs, khz);
+	clocksource_mmio_init(base + TIMER_VALUE, "timer2",
+		khz * 1000, 200, 16, clocksource_mmio_readl_down);
 }
 
 static void __iomem * const clkevt_base = (void __iomem *)TIMER1_VA_BASE;
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 11/19] clocksource: convert SPEAr platforms 16-bit up counting clocksource
  2011-05-16 17:23 ` Russell King - ARM Linux
                   ` (10 preceding siblings ...)
  (?)
@ 2011-05-16 17:29 ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:29 UTC (permalink / raw)
  To: linux-arm-kernel

Convert SPEAr platforms 16-bit up counting clocksource, which requires
a 16-bit register access read rather than 32-bit.

Acked-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/Kconfig           |    1 +
 arch/arm/plat-spear/time.c |   16 ++--------------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index bab25a0..cbc27fb 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -884,6 +884,7 @@ config PLAT_SPEAR
 	select ARM_AMBA
 	select ARCH_REQUIRE_GPIOLIB
 	select CLKDEV_LOOKUP
+	select CLKSRC_MMIO
 	select GENERIC_CLOCKEVENTS
 	select HAVE_CLK
 	help
diff --git a/arch/arm/plat-spear/time.c b/arch/arm/plat-spear/time.c
index dbb6e4f..0c77e42 100644
--- a/arch/arm/plat-spear/time.c
+++ b/arch/arm/plat-spear/time.c
@@ -70,19 +70,6 @@ static void clockevent_set_mode(enum clock_event_mode mode,
 static int clockevent_next_event(unsigned long evt,
 				 struct clock_event_device *clk_event_dev);
 
-static cycle_t clocksource_read_cycles(struct clocksource *cs)
-{
-	return (cycle_t) readw(gpt_base + COUNT(CLKSRC));
-}
-
-static struct clocksource clksrc = {
-	.name = "tmr1",
-	.rating = 200,		/* its a pretty decent clock */
-	.read = clocksource_read_cycles,
-	.mask = 0xFFFF,		/* 16 bits */
-	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static void spear_clocksource_init(void)
 {
 	u32 tick_rate;
@@ -103,7 +90,8 @@ static void spear_clocksource_init(void)
 	writew(val, gpt_base + CR(CLKSRC));
 
 	/* register the clocksource */
-	clocksource_register_hz(&clksrc, tick_rate);
+	clocksource_mmio_init(gpt_base + COUNT(CLKSRC), "tmr1", tick_rate,
+		200, 16, clocksource_mmio_readw_up);
 }
 
 static struct clock_event_device clkevt = {
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 12/19] clocksource: convert MXS timrotv2 to 32-bit down counting clocksource
  2011-05-16 17:23 ` Russell King - ARM Linux
                   ` (11 preceding siblings ...)
  (?)
@ 2011-05-16 17:29 ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:29 UTC (permalink / raw)
  To: linux-arm-kernel

Convert the MXS timrotv2 32-bit down counting clocksource to the
generic clocksource infrastructure.

Cc: Sascha Hauer <kernel@pengutronix.de>
Acked-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/Kconfig          |    1 +
 arch/arm/mach-mxs/timer.c |   20 +++++++-------------
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index cbc27fb..43f003a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -376,6 +376,7 @@ config ARCH_MXS
 	select GENERIC_CLOCKEVENTS
 	select ARCH_REQUIRE_GPIOLIB
 	select CLKDEV_LOOKUP
+	select CLKSRC_MMIO
 	help
 	  Support for Freescale MXS-based family of processors
 
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
index 13647f3..cace0d2 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -101,11 +101,6 @@ static cycle_t timrotv1_get_cycles(struct clocksource *cs)
 			& 0xffff0000) >> 16);
 }
 
-static cycle_t timrotv2_get_cycles(struct clocksource *cs)
-{
-	return ~__raw_readl(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1));
-}
-
 static int timrotv1_set_next_event(unsigned long evt,
 					struct clock_event_device *dev)
 {
@@ -230,8 +225,8 @@ static int __init mxs_clockevent_init(struct clk *timer_clk)
 static struct clocksource clocksource_mxs = {
 	.name		= "mxs_timer",
 	.rating		= 200,
-	.read		= timrotv2_get_cycles,
-	.mask		= CLOCKSOURCE_MASK(32),
+	.read		= timrotv1_get_cycles,
+	.mask		= CLOCKSOURCE_MASK(16),
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -239,12 +234,11 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)
 {
 	unsigned int c = clk_get_rate(timer_clk);
 
-	if (timrot_is_v1()) {
-		clocksource_mxs.read = timrotv1_get_cycles;
-		clocksource_mxs.mask = CLOCKSOURCE_MASK(16);
-	}
-
-	clocksource_register_hz(&clocksource_mxs, c);
+	if (timrot_is_v1())
+		clocksource_register_hz(&clocksource_mxs, c);
+	else
+		clocksource_mmio_init(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1),
+			"mxs_timer", c, 200, 32, clocksource_mmio_readl_down);
 
 	return 0;
 }
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 13/19] clocksource: convert OMAP1 to 32-bit down counting clocksource
  2011-05-16 17:23 ` Russell King - ARM Linux
@ 2011-05-16 17:29   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:29 UTC (permalink / raw)
  To: linux-arm-kernel, John Stultz, Thomas Gleixner; +Cc: linux-omap

Convert the OMAP1 32-bit down counting clocksource to the generic
clocksource infrastructure.

Tested-by: Tony Lindgren <tony@atomide.com>
Cc: linux-omap@vger.kernel.org
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-omap1/time.c |   23 ++++++-----------------
 arch/arm/plat-omap/Kconfig |    1 +
 2 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index e7ab616..03e1e10 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -190,24 +190,11 @@ static __init void omap_init_mpu_timer(unsigned long rate)
  * ---------------------------------------------------------------------------
  */
 
-static cycle_t mpu_read(struct clocksource *cs)
-{
-	return ~omap_mpu_timer_read(1);
-}
-
-static struct clocksource clocksource_mpu = {
-	.name		= "mpu_timer2",
-	.rating		= 300,
-	.read		= mpu_read,
-	.mask		= CLOCKSOURCE_MASK(32),
-	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static DEFINE_CLOCK_DATA(cd);
 
 static inline unsigned long long notrace _omap_mpu_sched_clock(void)
 {
-	u32 cyc = mpu_read(&clocksource_mpu);
+	u32 cyc = ~omap_mpu_timer_read(1);
 	return cyc_to_sched_clock(&cd, cyc, (u32)~0);
 }
 
@@ -225,20 +212,22 @@ static unsigned long long notrace omap_mpu_sched_clock(void)
 
 static void notrace mpu_update_sched_clock(void)
 {
-	u32 cyc = mpu_read(&clocksource_mpu);
+	u32 cyc = ~omap_mpu_timer_read(1);
 	update_sched_clock(&cd, cyc, (u32)~0);
 }
 
 static void __init omap_init_clocksource(unsigned long rate)
 {
+	omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(1);
 	static char err[] __initdata = KERN_ERR
 			"%s: can't register clocksource!\n";
 
 	omap_mpu_timer_start(1, ~0, 1);
 	init_sched_clock(&cd, mpu_update_sched_clock, 32, rate);
 
-	if (clocksource_register_hz(&clocksource_mpu, rate))
-		printk(err, clocksource_mpu.name);
+	if (clocksource_mmio_init(&timer->read_tim, "mpu_timer2", rate,
+			300, 32, clocksource_mmio_readl_down))
+		printk(err, "mpu_timer2");
 }
 
 static void __init omap_mpu_timer_init(void)
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index cd5f993..e9c0efc 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -12,6 +12,7 @@ choice
 config ARCH_OMAP1
 	bool "TI OMAP1"
 	select CLKDEV_LOOKUP
+	select CLKSRC_MMIO
 	help
 	  "Systems based on omap7xx, omap15xx or omap16xx"
 
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 13/19] clocksource: convert OMAP1 to 32-bit down counting clocksource
@ 2011-05-16 17:29   ` Russell King - ARM Linux
  0 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:29 UTC (permalink / raw)
  To: linux-arm-kernel

Convert the OMAP1 32-bit down counting clocksource to the generic
clocksource infrastructure.

Tested-by: Tony Lindgren <tony@atomide.com>
Cc: linux-omap at vger.kernel.org
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-omap1/time.c |   23 ++++++-----------------
 arch/arm/plat-omap/Kconfig |    1 +
 2 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index e7ab616..03e1e10 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -190,24 +190,11 @@ static __init void omap_init_mpu_timer(unsigned long rate)
  * ---------------------------------------------------------------------------
  */
 
-static cycle_t mpu_read(struct clocksource *cs)
-{
-	return ~omap_mpu_timer_read(1);
-}
-
-static struct clocksource clocksource_mpu = {
-	.name		= "mpu_timer2",
-	.rating		= 300,
-	.read		= mpu_read,
-	.mask		= CLOCKSOURCE_MASK(32),
-	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static DEFINE_CLOCK_DATA(cd);
 
 static inline unsigned long long notrace _omap_mpu_sched_clock(void)
 {
-	u32 cyc = mpu_read(&clocksource_mpu);
+	u32 cyc = ~omap_mpu_timer_read(1);
 	return cyc_to_sched_clock(&cd, cyc, (u32)~0);
 }
 
@@ -225,20 +212,22 @@ static unsigned long long notrace omap_mpu_sched_clock(void)
 
 static void notrace mpu_update_sched_clock(void)
 {
-	u32 cyc = mpu_read(&clocksource_mpu);
+	u32 cyc = ~omap_mpu_timer_read(1);
 	update_sched_clock(&cd, cyc, (u32)~0);
 }
 
 static void __init omap_init_clocksource(unsigned long rate)
 {
+	omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(1);
 	static char err[] __initdata = KERN_ERR
 			"%s: can't register clocksource!\n";
 
 	omap_mpu_timer_start(1, ~0, 1);
 	init_sched_clock(&cd, mpu_update_sched_clock, 32, rate);
 
-	if (clocksource_register_hz(&clocksource_mpu, rate))
-		printk(err, clocksource_mpu.name);
+	if (clocksource_mmio_init(&timer->read_tim, "mpu_timer2", rate,
+			300, 32, clocksource_mmio_readl_down))
+		printk(err, "mpu_timer2");
 }
 
 static void __init omap_mpu_timer_init(void)
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index cd5f993..e9c0efc 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -12,6 +12,7 @@ choice
 config ARCH_OMAP1
 	bool "TI OMAP1"
 	select CLKDEV_LOOKUP
+	select CLKSRC_MMIO
 	help
 	  "Systems based on omap7xx, omap15xx or omap16xx"
 
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 14/19] clocksource: ARM sp804: allow clocksource name to be specified
  2011-05-16 17:23 ` Russell King - ARM Linux
                   ` (13 preceding siblings ...)
  (?)
@ 2011-05-16 17:30 ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:30 UTC (permalink / raw)
  To: linux-arm-kernel

This allows platforms to specify the clocksource name upon
registration, which is necessary should they wish to register more
than one sp804 clocksource.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/common/timer-sp.c               |    4 ++--
 arch/arm/include/asm/hardware/timer-sp.h |    2 +-
 arch/arm/mach-integrator/integrator_cp.c |    2 +-
 arch/arm/mach-realview/core.c            |    2 +-
 arch/arm/mach-versatile/core.c           |    2 +-
 arch/arm/mach-vexpress/ct-ca9x4.c        |    2 +-
 arch/arm/mach-vexpress/v2m.c             |    2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index 445b05e..f6b9011 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -32,7 +32,7 @@
 #define TIMER_FREQ_KHZ	(1000)
 #define TIMER_RELOAD	(TIMER_FREQ_KHZ * 1000 / HZ)
 
-void __init sp804_clocksource_init(void __iomem *base)
+void __init sp804_clocksource_init(void __iomem *base, const char *name)
 {
 	/* setup timer 0 as free-running clocksource */
 	writel(0, base + TIMER_CTRL);
@@ -41,7 +41,7 @@ void __init sp804_clocksource_init(void __iomem *base)
 	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
 		base + TIMER_CTRL);
 
-	clocksource_mmio_init(base + TIMER_VALUE, "timer3",
+	clocksource_mmio_init(base + TIMER_VALUE, name,
 		TIMER_FREQ_KHZ * 1000, 200, 32, clocksource_mmio_readl_down);
 }
 
diff --git a/arch/arm/include/asm/hardware/timer-sp.h b/arch/arm/include/asm/hardware/timer-sp.h
index 21e75e3..11c386b 100644
--- a/arch/arm/include/asm/hardware/timer-sp.h
+++ b/arch/arm/include/asm/hardware/timer-sp.h
@@ -1,2 +1,2 @@
-void sp804_clocksource_init(void __iomem *);
+void sp804_clocksource_init(void __iomem *, const char *);
 void sp804_clockevents_init(void __iomem *, unsigned int);
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 9e3ce26..46fb7f5 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -476,7 +476,7 @@ static void __init intcp_timer_init(void)
 	writel(0, TIMER1_VA_BASE + TIMER_CTRL);
 	writel(0, TIMER2_VA_BASE + TIMER_CTRL);
 
-	sp804_clocksource_init(TIMER2_VA_BASE);
+	sp804_clocksource_init(TIMER2_VA_BASE, "timer2");
 	sp804_clockevents_init(TIMER1_VA_BASE, IRQ_TIMERINT1);
 }
 
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 75dbc87..6356b5e 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -545,7 +545,7 @@ void __init realview_timer_init(unsigned int timer_irq)
 	writel(0, timer2_va_base + TIMER_CTRL);
 	writel(0, timer3_va_base + TIMER_CTRL);
 
-	sp804_clocksource_init(timer3_va_base);
+	sp804_clocksource_init(timer3_va_base, "timer3");
 	sp804_clockevents_init(timer0_va_base, timer_irq);
 }
 
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index eb7ffa0..aad6d39 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -764,7 +764,7 @@ static void __init versatile_timer_init(void)
 	writel(0, TIMER2_VA_BASE + TIMER_CTRL);
 	writel(0, TIMER3_VA_BASE + TIMER_CTRL);
 
-	sp804_clocksource_init(TIMER3_VA_BASE);
+	sp804_clocksource_init(TIMER3_VA_BASE, "timer3");
 	sp804_clockevents_init(TIMER0_VA_BASE, IRQ_TIMERINT0_1);
 }
 
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index ebc22e7..c833fd9 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -71,7 +71,7 @@ static void __init ct_ca9x4_timer_init(void)
 	writel(0, MMIO_P2V(CT_CA9X4_TIMER0) + TIMER_CTRL);
 	writel(0, MMIO_P2V(CT_CA9X4_TIMER1) + TIMER_CTRL);
 
-	sp804_clocksource_init(MMIO_P2V(CT_CA9X4_TIMER1));
+	sp804_clocksource_init(MMIO_P2V(CT_CA9X4_TIMER1), "ct-timer1");
 	sp804_clockevents_init(MMIO_P2V(CT_CA9X4_TIMER0), IRQ_CT_CA9X4_TIMER0);
 }
 
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index ba46e8e..ccf1f89 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -65,7 +65,7 @@ static void __init v2m_timer_init(void)
 	writel(0, MMIO_P2V(V2M_TIMER0) + TIMER_CTRL);
 	writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL);
 
-	sp804_clocksource_init(MMIO_P2V(V2M_TIMER1));
+	sp804_clocksource_init(MMIO_P2V(V2M_TIMER1), "v2m-timer1");
 	sp804_clockevents_init(MMIO_P2V(V2M_TIMER0), IRQ_V2M_TIMER0);
 }
 
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 15/19] clocksource: ARM sp804: obtain sp804 timer rate via clks
  2011-05-16 17:23 ` Russell King - ARM Linux
                   ` (14 preceding siblings ...)
  (?)
@ 2011-05-16 17:30 ` Russell King - ARM Linux
  2011-05-16 22:18   ` Rob Herring
  -1 siblings, 1 reply; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:30 UTC (permalink / raw)
  To: linux-arm-kernel

This allows platforms to specify the rate of the SP804 clocksource via
the clk subsystem.  While ARM boards clock these at 1MHz, BCMRing also
has SP804 timers but are clocked at different rates.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/common/timer-sp.c               |   39 +++++++++++++++++++++++++++++-
 arch/arm/mach-integrator/integrator_cp.c |    7 +++++
 arch/arm/mach-realview/core.c            |    9 ++++++-
 arch/arm/mach-versatile/core.c           |    9 ++++++-
 arch/arm/mach-vexpress/ct-ca9x4.c        |    8 ++++++
 arch/arm/mach-vexpress/v2m.c             |    8 ++++++
 6 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index f6b9011..45a5eb8 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -18,8 +18,10 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+#include <linux/clk.h>
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
+#include <linux/err.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/io.h>
@@ -32,8 +34,43 @@
 #define TIMER_FREQ_KHZ	(1000)
 #define TIMER_RELOAD	(TIMER_FREQ_KHZ * 1000 / HZ)
 
+static long __init sp804_get_clock_rate(const char *name)
+{
+	struct clk *clk;
+	long rate;
+	int err;
+
+	clk = clk_get_sys("sp804", name);
+	if (IS_ERR(clk)) {
+		pr_err("sp804: %s clock not found: %d\n", name,
+			(int)PTR_ERR(clk));
+		return PTR_ERR(clk);
+	}
+
+	err = clk_enable(clk);
+	if (err) {
+		pr_err("sp804: %s clock failed to enable: %d\n", name, err);
+		clk_put(clk);
+		return err;
+	}
+
+	rate = clk_get_rate(clk);
+	if (rate < 0) {
+		pr_err("sp804: %s clock failed to get rate: %ld\n", name, err);
+		clk_disable(clk);
+		clk_put(clk);
+	}
+
+	return rate;
+}
+
 void __init sp804_clocksource_init(void __iomem *base, const char *name)
 {
+	long rate = sp804_get_clock_rate(name);
+
+	if (rate < 0)
+		return;
+
 	/* setup timer 0 as free-running clocksource */
 	writel(0, base + TIMER_CTRL);
 	writel(0xffffffff, base + TIMER_LOAD);
@@ -42,7 +79,7 @@ void __init sp804_clocksource_init(void __iomem *base, const char *name)
 		base + TIMER_CTRL);
 
 	clocksource_mmio_init(base + TIMER_VALUE, name,
-		TIMER_FREQ_KHZ * 1000, 200, 32, clocksource_mmio_readl_down);
+		rate, 200, 32, clocksource_mmio_readl_down);
 }
 
 
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 46fb7f5..8fb8afb 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -229,10 +229,17 @@ static struct clk cp_auxclk = {
 	.vcoreg	= CM_AUXOSC,
 };
 
+static struct clk sp804_clk = {
+	.rate	= 1000000,
+};
+
 static struct clk_lookup cp_lookups[] = {
 	{	/* CLCD */
 		.dev_id		= "mb:c0",
 		.clk		= &cp_auxclk,
+	}, {	/* SP804 timers */
+		.dev_id		= "sp804",
+		.clk		= &sp804_clk,
 	},
 };
 
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 6356b5e..6a9cd1e 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -315,6 +315,10 @@ static struct clk ref24_clk = {
 	.rate	= 24000000,
 };
 
+static struct clk sp804_clk = {
+	.rate	= 1000000,
+};
+
 static struct clk dummy_apb_pclk;
 
 static struct clk_lookup lookups[] = {
@@ -357,7 +361,10 @@ static struct clk_lookup lookups[] = {
 	}, {	/* SSP */
 		.dev_id		= "dev:ssp0",
 		.clk		= &ref24_clk,
-	}
+	}, {	/* SP804 timers */
+		.dev_id		= "sp804",
+		.clk		= &sp804_clk,
+	},
 };
 
 void __init realview_init_early(void)
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index aad6d39..b0b7de6 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -375,6 +375,10 @@ static struct clk ref24_clk = {
 	.rate	= 24000000,
 };
 
+static struct clk sp804_clk = {
+	.rate	= 1000000,
+};
+
 static struct clk dummy_apb_pclk;
 
 static struct clk_lookup lookups[] = {
@@ -411,7 +415,10 @@ static struct clk_lookup lookups[] = {
 	}, {	/* CLCD */
 		.dev_id		= "dev:20",
 		.clk		= &osc4_clk,
-	}
+	}, {	/* SP804 timers */
+		.dev_id		= "sp804",
+		.clk		= &sp804_clk,
+	},
 };
 
 /*
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index c833fd9..6004f06 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -141,10 +141,18 @@ static struct clk osc1_clk = {
 	.rate	= 24000000,
 };
 
+static struct clk ct_sp804_clk = {
+	.rate	= 1000000,
+};
+
 static struct clk_lookup lookups[] = {
 	{	/* CLCD */
 		.dev_id		= "ct:clcd",
 		.clk		= &osc1_clk,
+	}, {	/* SP804 timers */
+		.dev_id		= "sp804",
+		.con_id		= "ct-timer1",
+		.clk		= &ct_sp804_clk,
 	},
 };
 
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index ccf1f89..77d5db3 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -333,6 +333,10 @@ static struct clk osc2_clk = {
 	.rate	= 24000000,
 };
 
+static struct clk v2m_sp804_clk = {
+	.rate	= 1000000,
+};
+
 static struct clk dummy_apb_pclk;
 
 static struct clk_lookup v2m_lookups[] = {
@@ -363,6 +367,10 @@ static struct clk_lookup v2m_lookups[] = {
 	}, {	/* CLCD */
 		.dev_id		= "mb:clcd",
 		.clk		= &osc1_clk,
+	}, {	/* SP804 timers */
+		.dev_id		= "sp804",
+		.con_id		= "v2m-timer1",
+		.clk		= &v2m_sp804_clk,
 	},
 };
 
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 16/19] clockevents: ARM sp804: allow clockevent name to be specified
  2011-05-16 17:23 ` Russell King - ARM Linux
                   ` (15 preceding siblings ...)
  (?)
@ 2011-05-16 17:30 ` Russell King - ARM Linux
  2011-05-16 21:25   ` Rob Herring
  2011-05-23 10:55   ` Catalin Marinas
  -1 siblings, 2 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:30 UTC (permalink / raw)
  To: linux-arm-kernel

This allows platforms to specify the clcokevent name upon registration.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/common/timer-sp.c               |    7 ++++---
 arch/arm/include/asm/hardware/timer-sp.h |    2 +-
 arch/arm/mach-integrator/integrator_cp.c |    2 +-
 arch/arm/mach-realview/core.c            |    2 +-
 arch/arm/mach-versatile/core.c           |    2 +-
 arch/arm/mach-vexpress/ct-ca9x4.c        |    3 ++-
 arch/arm/mach-vexpress/v2m.c             |    3 ++-
 7 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index 45a5eb8..bf92afe 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -139,7 +139,6 @@ static int sp804_set_next_event(unsigned long next,
 }
 
 static struct clock_event_device sp804_clockevent = {
-	.name		= "timer0",
 	.shift		= 32,
 	.features       = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
 	.set_mode	= sp804_set_mode,
@@ -155,13 +154,15 @@ static struct irqaction sp804_timer_irq = {
 	.dev_id		= &sp804_clockevent,
 };
 
-void __init sp804_clockevents_init(void __iomem *base, unsigned int timer_irq)
+void __init sp804_clockevents_init(void __iomem *base, unsigned int irq,
+	const char *name)
 {
 	struct clock_event_device *evt = &sp804_clockevent;
 
 	clkevt_base = base;
 
-	evt->irq = timer_irq;
+	evt->name = name;
+	evt->irq = irq;
 	evt->mult = div_sc(TIMER_FREQ_KHZ, NSEC_PER_MSEC, evt->shift);
 	evt->max_delta_ns = clockevent_delta2ns(0xffffffff, evt);
 	evt->min_delta_ns = clockevent_delta2ns(0xf, evt);
diff --git a/arch/arm/include/asm/hardware/timer-sp.h b/arch/arm/include/asm/hardware/timer-sp.h
index 11c386b..4384d81 100644
--- a/arch/arm/include/asm/hardware/timer-sp.h
+++ b/arch/arm/include/asm/hardware/timer-sp.h
@@ -1,2 +1,2 @@
 void sp804_clocksource_init(void __iomem *, const char *);
-void sp804_clockevents_init(void __iomem *, unsigned int);
+void sp804_clockevents_init(void __iomem *, unsigned int, const char *);
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 8fb8afb..c4914c6 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -484,7 +484,7 @@ static void __init intcp_timer_init(void)
 	writel(0, TIMER2_VA_BASE + TIMER_CTRL);
 
 	sp804_clocksource_init(TIMER2_VA_BASE, "timer2");
-	sp804_clockevents_init(TIMER1_VA_BASE, IRQ_TIMERINT1);
+	sp804_clockevents_init(TIMER1_VA_BASE, IRQ_TIMERINT1, "timer1");
 }
 
 static struct sys_timer cp_timer = {
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 6a9cd1e..9f51555 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -553,7 +553,7 @@ void __init realview_timer_init(unsigned int timer_irq)
 	writel(0, timer3_va_base + TIMER_CTRL);
 
 	sp804_clocksource_init(timer3_va_base, "timer3");
-	sp804_clockevents_init(timer0_va_base, timer_irq);
+	sp804_clockevents_init(timer0_va_base, timer_irq, "timer0");
 }
 
 /*
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index b0b7de6..4e78c37 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -772,7 +772,7 @@ static void __init versatile_timer_init(void)
 	writel(0, TIMER3_VA_BASE + TIMER_CTRL);
 
 	sp804_clocksource_init(TIMER3_VA_BASE, "timer3");
-	sp804_clockevents_init(TIMER0_VA_BASE, IRQ_TIMERINT0_1);
+	sp804_clockevents_init(TIMER0_VA_BASE, IRQ_TIMERINT0_1, "timer0");
 }
 
 struct sys_timer versatile_timer = {
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index 6004f06..2712133 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -72,7 +72,8 @@ static void __init ct_ca9x4_timer_init(void)
 	writel(0, MMIO_P2V(CT_CA9X4_TIMER1) + TIMER_CTRL);
 
 	sp804_clocksource_init(MMIO_P2V(CT_CA9X4_TIMER1), "ct-timer1");
-	sp804_clockevents_init(MMIO_P2V(CT_CA9X4_TIMER0), IRQ_CT_CA9X4_TIMER0);
+	sp804_clockevents_init(MMIO_P2V(CT_CA9X4_TIMER0), IRQ_CT_CA9X4_TIMER0,
+		"ct-timer0");
 }
 
 static struct sys_timer ct_ca9x4_timer = {
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 77d5db3..f6fecdd 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -66,7 +66,8 @@ static void __init v2m_timer_init(void)
 	writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL);
 
 	sp804_clocksource_init(MMIO_P2V(V2M_TIMER1), "v2m-timer1");
-	sp804_clockevents_init(MMIO_P2V(V2M_TIMER0), IRQ_V2M_TIMER0);
+	sp804_clockevents_init(MMIO_P2V(V2M_TIMER0), IRQ_V2M_TIMER0,
+		"v2m-timer0");
 }
 
 static struct sys_timer v2m_timer = {
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 17/19] clockevents: ARM sp804: obtain sp804 timer rate via clks
  2011-05-16 17:23 ` Russell King - ARM Linux
                   ` (16 preceding siblings ...)
  (?)
@ 2011-05-16 17:31 ` Russell King - ARM Linux
  2011-05-16 21:24   ` Rob Herring
  2011-05-23 10:56   ` Catalin Marinas
  -1 siblings, 2 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

This allows platforms to specify the rate of the SP804 clockevent via
the clk subsystem.  While ARM boards clock these at 1MHz, BCMRing also
has SP804 timers but are clocked at different rates.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/common/timer-sp.c        |   16 ++++++++--------
 arch/arm/mach-vexpress/ct-ca9x4.c |    4 ++++
 arch/arm/mach-vexpress/v2m.c      |    4 ++++
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index bf92afe..1707c92 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -28,12 +28,6 @@
 
 #include <asm/hardware/arm_timer.h>
 
-/*
- * These timers are currently always setup to be clocked at 1MHz.
- */
-#define TIMER_FREQ_KHZ	(1000)
-#define TIMER_RELOAD	(TIMER_FREQ_KHZ * 1000 / HZ)
-
 static long __init sp804_get_clock_rate(const char *name)
 {
 	struct clk *clk;
@@ -84,6 +78,7 @@ void __init sp804_clocksource_init(void __iomem *base, const char *name)
 
 
 static void __iomem *clkevt_base;
+static unsigned long clkevt_reload;
 
 /*
  * IRQ handler for the timer
@@ -109,7 +104,7 @@ static void sp804_set_mode(enum clock_event_mode mode,
 
 	switch (mode) {
 	case CLOCK_EVT_MODE_PERIODIC:
-		writel(TIMER_RELOAD, clkevt_base + TIMER_LOAD);
+		writel(clkevt_reload, clkevt_base + TIMER_LOAD);
 		ctrl |= TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
 		break;
 
@@ -158,12 +153,17 @@ void __init sp804_clockevents_init(void __iomem *base, unsigned int irq,
 	const char *name)
 {
 	struct clock_event_device *evt = &sp804_clockevent;
+	long rate = sp804_get_clock_rate(name);
+
+	if (rate < 0)
+		return;
 
 	clkevt_base = base;
+	clkevt_reload = DIV_ROUND_CLOSEST(rate, HZ);
 
 	evt->name = name;
 	evt->irq = irq;
-	evt->mult = div_sc(TIMER_FREQ_KHZ, NSEC_PER_MSEC, evt->shift);
+	evt->mult = div_sc(rate, SEC_PER_MSEC, evt->shift);
 	evt->max_delta_ns = clockevent_delta2ns(0xffffffff, evt);
 	evt->min_delta_ns = clockevent_delta2ns(0xf, evt);
 
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index 2712133..2023a9e 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -152,6 +152,10 @@ static struct clk_lookup lookups[] = {
 		.clk		= &osc1_clk,
 	}, {	/* SP804 timers */
 		.dev_id		= "sp804",
+		.con_id		= "ct-timer0",
+		.clk		= &ct_sp804_clk,
+	}, {	/* SP804 timers */
+		.dev_id		= "sp804",
 		.con_id		= "ct-timer1",
 		.clk		= &ct_sp804_clk,
 	},
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index f6fecdd..9d9d4af 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -370,6 +370,10 @@ static struct clk_lookup v2m_lookups[] = {
 		.clk		= &osc1_clk,
 	}, {	/* SP804 timers */
 		.dev_id		= "sp804",
+		.con_id		= "v2m-timer0",
+		.clk		= &v2m_sp804_clk,
+	}, {	/* SP804 timers */
+		.dev_id		= "sp804",
 		.con_id		= "v2m-timer1",
 		.clk		= &v2m_sp804_clk,
 	},
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 18/19] ARM: bcmring: convert to sp804 clocksource
  2011-05-16 17:23 ` Russell King - ARM Linux
                   ` (17 preceding siblings ...)
  (?)
@ 2011-05-16 17:31 ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

bcmring has a set of four sp804 timers incorporated, yet it has its
own copy of the sp804 code.  Convert its clocksource implementation
to the standard sp804 support code.

Cc: Jiandong Zheng <jdzheng@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/Kconfig             |    1 +
 arch/arm/mach-bcmring/core.c |  108 +++++++++++++++++-------------------------
 2 files changed, 45 insertions(+), 64 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 43f003a..903c9c4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -297,6 +297,7 @@ config ARCH_BCMRING
 	depends on MMU
 	select CPU_V6
 	select ARM_AMBA
+	select ARM_TIMER_SP804
 	select CLKDEV_LOOKUP
 	select GENERIC_CLOCKEVENTS
 	select ARCH_WANT_OPTIONAL_GPIOLIB
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c
index 8fc2035..0ea33ff 100644
--- a/arch/arm/mach-bcmring/core.c
+++ b/arch/arm/mach-bcmring/core.c
@@ -37,6 +37,7 @@
 #include <linux/io.h>
 #include <asm/irq.h>
 #include <asm/hardware/arm_timer.h>
+#include <asm/hardware/timer-sp.h>
 #include <asm/mach-types.h>
 
 #include <asm/mach/arch.h>
@@ -97,6 +98,35 @@ static struct clk dummy_apb_pclk = {
 	.mode = CLK_MODE_XTAL,
 };
 
+/* Timer 0 - 25 MHz, Timer3 at bus clock rate, typically  150-166 MHz */
+#if defined(CONFIG_ARCH_FPGA11107)
+/* fpga cpu/bus are currently 30 times slower so scale frequency as well to */
+/* slow down Linux's sense of time */
+#define TIMER0_FREQUENCY_MHZ  (tmrHw_LOW_FREQUENCY_MHZ * 30)
+#define TIMER1_FREQUENCY_MHZ  (tmrHw_LOW_FREQUENCY_MHZ * 30)
+#define TIMER3_FREQUENCY_MHZ  (tmrHw_HIGH_FREQUENCY_MHZ * 30)
+#define TIMER3_FREQUENCY_KHZ   (tmrHw_HIGH_FREQUENCY_HZ / 1000 * 30)
+#else
+#define TIMER0_FREQUENCY_MHZ  tmrHw_LOW_FREQUENCY_MHZ
+#define TIMER1_FREQUENCY_MHZ  tmrHw_LOW_FREQUENCY_MHZ
+#define TIMER3_FREQUENCY_MHZ  tmrHw_HIGH_FREQUENCY_MHZ
+#define TIMER3_FREQUENCY_KHZ  (tmrHw_HIGH_FREQUENCY_HZ / 1000)
+#endif
+
+static struct clk sp804_timer1_clk = {
+	.name = "sp804-timer-1",
+	.type = CLK_TYPE_PRIMARY,
+	.mode = CLK_MODE_XTAL,
+	.rate_hz = TIMER1_FREQUENCY_MHZ * 1000000,
+};
+
+static struct clk sp804_timer3_clk = {
+	.name = "sp804-timer-3",
+	.type = CLK_TYPE_PRIMARY,
+	.mode = CLK_MODE_XTAL,
+	.rate_hz = TIMER3_FREQUENCY_KHZ * 1000,
+};
+
 static struct clk_lookup lookups[] = {
 	{			/* Bus clock */
 		.con_id = "apb_pclk",
@@ -107,6 +137,14 @@ static struct clk_lookup lookups[] = {
 	}, {			/* UART1 */
 		.dev_id = "uartb",
 		.clk = &uart_clk,
+	}, {			/* SP804 timer 1 */
+		.dev_id = "sp804",
+		.con_id = "timer1",
+		.clk = &sp804_timer1_clk,
+	}, {			/* SP804 timer 3 */
+		.dev_id = "sp804",
+		.con_id = "timer3",
+		.clk = &sp804_timer3_clk,
 	}
 };
 
@@ -162,25 +200,10 @@ void __init bcmring_amba_init(void)
 /*
  * Where is the timer (VA)?
  */
-#define TIMER0_VA_BASE		 MM_IO_BASE_TMR
-#define TIMER1_VA_BASE		(MM_IO_BASE_TMR + 0x20)
-#define TIMER2_VA_BASE		(MM_IO_BASE_TMR + 0x40)
-#define TIMER3_VA_BASE          (MM_IO_BASE_TMR + 0x60)
-
-/* Timer 0 - 25 MHz, Timer3 at bus clock rate, typically  150-166 MHz */
-#if defined(CONFIG_ARCH_FPGA11107)
-/* fpga cpu/bus are currently 30 times slower so scale frequency as well to */
-/* slow down Linux's sense of time */
-#define TIMER0_FREQUENCY_MHZ  (tmrHw_LOW_FREQUENCY_MHZ * 30)
-#define TIMER1_FREQUENCY_MHZ  (tmrHw_LOW_FREQUENCY_MHZ * 30)
-#define TIMER3_FREQUENCY_MHZ  (tmrHw_HIGH_FREQUENCY_MHZ * 30)
-#define TIMER3_FREQUENCY_KHZ   (tmrHw_HIGH_FREQUENCY_HZ / 1000 * 30)
-#else
-#define TIMER0_FREQUENCY_MHZ  tmrHw_LOW_FREQUENCY_MHZ
-#define TIMER1_FREQUENCY_MHZ  tmrHw_LOW_FREQUENCY_MHZ
-#define TIMER3_FREQUENCY_MHZ  tmrHw_HIGH_FREQUENCY_MHZ
-#define TIMER3_FREQUENCY_KHZ  (tmrHw_HIGH_FREQUENCY_HZ / 1000)
-#endif
+#define TIMER0_VA_BASE		((void __iomem *)MM_IO_BASE_TMR)
+#define TIMER1_VA_BASE		((void __iomem *)(MM_IO_BASE_TMR + 0x20))
+#define TIMER2_VA_BASE		((void __iomem *)(MM_IO_BASE_TMR + 0x40))
+#define TIMER3_VA_BASE          ((void __iomem *)(MM_IO_BASE_TMR + 0x60))
 
 #define TICKS_PER_uSEC     TIMER0_FREQUENCY_MHZ
 
@@ -189,10 +212,7 @@ void __init bcmring_amba_init(void)
  *
  */
 #define mSEC_1                          1000
-#define mSEC_5                          (mSEC_1 * 5)
 #define mSEC_10                         (mSEC_1 * 10)
-#define mSEC_25                         (mSEC_1 * 25)
-#define SEC_1                           (mSEC_1 * 1000)
 
 /*
  * How long is the timer interval?
@@ -279,53 +299,13 @@ static struct irqaction bcmring_timer_irq = {
 	.handler = bcmring_timer_interrupt,
 };
 
-static cycle_t bcmring_get_cycles_timer1(struct clocksource *cs)
-{
-	return ~readl(TIMER1_VA_BASE + TIMER_VALUE);
-}
-
-static cycle_t bcmring_get_cycles_timer3(struct clocksource *cs)
-{
-	return ~readl(TIMER3_VA_BASE + TIMER_VALUE);
-}
-
-static struct clocksource clocksource_bcmring_timer1 = {
-	.name = "timer1",
-	.rating = 200,
-	.read = bcmring_get_cycles_timer1,
-	.mask = CLOCKSOURCE_MASK(32),
-	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
-static struct clocksource clocksource_bcmring_timer3 = {
-	.name = "timer3",
-	.rating = 100,
-	.read = bcmring_get_cycles_timer3,
-	.mask = CLOCKSOURCE_MASK(32),
-	.flags = CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
 static int __init bcmring_clocksource_init(void)
 {
 	/* setup timer1 as free-running clocksource */
-	writel(0, TIMER1_VA_BASE + TIMER_CTRL);
-	writel(0xffffffff, TIMER1_VA_BASE + TIMER_LOAD);
-	writel(0xffffffff, TIMER1_VA_BASE + TIMER_VALUE);
-	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
-	       TIMER1_VA_BASE + TIMER_CTRL);
-
-	clocksource_register_khz(&clocksource_bcmring_timer1,
-				 TIMER1_FREQUENCY_MHZ * 1000);
+	sp804_clocksource_init(TIMER1_VA_BASE, "timer1");
 
 	/* setup timer3 as free-running clocksource */
-	writel(0, TIMER3_VA_BASE + TIMER_CTRL);
-	writel(0xffffffff, TIMER3_VA_BASE + TIMER_LOAD);
-	writel(0xffffffff, TIMER3_VA_BASE + TIMER_VALUE);
-	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
-	       TIMER3_VA_BASE + TIMER_CTRL);
-
-	clocksource_register_khz(&clocksource_bcmring_timer3,
-				 TIMER3_FREQUENCY_KHZ);
+	sp804_clocksource_init(TIMER3_VA_BASE, "timer3");
 
 	return 0;
 }
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 19/19] ARM: bcmring: convert to use sp804 clockevents
  2011-05-16 17:23 ` Russell King - ARM Linux
                   ` (18 preceding siblings ...)
  (?)
@ 2011-05-16 17:31 ` Russell King - ARM Linux
  2011-05-17 23:04   ` [PATCH] ARM: bcmring: fix patches to convert to " Jiandong Zheng
  -1 siblings, 1 reply; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

bcmring has a set of four sp804 timers incorporated, yet it has its
own copy of the sp804 code.  Convert its clockevent implementation
to the standard sp804 support code.

Cc: Jiandong Zheng <jdzheng@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-bcmring/core.c |  118 +++---------------------------------------
 1 files changed, 8 insertions(+), 110 deletions(-)

diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c
index 0ea33ff..c323ae9 100644
--- a/arch/arm/mach-bcmring/core.c
+++ b/arch/arm/mach-bcmring/core.c
@@ -28,8 +28,6 @@
 #include <linux/sysdev.h>
 #include <linux/interrupt.h>
 #include <linux/amba/bus.h>
-#include <linux/clocksource.h>
-#include <linux/clockchips.h>
 #include <linux/clkdev.h>
 
 #include <mach/csp/mm_addr.h>
@@ -113,8 +111,8 @@ static struct clk dummy_apb_pclk = {
 #define TIMER3_FREQUENCY_KHZ  (tmrHw_HIGH_FREQUENCY_HZ / 1000)
 #endif
 
-static struct clk sp804_timer1_clk = {
-	.name = "sp804-timer-1",
+static struct clk sp804_timer012_clk = {
+	.name = "sp804-timer-0,1,2",
 	.type = CLK_TYPE_PRIMARY,
 	.mode = CLK_MODE_XTAL,
 	.rate_hz = TIMER1_FREQUENCY_MHZ * 1000000,
@@ -137,10 +135,14 @@ static struct clk_lookup lookups[] = {
 	}, {			/* UART1 */
 		.dev_id = "uartb",
 		.clk = &uart_clk,
+	}, {			/* SP804 timer 0 */
+		.dev_id = "sp804",
+		.con_id = "timer0",
+		.clk = &sp804_timer012_clk,
 	}, {			/* SP804 timer 1 */
 		.dev_id = "sp804",
 		.con_id = "timer1",
-		.clk = &sp804_timer1_clk,
+		.clk = &sp804_timer012_clk,
 	}, {			/* SP804 timer 3 */
 		.dev_id = "sp804",
 		.con_id = "timer3",
@@ -205,100 +207,6 @@ void __init bcmring_amba_init(void)
 #define TIMER2_VA_BASE		((void __iomem *)(MM_IO_BASE_TMR + 0x40))
 #define TIMER3_VA_BASE          ((void __iomem *)(MM_IO_BASE_TMR + 0x60))
 
-#define TICKS_PER_uSEC     TIMER0_FREQUENCY_MHZ
-
-/*
- *  These are useconds NOT ticks.
- *
- */
-#define mSEC_1                          1000
-#define mSEC_10                         (mSEC_1 * 10)
-
-/*
- * How long is the timer interval?
- */
-#define TIMER_INTERVAL	(TICKS_PER_uSEC * mSEC_10)
-#if TIMER_INTERVAL >= 0x100000
-#define TIMER_RELOAD	(TIMER_INTERVAL >> 8)
-#define TIMER_DIVISOR	(TIMER_CTRL_DIV256)
-#define TICKS2USECS(x)	(256 * (x) / TICKS_PER_uSEC)
-#elif TIMER_INTERVAL >= 0x10000
-#define TIMER_RELOAD	(TIMER_INTERVAL >> 4)	/* Divide by 16 */
-#define TIMER_DIVISOR	(TIMER_CTRL_DIV16)
-#define TICKS2USECS(x)	(16 * (x) / TICKS_PER_uSEC)
-#else
-#define TIMER_RELOAD	(TIMER_INTERVAL)
-#define TIMER_DIVISOR	(TIMER_CTRL_DIV1)
-#define TICKS2USECS(x)	((x) / TICKS_PER_uSEC)
-#endif
-
-static void timer_set_mode(enum clock_event_mode mode,
-			   struct clock_event_device *clk)
-{
-	unsigned long ctrl;
-
-	switch (mode) {
-	case CLOCK_EVT_MODE_PERIODIC:
-		writel(TIMER_RELOAD, TIMER0_VA_BASE + TIMER_LOAD);
-
-		ctrl = TIMER_CTRL_PERIODIC;
-		ctrl |=
-		    TIMER_DIVISOR | TIMER_CTRL_32BIT | TIMER_CTRL_IE |
-		    TIMER_CTRL_ENABLE;
-		break;
-	case CLOCK_EVT_MODE_ONESHOT:
-		/* period set, and timer enabled in 'next_event' hook */
-		ctrl = TIMER_CTRL_ONESHOT;
-		ctrl |= TIMER_DIVISOR | TIMER_CTRL_32BIT | TIMER_CTRL_IE;
-		break;
-	case CLOCK_EVT_MODE_UNUSED:
-	case CLOCK_EVT_MODE_SHUTDOWN:
-	default:
-		ctrl = 0;
-	}
-
-	writel(ctrl, TIMER0_VA_BASE + TIMER_CTRL);
-}
-
-static int timer_set_next_event(unsigned long evt,
-				struct clock_event_device *unused)
-{
-	unsigned long ctrl = readl(TIMER0_VA_BASE + TIMER_CTRL);
-
-	writel(evt, TIMER0_VA_BASE + TIMER_LOAD);
-	writel(ctrl | TIMER_CTRL_ENABLE, TIMER0_VA_BASE + TIMER_CTRL);
-
-	return 0;
-}
-
-static struct clock_event_device timer0_clockevent = {
-	.name = "timer0",
-	.shift = 32,
-	.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
-	.set_mode = timer_set_mode,
-	.set_next_event = timer_set_next_event,
-};
-
-/*
- * IRQ handler for the timer
- */
-static irqreturn_t bcmring_timer_interrupt(int irq, void *dev_id)
-{
-	struct clock_event_device *evt = &timer0_clockevent;
-
-	writel(1, TIMER0_VA_BASE + TIMER_INTCLR);
-
-	evt->event_handler(evt);
-
-	return IRQ_HANDLED;
-}
-
-static struct irqaction bcmring_timer_irq = {
-	.name = "bcmring Timer Tick",
-	.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
-	.handler = bcmring_timer_interrupt,
-};
-
 static int __init bcmring_clocksource_init(void)
 {
 	/* setup timer1 as free-running clocksource */
@@ -327,19 +235,9 @@ void __init bcmring_init_timer(void)
 	/*
 	 * Make irqs happen for the system timer
 	 */
-	setup_irq(IRQ_TIMER0, &bcmring_timer_irq);
-
 	bcmring_clocksource_init();
 
-	timer0_clockevent.mult =
-	    div_sc(1000000, NSEC_PER_SEC, timer0_clockevent.shift);
-	timer0_clockevent.max_delta_ns =
-	    clockevent_delta2ns(0xffffffff, &timer0_clockevent);
-	timer0_clockevent.min_delta_ns =
-	    clockevent_delta2ns(0xf, &timer0_clockevent);
-
-	timer0_clockevent.cpumask = cpumask_of(0);
-	clockevents_register_device(&timer0_clockevent);
+	sp804_clockevents_register(TIMER0_VA_BASE, IRQ_TIMER0, "timer0");
 }
 
 struct sys_timer bcmring_timer = {
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 07/19] clocksource: convert ARM 32-bit up counting clocksources
  2011-05-16 17:27 ` [PATCH 07/19] clocksource: convert ARM 32-bit up counting clocksources Russell King - ARM Linux
@ 2011-05-16 18:30   ` Eric Miao
  2011-05-17  6:38   ` Sascha Hauer
  1 sibling, 0 replies; 56+ messages in thread
From: Eric Miao @ 2011-05-16 18:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 17, 2011 at 1:27 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> Convert ixp4xx, lpc32xx, mxc, netx, pxa, sa1100, tcc8k, tegra and u300
> to use the generic mmio clocksource recently introduced.
>
> Cc: Imre Kaloz <kaloz@openwrt.org>
> Cc: Krzysztof Halasa <khc@pm.waw.pl>
> Cc: Eric Miao <eric.y.miao@gmail.com>

Acked-by: Eric Miao <eric.y.miao@gmail.com>

> Acked-by: "Hans J. Koch" <hjk@hansjkoch.de>
> Acked-by: Colin Cross <ccross@android.com>
> Cc: Erik Gilling <konkers@android.com>
> Cc: Olof Johansson <olof@lixom.net>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> Cc: Sascha Hauer <kernel@pengutronix.de>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> ---
> ?arch/arm/Kconfig ? ? ? ? ? ? ?| ? ?9 +++++++++
> ?arch/arm/mach-ixp4xx/common.c | ? 16 ++--------------
> ?arch/arm/mach-lpc32xx/timer.c | ? 17 +++--------------
> ?arch/arm/mach-netx/time.c ? ? | ? 16 ++--------------
> ?arch/arm/mach-pxa/time.c ? ? ?| ? 17 ++---------------
> ?arch/arm/mach-sa1100/time.c ? | ? 16 ++--------------
> ?arch/arm/mach-tcc8k/time.c ? ?| ? 16 ++--------------
> ?arch/arm/mach-tegra/timer.c ? | ? 16 ++--------------
> ?arch/arm/mach-u300/timer.c ? ?| ? 18 +++---------------
> ?arch/arm/plat-mxc/time.c ? ? ?| ? 38 +++++++-------------------------------
> ?10 files changed, 34 insertions(+), 145 deletions(-)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 377a7a5..9aa5514 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -366,6 +366,7 @@ config ARCH_MXC
> ? ? ? ?select GENERIC_CLOCKEVENTS
> ? ? ? ?select ARCH_REQUIRE_GPIOLIB
> ? ? ? ?select CLKDEV_LOOKUP
> + ? ? ? select CLKSRC_MMIO
> ? ? ? ?select HAVE_SCHED_CLOCK
> ? ? ? ?help
> ? ? ? ? ?Support for Freescale MXC/iMX-based family of processors
> @@ -390,6 +391,7 @@ config ARCH_STMP3XXX
>
> ?config ARCH_NETX
> ? ? ? ?bool "Hilscher NetX based"
> + ? ? ? select CLKSRC_MMIO
> ? ? ? ?select CPU_ARM926T
> ? ? ? ?select ARM_VIC
> ? ? ? ?select GENERIC_CLOCKEVENTS
> @@ -457,6 +459,7 @@ config ARCH_IXP2000
> ?config ARCH_IXP4XX
> ? ? ? ?bool "IXP4xx-based"
> ? ? ? ?depends on MMU
> + ? ? ? select CLKSRC_MMIO
> ? ? ? ?select CPU_XSCALE
> ? ? ? ?select GENERIC_GPIO
> ? ? ? ?select GENERIC_CLOCKEVENTS
> @@ -497,6 +500,7 @@ config ARCH_LOKI
>
> ?config ARCH_LPC32XX
> ? ? ? ?bool "NXP LPC32XX"
> + ? ? ? select CLKSRC_MMIO
> ? ? ? ?select CPU_ARM926T
> ? ? ? ?select ARCH_REQUIRE_GPIOLIB
> ? ? ? ?select HAVE_IDE
> @@ -592,6 +596,7 @@ config ARCH_NUC93X
> ?config ARCH_TEGRA
> ? ? ? ?bool "NVIDIA Tegra"
> ? ? ? ?select CLKDEV_LOOKUP
> + ? ? ? select CLKSRC_MMIO
> ? ? ? ?select GENERIC_TIME
> ? ? ? ?select GENERIC_CLOCKEVENTS
> ? ? ? ?select GENERIC_GPIO
> @@ -617,6 +622,7 @@ config ARCH_PXA
> ? ? ? ?select ARCH_MTD_XIP
> ? ? ? ?select ARCH_HAS_CPUFREQ
> ? ? ? ?select CLKDEV_LOOKUP
> + ? ? ? select CLKSRC_MMIO
> ? ? ? ?select ARCH_REQUIRE_GPIOLIB
> ? ? ? ?select GENERIC_CLOCKEVENTS
> ? ? ? ?select HAVE_SCHED_CLOCK
> @@ -667,6 +673,7 @@ config ARCH_RPC
>
> ?config ARCH_SA1100
> ? ? ? ?bool "SA1100-based"
> + ? ? ? select CLKSRC_MMIO
> ? ? ? ?select CPU_SA1100
> ? ? ? ?select ISA
> ? ? ? ?select ARCH_SPARSEMEM_ENABLE
> @@ -803,6 +810,7 @@ config ARCH_SHARK
>
> ?config ARCH_TCC_926
> ? ? ? ?bool "Telechips TCC ARM926-based systems"
> + ? ? ? select CLKSRC_MMIO
> ? ? ? ?select CPU_ARM926T
> ? ? ? ?select HAVE_CLK
> ? ? ? ?select CLKDEV_LOOKUP
> @@ -813,6 +821,7 @@ config ARCH_TCC_926
> ?config ARCH_U300
> ? ? ? ?bool "ST-Ericsson U300 Series"
> ? ? ? ?depends on MMU
> + ? ? ? select CLKSRC_MMIO
> ? ? ? ?select CPU_ARM926T
> ? ? ? ?select HAVE_SCHED_CLOCK
> ? ? ? ?select HAVE_TCM
> diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
> index ed19bc3..74ed81a 100644
> --- a/arch/arm/mach-ixp4xx/common.c
> +++ b/arch/arm/mach-ixp4xx/common.c
> @@ -419,26 +419,14 @@ static void notrace ixp4xx_update_sched_clock(void)
> ?/*
> ?* clocksource
> ?*/
> -static cycle_t ixp4xx_get_cycles(struct clocksource *cs)
> -{
> - ? ? ? return *IXP4XX_OSTS;
> -}
> -
> -static struct clocksource clocksource_ixp4xx = {
> - ? ? ? .name ? ? ? ? ? = "OSTS",
> - ? ? ? .rating ? ? ? ? = 200,
> - ? ? ? .read ? ? ? ? ? = ixp4xx_get_cycles,
> - ? ? ? .mask ? ? ? ? ? = CLOCKSOURCE_MASK(32),
> - ? ? ? .flags ? ? ? ? ?= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
> ?unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ;
> ?EXPORT_SYMBOL(ixp4xx_timer_freq);
> ?static void __init ixp4xx_clocksource_init(void)
> ?{
> ? ? ? ?init_sched_clock(&cd, ixp4xx_update_sched_clock, 32, ixp4xx_timer_freq);
>
> - ? ? ? clocksource_register_hz(&clocksource_ixp4xx, ixp4xx_timer_freq);
> + ? ? ? clocksource_mmio_init(&IXP4XX_OSTS, "OSTS", ixp4xx_timer_freq, 200, 32,
> + ? ? ? ? ? ? ? ? ? ? ? clocksource_mmio_readl_up);
> ?}
>
> ?/*
> diff --git a/arch/arm/mach-lpc32xx/timer.c b/arch/arm/mach-lpc32xx/timer.c
> index 6162ac3..b42c909 100644
> --- a/arch/arm/mach-lpc32xx/timer.c
> +++ b/arch/arm/mach-lpc32xx/timer.c
> @@ -31,19 +31,6 @@
> ?#include <mach/platform.h>
> ?#include "common.h"
>
> -static cycle_t lpc32xx_clksrc_read(struct clocksource *cs)
> -{
> - ? ? ? return (cycle_t)__raw_readl(LCP32XX_TIMER_TC(LPC32XX_TIMER1_BASE));
> -}
> -
> -static struct clocksource lpc32xx_clksrc = {
> - ? ? ? .name ? = "lpc32xx_clksrc",
> - ? ? ? .rating = 300,
> - ? ? ? .read ? = lpc32xx_clksrc_read,
> - ? ? ? .mask ? = CLOCKSOURCE_MASK(32),
> - ? ? ? .flags ?= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
> ?static int lpc32xx_clkevt_next_event(unsigned long delta,
> ? ? struct clock_event_device *dev)
> ?{
> @@ -170,7 +157,9 @@ static void __init lpc32xx_timer_init(void)
> ? ? ? ?__raw_writel(0, LCP32XX_TIMER_MCR(LPC32XX_TIMER1_BASE));
> ? ? ? ?__raw_writel(LCP32XX_TIMER_CNTR_TCR_EN,
> ? ? ? ? ? ? ? ?LCP32XX_TIMER_TCR(LPC32XX_TIMER1_BASE));
> - ? ? ? clocksource_register_hz(&lpc32xx_clksrc, clkrate);
> +
> + ? ? ? clocksource_mmio_init(LCP32XX_TIMER_TC(LPC32XX_TIMER1_BASE),
> + ? ? ? ? ? ? ? "lpc32xx_clksrc", clkrate, 300, 32, clocksource_mmio_readl_up);
> ?}
>
> ?struct sys_timer lpc32xx_timer = {
> diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c
> index f12f22d..e24c141 100644
> --- a/arch/arm/mach-netx/time.c
> +++ b/arch/arm/mach-netx/time.c
> @@ -104,19 +104,6 @@ static struct irqaction netx_timer_irq = {
> ? ? ? ?.handler ? ? ? ?= netx_timer_interrupt,
> ?};
>
> -cycle_t netx_get_cycles(struct clocksource *cs)
> -{
> - ? ? ? return readl(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE));
> -}
> -
> -static struct clocksource clocksource_netx = {
> - ? ? ? .name ? ? ? ? ? = "netx_timer",
> - ? ? ? .rating ? ? ? ? = 200,
> - ? ? ? .read ? ? ? ? ? = netx_get_cycles,
> - ? ? ? .mask ? ? ? ? ? = CLOCKSOURCE_MASK(32),
> - ? ? ? .flags ? ? ? ? ?= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
> ?/*
> ?* Set up timer interrupt
> ?*/
> @@ -150,7 +137,8 @@ static void __init netx_timer_init(void)
> ? ? ? ?writel(NETX_GPIO_COUNTER_CTRL_RUN,
> ? ? ? ? ? ? ? ? ? ? ? ?NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKSOURCE));
>
> - ? ? ? clocksource_register_hz(&clocksource_netx, CLOCK_TICK_RATE);
> + ? ? ? clocksource_mmio_init(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE),
> + ? ? ? ? ? ? ? "netx_timer", CLOCK_TICK_RATE, 200, 32, clocksource_mmio_readl_up);
>
> ? ? ? ?netx_clockevent.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC,
> ? ? ? ? ? ? ? ? ? ? ? ?netx_clockevent.shift);
> diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
> index 428da3f..de68470 100644
> --- a/arch/arm/mach-pxa/time.c
> +++ b/arch/arm/mach-pxa/time.c
> @@ -105,19 +105,6 @@ static struct clock_event_device ckevt_pxa_osmr0 = {
> ? ? ? ?.set_mode ? ? ? = pxa_osmr0_set_mode,
> ?};
>
> -static cycle_t pxa_read_oscr(struct clocksource *cs)
> -{
> - ? ? ? return OSCR;
> -}
> -
> -static struct clocksource cksrc_pxa_oscr0 = {
> - ? ? ? .name ? ? ? ? ? = "oscr0",
> - ? ? ? .rating ? ? ? ? = 200,
> - ? ? ? .read ? ? ? ? ? = pxa_read_oscr,
> - ? ? ? .mask ? ? ? ? ? = CLOCKSOURCE_MASK(32),
> - ? ? ? .flags ? ? ? ? ?= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
> ?static struct irqaction pxa_ost0_irq = {
> ? ? ? ?.name ? ? ? ? ? = "ost0",
> ? ? ? ?.flags ? ? ? ? ?= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
> @@ -134,7 +121,6 @@ static void __init pxa_timer_init(void)
>
> ? ? ? ?init_sched_clock(&cd, pxa_update_sched_clock, 32, clock_tick_rate);
>
> - ? ? ? clocksource_calc_mult_shift(&cksrc_pxa_oscr0, clock_tick_rate, 4);
> ? ? ? ?clockevents_calc_mult_shift(&ckevt_pxa_osmr0, clock_tick_rate, 4);
> ? ? ? ?ckevt_pxa_osmr0.max_delta_ns =
> ? ? ? ? ? ? ? ?clockevent_delta2ns(0x7fffffff, &ckevt_pxa_osmr0);
> @@ -144,7 +130,8 @@ static void __init pxa_timer_init(void)
>
> ? ? ? ?setup_irq(IRQ_OST0, &pxa_ost0_irq);
>
> - ? ? ? clocksource_register_hz(&cksrc_pxa_oscr0, clock_tick_rate);
> + ? ? ? clocksource_mmio_init(&OSCR, "oscr0", clock_tick_rate, 200, 32,
> + ? ? ? ? ? ? ? clocksource_mmio_readl_up);
> ? ? ? ?clockevents_register_device(&ckevt_pxa_osmr0);
> ?}
>
> diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
> index 51c0529..fa66024 100644
> --- a/arch/arm/mach-sa1100/time.c
> +++ b/arch/arm/mach-sa1100/time.c
> @@ -97,19 +97,6 @@ static struct clock_event_device ckevt_sa1100_osmr0 = {
> ? ? ? ?.set_mode ? ? ? = sa1100_osmr0_set_mode,
> ?};
>
> -static cycle_t sa1100_read_oscr(struct clocksource *s)
> -{
> - ? ? ? return OSCR;
> -}
> -
> -static struct clocksource cksrc_sa1100_oscr = {
> - ? ? ? .name ? ? ? ? ? = "oscr",
> - ? ? ? .rating ? ? ? ? = 200,
> - ? ? ? .read ? ? ? ? ? = sa1100_read_oscr,
> - ? ? ? .mask ? ? ? ? ? = CLOCKSOURCE_MASK(32),
> - ? ? ? .flags ? ? ? ? ?= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
> ?static struct irqaction sa1100_timer_irq = {
> ? ? ? ?.name ? ? ? ? ? = "ost0",
> ? ? ? ?.flags ? ? ? ? ?= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
> @@ -134,7 +121,8 @@ static void __init sa1100_timer_init(void)
>
> ? ? ? ?setup_irq(IRQ_OST0, &sa1100_timer_irq);
>
> - ? ? ? clocksource_register_hz(&cksrc_sa1100_oscr, CLOCK_TICK_RATE);
> + ? ? ? clocksource_mmio_init(&OSCR, "oscr", CLOCK_TICK_RATE, 200, 32,
> + ? ? ? ? ? ? ? clocksource_mmio_readl_up);
> ? ? ? ?clockevents_register_device(&ckevt_sa1100_osmr0);
> ?}
>
> diff --git a/arch/arm/mach-tcc8k/time.c b/arch/arm/mach-tcc8k/time.c
> index e0a8d60..a96babe 100644
> --- a/arch/arm/mach-tcc8k/time.c
> +++ b/arch/arm/mach-tcc8k/time.c
> @@ -25,19 +25,6 @@
>
> ?static void __iomem *timer_base;
>
> -static cycle_t tcc_get_cycles(struct clocksource *cs)
> -{
> - ? ? ? return __raw_readl(timer_base + TC32MCNT_OFFS);
> -}
> -
> -static struct clocksource clocksource_tcc = {
> - ? ? ? .name ? ? ? ? ? = "tcc_tc32",
> - ? ? ? .rating ? ? ? ? = 200,
> - ? ? ? .read ? ? ? ? ? = tcc_get_cycles,
> - ? ? ? .mask ? ? ? ? ? = CLOCKSOURCE_MASK(32),
> - ? ? ? .flags ? ? ? ? ?= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
> ?static int tcc_set_next_event(unsigned long evt,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct clock_event_device *unused)
> ?{
> @@ -102,7 +89,8 @@ static int __init tcc_clockevent_init(struct clk *clock)
> ?{
> ? ? ? ?unsigned int c = clk_get_rate(clock);
>
> - ? ? ? clocksource_register_hz(&clocksource_tcc, c);
> + ? ? ? clocksource_mmio_init(timer_base + TC32MCNT_OFFS, "tcc_tc32", c,
> + ? ? ? ? ? ? ? 200, 32, clocksource_mmio_readl_up);
>
> ? ? ? ?clockevent_tcc.mult = div_sc(c, NSEC_PER_SEC,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?clockevent_tcc.shift);
> diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
> index 0fcb1eb..9035042 100644
> --- a/arch/arm/mach-tegra/timer.c
> +++ b/arch/arm/mach-tegra/timer.c
> @@ -98,11 +98,6 @@ static void tegra_timer_set_mode(enum clock_event_mode mode,
> ? ? ? ?}
> ?}
>
> -static cycle_t tegra_clocksource_read(struct clocksource *cs)
> -{
> - ? ? ? return timer_readl(TIMERUS_CNTR_1US);
> -}
> -
> ?static struct clock_event_device tegra_clockevent = {
> ? ? ? ?.name ? ? ? ? ? = "timer0",
> ? ? ? ?.rating ? ? ? ? = 300,
> @@ -111,14 +106,6 @@ static struct clock_event_device tegra_clockevent = {
> ? ? ? ?.set_mode ? ? ? = tegra_timer_set_mode,
> ?};
>
> -static struct clocksource tegra_clocksource = {
> - ? ? ? .name ? = "timer_us",
> - ? ? ? .rating = 300,
> - ? ? ? .read ? = tegra_clocksource_read,
> - ? ? ? .mask ? = CLOCKSOURCE_MASK(32),
> - ? ? ? .flags ?= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
> ?static DEFINE_CLOCK_DATA(cd);
>
> ?/*
> @@ -234,7 +221,8 @@ static void __init tegra_init_timer(void)
> ? ? ? ?init_fixed_sched_clock(&cd, tegra_update_sched_clock, 32,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 1000000, SC_MULT, SC_SHIFT);
>
> - ? ? ? if (clocksource_register_hz(&tegra_clocksource, 1000000)) {
> + ? ? ? if (clocksource_mmio_init(timer_reg_base + TIMERUS_CNTR_1US,
> + ? ? ? ? ? ? ? "timer_us", 1000000, 300, 32, clocksource_mmio_readl_up)) {
> ? ? ? ? ? ? ? ?printk(KERN_ERR "Failed to register clocksource\n");
> ? ? ? ? ? ? ? ?BUG();
> ? ? ? ?}
> diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
> index 3ec58bd..891cf44 100644
> --- a/arch/arm/mach-u300/timer.c
> +++ b/arch/arm/mach-u300/timer.c
> @@ -333,20 +333,6 @@ static struct irqaction u300_timer_irq = {
> ? ? ? ?.handler ? ? ? ?= u300_timer_interrupt,
> ?};
>
> -/* Use general purpose timer 2 as clock source */
> -static cycle_t u300_get_cycles(struct clocksource *cs)
> -{
> - ? ? ? return (cycles_t) readl(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC);
> -}
> -
> -static struct clocksource clocksource_u300_1mhz = {
> - ? ? ? .name ? ? ? ? ? = "GPT2",
> - ? ? ? .rating ? ? ? ? = 300, /* Reasonably fast and accurate clock source */
> - ? ? ? .read ? ? ? ? ? = u300_get_cycles,
> - ? ? ? .mask ? ? ? ? ? = CLOCKSOURCE_MASK(32), /* 32 bits */
> - ? ? ? .flags ? ? ? ? ?= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
> ?/*
> ?* Override the global weak sched_clock symbol with this
> ?* local implementation which uses the clocksource to get some
> @@ -422,7 +408,9 @@ static void __init u300_timer_init(void)
> ? ? ? ?writel(U300_TIMER_APP_EGPT2_TIMER_ENABLE,
> ? ? ? ? ? ? ? ?U300_TIMER_APP_VBASE + U300_TIMER_APP_EGPT2);
>
> - ? ? ? if (clocksource_register_hz(&clocksource_u300_1mhz, rate))
> + ? ? ? /* Use general purpose timer 2 as clock source */
> + ? ? ? if (clocksource_mmio_init(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC,
> + ? ? ? ? ? ? ? ? ? ? ? "GPT2", rate, 300, 32, clocksource_mmio_readl_up))
> ? ? ? ? ? ? ? ?printk(KERN_ERR "timer: failed to initialize clock "
> ? ? ? ? ? ? ? ? ? ? ? "source %s\n", clocksource_u300_1mhz.name);
>
> diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
> index 2237ff8..e4ac94a 100644
> --- a/arch/arm/plat-mxc/time.c
> +++ b/arch/arm/plat-mxc/time.c
> @@ -106,56 +106,32 @@ static void gpt_irq_acknowledge(void)
> ? ? ? ? ? ? ? ?__raw_writel(V2_TSTAT_OF1, timer_base + V2_TSTAT);
> ?}
>
> -static cycle_t dummy_get_cycles(struct clocksource *cs)
> -{
> - ? ? ? return 0;
> -}
> -
> -static cycle_t mx1_2_get_cycles(struct clocksource *cs)
> -{
> - ? ? ? return __raw_readl(timer_base + MX1_2_TCN);
> -}
> -
> -static cycle_t v2_get_cycles(struct clocksource *cs)
> -{
> - ? ? ? return __raw_readl(timer_base + V2_TCN);
> -}
> -
> -static struct clocksource clocksource_mxc = {
> - ? ? ? .name ? ? ? ? ? = "mxc_timer1",
> - ? ? ? .rating ? ? ? ? = 200,
> - ? ? ? .read ? ? ? ? ? = dummy_get_cycles,
> - ? ? ? .mask ? ? ? ? ? = CLOCKSOURCE_MASK(32),
> - ? ? ? .flags ? ? ? ? ?= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> +static void __iomem *sched_clock_reg;
>
> ?static DEFINE_CLOCK_DATA(cd);
> ?unsigned long long notrace sched_clock(void)
> ?{
> - ? ? ? cycle_t cyc = clocksource_mxc.read(&clocksource_mxc);
> + ? ? ? cycle_t cyc = sched_clock_reg ? __raw_readl(sched_clock_reg) : 0;
>
> ? ? ? ?return cyc_to_sched_clock(&cd, cyc, (u32)~0);
> ?}
>
> ?static void notrace mxc_update_sched_clock(void)
> ?{
> - ? ? ? cycle_t cyc = clocksource_mxc.read(&clocksource_mxc);
> + ? ? ? cycle_t cyc = sched_clock_reg ? __raw_readl(sched_clock_reg) : 0;
> ? ? ? ?update_sched_clock(&cd, cyc, (u32)~0);
> ?}
>
> ?static int __init mxc_clocksource_init(struct clk *timer_clk)
> ?{
> ? ? ? ?unsigned int c = clk_get_rate(timer_clk);
> + ? ? ? void __iomem *reg = timer_base + (timer_is_v2() ? V2_TCN : MX1_2_TCN);
>
> - ? ? ? if (timer_is_v2())
> - ? ? ? ? ? ? ? clocksource_mxc.read = v2_get_cycles;
> - ? ? ? else
> - ? ? ? ? ? ? ? clocksource_mxc.read = mx1_2_get_cycles;
> + ? ? ? sched_clock_reg = reg;
>
> ? ? ? ?init_sched_clock(&cd, mxc_update_sched_clock, 32, c);
> - ? ? ? clocksource_register_hz(&clocksource_mxc, c);
> -
> - ? ? ? return 0;
> + ? ? ? return clocksource_mmio_init(reg, "mxc_timer1", c, 200, 32,
> + ? ? ? ? ? ? ? ? ? ? ? clocksource_mmio_readl_up);
> ?}
>
> ?/* clock event */
> --
> 1.7.4.4
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 17/19] clockevents: ARM sp804: obtain sp804 timer rate via clks
  2011-05-16 17:31 ` [PATCH 17/19] clockevents: ARM sp804: obtain sp804 timer rate via clks Russell King - ARM Linux
@ 2011-05-16 21:24   ` Rob Herring
  2011-05-16 21:34     ` Russell King - ARM Linux
  2011-05-23 10:56   ` Catalin Marinas
  1 sibling, 1 reply; 56+ messages in thread
From: Rob Herring @ 2011-05-16 21:24 UTC (permalink / raw)
  To: linux-arm-kernel

On 05/16/2011 12:31 PM, Russell King - ARM Linux wrote:
> This allows platforms to specify the rate of the SP804 clockevent via
> the clk subsystem.  While ARM boards clock these at 1MHz, BCMRing also
> has SP804 timers but are clocked at different rates.
>
> Cc: Catalin Marinas<catalin.marinas@arm.com>
> Signed-off-by: Russell King<rmk+kernel@arm.linux.org.uk>
> ---
>   arch/arm/common/timer-sp.c        |   16 ++++++++--------
>   arch/arm/mach-vexpress/ct-ca9x4.c |    4 ++++
>   arch/arm/mach-vexpress/v2m.c      |    4 ++++
>   3 files changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
> index bf92afe..1707c92 100644
> --- a/arch/arm/common/timer-sp.c
> +++ b/arch/arm/common/timer-sp.c
> @@ -28,12 +28,6 @@
>
>   #include<asm/hardware/arm_timer.h>
>
> -/*
> - * These timers are currently always setup to be clocked at 1MHz.
> - */
> -#define TIMER_FREQ_KHZ	(1000)
> -#define TIMER_RELOAD	(TIMER_FREQ_KHZ * 1000 / HZ)
> -
>   static long __init sp804_get_clock_rate(const char *name)
>   {
>   	struct clk *clk;
> @@ -84,6 +78,7 @@ void __init sp804_clocksource_init(void __iomem *base, const char *name)
>
>
>   static void __iomem *clkevt_base;
> +static unsigned long clkevt_reload;
>
>   /*
>    * IRQ handler for the timer
> @@ -109,7 +104,7 @@ static void sp804_set_mode(enum clock_event_mode mode,
>
>   	switch (mode) {
>   	case CLOCK_EVT_MODE_PERIODIC:
> -		writel(TIMER_RELOAD, clkevt_base + TIMER_LOAD);
> +		writel(clkevt_reload, clkevt_base + TIMER_LOAD);
>   		ctrl |= TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
>   		break;
>
> @@ -158,12 +153,17 @@ void __init sp804_clockevents_init(void __iomem *base, unsigned int irq,
>   	const char *name)
>   {
>   	struct clock_event_device *evt =&sp804_clockevent;
> +	long rate = sp804_get_clock_rate(name);
> +
> +	if (rate<  0)
> +		return;
>
>   	clkevt_base = base;
> +	clkevt_reload = DIV_ROUND_CLOSEST(rate, HZ);
>
>   	evt->name = name;
>   	evt->irq = irq;
> -	evt->mult = div_sc(TIMER_FREQ_KHZ, NSEC_PER_MSEC, evt->shift);
> +	evt->mult = div_sc(rate, SEC_PER_MSEC, evt->shift);

This doesn't compile or make sense. Should be NSEC_PER_SEC.

Rob

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 16/19] clockevents: ARM sp804: allow clockevent name to be specified
  2011-05-16 17:30 ` [PATCH 16/19] clockevents: ARM sp804: allow clockevent name to be specified Russell King - ARM Linux
@ 2011-05-16 21:25   ` Rob Herring
  2011-05-16 21:33     ` Russell King - ARM Linux
  2011-05-23 10:55   ` Catalin Marinas
  1 sibling, 1 reply; 56+ messages in thread
From: Rob Herring @ 2011-05-16 21:25 UTC (permalink / raw)
  To: linux-arm-kernel

On 05/16/2011 12:30 PM, Russell King - ARM Linux wrote:
> This allows platforms to specify the clcokevent name upon registration.
>
> Cc: Catalin Marinas<catalin.marinas@arm.com>
> Signed-off-by: Russell King<rmk+kernel@arm.linux.org.uk>
> ---
>   arch/arm/common/timer-sp.c               |    7 ++++---
>   arch/arm/include/asm/hardware/timer-sp.h |    2 +-
>   arch/arm/mach-integrator/integrator_cp.c |    2 +-
>   arch/arm/mach-realview/core.c            |    2 +-
>   arch/arm/mach-versatile/core.c           |    2 +-
>   arch/arm/mach-vexpress/ct-ca9x4.c        |    3 ++-
>   arch/arm/mach-vexpress/v2m.c             |    3 ++-
>   7 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
> index 45a5eb8..bf92afe 100644
> --- a/arch/arm/common/timer-sp.c
> +++ b/arch/arm/common/timer-sp.c
> @@ -139,7 +139,6 @@ static int sp804_set_next_event(unsigned long next,
>   }
>
>   static struct clock_event_device sp804_clockevent = {
> -	.name		= "timer0",
>   	.shift		= 32,
>   	.features       = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
>   	.set_mode	= sp804_set_mode,
> @@ -155,13 +154,15 @@ static struct irqaction sp804_timer_irq = {
>   	.dev_id		=&sp804_clockevent,
>   };
>
> -void __init sp804_clockevents_init(void __iomem *base, unsigned int timer_irq)
> +void __init sp804_clockevents_init(void __iomem *base, unsigned int irq,
> +	const char *name)
>   {
>   	struct clock_event_device *evt =&sp804_clockevent;
>
>   	clkevt_base = base;
>
> -	evt->irq = timer_irq;
> +	evt->name = name;
> +	evt->irq = irq;

Also need to change timer_irq to irq in setup_irq farther down in this 
function.

Rob

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 16/19] clockevents: ARM sp804: allow clockevent name to be specified
  2011-05-16 21:25   ` Rob Herring
@ 2011-05-16 21:33     ` Russell King - ARM Linux
  0 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 21:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 16, 2011 at 04:25:43PM -0500, Rob Herring wrote:
> On 05/16/2011 12:30 PM, Russell King - ARM Linux wrote:
>> This allows platforms to specify the clcokevent name upon registration.
>>
>> Cc: Catalin Marinas<catalin.marinas@arm.com>
>> Signed-off-by: Russell King<rmk+kernel@arm.linux.org.uk>
>> ---
>>   arch/arm/common/timer-sp.c               |    7 ++++---
>>   arch/arm/include/asm/hardware/timer-sp.h |    2 +-
>>   arch/arm/mach-integrator/integrator_cp.c |    2 +-
>>   arch/arm/mach-realview/core.c            |    2 +-
>>   arch/arm/mach-versatile/core.c           |    2 +-
>>   arch/arm/mach-vexpress/ct-ca9x4.c        |    3 ++-
>>   arch/arm/mach-vexpress/v2m.c             |    3 ++-
>>   7 files changed, 12 insertions(+), 9 deletions(-)
>>
>> diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
>> index 45a5eb8..bf92afe 100644
>> --- a/arch/arm/common/timer-sp.c
>> +++ b/arch/arm/common/timer-sp.c
>> @@ -139,7 +139,6 @@ static int sp804_set_next_event(unsigned long next,
>>   }
>>
>>   static struct clock_event_device sp804_clockevent = {
>> -	.name		= "timer0",
>>   	.shift		= 32,
>>   	.features       = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
>>   	.set_mode	= sp804_set_mode,
>> @@ -155,13 +154,15 @@ static struct irqaction sp804_timer_irq = {
>>   	.dev_id		=&sp804_clockevent,
>>   };
>>
>> -void __init sp804_clockevents_init(void __iomem *base, unsigned int timer_irq)
>> +void __init sp804_clockevents_init(void __iomem *base, unsigned int irq,
>> +	const char *name)
>>   {
>>   	struct clock_event_device *evt =&sp804_clockevent;
>>
>>   	clkevt_base = base;
>>
>> -	evt->irq = timer_irq;
>> +	evt->name = name;
>> +	evt->irq = irq;
>
> Also need to change timer_irq to irq in setup_irq farther down in this  
> function.

Grr.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 17/19] clockevents: ARM sp804: obtain sp804 timer rate via clks
  2011-05-16 21:24   ` Rob Herring
@ 2011-05-16 21:34     ` Russell King - ARM Linux
  0 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 16, 2011 at 04:24:27PM -0500, Rob Herring wrote:
> On 05/16/2011 12:31 PM, Russell King - ARM Linux wrote:
>> -	evt->mult = div_sc(TIMER_FREQ_KHZ, NSEC_PER_MSEC, evt->shift);
>> +	evt->mult = div_sc(rate, SEC_PER_MSEC, evt->shift);
>
> This doesn't compile or make sense. Should be NSEC_PER_SEC.

Grr.  Fixed too.  No idea how that crap happened, but thanks for catching
it all.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 15/19] clocksource: ARM sp804: obtain sp804 timer rate via clks
  2011-05-16 17:30 ` [PATCH 15/19] clocksource: ARM sp804: obtain sp804 timer rate via clks Russell King - ARM Linux
@ 2011-05-16 22:18   ` Rob Herring
  2011-05-16 22:34     ` Russell King - ARM Linux
  0 siblings, 1 reply; 56+ messages in thread
From: Rob Herring @ 2011-05-16 22:18 UTC (permalink / raw)
  To: linux-arm-kernel

On 05/16/2011 12:30 PM, Russell King - ARM Linux wrote:
> This allows platforms to specify the rate of the SP804 clocksource via
> the clk subsystem.  While ARM boards clock these at 1MHz, BCMRing also
> has SP804 timers but are clocked at different rates.
>
> Acked-by: Catalin Marinas<catalin.marinas@arm.com>
> Signed-off-by: Russell King<rmk+kernel@arm.linux.org.uk>
> ---
>   arch/arm/common/timer-sp.c               |   39 +++++++++++++++++++++++++++++-
>   arch/arm/mach-integrator/integrator_cp.c |    7 +++++
>   arch/arm/mach-realview/core.c            |    9 ++++++-
>   arch/arm/mach-versatile/core.c           |    9 ++++++-
>   arch/arm/mach-vexpress/ct-ca9x4.c        |    8 ++++++
>   arch/arm/mach-vexpress/v2m.c             |    8 ++++++
>   6 files changed, 77 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
> index f6b9011..45a5eb8 100644
> --- a/arch/arm/common/timer-sp.c
> +++ b/arch/arm/common/timer-sp.c
> @@ -18,8 +18,10 @@
>    * along with this program; if not, write to the Free Software
>    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
>    */
> +#include<linux/clk.h>
>   #include<linux/clocksource.h>
>   #include<linux/clockchips.h>
> +#include<linux/err.h>
>   #include<linux/interrupt.h>
>   #include<linux/irq.h>
>   #include<linux/io.h>
> @@ -32,8 +34,43 @@
>   #define TIMER_FREQ_KHZ	(1000)
>   #define TIMER_RELOAD	(TIMER_FREQ_KHZ * 1000 / HZ)
>
> +static long __init sp804_get_clock_rate(const char *name)
> +{
> +	struct clk *clk;
> +	long rate;
> +	int err;
> +
> +	clk = clk_get_sys("sp804", name);
> +	if (IS_ERR(clk)) {
> +		pr_err("sp804: %s clock not found: %d\n", name,
> +			(int)PTR_ERR(clk));
> +		return PTR_ERR(clk);
> +	}
> +
> +	err = clk_enable(clk);
> +	if (err) {
> +		pr_err("sp804: %s clock failed to enable: %d\n", name, err);
> +		clk_put(clk);
> +		return err;
> +	}
> +
> +	rate = clk_get_rate(clk);
> +	if (rate<  0) {
> +		pr_err("sp804: %s clock failed to get rate: %ld\n", name, err);

err should be rate.

Rob

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 15/19] clocksource: ARM sp804: obtain sp804 timer rate via clks
  2011-05-16 22:18   ` Rob Herring
@ 2011-05-16 22:34     ` Russell King - ARM Linux
  0 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-16 22:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 16, 2011 at 05:18:21PM -0500, Rob Herring wrote:
> On 05/16/2011 12:30 PM, Russell King - ARM Linux wrote:
>> +	rate = clk_get_rate(clk);
>> +	if (rate<  0) {
>> +		pr_err("sp804: %s clock failed to get rate: %ld\n", name, err);
>
> err should be rate.

Yup, already spotted that and fixed.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 07/19] clocksource: convert ARM 32-bit up counting clocksources
  2011-05-16 17:27 ` [PATCH 07/19] clocksource: convert ARM 32-bit up counting clocksources Russell King - ARM Linux
  2011-05-16 18:30   ` Eric Miao
@ 2011-05-17  6:38   ` Sascha Hauer
  1 sibling, 0 replies; 56+ messages in thread
From: Sascha Hauer @ 2011-05-17  6:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 16, 2011 at 06:27:55PM +0100, Russell King - ARM Linux wrote:
> Convert ixp4xx, lpc32xx, mxc, netx, pxa, sa1100, tcc8k, tegra and u300
> to use the generic mmio clocksource recently introduced.
> 
> Cc: Imre Kaloz <kaloz@openwrt.org>
> Cc: Krzysztof Halasa <khc@pm.waw.pl>
> Cc: Eric Miao <eric.y.miao@gmail.com>
> Acked-by: "Hans J. Koch" <hjk@hansjkoch.de>
> Acked-by: Colin Cross <ccross@android.com>
> Cc: Erik Gilling <konkers@android.com>
> Cc: Olof Johansson <olof@lixom.net>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> Cc: Sascha Hauer <kernel@pengutronix.de>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

> ---
>  arch/arm/Kconfig              |    9 +++++++++
>  arch/arm/mach-ixp4xx/common.c |   16 ++--------------
>  arch/arm/mach-lpc32xx/timer.c |   17 +++--------------
>  arch/arm/mach-netx/time.c     |   16 ++--------------
>  arch/arm/mach-pxa/time.c      |   17 ++---------------
>  arch/arm/mach-sa1100/time.c   |   16 ++--------------
>  arch/arm/mach-tcc8k/time.c    |   16 ++--------------
>  arch/arm/mach-tegra/timer.c   |   16 ++--------------
>  arch/arm/mach-u300/timer.c    |   18 +++---------------
>  arch/arm/plat-mxc/time.c      |   38 +++++++-------------------------------
>  10 files changed, 34 insertions(+), 145 deletions(-)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 377a7a5..9aa5514 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -366,6 +366,7 @@ config ARCH_MXC
>  	select GENERIC_CLOCKEVENTS
>  	select ARCH_REQUIRE_GPIOLIB
>  	select CLKDEV_LOOKUP
> +	select CLKSRC_MMIO
>  	select HAVE_SCHED_CLOCK
>  	help
>  	  Support for Freescale MXC/iMX-based family of processors
> @@ -390,6 +391,7 @@ config ARCH_STMP3XXX
>  
>  config ARCH_NETX
>  	bool "Hilscher NetX based"
> +	select CLKSRC_MMIO
>  	select CPU_ARM926T
>  	select ARM_VIC
>  	select GENERIC_CLOCKEVENTS
> @@ -457,6 +459,7 @@ config ARCH_IXP2000
>  config ARCH_IXP4XX
>  	bool "IXP4xx-based"
>  	depends on MMU
> +	select CLKSRC_MMIO
>  	select CPU_XSCALE
>  	select GENERIC_GPIO
>  	select GENERIC_CLOCKEVENTS
> @@ -497,6 +500,7 @@ config ARCH_LOKI
>  
>  config ARCH_LPC32XX
>  	bool "NXP LPC32XX"
> +	select CLKSRC_MMIO
>  	select CPU_ARM926T
>  	select ARCH_REQUIRE_GPIOLIB
>  	select HAVE_IDE
> @@ -592,6 +596,7 @@ config ARCH_NUC93X
>  config ARCH_TEGRA
>  	bool "NVIDIA Tegra"
>  	select CLKDEV_LOOKUP
> +	select CLKSRC_MMIO
>  	select GENERIC_TIME
>  	select GENERIC_CLOCKEVENTS
>  	select GENERIC_GPIO
> @@ -617,6 +622,7 @@ config ARCH_PXA
>  	select ARCH_MTD_XIP
>  	select ARCH_HAS_CPUFREQ
>  	select CLKDEV_LOOKUP
> +	select CLKSRC_MMIO
>  	select ARCH_REQUIRE_GPIOLIB
>  	select GENERIC_CLOCKEVENTS
>  	select HAVE_SCHED_CLOCK
> @@ -667,6 +673,7 @@ config ARCH_RPC
>  
>  config ARCH_SA1100
>  	bool "SA1100-based"
> +	select CLKSRC_MMIO
>  	select CPU_SA1100
>  	select ISA
>  	select ARCH_SPARSEMEM_ENABLE
> @@ -803,6 +810,7 @@ config ARCH_SHARK
>  
>  config ARCH_TCC_926
>  	bool "Telechips TCC ARM926-based systems"
> +	select CLKSRC_MMIO
>  	select CPU_ARM926T
>  	select HAVE_CLK
>  	select CLKDEV_LOOKUP
> @@ -813,6 +821,7 @@ config ARCH_TCC_926
>  config ARCH_U300
>  	bool "ST-Ericsson U300 Series"
>  	depends on MMU
> +	select CLKSRC_MMIO
>  	select CPU_ARM926T
>  	select HAVE_SCHED_CLOCK
>  	select HAVE_TCM
> diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
> index ed19bc3..74ed81a 100644
> --- a/arch/arm/mach-ixp4xx/common.c
> +++ b/arch/arm/mach-ixp4xx/common.c
> @@ -419,26 +419,14 @@ static void notrace ixp4xx_update_sched_clock(void)
>  /*
>   * clocksource
>   */
> -static cycle_t ixp4xx_get_cycles(struct clocksource *cs)
> -{
> -	return *IXP4XX_OSTS;
> -}
> -
> -static struct clocksource clocksource_ixp4xx = {
> -	.name 		= "OSTS",
> -	.rating		= 200,
> -	.read		= ixp4xx_get_cycles,
> -	.mask		= CLOCKSOURCE_MASK(32),
> -	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
>  unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ;
>  EXPORT_SYMBOL(ixp4xx_timer_freq);
>  static void __init ixp4xx_clocksource_init(void)
>  {
>  	init_sched_clock(&cd, ixp4xx_update_sched_clock, 32, ixp4xx_timer_freq);
>  
> -	clocksource_register_hz(&clocksource_ixp4xx, ixp4xx_timer_freq);
> +	clocksource_mmio_init(&IXP4XX_OSTS, "OSTS", ixp4xx_timer_freq, 200, 32,
> +			clocksource_mmio_readl_up);
>  }
>  
>  /*
> diff --git a/arch/arm/mach-lpc32xx/timer.c b/arch/arm/mach-lpc32xx/timer.c
> index 6162ac3..b42c909 100644
> --- a/arch/arm/mach-lpc32xx/timer.c
> +++ b/arch/arm/mach-lpc32xx/timer.c
> @@ -31,19 +31,6 @@
>  #include <mach/platform.h>
>  #include "common.h"
>  
> -static cycle_t lpc32xx_clksrc_read(struct clocksource *cs)
> -{
> -	return (cycle_t)__raw_readl(LCP32XX_TIMER_TC(LPC32XX_TIMER1_BASE));
> -}
> -
> -static struct clocksource lpc32xx_clksrc = {
> -	.name	= "lpc32xx_clksrc",
> -	.rating	= 300,
> -	.read	= lpc32xx_clksrc_read,
> -	.mask	= CLOCKSOURCE_MASK(32),
> -	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
>  static int lpc32xx_clkevt_next_event(unsigned long delta,
>      struct clock_event_device *dev)
>  {
> @@ -170,7 +157,9 @@ static void __init lpc32xx_timer_init(void)
>  	__raw_writel(0, LCP32XX_TIMER_MCR(LPC32XX_TIMER1_BASE));
>  	__raw_writel(LCP32XX_TIMER_CNTR_TCR_EN,
>  		LCP32XX_TIMER_TCR(LPC32XX_TIMER1_BASE));
> -	clocksource_register_hz(&lpc32xx_clksrc, clkrate);
> +
> +	clocksource_mmio_init(LCP32XX_TIMER_TC(LPC32XX_TIMER1_BASE),
> +		"lpc32xx_clksrc", clkrate, 300, 32, clocksource_mmio_readl_up);
>  }
>  
>  struct sys_timer lpc32xx_timer = {
> diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c
> index f12f22d..e24c141 100644
> --- a/arch/arm/mach-netx/time.c
> +++ b/arch/arm/mach-netx/time.c
> @@ -104,19 +104,6 @@ static struct irqaction netx_timer_irq = {
>  	.handler	= netx_timer_interrupt,
>  };
>  
> -cycle_t netx_get_cycles(struct clocksource *cs)
> -{
> -	return readl(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE));
> -}
> -
> -static struct clocksource clocksource_netx = {
> -	.name		= "netx_timer",
> -	.rating		= 200,
> -	.read		= netx_get_cycles,
> -	.mask		= CLOCKSOURCE_MASK(32),
> -	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
>  /*
>   * Set up timer interrupt
>   */
> @@ -150,7 +137,8 @@ static void __init netx_timer_init(void)
>  	writel(NETX_GPIO_COUNTER_CTRL_RUN,
>  			NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKSOURCE));
>  
> -	clocksource_register_hz(&clocksource_netx, CLOCK_TICK_RATE);
> +	clocksource_mmio_init(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE),
> +		"netx_timer", CLOCK_TICK_RATE, 200, 32, clocksource_mmio_readl_up);
>  
>  	netx_clockevent.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC,
>  			netx_clockevent.shift);
> diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
> index 428da3f..de68470 100644
> --- a/arch/arm/mach-pxa/time.c
> +++ b/arch/arm/mach-pxa/time.c
> @@ -105,19 +105,6 @@ static struct clock_event_device ckevt_pxa_osmr0 = {
>  	.set_mode	= pxa_osmr0_set_mode,
>  };
>  
> -static cycle_t pxa_read_oscr(struct clocksource *cs)
> -{
> -	return OSCR;
> -}
> -
> -static struct clocksource cksrc_pxa_oscr0 = {
> -	.name           = "oscr0",
> -	.rating         = 200,
> -	.read           = pxa_read_oscr,
> -	.mask           = CLOCKSOURCE_MASK(32),
> -	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
>  static struct irqaction pxa_ost0_irq = {
>  	.name		= "ost0",
>  	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
> @@ -134,7 +121,6 @@ static void __init pxa_timer_init(void)
>  
>  	init_sched_clock(&cd, pxa_update_sched_clock, 32, clock_tick_rate);
>  
> -	clocksource_calc_mult_shift(&cksrc_pxa_oscr0, clock_tick_rate, 4);
>  	clockevents_calc_mult_shift(&ckevt_pxa_osmr0, clock_tick_rate, 4);
>  	ckevt_pxa_osmr0.max_delta_ns =
>  		clockevent_delta2ns(0x7fffffff, &ckevt_pxa_osmr0);
> @@ -144,7 +130,8 @@ static void __init pxa_timer_init(void)
>  
>  	setup_irq(IRQ_OST0, &pxa_ost0_irq);
>  
> -	clocksource_register_hz(&cksrc_pxa_oscr0, clock_tick_rate);
> +	clocksource_mmio_init(&OSCR, "oscr0", clock_tick_rate, 200, 32,
> +		clocksource_mmio_readl_up);
>  	clockevents_register_device(&ckevt_pxa_osmr0);
>  }
>  
> diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
> index 51c0529..fa66024 100644
> --- a/arch/arm/mach-sa1100/time.c
> +++ b/arch/arm/mach-sa1100/time.c
> @@ -97,19 +97,6 @@ static struct clock_event_device ckevt_sa1100_osmr0 = {
>  	.set_mode	= sa1100_osmr0_set_mode,
>  };
>  
> -static cycle_t sa1100_read_oscr(struct clocksource *s)
> -{
> -	return OSCR;
> -}
> -
> -static struct clocksource cksrc_sa1100_oscr = {
> -	.name		= "oscr",
> -	.rating		= 200,
> -	.read		= sa1100_read_oscr,
> -	.mask		= CLOCKSOURCE_MASK(32),
> -	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
>  static struct irqaction sa1100_timer_irq = {
>  	.name		= "ost0",
>  	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
> @@ -134,7 +121,8 @@ static void __init sa1100_timer_init(void)
>  
>  	setup_irq(IRQ_OST0, &sa1100_timer_irq);
>  
> -	clocksource_register_hz(&cksrc_sa1100_oscr, CLOCK_TICK_RATE);
> +	clocksource_mmio_init(&OSCR, "oscr", CLOCK_TICK_RATE, 200, 32,
> +		clocksource_mmio_readl_up);
>  	clockevents_register_device(&ckevt_sa1100_osmr0);
>  }
>  
> diff --git a/arch/arm/mach-tcc8k/time.c b/arch/arm/mach-tcc8k/time.c
> index e0a8d60..a96babe 100644
> --- a/arch/arm/mach-tcc8k/time.c
> +++ b/arch/arm/mach-tcc8k/time.c
> @@ -25,19 +25,6 @@
>  
>  static void __iomem *timer_base;
>  
> -static cycle_t tcc_get_cycles(struct clocksource *cs)
> -{
> -	return __raw_readl(timer_base + TC32MCNT_OFFS);
> -}
> -
> -static struct clocksource clocksource_tcc = {
> -	.name		= "tcc_tc32",
> -	.rating		= 200,
> -	.read		= tcc_get_cycles,
> -	.mask		= CLOCKSOURCE_MASK(32),
> -	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
>  static int tcc_set_next_event(unsigned long evt,
>  			      struct clock_event_device *unused)
>  {
> @@ -102,7 +89,8 @@ static int __init tcc_clockevent_init(struct clk *clock)
>  {
>  	unsigned int c = clk_get_rate(clock);
>  
> -	clocksource_register_hz(&clocksource_tcc, c);
> +	clocksource_mmio_init(timer_base + TC32MCNT_OFFS, "tcc_tc32", c,
> +		200, 32, clocksource_mmio_readl_up);
>  
>  	clockevent_tcc.mult = div_sc(c, NSEC_PER_SEC,
>  					clockevent_tcc.shift);
> diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
> index 0fcb1eb..9035042 100644
> --- a/arch/arm/mach-tegra/timer.c
> +++ b/arch/arm/mach-tegra/timer.c
> @@ -98,11 +98,6 @@ static void tegra_timer_set_mode(enum clock_event_mode mode,
>  	}
>  }
>  
> -static cycle_t tegra_clocksource_read(struct clocksource *cs)
> -{
> -	return timer_readl(TIMERUS_CNTR_1US);
> -}
> -
>  static struct clock_event_device tegra_clockevent = {
>  	.name		= "timer0",
>  	.rating		= 300,
> @@ -111,14 +106,6 @@ static struct clock_event_device tegra_clockevent = {
>  	.set_mode	= tegra_timer_set_mode,
>  };
>  
> -static struct clocksource tegra_clocksource = {
> -	.name	= "timer_us",
> -	.rating	= 300,
> -	.read	= tegra_clocksource_read,
> -	.mask	= CLOCKSOURCE_MASK(32),
> -	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
>  static DEFINE_CLOCK_DATA(cd);
>  
>  /*
> @@ -234,7 +221,8 @@ static void __init tegra_init_timer(void)
>  	init_fixed_sched_clock(&cd, tegra_update_sched_clock, 32,
>  			       1000000, SC_MULT, SC_SHIFT);
>  
> -	if (clocksource_register_hz(&tegra_clocksource, 1000000)) {
> +	if (clocksource_mmio_init(timer_reg_base + TIMERUS_CNTR_1US,
> +		"timer_us", 1000000, 300, 32, clocksource_mmio_readl_up)) {
>  		printk(KERN_ERR "Failed to register clocksource\n");
>  		BUG();
>  	}
> diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
> index 3ec58bd..891cf44 100644
> --- a/arch/arm/mach-u300/timer.c
> +++ b/arch/arm/mach-u300/timer.c
> @@ -333,20 +333,6 @@ static struct irqaction u300_timer_irq = {
>  	.handler        = u300_timer_interrupt,
>  };
>  
> -/* Use general purpose timer 2 as clock source */
> -static cycle_t u300_get_cycles(struct clocksource *cs)
> -{
> -	return (cycles_t) readl(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC);
> -}
> -
> -static struct clocksource clocksource_u300_1mhz = {
> -	.name           = "GPT2",
> -	.rating         = 300, /* Reasonably fast and accurate clock source */
> -	.read           = u300_get_cycles,
> -	.mask           = CLOCKSOURCE_MASK(32), /* 32 bits */
> -	.flags          = CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
>  /*
>   * Override the global weak sched_clock symbol with this
>   * local implementation which uses the clocksource to get some
> @@ -422,7 +408,9 @@ static void __init u300_timer_init(void)
>  	writel(U300_TIMER_APP_EGPT2_TIMER_ENABLE,
>  		U300_TIMER_APP_VBASE + U300_TIMER_APP_EGPT2);
>  
> -	if (clocksource_register_hz(&clocksource_u300_1mhz, rate))
> +	/* Use general purpose timer 2 as clock source */
> +	if (clocksource_mmio_init(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC,
> +			"GPT2", rate, 300, 32, clocksource_mmio_readl_up))
>  		printk(KERN_ERR "timer: failed to initialize clock "
>  		       "source %s\n", clocksource_u300_1mhz.name);
>  
> diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
> index 2237ff8..e4ac94a 100644
> --- a/arch/arm/plat-mxc/time.c
> +++ b/arch/arm/plat-mxc/time.c
> @@ -106,56 +106,32 @@ static void gpt_irq_acknowledge(void)
>  		__raw_writel(V2_TSTAT_OF1, timer_base + V2_TSTAT);
>  }
>  
> -static cycle_t dummy_get_cycles(struct clocksource *cs)
> -{
> -	return 0;
> -}
> -
> -static cycle_t mx1_2_get_cycles(struct clocksource *cs)
> -{
> -	return __raw_readl(timer_base + MX1_2_TCN);
> -}
> -
> -static cycle_t v2_get_cycles(struct clocksource *cs)
> -{
> -	return __raw_readl(timer_base + V2_TCN);
> -}
> -
> -static struct clocksource clocksource_mxc = {
> -	.name 		= "mxc_timer1",
> -	.rating		= 200,
> -	.read		= dummy_get_cycles,
> -	.mask		= CLOCKSOURCE_MASK(32),
> -	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> +static void __iomem *sched_clock_reg;
>  
>  static DEFINE_CLOCK_DATA(cd);
>  unsigned long long notrace sched_clock(void)
>  {
> -	cycle_t cyc = clocksource_mxc.read(&clocksource_mxc);
> +	cycle_t cyc = sched_clock_reg ? __raw_readl(sched_clock_reg) : 0;
>  
>  	return cyc_to_sched_clock(&cd, cyc, (u32)~0);
>  }
>  
>  static void notrace mxc_update_sched_clock(void)
>  {
> -	cycle_t cyc = clocksource_mxc.read(&clocksource_mxc);
> +	cycle_t cyc = sched_clock_reg ? __raw_readl(sched_clock_reg) : 0;
>  	update_sched_clock(&cd, cyc, (u32)~0);
>  }
>  
>  static int __init mxc_clocksource_init(struct clk *timer_clk)
>  {
>  	unsigned int c = clk_get_rate(timer_clk);
> +	void __iomem *reg = timer_base + (timer_is_v2() ? V2_TCN : MX1_2_TCN);
>  
> -	if (timer_is_v2())
> -		clocksource_mxc.read = v2_get_cycles;
> -	else
> -		clocksource_mxc.read = mx1_2_get_cycles;
> +	sched_clock_reg = reg;
>  
>  	init_sched_clock(&cd, mxc_update_sched_clock, 32, c);
> -	clocksource_register_hz(&clocksource_mxc, c);
> -
> -	return 0;
> +	return clocksource_mmio_init(reg, "mxc_timer1", c, 200, 32,
> +			clocksource_mmio_readl_up);
>  }
>  
>  /* clock event */
> -- 
> 1.7.4.4
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 04/19] ARM: omap1: convert to using readl/writel instead of volatile struct
  2011-05-16 17:26   ` Russell King - ARM Linux
@ 2011-05-17 21:59     ` Catalin Marinas
  -1 siblings, 0 replies; 56+ messages in thread
From: Catalin Marinas @ 2011-05-17 21:59 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: linux-arm-kernel, John Stultz, Thomas Gleixner, linux-omap

On 16 May 2011 18:26, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> --- a/arch/arm/mach-omap1/time.c
> +++ b/arch/arm/mach-omap1/time.c
...
>  static inline unsigned long notrace omap_mpu_timer_read(int nr)
>  {
> -       volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
> -       return timer->read_tim;
> +       omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
> +       return readl(&timer->read_tim);
>  }

We should start using the *_relaxed() accessors a bit more to avoid
the barriers overhead in the standard I/O accessors.

-- 
Catalin
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 04/19] ARM: omap1: convert to using readl/writel instead of volatile struct
@ 2011-05-17 21:59     ` Catalin Marinas
  0 siblings, 0 replies; 56+ messages in thread
From: Catalin Marinas @ 2011-05-17 21:59 UTC (permalink / raw)
  To: linux-arm-kernel

On 16 May 2011 18:26, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> --- a/arch/arm/mach-omap1/time.c
> +++ b/arch/arm/mach-omap1/time.c
...
> ?static inline unsigned long notrace omap_mpu_timer_read(int nr)
> ?{
> - ? ? ? volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
> - ? ? ? return timer->read_tim;
> + ? ? ? omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
> + ? ? ? return readl(&timer->read_tim);
> ?}

We should start using the *_relaxed() accessors a bit more to avoid
the barriers overhead in the standard I/O accessors.

-- 
Catalin

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH] ARM: bcmring: fix patches to convert to sp804 clockevents
  2011-05-16 17:31 ` [PATCH 19/19] ARM: bcmring: convert to use sp804 clockevents Russell King - ARM Linux
@ 2011-05-17 23:04   ` Jiandong Zheng
  2011-05-17 23:20     ` Russell King - ARM Linux
  0 siblings, 1 reply; 56+ messages in thread
From: Jiandong Zheng @ 2011-05-17 23:04 UTC (permalink / raw)
  To: linux-arm-kernel

Fix build and boot problem with original patches to convert bcmring
to use sp804 clockevents.

Signed-off-by: Jiandong Zheng <jdzheng@broadcom.com>
---
  arch/arm/mach-bcmring/core.c |    6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c
index c323ae9..299c275 100644
--- a/arch/arm/mach-bcmring/core.c
+++ b/arch/arm/mach-bcmring/core.c
@@ -191,8 +191,6 @@ void __init bcmring_amba_init(void)

  	chipcHw_busInterfaceClockEnable(bus_clock);

-	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
-
  	for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
  		struct amba_device *d = amba_devs[i];
  		amba_device_register(d, &iomem_resource);
@@ -232,12 +230,14 @@ void __init bcmring_init_timer(void)
  	writel(0, TIMER2_VA_BASE + TIMER_CTRL);
  	writel(0, TIMER3_VA_BASE + TIMER_CTRL);

+	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
  	/*
  	 * Make irqs happen for the system timer
  	 */
  	bcmring_clocksource_init();

-	sp804_clockevents_register(TIMER0_VA_BASE, IRQ_TIMER0, "timer0");
+	sp804_clockevents_init(TIMER0_VA_BASE, IRQ_TIMER0, "timer0");
  }

  struct sys_timer bcmring_timer = {
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH] ARM: bcmring: fix patches to convert to sp804 clockevents
  2011-05-17 23:04   ` [PATCH] ARM: bcmring: fix patches to convert to " Jiandong Zheng
@ 2011-05-17 23:20     ` Russell King - ARM Linux
  2011-05-17 23:42       ` Jiandong Zheng
  0 siblings, 1 reply; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-17 23:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 17, 2011 at 04:04:34PM -0700, Jiandong Zheng wrote:
> @@ -232,12 +230,14 @@ void __init bcmring_init_timer(void)
>  	writel(0, TIMER2_VA_BASE + TIMER_CTRL);
>  	writel(0, TIMER3_VA_BASE + TIMER_CTRL);
>
> +	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
> +

As we have the init_early callback in the machine record, can this be
done at that point, rather than sticking it in the timer init callback?

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH] ARM: bcmring: fix patches to convert to sp804 clockevents
  2011-05-17 23:20     ` Russell King - ARM Linux
@ 2011-05-17 23:42       ` Jiandong Zheng
  2011-05-18 15:46         ` Russell King - ARM Linux
  0 siblings, 1 reply; 56+ messages in thread
From: Jiandong Zheng @ 2011-05-17 23:42 UTC (permalink / raw)
  To: linux-arm-kernel

On 5/17/2011 4:20 PM, Russell King - ARM Linux wrote:
> On Tue, May 17, 2011 at 04:04:34PM -0700, Jiandong Zheng wrote:
>> @@ -232,12 +230,14 @@ void __init bcmring_init_timer(void)
>>   	writel(0, TIMER2_VA_BASE + TIMER_CTRL);
>>   	writel(0, TIMER3_VA_BASE + TIMER_CTRL);
>>
>> +	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
>> +
>
> As we have the init_early callback in the machine record, can this be
> done at that point, rather than sticking it in the timer init callback?
>
It should be OK as long as the table is added early enough but leave it 
here make it a little easier to understand the init order.

clkdev_add_table() was called by init_machine() which is too late while 
some other machines still do similar thing. Should we move 
clkdev_add_table() to init_early for all SoC using sp804?

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 04/19] ARM: omap1: convert to using readl/writel instead of volatile struct
  2011-05-17 21:59     ` Catalin Marinas
@ 2011-05-18  7:56       ` Russell King - ARM Linux
  -1 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-18  7:56 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: John Stultz, Thomas Gleixner, linux-omap, linux-arm-kernel

On Tue, May 17, 2011 at 10:59:28PM +0100, Catalin Marinas wrote:
> On 16 May 2011 18:26, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> > --- a/arch/arm/mach-omap1/time.c
> > +++ b/arch/arm/mach-omap1/time.c
> ...
> >  static inline unsigned long notrace omap_mpu_timer_read(int nr)
> >  {
> > -       volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
> > -       return timer->read_tim;
> > +       omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
> > +       return readl(&timer->read_tim);
> >  }
> 
> We should start using the *_relaxed() accessors a bit more to avoid
> the barriers overhead in the standard I/O accessors.

I thought about that, but when you look at patch 6, it'd change this.
I wanted to use the same accessor here as it ends up with in patch 6.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 04/19] ARM: omap1: convert to using readl/writel instead of volatile struct
@ 2011-05-18  7:56       ` Russell King - ARM Linux
  0 siblings, 0 replies; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-18  7:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 17, 2011 at 10:59:28PM +0100, Catalin Marinas wrote:
> On 16 May 2011 18:26, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> > --- a/arch/arm/mach-omap1/time.c
> > +++ b/arch/arm/mach-omap1/time.c
> ...
> > ?static inline unsigned long notrace omap_mpu_timer_read(int nr)
> > ?{
> > - ? ? ? volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
> > - ? ? ? return timer->read_tim;
> > + ? ? ? omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
> > + ? ? ? return readl(&timer->read_tim);
> > ?}
> 
> We should start using the *_relaxed() accessors a bit more to avoid
> the barriers overhead in the standard I/O accessors.

I thought about that, but when you look at patch 6, it'd change this.
I wanted to use the same accessor here as it ends up with in patch 6.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH] ARM: bcmring: fix patches to convert to sp804 clockevents
  2011-05-17 23:42       ` Jiandong Zheng
@ 2011-05-18 15:46         ` Russell King - ARM Linux
  2011-05-18 18:01           ` [PATCH] ARM: bcmring: Add clkdev table in init_early Jiandong Zheng
  0 siblings, 1 reply; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-18 15:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 17, 2011 at 04:42:26PM -0700, Jiandong Zheng wrote:
> On 5/17/2011 4:20 PM, Russell King - ARM Linux wrote:
>> On Tue, May 17, 2011 at 04:04:34PM -0700, Jiandong Zheng wrote:
>>> @@ -232,12 +230,14 @@ void __init bcmring_init_timer(void)
>>>   	writel(0, TIMER2_VA_BASE + TIMER_CTRL);
>>>   	writel(0, TIMER3_VA_BASE + TIMER_CTRL);
>>>
>>> +	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
>>> +
>>
>> As we have the init_early callback in the machine record, can this be
>> done at that point, rather than sticking it in the timer init callback?
>>
> It should be OK as long as the table is added early enough but leave it  
> here make it a little easier to understand the init order.
>
> clkdev_add_table() was called by init_machine() which is too late while  
> some other machines still do similar thing. Should we move  
> clkdev_add_table() to init_early for all SoC using sp804?

Yes please.  The order in which things are called is as the struct is
layed out:

fixup
reserve
map_io
init_early
init_irq
timer->init
init_machine

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH] ARM: bcmring: Add clkdev table in init_early
  2011-05-18 15:46         ` Russell King - ARM Linux
@ 2011-05-18 18:01           ` Jiandong Zheng
  2011-05-18 20:42             ` Russell King - ARM Linux
  0 siblings, 1 reply; 56+ messages in thread
From: Jiandong Zheng @ 2011-05-18 18:01 UTC (permalink / raw)
  To: linux-arm-kernel

ARM: bcmring: Move adding clkdev to init_early to make sure clkevent 
based on sp804 is initialized properly.

Signed-off-by: Jiandong Zheng <jdzheng@broadcom.com>
---
  arch/arm/mach-bcmring/arch.c |    1 +
  arch/arm/mach-bcmring/core.c |    7 +++++--
  arch/arm/mach-bcmring/core.h |    1 +
  3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-bcmring/arch.c b/arch/arm/mach-bcmring/arch.c
index 73eb066..a604b9e 100644
--- a/arch/arm/mach-bcmring/arch.c
+++ b/arch/arm/mach-bcmring/arch.c
@@ -169,6 +169,7 @@ MACHINE_START(BCMRING, "BCMRING")
  	/* Maintainer: Broadcom Corporation */
  	.fixup = bcmring_fixup,
  	.map_io = bcmring_map_io,
+	.init_early = bcmring_init_early,
  	.init_irq = bcmring_init_irq,
  	.timer = &bcmring_timer,
  	.init_machine = bcmring_init_machine
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c
index 299c275..430da12 100644
--- a/arch/arm/mach-bcmring/core.c
+++ b/arch/arm/mach-bcmring/core.c
@@ -230,8 +230,6 @@ void __init bcmring_init_timer(void)
  	writel(0, TIMER2_VA_BASE + TIMER_CTRL);
  	writel(0, TIMER3_VA_BASE + TIMER_CTRL);

-        clkdev_add_table(lookups, ARRAY_SIZE(lookups));
-
  	/*
  	 * Make irqs happen for the system timer
  	 */
@@ -243,3 +241,8 @@ void __init bcmring_init_timer(void)
  struct sys_timer bcmring_timer = {
  	.init = bcmring_init_timer,
  };
+
+void __init bcmring_init_early(void)
+{
+	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+}
diff --git a/arch/arm/mach-bcmring/core.h b/arch/arm/mach-bcmring/core.h
index b197ba4..e0e02c4 100644
--- a/arch/arm/mach-bcmring/core.h
+++ b/arch/arm/mach-bcmring/core.h
@@ -25,6 +25,7 @@
  void __init bcmring_amba_init(void);
  void __init bcmring_map_io(void);
  void __init bcmring_init_irq(void);
+void __init bcmring_init_early(void);

  extern struct sys_timer bcmring_timer;
  #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH] ARM: bcmring: Add clkdev table in init_early
  2011-05-18 18:01           ` [PATCH] ARM: bcmring: Add clkdev table in init_early Jiandong Zheng
@ 2011-05-18 20:42             ` Russell King - ARM Linux
  2011-05-18 22:37               ` Russell King - ARM Linux
  0 siblings, 1 reply; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-18 20:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 18, 2011 at 11:01:09AM -0700, Jiandong Zheng wrote:
> ARM: bcmring: Move adding clkdev to init_early to make sure clkevent  
> based on sp804 is initialized properly.

Great, can you submit this to the patch system please?  Thanks.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 04/19] ARM: omap1: convert to using readl/writel instead of volatile struct
  2011-05-17 21:59     ` Catalin Marinas
@ 2011-05-18 20:48       ` Linus Walleij
  -1 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2011-05-18 20:48 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Russell King - ARM Linux, John Stultz, Thomas Gleixner,
	linux-omap, linux-arm-kernel

2011/5/17 Catalin Marinas <catalin.marinas@arm.com>:
> On 16 May 2011 18:26, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
>> --- a/arch/arm/mach-omap1/time.c
>> +++ b/arch/arm/mach-omap1/time.c
> ...
>>  static inline unsigned long notrace omap_mpu_timer_read(int nr)
>>  {
>> -       volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
>> -       return timer->read_tim;
>> +       omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
>> +       return readl(&timer->read_tim);
>>  }
>
> We should start using the *_relaxed() accessors a bit more to avoid
> the barriers overhead in the standard I/O accessors.

Speaking of which.

The documentation for the *_relaxed calls are in
Documentation/DocBook/deviceiobook.tmpl
and reads like this:

"PCI ordering rules also guarantee that PIO read responses arrive after any
outstanding DMA writes from that bus, since for some devices the
result of a readb
call may signal to the driver that a DMA transaction is complete. In many cases,
however, the driver may want to indicate that the next readb call has
no relation to
any previous DMA writes performed by the device. The driver can use
readb_relaxed for these cases, although only some platforms will honor
the relaxed
semantics. Using the relaxed read functions will provide significant performance
benefits on platforms that support it. The qla2xxx driver provides
examples of how
to use readX_relaxed. In many cases, a majority of the driver's readX calls can
safely be converted to readX_relaxed calls, since only a few will indicate or
depend on DMA completion."

I guess that in the ARM case "PCI DMA" corresponds to "bus mastering" but
is this strictly speaking properly describing the semantics of the ARM
*_relaxed operations?

If it isn't a hint on how it should be understood would be much appreciated.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 04/19] ARM: omap1: convert to using readl/writel instead of volatile struct
@ 2011-05-18 20:48       ` Linus Walleij
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2011-05-18 20:48 UTC (permalink / raw)
  To: linux-arm-kernel

2011/5/17 Catalin Marinas <catalin.marinas@arm.com>:
> On 16 May 2011 18:26, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
>> --- a/arch/arm/mach-omap1/time.c
>> +++ b/arch/arm/mach-omap1/time.c
> ...
>> ?static inline unsigned long notrace omap_mpu_timer_read(int nr)
>> ?{
>> - ? ? ? volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
>> - ? ? ? return timer->read_tim;
>> + ? ? ? omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(nr);
>> + ? ? ? return readl(&timer->read_tim);
>> ?}
>
> We should start using the *_relaxed() accessors a bit more to avoid
> the barriers overhead in the standard I/O accessors.

Speaking of which.

The documentation for the *_relaxed calls are in
Documentation/DocBook/deviceiobook.tmpl
and reads like this:

"PCI ordering rules also guarantee that PIO read responses arrive after any
outstanding DMA writes from that bus, since for some devices the
result of a readb
call may signal to the driver that a DMA transaction is complete. In many cases,
however, the driver may want to indicate that the next readb call has
no relation to
any previous DMA writes performed by the device. The driver can use
readb_relaxed for these cases, although only some platforms will honor
the relaxed
semantics. Using the relaxed read functions will provide significant performance
benefits on platforms that support it. The qla2xxx driver provides
examples of how
to use readX_relaxed. In many cases, a majority of the driver's readX calls can
safely be converted to readX_relaxed calls, since only a few will indicate or
depend on DMA completion."

I guess that in the ARM case "PCI DMA" corresponds to "bus mastering" but
is this strictly speaking properly describing the semantics of the ARM
*_relaxed operations?

If it isn't a hint on how it should be understood would be much appreciated.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH] ARM: bcmring: Add clkdev table in init_early
  2011-05-18 20:42             ` Russell King - ARM Linux
@ 2011-05-18 22:37               ` Russell King - ARM Linux
  2011-05-18 22:45                 ` Jiandong Zheng
  0 siblings, 1 reply; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-18 22:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 18, 2011 at 09:42:42PM +0100, Russell King - ARM Linux wrote:
> On Wed, May 18, 2011 at 11:01:09AM -0700, Jiandong Zheng wrote:
> > ARM: bcmring: Move adding clkdev to init_early to make sure clkevent  
> > based on sp804 is initialized properly.
> 
> Great, can you submit this to the patch system please?  Thanks.

Erm, actually this patch is against your previous patch (as is the one
which you submitted to the patch system) so it won't apply as-is.  It
needs to be one which wil apply directly to mainline in this case please.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH] ARM: bcmring: Add clkdev table in init_early
  2011-05-18 22:37               ` Russell King - ARM Linux
@ 2011-05-18 22:45                 ` Jiandong Zheng
  2011-05-18 22:52                   ` Russell King - ARM Linux
  0 siblings, 1 reply; 56+ messages in thread
From: Jiandong Zheng @ 2011-05-18 22:45 UTC (permalink / raw)
  To: linux-arm-kernel

On 5/18/2011 3:37 PM, Russell King - ARM Linux wrote:
> On Wed, May 18, 2011 at 09:42:42PM +0100, Russell King - ARM Linux wrote:
>> On Wed, May 18, 2011 at 11:01:09AM -0700, Jiandong Zheng wrote:
>>> ARM: bcmring: Move adding clkdev to init_early to make sure clkevent
>>> based on sp804 is initialized properly.
>>
>> Great, can you submit this to the patch system please?  Thanks.
>
> Erm, actually this patch is against your previous patch (as is the one
> which you submitted to the patch system) so it won't apply as-is.  It
> needs to be one which wil apply directly to mainline in this case please.
>
Hi Russell,

And my previous patch is based on your set of patches to do common sp804 
clock source. How should I submit mine?

Since I haven't had much experience with submitting patch so far, please 
allow me to ask a question which may be asked many times: when should I 
use patch system?

For example, I sent a couple of unrelated patches last week and seems no 
one has problem with them since I don't see comments regarding them. 
Should I submit them again through patch system or they will picked up 
"automatically"?

Thanks,
JD

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH] ARM: bcmring: Add clkdev table in init_early
  2011-05-18 22:45                 ` Jiandong Zheng
@ 2011-05-18 22:52                   ` Russell King - ARM Linux
  2011-05-18 23:38                     ` Jiandong Zheng
  0 siblings, 1 reply; 56+ messages in thread
From: Russell King - ARM Linux @ 2011-05-18 22:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 18, 2011 at 03:45:32PM -0700, Jiandong Zheng wrote:
> On 5/18/2011 3:37 PM, Russell King - ARM Linux wrote:
>> On Wed, May 18, 2011 at 09:42:42PM +0100, Russell King - ARM Linux wrote:
>>> On Wed, May 18, 2011 at 11:01:09AM -0700, Jiandong Zheng wrote:
>>>> ARM: bcmring: Move adding clkdev to init_early to make sure clkevent
>>>> based on sp804 is initialized properly.
>>>
>>> Great, can you submit this to the patch system please?  Thanks.
>>
>> Erm, actually this patch is against your previous patch (as is the one
>> which you submitted to the patch system) so it won't apply as-is.  It
>> needs to be one which wil apply directly to mainline in this case please.
>>
> Hi Russell,
>
> And my previous patch is based on your set of patches to do common sp804  
> clock source. How should I submit mine?

Can you provide a patch against mainline which moves the clkdev
initialization to the init_early callback - and I'll then deal with
fixing up my patches for that by placing it before my two bcmring
patches.

> Since I haven't had much experience with submitting patch so far, please  
> allow me to ask a question which may be asked many times: when should I  
> use patch system?

When the patch has been reviewed and acked by people.  Note that things
in this area will be changing because in the long run you should end
up talking to the sub-arch group of people.

> For example, I sent a couple of unrelated patches last week and seems no  
> one has problem with them since I don't see comments regarding them.  
> Should I submit them again through patch system or they will picked up  
> "automatically"?

The debug-macros.S one seemed trivial enough, but the downside is that
it impacts on our goal of showing a significant reduction of arch/arm...
Since I'm fairly desperate to show as much of a reduction as possible
this goes counter to my current direction.

I think the other one was a build fix (?), and that should be fine.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH] ARM: bcmring: Add clkdev table in init_early
  2011-05-18 22:52                   ` Russell King - ARM Linux
@ 2011-05-18 23:38                     ` Jiandong Zheng
  0 siblings, 0 replies; 56+ messages in thread
From: Jiandong Zheng @ 2011-05-18 23:38 UTC (permalink / raw)
  To: linux-arm-kernel

On 5/18/2011 3:52 PM, Russell King - ARM Linux wrote:
> On Wed, May 18, 2011 at 03:45:32PM -0700, Jiandong Zheng wrote:
>> On 5/18/2011 3:37 PM, Russell King - ARM Linux wrote:
>>> On Wed, May 18, 2011 at 09:42:42PM +0100, Russell King - ARM Linux wrote:
>>>> On Wed, May 18, 2011 at 11:01:09AM -0700, Jiandong Zheng wrote:
>>>>> ARM: bcmring: Move adding clkdev to init_early to make sure clkevent
>>>>> based on sp804 is initialized properly.
>>>>
>>>> Great, can you submit this to the patch system please?  Thanks.
>>>
>>> Erm, actually this patch is against your previous patch (as is the one
>>> which you submitted to the patch system) so it won't apply as-is.  It
>>> needs to be one which wil apply directly to mainline in this case please.
>>>
>> Hi Russell,
>>
>> And my previous patch is based on your set of patches to do common sp804
>> clock source. How should I submit mine?
>
> Can you provide a patch against mainline which moves the clkdev
> initialization to the init_early callback - and I'll then deal with
> fixing up my patches for that by placing it before my two bcmring
> patches.

Done.

>
>> Since I haven't had much experience with submitting patch so far, please
>> allow me to ask a question which may be asked many times: when should I
>> use patch system?
>
> When the patch has been reviewed and acked by people.  Note that things
> in this area will be changing because in the long run you should end
> up talking to the sub-arch group of people.
>
>> For example, I sent a couple of unrelated patches last week and seems no
>> one has problem with them since I don't see comments regarding them.
>> Should I submit them again through patch system or they will picked up
>> "automatically"?
>
> The debug-macros.S one seemed trivial enough, but the downside is that
> it impacts on our goal of showing a significant reduction of arch/arm...
> Since I'm fairly desperate to show as much of a reduction as possible
> this goes counter to my current direction.
>
> I think the other one was a build fix (?), and that should be fine.
>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/19] Make clocksource name const
  2011-05-16 17:25   ` Russell King - ARM Linux
@ 2011-05-19  1:24     ` Hans J. Koch
  -1 siblings, 0 replies; 56+ messages in thread
From: Hans J. Koch @ 2011-05-19  1:24 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Kukjin Kim, Eric Miao, Linus Walleij, Erik Gilling,
	Nicolas Pitre, Tony Lindgren, John Stultz, Krzysztof Halasa,
	linux-omap, Hans J. Koch, Sascha Hauer, Colin Cross,
	Olof Johansson, Thomas Gleixner, Imre Kaloz, Wan ZongShun,
	Lennert Buytenhek, linux-arm-kernel, Alessandro Rubini

On Mon, May 16, 2011 at 06:25:54PM +0100, Russell King - ARM Linux wrote:
> As nothing should be writing to the clocksource name string, make the
> clocksource name pointer const.  Build-tested on ARM Versatile Express.
> 
> Cc: Alessandro Rubini <rubini@unipv.it>
> Cc: Colin Cross <ccross@android.com>
> Cc: Eric Miao <eric.y.miao@gmail.com>
> Cc: Erik Gilling <konkers@android.com>
> Cc: "Hans J. Koch" <hjk@hansjkoch.de>
> Cc: Imre Kaloz <kaloz@openwrt.org>
> Cc: Krzysztof Halasa <khc@pm.waw.pl>
> Cc: Kukjin Kim <kgene.kim@samsung.com>
> Cc: Lennert Buytenhek <kernel@wantstofly.org>
> Cc: Linus Walleij <linus.walleij@stericsson.com>
> Cc: linux-omap@vger.kernel.org
> Cc: Nicolas Pitre <nico@fluxnic.net>
> Cc: Olof Johansson <olof@lixom.net>
> Cc: Sascha Hauer <kernel@pengutronix.de>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Viresh Kumar <viresh.kumar@st.com>
> Cc: Wan ZongShun <mcuos.com@gmail.com>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Acked-by: "Hans J. Koch" <hjk@hansjkoch.de>

> ---
>  include/linux/clocksource.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
> index c37b21a..94c1f38 100644
> --- a/include/linux/clocksource.h
> +++ b/include/linux/clocksource.h
> @@ -161,7 +161,7 @@ struct clocksource {
>  	/*
>  	 * First part of structure is read mostly
>  	 */
> -	char *name;
> +	const char *name;
>  	struct list_head list;
>  	int rating;
>  	cycle_t (*read)(struct clocksource *cs);
> -- 
> 1.7.4.4
> 
> 

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 01/19] Make clocksource name const
@ 2011-05-19  1:24     ` Hans J. Koch
  0 siblings, 0 replies; 56+ messages in thread
From: Hans J. Koch @ 2011-05-19  1:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 16, 2011 at 06:25:54PM +0100, Russell King - ARM Linux wrote:
> As nothing should be writing to the clocksource name string, make the
> clocksource name pointer const.  Build-tested on ARM Versatile Express.
> 
> Cc: Alessandro Rubini <rubini@unipv.it>
> Cc: Colin Cross <ccross@android.com>
> Cc: Eric Miao <eric.y.miao@gmail.com>
> Cc: Erik Gilling <konkers@android.com>
> Cc: "Hans J. Koch" <hjk@hansjkoch.de>
> Cc: Imre Kaloz <kaloz@openwrt.org>
> Cc: Krzysztof Halasa <khc@pm.waw.pl>
> Cc: Kukjin Kim <kgene.kim@samsung.com>
> Cc: Lennert Buytenhek <kernel@wantstofly.org>
> Cc: Linus Walleij <linus.walleij@stericsson.com>
> Cc: linux-omap at vger.kernel.org
> Cc: Nicolas Pitre <nico@fluxnic.net>
> Cc: Olof Johansson <olof@lixom.net>
> Cc: Sascha Hauer <kernel@pengutronix.de>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Viresh Kumar <viresh.kumar@st.com>
> Cc: Wan ZongShun <mcuos.com@gmail.com>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Acked-by: "Hans J. Koch" <hjk@hansjkoch.de>

> ---
>  include/linux/clocksource.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
> index c37b21a..94c1f38 100644
> --- a/include/linux/clocksource.h
> +++ b/include/linux/clocksource.h
> @@ -161,7 +161,7 @@ struct clocksource {
>  	/*
>  	 * First part of structure is read mostly
>  	 */
> -	char *name;
> +	const char *name;
>  	struct list_head list;
>  	int rating;
>  	cycle_t (*read)(struct clocksource *cs);
> -- 
> 1.7.4.4
> 
> 

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/19] Make clocksource name const
  2011-05-16 17:25   ` Russell King - ARM Linux
@ 2011-05-19  7:19     ` Linus Walleij
  -1 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2011-05-19  7:19 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: linux-arm-kernel, John Stultz, Thomas Gleixner, Kukjin Kim,
	Eric Miao, Erik Gilling, Nicolas Pitre, Tony Lindgren,
	Krzysztof Halasa, linux-omap, Hans J. Koch, Sascha Hauer,
	Colin Cross, Olof Johansson, Imre Kaloz, Wan ZongShun,
	Lennert Buytenhek, Alessandro Rubini

2011/5/16 Russell King - ARM Linux <linux@arm.linux.org.uk>:

> As nothing should be writing to the clocksource name string, make the
> clocksource name pointer const.  Build-tested on ARM Versatile Express.

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 01/19] Make clocksource name const
@ 2011-05-19  7:19     ` Linus Walleij
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2011-05-19  7:19 UTC (permalink / raw)
  To: linux-arm-kernel

2011/5/16 Russell King - ARM Linux <linux@arm.linux.org.uk>:

> As nothing should be writing to the clocksource name string, make the
> clocksource name pointer const. ?Build-tested on ARM Versatile Express.

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 16/19] clockevents: ARM sp804: allow clockevent name to be specified
  2011-05-16 17:30 ` [PATCH 16/19] clockevents: ARM sp804: allow clockevent name to be specified Russell King - ARM Linux
  2011-05-16 21:25   ` Rob Herring
@ 2011-05-23 10:55   ` Catalin Marinas
  1 sibling, 0 replies; 56+ messages in thread
From: Catalin Marinas @ 2011-05-23 10:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2011-05-16 at 18:30 +0100, Russell King - ARM Linux wrote:
> This allows platforms to specify the clcokevent name upon
> registration.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

In case you haven't pushed these yet, after Rob's comments:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 17/19] clockevents: ARM sp804: obtain sp804 timer rate via clks
  2011-05-16 17:31 ` [PATCH 17/19] clockevents: ARM sp804: obtain sp804 timer rate via clks Russell King - ARM Linux
  2011-05-16 21:24   ` Rob Herring
@ 2011-05-23 10:56   ` Catalin Marinas
  1 sibling, 0 replies; 56+ messages in thread
From: Catalin Marinas @ 2011-05-23 10:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2011-05-16 at 18:31 +0100, Russell King - ARM Linux wrote:
> This allows platforms to specify the rate of the SP804 clockevent via
> the clk subsystem.  While ARM boards clock these at 1MHz, BCMRing also
> has SP804 timers but are clocked at different rates.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

After you fixed Rob's comments:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2011-05-23 10:56 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-16 17:23 [PATCH v2 00/19] Consolidate simple ARM MMIO clock sources Russell King - ARM Linux
2011-05-16 17:23 ` Russell King - ARM Linux
2011-05-16 17:25 ` [PATCH 01/19] Make clocksource name const Russell King - ARM Linux
2011-05-16 17:25   ` Russell King - ARM Linux
2011-05-19  1:24   ` Hans J. Koch
2011-05-19  1:24     ` Hans J. Koch
2011-05-19  7:19   ` Linus Walleij
2011-05-19  7:19     ` Linus Walleij
2011-05-16 17:26 ` [PATCH 02/19] ARM: s5p: consolidate selection of timer register Russell King - ARM Linux
2011-05-16 17:26 ` [PATCH 03/19] ARM: omap1: delete useless interrupt handler Russell King - ARM Linux
2011-05-16 17:26   ` Russell King - ARM Linux
2011-05-16 17:26 ` [PATCH 04/19] ARM: omap1: convert to using readl/writel instead of volatile struct Russell King - ARM Linux
2011-05-16 17:26   ` Russell King - ARM Linux
2011-05-17 21:59   ` Catalin Marinas
2011-05-17 21:59     ` Catalin Marinas
2011-05-18  7:56     ` Russell King - ARM Linux
2011-05-18  7:56       ` Russell King - ARM Linux
2011-05-18 20:48     ` Linus Walleij
2011-05-18 20:48       ` Linus Walleij
2011-05-16 17:27 ` [PATCH 05/19] ARM: update sa1100 to reflect PXA updates Russell King - ARM Linux
2011-05-16 17:27 ` [PATCH 06/19] clocksource: add common mmio clocksource Russell King - ARM Linux
2011-05-16 17:27   ` Russell King - ARM Linux
2011-05-16 17:27 ` [PATCH 07/19] clocksource: convert ARM 32-bit up counting clocksources Russell King - ARM Linux
2011-05-16 18:30   ` Eric Miao
2011-05-17  6:38   ` Sascha Hauer
2011-05-16 17:28 ` [PATCH 08/19] clocksource: convert ARM 32-bit down " Russell King - ARM Linux
2011-05-16 17:28 ` [PATCH 09/19] clocksource: convert W90x900 24-bit down counting clocksource Russell King - ARM Linux
2011-05-16 17:28 ` [PATCH 10/19] clocksource: convert Integrator/AP 16-bit " Russell King - ARM Linux
2011-05-16 17:29 ` [PATCH 11/19] clocksource: convert SPEAr platforms 16-bit up " Russell King - ARM Linux
2011-05-16 17:29 ` [PATCH 12/19] clocksource: convert MXS timrotv2 to 32-bit down " Russell King - ARM Linux
2011-05-16 17:29 ` [PATCH 13/19] clocksource: convert OMAP1 " Russell King - ARM Linux
2011-05-16 17:29   ` Russell King - ARM Linux
2011-05-16 17:30 ` [PATCH 14/19] clocksource: ARM sp804: allow clocksource name to be specified Russell King - ARM Linux
2011-05-16 17:30 ` [PATCH 15/19] clocksource: ARM sp804: obtain sp804 timer rate via clks Russell King - ARM Linux
2011-05-16 22:18   ` Rob Herring
2011-05-16 22:34     ` Russell King - ARM Linux
2011-05-16 17:30 ` [PATCH 16/19] clockevents: ARM sp804: allow clockevent name to be specified Russell King - ARM Linux
2011-05-16 21:25   ` Rob Herring
2011-05-16 21:33     ` Russell King - ARM Linux
2011-05-23 10:55   ` Catalin Marinas
2011-05-16 17:31 ` [PATCH 17/19] clockevents: ARM sp804: obtain sp804 timer rate via clks Russell King - ARM Linux
2011-05-16 21:24   ` Rob Herring
2011-05-16 21:34     ` Russell King - ARM Linux
2011-05-23 10:56   ` Catalin Marinas
2011-05-16 17:31 ` [PATCH 18/19] ARM: bcmring: convert to sp804 clocksource Russell King - ARM Linux
2011-05-16 17:31 ` [PATCH 19/19] ARM: bcmring: convert to use sp804 clockevents Russell King - ARM Linux
2011-05-17 23:04   ` [PATCH] ARM: bcmring: fix patches to convert to " Jiandong Zheng
2011-05-17 23:20     ` Russell King - ARM Linux
2011-05-17 23:42       ` Jiandong Zheng
2011-05-18 15:46         ` Russell King - ARM Linux
2011-05-18 18:01           ` [PATCH] ARM: bcmring: Add clkdev table in init_early Jiandong Zheng
2011-05-18 20:42             ` Russell King - ARM Linux
2011-05-18 22:37               ` Russell King - ARM Linux
2011-05-18 22:45                 ` Jiandong Zheng
2011-05-18 22:52                   ` Russell King - ARM Linux
2011-05-18 23:38                     ` Jiandong Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.