Skip to contentSkip to conversation

SDM630 and Ninges fixes

PATCH In review Konrad Dybcio 2 participants 12 messages Jun 23, 2020 – Jun 25, 2020

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

cover SDM630 and Ninges fixes

Disclaimer: Ninges = Nile&Ganges

This series brings support for RPMPD on 630/660, initial tsens support (thermal-zones are WIP so dont' want to send them yet), an urgent fix for pinctrl (I have made a mistake that only showed itself when I tried to add more GPIO-dependent stuff...) and some stuff for Ninges, namely enablement of BLSP1_UART2 (omitted it previously) and temporary removal of Vol- on Nile (which is a result of fixing the pinctrl driver so that gpio-keys got to the point where it probed it and then it died). Also with these changes come some cosmetic updates (using phandles instead of addresses as per Bjorn's Request).

Konrad Dybcio (8):
soc: qcom: rpmpd: Add SDM660 power-domains
arm64: dts: qcom: sdm630: Add RPM power domains support
arm64: dts: qcom: sdm630: Add tsens node
arm64: dts: qcom: sdm630: nile: Enable BLSP1_UART2
arm64: dts: qcom: sdm630: Fix the pinctrl node
arm64: dts: qcom: sdm630: nile: Reserve disabled GPIOs
arm64: dts: qcom: sdm630: nile: Remove Volume Down gpio-key
arm64: dts: qcom: sdm630: ganges: Change addresses to phandles

 .../devicetree/bindings/power/qcom,rpmpd.yaml |  1 +
 .../bindings/thermal/qcom-tsens.yaml          |  1 +
 .../dts/qcom/sdm630-sony-xperia-ganges.dtsi   | 22 +++---
 .../dts/qcom/sdm630-sony-xperia-nile.dtsi     | 67 +++++++++---------
 arch/arm64/boot/dts/qcom/sdm630.dtsi          | 69 +++++++++++++++++--
 drivers/soc/qcom/rpmpd.c                      | 33 +++++++++
 include/dt-bindings/power/qcom-rpmpd.h        | 12 ++++
 7 files changed, 155 insertions(+), 50 deletions(-)
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/8 soc: qcom: rpmpd: Add SDM660 power-domains

Add the shared cx/mx and sensor sub-system's cx and mx power-domains found on SDM660.

---
 .../devicetree/bindings/power/qcom,rpmpd.yaml |  1 +
 drivers/soc/qcom/rpmpd.c                      | 33 +++++++++++++++++++
 include/dt-bindings/power/qcom-rpmpd.h        | 12 +++++++
 3 files changed, 46 insertions(+)
Documentation/devicetree/bindings/power/qcom,rpmpd.yaml +1 -0
index 8058955fb3b9..45ec2439ff51 100644
@@ -20,6 +20,7 @@ properties:
       - qcom,msm8996-rpmpd
       - qcom,msm8998-rpmpd
       - qcom,qcs404-rpmpd
+      - qcom,sdm660-rpmpd
       - qcom,sc7180-rpmhpd
       - qcom,sdm845-rpmhpd
       - qcom,sm8150-rpmhpd
drivers/soc/qcom/rpmpd.c +33 -0
index f2168e4259b2..d54a84dd83a8 100644
@@ -220,11 +220,44 @@ static const struct rpmpd_desc qcs404_desc = {
 	.max_state = RPM_SMD_LEVEL_BINNING,
 };
 
