linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/14] Support CPU frequency scaling on QCS404
@ 2019-01-28 18:32 Jorge Ramirez-Ortiz
  2019-01-28 18:32 ` [PATCH v2 01/14] clk: qcom: gcc: limit GPLL0_AO_OUT operating frequency Jorge Ramirez-Ortiz
                   ` (13 more replies)
  0 siblings, 14 replies; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:32 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

The following patchset enables CPU frequency scaling support on the
QCS404.

Patch 8 "clk: qcom: hfpll: CLK_IGNORE_UNUSED" is a bit controversial;
in this platform, this PLL provides the clock signal to a CPU
core. But in others it might not.

I opted for the minimal ammount of changes without affecting the
default functionality: simply bypassing the COMMON_CLK_DISABLE_UNUSED
framework and letting the firwmare chose whether to enable or disable
the clock at boot. However maybe a DT property and marking the clock
as critical would be more appropriate for this PLL. I'd appreciate the
maintainer's input on this topic.

v2:
   - dts: ms8916: apcs mux/divider: new bindings
     (the driver can still support the old bindings)
     
   - qcs404.dtsi
     fix apcs-hfpll definition
     fix cpu_opp_table definition
     
   - GPLL0_AO_OUT operating frequency
     define new alpha_pll_fixed_ops to limit the operating frequency
   
Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>

Jorge Ramirez-Ortiz (14):
  clk: qcom: gcc: limit GPLL0_AO_OUT operating frequency
  mbox: qcom: add APCS child device for QCS404
  mbox: qcom: replace integer with valid macro
  dt-bindings: mailbox: qcom: Add clock-name optional property
  clk: qcom: apcs-msm8916: get parent clock names from DT
  clk: qcom: hfpll: get parent clock names from DT
  clk: qcom: hfpll: register as clock provider
  clk: qcom: hfpll: CLK_IGNORE_UNUSED
  arm64: dts: qcom: msm8916: Add the clocks for the APCS mux/divider
  arm64: dts: qcom: qcs404: Add OPP table
  arm64: dts: qcom: qcs404: Add HFPLL node
  arm64: dts: qcom: qcs404: Add the clocks for APCS mux/divider
  arm64: dts: qcom: qcs404: Add cpufreq support
  arm64: defconfig: Enable HFPLL

 .../bindings/mailbox/qcom,apcs-kpss-global.txt     | 24 +++++++++++++--
 arch/arm64/boot/dts/qcom/msm8916.dtsi              |  3 +-
 arch/arm64/boot/dts/qcom/qcs404.dtsi               | 35 ++++++++++++++++++++++
 arch/arm64/configs/defconfig                       |  1 +
 drivers/clk/qcom/apcs-msm8916.c                    | 32 +++++++++++++++-----
 drivers/clk/qcom/clk-alpha-pll.c                   |  8 +++++
 drivers/clk/qcom/clk-alpha-pll.h                   |  1 +
 drivers/clk/qcom/gcc-qcs404.c                      |  3 +-
 drivers/clk/qcom/hfpll.c                           | 19 +++++++++++-
 drivers/mailbox/qcom-apcs-ipc-mailbox.c            | 21 ++++++++-----
 10 files changed, 125 insertions(+), 22 deletions(-)

-- 
2.7.4


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

* [PATCH v2 01/14] clk: qcom: gcc: limit GPLL0_AO_OUT operating frequency
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
@ 2019-01-28 18:32 ` Jorge Ramirez-Ortiz
  2019-02-22 18:07   ` Stephen Boyd
  2019-01-28 18:32 ` [PATCH v2 02/14] mbox: qcom: add APCS child device for QCS404 Jorge Ramirez-Ortiz
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:32 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Limit the GPLL0_AO_OUT_MAIN operating frequency as per its hardware
specifications.

Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 drivers/clk/qcom/clk-alpha-pll.c | 8 ++++++++
 drivers/clk/qcom/clk-alpha-pll.h | 1 +
 drivers/clk/qcom/gcc-qcs404.c    | 3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/clk-alpha-pll.c b/drivers/clk/qcom/clk-alpha-pll.c
index 0ced4a5..ef51f30 100644
--- a/drivers/clk/qcom/clk-alpha-pll.c
+++ b/drivers/clk/qcom/clk-alpha-pll.c
@@ -730,6 +730,14 @@ static long alpha_pll_huayra_round_rate(struct clk_hw *hw, unsigned long rate,
 	return alpha_huayra_pll_round_rate(rate, *prate, &l, &a);
 }
 
+const struct clk_ops clk_alpha_pll_fixed_ops = {
+	.enable = clk_alpha_pll_enable,
+	.disable = clk_alpha_pll_disable,
+	.is_enabled = clk_alpha_pll_is_enabled,
+	.recalc_rate = clk_alpha_pll_recalc_rate,
+};
+EXPORT_SYMBOL_GPL(clk_alpha_pll_fixed_ops);
+
 const struct clk_ops clk_alpha_pll_ops = {
 	.enable = clk_alpha_pll_enable,
 	.disable = clk_alpha_pll_disable,
diff --git a/drivers/clk/qcom/clk-alpha-pll.h b/drivers/clk/qcom/clk-alpha-pll.h
index 66755f0..6b4eb74 100644
--- a/drivers/clk/qcom/clk-alpha-pll.h
+++ b/drivers/clk/qcom/clk-alpha-pll.h
@@ -104,6 +104,7 @@ struct alpha_pll_config {
 };
 
 extern const struct clk_ops clk_alpha_pll_ops;
+extern const struct clk_ops clk_alpha_pll_fixed_ops;
 extern const struct clk_ops clk_alpha_pll_hwfsm_ops;
 extern const struct clk_ops clk_alpha_pll_postdiv_ops;
 extern const struct clk_ops clk_alpha_pll_huayra_ops;
diff --git a/drivers/clk/qcom/gcc-qcs404.c b/drivers/clk/qcom/gcc-qcs404.c
index 64da032..7de4fcf 100644
--- a/drivers/clk/qcom/gcc-qcs404.c
+++ b/drivers/clk/qcom/gcc-qcs404.c
@@ -304,6 +304,7 @@ static struct clk_alpha_pll gpll0_out_main = {
 	},
 };
 
+
 static struct clk_alpha_pll gpll0_ao_out_main = {
 	.offset = 0x21000,
 	.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
@@ -316,7 +317,7 @@ static struct clk_alpha_pll gpll0_ao_out_main = {
 			.parent_names = (const char *[]){ "cxo" },
 			.num_parents = 1,
 			.flags = CLK_IS_CRITICAL,
-			.ops = &clk_alpha_pll_ops,
+			.ops = &clk_alpha_pll_fixed_ops,
 		},
 	},
 };
-- 
2.7.4


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

* [PATCH v2 02/14] mbox: qcom: add APCS child device for QCS404
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
  2019-01-28 18:32 ` [PATCH v2 01/14] clk: qcom: gcc: limit GPLL0_AO_OUT operating frequency Jorge Ramirez-Ortiz
