linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/3] ARM i.MX25 clk: Fix gpt timer clock.
@ 2014-06-25 12:41 Denis Carikli
  2014-06-25 12:41 ` [PATCH v3 2/3] ARM: dts: i.MX25: Fix gpt timers clocks Denis Carikli
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Denis Carikli @ 2014-06-25 12:41 UTC (permalink / raw)
  To: linux-arm-kernel

The gpt0 timer clock has been wrong since:
  6bbaec5 ARM i.MX25: implement clocks using common clock framework

Signed-off-by: Denis Carikli <denis@eukrea.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Changelog v2->v3:
- DTS part splitted out
- Added Sascha's ack from the previous unsplitted patch.
- Added non-dt specific commit message.
- No code changes

Changelog v1->v2:
- Also fixed the ipg clock for non-dt init.
---
 arch/arm/mach-imx/clk-imx25.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
index 887b508..e759a6d 100644
--- a/arch/arm/mach-imx/clk-imx25.c
+++ b/arch/arm/mach-imx/clk-imx25.c
@@ -242,7 +242,7 @@ int __init mx25_clocks_init(void)
 {
 	__mx25_clocks_init(24000000);
 
-	clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
+	clk_register_clkdev(clk[gpt1_ipg], "ipg", "imx-gpt.0");
 	clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
 	/* i.mx25 has the i.mx21 type uart */
 	clk_register_clkdev(clk[uart1_ipg], "ipg", "imx21-uart.0");
-- 
1.7.9.5

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

* [PATCH v3 2/3] ARM: dts: i.MX25: Fix gpt timers clocks.
  2014-06-25 12:41 [PATCH v3 1/3] ARM i.MX25 clk: Fix gpt timer clock Denis Carikli
@ 2014-06-25 12:41 ` Denis Carikli
  2014-06-25 17:55   ` Fabio Estevam
  2014-06-25 12:41 ` [PATCH v3 3/3] ARM: i.MX25 clk: Use of_clk_init() for DT case Denis Carikli
  2014-06-28 15:11 ` [PATCH v3 1/3] ARM i.MX25 clk: Fix gpt timer clock Shawn Guo
  2 siblings, 1 reply; 8+ messages in thread
From: Denis Carikli @ 2014-06-25 12:41 UTC (permalink / raw)
  To: linux-arm-kernel

Without that fix, the board freeze during boot.

This appeared after the following commit:
  496f065 ARM: i.MX: Use of_clk_get_by_name() for timer clocks for DT case.

Signed-off-by: Denis Carikli <denis@eukrea.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Changelog v2->v3:
- Splitted out the non-dts part.
- Added Sascha's ack which applied on the previous non-splitted patch.
- No code/dts changes.

Changelog v1->v2:
- Also fixed the ipg clock
- Also fixed the ipg and per clocks for the other gpts
---
 arch/arm/boot/dts/imx25.dtsi |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
index bb74d95..c174039 100644
--- a/arch/arm/boot/dts/imx25.dtsi
+++ b/arch/arm/boot/dts/imx25.dtsi
@@ -312,7 +312,7 @@
 			gpt4: timer at 53f84000 {
 				compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
 				reg = <0x53f84000 0x4000>;
-				clocks = <&clks 9>, <&clks 45>;
+				clocks = <&clks 95>, <&clks 47>;
 				clock-names = "ipg", "per";
 				interrupts = <1>;
 			};
@@ -320,7 +320,7 @@
 			gpt3: timer at 53f88000 {
 				compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
 				reg = <0x53f88000 0x4000>;
-				clocks = <&clks 9>, <&clks 47>;
+				clocks = <&clks 94>, <&clks 47>;
 				clock-names = "ipg", "per";
 				interrupts = <29>;
 			};
@@ -328,7 +328,7 @@
 			gpt2: timer at 53f8c000 {
 				compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
 				reg = <0x53f8c000 0x4000>;
-				clocks = <&clks 9>, <&clks 47>;
+				clocks = <&clks 93>, <&clks 47>;
 				clock-names = "ipg", "per";
 				interrupts = <53>;
 			};
@@ -336,7 +336,7 @@
 			gpt1: timer at 53f90000 {
 				compatible = "fsl,imx25-gpt", "fsl,imx31-gpt";
 				reg = <0x53f90000 0x4000>;
-				clocks = <&clks 9>, <&clks 47>;
+				clocks = <&clks 92>, <&clks 47>;
 				clock-names = "ipg", "per";
 				interrupts = <54>;
 			};
-- 
1.7.9.5

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

* [PATCH v3 3/3] ARM: i.MX25 clk: Use of_clk_init() for DT case
  2014-06-25 12:41 [PATCH v3 1/3] ARM i.MX25 clk: Fix gpt timer clock Denis Carikli
  2014-06-25 12:41 ` [PATCH v3 2/3] ARM: dts: i.MX25: Fix gpt timers clocks Denis Carikli
