Skip to contentSkip to conversation

Add APSS clock controller support for IPQ6018

PATCH Superseded Sivaprakash Murugesan 3 participants 19 messages May 4, 2020 – May 24, 2020

Subsystems (6)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add APSS clock controller support for IPQ6018

The CPU on Qualcomm's IPQ6018 devices are primarily fed by APSS PLL and XO, these are connected to a clock mux and enable block.

This patch series adds support for these clocks and inturn enables clocks required for CPU freq.

[V4]
* Re-written PLL found on IPQ platforms as a separate driver
* Addressed stephen's comments on apss clock controller and pll
* Addressed Rob's review comments on bindings
* moved a53 pll binding from this series as it is not applicable, will send it separately.
[V3]
* Fixed dt binding check error in patch2
dt-bindings: clock: Add YAML schemas for QCOM A53 PLL
[V2]
* Restructred the patch series as there are two different HW blocks, the mux and enable belongs to the apcs block and PLL has a separate HW block.
* Converted qcom mailbox and qcom a53 pll documentation to yaml.
* Addressed review comments from Stephen, Rob and Sibi where it is applicable.
* Changed this cover letter to state the purpose of this patch series

Sivaprakash Murugesan (8):
dt-bindings: mailbox: Add YAML schemas for QCOM APCS global block
dt-bindings: clock: Add schema for QCOM IPQ apss pll
clk: qcom: Add ipq apss pll driver
clk: qcom: Add DT bindings for ipq6018 apss clock controller
clk: qcom: Add ipq apss clock controller
dt-bindings: mailbox: Add dt-bindings for ipq6018 apcs global block
mailbox: qcom: Add ipq6018 apcs compatible
arm64: dts: ipq6018: Add a53 pll and apcs clock

 .../bindings/clock/qcom,ipq-apsspll.yaml           |  49 ++++++++++
 .../bindings/mailbox/qcom,apcs-kpss-global.txt     |  88 -----------------
 .../bindings/mailbox/qcom,apcs-kpss-global.yaml    |  99 +++++++++++++++++++
 arch/arm64/boot/dts/qcom/ipq6018.dtsi              |  16 +++-
 drivers/clk/qcom/Kconfig                           |  19 ++++
 drivers/clk/qcom/Makefile                          |   2 +
 drivers/clk/qcom/apss-ipq-pll.c                    |  97 +++++++++++++++++++
 drivers/clk/qcom/apss-ipq.c                        | 106 +++++++++++++++++++++
 drivers/mailbox/qcom-apcs-ipc-mailbox.c            |  26 +++--
 include/dt-bindings/clock/qcom,apss-ipq.h          |  12 +++
 10 files changed, 414 insertions(+), 100 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,ipq-apsspll.yaml
 delete mode 100644 Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt
 create mode 100644 Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml
 create mode 100644 drivers/clk/qcom/apss-ipq-pll.c
 create mode 100644 drivers/clk/qcom/apss-ipq.c
 create mode 100644 include/dt-bindings/clock/qcom,apss-ipq.h
Signature · 1 line
2.7.4
#1 lore raw

PATCH v4 1/8 dt-bindings: mailbox: Add YAML schemas for QCOM APCS global block

Qualcomm APCS global block provides a bunch of generic properties which are required in a device tree. Add YAML schema for these properties.

---
[V4]
* Addressed Rob's review comments

 .../bindings/mailbox/qcom,apcs-kpss-global.txt     | 88 ----------------------
 .../bindings/mailbox/qcom,apcs-kpss-global.yaml    | 86 +++++++++++++++++++++
 2 files changed, 86 insertions(+), 88 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt
 create mode 100644 Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml
Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt deleted +0 -88
deleted file mode 100644
index beec612..0000000
@@ -1,88 +0,0 @@
-Binding for the Qualcomm APCS global block
-==========================================
-
-This binding describes the APCS "global" block found in various Qualcomm
-platforms.
-
-- compatible:
-	Usage: required
-	Value type: <string>
-	Definition: must be one of:
-		    "qcom,msm8916-apcs-kpss-global",
-		    "qcom,msm8996-apcs-hmss-global"
-		    "qcom,msm8998-apcs-hmss-global"
-		    "qcom,qcs404-apcs-apps-global"
-		    "qcom,sc7180-apss-shared"
-		    "qcom,sdm845-apss-shared"
-		    "qcom,sm8150-apss-shared"
-		    "qcom,ipq8074-apcs-apps-global"
-
-- reg:
-	Usage: required
-	Value type: <prop-encoded-array>
-	Definition: must specify the base address and size of the global block
-
-- clocks:
-	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
-	Value type: <u32>
-	Definition: as described in mailbox.txt, must be 1
-
-- #clock-cells:
-	Usage: optional
-	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 "pll" and "aux"
-
-= EXAMPLE
-The following example describes the APCS HMSS found in MSM8996 and part of the
-GLINK RPM referencing the "rpm_hlos" doorbell therein.
-
-	apcs_glb: mailbox@9820000 {
-		compatible = "qcom,msm8996-apcs-hmss-global";
-		reg = <0x9820000 0x1000>;
-
-		#mbox-cells = <1>;
-	};
-
-	rpm-glink {
-		compatible = "qcom,glink-rpm";
-
-		interrupts = <GIC_SPI 168 IRQ_TYPE_EDGE_RISING>;
-
-		qcom,rpm-msg-ram = <&rpm_msg_ram>;
-
-		mboxes = <&apcs_glb 0>;
-		mbox-names = "rpm_hlos";
-	};
-
-Below is another example of the APCS binding on MSM8916 platforms:
-
-	apcs: mailbox@b011000 {
-		compatible = "qcom,msm8916-apcs-kpss-global";
-		reg = <0xb011000 0x1000>;
-		#mbox-cells = <1>;
-		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 = <&apcs_hfpll>, <&gcc GCC_GPLL0_AO_OUT_MAIN>;
-		clock-names = "pll", "aux";
-		#clock-cells = <0>;
-	};
Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml new file +86 -0

