linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/3] clk: imx28: add DC-DC clock domain
@ 2015-04-20 21:45 Stefan Wahren
  2015-04-20 21:45 ` [PATCH RFC 1/3] DT: imx28-clock: add ids for " Stefan Wahren
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Wahren @ 2015-04-20 21:45 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd
  Cc: Shawn Guo, Mark Brown, Mark Rutland, Fabio Estevam, Marek Vasut,
	Sascha Hauer, devicetree, linux-kernel, Stefan Wahren

This patch series integrates the DC-DC clock domain into the i.MX28 clock 
driver. That enables consumers to change DC-DC clock frequency in order to avoid
interferences without changing hardware. The final patch in the near future 
should handle the i.MX23, too.

 * patch 1 contains the update for the DT binding documentation
 * patch 2 defines the PMU as the clock consumer
 * patch 3 is extension of the clock driver

All information about the DC-DC clock was taken from the reference manual [1].
Unfortunately the logical diagram doesn't contain the DC-DC clock domain,
so i decide to create a ASCII diagramm (please look at patch 1).

The series is related to the upcoming MXS PMU and regulator driver 
(last patch [2], working repo [3]).
 
At the end i still have a question:

The MXS PMU driver will using the syscon interface for accessing the
HW_POWER registers. The ctrl register for the DC-DC clock domain is located
under HW_POWER and not under HW_CLKCTRL.

So should the clock registration be done in clock driver like in patch 3 or
in the upcoming PMU driver?

Any other comments about the implementation are also welcome.

Regards
Stefan

[1] - http://cache.freescale.com/files/dsp/doc/ref_manual/MCIMX28RM.pdf
      i.MX28 Applications Processor Reference Manual, Rev. 2, 08/2013
      11.12.10 DC-DC Miscellaneous Register (HW_POWER_MISC)
[2] - http://marc.info/?l=linux-pm&m=142698428606221&w=2
[3] - https://github.com/lategoodbye/linux-mxs-power/tree/syscon

Stefan Wahren (3):
  DT: imx28-clock: add ids for DC-DC clock domain
  ARM: imx28: define PMU as clock consumer
  clk: imx28: add DC-DC clock domain

 .../devicetree/bindings/clock/imx28-clock.txt      |    3 ++
 arch/arm/boot/dts/imx28.dtsi                       |    2 ++
 drivers/clk/mxs/clk-imx28.c                        |   33 +++++++++++++++++---
 3 files changed, 33 insertions(+), 5 deletions(-)

-- 
1.7.9.5


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

* [PATCH RFC 1/3] DT: imx28-clock: add ids for DC-DC clock domain
  2015-04-20 21:45 [PATCH RFC 0/3] clk: imx28: add DC-DC clock domain Stefan Wahren
@ 2015-04-20 21:45 ` Stefan Wahren
  2015-04-20 21:45 ` [PATCH RFC 2/3] ARM: imx28: define PMU as clock consumer Stefan Wahren
  2015-04-20 21:45 ` [PATCH RFC 3/3] clk: imx28: add DC-DC clock domain Stefan Wahren
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Wahren @ 2015-04-20 21:45 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd
  Cc: Shawn Guo, Mark Brown, Mark Rutland, Fabio Estevam, Marek Vasut,
	Sascha Hauer, devicetree, linux-kernel, Stefan Wahren

This patch adds the clock ids for the integrated DC-DC converter
of the i.MX28:

 ref_xtal                             |\
 ------------------------------------>| \
                                      |  \         +----------+
                                      |   \        |          |
 ref_pll  |\                          |    +-------> CLK_DCDC |
 -------->| \       +---------+       |   /        |          |
          |  \      |         |       |  /         +----------+
          |   +-----> DIV INT |------>| /
 ref_gpmi |  /      |         |       |/
 -------->| /       +---------+       dcdc_sel
          |/        dcdc_div
          dcdc_pll

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 .../devicetree/bindings/clock/imx28-clock.txt      |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/clock/imx28-clock.txt b/Documentation/devicetree/bindings/clock/imx28-clock.txt
index e6587af..3678e3c 100644
--- a/Documentation/devicetree/bindings/clock/imx28-clock.txt
+++ b/Documentation/devicetree/bindings/clock/imx28-clock.txt
@@ -76,6 +76,9 @@ clocks and IDs.
 	usb0_phy	62
 	usb1_phy	63
 	enet_out	64
