linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: viresh.kumar@st.com (Viresh Kumar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V3 05/63] ST SPEAr: Formalized timer support
Date: Mon, 20 Dec 2010 13:55:26 +0530	[thread overview]
Message-ID: <c7718f038dc1e157d73b89f6ceb76beeb6e738ca.1292833228.git.viresh.kumar@st.com> (raw)
In-Reply-To: <cover.1292833228.git.viresh.kumar@st.com>

From: Shiraz Hashim <shiraz.hashim@st.com>

Arch specific timer initialization code is moved into Arch specific file.

Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Rajeev Kumar <rajeev-dlh.kumar@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
 arch/arm/mach-spear3xx/include/mach/generic.h |    3 +-
 arch/arm/mach-spear3xx/spear300_evb.c         |    2 +-
 arch/arm/mach-spear3xx/spear310_evb.c         |    2 +-
 arch/arm/mach-spear3xx/spear320_evb.c         |    2 +-
 arch/arm/mach-spear3xx/spear3xx.c             |   32 ++++++++++++++++++++++++-
 arch/arm/mach-spear6xx/include/mach/generic.h |    3 +-
 arch/arm/mach-spear6xx/spear600_evb.c         |    3 +-
 arch/arm/mach-spear6xx/spear6xx.c             |   31 ++++++++++++++++++++++++
 arch/arm/plat-spear/time.c                    |   21 ++++++----------
 9 files changed, 79 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-spear3xx/include/mach/generic.h b/arch/arm/mach-spear3xx/include/mach/generic.h
index c16d2f8..e7d2de8 100644
--- a/arch/arm/mach-spear3xx/include/mach/generic.h
+++ b/arch/arm/mach-spear3xx/include/mach/generic.h
@@ -33,10 +33,11 @@
 /* Add spear3xx family device structure declarations here */
 extern struct amba_device gpio_device;
 extern struct amba_device uart_device;
-extern struct sys_timer spear_sys_timer;
+extern struct sys_timer spear3xx_timer;
 
 /* Add spear3xx family function declarations here */
 void __init clk_init(void);
+void __init spear_setup_timer(void);
 void __init spear3xx_map_io(void);
 void __init spear3xx_init_irq(void);
 void __init spear3xx_init(void);
diff --git a/arch/arm/mach-spear3xx/spear300_evb.c b/arch/arm/mach-spear3xx/spear300_evb.c
index 2c90663..cd23c98 100644
--- a/arch/arm/mach-spear3xx/spear300_evb.c
+++ b/arch/arm/mach-spear3xx/spear300_evb.c
@@ -71,6 +71,6 @@ MACHINE_START(SPEAR300, "ST-SPEAR300-EVB")
 	.boot_params	=	0x00000100,
 	.map_io		=	spear3xx_map_io,
 	.init_irq	=	spear3xx_init_irq,
-	.timer		=	&spear_sys_timer,
+	.timer		=	&spear3xx_timer,
 	.init_machine	=	spear300_evb_init,
 MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear310_evb.c b/arch/arm/mach-spear3xx/spear310_evb.c
index 4e55e55..3855431 100644
--- a/arch/arm/mach-spear3xx/spear310_evb.c
+++ b/arch/arm/mach-spear3xx/spear310_evb.c
@@ -78,6 +78,6 @@ MACHINE_START(SPEAR310, "ST-SPEAR310-EVB")
 	.boot_params	=	0x00000100,
 	.map_io		=	spear3xx_map_io,
 	.init_irq	=	spear3xx_init_irq,
-	.timer		=	&spear_sys_timer,
+	.timer		=	&spear3xx_timer,
 	.init_machine	=	spear310_evb_init,
 MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear320_evb.c b/arch/arm/mach-spear3xx/spear320_evb.c
index 7083a06..4a7ce35 100644
--- a/arch/arm/mach-spear3xx/spear320_evb.c
+++ b/arch/arm/mach-spear3xx/spear320_evb.c
@@ -75,6 +75,6 @@ MACHINE_START(SPEAR320, "ST-SPEAR320-EVB")
 	.boot_params	=	0x00000100,
 	.map_io		=	spear3xx_map_io,
 	.init_irq	=	spear3xx_init_irq,
-	.timer		=	&spear_sys_timer,
+	.timer		=	&spear3xx_timer,
 	.init_machine	=	spear320_evb_init,
 MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c