86 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer Reviewed-by on v4 1/8
#2 lore raw

Re: [PATCH V4 1/8] dt-bindings: mailbox: Add YAML schemas for QCOM APCS global block

Quoted 4 lines · Sivaprakash Murugesan

Qualcomm APCS global block provides a bunch of generic properties which are required in a device tree. Add YAML schema for these properties.

Quoted 9 lines

---
[V4]
* Addressed Rob's review comments

 .../bindings/mailbox/qcom,apcs-kpss-global.txt     | 88 ----------------------
 .../bindings/mailbox/qcom,apcs-kpss-global.yaml    | 86 +++++++++++++++++++++
 2 files changed, 86 insertions(+), 88 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt
 create mode 100644 Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml
#3 lore raw

PATCH v4 2/8 dt-bindings: clock: Add schema for QCOM IPQ apss pll

In reply to Sivaprakash Murugesan

Add dt-binding for apss pll found on QCOM IPQ platforms

---
 .../bindings/clock/qcom,ipq-apsspll.yaml           | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,ipq-apsspll.yaml
Documentation/devicetree/bindings/clock/qcom,ipq-apsspll.yaml new file +49 -0
new file mode 100644
index 0000000..dd12ec4
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,ipq-apsspll.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm IPQ APSS PLL Binding
+
+maintainers:
+  - Sivaprakash Murugesan <[email protected]>
+
+description:
+  The APSS PLL is the main clock that feds the CPUs on QCOM IPQ platforms.
+  It can support frequencies above 1GHz.
+
+properties:
+  compatible:
+    const: qcom,ipq-apss-pll
+
+  reg:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 0
+
+  clocks:
+    items:
+      - description: board XO clock
+
+  clock-names:
+    items:
+      - const: xo
+
+required:
+  - compatible
+  - reg
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    a53pll_ipq: clock@b116000 {
+        compatible = "qcom,ipq-apss-pll";
+        reg = <0x0b116000 0x40>;
+        #clock-cells = <0>;
+        clocks = <&xo>;
+        clock-names = "xo";
+    };
Signature · 1 line
2.7.4
#4 lore raw

Re: [PATCH V4 2/8] dt-bindings: clock: Add schema for QCOM IPQ apss pll

Quoted 3 lines · Sivaprakash Murugesan

Add dt-binding for apss pll found on QCOM IPQ platforms

This seems quite similar to the existing qcom,a53pll binding, can't you just describe both in the same binding?

Quoted 19 lines
---
 .../bindings/clock/qcom,ipq-apsspll.yaml           | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qcom,ipq-apsspll.yaml
Documentation/devicetree/bindings/clock/qcom,ipq-apsspll.yaml new file +8 -0
new file mode 100644
index 0000000..dd12ec4
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/qcom,ipq-apsspll.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm IPQ APSS PLL Binding
+

Documentation/devicetree/bindings/clock/qcom,ipq-apsspll.yaml line 18

Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,ipq-apsspll.yaml new file +10 -0
+maintainers:
+  - Sivaprakash Murugesan <[email protected]>
+
+description:
+  The APSS PLL is the main clock that feds the CPUs on QCOM IPQ platforms.
+  It can support frequencies above 1GHz.
+
+properties:
+  compatible:
+    const: qcom,ipq-apss-pll

Allow me to claim that this is not the last IPQ, with an APSS PLL, which means that this compatible is no good.

I think you want a compatible on the format qcom,ipq<numbers>-a53pll.

Regards,
Bjorn

Quoted 34 lines
Documentation/devicetree/bindings/clock/qcom,ipq-apsspll.yaml new file +31 -0
+
+  reg:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 0
+
+  clocks:
+    items:
+      - description: board XO clock
+
+  clock-names:
+    items:
+      - const: xo
+
+required:
+  - compatible
+  - reg
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    a53pll_ipq: clock@b116000 {
+        compatible = "qcom,ipq-apss-pll";
+        reg = <0x0b116000 0x40>;
+        #clock-cells = <0>;
+        clocks = <&xo>;
+        clock-names = "xo";
+    };
Signature · 1 line
2.7.4
#5 lore raw

Re: [PATCH V4 2/8] dt-bindings: clock: Add schema for QCOM IPQ apss pll

Quoted 7 lines · Bjorn Andersson
Quoted 3 lines · Sivaprakash Murugesan

Add dt-binding for apss pll found on QCOM IPQ platforms

This seems quite similar to the existing qcom,a53pll binding, can't you just describe both in the same binding?

ok.

#6 lore raw

PATCH v4 3/8 clk: qcom: Add ipq apss pll driver

In reply to Sivaprakash Murugesan

The CPUs on Qualcomm ipq based devices are clocked by an alpha PLL. Add support for the apss pll found on ipq based devices which can support CPU frequencies above 1Ghz.

---
 drivers/clk/qcom/Kconfig        |  8 ++++
 drivers/clk/qcom/Makefile       |  1 +
 drivers/clk/qcom/apss-ipq-pll.c | 97 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 106 insertions(+)
 create mode 100644 drivers/clk/qcom/apss-ipq-pll.c
