linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4 - Keystone DTS and clock driver updates]
@ 2013-11-20  0:45 Murali Karicheri
  2013-11-20  0:45 ` [PATCH v2 1/4] clk: keystone: use clkod register bits for postdiv Murali Karicheri
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Murali Karicheri @ 2013-11-20  0:45 UTC (permalink / raw)
  To: linux-arm-kernel

This patch series add a K2HK (K2 Hawking/Kepler) EVM
dts file and make some updates to the existing dts
files and Keystone PLL clk driver.

Murali Karicheri (4):
  clk: keystone: use clkod register bits for postdiv
  keystone: dts: add a k2hk-evm specific dts file
  keystone: dts: fix typo in the ddr3 pllclk node name
  keystone: dts: add paclk divider clock node

 .../devicetree/bindings/clock/keystone-pll.txt     |    8 +--
 arch/arm/boot/dts/k2hk-evm.dts                     |   55 ++++++++++++++++++++
 arch/arm/boot/dts/keystone-clocks.dtsi             |   36 ++++++-------
 arch/arm/boot/dts/{keystone.dts => keystone.dtsi}  |    2 -
 drivers/clk/keystone/pll.c                         |   24 +++++++--
 5 files changed, 96 insertions(+), 29 deletions(-)
 create mode 100644 arch/arm/boot/dts/k2hk-evm.dts
 rename arch/arm/boot/dts/{keystone.dts => keystone.dtsi} (98%)

-- 
1.7.9.5

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

* [PATCH v2 1/4] clk: keystone: use clkod register bits for postdiv
  2013-11-20  0:45 [PATCH v2 0/4 - Keystone DTS and clock driver updates] Murali Karicheri
@ 2013-11-20  0:45 ` Murali Karicheri
  2013-11-20  0:45 ` [PATCH v2 2/4] keystone: dts: add a k2hk-evm specific dts file Murali Karicheri
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Murali Karicheri @ 2013-11-20  0:45 UTC (permalink / raw)
  To: linux-arm-kernel

DDR3A/B, ARM and PA PLL controllers have clkod register bits for
configuring postdiv values. So use it instead of using fixed
post dividers for these pll controllers. Assume that if fixed-postdiv
attribute is not present, use clkod register value for pistdiv.

Also update the Documentation of bindings to reflect the same.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
---
 - addressed comments against initial version

 .../devicetree/bindings/clock/keystone-pll.txt     |    8 +++----
 drivers/clk/keystone/pll.c                         |   24 ++++++++++++++++----
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/keystone-pll.txt b/Documentation/devicetree/bindings/clock/keystone-pll.txt
index 12bd726..225990f 100644
--- a/Documentation/devicetree/bindings/clock/keystone-pll.txt
+++ b/Documentation/devicetree/bindings/clock/keystone-pll.txt
@@ -17,13 +17,14 @@ Required properties:
 - reg - pll control0 and pll multipler registers
 - reg-names : control and multiplier. The multiplier is applicable only for
 		main pll clock
-- fixed-postdiv : fixed post divider value
+- fixed-postdiv : fixed post divider value. If absent, use clkod register bits
+		for postdiv
 
 Example:
 	mainpllclk: mainpllclk at 2310110 {
 		#clock-cells = <0>;
 		compatible = "ti,keystone,main-pll-clock";
-		clocks = <&refclkmain>;
+		clocks = <&refclksys>;
 		reg = <0x02620350 4>, <0x02310110 4>;
 		reg-names = "control", "multiplier";
 		fixed-postdiv = <2>;
@@ -32,11 +33,10 @@ Example:
 	papllclk: papllclk at 2620358 {
 		#clock-cells = <0>;
 		compatible = "ti,keystone,pll-clock";
-		clocks = <&refclkmain>;
+		clocks = <&refclkpass>;
 		clock-output-names = "pa-pll-clk";
 		reg = <0x02620358 4>;
 		reg-names = "control";
-		fixed-postdiv = <6>;
 	};
 
 Required properties:
diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c
index 47a1bd9..0dd8a4b 100644
--- a/drivers/clk/keystone/pll.c
+++ b/drivers/clk/keystone/pll.c
@@ -24,6 +24,8 @@
 #define MAIN_PLLM_HIGH_MASK	0x7f000
 #define PLLM_HIGH_SHIFT		6
 #define PLLD_MASK		0x3f
+#define CLKOD_MASK		0x780000
+#define CLKOD_SHIFT		19
 
 /**
  * struct clk_pll_data - pll data structure
@@ -41,7 +43,10 @@
  * @pllm_upper_mask: multiplier upper mask
  * @pllm_upper_shift: multiplier upper shift
  * @plld_mask: divider mask
- * @postdiv: Post divider
+ * @clkod_mask: output divider mask
+ * @clkod_shift: output divider shift
+ * @plld_mask: divider mask
+ * @postdiv: Fixed post divider
  */
 struct clk_pll_data {
 	bool has_pllctrl;
@@ -53,6 +58,8 @@ struct clk_pll_data {
 	u32 pllm_upper_mask;
 	u32 pllm_upper_shift;
 	u32 plld_mask;
+	u32 clkod_mask;
+	u32 clkod_shift;
 	u32 postdiv;
 };
 
@@ -90,7 +97,13 @@ static unsigned long clk_pllclk_recalc(struct clk_hw *hw,
 	mult |= ((val & pll_data->pllm_upper_mask)
 			>> pll_data->pllm_upper_shift);
 	prediv = (val & pll_data->plld_mask);
-	postdiv = pll_data->postdiv;
+
+	if (!pll_data->has_pllctrl)
+		/* read post divider from od bits*/
+		postdiv = ((val & pll_data->clkod_mask) >>
+				 pll_data->clkod_shift) + 1;
+	else
+		postdiv = pll_data->postdiv;
 
 	rate /= (prediv + 1);
 	rate = (rate * (mult + 1));
@@ -155,8 +168,11 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl)
 	}
 
 	parent_name = of_clk_get_parent_name(node, 0);
-	if (of_property_read_u32(node, "fixed-postdiv",	&pll_data->postdiv))
-		goto out;
+	if (of_property_read_u32(node, "fixed-postdiv",	&pll_data->postdiv)) {
+		/* assume the PLL has output divider register bits */
+		pll_data->clkod_mask = CLKOD_MASK;
+		pll_data->clkod_shift = CLKOD_SHIFT;
+	}
 
 	i = of_property_match_string(node, "reg-names", "control");
 	pll_data->pll_ctl0 = of_iomap(node, i);
-- 
1.7.9.5

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

* [PATCH v2 2/4] keystone: dts: add a k2hk-evm specific dts file
  2013-11-20  0:45 [PATCH v2 0/4 - Keystone DTS and clock driver updates] Murali Karicheri
  2013-11-20  0:45 ` [PATCH v2 1/4] clk: keystone: use clkod register bits for postdiv Murali Karicheri