index efd2e17..34de574 100644
--- a/arch/arm/mach-spear3xx/spear3xx.c
+++ b/arch/arm/mach-spear3xx/spear3xx.c
@@ -523,5 +523,35 @@ struct pmx_dev pmx_plgpio_45_46_49_50 = {
 	.mode_count = ARRAY_SIZE(pmx_plgpio_45_46_49_50_modes),
 	.enb_on_reset = 1,
 };
+#endif /* CONFIG_MACH_SPEAR310 || CONFIG_MACH_SPEAR320 */
 
-#endif
+static void __init spear3xx_timer_init(void)
+{
+	char pclk_name[] = "pll3_48m_clk";
+	struct clk *gpt_clk, *pclk;
+
+	/* get the system timer clock */
+	gpt_clk = clk_get_sys("gpt0", NULL);
+	if (!gpt_clk) {
+		pr_err("%s:couldn't get clk for gpt\n", __func__);
+		BUG();
+	}
+
+	/* get the suitable parent clock for timer*/
+	pclk = clk_get(NULL, pclk_name);
+	if (!pclk) {
+		pr_err("%s:couldn't get %s as parent for gpt\n",
+				__func__, pclk_name);
+		BUG();
+	}
+
+	clk_set_parent(gpt_clk, pclk);
+	clk_put(gpt_clk);
+	clk_put(pclk);
+
+	spear_setup_timer();
+}
+
+struct sys_timer spear3xx_timer = {
+	.init = spear3xx_timer_init,
+};
diff --git a/arch/arm/mach-spear6xx/include/mach/generic.h b/arch/arm/mach-spear6xx/include/mach/generic.h
index 16205a5..e5967ed 100644
--- a/arch/arm/mach-spear6xx/include/mach/generic.h
+++ b/arch/arm/mach-spear6xx/include/mach/generic.h
@@ -31,9 +31,10 @@
 /* Add spear6xx family device structure declarations here */
 extern struct amba_device gpio_device[];
 extern struct amba_device uart_device[];
-extern struct sys_timer spear_sys_timer;
+extern struct sys_timer spear6xx_timer;
 
 /* Add spear6xx family function declarations here */
+void __init spear_setup_timer(void);
 void __init spear6xx_map_io(void);
 void __init spear6xx_init_irq(void);
 void __init spear6xx_init(void);
diff --git a/arch/arm/mach-spear6xx/spear600_evb.c b/arch/arm/mach-spear6xx/spear600_evb.c
index daff8d0..bdd5b76 100644
--- a/arch/arm/mach-spear6xx/spear600_evb.c
+++ b/arch/arm/mach-spear6xx/spear600_evb.c
@@ -42,10 +42,11 @@ static void __init spear600_evb_init(void)
 		amba_device_register(amba_devs[i], &iomem_resource);
 }
 
+
 MACHINE_START(SPEAR600, "ST-SPEAR600-EVB")
 	.boot_params	=	0x00000100,
 	.map_io		=	spear6xx_map_io,
 	.init_irq	=	spear6xx_init_irq,
-	.timer		=	&spear_sys_timer,
+	.timer		=	&spear6xx_timer,
 	.init_machine	=	spear600_evb_init,
 MACHINE_END
diff --git a/arch/arm/mach-spear6xx/spear6xx.c b/arch/arm/mach-spear6xx/spear6xx.c
index baf6bcc..e0bf51e 100644
--- a/arch/arm/mach-spear6xx/spear6xx.c
+++ b/arch/arm/mach-spear6xx/spear6xx.c
@@ -155,3 +155,34 @@ void __init spear6xx_map_io(void)
 	/* This will initialize clock framework */
 	clk_init();
 }
