2020-06-23 18:09:20

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 0/8] 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(-)

--
2.27.0


2020-06-23 18:09:36

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 4/8] arm64: dts: qcom: sdm630: nile: Enable BLSP1_UART2

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.

Signed-off-by: Konrad Dybcio <[email protected]>
---
.../dts/qcom/sdm630-sony-xperia-nile.dtsi | 50 ++++++++++---------
1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi b/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
index 9ba359c848d0..de06fa809488 100644
--- a/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
@@ -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;
};
--
2.27.0

2020-06-23 18:09:39

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 5/8] arm64: dts: qcom: sdm630: Fix the pinctrl node

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

Fix it to actually enable the use of GPIOs.

Signed-off-by: Konrad Dybcio <[email protected]>
---
arch/arm64/boot/dts/qcom/sdm630.dtsi | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qcom/sdm630.dtsi
index 92bf4ae6a590..25c18edcb1fa 100644
--- a/arch/arm64/boot/dts/qcom/sdm630.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi
@@ -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";
--
2.27.0

2020-06-23 18:09:49

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 6/8] arm64: dts: qcom: sdm630: nile: Reserve disabled GPIOs

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

Signed-off-by: Konrad Dybcio <[email protected]>
---
arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi b/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
index de06fa809488..9fe800d547cb 100644
--- a/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
@@ -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>;
+};
--
2.27.0

2020-06-23 18:09:49

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 8/8] arm64: dts: qcom: sdm630: ganges: Change addresses to phandles

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

Signed-off-by: Konrad Dybcio <[email protected]>
---
.../dts/qcom/sdm630-sony-xperia-ganges.dtsi | 22 +++++++------------
1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-ganges.dtsi b/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-ganges.dtsi
index cf2e8b5d60e8..12d4d1c25027 100644
--- a/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-ganges.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-ganges.dtsi
@@ -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 */
};
--
2.27.0

2020-06-23 18:10:27

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 3/8] arm64: dts: qcom: sdm630: Add tsens node

Enable tsens on this SoC using tsens-v2 driver.

Signed-off-by: Konrad Dybcio <[email protected]>
---
.../devicetree/bindings/thermal/qcom-tsens.yaml | 1 +
arch/arm64/boot/dts/qcom/sdm630.dtsi | 11 +++++++++++
2 files changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
index d7be931b42d2..d89d5acd6e2a 100644
--- a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
+++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
@@ -39,6 +39,7 @@ properties:
- qcom,msm8996-tsens
- qcom,msm8998-tsens
- qcom,sc7180-tsens
+ - qcom,sdm630-tsens
- qcom,sdm845-tsens
- const: qcom,tsens-v2

diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qcom/sdm630.dtsi
index ea85f28032d2..92bf4ae6a590 100644
--- a/arch/arm64/boot/dts/qcom/sdm630.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi
@@ -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>;
--
2.27.0

2020-06-23 18:11:27

by Konrad Dybcio

[permalink] [raw]
Subject: [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.

Signed-off-by: Konrad Dybcio <[email protected]>
---
.../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(+)

diff --git a/Documentation/devicetree/bindings/power/qcom,rpmpd.yaml b/Documentation/devicetree/bindings/power/qcom,rpmpd.yaml
index 8058955fb3b9..45ec2439ff51 100644
--- a/Documentation/devicetree/bindings/power/qcom,rpmpd.yaml
+++ b/Documentation/devicetree/bindings/power/qcom,rpmpd.yaml
@@ -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
diff --git a/drivers/soc/qcom/rpmpd.c b/drivers/soc/qcom/rpmpd.c
index f2168e4259b2..d54a84dd83a8 100644
--- a/drivers/soc/qcom/rpmpd.c
+++ b/drivers/soc/qcom/rpmpd.c
@@ -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);
diff --git a/include/dt-bindings/power/qcom-rpmpd.h b/include/dt-bindings/power/qcom-rpmpd.h
index dc146e44228b..c5a2ddef6b4b 100644
--- a/include/dt-bindings/power/qcom-rpmpd.h
+++ b/include/dt-bindings/power/qcom-rpmpd.h
@@ -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
--
2.27.0

2020-06-23 18:11:51

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 7/8] arm64: dts: qcom: sdm630: nile: Remove Volume Down gpio-key

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.

Signed-off-by: Konrad Dybcio <[email protected]>
---
.../boot/dts/qcom/sdm630-sony-xperia-nile.dtsi | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi b/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
index 9fe800d547cb..3646890040b3 100644
--- a/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
@@ -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 {
--
2.27.0

2020-06-23 18:12:24

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH 2/8] arm64: dts: qcom: sdm630: Add RPM power domains support

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

Signed-off-by: Konrad Dybcio <[email protected]>
---
arch/arm64/boot/dts/qcom/sdm630.dtsi | 46 ++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qcom/sdm630.dtsi
index 88efe8200c80..ea85f28032d2 100644
--- a/arch/arm64/boot/dts/qcom/sdm630.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi
@@ -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>;
+ };
+ };
+ };
};
};

--
2.27.0

2020-06-24 11:45:50

by Amit Kucheria

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

On Tue, Jun 23, 2020 at 11:39 PM Konrad Dybcio <[email protected]> wrote:
>
> Enable tsens on this SoC using tsens-v2 driver.
>
> Signed-off-by: Konrad Dybcio <[email protected]>
> ---
> .../devicetree/bindings/thermal/qcom-tsens.yaml | 1 +
> arch/arm64/boot/dts/qcom/sdm630.dtsi | 11 +++++++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
> index d7be931b42d2..d89d5acd6e2a 100644
> --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
> +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
> @@ -39,6 +39,7 @@ properties:
> - qcom,msm8996-tsens
> - qcom,msm8998-tsens
> - qcom,sc7180-tsens
> + - qcom,sdm630-tsens
> - qcom,sdm845-tsens
> - const: qcom,tsens-v2
>
> diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qcom/sdm630.dtsi
> index ea85f28032d2..92bf4ae6a590 100644
> --- a/arch/arm64/boot/dts/qcom/sdm630.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi
> @@ -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>;
> + };
> +

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

> tcsr_mutex_regs: syscon@1f40000 {
> compatible = "syscon";
> reg = <0x01f40000 0x20000>;
> --
> 2.27.0
>

2020-06-24 15:06:12

by Konrad Dybcio

[permalink] [raw]
Subject: 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

2020-06-25 06:25:10

by Amit Kucheria

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

On Wed, Jun 24, 2020 at 8:32 PM Konrad Dybcio <[email protected]> wrote:
>
> 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