+	dcdc_pll	65
+	dcdc_div	66
+	dcdc_sel	67
 
 Examples:
 
-- 
1.7.9.5


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

* [PATCH RFC 2/3] ARM: imx28: define PMU as clock consumer
  2015-04-20 21:45 [PATCH RFC 0/3] clk: imx28: add DC-DC clock domain Stefan Wahren
  2015-04-20 21:45 ` [PATCH RFC 1/3] DT: imx28-clock: add ids for " Stefan Wahren
@ 2015-04-20 21:45 ` Stefan Wahren
  2015-04-20 21:45 ` [PATCH RFC 3/3] clk: imx28: add DC-DC clock domain Stefan Wahren
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Wahren @ 2015-04-20 21:45 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd
  Cc: Shawn Guo, Mark Brown, Mark Rutland, Fabio Estevam, Marek Vasut,
	Sascha Hauer, devicetree, linux-kernel, Stefan Wahren

This patch defines the i.MX28 PMU as consumer of clock dcdc_sel.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 arch/arm/boot/dts/imx28.dtsi |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index 02330f4..bdd087d 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -1022,7 +1022,9 @@
 			};
 
 			power: power@80044000 {
+				compatible = "fsl,imx28-power", "syscon";
 				reg = <0x80044000 0x2000>;
+				clocks = <&clks 67>;
 				status = "disabled";
 			};
 
-- 
1.7.9.5


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

* [PATCH RFC 3/3] clk: imx28: add DC-DC clock domain
  2015-04-20 21:45 [PATCH RFC 0/3] clk: imx28: add DC-DC clock domain Stefan Wahren
  2015-04-20 21:45 ` [PATCH RFC 1/3] DT: imx28-clock: add ids for " Stefan Wahren
  2015-04-20 21:45 ` [PATCH RFC 2/3] ARM: imx28: define PMU as clock consumer Stefan Wahren
@ 2015-04-20 21:45 ` Stefan Wahren
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Wahren @ 2015-04-20 21:45 UTC (permalink / raw)
  To: Mike Turquette, Stephen Boyd
  Cc: Shawn Guo, Mark Brown, Mark Rutland, Fabio Estevam, Marek Vasut,
	Sascha Hauer, devicetree, linux-kernel, Stefan Wahren

This patch adds the DC-DC clock domain into the i.MX28 clock driver.
That enables consumers to change DC-DC clock frequency in order to
avoid interferences without changing hardware.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 drivers/clk/mxs/clk-imx28.c |   33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index a6c3501..de2c347 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -60,6 +60,18 @@ static void __iomem *digctrl;
 #define DIGCTRL digctrl
 #define BP_SAIF_CLKMUX		10
 