@ 2019-01-28 18:32 ` Jorge Ramirez-Ortiz
  2019-02-22 18:09   ` Stephen Boyd
  2019-01-28 18:32 ` [PATCH v2 03/14] mbox: qcom: replace integer with valid macro Jorge Ramirez-Ortiz
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:32 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

There is clock controller functionality in the APCS hardware block of
qcs404 devices similar to msm8916.

Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 drivers/mailbox/qcom-apcs-ipc-mailbox.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/mailbox/qcom-apcs-ipc-mailbox.c b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
index 3cf2937..0d64aa5 100644
--- a/drivers/mailbox/qcom-apcs-ipc-mailbox.c
+++ b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
@@ -97,16 +97,21 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	if (of_device_is_compatible(np, "qcom,msm8916-apcs-kpss-global")) {
-		apcs->clk = platform_device_register_data(&pdev->dev,
-							  "qcom-apcs-msm8916-clk",
-							  -1, NULL, 0);
-		if (IS_ERR(apcs->clk))
-			dev_err(&pdev->dev, "failed to register APCS clk\n");
-	}
-
 	platform_set_drvdata(pdev, apcs);
 
+	if (of_device_is_compatible(np, "qcom,msm8916-apcs-kpss-global") ||
+	    of_device_is_compatible(np, "qcom,qcs404-apcs-apps-global"))
+		goto register_clk;
+
+	return 0;
+
+register_clk:
+	apcs->clk = platform_device_register_data(&pdev->dev,
+						  "qcom-apcs-msm8916-clk",
+						  -1, NULL, 0);
+	if (IS_ERR(apcs->clk))
+		dev_err(&pdev->dev, "failed to register APCS clk\n");
+
 	return 0;
 }
 
-- 
2.7.4


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

* [PATCH v2 03/14] mbox: qcom: replace integer with valid macro
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
  2019-01-28 18:32 ` [PATCH v2 01/14] clk: qcom: gcc: limit GPLL0_AO_OUT operating frequency Jorge Ramirez-Ortiz
  2019-01-28 18:32 ` [PATCH v2 02/14] mbox: qcom: add APCS child device for QCS404 Jorge Ramirez-Ortiz
@ 2019-01-28 18:32 ` Jorge Ramirez-Ortiz
  2019-01-28 18:32 ` [PATCH v2 04/14] dt-bindings: mailbox: qcom: Add clock-name optional property Jorge Ramirez-Ortiz
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:32 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Use the correct macro when registering the platform device.

Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 drivers/mailbox/qcom-apcs-ipc-mailbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/qcom-apcs-ipc-mailbox.c b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
index 0d64aa5..7a1b4ff 100644
--- a/drivers/mailbox/qcom-apcs-ipc-mailbox.c
+++ b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
@@ -108,7 +108,7 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
 register_clk:
 	apcs->clk = platform_device_register_data(&pdev->dev,
 						  "qcom-apcs-msm8916-clk",
-						  -1, NULL, 0);
+						  PLATFORM_DEVID_NONE, NULL, 0);
 	if (IS_ERR(apcs->clk))
 		dev_err(&pdev->dev, "failed to register APCS clk\n");
 
-- 
2.7.4


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

* [PATCH v2 04/14] dt-bindings: mailbox: qcom: Add clock-name optional property
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
                   ` (2 preceding siblings ...)
  2019-01-28 18:32 ` [PATCH v2 03/14] mbox: qcom: replace integer with valid macro Jorge Ramirez-Ortiz
@ 2019-01-28 18:32 ` Jorge Ramirez-Ortiz
  2019-01-30 15:50   ` Rob Herring
  2019-01-28 18:32 ` [PATCH v2 05/14] clk: qcom: apcs-msm8916: get parent clock names from DT Jorge Ramirez-Ortiz
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:32 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

When the APCS clock is registered (platform dependent), it retrieves
its parent names from hardcoded values in the driver.

The following commit allows the DT node to provide such clock names to
the platform data based clock driver therefore avoiding having to
explicitly embed those names in the clock driver source code.

Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 .../bindings/mailbox/qcom,apcs-kpss-global.txt     | 24 +++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt b/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt
index 1232fc9..b693103 100644
--- a/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt
+++ b/Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt
@@ -18,10 +18,11 @@ platforms.
 	Usage: required
 	Value type: <prop-encoded-array>
 	Definition: must specify the base address and size of the global block
+
 - clocks:
-	Usage: required if #clocks-cells property is present
-	Value type: <phandle>
-	Definition: phandle to the input PLL, which feeds the APCS mux/divider
+	Usage: required if #clock-names property is present
+	Value type: <phandle array>
+	Definition: phandles to the two parent clocks of the clock driver.
 
 - #mbox-cells:
 	Usage: required
@@ -33,6 +34,12 @@ platforms.
 	Value type: <u32>
 	Definition: as described in clock.txt, must be 0
 
+- clock-names:
+	Usage: required if the platform data based clock driver needs to
+	retrieve the parent clock names from device tree.
+	This will requires two mandatory clocks to be defined.
+	Value type: <string-array>
+	Definition: must be "aux" and "pll"
 
 = EXAMPLE
 The following example describes the APCS HMSS found in MSM8996 and part of the
@@ -65,3 +72,14 @@ Below is another example of the APCS binding on MSM8916 platforms:
 		clocks = <&a53pll>;
 		#clock-cells = <0>;
 	};
+
+Below is another example of the APCS binding on QCS404 platforms:
+
+	apcs_glb: mailbox@b011000 {
+		compatible = "qcom,qcs404-apcs-apps-global", "syscon";
+		reg = <0x0b011000 0x1000>;
+		#mbox-cells = <1>;
+		clocks = <&gcc GCC_GPLL0_AO_OUT_MAIN>, <&apcs_hfpll>;
+		clock-names = "aux", "pll";
+		#clock-cells = <0>;
+	};
-- 
2.7.4


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

* [PATCH v2 05/14] clk: qcom: apcs-msm8916: get parent clock names from DT
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
                   ` (3 preceding siblings ...)
  2019-01-28 18:32 ` [PATCH v2 04/14] dt-bindings: mailbox: qcom: Add clock-name optional property Jorge Ramirez-Ortiz
