All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] clk: mxs: mach header cleanup
@ 2013-03-26 13:59 Shawn Guo
  2013-03-26 13:59 ` [PATCH 1/2] clk: mxs: get base address from device tree Shawn Guo
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Shawn Guo @ 2013-03-26 13:59 UTC (permalink / raw)
  To: linux-arm-kernel

The series cleans up the mach header inclusion from mxs clk drivers,
which is another step to multiplatform support.

Mike,

The series depends on some mxs platform cleanup patches on my tree.
May I ask you ACK on the patches to have them go arm-soc tree?

Shawn

Shawn Guo (2):
  clk: mxs: get base address from device tree
  clk: mxs: remove the use of mach level IO accessor

 arch/arm/boot/dts/imx23.dtsi |    1 +
 arch/arm/boot/dts/imx28.dtsi |    1 +
 drivers/clk/mxs/clk-imx23.c  |   37 +++++++++++++++++++++++--------------
 drivers/clk/mxs/clk-imx28.c  |   38 +++++++++++++++++++++++---------------
 4 files changed, 48 insertions(+), 29 deletions(-)

-- 
1.7.9.5

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

* [PATCH 1/2] clk: mxs: get base address from device tree
  2013-03-26 13:59 [PATCH 0/2] clk: mxs: mach header cleanup Shawn Guo
@ 2013-03-26 13:59 ` Shawn Guo
  2013-03-26 15:12   ` Michał Mirosław
  2013-03-26 13:59 ` [PATCH 2/2] clk: mxs: remove the use of mach level IO accessor Shawn Guo
  2013-03-26 18:35 ` [PATCH 0/2] clk: mxs: mach header cleanup Mike Turquette
  2 siblings, 1 reply; 6+ messages in thread
From: Shawn Guo @ 2013-03-26 13:59 UTC (permalink / raw)
  To: linux-arm-kernel

Instead of using the static definitions, get clkctrl and digctl base
addresses with mapping from device tree.

Use macro on variable is not nice, but it's done here to save huge
pointless diff stat.

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

diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 27ce807..8d37aa7 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -295,6 +295,7 @@
 			};
 
 			digctl at 8001c000 {
+				compatible = "fsl,imx23-digctl";
 				reg = <0x8001c000 2000>;
 				status = "disabled";
 			};
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index c2f10d3..d306ff5 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -647,6 +647,7 @@
 			};
 
 			digctl at 8001c000 {
+				compatible = "fsl,imx28-digctl";
 				reg = <0x8001c000 0x2000>;
 				interrupts = <89>;
 				status = "disabled";
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index 46ae6be..0c8fda4 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -15,11 +15,16 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/of.h>
+#include <linux/of_address.h>
 #include <mach/mx23.h>
 #include "clk.h"
 
-#define DIGCTRL			MX23_IO_ADDRESS(MX23_DIGCTL_BASE_ADDR)
-#define CLKCTRL			MX23_IO_ADDRESS(MX23_CLKCTRL_BASE_ADDR)
+static void __iomem *clkctrl;
+static void __iomem *digctrl;
+
+#define CLKCTRL clkctrl
+#define DIGCTRL digctrl
+
 #define PLLCTRL0		(CLKCTRL + 0x0000)
 #define CPU			(CLKCTRL + 0x0020)
 #define HBUS			(CLKCTRL + 0x0030)
@@ -100,6 +105,14 @@ int __init mx23_clocks_init(void)
 	struct device_node *np;
 	u32 i;
 
+	np = of_find_compatible_node(NULL, NULL, "fsl,imx23-digctl");
+	digctrl = of_iomap(np, 0);
+	WARN_ON(!digctrl);
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,imx23-clkctrl");
+	clkctrl = of_iomap(np, 0);
+	WARN_ON(!clkctrl);
+
 	clk_misc_init();
 
 	clks[ref_xtal] = mxs_clk_fixed("ref_xtal", 24000000);
@@ -152,12 +165,9 @@ int __init mx23_clocks_init(void)
 			return PTR_ERR(clks[i]);
 		}
 
-	np = of_find_compatible_node(NULL, NULL, "fsl,imx23-clkctrl");
-	if (np) {
-		clk_data.clks = clks;
-		clk_data.clk_num = ARRAY_SIZE(clks);
-		of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
-	}
+	clk_data.clks = clks;
+	clk_data.clk_num = ARRAY_SIZE(clks);
+	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
 
 	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 fb30cd9..f623fdd 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -15,10 +15,13 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/of.h>
+#include <linux/of_address.h>
 #include <mach/mx28.h>
 #include "clk.h"
 
-#define CLKCTRL			MX28_IO_ADDRESS(MX28_CLKCTRL_BASE_ADDR)
+static void __iomem *clkctrl;
+#define CLKCTRL clkctrl
+
 #define PLL0CTRL0		(CLKCTRL + 0x0000)
 #define PLL1CTRL0		(CLKCTRL + 0x0020)
 #define PLL2CTRL0		(CLKCTRL + 0x0040)
@@ -52,7 +55,8 @@
 #define BP_FRAC0_IO1FRAC	16
 #define BP_FRAC0_IO0FRAC	24
 
-#define DIGCTRL			MX28_IO_ADDRESS(MX28_DIGCTL_BASE_ADDR)
+static void __iomem *digctrl;
+#define DIGCTRL digctrl
 #define BP_SAIF_CLKMUX		10
 
 /*
@@ -155,6 +159,14 @@ int __init mx28_clocks_init(void)
 	struct device_node *np;
 	u32 i;
 
+	np = of_find_compatible_node(NULL, NULL, "fsl,imx28-digctl");
+	digctrl = of_iomap(np, 0);
+	WARN_ON(!digctrl);
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,imx28-clkctrl");
+	clkctrl = of_iomap(np, 0);
+	WARN_ON(!clkctrl);
+
 	clk_misc_init();
 
 	clks[ref_xtal] = mxs_clk_fixed("ref_xtal", 24000000);
@@ -230,12 +242,9 @@ int __init mx28_clocks_init(void)
 			return PTR_ERR(clks[i]);
 		}
 
-	np = of_find_compatible_node(NULL, NULL, "fsl,imx28-clkctrl");
-	if (np) {
-		clk_data.clks = clks;
-		clk_data.clk_num = ARRAY_SIZE(clks);
-		of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
-	}
+	clk_data.clks = clks;
+	clk_data.clk_num = ARRAY_SIZE(clks);
+	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
 
 	clk_register_clkdev(clks[enet_out], NULL, "enet_out");
 
-- 
1.7.9.5

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

* [PATCH 2/2] clk: mxs: remove the use of mach level IO accessor
  2013-03-26 13:59 [PATCH 0/2] clk: mxs: mach header cleanup Shawn Guo
  2013-03-26 13:59 ` [PATCH 1/2] clk: mxs: get base address from device tree Shawn Guo
