linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM: i.MX1 clk: Add missing clocks
@ 2014-05-09  9:59 Alexander Shiyan
  2014-05-09  9:59 ` [PATCH 2/3] ARM: i.MX1 clk: Add devicetree support Alexander Shiyan
  2014-05-09  9:59 ` [PATCH 3/3] ARM: i.MX1 clk: Remove clk_register_clkdev() for unused clocks Alexander Shiyan
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Shiyan @ 2014-05-09  9:59 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds missing clocks for mpll_gate, spll_gate, uart3_gate,
ssi2_gate and brom_gate. As an additional this fixes incorrect bit
position for dma_gate clock.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/mach-imx/clk-imx1.c | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx1.c b/arch/arm/mach-imx/clk-imx1.c
index 15f9d22..602b30a 100644
--- a/arch/arm/mach-imx/clk-imx1.c
+++ b/arch/arm/mach-imx/clk-imx1.c
@@ -40,12 +40,14 @@
 #define SCM_GCCR	IO_ADDR_SCM(0xc)
 
 static const char *prem_sel_clks[] = { "clk32_premult", "clk16m", };
-static const char *clko_sel_clks[] = { "per1", "hclk", "clk48m", "clk16m", "prem",
-				"fclk", };
+static const char *clko_sel_clks[] = { "per1", "hclk", "clk48m", "clk16m",
+				       "prem", "fclk", };
+
 enum imx1_clks {
-	dummy, clk32, clk16m_ext, clk16m, clk32_premult, prem, mpll, spll, mcu,
-	fclk, hclk, clk48m, per1, per2, per3, clko, dma_gate, csi_gate,
-	mma_gate, usbd_gate, clk_max
+	dummy, clk32, clk16m_ext, clk16m, clk32_premult, prem, mpll, mpll_gate,
+	spll, spll_gate, mcu, fclk, hclk, clk48m, per1, per2, per3, clko,
+	uart3_gate, ssi2_gate, brom_gate, dma_gate, csi_gate, mma_gate,
+	usbd_gate, clk_max
 };
 
 static struct clk *clk[clk_max];
@@ -62,17 +64,22 @@ int __init mx1_clocks_init(unsigned long fref)
 	clk[prem] = imx_clk_mux("prem", CCM_CSCR, 16, 1, prem_sel_clks,
 			ARRAY_SIZE(prem_sel_clks));
 	clk[mpll] = imx_clk_pllv1("mpll", "clk32_premult", CCM_MPCTL0);
+	clk[mpll_gate] = imx_clk_gate("mpll_gate", "mpll", CCM_CSCR, 0);
 	clk[spll] = imx_clk_pllv1("spll", "prem", CCM_SPCTL0);
+	clk[spll_gate] = imx_clk_gate("spll_gate", "spll", CCM_CSCR, 1);
 	clk[mcu] = imx_clk_divider("mcu", "clk32_premult", CCM_CSCR, 15, 1);
-	clk[fclk] = imx_clk_divider("fclk", "mpll", CCM_CSCR, 15, 1);
-	clk[hclk] = imx_clk_divider("hclk", "spll", CCM_CSCR, 10, 4);
-	clk[clk48m] = imx_clk_divider("clk48m", "spll", CCM_CSCR, 26, 3);
-	clk[per1] = imx_clk_divider("per1", "spll", CCM_PCDR, 0, 4);
-	clk[per2] = imx_clk_divider("per2", "spll", CCM_PCDR, 4, 4);
-	clk[per3] = imx_clk_divider("per3", "spll", CCM_PCDR, 16, 7);
+	clk[fclk] = imx_clk_divider("fclk", "mpll_gate", CCM_CSCR, 15, 1);
+	clk[hclk] = imx_clk_divider("hclk", "spll_gate", CCM_CSCR, 10, 4);
+	clk[clk48m] = imx_clk_divider("clk48m", "spll_gate", CCM_CSCR, 26, 3);
+	clk[per1] = imx_clk_divider("per1", "spll_gate", CCM_PCDR, 0, 4);
+	clk[per2] = imx_clk_divider("per2", "spll_gate", CCM_PCDR, 4, 4);
+	clk[per3] = imx_clk_divider("per3", "spll_gate", CCM_PCDR, 16, 7);
 	clk[clko] = imx_clk_mux("clko", CCM_CSCR, 29, 3, clko_sel_clks,
 			ARRAY_SIZE(clko_sel_clks));