@ 2019-01-28 18:32 ` Jorge Ramirez-Ortiz
  2019-02-22 18:11   ` Stephen Boyd
  2019-01-28 18:32 ` [PATCH v2 06/14] clk: qcom: hfpll: " Jorge Ramirez-Ortiz
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:32 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Allow accessing the parent clock names required for the driver
operation by using the device tree node.

This permits extending the driver to other platforms without having to
modify its source code.

For backwards compatibility leave previous values as default.

Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 drivers/clk/qcom/apcs-msm8916.c | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c
index a6c89a3..987ee00 100644
--- a/drivers/clk/qcom/apcs-msm8916.c
+++ b/drivers/clk/qcom/apcs-msm8916.c
@@ -19,7 +19,7 @@
 
 static const u32 gpll0_a53cc_map[] = { 4, 5 };
 
-static const char * const gpll0_a53cc[] = {
+static const char *gpll0_a53cc[] = {
 	"gpll0_vote",
 	"a53pll",
 };
@@ -50,6 +50,10 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev)
 	struct regmap *regmap;
 	struct clk_init_data init = { };
 	int ret = -ENODEV;
+	struct clk_bulk_data pclks[] = {
+		[0] = { .id = "aux", .clk = NULL },
+		[1] = { .id = "pll", .clk = NULL },
+	};
 
 	regmap = dev_get_regmap(parent, NULL);
 	if (!regmap) {
@@ -61,6 +65,25 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev)
 	if (!a53cc)
 		return -ENOMEM;
 
+	/* check if the parent names are present in the device tree */
+	ret = devm_clk_bulk_get(parent, ARRAY_SIZE(pclks), pclks);
+	if (ret == -EPROBE_DEFER)
+		return ret;
+
+	if (!ret) {
+		gpll0_a53cc[0] = __clk_get_name(pclks[0].clk);
+		gpll0_a53cc[1] = __clk_get_name(pclks[1].clk);
+		a53cc->pclk = pclks[1].clk;
+	} else {
+		/* support old binding where only pll was explicitily defined */
+		a53cc->pclk = devm_clk_get(parent, NULL);
+		if (IS_ERR(a53cc->pclk)) {
+			ret = PTR_ERR(a53cc->pclk);
+			dev_err(dev, "failed to get clk: %d\n", ret);
+			return ret;
+		}
+	}
+
 	init.name = "a53mux";
 	init.parent_names = gpll0_a53cc;
 	init.num_parents = ARRAY_SIZE(gpll0_a53cc);
@@ -76,13 +99,6 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev)
 	a53cc->src_shift = 8;
 	a53cc->parent_map = gpll0_a53cc_map;
 
-	a53cc->pclk = devm_clk_get(parent, NULL);
-	if (IS_ERR(a53cc->pclk)) {
-		ret = PTR_ERR(a53cc->pclk);
-		dev_err(dev, "failed to get clk: %d\n", ret);
-		return ret;
-	}
-
 	a53cc->clk_nb.notifier_call = a53cc_notifier_cb;
 	ret = clk_notifier_register(a53cc->pclk, &a53cc->clk_nb);
 	if (ret) {
-- 
2.7.4


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

* [PATCH v2 06/14] clk: qcom: hfpll: get parent clock names from DT
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
                   ` (4 preceding siblings ...)
  2019-01-28 18:32 ` [PATCH v2 05/14] clk: qcom: apcs-msm8916: get parent clock names from DT Jorge Ramirez-Ortiz
@ 2019-01-28 18:32 ` Jorge Ramirez-Ortiz
  2019-01-28 18:32 ` [PATCH v2 07/14] clk: qcom: hfpll: register as clock provider Jorge Ramirez-Ortiz
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:32 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Allow accessing the parent clock name required for the driver
operation using the device tree node.

This permits extending the driver to other platforms without having to
modify its source code.

For backwards compatibility leave the previous value as default.

Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 drivers/clk/qcom/hfpll.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c
index a6de7101..87b7f46 100644
--- a/drivers/clk/qcom/hfpll.c
+++ b/drivers/clk/qcom/hfpll.c
@@ -52,6 +52,7 @@ static int qcom_hfpll_probe(struct platform_device *pdev)
 	void __iomem *base;
 	struct regmap *regmap;
 	struct clk_hfpll *h;
+	struct clk *pclk;
 	struct clk_init_data init = {
 		.parent_names = (const char *[]){ "xo" },
 		.num_parents = 1,
@@ -75,6 +76,13 @@ static int qcom_hfpll_probe(struct platform_device *pdev)
 					  0, &init.name))
 		return -ENODEV;
 
+	/* get parent clock from device tree (optional) */
+	pclk = devm_clk_get(dev, "xo");
+	if (!IS_ERR(pclk))
+		init.parent_names = (const char *[]){ __clk_get_name(pclk) };
+	else if (PTR_ERR(pclk) == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
+
 	h->d = &hdata;
 	h->clkr.hw.init = &init;
 	spin_lock_init(&h->lock);
-- 
2.7.4


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

* [PATCH v2 07/14] clk: qcom: hfpll: register as clock provider
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
                   ` (5 preceding siblings ...)
  2019-01-28 18:32 ` [PATCH v2 06/14] clk: qcom: hfpll: " Jorge Ramirez-Ortiz
@ 2019-01-28 18:32 ` Jorge Ramirez-Ortiz
  2019-02-22 18:06   ` Stephen Boyd
  2019-01-28 18:32 ` [PATCH v2 08/14] clk: qcom: hfpll: CLK_IGNORE_UNUSED Jorge Ramirez-Ortiz
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:32 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Make the output of the high frequency pll a clock provider.
On the QCS404 this PLL controls cpu frequency scaling.

Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 drivers/clk/qcom/hfpll.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c
index 87b7f46..0ffed0d 100644
--- a/drivers/clk/qcom/hfpll.c
+++ b/drivers/clk/qcom/hfpll.c
@@ -53,6 +53,7 @@ static int qcom_hfpll_probe(struct platform_device *pdev)
 	struct regmap *regmap;
 	struct clk_hfpll *h;
 	struct clk *pclk;
+	int ret;
 	struct clk_init_data init = {
 		.parent_names = (const char *[]){ "xo" },
 		.num_parents = 1,
@@ -87,7 +88,14 @@ static int qcom_hfpll_probe(struct platform_device *pdev)
 	h->clkr.hw.init = &init;
 	spin_lock_init(&h->lock);
 
-	return devm_clk_register_regmap(&pdev->dev, &h->clkr);
+	ret = devm_clk_register_regmap(dev, &h->clkr);
+	if (ret) {
+		dev_err(dev, "failed to register regmap clock: %d\n", ret);
+		return ret;
+	}
+
+	return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get,
+					   &h->clkr.hw);
 }
 
 static struct platform_driver qcom_hfpll_driver = {
-- 
2.7.4


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

* [PATCH v2 08/14] clk: qcom: hfpll: CLK_IGNORE_UNUSED
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
                   ` (6 preceding siblings ...)
  2019-01-28 18:32 ` [PATCH v2 07/14] clk: qcom: hfpll: register as clock provider Jorge Ramirez-Ortiz
@ 2019-01-28 18:32 ` Jorge Ramirez-Ortiz
  2019-02-22 18:12   ` Stephen Boyd
  2019-01-28 18:32 ` [PATCH v2 09/14] arm64: dts: qcom: msm8916: Add the clocks for the APCS mux/divider Jorge Ramirez-Ortiz
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:32 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

When COMMON_CLK_DISABLED_UNUSED is set, in an effort to save power and
to keep the software model of the clock in line with reality, the
framework transverses the clock tree and disables those clocks that
were enabled by the firmware but have not been enabled by any device
driver.

If CPUFREQ is enabled, early during the system boot, it might attempt
to change the CPU frequency ("set_rate"). If the HFPLL is selected as
a provider, it will then change the rate for this clock.

As boot continues, clk_disable_unused_subtree will run. Since it wont
find a valid counter (enable_count) for a clock that is actually
enabled it will attempt to disable it which will cause the CPU to
stop. Notice that in this driver, calls to check whether the clock is
enabled are routed via the is_enabled callback which queries the
hardware.

The following commit, rather than marking the clock critical and
forcing the clock to be always enabled, addresses the above scenario
making sure the clock is not disabled but it continues to rely on the
firmware to enable the clock.

Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 drivers/clk/qcom/hfpll.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c
index 0ffed0d..9d92f5d 100644
--- a/drivers/clk/qcom/hfpll.c
+++ b/drivers/clk/qcom/hfpll.c
@@ -58,6 +58,7 @@ static int qcom_hfpll_probe(struct platform_device *pdev)
 		.parent_names = (const char *[]){ "xo" },
 		.num_parents = 1,
 		.ops = &clk_ops_hfpll,
+		.flags = CLK_IGNORE_UNUSED,
 	};
 
 	h = devm_kzalloc(dev, sizeof(*h), GFP_KERNEL);
-- 
2.7.4


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

* [PATCH v2 09/14] arm64: dts: qcom: msm8916: Add the clocks for the APCS mux/divider
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
                   ` (7 preceding siblings ...)
  2019-01-28 18:32 ` [PATCH v2 08/14] clk: qcom: hfpll: CLK_IGNORE_UNUSED Jorge Ramirez-Ortiz
@ 2019-01-28 18:32 ` Jorge Ramirez-Ortiz
  2019-01-28 18:32 ` [PATCH v2 10/14] arm64: dts: qcom: qcs404: Add OPP table Jorge Ramirez-Ortiz
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:32 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Specify the cloks that feed the APCS mux/dirivider instead of using
default hardcoded values in the source code.

The driver still supports the previous bindings; however with this
update it we allow the msm8916 to access the parent clock names
required by the driver operation using the device tree node.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi
index c5348c3..729c117 100644
--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi
@@ -425,7 +425,8 @@
 			compatible = "qcom,msm8916-apcs-kpss-global", "syscon";
 			reg = <0xb011000 0x1000>;
 			#mbox-cells = <1>;
-			clocks = <&a53pll>;
+			clocks = <&gcc GPLL0_VOTE>, <&a53pll>;
+			clock-names = "aux", "pll";
 			#clock-cells = <0>;
 		};
 
-- 
2.7.4


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

* [PATCH v2 10/14] arm64: dts: qcom: qcs404: Add OPP table
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
                   ` (8 preceding siblings ...)
  2019-01-28 18:32 ` [PATCH v2 09/14] arm64: dts: qcom: msm8916: Add the clocks for the APCS mux/divider Jorge Ramirez-Ortiz
@ 2019-01-28 18:32 ` Jorge Ramirez-Ortiz
  2019-01-30  4:41   ` Vinod Koul
  2019-01-28 18:32 ` [PATCH v2 11/14] arm64: dts: qcom: qcs404: Add HFPLL node Jorge Ramirez-Ortiz
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:32 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Add a CPU OPP table to qcs404

Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 arch/arm64/boot/dts/qcom/qcs404.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi
index 9b5c165..4594fea7 100644
--- a/arch/arm64/boot/dts/qcom/qcs404.dtsi
+++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi
@@ -62,6 +62,21 @@
 		};
 	};
 