drivers/clk/qcom/Kconfig +8 -0
index 11ec6f4..e70aa01 100644
@@ -89,6 +89,14 @@ config APQ_MMCC_8084
 	  Say Y if you want to support multimedia devices such as display,
 	  graphics, video encode/decode, camera, etc.
 
+config IPQ_APSS_PLL
+	tristate "IPQ APSS PLL"
+	help
+	  Support for APSS PLL on ipq devices. The APSS PLL is the main
+	  clock that feeds the CPUs on ipq based devices.
+	  Say Y if you want to support CPU frequency scaling on ipq based
+	  devices.
+
 config IPQ_GCC_4019
 	tristate "IPQ4019 Global Clock Controller"
 	help
drivers/clk/qcom/Makefile +1 -0
index 691efbf..b4a6ba1 100644
@@ -19,6 +19,7 @@ clk-qcom-$(CONFIG_QCOM_GDSC) += gdsc.o
 # Keep alphabetically sorted by config
 obj-$(CONFIG_APQ_GCC_8084) += gcc-apq8084.o
 obj-$(CONFIG_APQ_MMCC_8084) += mmcc-apq8084.o
+obj-$(CONFIG_IPQ_APSS_PLL) += apss-ipq-pll.o
 obj-$(CONFIG_IPQ_GCC_4019) += gcc-ipq4019.o
 obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o
 obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
drivers/clk/qcom/apss-ipq-pll.c new file +97 -0

97 lines not on this page · raw message

Signature · 1 line
2.7.4
#7 lore raw

PATCH v4 4/8 clk: qcom: Add DT bindings for ipq6018 apss clock controller

In reply to Sivaprakash Murugesan

add dt-binding for ipq6018 apss clock controller

---
 include/dt-bindings/clock/qcom,apss-ipq.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 include/dt-bindings/clock/qcom,apss-ipq.h
include/dt-bindings/clock/qcom,apss-ipq.h new file +12 -0
new file mode 100644
index 0000000..77b6e05
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef _DT_BINDINGS_CLOCK_QCA_APSS_IPQ6018_H
+#define _DT_BINDINGS_CLOCK_QCA_APSS_IPQ6018_H
+
+#define APCS_ALIAS0_CLK_SRC			0
+#define APCS_ALIAS0_CORE_CLK			1
+
+#endif
Signature · 1 line
2.7.4
#8 lore raw

PATCH v4 5/8 clk: qcom: Add ipq apss clock controller

In reply to Sivaprakash Murugesan

The CPU on Qualcomm ipq platform is clocked primarily by a aplha PLL and xo which are connected to a mux and enable block.

Add support for the mux and enable block which feeds the CPU on ipq based devices.

---
[V4]
* Addressed review comments

 drivers/clk/qcom/Kconfig    |  11 +++++
 drivers/clk/qcom/Makefile   |   1 +
 drivers/clk/qcom/apss-ipq.c | 106 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 118 insertions(+)
 create mode 100644 drivers/clk/qcom/apss-ipq.c
drivers/clk/qcom/Kconfig +11 -0
index e70aa01..8d8465e 100644
@@ -97,6 +97,17 @@ config IPQ_APSS_PLL
 	  Say Y if you want to support CPU frequency scaling on ipq based
 	  devices.
 
+config IPQ_APSS
+	tristate "IPQ APSS Clock Controller"
+	select IPQ_APSS_PLL
+	depends on QCOM_APCS_IPC || COMPILE_TEST
+	help
+	  Support for APSS clock controller on IPQ platforms. The
+	  APSS clock controller manages the Mux and enable block that feeds the
+	  CPUs.
+	  Say Y if you want to support CPU frequency scaling on
+	  ipq based devices.
+
 config IPQ_GCC_4019
 	tristate "IPQ4019 Global Clock Controller"
 	help
drivers/clk/qcom/Makefile +1 -0
index b4a6ba1..aab7a58 100644
@@ -20,6 +20,7 @@ clk-qcom-$(CONFIG_QCOM_GDSC) += gdsc.o
 obj-$(CONFIG_APQ_GCC_8084) += gcc-apq8084.o
 obj-$(CONFIG_APQ_MMCC_8084) += mmcc-apq8084.o
 obj-$(CONFIG_IPQ_APSS_PLL) += apss-ipq-pll.o
+obj-$(CONFIG_IPQ_APSS) += apss-ipq.o
 obj-$(CONFIG_IPQ_GCC_4019) += gcc-ipq4019.o
 obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o
 obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
drivers/clk/qcom/apss-ipq.c new file +106 -0

106 lines not on this page · raw message

Signature · 1 line
2.7.4
#9 lore raw

Re: [PATCH V4 5/8] clk: qcom: Add ipq apss clock controller

Quoted 6 lines · Sivaprakash Murugesan

The CPU on Qualcomm ipq platform is clocked primarily by a aplha PLL and xo which are connected to a mux and enable block.

Add support for the mux and enable block which feeds the CPU on ipq based devices.

As with the A53 binding, I don't believe that this driver will support all past, present and future IPQ APSSs. Please make it more specific.

Regards,
Bjorn

Quoted 159 lines

---
[V4]
* Addressed review comments

 drivers/clk/qcom/Kconfig    |  11 +++++
 drivers/clk/qcom/Makefile   |   1 +
 drivers/clk/qcom/apss-ipq.c | 106 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 118 insertions(+)
 create mode 100644 drivers/clk/qcom/apss-ipq.c