+
+static void __init spear6xx_timer_init(void)
+{
+	char pclk_name[] = "pll3_48m_clk";
+	struct clk *gpt_clk, *pclk;
+
+	/* get the system timer clock */
+	gpt_clk = clk_get_sys("gpt0", NULL);
+	if (!gpt_clk) {
+		pr_err("%s:couldn't get clk for gpt\n", __func__);
+		BUG();
+	}
+
+	/* get the suitable parent clock for timer*/
+	pclk = clk_get(NULL, pclk_name);
+	if (!pclk) {
+		pr_err("%s:couldn't get %s as parent for gpt\n",
+				__func__, pclk_name);
+		BUG();
+	}
+
+	clk_set_parent(gpt_clk, pclk);
+	clk_put(gpt_clk);
+	clk_put(pclk);
+
+	spear_setup_timer();
+}
+
+struct sys_timer spear6xx_timer = {
+	.init = spear6xx_timer_init,
+};
diff --git a/arch/arm/plat-spear/time.c b/arch/arm/plat-spear/time.c
index ab21165..7a038c9 100644
--- a/arch/arm/plat-spear/time.c
+++ b/arch/arm/plat-spear/time.c
@@ -1,7 +1,7 @@
 /*
  * arch/arm/plat-spear/time.c
  *
- * Copyright (C) 2009 ST Microelectronics
+ * Copyright (C) 2010 ST Microelectronics
  * Shiraz Hashim<shiraz.hashim@st.com>
  *
  * This file is licensed under the terms of the GNU General Public
@@ -215,7 +215,7 @@ static void __init spear_clockevent_init(void)
 
 void __init spear_setup_timer(void)
 {
-	struct clk *pll3_clk;
+	int ret;
 
 	if (!request_mem_region(SPEAR_GPT0_BASE, SZ_1K, "gpt0")) {
 		pr_err("%s:cannot get IO addr\n", __func__);
@@ -234,26 +234,21 @@ void __init spear_setup_timer(void)
 		goto err_iomap;
 	}
 
-	pll3_clk = clk_get(NULL, "pll3_48m_clk");
-	if (!pll3_clk) {
-		pr_err("%s:couldn't get PLL3 as parent for gpt\n", __func__);
-		goto err_iomap;
+	ret = clk_enable(gpt_clk);
+	if (ret < 0) {
+		pr_err("%s:couldn't enable gpt clock\n", __func__);
+		goto err_clk;
 	}
 
-	clk_set_parent(gpt_clk, pll3_clk);
-
 	spear_clockevent_init();
 	spear_clocksource_init();
 
 	return;
 
+err_clk:
+	clk_put(gpt_clk);
 err_iomap:
 	iounmap(gpt_base);
-
 err_mem:
 	release_mem_region(SPEAR_GPT0_BASE, SZ_1K);
 }
-
-struct sys_timer spear_sys_timer = {
-	.init = spear_setup_timer,
-};
-- 
1.7.2.2

  parent reply	other threads:[~2010-12-20  8:25 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-20  8:25 [PATCH V3 00/63] Updating SPEAr Support Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 01/63] ARM: move sev definition to common system.h include file Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 02/63] sp810 Fix: Switch to slow mode before sysctl_soft_reset Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 03/63] ST SPEAr: Padmux code Updated Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 04/63] ST SPEAr: Making clock functions more generic Viresh Kumar
2010-12-20  8:25 ` Viresh Kumar [this message]
2010-12-20  8:25 ` [PATCH V3 06/63] ST SPEAr13XX: Adding machine specific header files Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 07/63] ST SPEAr13XX: Adding machine specific src files Viresh Kumar
2011-01-14 10:08   ` stanley.miao
2011-01-14 10:09     ` viresh kumar
2010-12-20  8:25 ` [PATCH V3 08/63] ST SPEAr: Adding support for SPEAr13xx SoC in spear generic plat/ Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 09/63] ST SPEAr13XX: Added compilation support in arch/arm/ Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 10/63] ST SPEAr1300: Adding default config file Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 11/63] ST SPEAr: Adding support for CLCD on SPEAr3xx/6xx Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 12/63] ST SPEAr: Updating Clock Support Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 13/63] ST SPEAr: Adding Debugfs support on clock framework Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 14/63] ST SPEAr: Correcting SOC Config base address for spear320 Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 15/63] ST SPEAr: Adding PLGPIO driver for spear platform Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 17/63] ST SPEAr: Adding machine support for rtc-spear Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 18/63] ST SPEAr: adding support for synopsis i2c designware Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 19/63] ST SPEAr: Adding machine support for USB host Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 20/63] ST SPEAr: Adding machine support for keyboard Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 21/63] ST SPEAr: Added ARM PL061 GPIO Support on SPEAr13xx and modified resource size Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 22/63] ST SPEAr: Adding support for ST's PWM IP Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 23/63] ST SPEAr: Adding Watchdog support Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 24/63] ST SPEAr: Adding machine support for nand Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 25/63] Newly erased page read workaround Viresh Kumar
2011-01-14  5:21   ` [PATCH V3 25/63 resend] " viresh kumar
2011-01-14 12:36   ` [PATCH V3 25/63] " Linus Walleij
2010-12-20  8:25 ` [PATCH V3 26/63] ST SPEAr: Added PCIE host controller base driver support Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 27/63] ST SPEAr: Adding support for SSP PL022 Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 28/63] ST SPEAr: Adding support for SDHCI (SDIO) Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 29/63] ST SPEAr: Changing resource size of amba devices to SZ_4K Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 30/63] ST SPEAr: Replacing SIZE macro's with actual required size Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 31/63] SPEAr: defines base addresses as ulong Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 32/63] ST SPEAr: Adding miscellaneous devices Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 33/63] ST SPEAr 13xx : Adding support for SPEAr1310 Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 34/63] ST SPEAr: Adding support for DDR in clock framework Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 35/63] ST SPEAr : EMI (Extrenal Memory Interface) controller driver Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 36/63] ST SPEAr : FSMC (Flexible Static Memory Controller) NOR interface driver Viresh Kumar
2010-12-26 15:38   ` Linus Walleij
2011-01-03  3:48     ` viresh kumar
2010-12-20  8:25 ` [PATCH V3 37/63] SPEAr Clock Framework: Adding support for PLL frequency change Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 38/63] SPEAr Power Management: Added the support for Standby mode Viresh Kumar
2010-12-20  8:25 ` [PATCH V3 39/63] GIC: Added dummy handlers for Power Management Suspend Resume Viresh Kumar
2010-12-20 11:10   ` Russell King - ARM Linux
2010-12-20 11:32     ` viresh kumar
2010-12-20 11:49       ` Russell King - ARM Linux
2010-12-20 12:20         ` [PATCH V3 39/63] GIC: Added dummy handlers for Power ManagementSuspend Resume Santosh Shilimkar
2010-12-20 12:28           ` Russell King - ARM Linux
2010-12-20 12:34             ` [PATCH V3 39/63] GIC: Added dummy handlers for PowerManagementSuspend Resume Santosh Shilimkar
2010-12-21  4:17         ` [PATCH V3 39/63] GIC: Added dummy handlers for Power Management Suspend Resume viresh kumar
2010-12-20  8:26 ` [PATCH V3 40/63] SPEAr CPU freq: Adding support for CPU Freq framework Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 41/63] ST SPEAr13xx: Adding CPU hotplug support added for SMP platforms Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 42/63] ST SPEAr: replace readl, writel with __raw_readl, __raw_writel in uncompress.h Viresh Kumar
2011-01-07  2:26   ` stanley.miao
2011-01-07  9:17     ` Russell King - ARM Linux
2011-01-07  9:38       ` stanley.miao
2011-01-11  5:39         ` viresh kumar
2010-12-20  8:26 ` [PATCH V3 43/63] ST SPEAr13xx: add L2 cache support Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 44/63] ST SPEAr13xx: Modified static mappings Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 45/63] SPEAr: Adding and Updating Clock definitions Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 46/63] SPEAr : Pad multiplexing handling modified Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 47/63] SPEAr13xx : Fixed part devices in SPEAr13xx addded to the generic implementation Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 48/63] SPEAr : Updating pad multiplexing support Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 49/63] ST SPEAr3xx: Passing pmx devices address from machine *.c files Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 50/63] ST SPEAr Clock Framework: Updating for single image solution Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 51/63] SPEAr3xx: Make local structures static Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 52/63] SPEAR3xx: Rename register/irq defines to remove naming conflicts Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 53/63] SPEAr3xx: Rework pmx_dev code to remove conflicts Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 54/63] SPEAr3xx: Rework KConfig to allow all boards to be compiled in Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 55/63] SPEAr3xx: Replace defconfigs with single unified defconfig Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 56/63] ST SPEAr: Appending spear3** with global structures Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 57/63] ST SPEAr3xx: Updating plgpio and emi source to make it compliant with single image strategy Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 58/63] SPEAr6xx: Rework Kconfig for single image solution Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 59/63] ST SPEAR6xx: renaming spear600_defconfig as spear6xx_defconfig Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 60/63] ST SPEAr13xx: Pass default padmux settings as parameter to spear13**_init routine Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 61/63] ST SPEAr: Adding devices & clocks Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 62/63] ST SPEAr: Adding information in Documentation/ and MAINTAINERS Viresh Kumar
2010-12-20  8:26 ` [PATCH V3 63/63] ST SPEAr: Updating defconfigs Viresh Kumar
2010-12-20  8:28 ` [PATCH V3 16/63 resend] rtc: Adding support for spear rtc Viresh Kumar
2011-01-12  9:41   ` viresh kumar
2010-12-23 12:13 ` [PATCH V3 00/63] Updating SPEAr Support Russell King - ARM Linux
2010-12-24  4:01   ` viresh kumar

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=c7718f038dc1e157d73b89f6ceb76beeb6e738ca.1292833228.git.viresh.kumar@st.com \
    --to=viresh.kumar@st.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).