All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] ARM: mxs: timer code cleanup
@ 2013-03-25 15:17 Shawn Guo
  2013-03-25 15:17 ` [PATCH 1/6] ARM: mxs: use CLKSRC_OF helper to initialize timer Shawn Guo
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Shawn Guo @ 2013-03-25 15:17 UTC (permalink / raw)
  To: linux-arm-kernel

The series cleans up mxs timer driver and then moves it into
drivers/clocksource.  It moves mxs platform one step toward
multiplatform support.

It's based on arm-soc/clksrc/cleanup.

Shawn Guo (6):
  ARM: mxs: use CLKSRC_OF helper to initialize timer
  ARM: mxs: look up timrot clock from device tree
  ARM: mxs: get timrot base address from device tree
  ARM: mxs: remove cpu_is_mx23() call from timer code
  ARM: mxs: select STMP_DEVICE and use it for timer code
  ARM: mxs: move timer driver into drivers/clocksource

 arch/arm/Kconfig                                   |    2 ++
 arch/arm/boot/dts/imx23.dtsi                       |    1 +
 arch/arm/boot/dts/imx28.dtsi                       |    1 +
 arch/arm/mach-mxs/Makefile                         |    2 +-
 arch/arm/mach-mxs/include/mach/common.h            |    1 -
 arch/arm/mach-mxs/mach-mxs.c                       |    3 ++
 drivers/clk/mxs/clk-imx23.c                        |    4 ---
 drivers/clk/mxs/clk-imx28.c                        |    3 --
 drivers/clocksource/Makefile                       |    1 +
 .../timer.c => drivers/clocksource/mxs_timer.c     |   36 +++++++++-----------
 10 files changed, 26 insertions(+), 28 deletions(-)
 rename arch/arm/mach-mxs/timer.c => drivers/clocksource/mxs_timer.c (91%)

-- 
1.7.9.5

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

* [PATCH 1/6] ARM: mxs: use CLKSRC_OF helper to initialize timer
  2013-03-25 15:17 [PATCH 0/6] ARM: mxs: timer code cleanup Shawn Guo
@ 2013-03-25 15:17 ` Shawn Guo
  2013-03-25 15:17 ` [PATCH 2/6] ARM: mxs: look up timrot clock from device tree Shawn Guo
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2013-03-25 15:17 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH 2/6] ARM: mxs: look up timrot clock from device tree
  2013-03-25 15:17 [PATCH 0/6] ARM: mxs: timer code cleanup Shawn Guo
  2013-03-25 15:17 ` [PATCH 1/6] ARM: mxs: use CLKSRC_OF helper to initialize timer Shawn Guo