@ 2013-11-20  0:45 ` Murali Karicheri
  2013-11-20  0:45 ` [PATCH v2 3/4] keystone: dts: fix typo in the ddr3 pllclk node name Murali Karicheri
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Murali Karicheri @ 2013-11-20  0:45 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds K2 Kepler/Hawking evm (k2hk-evm) specific dts file.
To enable re-use of bindings across multiple evms of this family,
rename current keystone.dts to keystone.dtsi and include it in the
evm specific dts file.

K2 SoC has separate ref clock inputs for various clocks. So add
separate ref clock nodes for ARM, DDR3A, DDR3B and PA PLL input
clocks in k2hk-evm.dts. While at it, rename  refclkmain to
refclksys based on device User Guide naming convention

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
---
 - addressed comments against initial version

 arch/arm/boot/dts/k2hk-evm.dts                    |   55 +++++++++++++++++++++
 arch/arm/boot/dts/keystone-clocks.dtsi            |   23 +++------
 arch/arm/boot/dts/{keystone.dts => keystone.dtsi} |    2 -
 3 files changed, 61 insertions(+), 19 deletions(-)
 create mode 100644 arch/arm/boot/dts/k2hk-evm.dts
 rename arch/arm/boot/dts/{keystone.dts => keystone.dtsi} (98%)

