From: shawn.guo@linaro.org (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/6] ARM: mxs: use CLKSRC_OF helper to initialize timer
Date: Mon, 25 Mar 2013 23:17:27 +0800 [thread overview]
Message-ID: <1364224652-28332-2-git-send-email-shawn.guo@linaro.org> (raw)
In-Reply-To: <1364224652-28332-1-git-send-email-shawn.guo@linaro.org>
Select CLKSRC_OF and use clocksource_of_init() to initialize timer, so
that the call to mxs_timer_init() in clock driver can be removed.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/Kconfig | 1 +
arch/arm/mach-mxs/include/mach/common.h | 1 -
arch/arm/mach-mxs/mach-mxs.c | 3 +++
arch/arm/mach-mxs/timer.c | 10 ++--------
drivers/clk/mxs/clk-imx23.c | 2 --
drivers/clk/mxs/clk-imx28.c | 2 --
6 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index eaae82a..d57fc3d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -474,6 +474,7 @@ config ARCH_MXS
select ARCH_REQUIRE_GPIOLIB
select CLKDEV_LOOKUP
select CLKSRC_MMIO
+ select CLKSRC_OF
select COMMON_CLK
select GENERIC_CLOCKEVENTS
select HAVE_CLK_PREPARE
diff --git a/arch/arm/mach-mxs/include/mach/common.h b/arch/arm/mach-mxs/include/mach/common.h
index be5a9c9..e043c47 100644
--- a/arch/arm/mach-mxs/include/mach/common.h
+++ b/arch/arm/mach-mxs/include/mach/common.h
@@ -13,7 +13,6 @@
extern const u32 *mxs_get_ocotp(void);
extern int mxs_reset_block(void __iomem *);
-extern void mxs_timer_init(void);
extern void mxs_restart(char, const char *);
extern int mxs_saif_clkmux_select(unsigned int clkmux);
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 3218f1f..796c5dd 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -12,6 +12,7 @@
#include <linux/clk.h>
#include <linux/clkdev.h>
+#include <linux/clocksource.h>
#include <linux/can/platform/flexcan.h>
#include <linux/delay.h>
#include <linux/err.h>
@@ -178,11 +179,13 @@ static struct of_dev_auxdata mxs_auxdata_lookup[] __initdata = {
static void __init imx23_timer_init(void)
{
mx23_clocks_init();
+ clocksource_of_init();
}
static void __init imx28_timer_init(void)
{
mx28_clocks_init();
+ clocksource_of_init();
}
enum mac_oui {
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
index 4210204..fe2903d 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -242,18 +242,11 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)
return 0;
}
-void __init mxs_timer_init(void)
+static void __init mxs_timer_init(struct device_node *np)
{
- struct device_node *np;
struct clk *timer_clk;
int irq;
- np = of_find_compatible_node(NULL, NULL, "fsl,timrot");
- if (!np) {
- pr_err("%s: failed find timrot node\n", __func__);
- return;
- }
-
timer_clk = clk_get_sys("timrot", NULL);
if (IS_ERR(timer_clk)) {
pr_err("%s: failed to get clk\n", __func__);
@@ -304,3 +297,4 @@ void __init mxs_timer_init(void)
irq = irq_of_parse_and_map(np, 0);
setup_irq(irq, &mxs_timer_irq);
}
+CLOCKSOURCE_OF_DECLARE(mxs, "fsl,timrot", mxs_timer_init)
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index b5c06f9..52e0365 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -165,7 +165,5 @@ int __init mx23_clocks_init(void)
for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);
- mxs_timer_init();
-
return 0;
}
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index 76ce6c6..03918e1 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -244,7 +244,5 @@ int __init mx28_clocks_init(void)
for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);
- mxs_timer_init();
-
return 0;
}
--
1.7.9.5
next prev parent reply other threads:[~2013-03-25 15:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-25 15:17 [PATCH 0/6] ARM: mxs: timer code cleanup Shawn Guo
2013-03-25 15:17 ` Shawn Guo [this message]
2013-03-25 15:17 ` [PATCH 2/6] ARM: mxs: look up timrot clock from device tree Shawn Guo
2013-07-11 10:56 ` Uwe Kleine-König
2013-07-11 13:57 ` Shawn Guo
2013-03-25 15:17 ` [PATCH 3/6] ARM: mxs: get timrot base address " Shawn Guo
2013-03-25 15:17 ` [PATCH 4/6] ARM: mxs: remove cpu_is_mx23() call from timer code Shawn Guo
2013-03-25 15:17 ` [PATCH 5/6] ARM: mxs: select STMP_DEVICE and use it for " Shawn Guo
2013-03-25 15:17 ` [PATCH 6/6] ARM: mxs: move timer driver into drivers/clocksource Shawn Guo
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=1364224652-28332-2-git-send-email-shawn.guo@linaro.org \
--to=shawn.guo@linaro.org \
--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).