@ 2013-03-25 15:17 ` Shawn Guo
  2013-07-11 10:56   ` Uwe Kleine-König
  2013-03-25 15:17 ` [PATCH 3/6] ARM: mxs: get timrot base address " Shawn Guo
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Shawn Guo @ 2013-03-25 15:17 UTC (permalink / raw)
  To: linux-arm-kernel

Change call clk_get_sys() to of_clk_get() to look up timrot clock from
device tree, so that the clk_register_clkdev() call for timrot can be
saved in clock driver.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/boot/dts/imx23.dtsi |    1 +
 arch/arm/boot/dts/imx28.dtsi |    1 +
 arch/arm/mach-mxs/timer.c    |    2 +-
 drivers/clk/mxs/clk-imx23.c  |    2 --
 drivers/clk/mxs/clk-imx28.c  |    1 -
 5 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 56afcf4..27ce807 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -426,6 +426,7 @@
 				compatible = "fsl,imx23-timrot", "fsl,timrot";
 				reg = <0x80068000 0x2000>;
 				interrupts = <28 29 30 31>;
+				clocks = <&clks 28>;
 			};
 
 			auart0: serial at 8006c000 {
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index 7ba4966..c2f10d3 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -838,6 +838,7 @@
 				compatible = "fsl,imx28-timrot", "fsl,timrot";
 				reg = <0x80068000 0x2000>;
 				interrupts = <48 49 50 51>;
+				clocks = <&clks 26>;
 			};
 
 			auart0: serial at 8006a000 {
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
index fe2903d..f5142aa 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -247,7 +247,7 @@ static void __init mxs_timer_init(struct device_node *np)
 	struct clk *timer_clk;
 	int irq;
 
-	timer_clk = clk_get_sys("timrot", NULL);
+	timer_clk = of_clk_get(np, 0);
 	if (IS_ERR(timer_clk)) {
 		pr_err("%s: failed to get clk\n", __func__);
 		return;
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index 52e0365..f65b19c 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -160,8 +160,6 @@ int __init mx23_clocks_init(void)
 		of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
 	}
 
-	clk_register_clkdev(clks[clk32k], NULL, "timrot");
-
 	for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
 		clk_prepare_enable(clks[clks_init_on[i]]);
 
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index 03918e1..3cc82ea 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -238,7 +238,6 @@ int __init mx28_clocks_init(void)
 		of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
 	}
 
-	clk_register_clkdev(clks[xbus], NULL, "timrot");
 	clk_register_clkdev(clks[enet_out], NULL, "enet_out");
 
 	for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
-- 
1.7.9.5

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

* [PATCH 3/6] ARM: mxs: get timrot base address from device tree
  2013-03-25 15:17 [PATCH 0/6] ARM: mxs: timer code cleanup Shawn Guo
  2013-03-25 15:17 ` [PATCH 1/6] ARM: mxs: use CLKSRC_OF helper to initialize timer Shawn Guo
  2013-03-25 15:17 ` [PATCH 2/6] ARM: mxs: look up timrot clock from device tree Shawn Guo
@ 2013-03-25 15:17 ` Shawn Guo
  2013-03-25 15:17 ` [PATCH 4/6] ARM: mxs: remove cpu_is_mx23() call from timer code Shawn Guo
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2013-03-25 15:17 UTC (permalink / raw)
  To: linux-arm-kernel

Instead of using static defines, it gets timrot base address with
mapping from device tree.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/mach-mxs/timer.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
index f5142aa..c8cda18 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -26,6 +26,7 @@
 #include <linux/clockchips.h>
 #include <linux/clk.h>
 #include <linux/of.h>
+#include <linux/of_address.h>
 #include <linux/of_irq.h>
 
 #include <asm/mach/time.h>
@@ -79,7 +80,7 @@
 static struct clock_event_device mxs_clockevent_device;
 static enum clock_event_mode mxs_clockevent_mode = CLOCK_EVT_MODE_UNUSED;
 
-static void __iomem *mxs_timrot_base = MXS_IO_ADDRESS(MXS_TIMROT_BASE_ADDR);
+static void __iomem *mxs_timrot_base;
 static u32 timrot_major_version;
 
 static inline void timrot_irq_disable(void)
@@ -247,6 +248,9 @@ static void __init mxs_timer_init(struct device_node *np)
 	struct clk *timer_clk;
 	int irq;
 
+	mxs_timrot_base = of_iomap(np, 0);
+	WARN_ON(!mxs_timrot_base);
+
 	timer_clk = of_clk_get(np, 0);
 	if (IS_ERR(timer_clk)) {
 		pr_err("%s: failed to get clk\n", __func__);
-- 
1.7.9.5

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

* [PATCH 4/6] ARM: mxs: remove cpu_is_mx23() call from timer code
  2013-03-25 15:17 [PATCH 0/6] ARM: mxs: timer code cleanup Shawn Guo
                   ` (2 preceding siblings ...)
  2013-03-25 15:17 ` [PATCH 3/6] ARM: mxs: get timrot base address " Shawn Guo
@ 2013-03-25 15:17 ` 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
  5 siblings, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2013-03-25 15:17 UTC (permalink / raw)
  To: linux-arm-kernel