+	cpu_opp_table: cpu_opp_table {
+		compatible = "operating-points-v2";
+		opp-shared;
+
+		opp-1094400000 {
+			opp-hz = /bits/ 64 <1094400000>;
+		};
+		opp-1248000000 {
+			opp-hz = /bits/ 64 <1248000000>;
+		};
+		opp-1401600000 {
+			opp-hz = /bits/ 64 <1401600000>;
+		};
+	};
+
 	firmware {
 		scm: scm {
 			compatible = "qcom,scm-qcs404", "qcom,scm";
-- 
2.7.4


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

* [PATCH v2 11/14] arm64: dts: qcom: qcs404: Add HFPLL node
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
                   ` (9 preceding siblings ...)
  2019-01-28 18:32 ` [PATCH v2 10/14] arm64: dts: qcom: qcs404: Add OPP table Jorge Ramirez-Ortiz
@ 2019-01-28 18:32 ` Jorge Ramirez-Ortiz
  2019-01-28 18:32 ` [PATCH v2 12/14] arm64: dts: qcom: qcs404: Add the clocks for APCS mux/divider Jorge Ramirez-Ortiz
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:32 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

The high frequency pll functionality is required to enable CPU
frequency scaling operation.

Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 arch/arm64/boot/dts/qcom/qcs404.dtsi | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi
index 4594fea7..6a4f8a2 100644
--- a/arch/arm64/boot/dts/qcom/qcs404.dtsi
+++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi
@@ -62,7 +62,7 @@
 		};
 	};
 