-	clk[dma_gate] = imx_clk_gate("dma_gate", "hclk", SCM_GCCR, 4);
+	clk[uart3_gate] = imx_clk_gate("uart3_gate", "hclk", SCM_GCCR, 6);
+	clk[ssi2_gate] = imx_clk_gate("ssi2_gate", "hclk", SCM_GCCR, 5);
+	clk[brom_gate] = imx_clk_gate("brom_gate", "hclk", SCM_GCCR, 4);
+	clk[dma_gate] = imx_clk_gate("dma_gate", "hclk", SCM_GCCR, 3);
 	clk[csi_gate] = imx_clk_gate("csi_gate", "hclk", SCM_GCCR, 2);
 	clk[mma_gate] = imx_clk_gate("mma_gate", "hclk", SCM_GCCR, 1);
 	clk[usbd_gate] = imx_clk_gate("usbd_gate", "clk48m", SCM_GCCR, 0);
@@ -94,7 +101,7 @@ int __init mx1_clocks_init(unsigned long fref)
 	clk_register_clkdev(clk[per1], "per", "imx1-uart.1");
 	clk_register_clkdev(clk[hclk], "ipg", "imx1-uart.1");
 	clk_register_clkdev(clk[per1], "per", "imx1-uart.2");
-	clk_register_clkdev(clk[hclk], "ipg", "imx1-uart.2");
+	clk_register_clkdev(clk[uart3_gate], "ipg", "imx1-uart.2");
 	clk_register_clkdev(clk[hclk], NULL, "imx1-i2c.0");
 	clk_register_clkdev(clk[per2], "per", "imx1-cspi.0");
 	clk_register_clkdev(clk[dummy], "ipg", "imx1-cspi.0");
-- 
1.8.3.2

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

* [PATCH 2/3] ARM: i.MX1 clk: Add devicetree support
  2014-05-09  9:59 [PATCH 1/3] ARM: i.MX1 clk: Add missing clocks Alexander Shiyan