drivers/clk/qcom/Kconfig +11 -0
index e70aa01..8d8465e 100644
@@ -97,6 +97,17 @@ config IPQ_APSS_PLL
 	  Say Y if you want to support CPU frequency scaling on ipq based
 	  devices.
 
+config IPQ_APSS
+	tristate "IPQ APSS Clock Controller"
+	select IPQ_APSS_PLL
+	depends on QCOM_APCS_IPC || COMPILE_TEST
+	help
+	  Support for APSS clock controller on IPQ platforms. The
+	  APSS clock controller manages the Mux and enable block that feeds the
+	  CPUs.
+	  Say Y if you want to support CPU frequency scaling on
+	  ipq based devices.
+
 config IPQ_GCC_4019
 	tristate "IPQ4019 Global Clock Controller"
 	help
drivers/clk/qcom/Makefile +1 -0
index b4a6ba1..aab7a58 100644
@@ -20,6 +20,7 @@ clk-qcom-$(CONFIG_QCOM_GDSC) += gdsc.o
 obj-$(CONFIG_APQ_GCC_8084) += gcc-apq8084.o
 obj-$(CONFIG_APQ_MMCC_8084) += mmcc-apq8084.o
 obj-$(CONFIG_IPQ_APSS_PLL) += apss-ipq-pll.o
+obj-$(CONFIG_IPQ_APSS) += apss-ipq.o
 obj-$(CONFIG_IPQ_GCC_4019) += gcc-ipq4019.o
 obj-$(CONFIG_IPQ_GCC_6018) += gcc-ipq6018.o
 obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
drivers/clk/qcom/apss-ipq.c new file +106 -0
new file mode 100644
index 0000000..59ed8e7
@@ -0,0 +1,106 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include <linux/kernel.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/clk-provider.h>
+#include <linux/regmap.h>
+#include <linux/module.h>
+
+#include <dt-bindings/clock/qcom,apss-ipq.h>
+
+#include "common.h"
+#include "clk-regmap.h"
+#include "clk-branch.h"
+#include "clk-alpha-pll.h"
+#include "clk-regmap-mux.h"
+
+enum {
+	P_XO,
+	P_APSS_PLL_EARLY,
+};
+
+static const struct clk_parent_data parents_apcs_alias0_clk_src[] = {
+	{ .fw_name = "xo" },
+	{ .fw_name = "pll" },
+};
+
+static const struct parent_map parents_apcs_alias0_clk_src_map[] = {
+	{ P_XO, 0 },
+	{ P_APSS_PLL_EARLY, 5 },
+};
+
+static struct clk_regmap_mux apcs_alias0_clk_src = {
+	.reg = 0x0050,
+	.width = 3,
+	.shift = 7,
+	.parent_map = parents_apcs_alias0_clk_src_map,
+	.clkr.hw.init = &(struct clk_init_data){
+		.name = "apcs_alias0_clk_src",
+		.parent_data = parents_apcs_alias0_clk_src,
+		.num_parents = 2,
+		.ops = &clk_regmap_mux_closest_ops,
+		.flags = CLK_SET_RATE_PARENT,
+	},
+};
+
+static struct clk_branch apcs_alias0_core_clk = {
+	.halt_reg = 0x0058,
+	.clkr = {
+		.enable_reg = 0x0058,
+		.enable_mask = BIT(0),
+		.hw.init = &(struct clk_init_data){
+			.name = "apcs_alias0_core_clk",
+			.parent_hws = (const struct clk_hw *[]){
+				&apcs_alias0_clk_src.clkr.hw },
+			.num_parents = 1,
+			.flags = CLK_SET_RATE_PARENT,
+			.ops = &clk_branch2_ops,
+		},
+	},
+};
+
+static const struct regmap_config apss_ipq_regmap_config = {
+	.reg_bits       = 32,
+	.reg_stride     = 4,
+	.val_bits       = 32,
+	.max_register   = 0x1000,
+	.fast_io        = true,
+};
+
+static struct clk_regmap *apss_ipq_clks[] = {
+	[APCS_ALIAS0_CLK_SRC] = &apcs_alias0_clk_src.clkr,
+	[APCS_ALIAS0_CORE_CLK] = &apcs_alias0_core_clk.clkr,
+};
+
+static const struct qcom_cc_desc apss_ipq_desc = {
+	.config = &apss_ipq_regmap_config,
+	.clks = apss_ipq_clks,
+	.num_clks = ARRAY_SIZE(apss_ipq_clks),
+};
+
+static int apss_ipq_probe(struct platform_device *pdev)
+{
+	struct regmap *regmap;
+
+	regmap = dev_get_regmap(pdev->dev.parent, NULL);
+	if (IS_ERR(regmap))
+		return PTR_ERR(regmap);
+
+	return qcom_cc_really_probe(pdev, &apss_ipq_desc, regmap);
+}
+
+static struct platform_driver apss_ipq_driver = {
+	.probe = apss_ipq_probe,
+	.driver = {
+		.name   = "qcom,apss-ipq-clk",
+	},
+};
+
+module_platform_driver(apss_ipq_driver);
+
+MODULE_DESCRIPTION("QCOM APSS IPQ CLK Driver");
+MODULE_LICENSE("GPL v2");
Signature · 1 line
2.7.4
#10 lore raw

Re: [PATCH V4 5/8] clk: qcom: Add ipq apss clock controller