-	cpu_opp_table: cpu_opp_table {
+	cpu_opp_table: cpu-opp-table {
 		compatible = "operating-points-v2";
 		opp-shared;
 
@@ -375,6 +375,15 @@
 			#mbox-cells = <1>;
 		};
 
+		apcs_hfpll: clock-controller@b016000 {
+			compatible = "qcom,hfpll";
+			reg = <0x0b016000 0x30>;
+			#clock-cells = <0>;
+			clock-output-names = "apcs_hfpll";
+			clocks = <&xo_board>;
+			clock-names = "xo";
+		};
+
 		timer@b120000 {
 			#address-cells = <1>;
 			#size-cells = <1>;
-- 
2.7.4


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

* [PATCH v2 12/14] arm64: dts: qcom: qcs404: Add the clocks for APCS mux/divider
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
                   ` (10 preceding siblings ...)
  2019-01-28 18:32 ` [PATCH v2 11/14] arm64: dts: qcom: qcs404: Add HFPLL node Jorge Ramirez-Ortiz
@ 2019-01-28 18:32 ` Jorge Ramirez-Ortiz
  2019-01-28 18:33 ` [PATCH v2 13/14] arm64: dts: qcom: qcs404: Add cpufreq support Jorge Ramirez-Ortiz
  2019-01-28 18:33 ` [PATCH v2 14/14] arm64: defconfig: Enable HFPLL Jorge Ramirez-Ortiz
  13 siblings, 0 replies; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:32 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Specify the clocks that feed the APCS mux/divider instead of using
default hardcoded values in the source code.

Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 arch/arm64/boot/dts/qcom/qcs404.dtsi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi
index 6a4f8a2..948ba3c 100644
--- a/arch/arm64/boot/dts/qcom/qcs404.dtsi
+++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi
@@ -373,6 +373,9 @@
 			compatible = "qcom,qcs404-apcs-apps-global", "syscon";
 			reg = <0x0b011000 0x1000>;
 			#mbox-cells = <1>;
+			clocks = <&gcc GCC_GPLL0_AO_OUT_MAIN>, <&apcs_hfpll>;
+			clock-names = "aux", "pll";
+			#clock-cells = <0>;
 		};
 
 		apcs_hfpll: clock-controller@b016000 {
-- 
2.7.4


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

* [PATCH v2 13/14] arm64: dts: qcom: qcs404: Add cpufreq support
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
                   ` (11 preceding siblings ...)
  2019-01-28 18:32 ` [PATCH v2 12/14] arm64: dts: qcom: qcs404: Add the clocks for APCS mux/divider Jorge Ramirez-Ortiz
@ 2019-01-28 18:33 ` Jorge Ramirez-Ortiz
  2019-01-28 18:33 ` [PATCH v2 14/14] arm64: defconfig: Enable HFPLL Jorge Ramirez-Ortiz
  13 siblings, 0 replies; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:33 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Support CPU frequency scaling on qcs404.

Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 arch/arm64/boot/dts/qcom/qcs404.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi
index 948ba3c..a0f58bf 100644
--- a/arch/arm64/boot/dts/qcom/qcs404.dtsi
+++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi
@@ -30,6 +30,8 @@
 			reg = <0x100>;
 			enable-method = "psci";
 			next-level-cache = <&L2_0>;
+			clocks = <&apcs_glb>;
+			operating-points-v2 = <&cpu_opp_table>;
 		};
 
 		CPU1: cpu@101 {
@@ -38,6 +40,8 @@
 			reg = <0x101>;
 			enable-method = "psci";
 			next-level-cache = <&L2_0>;
+			clocks = <&apcs_glb>;
+			operating-points-v2 = <&cpu_opp_table>;
 		};
 
 		CPU2: cpu@102 {
@@ -46,6 +50,8 @@
 			reg = <0x102>;
 			enable-method = "psci";
 			next-level-cache = <&L2_0>;
+			clocks = <&apcs_glb>;
+			operating-points-v2 = <&cpu_opp_table>;
 		};
 
 		CPU3: cpu@103 {
@@ -54,6 +60,8 @@
 			reg = <0x103>;
 			enable-method = "psci";
 			next-level-cache = <&L2_0>;
+			clocks = <&apcs_glb>;
+			operating-points-v2 = <&cpu_opp_table>;
 		};
 
 		L2_0: l2-cache {
-- 
2.7.4


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

* [PATCH v2 14/14] arm64: defconfig: Enable HFPLL
  2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
                   ` (12 preceding siblings ...)
  2019-01-28 18:33 ` [PATCH v2 13/14] arm64: dts: qcom: qcs404: Add cpufreq support Jorge Ramirez-Ortiz
@ 2019-01-28 18:33 ` Jorge Ramirez-Ortiz
  13 siblings, 0 replies; 26+ messages in thread
From: Jorge Ramirez-Ortiz @ 2019-01-28 18:33 UTC (permalink / raw)
  To: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

The high frequency pll is required on compatible Qualcomm SoCs to
support the CPU frequency scaling feature.

Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index c8432e2..67f0cca 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -628,6 +628,7 @@ CONFIG_MSM_MMCC_8996=y
 CONFIG_MSM_GCC_8998=y
 CONFIG_QCS_GCC_404=y
 CONFIG_SDM_GCC_845=y
+CONFIG_QCOM_HFPLL=y
 CONFIG_HWSPINLOCK=y
 CONFIG_HWSPINLOCK_QCOM=y
 CONFIG_ARM_MHU=y
-- 
2.7.4


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

* Re: [PATCH v2 10/14] arm64: dts: qcom: qcs404: Add OPP table
  2019-01-28 18:32 ` [PATCH v2 10/14] arm64: dts: qcom: qcs404: Add OPP table Jorge Ramirez-Ortiz
@ 2019-01-30  4:41   ` Vinod Koul
  2019-01-30  9:08     ` Jorge Ramirez
  0 siblings, 1 reply; 26+ messages in thread
From: Vinod Koul @ 2019-01-30  4:41 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz
  Cc: sboyd, bjorn.andersson, andy.gross, david.brown, jassisinghbrar,
	mark.rutland, mturquette, robh+dt, will.deacon, arnd,
	horms+renesas, heiko, sibis, enric.balletbo, jagan, olof,
	niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

On 28-01-19, 19:32, Jorge Ramirez-Ortiz wrote:
> Add a CPU OPP table to qcs404
> 
> Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
> Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> ---
>  arch/arm64/boot/dts/qcom/qcs404.dtsi | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi
> index 9b5c165..4594fea7 100644
> --- a/arch/arm64/boot/dts/qcom/qcs404.dtsi
> +++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi
> @@ -62,6 +62,21 @@
>  		};
>  	};
>  
> +	cpu_opp_table: cpu_opp_table {

This should be:
        cpu_opp_table: cpu-opp-table

IIRC node names are not supposed to have _ and tags not supposed to have
-, please compile with W=12 to trigger these warnings :)

> +		compatible = "operating-points-v2";
> +		opp-shared;
> +
> +		opp-1094400000 {
> +			opp-hz = /bits/ 64 <1094400000>;
> +		};
> +		opp-1248000000 {
> +			opp-hz = /bits/ 64 <1248000000>;
> +		};
> +		opp-1401600000 {
> +			opp-hz = /bits/ 64 <1401600000>;
> +		};
> +	};
> +
>  	firmware {
>  		scm: scm {
>  			compatible = "qcom,scm-qcs404", "qcom,scm";
> -- 
> 2.7.4

-- 
~Vinod

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

* Re: [PATCH v2 10/14] arm64: dts: qcom: qcs404: Add OPP table
  2019-01-30  4:41   ` Vinod Koul
@ 2019-01-30  9:08     ` Jorge Ramirez
  0 siblings, 0 replies; 26+ messages in thread
From: Jorge Ramirez @ 2019-01-30  9:08 UTC (permalink / raw)
  To: Vinod Koul
  Cc: sboyd, bjorn.andersson, andy.gross, david.brown, jassisinghbrar,
	mark.rutland, mturquette, robh+dt, will.deacon, arnd,
	horms+renesas, heiko, sibis, enric.balletbo, jagan, olof,
	niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

On 1/30/19 05:41, Vinod Koul wrote:
> On 28-01-19, 19:32, Jorge Ramirez-Ortiz wrote:
>> Add a CPU OPP table to qcs404
>>
>> Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
>> Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
>> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
>> ---
>>  arch/arm64/boot/dts/qcom/qcs404.dtsi | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi
>> index 9b5c165..4594fea7 100644
>> --- a/arch/arm64/boot/dts/qcom/qcs404.dtsi
>> +++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi
>> @@ -62,6 +62,21 @@
>>  		};
>>  	};
>>  
>> +	cpu_opp_table: cpu_opp_table {
> 
> This should be:
>         cpu_opp_table: cpu-opp-table

yes. um I thought I fixed this ..sorry about it.

> 
> IIRC node names are not supposed to have _ and tags not supposed to have
> -, please compile with W=12 to trigger these warnings :)
> 
>> +		compatible = "operating-points-v2";
>> +		opp-shared;
>> +
>> +		opp-1094400000 {
>> +			opp-hz = /bits/ 64 <1094400000>;
>> +		};
>> +		opp-1248000000 {
>> +			opp-hz = /bits/ 64 <1248000000>;
>> +		};

also need to remove the frequency below. I might have sent the wrong
version of this file

>> +		opp-1401600000 {
>> +			opp-hz = /bits/ 64 <1401600000>;
>> +		};
>> +	};
>> +
>>  	firmware {
>>  		scm: scm {
>>  			compatible = "qcom,scm-qcs404", "qcom,scm";
>> -- 
>> 2.7.4
> 


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

* Re: [PATCH v2 04/14] dt-bindings: mailbox: qcom: Add clock-name optional property
  2019-01-28 18:32 ` [PATCH v2 04/14] dt-bindings: mailbox: qcom: Add clock-name optional property Jorge Ramirez-Ortiz
@ 2019-01-30 15:50   ` Rob Herring
  0 siblings, 0 replies; 26+ messages in thread
From: Rob Herring @ 2019-01-30 15:50 UTC (permalink / raw)
  To: Jorge Ramirez-Ortiz
  Cc: jorge.ramirez-ortiz, sboyd, bjorn.andersson, andy.gross,
	david.brown, jassisinghbrar, mark.rutland, mturquette, robh+dt,
	will.deacon, arnd, horms+renesas, heiko, sibis, enric.balletbo,
	jagan, olof, vkoul, niklas.cassel, georgi.djakov, amit.kucheria,
	devicetree, linux-kernel, linux-arm-kernel, linux-clk,
	linux-arm-msm, khasim.mohammed

On Mon, 28 Jan 2019 19:32:51 +0100, Jorge Ramirez-Ortiz wrote:
> When the APCS clock is registered (platform dependent), it retrieves
> its parent names from hardcoded values in the driver.
> 
> The following commit allows the DT node to provide such clock names to
> the platform data based clock driver therefore avoiding having to
> explicitly embed those names in the clock driver source code.
> 
> Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
> Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> ---
>  .../bindings/mailbox/qcom,apcs-kpss-global.txt     | 24 +++++++++++++++++++---
>  1 file changed, 21 insertions(+), 3 deletions(-)
> 

Please add Acked-by/Reviewed-by tags when posting new versions. However,
there's no need to repost patches *only* to add the tags. The upstream
maintainer will do that for acks received on the version they apply.

If a tag was not added on purpose, please state why and what changed.

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

* Re: [PATCH v2 07/14] clk: qcom: hfpll: register as clock provider
  2019-01-28 18:32 ` [PATCH v2 07/14] clk: qcom: hfpll: register as clock provider Jorge Ramirez-Ortiz
@ 2019-02-22 18:06   ` Stephen Boyd
  0 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2019-02-22 18:06 UTC (permalink / raw)
  To: andy.gross, arnd, bjorn.andersson, david.brown, enric.balletbo,
	heiko, horms+renesas, jagan, jassisinghbrar, jorge.ramirez-ortiz,
	mark.rutland, mturquette, olof, robh+dt, sibis, will.deacon
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Quoting Jorge Ramirez-Ortiz (2019-01-28 10:32:54)
> Make the output of the high frequency pll a clock provider.
> On the QCS404 this PLL controls cpu frequency scaling.
> 
> Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
> Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> ---

Acked-by: Stephen Boyd <sboyd@kernel.org>


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

* Re: [PATCH v2 01/14] clk: qcom: gcc: limit GPLL0_AO_OUT operating frequency
  2019-01-28 18:32 ` [PATCH v2 01/14] clk: qcom: gcc: limit GPLL0_AO_OUT operating frequency Jorge Ramirez-Ortiz
@ 2019-02-22 18:07   ` Stephen Boyd
  0 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2019-02-22 18:07 UTC (permalink / raw)
  To: andy.gross, arnd, bjorn.andersson, david.brown, enric.balletbo,
	heiko, horms+renesas, jagan, jassisinghbrar, jorge.ramirez-ortiz,
	mark.rutland, mturquette, olof, robh+dt, sibis, will.deacon
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Quoting Jorge Ramirez-Ortiz (2019-01-28 10:32:48)
> Limit the GPLL0_AO_OUT_MAIN operating frequency as per its hardware
> specifications.
> 
> Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
> Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>

Acked-by: Stephen Boyd <sboyd@kernel.org>

> diff --git a/drivers/clk/qcom/gcc-qcs404.c b/drivers/clk/qcom/gcc-qcs404.c
> index 64da032..7de4fcf 100644
> --- a/drivers/clk/qcom/gcc-qcs404.c
> +++ b/drivers/clk/qcom/gcc-qcs404.c
> @@ -304,6 +304,7 @@ static struct clk_alpha_pll gpll0_out_main = {
>         },
>  };
>  
> +

Please remove this stray hunk though.

>  static struct clk_alpha_pll gpll0_ao_out_main = {
>         .offset = 0x21000,
>         .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],

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

* Re: [PATCH v2 02/14] mbox: qcom: add APCS child device for QCS404
  2019-01-28 18:32 ` [PATCH v2 02/14] mbox: qcom: add APCS child device for QCS404 Jorge Ramirez-Ortiz
@ 2019-02-22 18:09   ` Stephen Boyd
  0 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2019-02-22 18:09 UTC (permalink / raw)
  To: andy.gross, arnd, bjorn.andersson, david.brown, enric.balletbo,
	heiko, horms+renesas, jagan, jassisinghbrar, jorge.ramirez-ortiz,
	mark.rutland, mturquette, olof, robh+dt, sibis, will.deacon
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Quoting Jorge Ramirez-Ortiz (2019-01-28 10:32:49)
> There is clock controller functionality in the APCS hardware block of
> qcs404 devices similar to msm8916.
> 
> Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
> Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> ---
>  drivers/mailbox/qcom-apcs-ipc-mailbox.c | 21 +++++++++++++--------
>  1 file changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mailbox/qcom-apcs-ipc-mailbox.c b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
> index 3cf2937..0d64aa5 100644
> --- a/drivers/mailbox/qcom-apcs-ipc-mailbox.c
> +++ b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
> @@ -97,16 +97,21 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
>                 return ret;
>         }
>  
> -       if (of_device_is_compatible(np, "qcom,msm8916-apcs-kpss-global")) {
> -               apcs->clk = platform_device_register_data(&pdev->dev,
> -                                                         "qcom-apcs-msm8916-clk",
> -                                                         -1, NULL, 0);
> -               if (IS_ERR(apcs->clk))
> -                       dev_err(&pdev->dev, "failed to register APCS clk\n");
> -       }
> -
>         platform_set_drvdata(pdev, apcs);
>  
> +       if (of_device_is_compatible(np, "qcom,msm8916-apcs-kpss-global") ||
> +           of_device_is_compatible(np, "qcom,qcs404-apcs-apps-global"))
> +               goto register_clk;

This goto is weird style, but I'm not the maintainer here. Maybe just do
an if condition with the body of the if inside like normally is done and
suffer the indenting pain?


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

* Re: [PATCH v2 05/14] clk: qcom: apcs-msm8916: get parent clock names from DT
  2019-01-28 18:32 ` [PATCH v2 05/14] clk: qcom: apcs-msm8916: get parent clock names from DT Jorge Ramirez-Ortiz
@ 2019-02-22 18:11   ` Stephen Boyd
  2019-04-22 11:44     ` Jorge Ramirez
  0 siblings, 1 reply; 26+ messages in thread
From: Stephen Boyd @ 2019-02-22 18:11 UTC (permalink / raw)
  To: andy.gross, arnd, bjorn.andersson, david.brown, enric.balletbo,
	heiko, horms+renesas, jagan, jassisinghbrar, jorge.ramirez-ortiz,
	mark.rutland, mturquette, olof, robh+dt, sibis, will.deacon
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Quoting Jorge Ramirez-Ortiz (2019-01-28 10:32:52)
> @@ -61,6 +65,25 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev)
>         if (!a53cc)
>                 return -ENOMEM;
>  
> +       /* check if the parent names are present in the device tree */

This looks odd.

> +       ret = devm_clk_bulk_get(parent, ARRAY_SIZE(pclks), pclks);
> +       if (ret == -EPROBE_DEFER)
> +               return ret;

Why can't we use of_clk_parent_fill() if we know this is always a DT
platform?  The parent clks may not be registered at the time of probe?
Maybe this series should wait for the parent registration stuff I'm
working on so that this can be made simpler.

> +
> +       if (!ret) {
> +               gpll0_a53cc[0] = __clk_get_name(pclks[0].clk);
> +               gpll0_a53cc[1] = __clk_get_name(pclks[1].clk);
> +               a53cc->pclk = pclks[1].clk;
> +       } else {
> +               /* support old binding where only pll was explicitily defined */
> +               a53cc->pclk = devm_clk_get(parent, NULL);
> +               if (IS_ERR(a53cc->pclk)) {
> +                       ret = PTR_ERR(a53cc->pclk);
> +                       dev_err(dev, "failed to get clk: %d\n", ret);
> +                       return ret;
> +               }
> +       }
> +
>         init.name = "a53mux";
>         init.parent_names = gpll0_a53cc;
>         init.num_parents = ARRAY_SIZE(gpll0_a53cc);

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

* Re: [PATCH v2 08/14] clk: qcom: hfpll: CLK_IGNORE_UNUSED
  2019-01-28 18:32 ` [PATCH v2 08/14] clk: qcom: hfpll: CLK_IGNORE_UNUSED Jorge Ramirez-Ortiz
@ 2019-02-22 18:12   ` Stephen Boyd
  0 siblings, 0 replies; 26+ messages in thread
From: Stephen Boyd @ 2019-02-22 18:12 UTC (permalink / raw)
  To: andy.gross, arnd, bjorn.andersson, david.brown, enric.balletbo,
	heiko, horms+renesas, jagan, jassisinghbrar, jorge.ramirez-ortiz,
	mark.rutland, mturquette, olof, robh+dt, sibis, will.deacon
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Quoting Jorge Ramirez-Ortiz (2019-01-28 10:32:55)
> When COMMON_CLK_DISABLED_UNUSED is set, in an effort to save power and
> to keep the software model of the clock in line with reality, the
> framework transverses the clock tree and disables those clocks that
> were enabled by the firmware but have not been enabled by any device
> driver.
> 
> If CPUFREQ is enabled, early during the system boot, it might attempt
> to change the CPU frequency ("set_rate"). If the HFPLL is selected as
> a provider, it will then change the rate for this clock.
> 
> As boot continues, clk_disable_unused_subtree will run. Since it wont
> find a valid counter (enable_count) for a clock that is actually
> enabled it will attempt to disable it which will cause the CPU to
> stop. Notice that in this driver, calls to check whether the clock is
> enabled are routed via the is_enabled callback which queries the
> hardware.
> 
> The following commit, rather than marking the clock critical and
> forcing the clock to be always enabled, addresses the above scenario
> making sure the clock is not disabled but it continues to rely on the
> firmware to enable the clock.
> 
> Co-developed-by: Niklas Cassel <niklas.cassel@linaro.org>
> Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
> Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> ---
>  drivers/clk/qcom/hfpll.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c
> index 0ffed0d..9d92f5d 100644
> --- a/drivers/clk/qcom/hfpll.c
> +++ b/drivers/clk/qcom/hfpll.c
> @@ -58,6 +58,7 @@ static int qcom_hfpll_probe(struct platform_device *pdev)
>                 .parent_names = (const char *[]){ "xo" },
>                 .num_parents = 1,
>                 .ops = &clk_ops_hfpll,
> +               .flags = CLK_IGNORE_UNUSED,

Please put some sort of similar comment in the code so we can find it
without git history digging.


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

* Re: [PATCH v2 05/14] clk: qcom: apcs-msm8916: get parent clock names from DT
  2019-02-22 18:11   ` Stephen Boyd
@ 2019-04-22 11:44     ` Jorge Ramirez
  2019-04-25 21:29       ` Stephen Boyd
  0 siblings, 1 reply; 26+ messages in thread
From: Jorge Ramirez @ 2019-04-22 11:44 UTC (permalink / raw)
  To: Stephen Boyd, andy.gross, arnd, bjorn.andersson, david.brown,
	enric.balletbo, heiko, horms+renesas, jagan, jassisinghbrar,
	mark.rutland, mturquette, olof, robh+dt, sibis, will.deacon
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

On 2/22/19 19:11, Stephen Boyd wrote:
> Quoting Jorge Ramirez-Ortiz (2019-01-28 10:32:52)
>> @@ -61,6 +65,25 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev)
>>         if (!a53cc)
>>                 return -ENOMEM;
>>  
>> +       /* check if the parent names are present in the device tree */
> 
> This looks odd.
> 
>> +       ret = devm_clk_bulk_get(parent, ARRAY_SIZE(pclks), pclks);
>> +       if (ret == -EPROBE_DEFER)
>> +               return ret;
> 
> Why can't we use of_clk_parent_fill() if we know this is always a DT
> platform?  The parent clks may not be registered at the time of probe?

yes, and AFAICS the important thing at this point is that the clock is
registered hence the handling of defer.

I could use of_clk_parent_fill and then - if needed - call
devm_clk_bulk_get but I am not sure of the gains of doing it (wouldnt
this just make the code more confusing?)


> Maybe this series should wait for the parent registration stuff I'm
> working on so that this can be made simpler.

the need for the clock name is not intrinsic to this driver (the driver
itself doesnt use these names) but it just feeds these to the framework.

I was looking into your parent registration code and I am not sure how
can I use it in this particular driver other than simply removing the
names and hoping that things are handled properly at the lower
levels.... could you clarify please?


> 
>> +
>> +       if (!ret) {
>> +               gpll0_a53cc[0] = __clk_get_name(pclks[0].clk);
>> +               gpll0_a53cc[1] = __clk_get_name(pclks[1].clk);
>> +               a53cc->pclk = pclks[1].clk;
>> +       } else {
>> +               /* support old binding where only pll was explicitily defined */
>> +               a53cc->pclk = devm_clk_get(parent, NULL);
>> +               if (IS_ERR(a53cc->pclk)) {
>> +                       ret = PTR_ERR(a53cc->pclk);
>> +                       dev_err(dev, "failed to get clk: %d\n", ret);
>> +                       return ret;
>> +               }
>> +       }
>> +
>>         init.name = "a53mux";
>>         init.parent_names = gpll0_a53cc;
>>         init.num_parents = ARRAY_SIZE(gpll0_a53cc);
> 


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

* Re: [PATCH v2 05/14] clk: qcom: apcs-msm8916: get parent clock names from DT
  2019-04-22 11:44     ` Jorge Ramirez
@ 2019-04-25 21:29       ` Stephen Boyd
  2019-04-25 21:42         ` Jorge Ramirez
  0 siblings, 1 reply; 26+ messages in thread
From: Stephen Boyd @ 2019-04-25 21:29 UTC (permalink / raw)
  To: Jorge Ramirez, andy.gross, arnd, bjorn.andersson, david.brown,
	enric.balletbo, heiko, horms+renesas, jagan, jassisinghbrar,
	mark.rutland, mturquette, olof, robh+dt, sibis, will.deacon
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

Quoting Jorge Ramirez (2019-04-22 04:44:50)
> On 2/22/19 19:11, Stephen Boyd wrote:
> > Quoting Jorge Ramirez-Ortiz (2019-01-28 10:32:52)
> >> @@ -61,6 +65,25 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev)
> >>         if (!a53cc)
> >>                 return -ENOMEM;
> >>  
> >> +       /* check if the parent names are present in the device tree */
> > 
> > This looks odd.
> > 
> >> +       ret = devm_clk_bulk_get(parent, ARRAY_SIZE(pclks), pclks);
> >> +       if (ret == -EPROBE_DEFER)
> >> +               return ret;
> > 
> > Why can't we use of_clk_parent_fill() if we know this is always a DT
> > platform?  The parent clks may not be registered at the time of probe?
> 
> yes, and AFAICS the important thing at this point is that the clock is
> registered hence the handling of defer.
> 
> I could use of_clk_parent_fill and then - if needed - call
> devm_clk_bulk_get but I am not sure of the gains of doing it (wouldnt
> this just make the code more confusing?)