diff --git a/arch/arm/boot/dts/k2hk-evm.dts b/arch/arm/boot/dts/k2hk-evm.dts
new file mode 100644
index 0000000..15b3a95
--- /dev/null
+++ b/arch/arm/boot/dts/k2hk-evm.dts
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013 Texas Instruments, Inc.
+ *
+ * Keystone 2 Kepler/Hawking EVM device tree
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+#include "keystone.dtsi"
+
+/ {
+	compatible =  "ti,keystone-evm";
+
+	soc {
+		clock {
+			refclksys: refclksys {
+				#clock-cells = <0>;
+				compatible = "fixed-clock";
+				clock-frequency = <122880000>;
+				clock-output-names = "refclk-sys";
+			};
+
+			refclkpass: refclkpass {
+				#clock-cells = <0>;
+				compatible = "fixed-clock";
+				clock-frequency = <122880000>;
+				clock-output-names = "refclk-pass";
+			};
+
+			refclkarm: refclkarm {
+				#clock-cells = <0>;
+				compatible = "fixed-clock";
+				clock-frequency = <125000000>;
+				clock-output-names = "refclk-arm";
+			};
+
+			refclkddr3a: refclkddr3a {
+				#clock-cells = <0>;
+				compatible = "fixed-clock";
+				clock-frequency = <100000000>;
+				clock-output-names = "refclk-ddr3a";
+			};
+
+			refclkddr3b: refclkddr3b {
+				#clock-cells = <0>;
+				compatible = "fixed-clock";
+				clock-frequency = <100000000>;
+				clock-output-names = "refclk-ddr3b";
+			};
+		};
+	};
+};
diff --git a/arch/arm/boot/dts/keystone-clocks.dtsi b/arch/arm/boot/dts/keystone-clocks.dtsi
index d6713b1..67e70ec 100644
--- a/arch/arm/boot/dts/keystone-clocks.dtsi
+++ b/arch/arm/boot/dts/keystone-clocks.dtsi
@@ -13,17 +13,10 @@ clocks {
 	#size-cells = <1>;
 	ranges;
 
-	refclkmain: refclkmain {
-		#clock-cells = <0>;
-		compatible = "fixed-clock";
-		clock-frequency = <122880000>;
-		clock-output-names = "refclk-main";
-	};
-
 	mainpllclk: mainpllclk at 2310110 {
 		#clock-cells = <0>;
 		compatible = "ti,keystone,main-pll-clock";
-		clocks = <&refclkmain>;
+		clocks = <&refclksys>;
 		reg = <0x02620350 4>, <0x02310110 4>;
 		reg-names = "control", "multiplier";
 		fixed-postdiv = <2>;
@@ -32,47 +25,43 @@ clocks {
 	papllclk: papllclk at 2620358 {
 		#clock-cells = <0>;
 		compatible = "ti,keystone,pll-clock";
-		clocks = <&refclkmain>;
+		clocks = <&refclkpass>;
 		clock-output-names = "pa-pll-clk";
 		reg = <0x02620358 4>;
 		reg-names = "control";
-		fixed-postdiv = <6>;
 	};
 
 	ddr3allclk: ddr3apllclk at 2620360 {
 		#clock-cells = <0>;
 		compatible = "ti,keystone,pll-clock";
-		clocks = <&refclkmain>;
+		clocks = <&refclkddr3a>;
 		clock-output-names = "ddr-3a-pll-clk";
 		reg = <0x02620360 4>;
 		reg-names = "control";
-		fixed-postdiv = <6>;
 	};
 
 	ddr3bllclk: ddr3bpllclk at 2620368 {
 		#clock-cells = <0>;
 		compatible = "ti,keystone,pll-clock";
-		clocks = <&refclkmain>;
+		clocks = <&refclkddr3b>;
 		clock-output-names = "ddr-3b-pll-clk";
 		reg = <0x02620368 4>;
 		reg-names = "control";
-		fixed-postdiv = <6>;
 	};
 
 	armpllclk: armpllclk at 2620370 {
 		#clock-cells = <0>;
 		compatible = "ti,keystone,pll-clock";
-		clocks = <&refclkmain>;
+		clocks = <&refclkarm>;
 		clock-output-names = "arm-pll-clk";
 		reg = <0x02620370 4>;
 		reg-names = "control";
-		fixed-postdiv = <6>;
 	};
 
 	mainmuxclk: mainmuxclk at 2310108 {
 		#clock-cells = <0>;
 		compatible = "ti,keystone,pll-mux-clock";
-		clocks = <&mainpllclk>, <&refclkmain>;
+		clocks = <&mainpllclk>, <&refclksys>;
 		reg = <0x02310108 4>;
 		bit-shift = <23>;
 		bit-mask = <1>;
diff --git a/arch/arm/boot/dts/keystone.dts b/arch/arm/boot/dts/keystone.dtsi
similarity index 98%
rename from arch/arm/boot/dts/keystone.dts
rename to arch/arm/boot/dts/keystone.dtsi
index 100bdf5..c01c6fb 100644
--- a/arch/arm/boot/dts/keystone.dts
+++ b/arch/arm/boot/dts/keystone.dtsi
@@ -6,14 +6,12 @@
  * published by the Free Software Foundation.
  */
 
-/dts-v1/;
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 
 #include "skeleton.dtsi"
 
 / {
 	model = "Texas Instruments Keystone 2 SoC";
-	compatible =  "ti,keystone-evm";
 	#address-cells = <2>;
 	#size-cells = <2>;
 	interrupt-parent = <&gic>;
-- 
1.7.9.5

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

* [PATCH v2 3/4] keystone: dts: fix typo in the ddr3 pllclk node name
  2013-11-20  0:45 [PATCH v2 0/4 - Keystone DTS and clock driver updates] Murali Karicheri
  2013-11-20  0:45 ` [PATCH v2 1/4] clk: keystone: use clkod register bits for postdiv Murali Karicheri
  2013-11-20  0:45 ` [PATCH v2 2/4] keystone: dts: add a k2hk-evm specific dts file Murali Karicheri
@ 2013-11-20  0:45 ` Murali Karicheri
  2013-11-20  0:45 ` [PATCH v2 4/4] keystone: dts: add paclk divider clock node Murali Karicheri
  2013-11-20  0:48 ` [PATCH v2 0/4 - Keystone DTS and clock driver updates] Santosh Shilimkar
  4 siblings, 0 replies; 7+ messages in thread
From: Murali Karicheri @ 2013-11-20  0:45 UTC (permalink / raw)
  To: linux-arm-kernel

Fix following typo
 ddr3allclk -> ddr3apllclk
 ddr3bllclk -> ddr3bpllclk

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
---
 arch/arm/boot/dts/keystone-clocks.dtsi |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/keystone-clocks.dtsi b/arch/arm/boot/dts/keystone-clocks.dtsi
index 67e70ec..2a2f247 100644
--- a/arch/arm/boot/dts/keystone-clocks.dtsi
+++ b/arch/arm/boot/dts/keystone-clocks.dtsi
@@ -31,7 +31,7 @@ clocks {
 		reg-names = "control";
 	};
 
-	ddr3allclk: ddr3apllclk at 2620360 {
+	ddr3apllclk: ddr3apllclk at 2620360 {
 		#clock-cells = <0>;
 		compatible = "ti,keystone,pll-clock";
 		clocks = <&refclkddr3a>;
@@ -40,7 +40,7 @@ clocks {
 		reg-names = "control";
 	};
 
-	ddr3bllclk: ddr3bpllclk at 2620368 {
+	ddr3bpllclk: ddr3bpllclk at 2620368 {
 		#clock-cells = <0>;
 		compatible = "ti,keystone,pll-clock";
 		clocks = <&refclkddr3b>;
-- 
1.7.9.5

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

* [PATCH v2 4/4] keystone: dts: add paclk divider clock node
  2013-11-20  0:45 [PATCH v2 0/4 - Keystone DTS and clock driver updates] Murali Karicheri
                   ` (2 preceding siblings ...)
  2013-11-20  0:45 ` [PATCH v2 3/4] keystone: dts: fix typo in the ddr3 pllclk node name Murali Karicheri
@ 2013-11-20  0:45 ` Murali Karicheri
  2013-11-20  0:48 ` [PATCH v2 0/4 - Keystone DTS and clock driver updates] Santosh Shilimkar
  4 siblings, 0 replies; 7+ messages in thread
From: Murali Karicheri @ 2013-11-20  0:45 UTC (permalink / raw)
  To: linux-arm-kernel

PA subsystem has a fixed factor clock at the input which is
input clock divided by 3. This patch adds this clock node to dts

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
---
 arch/arm/boot/dts/keystone-clocks.dtsi |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/keystone-clocks.dtsi b/arch/arm/boot/dts/keystone-clocks.dtsi
index 2a2f247..2363593 100644
--- a/arch/arm/boot/dts/keystone-clocks.dtsi
+++ b/arch/arm/boot/dts/keystone-clocks.dtsi
@@ -124,6 +124,15 @@ clocks {
 		clock-output-names = "chipclk13";
 	};
 
+	paclk13: paclk13 {
+		#clock-cells = <0>;
+		compatible = "fixed-factor-clock";
+		clocks = <&papllclk>;
+		clock-div = <3>;
+		clock-mult = <1>;
+		clock-output-names = "paclk13";
+	};
+
 	chipclk14: chipclk14 {
 		#clock-cells = <0>;
 		compatible = "fixed-factor-clock";
-- 
1.7.9.5

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

* [PATCH v2 0/4 - Keystone DTS and clock driver updates]
  2013-11-20  0:45 [PATCH v2 0/4 - Keystone DTS and clock driver updates] Murali Karicheri
                   ` (3 preceding siblings ...)
  2013-11-20  0:45 ` [PATCH v2 4/4] keystone: dts: add paclk divider clock node Murali Karicheri
@ 2013-11-20  0:48 ` Santosh Shilimkar
  2013-11-20 14:55   ` Karicheri, Muralidharan
  4 siblings, 1 reply; 7+ messages in thread
From: Santosh Shilimkar @ 2013-11-20  0:48 UTC (permalink / raw)
  To: linux-arm-kernel

Murali,

On Tuesday 19 November 2013 07:45 PM, Murali Karicheri wrote:
> This patch series add a K2HK (K2 Hawking/Kepler) EVM
> dts file and make some updates to the existing dts
> files and Keystone PLL clk driver.
> 
> Murali Karicheri (4):
>   clk: keystone: use clkod register bits for postdiv
>   keystone: dts: add a k2hk-evm specific dts file
>   keystone: dts: fix typo in the ddr3 pllclk node name
>   keystone: dts: add paclk divider clock node
> 
Thanks for the updates. I will add the dts patches in
my arm-soc queue and also pick the clock patch in
clock updates for Mike to pick it up.

Regards,
Santosh

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

* [PATCH v2 0/4 - Keystone DTS and clock driver updates]
  2013-11-20  0:48 ` [PATCH v2 0/4 - Keystone DTS and clock driver updates] Santosh Shilimkar
@ 2013-11-20 14:55   ` Karicheri, Muralidharan
  0 siblings, 0 replies; 7+ messages in thread
From: Karicheri, Muralidharan @ 2013-11-20 14:55 UTC (permalink / raw)
  To: linux-arm-kernel

>> -----Original Message-----
>> From: Shilimkar, Santosh
>> Sent: Tuesday, November 19, 2013 7:49 PM
>> To: Karicheri, Muralidharan
>> Cc: linux-arm-kernel at lists.infradead.org; mturquette at linaro.org; linux-
>> keystone at list.ti.com - Linux developers for Keystone family of devices (May contain non-
>> TIers)
>> Subject: Re: [PATCH v2 0/4 - Keystone DTS and clock driver updates]
>> 
>> Murali,
>> 
>> On Tuesday 19 November 2013 07:45 PM, Murali Karicheri wrote:
>> > This patch series add a K2HK (K2 Hawking/Kepler) EVM dts file and make
>> > some updates to the existing dts files and Keystone PLL clk driver.
>> >
>> > Murali Karicheri (4):
>> >   clk: keystone: use clkod register bits for postdiv
>> >   keystone: dts: add a k2hk-evm specific dts file
>> >   keystone: dts: fix typo in the ddr3 pllclk node name
>> >   keystone: dts: add paclk divider clock node
>> >
>> Thanks for the updates. I will add the dts patches in my arm-soc queue and also pick the
>> clock patch in clock updates for Mike to pick it up.
>> 
>> Regards,
>> Santosh

Thanks

Murali Karicheri
Linux Kernel, Software Development

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

end of thread, other threads:[~2013-11-20 14:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20  0:45 [PATCH v2 0/4 - Keystone DTS and clock driver updates] Murali Karicheri
2013-11-20  0:45 ` [PATCH v2 1/4] clk: keystone: use clkod register bits for postdiv Murali Karicheri
2013-11-20  0:45 ` [PATCH v2 2/4] keystone: dts: add a k2hk-evm specific dts file Murali Karicheri
2013-11-20  0:45 ` [PATCH v2 3/4] keystone: dts: fix typo in the ddr3 pllclk node name Murali Karicheri
2013-11-20  0:45 ` [PATCH v2 4/4] keystone: dts: add paclk divider clock node Murali Karicheri
2013-11-20  0:48 ` [PATCH v2 0/4 - Keystone DTS and clock driver updates] Santosh Shilimkar
2013-11-20 14:55   ` Karicheri, Muralidharan

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