+/* sdm660 RPM Power domains */
+DEFINE_RPMPD_PAIR(sdm660, vddcx, vddcx_ao, RWCX, LEVEL, 0);
+DEFINE_RPMPD_VFL(sdm660, vddcx_vfl, RWCX, 0);
+
+DEFINE_RPMPD_PAIR(sdm660, vddmx, vddmx_ao, RWMX, LEVEL, 0);
+DEFINE_RPMPD_VFL(sdm660, vddmx_vfl, RWMX, 0);
+
+DEFINE_RPMPD_LEVEL(sdm660, vdd_ssccx, RWSC, 0);
+DEFINE_RPMPD_VFL(sdm660, vdd_ssccx_vfl, RWSC, 0);
+
+DEFINE_RPMPD_LEVEL(sdm660, vdd_sscmx, RWSM, 0);
+DEFINE_RPMPD_VFL(sdm660, vdd_sscmx_vfl, RWSM, 0);
+
+static struct rpmpd *sdm660_rpmpds[] = {
+	[SDM660_VDDCX] =		&sdm660_vddcx,
+	[SDM660_VDDCX_AO] =		&sdm660_vddcx_ao,
+	[SDM660_VDDCX_VFL] =		&sdm660_vddcx_vfl,
+	[SDM660_VDDMX] =		&sdm660_vddmx,
+	[SDM660_VDDMX_AO] =		&sdm660_vddmx_ao,
+	[SDM660_VDDMX_VFL] =		&sdm660_vddmx_vfl,
+	[SDM660_SSCCX] =		&sdm660_vdd_ssccx,
+	[SDM660_SSCCX_VFL] =		&sdm660_vdd_ssccx_vfl,
+	[SDM660_SSCMX] =		&sdm660_vdd_sscmx,
+	[SDM660_SSCMX_VFL] =		&sdm660_vdd_sscmx_vfl,
+};
+
+static const struct rpmpd_desc sdm660_desc = {
+	.rpmpds = sdm660_rpmpds,
+	.num_pds = ARRAY_SIZE(sdm660_rpmpds),
+	.max_state = RPM_SMD_LEVEL_TURBO,
+};
+
 static const struct of_device_id rpmpd_match_table[] = {
 	{ .compatible = "qcom,msm8976-rpmpd", .data = &msm8976_desc },
 	{ .compatible = "qcom,msm8996-rpmpd", .data = &msm8996_desc },
 	{ .compatible = "qcom,msm8998-rpmpd", .data = &msm8998_desc },
 	{ .compatible = "qcom,qcs404-rpmpd", .data = &qcs404_desc },
+	{ .compatible = "qcom,sdm660-rpmpd", .data = &sdm660_desc },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, rpmpd_match_table);
include/dt-bindings/power/qcom-rpmpd.h +12 -0
index dc146e44228b..c5a2ddef6b4b 100644
@@ -101,6 +101,18 @@
 #define QCS404_LPIMX		5
 #define QCS404_LPIMX_VFL	6
 
+/* SDM660 Power Domains */
+#define SDM660_VDDCX		0
+#define SDM660_VDDCX_AO		1
+#define SDM660_VDDCX_VFL	2
+#define SDM660_VDDMX		3
+#define SDM660_VDDMX_AO		4
+#define SDM660_VDDMX_VFL	5
+#define SDM660_SSCCX		6
+#define SDM660_SSCCX_VFL	7
+#define SDM660_SSCMX		8
+#define SDM660_SSCMX_VFL	9
+
 /* RPM SMD Power Domain performance levels */
 #define RPM_SMD_LEVEL_RETENTION       16
 #define RPM_SMD_LEVEL_RETENTION_PLUS  32
Signature · 1 line
2.27.0
#2 lore raw

PATCH 2/8 arm64: dts: qcom: sdm630: Add RPM power domains support

In reply to Konrad Dybcio

Add the rpmpd node on the sdm630 and define the available levels.

---
 arch/arm64/boot/dts/qcom/sdm630.dtsi | 46 ++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
arch/arm64/boot/dts/qcom/sdm630.dtsi +46 -0
index 88efe8200c80..ea85f28032d2 100644
@@ -428,6 +428,52 @@ rpmcc: clock-controller {
 				compatible = "qcom,rpmcc-sdm660", "qcom,rpmcc";
 				#clock-cells = <1>;
 			};