@ 2013-03-26 13:59 ` Shawn Guo
  2013-03-26 18:35 ` [PATCH 0/2] clk: mxs: mach header cleanup Mike Turquette
  2 siblings, 0 replies; 6+ messages in thread
From: Shawn Guo @ 2013-03-26 13:59 UTC (permalink / raw)
  To: linux-arm-kernel

It removes the use of mach level IO accessor __mxs_setl/clrl, and hence
removes mach header inclusion from clock driver.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/clk/mxs/clk-imx23.c |   11 +++++------
 drivers/clk/mxs/clk-imx28.c |   13 ++++++-------
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index 0c8fda4..f6a7487 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -16,7 +16,6 @@
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
-#include <mach/mx23.h>
 #include "clk.h"
 
 static void __iomem *clkctrl;
@@ -52,10 +51,10 @@ static void __init clk_misc_init(void)
 	u32 val;
 
 	/* Gate off cpu clock in WFI for power saving */
-	__mxs_setl(1 << BP_CPU_INTERRUPT_WAIT, CPU);
+	writel_relaxed(1 << BP_CPU_INTERRUPT_WAIT, CPU + SET);
 
 	/* Clear BYPASS for SAIF */
-	__mxs_clrl(1 << BP_CLKSEQ_BYPASS_SAIF, CLKSEQ);
+	writel_relaxed(1 << BP_CLKSEQ_BYPASS_SAIF, CLKSEQ + CLR);
 
 	/* SAIF has to use frac div for functional operation */
 	val = readl_relaxed(SAIF);