Yeah of_clk_parent_fill() isn't the best approach. But it at least keeps
this driver from using clk consumer APIs?

> 
> 
> > Maybe this series should wait for the parent registration stuff I'm
> > working on so that this can be made simpler.
> 
> the need for the clock name is not intrinsic to this driver (the driver
> itself doesnt use these names) but it just feeds these to the framework.
> 
> I was looking into your parent registration code and I am not sure how
> can I use it in this particular driver other than simply removing the
> names and hoping that things are handled properly at the lower
> levels.... could you clarify please?
> 

I think so. I've forgotten the context of this patch, but the general
idea would be to specify the parents with clock-names or DT index in the
DT node for the clks registered here and not use of_clk_parent_fill() or
do any sort of devm_clk_bulk_get() calls. Then the framework will take
care of finding the parents for the clks and hooking things up properly
for the parent-child relationship.


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

* Re: [PATCH v2 05/14] clk: qcom: apcs-msm8916: get parent clock names from DT
  2019-04-25 21:29       ` Stephen Boyd
@ 2019-04-25 21:42         ` Jorge Ramirez
  0 siblings, 0 replies; 26+ messages in thread
From: Jorge Ramirez @ 2019-04-25 21:42 UTC (permalink / raw)
  To: Stephen Boyd, andy.gross, arnd, bjorn.andersson, david.brown,
	enric.balletbo, heiko, horms+renesas, jagan, jassisinghbrar,
	mark.rutland, mturquette, olof, robh+dt, sibis, will.deacon
  Cc: vkoul, niklas.cassel, georgi.djakov, amit.kucheria, devicetree,
	linux-kernel, linux-arm-kernel, linux-clk, linux-arm-msm,
	khasim.mohammed