+
+			rpmpd: power-controller {
+				compatible = "qcom,sdm660-rpmpd";
+				#power-domain-cells = <1>;
+				operating-points-v2 = <&rpmpd_opp_table>;
+
+				rpmpd_opp_table: opp-table {
+					compatible = "operating-points-v2";
+
+					rpmpd_opp_ret: opp1 {
+						opp-level = <16>;
+					};
+
+					rpmpd_opp_ret_plus: opp2 {
+						opp-level = <32>;
+					};
+
+					rpmpd_opp_min_svs: opp3 {
+						opp-level = <48>;
+					};
+
+					rpmpd_opp_low_svs: opp4 {
+						opp-level = <64>;
+					};
+
+					rpmpd_opp_svs: opp5 {
+						opp-level = <128>;
+					};
+
+					rpmpd_opp_svs_plus: opp6 {
+						opp-level = <192>;
+					};
+
+					rpmpd_opp_nom: opp7 {
+						opp-level = <256>;
+					};
+
+					rpmpd_opp_nom_plus: opp8 {
+						opp-level = <320>;
+					};
+
+					rpmpd_opp_turbo: opp9 {
+						opp-level = <384>;
+					};
+				};
+			};
 		};
 	};
 
Signature · 1 line
2.27.0
#3 lore raw

PATCH 3/8 arm64: dts: qcom: sdm630: Add tsens node

In reply to Konrad Dybcio

Enable tsens on this SoC using tsens-v2 driver.

---
 .../devicetree/bindings/thermal/qcom-tsens.yaml       |  1 +
 arch/arm64/boot/dts/qcom/sdm630.dtsi                  | 11 +++++++++++
 2 files changed, 12 insertions(+)
Documentation/devicetree/bindings/thermal/qcom-tsens.yaml +1 -0
index d7be931b42d2..d89d5acd6e2a 100644
@@ -39,6 +39,7 @@ properties:
               - qcom,msm8996-tsens
               - qcom,msm8998-tsens
               - qcom,sc7180-tsens
+              - qcom,sdm630-tsens
               - qcom,sdm845-tsens
           - const: qcom,tsens-v2
 