Remove cpu_is_mx23() call from timer code by using
of_device_is_compatible() instead.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/mach-mxs/timer.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
index c8cda18..f4dd96ff 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -266,7 +266,8 @@ static void __init mxs_timer_init(struct device_node *np)
 
 	/* get timrot version */
 	timrot_major_version = __raw_readl(mxs_timrot_base +
-				(cpu_is_mx23() ? MX23_TIMROT_VERSION_OFFSET :
+			(of_device_is_compatible(np, "fsl,imx23-timrot") ?
+						MX23_TIMROT_VERSION_OFFSET :
 						MX28_TIMROT_VERSION_OFFSET));
 	timrot_major_version >>= BP_TIMROT_MAJOR_VERSION;
 
-- 
1.7.9.5

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

* [PATCH 5/6] ARM: mxs: select STMP_DEVICE and use it for timer code
  2013-03-25 15:17 [PATCH 0/6] ARM: mxs: timer code cleanup Shawn Guo
                   ` (3 preceding siblings ...)
  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 ` Shawn Guo
  2013-03-25 15:17 ` [PATCH 6/6] ARM: mxs: move timer driver into drivers/clocksource Shawn Guo
  5 siblings, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2013-03-25 15:17 UTC (permalink / raw)
  To: linux-arm-kernel

Select STMP_DEVICE and in timer code replace mxs_reset_block() with
stmp_reset_block(), use STMP_OFFSET_REG_SET/CLR to replace
__mxs_setl/clrl.

As the result, <mach/mxs.h> and <mach/common.h> includsion can be
removed from timer.c now.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/Kconfig          |    1 +
 arch/arm/mach-mxs/timer.c |   17 ++++++++---------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index d57fc3d..6f61286 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -481,6 +481,7 @@ config ARCH_MXS
 	select MULTI_IRQ_HANDLER
 	select PINCTRL
 	select SPARSE_IRQ
+	select STMP_DEVICE
 	select USE_OF
 	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 f4dd96ff..a4d469b 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -28,11 +28,10 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
+#include <linux/stmp_device.h>
 
 #include <asm/mach/time.h>
 #include <asm/sched_clock.h>
-#include <mach/mxs.h>
-#include <mach/common.h>
 
 /*
  * There are 2 versions of the timrot on Freescale MXS-based SoCs.
@@ -85,20 +84,20 @@ static u32 timrot_major_version;
 
 static inline void timrot_irq_disable(void)
 {
-	__mxs_clrl(BM_TIMROT_TIMCTRLn_IRQ_EN,
-			mxs_timrot_base + HW_TIMROT_TIMCTRLn(0));
+	__raw_writel(BM_TIMROT_TIMCTRLn_IRQ_EN, mxs_timrot_base +
+		     HW_TIMROT_TIMCTRLn(0) + STMP_OFFSET_REG_CLR);
 }
 
 static inline void timrot_irq_enable(void)
 {
-	__mxs_setl(BM_TIMROT_TIMCTRLn_IRQ_EN,
-			mxs_timrot_base + HW_TIMROT_TIMCTRLn(0));
+	__raw_writel(BM_TIMROT_TIMCTRLn_IRQ_EN, mxs_timrot_base +
+		     HW_TIMROT_TIMCTRLn(0) + STMP_OFFSET_REG_SET);
 }
 
 static void timrot_irq_acknowledge(void)
 {
-	__mxs_clrl(BM_TIMROT_TIMCTRLn_IRQ,
-			mxs_timrot_base + HW_TIMROT_TIMCTRLn(0));
+	__raw_writel(BM_TIMROT_TIMCTRLn_IRQ, mxs_timrot_base +
+		     HW_TIMROT_TIMCTRLn(0) + STMP_OFFSET_REG_CLR);
 }
 
 static cycle_t timrotv1_get_cycles(struct clocksource *cs)
@@ -262,7 +261,7 @@ static void __init mxs_timer_init(struct device_node *np)
 	/*
 	 * Initialize timers to a known state
 	 */
-	mxs_reset_block(mxs_timrot_base + HW_TIMROT_ROTCTRL);
+	stmp_reset_block(mxs_timrot_base + HW_TIMROT_ROTCTRL);
 
 	/* get timrot version */
 	timrot_major_version = __raw_readl(mxs_timrot_base +
-- 
1.7.9.5

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

* [PATCH 6/6] ARM: mxs: move timer driver into drivers/clocksource
  2013-03-25 15:17 [PATCH 0/6] ARM: mxs: timer code cleanup Shawn Guo
                   ` (4 preceding siblings ...)
  2013-03-25 15:17 ` [PATCH 5/6] ARM: mxs: select STMP_DEVICE and use it for " Shawn Guo
@ 2013-03-25 15:17 ` Shawn Guo
  5 siblings, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2013-03-25 15:17 UTC (permalink / raw)
  To: linux-arm-kernel

Move mxs timer driver into drivers/clocksource as mxs_timer.c.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/mach-mxs/Makefile                         |    2 +-
 drivers/clocksource/Makefile                       |    1 +
 .../timer.c => drivers/clocksource/mxs_timer.c     |    0
 3 files changed, 2 insertions(+), 1 deletion(-)
 rename arch/arm/mach-mxs/timer.c => drivers/clocksource/mxs_timer.c (100%)

diff --git a/arch/arm/mach-mxs/Makefile b/arch/arm/mach-mxs/Makefile
index 3d3c8a9..76c336e 100644
--- a/arch/arm/mach-mxs/Makefile
+++ b/arch/arm/mach-mxs/Makefile
@@ -1,5 +1,5 @@
 # Common support
-obj-y := icoll.o ocotp.o system.o timer.o mm.o
+obj-y := icoll.o ocotp.o system.o mm.o
 
 obj-$(CONFIG_PM) += pm.o
 
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 4d8283a..89c5adc 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_CLKSRC_NOMADIK_MTU)	+= nomadik-mtu.o
 obj-$(CONFIG_CLKSRC_DBX500_PRCMU)	+= clksrc-dbx500-prcmu.o
 obj-$(CONFIG_ARMADA_370_XP_TIMER)	+= time-armada-370-xp.o
 obj-$(CONFIG_ARCH_BCM2835)	+= bcm2835_timer.o