On 4/25/19 23:29, Stephen Boyd wrote:
> Quoting Jorge Ramirez (2019-04-22 04:44:50)
>> On 2/22/19 19:11, Stephen Boyd wrote:
>>> Quoting Jorge Ramirez-Ortiz (2019-01-28 10:32:52)
>>>> @@ -61,6 +65,25 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev)
>>>>         if (!a53cc)
>>>>                 return -ENOMEM;
>>>>  
>>>> +       /* check if the parent names are present in the device tree */
>>>
>>> This looks odd.
>>>
>>>> +       ret = devm_clk_bulk_get(parent, ARRAY_SIZE(pclks), pclks);
>>>> +       if (ret == -EPROBE_DEFER)
>>>> +               return ret;
>>>
>>> Why can't we use of_clk_parent_fill() if we know this is always a DT
>>> platform?  The parent clks may not be registered at the time of probe?
>>
>> yes, and AFAICS the important thing at this point is that the clock is
>> registered hence the handling of defer.
>>
>> I could use of_clk_parent_fill and then - if needed - call
>> devm_clk_bulk_get but I am not sure of the gains of doing it (wouldnt
>> this just make the code more confusing?)
> 
> Yeah of_clk_parent_fill() isn't the best approach. But it at least keeps
> this driver from using clk consumer APIs?