Quoted 10 lines · Bjorn Andersson
Quoted 6 lines · Sivaprakash Murugesan

The CPU on Qualcomm ipq platform is clocked primarily by a aplha PLL and xo which are connected to a mux and enable block.

Add support for the mux and enable block which feeds the CPU on ipq based devices.

As with the A53 binding, I don't believe that this driver will support all past, present and future IPQ APSSs. Please make it more specific.

ok. Let me make the changes to be specific for ipq6018 devices.

Quoted 3 lines

Regards,
Bjorn

#11 lore raw

PATCH v4 6/8 dt-bindings: mailbox: Add dt-bindings for ipq6018 apcs global block

In reply to Sivaprakash Murugesan

Add dt-bindings for ipq6018 mailbox driver

---
 .../bindings/mailbox/qcom,apcs-kpss-global.yaml         | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml +15 -2
index 12eff94..e05bff4 100644
@@ -16,6 +16,7 @@ maintainers:
 properties:
   compatible:
     enum:
+      - qcom,ipq6018-apcs-apps-global
       - qcom,ipq8074-apcs-apps-global
       - qcom,msm8916-apcs-kpss-global
       - qcom,msm8996-apcs-hmss-global
@@ -38,12 +39,12 @@ properties:
     const: 1
 
   '#clock-cells':
-    const: 0
+    enum: [ 0, 1 ]
 
   clock-names:
     items:
       - const: pll
-      - const: aux
+      - enum: [ aux, xo ]
 
 required:
   - compatible
@@ -84,3 +85,15 @@ examples:
         clock-names = "pll", "aux";
         #clock-cells = <0>;
     };
+
+  # Example apcs with ipq6018
+  - |
+    #include "dt-bindings/clock/qcom,apss-ipq.h"
+    apcs_ipq: mailbox@b111000 {
+        compatible = "qcom,ipq6018-apcs-apps-global";
+        reg = <0x0b111000 0x1000>;
+        #clock-cells = <1>;
+        clocks = <&a53pll>, <&xo>;
+        clock-names = "pll", "xo";
+        #mbox-cells = <1>;
+    };
Signature · 1 line
2.7.4
#12 lore raw

PATCH v4 7/8 mailbox: qcom: Add ipq6018 apcs compatible

In reply to Sivaprakash Murugesan

The Qualcomm ipq6018 has apcs block, add compatible for the same. Also, the apcs provides a clock controller functionality similar to msm8916 but the clock driver is different.

Create a child platform device based on the apcs compatible for the clock controller functionality.

---
 drivers/mailbox/qcom-apcs-ipc-mailbox.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)
drivers/mailbox/qcom-apcs-ipc-mailbox.c +17 -9
index eeebafd..7c0c4b0 100644
@@ -45,6 +45,16 @@ static const struct mbox_chan_ops qcom_apcs_ipc_ops = {
 	.send_data = qcom_apcs_ipc_send_data,
 };
 
+static const struct of_device_id apcs_clk_match_table[] = {
+	{ .compatible = "qcom,msm8916-apcs-kpss-global",
+	  .data = "qcom-apcs-msm8916-clk", },
+	{ .compatible = "qcom,qcs404-apcs-apps-global",
+	  .data = "qcom-apcs-msm8916-clk", },
+	{ .compatible = "qcom,ipq6018-apcs-apps-global",
+	  .data = "qcom,apss-ipq-clk", },
+	{}
+};
+
 static int qcom_apcs_ipc_probe(struct platform_device *pdev)
 {
 	struct qcom_apcs_ipc *apcs;
@@ -54,11 +64,7 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
 	void __iomem *base;
 	unsigned long i;
 	int ret;
-	const struct of_device_id apcs_clk_match_table[] = {
-		{ .compatible = "qcom,msm8916-apcs-kpss-global", },
-		{ .compatible = "qcom,qcs404-apcs-apps-global", },
-		{}
-	};
+	const struct of_device_id *clk_device;
 
 	apcs = devm_kzalloc(&pdev->dev, sizeof(*apcs), GFP_KERNEL);
 	if (!apcs)
@@ -93,11 +99,12 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	if (of_match_device(apcs_clk_match_table, &pdev->dev)) {
+	clk_device = of_match_device(apcs_clk_match_table, &pdev->dev);
+	if (clk_device) {
 		apcs->clk = platform_device_register_data(&pdev->dev,
-							  "qcom-apcs-msm8916-clk",
-							  PLATFORM_DEVID_NONE,
-							  NULL, 0);
+						(const char *)clk_device->data,
+						PLATFORM_DEVID_NONE,
+						NULL, 0);
 		if (IS_ERR(apcs->clk))
 			dev_err(&pdev->dev, "failed to register APCS clk\n");
 	}
@@ -127,6 +134,7 @@ static const struct of_device_id qcom_apcs_ipc_of_match[] = {
 	{ .compatible = "qcom,sdm845-apss-shared", .data = (void *)12 },
 	{ .compatible = "qcom,sm8150-apss-shared", .data = (void *)12 },
 	{ .compatible = "qcom,ipq8074-apcs-apps-global", .data = (void *)8 },
+	{ .compatible = "qcom,ipq6018-apcs-apps-global", .data = (void *)8 },
 	{}
 };
 MODULE_DEVICE_TABLE(of, qcom_apcs_ipc_of_match);
Signature · 1 line
2.7.4
#13 lore raw

Re: [PATCH V4 7/8] mailbox: qcom: Add ipq6018 apcs compatible

Quoted 17 lines · Sivaprakash Murugesan

The Qualcomm ipq6018 has apcs block, add compatible for the same. Also, the apcs provides a clock controller functionality similar to msm8916 but the clock driver is different.

Create a child platform device based on the apcs compatible for the clock controller functionality.

---
 drivers/mailbox/qcom-apcs-ipc-mailbox.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)