@ 2014-06-25 12:41 ` Denis Carikli
  2014-06-25 14:13   ` Fabio Estevam
  2014-06-26  5:43   ` Sascha Hauer
  2014-06-28 15:11 ` [PATCH v3 1/3] ARM i.MX25 clk: Fix gpt timer clock Shawn Guo
  2 siblings, 2 replies; 8+ messages in thread
From: Denis Carikli @ 2014-06-25 12:41 UTC (permalink / raw)
  To: linux-arm-kernel

Replace .init_time() hook with of_clk_init() for DT targets.

Based on:
  d4347ee ARM: i.MX27 clk: Use of_clk_init() for DT case

Signed-off-by: Denis Carikli <denis@eukrea.com>
---
Changelog v2->v3:
- Reworked the patch to look way smaller.
- Thanks to that the ccm global variable is now gone
  (now it's local).

Changelog v1->v2:
- Rebased.
- Removing the warning about the useless int i declaration.
---
 arch/arm/mach-imx/clk-imx25.c |   35 ++++++++++++++++++++---------------
 arch/arm/mach-imx/common.h    |    1 -
 arch/arm/mach-imx/imx25-dt.c  |    6 ------
 3 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
index e759a6d..cab34c3 100644
--- a/arch/arm/mach-imx/clk-imx25.c
+++ b/arch/arm/mach-imx/clk-imx25.c
@@ -32,8 +32,6 @@
 #include "hardware.h"
 #include "mx25.h"
 
-#define CRM_BASE	MX25_IO_ADDRESS(MX25_CRM_BASE_ADDR)
-
 #define CCM_MPCTL	0x00
 #define CCM_UPCTL	0x04
 #define CCM_CCTL	0x08
@@ -56,7 +54,7 @@
 #define CCM_LTR3	0x4c
 #define CCM_MCR		0x64
 
-#define ccm(x)	(CRM_BASE + (x))
+#define ccm(x)	(ccm_base + (x))
 
 static struct clk_onecell_data clk_data;
 
@@ -91,8 +89,11 @@ enum mx25_clks {
 
 static struct clk *clk[clk_max];
 
-static int __init __mx25_clocks_init(unsigned long osc_rate)
+static int __init __mx25_clocks_init(unsigned long osc_rate,
+				     void __iomem *ccm_base)
 {
+	BUG_ON(!ccm_base);
+
 	clk[dummy] = imx_clk_fixed("dummy", 0);
 	clk[osc] = imx_clk_fixed("osc", osc_rate);
 	clk[mpll] = imx_clk_pllv1("mpll", "osc", ccm(CCM_MPCTL));
@@ -240,7 +241,11 @@ static int __init __mx25_clocks_init(unsigned long osc_rate)
 
 int __init mx25_clocks_init(void)
 {
-	__mx25_clocks_init(24000000);
+	void __iomem *ccm;
+
+	ccm = ioremap(MX25_CRM_BASE_ADDR, SZ_16K);
+
+	__mx25_clocks_init(24000000, ccm);
 
 	clk_register_clkdev(clk[gpt1_ipg], "ipg", "imx-gpt.0");
 	clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
@@ -308,29 +313,29 @@ int __init mx25_clocks_init(void)
 	return 0;
 }
 
-int __init mx25_clocks_init_dt(void)
+static void __init mx25_clocks_init_dt(struct device_node *np)
 {
-	struct device_node *np;
+	struct device_node *refnp;
 	unsigned long osc_rate = 24000000;
+	void __iomem *ccm;
 
 	/* retrieve the freqency of fixed clocks from device tree */
-	for_each_compatible_node(np, NULL, "fixed-clock") {
+	for_each_compatible_node(refnp, NULL, "fixed-clock") {
 		u32 rate;
-		if (of_property_read_u32(np, "clock-frequency", &rate))
+		if (of_property_read_u32(refnp, "clock-frequency", &rate))
 			continue;
 
-		if (of_device_is_compatible(np, "fsl,imx-osc"))
+		if (of_device_is_compatible(refnp, "fsl,imx-osc"))
 			osc_rate = rate;
 	}
 
-	np = of_find_compatible_node(NULL, NULL, "fsl,imx25-ccm");
+	ccm = of_iomap(np, 0);
+	__mx25_clocks_init(osc_rate, ccm);
+
 	clk_data.clks = clk;
 	clk_data.clk_num = ARRAY_SIZE(clk);
 	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
 
-	__mx25_clocks_init(osc_rate);
-
 	mxc_timer_init_dt(of_find_compatible_node(NULL, NULL, "fsl,imx25-gpt"));
-
-	return 0;
 }
+CLK_OF_DECLARE(imx25_ccm, "fsl,imx25-ccm", mx25_clocks_init_dt);
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 50ee9c2..08ab255 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -55,7 +55,6 @@ int mx25_clocks_init(void);
 int mx27_clocks_init(unsigned long fref);
 int mx31_clocks_init(unsigned long fref);
 int mx35_clocks_init(void);
-int mx25_clocks_init_dt(void);
 int mx31_clocks_init_dt(void);
 struct platform_device *mxc_register_gpio(char *name, int id,
 	resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c
index 42a65e0..cf8032b 100644
--- a/arch/arm/mach-imx/imx25-dt.c
+++ b/arch/arm/mach-imx/imx25-dt.c
@@ -29,16 +29,10 @@ static const char * const imx25_dt_board_compat[] __initconst = {
 	NULL
 };
 
-static void __init imx25_timer_init(void)
-{
-	mx25_clocks_init_dt();
-}
-
 DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)")
 	.map_io		= mx25_map_io,
 	.init_early	= imx25_init_early,
 	.init_irq	= mx25_init_irq,
-	.init_time	= imx25_timer_init,
 	.init_machine	= imx25_dt_init,
 	.dt_compat	= imx25_dt_board_compat,
 	.restart	= mxc_restart,
-- 
1.7.9.5

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

* [PATCH v3 3/3] ARM: i.MX25 clk: Use of_clk_init() for DT case
  2014-06-25 12:41 ` [PATCH v3 3/3] ARM: i.MX25 clk: Use of_clk_init() for DT case Denis Carikli
@ 2014-06-25 14:13   ` Fabio Estevam
  2014-06-25 14:21     ` Denis Carikli
  2014-06-26  5:43   ` Sascha Hauer
  1 sibling, 1 reply; 8+ messages in thread
From: Fabio Estevam @ 2014-06-25 14:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 25, 2014 at 9:41 AM, Denis Carikli <denis@eukrea.com> wrote:

>  int __init mx25_clocks_init(void)
>  {
> -       __mx25_clocks_init(24000000);
> +       void __iomem *ccm;
> +
> +       ccm = ioremap(MX25_CRM_BASE_ADDR, SZ_16K);

Shouldn't the ccm base address be retrieved from dt?

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

* [PATCH v3 3/3] ARM: i.MX25 clk: Use of_clk_init() for DT case
  2014-06-25 14:13   ` Fabio Estevam
@ 2014-06-25 14:21     ` Denis Carikli
  0 siblings, 0 replies; 8+ messages in thread
From: Denis Carikli @ 2014-06-25 14:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/25/2014 04:13 PM, Fabio Estevam wrote:
>
> On Wed, Jun 25, 2014 at 9:41 AM, Denis Carikli <denis@eukrea.com> wrote:
>
>>   int __init mx25_clocks_init(void)
>>   {
>> -       __mx25_clocks_init(24000000);
>> +       void __iomem *ccm;
>> +
>> +       ccm = ioremap(MX25_CRM_BASE_ADDR, SZ_16K);
>
> Shouldn't the ccm base address be retrieved from dt?
Yes, it is.

As I understand it mx25_clocks_init is called only by the boards files 
(mach-eukrea_cpuimx25.c and mach-mx25_3ds.c) while mx25_clocks_init_dt 
is what is used in the case of a DT boot (in imx25-dt.c).

Denis.

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

* [PATCH v3 2/3] ARM: dts: i.MX25: Fix gpt timers clocks.
  2014-06-25 12:41 ` [PATCH v3 2/3] ARM: dts: i.MX25: Fix gpt timers clocks Denis Carikli
@ 2014-06-25 17:55   ` Fabio Estevam
  0 siblings, 0 replies; 8+ messages in thread
From: Fabio Estevam @ 2014-06-25 17:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 25, 2014 at 9:41 AM, Denis Carikli <denis@eukrea.com> wrote:
> Without that fix, the board freeze during boot.
>
> This appeared after the following commit:
>   496f065 ARM: i.MX: Use of_clk_get_by_name() for timer clocks for DT case.
>
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

This allows mx25pdk to boot again, thanks:

Tested-by: Fabio Estevam <fabio.estevam@freescale.com>

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

* [PATCH v3 3/3] ARM: i.MX25 clk: Use of_clk_init() for DT case
  2014-06-25 12:41 ` [PATCH v3 3/3] ARM: i.MX25 clk: Use of_clk_init() for DT case Denis Carikli
  2014-06-25 14:13   ` Fabio Estevam
@ 2014-06-26  5:43   ` Sascha Hauer
  1 sibling, 0 replies; 8+ messages in thread
From: Sascha Hauer @ 2014-06-26  5:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 25, 2014 at 02:41:36PM +0200, Denis Carikli wrote:
> Replace .init_time() hook with of_clk_init() for DT targets.
> 
> Based on:
>   d4347ee ARM: i.MX27 clk: Use of_clk_init() for DT case
> 
> Signed-off-by: Denis Carikli <denis@eukrea.com>

Looks good now.

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

Sascha


-- 
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] 8+ messages in thread

* [PATCH v3 1/3] ARM i.MX25 clk: Fix gpt timer clock.
  2014-06-25 12:41 [PATCH v3 1/3] ARM i.MX25 clk: Fix gpt timer clock Denis Carikli
  2014-06-25 12:41 ` [PATCH v3 2/3] ARM: dts: i.MX25: Fix gpt timers clocks Denis Carikli
  2014-06-25 12:41 ` [PATCH v3 3/3] ARM: i.MX25 clk: Use of_clk_init() for DT case Denis Carikli
@ 2014-06-28 15:11 ` Shawn Guo
  2 siblings, 0 replies; 8+ messages in thread
From: Shawn Guo @ 2014-06-28 15:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 25, 2014 at 02:41:34PM +0200, Denis Carikli wrote:
> The gpt0 timer clock has been wrong since:
>   6bbaec5 ARM i.MX25: implement clocks using common clock framework
> 
> Signed-off-by: Denis Carikli <denis@eukrea.com>
> Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

Applied all 3, thanks.

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

end of thread, other threads:[~2014-06-28 15:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-25 12:41 [PATCH v3 1/3] ARM i.MX25 clk: Fix gpt timer clock Denis Carikli
2014-06-25 12:41 ` [PATCH v3 2/3] ARM: dts: i.MX25: Fix gpt timers clocks Denis Carikli
2014-06-25 17:55   ` Fabio Estevam
2014-06-25 12:41 ` [PATCH v3 3/3] ARM: i.MX25 clk: Use of_clk_init() for DT case Denis Carikli
2014-06-25 14:13   ` Fabio Estevam
2014-06-25 14:21     ` Denis Carikli
2014-06-26  5:43   ` Sascha Hauer
2014-06-28 15:11 ` [PATCH v3 1/3] ARM i.MX25 clk: Fix gpt timer clock Shawn Guo

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).