ok will do that then.

> 
>>
>>
>>> Maybe this series should wait for the parent registration stuff I'm
>>> working on so that this can be made simpler.
>>
>> the need for the clock name is not intrinsic to this driver (the driver
>> itself doesnt use these names) but it just feeds these to the framework.
>>
>> I was looking into your parent registration code and I am not sure how
>> can I use it in this particular driver other than simply removing the
>> names and hoping that things are handled properly at the lower
>> levels.... could you clarify please?
>>
> 
> I think so. I've forgotten the context of this patch, but the general
> idea would be to specify the parents with clock-names or DT index in the
> DT node for the clks registered here and not use of_clk_parent_fill() or
> do any sort of devm_clk_bulk_get() calls. Then the framework will take
> care of finding the parents for the clks and hooking things up properly
> for the parent-child relationship.
> 
> 

ok will try that. thanks for confirming!


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

end of thread, other threads:[~2019-04-25 21:42 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-28 18:32 [PATCH v2 00/14] Support CPU frequency scaling on QCS404 Jorge Ramirez-Ortiz
2019-01-28 18:32 ` [PATCH v2 01/14] clk: qcom: gcc: limit GPLL0_AO_OUT operating frequency Jorge Ramirez-Ortiz
2019-02-22 18:07   ` Stephen Boyd
2019-01-28 18:32 ` [PATCH v2 02/14] mbox: qcom: add APCS child device for QCS404 Jorge Ramirez-Ortiz
2019-02-22 18:09   ` Stephen Boyd
2019-01-28 18:32 ` [PATCH v2 03/14] mbox: qcom: replace integer with valid macro Jorge Ramirez-Ortiz
2019-01-28 18:32 ` [PATCH v2 04/14] dt-bindings: mailbox: qcom: Add clock-name optional property Jorge Ramirez-Ortiz
2019-01-30 15:50   ` Rob Herring
2019-01-28 18:32 ` [PATCH v2 05/14] clk: qcom: apcs-msm8916: get parent clock names from DT Jorge Ramirez-Ortiz
2019-02-22 18:11   ` Stephen Boyd
2019-04-22 11:44     ` Jorge Ramirez
2019-04-25 21:29       ` Stephen Boyd
2019-04-25 21:42         ` Jorge Ramirez
2019-01-28 18:32 ` [PATCH v2 06/14] clk: qcom: hfpll: " Jorge Ramirez-Ortiz
2019-01-28 18:32 ` [PATCH v2 07/14] clk: qcom: hfpll: register as clock provider Jorge Ramirez-Ortiz
2019-02-22 18:06   ` Stephen Boyd
2019-01-28 18:32 ` [PATCH v2 08/14] clk: qcom: hfpll: CLK_IGNORE_UNUSED Jorge Ramirez-Ortiz
2019-02-22 18:12   ` Stephen Boyd
2019-01-28 18:32 ` [PATCH v2 09/14] arm64: dts: qcom: msm8916: Add the clocks for the APCS mux/divider Jorge Ramirez-Ortiz
2019-01-28 18:32 ` [PATCH v2 10/14] arm64: dts: qcom: qcs404: Add OPP table Jorge Ramirez-Ortiz
2019-01-30  4:41   ` Vinod Koul
2019-01-30  9:08     ` Jorge Ramirez
2019-01-28 18:32 ` [PATCH v2 11/14] arm64: dts: qcom: qcs404: Add HFPLL node Jorge Ramirez-Ortiz
2019-01-28 18:32 ` [PATCH v2 12/14] arm64: dts: qcom: qcs404: Add the clocks for APCS mux/divider Jorge Ramirez-Ortiz
2019-01-28 18:33 ` [PATCH v2 13/14] arm64: dts: qcom: qcs404: Add cpufreq support Jorge Ramirez-Ortiz
2019-01-28 18:33 ` [PATCH v2 14/14] arm64: defconfig: Enable HFPLL Jorge Ramirez-Ortiz

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