@ 2014-05-09  9:59 ` Alexander Shiyan
  2014-05-12  5:13   ` Sascha Hauer
  2014-05-09  9:59 ` [PATCH 3/3] ARM: i.MX1 clk: Remove clk_register_clkdev() for unused clocks Alexander Shiyan
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander Shiyan @ 2014-05-09  9:59 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds devicetree support CCM module for i.MX1 (MC9328MX1) CPUs.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 .../devicetree/bindings/clock/imx1-clock.txt       | 46 ++++++++++++++++++++++
 arch/arm/mach-imx/clk-imx1.c                       | 10 ++++-
 2 files changed, 55 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/clock/imx1-clock.txt

diff --git a/Documentation/devicetree/bindings/clock/imx1-clock.txt b/Documentation/devicetree/bindings/clock/imx1-clock.txt
new file mode 100644
index 0000000..f66fe37
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/imx1-clock.txt
@@ -0,0 +1,46 @@
+* Clock bindings for Freescale i.MX1
+
+Required properties:
+- compatible: Should be "fsl,imx1-ccm".
+- reg: Address and length of the register set.
+- interrupts: Should contain CCM interrupt.
+- #clock-cells: Should be <1>.
+
+The clock consumer should specify the desired clock by having the clock
+ID in its "clocks" phandle cell. The following is a full list of i.MX1
+clocks and IDs.
+
+	Clock			ID
+	---------------------------
+	dummy			0
+	clk32			1
+	clk16m_ext		2
+	clk16m			3
+	clk32_premult		4
+	prem			5
+	mpll			6
+	mpll_gate		7
+	spll			8
+	spll_gate		9
+	mcu			10
+	fclk			11
+	hclk			12
+	clk48m			13
+	per1			14
+	per2			15
+	per3			16
+	clko			17
+	uart3_gate		18
+	ssi2_gate		19
+	brom_gate		20
+	dma_gate		21
+	csi_gate		22
+	mma_gate		23
+	usbd_gate		24
+
+Examples:
+	clks: ccm at 0021b000 {
+		compatible = "fsl,imx1-ccm";
+		reg = <0x0021b000 0x1000>;
+		interrupts = <59>;
+	};
diff --git a/arch/arm/mach-imx/clk-imx1.c b/arch/arm/mach-imx/clk-imx1.c
index 602b30a..d13dce4 100644
--- a/arch/arm/mach-imx/clk-imx1.c
+++ b/arch/arm/mach-imx/clk-imx1.c
@@ -20,7 +20,9 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/clkdev.h>
+#include <linux/clk-provider.h>
 #include <linux/err.h>
+#include <linux/of.h>
 
 #include "clk.h"
 #include "common.h"
@@ -57,7 +59,7 @@ int __init mx1_clocks_init(unsigned long fref)
 	int i;
 
 	clk[dummy] = imx_clk_fixed("dummy", 0);
-	clk[clk32] = imx_clk_fixed("clk32", fref);
+	clk[clk32] = imx_obtain_fixed_clock("clk32", fref);
 	clk[clk16m_ext] = imx_clk_fixed("clk16m_ext", 16000000);
 	clk[clk16m] = imx_clk_gate("clk16m", "clk16m_ext", CCM_CSCR, 17);
 	clk[clk32_premult] = imx_clk_fixed_factor("clk32_premult", "clk32", 512, 1);
@@ -120,3 +122,9 @@ int __init mx1_clocks_init(unsigned long fref)
 
 	return 0;
 }
+
+static void __init mx1_clocks_init_dt(struct device_node *np)
+{
+	mx1_clocks_init(32768);
+}
+CLK_OF_DECLARE(imx1_ccm, "fsl,imx1-ccm", mx1_clocks_init_dt);
-- 
1.8.3.2

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

* [PATCH 3/3] ARM: i.MX1 clk: Remove clk_register_clkdev() for unused clocks
  2014-05-09  9:59 [PATCH 1/3] ARM: i.MX1 clk: Add missing clocks Alexander Shiyan
  2014-05-09  9:59 ` [PATCH 2/3] ARM: i.MX1 clk: Add devicetree support Alexander Shiyan
@ 2014-05-09  9:59 ` Alexander Shiyan
  1 sibling, 0 replies; 5+ messages in thread
From: Alexander Shiyan @ 2014-05-09  9:59 UTC (permalink / raw)
  To: linux-arm-kernel

This patch removes clk_register_clkdev() for the clocks that do not
have any users for non-DT boards and drivers.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/mach-imx/clk-imx1.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx1.c b/arch/arm/mach-imx/clk-imx1.c
index d13dce4..2f37896 100644
--- a/arch/arm/mach-imx/clk-imx1.c
+++ b/arch/arm/mach-imx/clk-imx1.c
@@ -94,7 +94,6 @@ int __init mx1_clocks_init(unsigned long fref)
 	clk_register_clkdev(clk[dma_gate], "ahb", "imx1-dma");
 	clk_register_clkdev(clk[hclk], "ipg", "imx1-dma");
 	clk_register_clkdev(clk[csi_gate], NULL, "mx1-camera.0");
-	clk_register_clkdev(clk[mma_gate], "mma", NULL);
 	clk_register_clkdev(clk[usbd_gate], NULL, "imx_udc.0");
 	clk_register_clkdev(clk[per1], "per", "imx-gpt.0");
 	clk_register_clkdev(clk[hclk], "ipg", "imx-gpt.0");
@@ -113,10 +112,6 @@ int __init mx1_clocks_init(unsigned long fref)
 	clk_register_clkdev(clk[per2], "per", "imx1-fb.0");
 	clk_register_clkdev(clk[dummy], "ipg", "imx1-fb.0");
 	clk_register_clkdev(clk[dummy], "ahb", "imx1-fb.0");
-	clk_register_clkdev(clk[hclk], "mshc", NULL);
-	clk_register_clkdev(clk[per3], "ssi", NULL);
-	clk_register_clkdev(clk[clk32], NULL, "imx1-rtc.0");
-	clk_register_clkdev(clk[clko], "clko", NULL);
 
 	mxc_timer_init(MX1_IO_ADDRESS(MX1_TIM1_BASE_ADDR), MX1_TIM1_INT);
 
-- 
1.8.3.2

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

* [PATCH 2/3] ARM: i.MX1 clk: Add devicetree support
  2014-05-09  9:59 ` [PATCH 2/3] ARM: i.MX1 clk: Add devicetree support Alexander Shiyan