+static void __iomem *powerctrl;
+#define POWERCTRL powerctrl
+#define POWER_MISC		(POWERCTRL + 0x0090)
+
+static const struct clk_div_table dcdc_div_table[] = {
+	{ .val = 0, .div = 16 },
+	{ .val = 1, .div = 24 },
+	{ .val = 2, .div = 20 },
+	{ .val = 3, .div = 25 },
+	{ /* sentinel */ },
+};
+
 /*
  * HW_SAIF_CLKMUX_SEL:
  *  DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks, and SAIF1
@@ -134,6 +146,8 @@ static const char *sel_pll0[] __initconst = { "pll0", "ref_xtal", };
 static const char *cpu_sels[] __initconst = { "cpu_pll", "cpu_xtal", };
 static const char *emi_sels[] __initconst = { "emi_pll", "emi_xtal", };
 static const char *ptp_sels[] __initconst = { "ref_xtal", "pll0", };
+static const char *dcdc_plls[] __initconst = { "pll0", "ref_gpmi", };
+static const char *dcdc_sels[] __initconst = { "ref_xtal", "dcdc_div", };
 
 enum imx28_clk {
 	ref_xtal, pll0, pll1, pll2, ref_cpu, ref_emi, ref_io0, ref_io1,
@@ -145,7 +159,8 @@ enum imx28_clk {
 	clk32k_div, rtc, lradc, spdif_div, clk32k, pwm, uart, ssp0,
 	ssp1, ssp2, ssp3, gpmi, spdif, emi, saif0, saif1, lcdif, etm,
 	fec, can0, can1, usb0, usb1, usb0_phy, usb1_phy, enet_out,
-	clk_max
+	dcdc_pll, dcdc_div, dcdc_sel,
+	clk_max,
 };
 
 static struct clk *clks[clk_max];
@@ -157,13 +172,18 @@ static enum imx28_clk clks_init_on[] __initdata = {
 
 static void __init mx28_clocks_init(struct device_node *np)
 {
-	struct device_node *dcnp;
+	struct device_node *tnp;
 	u32 i;
 
-	dcnp = of_find_compatible_node(NULL, NULL, "fsl,imx28-digctl");
-	digctrl = of_iomap(dcnp, 0);
+	tnp = of_find_compatible_node(NULL, NULL, "fsl,imx28-digctl");
+	digctrl = of_iomap(tnp, 0);
 	WARN_ON(!digctrl);
-	of_node_put(dcnp);
+	of_node_put(tnp);
+
+	tnp = of_find_compatible_node(NULL, NULL, "fsl,imx28-power");
+	powerctrl = of_iomap(tnp, 0);
+	WARN_ON(!powerctrl);
+	of_node_put(tnp);
 
 	clkctrl = of_iomap(np, 0);
 	WARN_ON(!clkctrl);
@@ -235,6 +255,9 @@ static void __init mx28_clocks_init(struct device_node *np)
 	clks[usb0_phy] = clk_register_gate(NULL, "usb0_phy", "pll0", 0, PLL0CTRL0, 18, 0, &mxs_lock);
 	clks[usb1_phy] = clk_register_gate(NULL, "usb1_phy", "pll1", 0, PLL1CTRL0, 18, 0, &mxs_lock);
 	clks[enet_out] = clk_register_gate(NULL, "enet_out", "pll2", 0, ENET, 18, 0, &mxs_lock);
+	clks[dcdc_pll] = mxs_clk_mux("dcdc_pll", POWER_MISC, 6, 1, dcdc_plls, ARRAY_SIZE(dcdc_plls));
+	clks[dcdc_div] = clk_register_divider_table(NULL, "dcdc_div", "dcdc_pll", 0, POWER_MISC, 4, 2, 0, dcdc_div_table, &mxs_lock);
+	clks[dcdc_sel] = mxs_clk_mux("dcdc_sel", POWER_MISC, 0, 1, dcdc_sels, ARRAY_SIZE(dcdc_sels));
 
 	for (i = 0; i < ARRAY_SIZE(clks); i++)
 		if (IS_ERR(clks[i])) {
-- 
1.7.9.5


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

end of thread, other threads:[~2015-04-20 21:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-20 21:45 [PATCH RFC 0/3] clk: imx28: add DC-DC clock domain Stefan Wahren
2015-04-20 21:45 ` [PATCH RFC 1/3] DT: imx28-clock: add ids for " Stefan Wahren
2015-04-20 21:45 ` [PATCH RFC 2/3] ARM: imx28: define PMU as clock consumer Stefan Wahren
2015-04-20 21:45 ` [PATCH RFC 3/3] clk: imx28: add DC-DC clock domain Stefan Wahren

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