linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 08/11] ARM: versatile: use OF init for sp804 timer
Date: Wed, 20 Mar 2013 17:54:08 -0500	[thread overview]
Message-ID: <1363820051-24428-9-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1363820051-24428-1-git-send-email-robherring2@gmail.com>

From: Rob Herring <rob.herring@calxeda.com>

Enable DT based init for the sp804 timers on versatile DT platform.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/boot/dts/versatile-ab.dts     |   12 ++++++++++++
 arch/arm/mach-versatile/core.c         |   26 +++++++++++++-------------
 arch/arm/mach-versatile/versatile_dt.c |    1 -
 3 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts
index e2fe319..dde75ae 100644
--- a/arch/arm/boot/dts/versatile-ab.dts
+++ b/arch/arm/boot/dts/versatile-ab.dts
@@ -121,6 +121,18 @@
 			interrupts = <0>;
 		};
 
+		timer at 101e2000 {
+			compatible = "arm,sp804", "arm,primecell";
+			reg = <0x101e2000 0x1000>;
+			interrupts = <4>;
+		};
+
+		timer at 101e3000 {
+			compatible = "arm,sp804", "arm,primecell";
+			reg = <0x101e3000 0x1000>;
+			interrupts = <5>;
+		};
+
 		gpio0: gpio at 101e4000 {
 			compatible = "arm,pl061", "arm,primecell";
 			reg = <0x101e4000 0x1000>;
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 286303a..5cdfc87 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -748,12 +748,25 @@ void versatile_restart(char mode, const char *cmd)
 /* Early initializations */
 void __init versatile_init_early(void)
 {
+	u32 val;
 	void __iomem *sys = __io_address(VERSATILE_SYS_BASE);
 
 	osc4_clk.vcoreg	= sys + VERSATILE_SYS_OSCCLCD_OFFSET;
 	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
 
 	versatile_sched_clock_init(sys + VERSATILE_SYS_24MHz_OFFSET, 24000000);
+
+	/*
+	 * set clock frequency:
+	 *	VERSATILE_REFCLK is 32KHz
+	 *	VERSATILE_TIMCLK is 1MHz
+	 */
+	val = readl(__io_address(VERSATILE_SCTL_BASE));
+	writel((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) |
+	       (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) |
+	       (VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) |
+	       (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel) | val,
+	       __io_address(VERSATILE_SCTL_BASE));
 }
 
 void __init versatile_init(void)
@@ -784,19 +797,6 @@ void __init versatile_init(void)
  */
 void __init versatile_timer_init(void)
 {
-	u32 val;
-
-	/* 
-	 * set clock frequency: 
-	 *	VERSATILE_REFCLK is 32KHz
-	 *	VERSATILE_TIMCLK is 1MHz
-	 */
-	val = readl(__io_address(VERSATILE_SCTL_BASE));
-	writel((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) |
-	       (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) | 
-	       (VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) |
-	       (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel) | val,
-	       __io_address(VERSATILE_SCTL_BASE));
 
 	sp804_clocksource_init(TIMER3_VA_BASE, "timer3");
 	sp804_clockevents_init(TIMER0_VA_BASE, IRQ_TIMERINT0_1, "timer0");
diff --git a/arch/arm/mach-versatile/versatile_dt.c b/arch/arm/mach-versatile/versatile_dt.c
index 2558f2e..3621b00 100644
--- a/arch/arm/mach-versatile/versatile_dt.c
+++ b/arch/arm/mach-versatile/versatile_dt.c
@@ -45,7 +45,6 @@ DT_MACHINE_START(VERSATILE_PB, "ARM-Versatile (Device Tree Support)")
 	.map_io		= versatile_map_io,
 	.init_early	= versatile_init_early,
 	.init_irq	= versatile_init_irq,
-	.init_time	= versatile_timer_init,
 	.init_machine	= versatile_dt_init,
 	.dt_compat	= versatile_dt_match,
 	.restart	= versatile_restart,
-- 
1.7.10.4

  parent reply	other threads:[~2013-03-20 22:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 22:54 [PATCH 00/11] sp804 and integrator timer CLKSRC_OF support Rob Herring
2013-03-20 22:54 ` [PATCH 01/11] OF: add empty of_device_is_available for !OF Rob Herring
2013-03-21 14:18   ` Mark Rutland
2013-03-21 14:26     ` Rob Herring
2013-03-20 22:54 ` [PATCH 02/11] ARM: remove extra timer-sp control register clearing Rob Herring
2013-03-21 17:58   ` Linus Walleij
2013-03-21 18:03     ` Rob Herring
2013-03-21 19:23   ` Russell King - ARM Linux
2013-03-22  2:36     ` Rob Herring
2013-03-20 22:54 ` [PATCH 03/11] ARM: timer-sp: convert to use CLKSRC_OF init Rob Herring
2013-03-21 18:02   ` Linus Walleij
2013-03-21 19:35   ` Russell King - ARM Linux
2013-03-22  2:31     ` Rob Herring
2013-03-22 11:49       ` Russell King - ARM Linux
2013-03-20 22:54 ` [PATCH 04/11] ARM: highbank: use OF init for sp804 timer Rob Herring
2013-03-20 22:54 ` [PATCH 05/11] ARM: vexpress: remove sp804 OF init Rob Herring
2013-03-20 22:54 ` [PATCH 06/11] ARM: dts: vexpress: disable CA9 core tile sp804 timer Rob Herring
2013-03-20 22:54 ` [PATCH 07/11] ARM: versatile: add versatile dtbs to dtbs target Rob Herring
2013-03-20 22:54 ` Rob Herring [this message]
2013-03-20 22:54 ` [PATCH 09/11] ARM: integrator-cp: convert use CLKSRC_OF for timer init Rob Herring
2013-03-21 18:07   ` Linus Walleij
2013-03-20 22:54 ` [PATCH 10/11] ARM: move sp804 and integrator timers to drivers/clocksource Rob Herring
2013-03-21 18:15   ` Linus Walleij
2013-03-20 22:54 ` [PATCH 11/11] devtree: add binding documentation for sp804 Rob Herring
2013-03-21 19:36   ` Russell King - ARM Linux
2013-03-21 13:24 ` [PATCH 00/11] sp804 and integrator timer CLKSRC_OF support Arnd Bergmann
2013-03-21 14:06   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363820051-24428-9-git-send-email-robherring2@gmail.com \
    --to=robherring2@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).