arch/arm64/boot/dts/qcom/sdm630.dtsi +11 -0
index ea85f28032d2..92bf4ae6a590 100644
@@ -566,6 +566,17 @@ anoc2_smmu: iommu@16c0000 {
 				<GIC_SPI 474 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		tsens: thermal-sensor@10ae000 {
+			compatible = "qcom,sdm630-tsens", "qcom,tsens-v2";
+			reg = <0x010ae000 0x1000>, /* TM */
+				  <0x010ad000 0x1000>; /* SROT */
+			#qcom,sensors = <12>;
+			interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>,
+					 <GIC_SPI 430 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "uplow", "critical";
+			#thermal-sensor-cells = <1>;
+		};
+
 		tcsr_mutex_regs: syscon@1f40000 {
 			compatible = "syscon";
 			reg = <0x01f40000 0x20000>;
Signature · 1 line
2.27.0
#4 lore raw

Re: [PATCH 3/8] arm64: dts: qcom: sdm630: Add tsens node

Quoted 30 lines · Konrad Dybcio

Enable tsens on this SoC using tsens-v2 driver.

---
 .../devicetree/bindings/thermal/qcom-tsens.yaml       |  1 +
 arch/arm64/boot/dts/qcom/sdm630.dtsi                  | 11 +++++++++++
 2 files changed, 12 insertions(+)
Documentation/devicetree/bindings/thermal/qcom-tsens.yaml +1 -0
index d7be931b42d2..d89d5acd6e2a 100644
@@ -39,6 +39,7 @@ properties:
               - qcom,msm8996-tsens
               - qcom,msm8998-tsens
               - qcom,sc7180-tsens
+              - qcom,sdm630-tsens
               - qcom,sdm845-tsens
           - const: qcom,tsens-v2
 
arch/arm64/boot/dts/qcom/sdm630.dtsi +1 -0
index ea85f28032d2..92bf4ae6a590 100644
@@ -566,6 +566,17 @@ anoc2_smmu: iommu@16c0000 {
                                <GIC_SPI 474 IRQ_TYPE_LEVEL_HIGH>;
                };
 
+               tsens: thermal-sensor@10ae000 {

arch/arm64/boot/dts/qcom/sdm630.dtsi anoc2_smmu: iommu@16c0000 { · line 579

Quoted 10 lines
arch/arm64/boot/dts/qcom/sdm630.dtsi +10 -0
+                       compatible = "qcom,sdm630-tsens", "qcom,tsens-v2";
+                       reg = <0x010ae000 0x1000>, /* TM */
+                                 <0x010ad000 0x1000>; /* SROT */
+                       #qcom,sensors = <12>;
+                       interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>,
+                                        <GIC_SPI 430 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "uplow", "critical";
+                       #thermal-sensor-cells = <1>;
+               };
+

There should be 2 tsens controllers on this platform, the first at 0x010AA000, the other at 0x010AD000.

Quoted 6 lines
arch/arm64/boot/dts/qcom/sdm630.dtsi +0 -1
                tcsr_mutex_regs: syscon@1f40000 {
                        compatible = "syscon";
                        reg = <0x01f40000 0x20000>;
--

2.27.0

#5 lore raw

Re: [PATCH 3/8] arm64: dts: qcom: sdm630: Add tsens node

Interesting, the downstream DTS only mentions the 0x010AD one.. Are you sure you're not looking at 636/660?

Regards
Konrad

#6 lore raw

Re: [PATCH 3/8] arm64: dts: qcom: sdm630: Add tsens node

Quoted 4 lines · Konrad Dybcio

Interesting, the downstream DTS only mentions the 0x010AD one.. Are you sure you're not looking at 636/660?

I looked a bit closer. So there are two instances of the controller but the platform doesn't have as many sensors. So using just one controller is fine. I suspect the other controller might be disabled in firmware.

Regards,
Amit

#7 lore raw

PATCH 4/8 arm64: dts: qcom: sdm630: nile: Enable BLSP1_UART2

In reply to Konrad Dybcio

Enable the second UART interface used on this board. Also convert the DT to use phandles instead of addresses to make it coherent with other device trees.

---
 .../dts/qcom/sdm630-sony-xperia-nile.dtsi     | 50 ++++++++++---------
 1 file changed, 26 insertions(+), 24 deletions(-)
arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi +26 -24
index 9ba359c848d0..de06fa809488 100644
@@ -99,38 +99,40 @@ removed_region@85800000 {
 			no-map;
 		};
 	};
+};
 
-	soc {
-		sdhci@c0c4000 {
-			status = "okay";
+&blsp_i2c1 {
+	status = "okay";
 
-			mmc-ddr-1_8v;
-			/* SoMC Nile platform's eMMC doesn't support HS200 mode */
-			mmc-hs400-1_8v;
-		};
+	/* Synaptics touchscreen */
+};
 
-		i2c@c175000 {
-			status = "okay";
+&blsp_i2c2 {
+	status = "okay";
 
-			/* Synaptics touchscreen */
-		};
+	/* SMB1351 charger */
+};
 
-		i2c@c176000 {
-			status = "okay";
+/* I2C3, 4, 5, 7 and 8 are disabled on this board. */
 
-			/* SMB1351 charger */
-		};
+&blsp_i2c6 {
+	status = "okay";
 
-		serial@c1af000 {
-			status = "okay";
-		};
+	/* NXP NFC */
+};
 
-		/* I2C3, 4, 5, 7 and 8 are disabled on this board. */
+&blsp1_uart2 {
+	status = "okay";
+};
 
-		i2c@c1b6000 {
-			status = "okay";
+&blsp2_uart1 {
+	status = "okay";
+};
 
-			/* NXP NFC */
-		};
-	};
+&sdhc_1 {
+	status = "okay";
+
+	mmc-ddr-1_8v;
+	/* SoMC Nile platform's eMMC doesn't support HS200 mode */
+	mmc-hs400-1_8v;
 };
Signature · 1 line
2.27.0
#8 lore raw

PATCH 5/8 arm64: dts: qcom: sdm630: Fix the pinctrl node

In reply to Konrad Dybcio

Previously present pinctrl node didn't show
problems, but I have in fact misconfigured it.

Fix it to actually enable the use of GPIOs.

---
 arch/arm64/boot/dts/qcom/sdm630.dtsi | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sdm630.dtsi +8 -4
index 92bf4ae6a590..25c18edcb1fa 100644
@@ -582,14 +582,18 @@ tcsr_mutex_regs: syscon@1f40000 {
 			reg = <0x01f40000 0x20000>;
 		};
 
-		tlmm: pinctrl@3000000 {
+		tlmm: pinctrl@3100000 {
 			compatible = "qcom,sdm630-pinctrl";
-			reg = <0x03000000 0xc00000>;
+			reg = <0x03100000 0x400000>,
+				  <0x03500000 0x400000>,
+				  <0x03900000 0x400000>;
+			reg-names = "south", "center", "north";
 			interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>;
 			gpio-controller;
-			#gpio-cells = <0x2>;
+			gpio-ranges = <&tlmm 0 0 114>;
+			#gpio-cells = <2>;
 			interrupt-controller;
-			#interrupt-cells = <0x2>;
+			#interrupt-cells = <2>;
 
 			blsp1_uart1_default: blsp1-uart1-default {
 				pins = "gpio0", "gpio1", "gpio2", "gpio3";
Signature · 1 line
2.27.0
#9 lore raw

PATCH 6/8 arm64: dts: qcom: sdm630: nile: Reserve disabled GPIOs

In reply to Konrad Dybcio

Both Nile and Ganges platforms have gpios 8-11 disabled. Without this, the kernel will not boot when the pinctrl driver is present.

---
 arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi +4 -0
index de06fa809488..9fe800d547cb 100644
@@ -136,3 +136,7 @@ &sdhc_1 {
 	/* SoMC Nile platform's eMMC doesn't support HS200 mode */
 	mmc-hs400-1_8v;
 };
+
+&tlmm {
+	gpio-reserved-ranges = <8 4>;
+};
Signature · 1 line
2.27.0
#10 lore raw

PATCH 7/8 arm64: dts: qcom: sdm630: nile: Remove Volume Down gpio-key

In reply to Konrad Dybcio

Currently, the driver crashes with tons of
gpiochip_irq_unmask+0x30/0x40.

Removing the key for now will prevent the
kernel from panicking, so that the development
can go on.

---
 .../boot/dts/qcom/sdm630-sony-xperia-nile.dtsi      | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi +5 -8
index 9fe800d547cb..3646890040b3 100644
@@ -63,14 +63,11 @@ camera_snapshot {
 			debounce-interval = <15>;
 		};
 
-		vol_down {
-			label = "Volume Down";
-			gpios = <&pm660l_gpios 7 GPIO_ACTIVE_LOW>;
-			linux,input-type = <1>;
-			linux,code = <KEY_VOLUMEDOWN>;
-			gpio-key,wakeup;
-			debounce-interval = <15>;
-		};
+		/* Nile also uses gpio-keys for
+		 * Volume Down,  but currently there's an
+		 * issue with it that has to be resolved.
+		 * Until then, let's not make the kernel panic
+		 */
 	};
 
 	reserved-memory {
Signature · 1 line
2.27.0
#11 lore raw

PATCH 8/8 arm64: dts: qcom: sdm630: ganges: Change addresses to phandles

In reply to Konrad Dybcio

This brings the DT in line with the style used
in other device trees.

---
 .../dts/qcom/sdm630-sony-xperia-ganges.dtsi   | 22 +++++++------------
 1 file changed, 8 insertions(+), 14 deletions(-)
arch/arm64/boot/dts/qcom/sdm630-sony-xperia-ganges.dtsi +8 -14
index cf2e8b5d60e8..12d4d1c25027 100644
@@ -13,13 +13,6 @@
 #include "sdm630-sony-xperia-nile.dtsi"
 
 / {
-	chosen {
-		framebuffer@9d400000 {
-			reg = <0 0x9d400000 0 (2520 * 1080 * 4)>;
-			height = <2520>;
-		};
-	};
-
 	/* Yes, this is intentional.
 	 * Ganges devices only use gpio-keys for
 	 * Volume Down, but currently there's an
@@ -27,14 +20,15 @@ framebuffer@9d400000 {
 	 * Until then, let's not make the kernel panic
 	 */
 	/delete-node/ gpio-keys;
+};
 
-	soc {
-
-		i2c@c175000 {
-			status = "okay";
+&framebuffer0 {
+	reg = <0 0x9d400000 0 (2520 * 1080 * 4)>;
+	height = <2520>;
+};
 
-			/* Novatek touchscreen */
-		};
-	};
+&blsp_i2c1 {
+	status = "okay";
 
+	/* Novatek touchscreen */
 };
Signature · 1 line
2.27.0