drivers/mailbox/qcom-apcs-ipc-mailbox.c +0 -0
index eeebafd..7c0c4b0 100644

drivers/mailbox/qcom-apcs-ipc-mailbox.c static const struct mbox_chan_ops qcom_apcs_ipc_ops = { · line 50

Quoted 6 lines
drivers/mailbox/qcom-apcs-ipc-mailbox.c +3 -0
@@ -45,6 +45,16 @@ static const struct mbox_chan_ops qcom_apcs_ipc_ops = {
 	.send_data = qcom_apcs_ipc_send_data,
 };
 
+static const struct of_device_id apcs_clk_match_table[] = {
+	{ .compatible = "qcom,msm8916-apcs-kpss-global",
+	  .data = "qcom-apcs-msm8916-clk", },

These are easier to read if you ignore the 80-char limit. Unless Jassi's object that is.

drivers/mailbox/qcom-apcs-ipc-mailbox.c static const struct mbox_chan_ops qcom_apcs_ipc_ops = { · line 53

Quoted 3 lines
drivers/mailbox/qcom-apcs-ipc-mailbox.c +3 -0
+	{ .compatible = "qcom,qcs404-apcs-apps-global",
+	  .data = "qcom-apcs-msm8916-clk", },
+	{ .compatible = "qcom,ipq6018-apcs-apps-global",

Add your entry on top, to maintain sort order.

Quoted 21 lines
drivers/mailbox/qcom-apcs-ipc-mailbox.c +5 -5
+	  .data = "qcom,apss-ipq-clk", },
+	{}
+};
+
 static int qcom_apcs_ipc_probe(struct platform_device *pdev)
 {
 	struct qcom_apcs_ipc *apcs;
@@ -54,11 +64,7 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
 	void __iomem *base;
 	unsigned long i;
 	int ret;
-	const struct of_device_id apcs_clk_match_table[] = {
-		{ .compatible = "qcom,msm8916-apcs-kpss-global", },
-		{ .compatible = "qcom,qcs404-apcs-apps-global", },
-		{}
-	};
+	const struct of_device_id *clk_device;
 
 	apcs = devm_kzalloc(&pdev->dev, sizeof(*apcs), GFP_KERNEL);
 	if (!apcs)

drivers/mailbox/qcom-apcs-ipc-mailbox.c static int qcom_apcs_ipc_probe(struct platform_device *pdev) · line 102

Quoted 5 lines
drivers/mailbox/qcom-apcs-ipc-mailbox.c +1 -1
@@ -93,11 +99,12 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	if (of_match_device(apcs_clk_match_table, &pdev->dev)) {
+	clk_device = of_match_device(apcs_clk_match_table, &pdev->dev);

Better use of_device_match_data() and get the string directly (or NULL).

drivers/mailbox/qcom-apcs-ipc-mailbox.c static int qcom_apcs_ipc_probe(struct platform_device *pdev) · line 107

Quoted 8 lines
drivers/mailbox/qcom-apcs-ipc-mailbox.c +4 -3
+	if (clk_device) {
 		apcs->clk = platform_device_register_data(&pdev->dev,
-							  "qcom-apcs-msm8916-clk",
-							  PLATFORM_DEVID_NONE,
-							  NULL, 0);
+						(const char *)clk_device->data,
+						PLATFORM_DEVID_NONE,
+						NULL, 0);

I didn't apply the patch to look for myself, but please ensure to maintain indentation to follow the parenthesis on the line before.

drivers/mailbox/qcom-apcs-ipc-mailbox.c static const struct of_device_id qcom_apcs_ipc_of_match[] = { · line 137

Quoted 8 lines
drivers/mailbox/qcom-apcs-ipc-mailbox.c +1 -0
 		if (IS_ERR(apcs->clk))
 			dev_err(&pdev->dev, "failed to register APCS clk\n");
 	}
@@ -127,6 +134,7 @@ static const struct of_device_id qcom_apcs_ipc_of_match[] = {
 	{ .compatible = "qcom,sdm845-apss-shared", .data = (void *)12 },
 	{ .compatible = "qcom,sm8150-apss-shared", .data = (void *)12 },
 	{ .compatible = "qcom,ipq8074-apcs-apps-global", .data = (void *)8 },
+	{ .compatible = "qcom,ipq6018-apcs-apps-global", .data = (void *)8 },

Add it one line up and you'll maintain partial sorting...

Regards,
Bjorn

Quoted 6 lines
drivers/mailbox/qcom-apcs-ipc-mailbox.c +0 -0
 	{}
 };
 MODULE_DEVICE_TABLE(of, qcom_apcs_ipc_of_match);
Signature · 1 line
2.7.4
#14 lore raw

Re: [PATCH V4 7/8] mailbox: qcom: Add ipq6018 apcs compatible

Hi Bjorn,

Quoted 22 lines · Bjorn Andersson
Quoted 20 lines · Sivaprakash Murugesan

The Qualcomm ipq6018 has apcs block, add compatible for the same. Also, the apcs provides a clock controller functionality similar to msm8916 but the clock driver is different.

Create a child platform device based on the apcs compatible for the clock controller functionality.

---
  drivers/mailbox/qcom-apcs-ipc-mailbox.c | 26 +++++++++++++++++---------
  1 file changed, 17 insertions(+), 9 deletions(-)
drivers/mailbox/qcom-apcs-ipc-mailbox.c +0 -0
index eeebafd..7c0c4b0 100644
@@ -45,6 +45,16 @@ static const struct mbox_chan_ops qcom_apcs_ipc_ops = {
  	.send_data = qcom_apcs_ipc_send_data,
  };
 
Quoted 5 lines

drivers/mailbox/qcom-apcs-ipc-mailbox.c static const struct mbox_chan_ops qcom_apcs_ipc_ops = { · line 50

Quoted 3 lines
drivers/mailbox/qcom-apcs-ipc-mailbox.c +3 -0
+static const struct of_device_id apcs_clk_match_table[] = {
+	{ .compatible = "qcom,msm8916-apcs-kpss-global",
+	  .data = "qcom-apcs-msm8916-clk", },

These are easier to read if you ignore the 80-char limit. Unless Jassi's object that is.

since Jassi has not objected your comment, I am making the change as per your suggestion.

Quoted 5 lines

drivers/mailbox/qcom-apcs-ipc-mailbox.c static const struct mbox_chan_ops qcom_apcs_ipc_ops = { · line 53

Quoted 4 lines
drivers/mailbox/qcom-apcs-ipc-mailbox.c +3 -0
+	{ .compatible = "qcom,qcs404-apcs-apps-global",
+	  .data = "qcom-apcs-msm8916-clk", },
+	{ .compatible = "qcom,ipq6018-apcs-apps-global",

Add your entry on top, to maintain sort order.

ok.

Quoted 25 lines
Quoted 25 lines
drivers/mailbox/qcom-apcs-ipc-mailbox.c +5 -5
+	  .data = "qcom,apss-ipq-clk", },
+	{}
+};
+
  static int qcom_apcs_ipc_probe(struct platform_device *pdev)
  {
  	struct qcom_apcs_ipc *apcs;
@@ -54,11 +64,7 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
  	void __iomem *base;
  	unsigned long i;
  	int ret;
-	const struct of_device_id apcs_clk_match_table[] = {
-		{ .compatible = "qcom,msm8916-apcs-kpss-global", },
-		{ .compatible = "qcom,qcs404-apcs-apps-global", },
-		{}
-	};
+	const struct of_device_id *clk_device;
 
  	apcs = devm_kzalloc(&pdev->dev, sizeof(*apcs), GFP_KERNEL);
  	if (!apcs)
@@ -93,11 +99,12 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
  		return ret;
  	}
 
Quoted 3 lines

drivers/mailbox/qcom-apcs-ipc-mailbox.c static int qcom_apcs_ipc_probe(struct platform_device *pdev) · line 102

Quoted 2 lines
drivers/mailbox/qcom-apcs-ipc-mailbox.c +1 -1
-	if (of_match_device(apcs_clk_match_table, &pdev->dev)) {
+	clk_device = of_match_device(apcs_clk_match_table, &pdev->dev);

Better use of_device_match_data() and get the string directly (or NULL).

As I checked there is no API called of_device_match_data(), the API of_device_get_match_data()

returns the data associated with the device and it cannot be used here.

please correct me if wrong.

Quoted 11 lines

drivers/mailbox/qcom-apcs-ipc-mailbox.c static int qcom_apcs_ipc_probe(struct platform_device *pdev) · line 107

Quoted 9 lines
drivers/mailbox/qcom-apcs-ipc-mailbox.c +4 -3
+	if (clk_device) {
  		apcs->clk = platform_device_register_data(&pdev->dev,
-							  "qcom-apcs-msm8916-clk",
-							  PLATFORM_DEVID_NONE,
-							  NULL, 0);
+						(const char *)clk_device->data,
+						PLATFORM_DEVID_NONE,
+						NULL, 0);

I didn't apply the patch to look for myself, but please ensure to maintain indentation to follow the parenthesis on the line before.

ok.

Quoted 10 lines

drivers/mailbox/qcom-apcs-ipc-mailbox.c static const struct of_device_id qcom_apcs_ipc_of_match[] = { · line 137

Quoted 9 lines
drivers/mailbox/qcom-apcs-ipc-mailbox.c +1 -0
  		if (IS_ERR(apcs->clk))
  			dev_err(&pdev->dev, "failed to register APCS clk\n");
  	}
@@ -127,6 +134,7 @@ static const struct of_device_id qcom_apcs_ipc_of_match[] = {
  	{ .compatible = "qcom,sdm845-apss-shared", .data = (void *)12 },
  	{ .compatible = "qcom,sm8150-apss-shared", .data = (void *)12 },
  	{ .compatible = "qcom,ipq8074-apcs-apps-global", .data = (void *)8 },
+	{ .compatible = "qcom,ipq6018-apcs-apps-global", .data = (void *)8 },

Add it one line up and you'll maintain partial sorting...

ok.

#15 lore raw

PATCH v4 8/8 arm64: dts: ipq6018: Add a53 pll and apcs clock

In reply to Sivaprakash Murugesan

add support for apps pll and apcs clock.

---
 arch/arm64/boot/dts/qcom/ipq6018.dtsi | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/ipq6018.dtsi +13 -3
index 1aa8d85..af2ceeb 100644
@@ -294,12 +294,22 @@
 		};
 
 		apcs_glb: mailbox@b111000 {
-			compatible = "qcom,ipq8074-apcs-apps-global";
-			reg = <0x0b111000 0xc>;
-
+			compatible = "qcom,ipq6018-apcs-apps-global";
+			reg = <0x0b111000 0x1000>;
+			#clock-cells = <1>;
+			clocks = <&apsspll>, <&xo>;
+			clock-names = "pll", "xo";
 			#mbox-cells = <1>;
 		};
 
+		apsspll: clock@b116000 {
+			compatible = "qcom,ipq-apss-pll";
+			reg = <0x0b116000 0x40>;
+			#clock-cells = <0>;
+			clocks = <&xo>;
+			clock-names = "xo";
+		};
+
 		timer {
 			compatible = "arm,armv8-timer";
 			interrupts = <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
Signature · 1 line
2.7.4
#16 lore raw

Re: [PATCH V4 8/8] arm64: dts: ipq6018: Add a53 pll and apcs clock

Quoted 12 lines · Sivaprakash Murugesan

add support for apps pll and apcs clock.

---
 arch/arm64/boot/dts/qcom/ipq6018.dtsi | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/ipq6018.dtsi +0 -0
index 1aa8d85..af2ceeb 100644

arch/arm64/boot/dts/qcom/ipq6018.dtsi line 298

Quoted 8 lines
arch/arm64/boot/dts/qcom/ipq6018.dtsi +2 -3
@@ -294,12 +294,22 @@
 		};
 
 		apcs_glb: mailbox@b111000 {
-			compatible = "qcom,ipq8074-apcs-apps-global";
-			reg = <0x0b111000 0xc>;
-
+			compatible = "qcom,ipq6018-apcs-apps-global";
+			reg = <0x0b111000 0x1000>;

My documentation states that IPQ8074 indeed has this block at 0x0b111000, but IPQ6018 it's at 0x6b111000. Can you confirm this is correct? Same with the pll below.

Apart from that the patch looks good.

Regards,
Bjorn

Quoted 20 lines
arch/arm64/boot/dts/qcom/ipq6018.dtsi +11 -0
+			#clock-cells = <1>;
+			clocks = <&apsspll>, <&xo>;
+			clock-names = "pll", "xo";
 			#mbox-cells = <1>;
 		};
 
+		apsspll: clock@b116000 {
+			compatible = "qcom,ipq-apss-pll";
+			reg = <0x0b116000 0x40>;
+			#clock-cells = <0>;
+			clocks = <&xo>;
+			clock-names = "xo";
+		};
+
 		timer {
 			compatible = "arm,armv8-timer";
 			interrupts = <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
Signature · 1 line
2.7.4
#17 lore raw

Re: [PATCH V4 8/8] arm64: dts: ipq6018: Add a53 pll and apcs clock

Hi Bjorn,

Quoted 16 lines · Bjorn Andersson
Quoted 14 lines · Sivaprakash Murugesan

add support for apps pll and apcs clock.

---
  arch/arm64/boot/dts/qcom/ipq6018.dtsi | 16 +++++++++++++---
  1 file changed, 13 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/ipq6018.dtsi +0 -0
index 1aa8d85..af2ceeb 100644
@@ -294,12 +294,22 @@
  		};
 
Quoted 9 lines

arch/arm64/boot/dts/qcom/ipq6018.dtsi line 298

Quoted 6 lines
arch/arm64/boot/dts/qcom/ipq6018.dtsi +2 -3
  		apcs_glb: mailbox@b111000 {
-			compatible = "qcom,ipq8074-apcs-apps-global";
-			reg = <0x0b111000 0xc>;
-
+			compatible = "qcom,ipq6018-apcs-apps-global";
+			reg = <0x0b111000 0x1000>;

My documentation states that IPQ8074 indeed has this block at 0x0b111000, but IPQ6018 it's at 0x6b111000. Can you confirm this is correct? Same with the pll below.

The address 0x6b111000 is how the RPM sees this block. For A53 it is still 0xb111000

Quoted 5 lines

Apart from that the patch looks good.

Regards,
Bjorn

#18 lore raw

Re: [PATCH V4 8/8] arm64: dts: ipq6018: Add a53 pll and apcs clock

Quoted 27 lines · Sivaprakash Murugesan

Hi Bjorn,

Quoted 9 lines · Bjorn Andersson
Quoted 7 lines · Sivaprakash Murugesan

add support for apps pll and apcs clock.

---
  arch/arm64/boot/dts/qcom/ipq6018.dtsi | 16 +++++++++++++---
  1 file changed, 13 insertions(+), 3 deletions(-)
Quoted 15 lines

arch/arm64/boot/dts/qcom/ipq6018.dtsi line 297

Quoted 12 lines
arch/arm64/boot/dts/qcom/ipq6018.dtsi +2 -3
index 1aa8d85..af2ceeb 100644
@@ -294,12 +294,22 @@
  		};
  		apcs_glb: mailbox@b111000 {
-			compatible = "qcom,ipq8074-apcs-apps-global";
-			reg = <0x0b111000 0xc>;
-
+			compatible = "qcom,ipq6018-apcs-apps-global";
+			reg = <0x0b111000 0x1000>;

My documentation states that IPQ8074 indeed has this block at 0x0b111000, but IPQ6018 it's at 0x6b111000. Can you confirm this is correct? Same with the pll below.

Quoted 2 lines

The address 0x6b111000 is how the RPM sees this block. For A53 it is still 0xb111000

Okay, thanks for confirming.

Regards,
Bjorn