@@ -66,14 +65,14 @@ static void __init clk_misc_init(void)
 	 * Source ssp clock from ref_io than ref_xtal,
 	 * as ref_xtal only provides 24 MHz as maximum.
 	 */
-	__mxs_clrl(1 << BP_CLKSEQ_BYPASS_SSP, CLKSEQ);
+	writel_relaxed(1 << BP_CLKSEQ_BYPASS_SSP, CLKSEQ + CLR);
 
 	/*
 	 * 480 MHz seems too high to be ssp clock source directly,
 	 * so set frac to get a 288 MHz ref_io.
 	 */
-	__mxs_clrl(0x3f << BP_FRAC_IOFRAC, FRAC);
-	__mxs_setl(30 << BP_FRAC_IOFRAC, FRAC);
+	writel_relaxed(0x3f << BP_FRAC_IOFRAC, FRAC + CLR);
+	writel_relaxed(30 << BP_FRAC_IOFRAC, FRAC + SET);
 }
 
 static const char *sel_pll[]  __initconst = { "pll", "ref_xtal", };
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index f623fdd..d0e5eed 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -16,7 +16,6 @@
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
-#include <mach/mx28.h>
 #include "clk.h"
 
 static void __iomem *clkctrl;
@@ -75,8 +74,8 @@ int mxs_saif_clkmux_select(unsigned int clkmux)
 	if (clkmux > 0x3)
 		return -EINVAL;
 
-	__mxs_clrl(0x3 << BP_SAIF_CLKMUX, DIGCTRL);
-	__mxs_setl(clkmux << BP_SAIF_CLKMUX, DIGCTRL);
+	writel_relaxed(0x3 << BP_SAIF_CLKMUX, DIGCTRL + CLR);
+	writel_relaxed(clkmux << BP_SAIF_CLKMUX, DIGCTRL + SET);
 
 	return 0;
 }
@@ -86,13 +85,13 @@ static void __init clk_misc_init(void)
 	u32 val;
 
 	/* Gate off cpu clock in WFI for power saving */
-	__mxs_setl(1 << BP_CPU_INTERRUPT_WAIT, CPU);
+	writel_relaxed(1 << BP_CPU_INTERRUPT_WAIT, CPU + SET);
 
 	/* 0 is a bad default value for a divider */
-	__mxs_setl(1 << BP_ENET_DIV_TIME, ENET);
+	writel_relaxed(1 << BP_ENET_DIV_TIME, ENET + SET);
 
 	/* Clear BYPASS for SAIF */
-	__mxs_clrl(0x3 << BP_CLKSEQ_BYPASS_SAIF0, CLKSEQ);
+	writel_relaxed(0x3 << BP_CLKSEQ_BYPASS_SAIF0, CLKSEQ + CLR);
 
 	/* SAIF has to use frac div for functional operation */
 	val = readl_relaxed(SAIF0);
@@ -112,7 +111,7 @@ static void __init clk_misc_init(void)
 	 * Source ssp clock from ref_io than ref_xtal,
 	 * as ref_xtal only provides 24 MHz as maximum.
 	 */