+obj-$(CONFIG_ARCH_MXS)		+= mxs_timer.o
 obj-$(CONFIG_SUNXI_TIMER)	+= sunxi_timer.o
 obj-$(CONFIG_ARCH_TEGRA)	+= tegra20_timer.o
 obj-$(CONFIG_VT8500_TIMER)	+= vt8500_timer.o
diff --git a/arch/arm/mach-mxs/timer.c b/drivers/clocksource/mxs_timer.c
similarity index 100%
rename from arch/arm/mach-mxs/timer.c
rename to drivers/clocksource/mxs_timer.c
-- 
1.7.9.5

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

* [PATCH 2/6] ARM: mxs: look up timrot clock from device tree
  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
  0 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2013-07-11 10:56 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Shawn,

On Mon, Mar 25, 2013 at 11:17:28PM +0800, Shawn Guo wrote:
> Change call clk_get_sys() to of_clk_get() to look up timrot clock from
> device tree, so that the clk_register_clkdev() call for timrot can be
> saved in clock driver.

I'm currently using an i.MX28 with 3.8-rt13 and patched the clocksource
and clockevent to use the 24 MHz clock source
(BV_TIMROTv2_TIMCTRLn_SELECT__ALWAYS instead of
BV_TIMROTv2_TIMCTRLn_SELECT__32KHZ_XTAL). Currently my patch is a hack
because I hard code the 24 MHz. I wonder how to do it properly?

Add another item to the "clocks = <...>" entry and use the first entry
for enable and the 2nd for clk_get_rate?

Something like:

	always_clk = of_clk_get(np, 1);
	if (always_clk)
		register timers using always clk (24 MHz, SELECT__ALWAYS)
	else
		fall back to timer_clk (32 kHz, 32KHZ_XTAL)

and then

	timrot at 80068000 {
		compatible = "fsl,imx28-timrot", "fsl,timrot";
		reg = <0x80068000 0x2000>;
		interrupts = <48 49 50 51>;
		clocks = <&clks 26 &clks 0>;
	};

If you like it, too, I can prepare a patch.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* [PATCH 2/6] ARM: mxs: look up timrot clock from device tree
  2013-07-11 10:56   ` Uwe Kleine-König
@ 2013-07-11 13:57     ` Shawn Guo
  0 siblings, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2013-07-11 13:57 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Uwe,

On Thu, Jul 11, 2013 at 12:56:26PM +0200, Uwe Kleine-K?nig wrote:
> I'm currently using an i.MX28 with 3.8-rt13 and patched the clocksource
> and clockevent to use the 24 MHz clock source
> (BV_TIMROTv2_TIMCTRLn_SELECT__ALWAYS instead of
> BV_TIMROTv2_TIMCTRLn_SELECT__32KHZ_XTAL). Currently my patch is a hack
> because I hard code the 24 MHz. I wonder how to do it properly?
> 

You may want to take a look at commit 2fb318f (ARM: mxs: use apbx bus
clock to drive the timers on timrotv2), which hit mainline in v3.9.

Shawn

> Add another item to the "clocks = <...>" entry and use the first entry
> for enable and the 2nd for clk_get_rate?
> 
> Something like:
> 
> 	always_clk = of_clk_get(np, 1);
> 	if (always_clk)
> 		register timers using always clk (24 MHz, SELECT__ALWAYS)
> 	else
> 		fall back to timer_clk (32 kHz, 32KHZ_XTAL)
> 
> and then
> 
> 	timrot at 80068000 {
> 		compatible = "fsl,imx28-timrot", "fsl,timrot";
> 		reg = <0x80068000 0x2000>;
> 		interrupts = <48 49 50 51>;
> 		clocks = <&clks 26 &clks 0>;
> 	};
> 
> If you like it, too, I can prepare a patch.
> 
> Best regards
> Uwe
> 
> -- 
> Pengutronix e.K.                           | Uwe Kleine-K?nig            |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

end of thread, other threads:[~2013-07-11 13:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-25 15:17 [PATCH 0/6] ARM: mxs: timer code cleanup Shawn Guo
2013-03-25 15:17 ` [PATCH 1/6] ARM: mxs: use CLKSRC_OF helper to initialize timer Shawn Guo
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

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.