Skip to contentSkip to conversation

ARM: OMAP5: add support for fref-xtal-clk

PATCH New Peter Ujfalusi 2 participants 8 messages Mar 14, 2018 – Mar 20, 2018

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v2 cover ARM: OMAP5: add support for fref-xtal-clk

Hi,

Changes since v1 (sent by Tero):
- Rebased on linux-next
- Split the dts and binding document patch
- Tested it on omap5-uevm that the HPPLL of twl6040 is working (xtal clock is suplied)

The v1 of this series was sent about two years ago:
http://linux-arm-kernel.infradead.narkive.com/hBBbM4D7/patch-0-5-arm-omap5-add-support-for-fref-xtal-clk

but for some reason it was not applied back then, but I have been rolling it on top of linux-next ever since.

Regards,
Peter
---
Peter Ujfalusi (1):
ARM: dts: omap5-board-common: Add phandle for mclk clock for twl6040

Tero Kristo (5):
ARM: omap2+: control: add support for auxiliary control module
instances
dt-bindings: omap5: ctrl: Support for control module wkup pad config
ARM: dts: omap5: add support for control module wkup pad config
ARM: OMAP5: control: add support for control module wkup pad config
ARM: dts: omap5: add fref_xtal_ck support

 .../devicetree/bindings/arm/omap/ctrl.txt          |  1 +
 arch/arm/boot/dts/omap5-board-common.dtsi          |  4 ++--
 arch/arm/boot/dts/omap5.dtsi                       | 22 ++++++++++++++++++++++
 arch/arm/boot/dts/omap54xx-clocks.dtsi             | 10 ++++++++++
 arch/arm/mach-omap2/control.c                      | 20 ++++++++++++++++----
 include/linux/clk/ti.h                             |  1 +
 6 files changed, 52 insertions(+), 6 deletions(-)
Signature · 4 lines
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#1 lore raw

PATCH v2 1/6 ARM: omap2+: control: add support for auxiliary control module instances

From: Tero Kristo <[email protected]>

Control module can have multiple instances in a system, each with separate address space and features. Add base support for these auxiliary instances, with support for syscon and clock mappings under them.

---
 arch/arm/mach-omap2/control.c | 15 +++++++++++----
 include/linux/clk/ti.h        |  1 +
 2 files changed, 12 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/control.c +11 -4
index bd8089ff929f..632adb2b7d03 100644
@@ -623,6 +623,7 @@ void __init omap3_ctrl_init(void)
 
 struct control_init_data {
 	int index;
+	void __iomem *mem;
 	s16 offset;
 };
 
@@ -660,15 +661,21 @@ int __init omap2_control_base_init(void)
 	struct device_node *np;
 	const struct of_device_id *match;
 	struct control_init_data *data;
+	void __iomem *mem;
 
 	for_each_matching_node_and_match(np, omap_scrm_dt_match_table, &match) {
 		data = (struct control_init_data *)match->data;
 
-		omap2_ctrl_base = of_iomap(np, 0);
-		if (!omap2_ctrl_base)
+		mem = of_iomap(np, 0);
+		if (!mem)
 			return -ENOMEM;
 
-		omap2_ctrl_offset = data->offset;
+		if (data->index == TI_CLKM_CTRL) {
+			omap2_ctrl_base = mem;
+			omap2_ctrl_offset = data->offset;
+		}
+
+		data->mem = mem;
 	}
 
 	return 0;
@@ -713,7 +720,7 @@ int __init omap_control_init(void)
 		} else {
 			/* No scm_conf found, direct access */
 			ret = omap2_clk_provider_init(np, data->index, NULL,
-						      omap2_ctrl_base);
+						      data->mem);
 			if (ret)
 				return ret;
 		}
include/linux/clk/ti.h +1 -0
index d18da839b810..7e3bceee3489 100644
@@ -203,6 +203,7 @@ enum {
 	TI_CLKM_PRM,
 	TI_CLKM_SCRM,
 	TI_CLKM_CTRL,
+	TI_CLKM_CTRL_AUX,
 	TI_CLKM_PLLSS,
 	CLK_MAX_MEMMAPS
 };
Signature · 4 lines
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#2 lore raw

PATCH v2 2/6 dt-bindings: omap5: ctrl: Support for control module wkup pad config

In reply to Peter Ujfalusi

From: Tero Kristo <[email protected]>

The pad configuration area under control module wkup has some miscellaneous config registers, that are not pinmux related.
Add new compatible string for this section of control module.

---
 Documentation/devicetree/bindings/arm/omap/ctrl.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/arm/omap/ctrl.txt +1 -0
index ce8dabf8c0f9..f35b77920786 100644
@@ -25,6 +25,7 @@ Required properties:
 		"ti,omap4-scm-padconf-wkup"
 		"ti,omap5-scm-core"
 		"ti,omap5-scm-padconf-core"
+		"ti,omap5-scm-wkup-pad-conf"
 		"ti,dra7-scm-core"
 - reg:		Contains Control Module register address range
 		(base address and length)
Signature · 4 lines
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#3 lore raw

PATCH v2 3/6 ARM: dts: omap5: add support for control module wkup pad config

In reply to Peter Ujfalusi

From: Tero Kristo <[email protected]>

The pad configuration area under control module wkup has some miscellaneous config registers, that are not pinmux related. Add a separate area for these, and add support for syscon / clocks under this new area.