-	__mxs_clrl(0xf << BP_CLKSEQ_BYPASS_SSP0, CLKSEQ);
+	writel_relaxed(0xf << BP_CLKSEQ_BYPASS_SSP0, CLKSEQ + CLR);
 
 	/*
 	 * 480 MHz seems too high to be ssp clock source directly,
-- 
1.7.9.5

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

* [PATCH 1/2] clk: mxs: get base address from device tree
  2013-03-26 13:59 ` [PATCH 1/2] clk: mxs: get base address from device tree Shawn Guo
@ 2013-03-26 15:12   ` Michał Mirosław
  2013-03-27  3:29     ` Shawn Guo
  0 siblings, 1 reply; 6+ messages in thread
From: Michał Mirosław @ 2013-03-26 15:12 UTC (permalink / raw)
  To: linux-arm-kernel

2013/3/26 Shawn Guo <shawn.guo@linaro.org>:
> Instead of using the static definitions, get clkctrl and digctl base
> addresses with mapping from device tree.
>
> Use macro on variable is not nice, but it's done here to save huge
> pointless diff stat.
>
[...]
> @@ -100,6 +105,14 @@ int __init mx23_clocks_init(void)
>         struct device_node *np;
>         u32 i;
>
> +       np = of_find_compatible_node(NULL, NULL, "fsl,imx23-digctl");
> +       digctrl = of_iomap(np, 0);
> +       WARN_ON(!digctrl);
> +
> +       np = of_find_compatible_node(NULL, NULL, "fsl,imx23-clkctrl");
> +       clkctrl = of_iomap(np, 0);
> +       WARN_ON(!clkctrl);
> +

WARN? Won't the system die soon anyway if the addresses cannot be found?

Best Regards,
Micha? Miros?aw

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

* [PATCH 0/2] clk: mxs: mach header cleanup
  2013-03-26 13:59 [PATCH 0/2] clk: mxs: mach header cleanup Shawn Guo
  2013-03-26 13:59 ` [PATCH 1/2] clk: mxs: get base address from device tree Shawn Guo
  2013-03-26 13:59 ` [PATCH 2/2] clk: mxs: remove the use of mach level IO accessor Shawn Guo
@ 2013-03-26 18:35 ` Mike Turquette
  2 siblings, 0 replies; 6+ messages in thread
From: Mike Turquette @ 2013-03-26 18:35 UTC (permalink / raw)
  To: linux-arm-kernel

Quoting Shawn Guo (2013-03-26 06:59:32)
> The series cleans up the mach header inclusion from mxs clk drivers,
> which is another step to multiplatform support.
> 
> Mike,
> 
> The series depends on some mxs platform cleanup patches on my tree.
> May I ask you ACK on the patches to have them go arm-soc tree?
> 
> Shawn
> 

Hi Shawn,

Nice cleanup.

Acked-by: Mike Turquette <mturquette@linaro.org>

> Shawn Guo (2):
>   clk: mxs: get base address from device tree
>   clk: mxs: remove the use of mach level IO accessor
> 
>  arch/arm/boot/dts/imx23.dtsi |    1 +
>  arch/arm/boot/dts/imx28.dtsi |    1 +
>  drivers/clk/mxs/clk-imx23.c  |   37 +++++++++++++++++++++++--------------
>  drivers/clk/mxs/clk-imx28.c  |   38 +++++++++++++++++++++++---------------
>  4 files changed, 48 insertions(+), 29 deletions(-)
> 
> -- 
> 1.7.9.5

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

* [PATCH 1/2] clk: mxs: get base address from device tree
  2013-03-26 15:12   ` Michał Mirosław
@ 2013-03-27  3:29     ` Shawn Guo
  0 siblings, 0 replies; 6+ messages in thread
From: Shawn Guo @ 2013-03-27  3:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 26, 2013 at 04:12:35PM +0100, Micha? Miros?aw wrote:
> 2013/3/26 Shawn Guo <shawn.guo@linaro.org>:
> > Instead of using the static definitions, get clkctrl and digctl base
> > addresses with mapping from device tree.
> >
> > Use macro on variable is not nice, but it's done here to save huge
> > pointless diff stat.
> >
> [...]
> > @@ -100,6 +105,14 @@ int __init mx23_clocks_init(void)
> >         struct device_node *np;
> >         u32 i;
> >
> > +       np = of_find_compatible_node(NULL, NULL, "fsl,imx23-digctl");
> > +       digctrl = of_iomap(np, 0);
> > +       WARN_ON(!digctrl);
> > +
> > +       np = of_find_compatible_node(NULL, NULL, "fsl,imx23-clkctrl");
> > +       clkctrl = of_iomap(np, 0);
> > +       WARN_ON(!clkctrl);
> > +
> 
> WARN? Won't the system die soon anyway if the addresses cannot be found?

Probably.  But this big fat warning is also good at telling where goes
wrong at the first place, so I do not see much difference than using BUG.

Shawn

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

end of thread, other threads:[~2013-03-27  3:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-26 13:59 [PATCH 0/2] clk: mxs: mach header cleanup Shawn Guo
2013-03-26 13:59 ` [PATCH 1/2] clk: mxs: get base address from device tree Shawn Guo
2013-03-26 15:12   ` Michał Mirosław
2013-03-27  3:29     ` Shawn Guo
2013-03-26 13:59 ` [PATCH 2/2] clk: mxs: remove the use of mach level IO accessor Shawn Guo
2013-03-26 18:35 ` [PATCH 0/2] clk: mxs: mach header cleanup Mike Turquette

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.