@ 2014-05-12  5:13   ` Sascha Hauer
  2014-05-12  6:25     ` Alexander Shiyan
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2014-05-12  5:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, May 09, 2014 at 01:59:01PM +0400, Alexander Shiyan wrote:
> This patch adds devicetree support CCM module for i.MX1 (MC9328MX1) CPUs.
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  .../devicetree/bindings/clock/imx1-clock.txt       | 46 ++++++++++++++++++++++
>  arch/arm/mach-imx/clk-imx1.c                       | 10 ++++-
>  2 files changed, 55 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/clock/imx1-clock.txt
> 
> diff --git a/Documentation/devicetree/bindings/clock/imx1-clock.txt b/Documentation/devicetree/bindings/clock/imx1-clock.txt
> new file mode 100644
> index 0000000..f66fe37
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/clock/imx1-clock.txt

Can we meld this for i.MX1 into this patch?:

commit 490dd8808a8baa093ac3b2bfc2f66f798599bb2c
Author: Lucas Stach <l.stach@pengutronix.de>
Date:   Thu Nov 14 11:18:57 2013 +0100

    ARM: imx5: introduce DT includes for clock provider
    
    Use clock defines in order to make devicetrees more
    human readable.

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

* Re: [PATCH 2/3] ARM: i.MX1 clk: Add devicetree support
  2014-05-12  5:13   ` Sascha Hauer
@ 2014-05-12  6:25     ` Alexander Shiyan
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Shiyan @ 2014-05-12  6:25 UTC (permalink / raw)
  To: linux-arm-kernel

Mon, 12 May 2014 07:13:08 +0200 ?? Sascha Hauer <s.hauer@pengutronix.de>:
> On Fri, May 09, 2014 at 01:59:01PM +0400, Alexander Shiyan wrote:
> > This patch adds devicetree support CCM module for i.MX1 (MC9328MX1) CPUs.
> > 
> > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> > ---
> >  .../devicetree/bindings/clock/imx1-clock.txt       | 46 ++++++++++++++++++++++
> >  arch/arm/mach-imx/clk-imx1.c                       | 10 ++++-
> >  2 files changed, 55 insertions(+), 1 deletion(-)
> >  create mode 100644 Documentation/devicetree/bindings/clock/imx1-clock.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/clock/imx1-clock.txt b/Documentation/devicetree/bindings/clock/imx1-clock.txt
> > new file mode 100644
> > index 0000000..f66fe37
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/clock/imx1-clock.txt
> 
> Can we meld this for i.MX1 into this patch?:
> 
> commit 490dd8808a8baa093ac3b2bfc2f66f798599bb2c
> Author: Lucas Stach <l.stach@pengutronix.de>
> Date:   Thu Nov 14 11:18:57 2013 +0100
> 
>     ARM: imx5: introduce DT includes for clock provider
>     
>     Use clock defines in order to make devicetrees more
>     human readable.

Yes, I will prepare another series with the bindings. In any case I would
like to update this patch series.

---

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

end of thread, other threads:[~2014-05-12  6:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-09  9:59 [PATCH 1/3] ARM: i.MX1 clk: Add missing clocks Alexander Shiyan
2014-05-09  9:59 ` [PATCH 2/3] ARM: i.MX1 clk: Add devicetree support Alexander Shiyan
2014-05-12  5:13   ` Sascha Hauer
2014-05-12  6:25     ` Alexander Shiyan
2014-05-09  9:59 ` [PATCH 3/3] ARM: i.MX1 clk: Remove clk_register_clkdev() for unused clocks Alexander Shiyan

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