Skip to contentSkip to conversation

mailbox: qcom-apcs-ipc: add IPQ8074 APSS clock controller support

PATCH In review Robert Marko 2 participants 5 messages Jul 5, 2022 – Jul 6, 2022

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

PATCH v5 1/3 mailbox: qcom-apcs-ipc: add IPQ8074 APSS clock controller support

IPQ8074 has the APSS clock controller utilizing the same register space as the APCS, so provide access to the APSS utilizing a child device like IPQ6018 does as well, but just by utilizing the IPQ8074 specific APSS clock driver.

Also, APCS register space in IPQ8074 is 0x6000 so max_register needs to be updated to 0x5ffc.

---
Changes in v5:
* Use lower case hex for max_register
* Update the APSS clock name to match the new one without commas

---
 drivers/mailbox/qcom-apcs-ipc-mailbox.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/mailbox/qcom-apcs-ipc-mailbox.c +6 -2
index 80a54d81412e..4ef7e917a911 100644
@@ -33,6 +33,10 @@ static const struct qcom_apcs_ipc_data ipq6018_apcs_data = {
 	.offset = 8, .clk_name = "qcom,apss-ipq6018-clk"
 };
 
+static const struct qcom_apcs_ipc_data ipq8074_apcs_data = {
+	.offset = 8, .clk_name = "qcom-apss-ipq8074-clk"
+};
+
 static const struct qcom_apcs_ipc_data msm8916_apcs_data = {
 	.offset = 8, .clk_name = "qcom-apcs-msm8916-clk"
 };
@@ -57,7 +61,7 @@ static const struct regmap_config apcs_regmap_config = {
 	.reg_bits = 32,
 	.reg_stride = 4,
 	.val_bits = 32,
-	.max_register = 0x1008,
+	.max_register = 0x5ffc,
 	.fast_io = true,
 };
 
@@ -142,7 +146,7 @@ static int qcom_apcs_ipc_remove(struct platform_device *pdev)
 /* .data is the offset of the ipc register within the global block */
 static const struct of_device_id qcom_apcs_ipc_of_match[] = {
 	{ .compatible = "qcom,ipq6018-apcs-apps-global", .data = &ipq6018_apcs_data },
-	{ .compatible = "qcom,ipq8074-apcs-apps-global", .data = &msm8994_apcs_data },
+	{ .compatible = "qcom,ipq8074-apcs-apps-global", .data = &ipq8074_apcs_data },
 	{ .compatible = "qcom,msm8916-apcs-kpss-global", .data = &msm8916_apcs_data },
 	{ .compatible = "qcom,msm8939-apcs-kpss-global", .data = &msm8916_apcs_data },
 	{ .compatible = "qcom,msm8953-apcs-kpss-global", .data = &msm8994_apcs_data },
Signature · 1 line
2.36.1
#1 lore raw

PATCH v5 2/3 dt-bindings: mailbox: qcom: set correct #clock-cells

IPQ6018 and IPQ8074 require #clock-cells to be set to 1 as their APSS clock driver provides multiple clock outputs.

So allow setting 1 as #clock-cells and check that its set to 1 for IPQ6018 and IPQ8074, check others for 0 as its currently.

---
Changes in v3:
* Drop not needed blank line

Changes in v2:
* Correct subject name

---
 .../bindings/mailbox/qcom,apcs-kpss-global.yaml | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.yaml +16 -1
index 3b5ba7ecc19d..95ecb84e3278 100644
@@ -50,7 +50,7 @@ properties:
     const: 1
 
   '#clock-cells':
-    const: 0
+    enum: [0, 1]
 
   clock-names:
     minItems: 2
@@ -96,6 +96,21 @@ allOf:
       properties:
         clocks:
           maxItems: 3
+  - if:
+      properties:
+        compatible:
+          enum:
+            - qcom,ipq6018-apcs-apps-global
+            - qcom,ipq8074-apcs-apps-global
+    then:
+      properties:
+        '#clock-cells':
+          const: 1
+    else:
+      properties:
+        '#clock-cells':
+          const: 0
+
 examples:
 
   # Example apcs with msm8996
Signature · 1 line
2.36.1
#2 lore raw

PATCH v5 3/3 arm64: dts: ipq8074: add APCS node

In reply to Robert Marko

APCS now has support for providing the APSS clocks as the child device for IPQ8074.

So, add the required DT node for it as it will later be used as the CPU clocksource.

---
Changes in v3:
* Node does not currently exist in the upstream kernel, so add it instead of modifying.

---
 arch/arm64/boot/dts/qcom/ipq8074.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/qcom/ipq8074.dtsi +8 -0
index b4ae13f16398..76707b9f9845 100644
@@ -886,5 +886,13 @@ IRQ_TYPE_LEVEL_HIGH>, /* int_c */
 				      "axi_m_sticky";
 			status = "disabled";
 		};
+
+		apcs_glb: mailbox@b111000 {
+			compatible = "qcom,ipq8074-apcs-apps-global";
+			reg = <0x0b111000 0x6000>;
+
+			#clock-cells = <1>;
+			#mbox-cells = <1>;
+		};
 	};
 };
Signature · 1 line
2.36.1
Reviewed-by on v5 3/3
#3 lore raw

Re: [PATCH v5 3/3] arm64: dts: ipq8074: add APCS node

Quoted 8 lines · Robert Marko

APCS now has support for providing the APSS clocks as the child device for IPQ8074.

So, add the required DT node for it as it will later be used as the CPU clocksource.

Quoted 29 lines

---
Changes in v3:
* Node does not currently exist in the upstream kernel, so add it instead of modifying.

---
 arch/arm64/boot/dts/qcom/ipq8074.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/qcom/ipq8074.dtsi +8 -1
index b4ae13f16398..76707b9f9845 100644
@@ -886,5 +886,13 @@ IRQ_TYPE_LEVEL_HIGH>, /* int_c */
                                      "axi_m_sticky";
                        status = "disabled";
                };
+
+               apcs_glb: mailbox@b111000 {
+                       compatible = "qcom,ipq8074-apcs-apps-global";
+                       reg = <0x0b111000 0x6000>;
+
+                       #clock-cells = <1>;
+                       #mbox-cells = <1>;
+               };
        };
 };
--

2.36.1

Signature · 2 lines
With best wishes
Dmitry
#4 lore raw
In reply to Robert Marko
Quoted 8 lines · Robert Marko

IPQ8074 has the APSS clock controller utilizing the same register space as the APCS, so provide access to the APSS utilizing a child device like IPQ6018 does as well, but just by utilizing the IPQ8074 specific APSS clock driver.

Also, APCS register space in IPQ8074 is 0x6000 so max_register needs to be updated to 0x5ffc.

As you can see, this was changed to support SDX55. Please either make this configurable, or leave it as it is.

Quoted 10 lines

---
Changes in v5:
* Use lower case hex for max_register
* Update the APSS clock name to match the new one without commas

---
 drivers/mailbox/qcom-apcs-ipc-mailbox.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Signature · 2 lines
With best wishes
Dmitry