---
 arch/arm/boot/dts/omap5.dtsi | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm/boot/dts/omap5.dtsi +22 -0
index 511606c17a04..732b61a0e990 100644
@@ -287,6 +287,28 @@
 				pinctrl-single,register-width = <16>;
 				pinctrl-single,function-mask = <0x7fff>;
 			};
+
+			omap5_scm_wkup_pad_conf: omap5_scm_wkup_pad_conf at cda0 {
+				compatible = "ti,omap5-scm-wkup-pad-conf",
+					     "simple-bus";
+				reg = <0xcda0 0x60>;
+				#address-cells = <1>;
+				#size-cells = <1>;
+				ranges = <0 0xcda0 0x60>;
+
+				scm_wkup_pad_conf: scm_conf at 0 {
+					compatible = "syscon", "simple-bus";
+					reg = <0x0 0x60>;
+					#address-cells = <1>;
+					#size-cells = <1>;
+					ranges = <0 0x0 0x60>;
+
+					scm_wkup_pad_conf_clocks: clocks at 0 {
+						#address-cells = <1>;
+						#size-cells = <0>;
+					};
+				};
+			};
 		};
 
 		ocmcram: ocmcram at 40300000 {
Signature · 4 lines
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#4 lore raw

PATCH v2 4/6 ARM: OMAP5: control: add support for control module wkup pad config

In reply to Peter Ujfalusi

From: Tero Kristo <[email protected]>

Match the new compatible string in the control module driver. The base infra maps the required syscon ranges and clock registers if available.

---
 arch/arm/mach-omap2/control.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/mach-omap2/control.c +5 -0
index 632adb2b7d03..180da403639e 100644
@@ -636,6 +636,10 @@ static const struct control_init_data omap2_ctrl_data = {
 	.offset = -OMAP2_CONTROL_GENERAL,
 };
 
+static const struct control_init_data ctrl_aux_data = {
+	.index = TI_CLKM_CTRL_AUX,
+};
+
 static const struct of_device_id omap_scrm_dt_match_table[] = {
 	{ .compatible = "ti,am3-scm", .data = &ctrl_data },
 	{ .compatible = "ti,am4-scm", .data = &ctrl_data },
@@ -645,6 +649,7 @@ static const struct of_device_id omap_scrm_dt_match_table[] = {
 	{ .compatible = "ti,dm816-scrm", .data = &ctrl_data },
 	{ .compatible = "ti,omap4-scm-core", .data = &ctrl_data },
 	{ .compatible = "ti,omap5-scm-core", .data = &ctrl_data },
+	{ .compatible = "ti,omap5-scm-wkup-pad-conf", .data = &ctrl_aux_data },
 	{ .compatible = "ti,dra7-scm-core", .data = &ctrl_data },
 	{ }
 };
Signature · 4 lines
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#5 lore raw

PATCH v2 5/6 ARM: dts: omap5: add fref_xtal_ck support

In reply to Peter Ujfalusi

From: Tero Kristo <[email protected]>

The clock is directly sourced from sys_clkin, and provides an external output clock for (typically) TWL6040 chip.

---
 arch/arm/boot/dts/omap54xx-clocks.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/omap54xx-clocks.dtsi +10 -0
index 9619a746d657..ecc5573d264c 100644
@@ -1179,3 +1179,13 @@
 		};
 	};
 };
+
+&scm_wkup_pad_conf_clocks {
+	fref_xtal_ck: fref_xtal_ck {
+		#clock-cells = <0>;
+		compatible = "ti,gate-clock";
+		clocks = <&sys_clkin>;
+		ti,bit-shift = <28>;
+		reg = <0x14>;
+	};
+};
Signature · 4 lines
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#6 lore raw

PATCH v2 6/6 ARM: dts: omap5-board-common: Add phandle for mclk clock for twl6040

In reply to Peter Ujfalusi

The xref_xtal clock is used by twl6040 as mclk. It is needed for the HPPLL internally.

---
 arch/arm/boot/dts/omap5-board-common.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/omap5-board-common.dtsi +2 -2
index 1b20838bb9a4..3b2244560c28 100644
@@ -659,8 +659,8 @@
 		v2v1-supply = <&smps9_reg>;
 		enable-active-high;
 
-		clocks = <&clk32kgaudio>;
-		clock-names = "clk32k";
+		clocks = <&clk32kgaudio>, <&fref_xtal_ck>;
+		clock-names = "clk32k", "mclk";
 	};
 };
 
Signature · 4 lines
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
maintainer
#7 lore raw

v2 cover ARM: OMAP5: add support for fref-xtal-clk

In reply to Peter Ujfalusi
Quoted 8 lines · Peter Ujfalusi

Hi,

Changes since v1 (sent by Tero):
- Rebased on linux-next
- Split the dts and binding document patch
- Tested it on omap5-uevm that the HPPLL of twl6040 is working (xtal clock is suplied)

Quoted 5 lines

The v1 of this series was sent about two years ago:
http://linux-arm-kernel.infradead.narkive.com/hBBbM4D7/patch-0-5-arm-omap5-add-support-for-fref-xtal-clk

but for some reason it was not applied back then, but I have been rolling it on top of linux-next ever since.

OK applying into omap-for-v4.17/soc and omap-for-v4.17/dt thanks.

Regards,

Tony