Skip to contentSkip to conversation

arm64: dts: sm8350: add support for Microsoft Surface Duo 2

PATCH RESEND Superseded Katherine Perez 3 participants 12 messages Nov 22, 2021 – Dec 8, 2021

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover arm64: dts: sm8350: add support for Microsoft Surface Duo 2

Add initial support for the Microsoft Surface Duo 2 based on the sm8350-mtp DT.

Katherine Perez (2):
arm64: dts: add minimal DTS for Microsoft Surface Duo2
arm64: dts: sm8350: fix tlmm base address

 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../qcom/sm8350-microsoft-surface-duo2.dts    | 363 ++++++++++++++++++
 arch/arm64/boot/dts/qcom/sm8350.dtsi          |   4 +-
 3 files changed, 366 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm64/boot/dts/qcom/sm8350-microsoft-surface-duo2.dts

--
2.31.1

#1 lore raw

PATCH v2 1/2 arm64: dts: add minimal DTS for Microsoft Surface Duo2

This is a minimal devicetree for Microsoft Surface Duo 2 with SM8350 Chipset

---

Changes since v1:
- Change remoteprocs firmware-naming scheme to qcom/sm8350/microsft/*
- Add chassis-type

 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../qcom/sm8350-microsoft-surface-duo2.dts    | 369 ++++++++++++++++++
 2 files changed, 370 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/sm8350-microsoft-surface-duo2.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 6b816eb33309..a8cc6bd3c423 100644
@@ -106,4 +106,5 @@ dtb-$(CONFIG_ARCH_QCOM)	+= sm8250-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8250-sony-xperia-edo-pdx203.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8250-sony-xperia-edo-pdx206.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8350-hdk.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= sm8350-microsoft-surface-duo2.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8350-mtp.dtb
arch/arm64/boot/dts/qcom/sm8350-microsoft-surface-duo2.dts new file +369 -0

369 lines not on this page · raw message

--
2.31.1

#2 lore raw

Re: [PATCH v2 1/2] arm64: dts: add minimal DTS for Microsoft Surface Duo2

Quoted 42 lines · Katherine Perez

This is a minimal devicetree for Microsoft Surface Duo 2 with SM8350 Chipset

---

Changes since v1:
- Change remoteprocs firmware-naming scheme to qcom/sm8350/microsft/*
- Add chassis-type

 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../qcom/sm8350-microsoft-surface-duo2.dts    | 369 ++++++++++++++++++
 2 files changed, 370 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/sm8350-microsoft-surface-duo2.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 6b816eb33309..a8cc6bd3c423 100644
@@ -106,4 +106,5 @@ dtb-$(CONFIG_ARCH_QCOM)	+= sm8250-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8250-sony-xperia-edo-pdx203.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8250-sony-xperia-edo-pdx206.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8350-hdk.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= sm8350-microsoft-surface-duo2.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8350-mtp.dtb
arch/arm64/boot/dts/qcom/sm8350-microsoft-surface-duo2.dts new file +11 -0
new file mode 100644
index 000000000000..d4963c9015cb
@@ -0,0 +1,369 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Copyright (C) 2021, Microsoft Corporation
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
+#include "sm8350.dtsi"
+#include "pm8350.dtsi"

arch/arm64/boot/dts/qcom/sm8350-microsoft-surface-duo2.dts line 21

Quoted 10 lines
arch/arm64/boot/dts/qcom/sm8350-microsoft-surface-duo2.dts new file +10 -0
+#include "pm8350b.dtsi"
+#include "pm8350c.dtsi"
+#include "pmk8350.dtsi"
+#include "pmr735a.dtsi"
+#include "pmr735b.dtsi"
+
+/ {
+	model = "Microsoft Surface Duo 2";
+	compatible = "microsoft,surface-duo2", "qcom,sm8350";
+	chassis-type = "handset";

This is interesting, I see it used at lot of place, unfortunately, it does not seem to be documented :(

Signature · 1 line
~Vinod
#3 lore raw

Re: [PATCH v2 1/2] arm64: dts: add minimal DTS for Microsoft Surface Duo2

Quoted 48 lines · Vinod Koul
Quoted 47 lines · Katherine Perez

This is a minimal devicetree for Microsoft Surface Duo 2 with SM8350 Chipset

---

Changes since v1:
- Change remoteprocs firmware-naming scheme to qcom/sm8350/microsft/*
- Add chassis-type

 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../qcom/sm8350-microsoft-surface-duo2.dts    | 369 ++++++++++++++++++
 2 files changed, 370 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/sm8350-microsoft-surface-duo2.dts
arch/arm64/boot/dts/qcom/Makefile +1 -0
index 6b816eb33309..a8cc6bd3c423 100644
@@ -106,4 +106,5 @@ dtb-$(CONFIG_ARCH_QCOM)	+= sm8250-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8250-sony-xperia-edo-pdx203.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8250-sony-xperia-edo-pdx206.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8350-hdk.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= sm8350-microsoft-surface-duo2.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= sm8350-mtp.dtb
arch/arm64/boot/dts/qcom/sm8350-microsoft-surface-duo2.dts new file +16 -0
new file mode 100644
index 000000000000..d4963c9015cb
@@ -0,0 +1,369 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Copyright (C) 2021, Microsoft Corporation
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
+#include "sm8350.dtsi"
+#include "pm8350.dtsi"
+#include "pm8350b.dtsi"
+#include "pm8350c.dtsi"
+#include "pmk8350.dtsi"
+#include "pmr735a.dtsi"
+#include "pmr735b.dtsi"
Quoted 11 lines

arch/arm64/boot/dts/qcom/sm8350-microsoft-surface-duo2.dts line 21

Quoted 5 lines
arch/arm64/boot/dts/qcom/sm8350-microsoft-surface-duo2.dts new file +5 -0
+
+/ {
+	model = "Microsoft Surface Duo 2";
+	compatible = "microsoft,surface-duo2", "qcom,sm8350";
+	chassis-type = "handset";

This is interesting, I see it used at lot of place, unfortunately, it does not seem to be documented :(

Signature · 1 line
~Vinod

Hi Vinod,

Looks like "chassis-type" is documented in the Devicetree Specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter3-devicenodes.html.

-Katherine

#4 lore raw

PATCH v2 2/2 arm64: dts: sm8350: fix tlmm base address

In reply to Katherine Perez

TLMM controller base address is incorrect and will hang on some platforms. Fix by giving the correct address.

---
 arch/arm64/boot/dts/qcom/sm8350.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +2 -2
index d134280e2939..624d294612d8 100644
@@ -960,9 +960,9 @@ spmi_bus: spmi@c440000 {
 			#interrupt-cells = <4>;
 		};
 
-		tlmm: pinctrl@f100000 {
+		tlmm: pinctrl@f000000 {
 			compatible = "qcom,sm8350-tlmm";
-			reg = <0 0x0f100000 0 0x300000>;
+			reg = <0 0x0f000000 0 0x300000>;
 			interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>;
 			gpio-controller;
 			#gpio-cells = <2>;
Signature · 1 line
2.31.1
Reviewed-by on v2 2/2
#5 lore raw

Re: [PATCH v2 2/2] arm64: dts: sm8350: fix tlmm base address

Quoted 2 lines · Katherine Perez

TLMM controller base address is incorrect and will hang on some platforms. Fix by giving the correct address.

Thanks, recheck the spec this looks correct. We should have tlmm reg space here and not tlmm base which also contains xpu region (thus hang)

Fixes b7e8f433a673 ("arm64: dts: qcom: Add basic devicetree support for SM8350 SoC")
Quoted 24 lines
---
 arch/arm64/boot/dts/qcom/sm8350.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +2 -2
index d134280e2939..624d294612d8 100644
@@ -960,9 +960,9 @@ spmi_bus: spmi@c440000 {
 			#interrupt-cells = <4>;
 		};
 
-		tlmm: pinctrl@f100000 {
+		tlmm: pinctrl@f000000 {
 			compatible = "qcom,sm8350-tlmm";
-			reg = <0 0x0f100000 0 0x300000>;
+			reg = <0 0x0f000000 0 0x300000>;
 			interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>;
 			gpio-controller;
 			#gpio-cells = <2>;
Signature · 1 line
2.31.1
Signature · 1 line
~Vinod
#6 lore raw

Re: [PATCH v2 2/2] arm64: dts: sm8350: fix tlmm base address

Quoted 7 lines · Vinod Koul
Quoted 2 lines · Katherine Perez

TLMM controller base address is incorrect and will hang on some platforms. Fix by giving the correct address.

Thanks, recheck the spec this looks correct. We should have tlmm reg space here and not tlmm base which also contains xpu region (thus hang)

Aren't you reading the patch backwards?

Afaict downstream the driver carries an offset of 0x100000, which we dropped as we upstreamed the driver. As such changing reg to 0x0f000000 should cause most gpio register accesses to fall outside the actual register window.

Or perhaps I'm missing something here?

Regards,
Bjorn

Quoted 30 lines
Fixes b7e8f433a673 ("arm64: dts: qcom: Add basic devicetree support for SM8350 SoC")
Quoted 24 lines
---
 arch/arm64/boot/dts/qcom/sm8350.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +2 -2
index d134280e2939..624d294612d8 100644
@@ -960,9 +960,9 @@ spmi_bus: spmi@c440000 {
 			#interrupt-cells = <4>;
 		};
 
-		tlmm: pinctrl@f100000 {
+		tlmm: pinctrl@f000000 {
 			compatible = "qcom,sm8350-tlmm";
-			reg = <0 0x0f100000 0 0x300000>;
+			reg = <0 0x0f000000 0 0x300000>;
 			interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>;
 			gpio-controller;
 			#gpio-cells = <2>;
Signature · 1 line
2.31.1
Signature · 1 line
~Vinod
#7 lore raw

Re: [PATCH v2 2/2] arm64: dts: sm8350: fix tlmm base address

Quoted 17 lines · Bjorn Andersson
Quoted 7 lines · Vinod Koul
Quoted 2 lines · Katherine Perez

TLMM controller base address is incorrect and will hang on some platforms. Fix by giving the correct address.

Thanks, recheck the spec this looks correct. We should have tlmm reg space here and not tlmm base which also contains xpu region (thus hang)

Aren't you reading the patch backwards?

Afaict downstream the driver carries an offset of 0x100000, which we dropped as we upstreamed the driver. As such changing reg to 0x0f000000 should cause most gpio register accesses to fall outside the actual register window.

Quoted 4 lines

Or perhaps I'm missing something here?

Regards,
Bjorn

Hi Vinod,

Gentle reminder about the response above. Without the change to the TLMM base address, my platform hangs. I have ensured that the pinctrl driver contains the patch that Bjorn has previously submitted here:
https://lore.kernel.org/all/[email protected]/

Best,
Katherine

Quoted 31 lines
Quoted 31 lines
Fixes b7e8f433a673 ("arm64: dts: qcom: Add basic devicetree support for SM8350 SoC")
Quoted 24 lines
---
 arch/arm64/boot/dts/qcom/sm8350.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +2 -2
index d134280e2939..624d294612d8 100644
@@ -960,9 +960,9 @@ spmi_bus: spmi@c440000 {
 			#interrupt-cells = <4>;
 		};
 
-		tlmm: pinctrl@f100000 {
+		tlmm: pinctrl@f000000 {
 			compatible = "qcom,sm8350-tlmm";
-			reg = <0 0x0f100000 0 0x300000>;
+			reg = <0 0x0f000000 0 0x300000>;
 			interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>;
 			gpio-controller;
 			#gpio-cells = <2>;
Signature · 1 line
2.31.1
Signature · 1 line
~Vinod
#8 lore raw

Re: [PATCH v2 2/2] arm64: dts: sm8350: fix tlmm base address

In reply to Bjorn Andersson
Quoted 11 lines · Bjorn Andersson
Quoted 7 lines · Vinod Koul
Quoted 2 lines · Katherine Perez

TLMM controller base address is incorrect and will hang on some platforms. Fix by giving the correct address.

Thanks, recheck the spec this looks correct. We should have tlmm reg space here and not tlmm base which also contains xpu region (thus hang)

Aren't you reading the patch backwards?

I guess :(

Quoted 6 lines

Afaict downstream the driver carries an offset of 0x100000, which we dropped as we upstreamed the driver. As such changing reg to 0x0f000000 should cause most gpio register accesses to fall outside the actual register window.

Or perhaps I'm missing something here?

I relooked and XPU is at 0xF000000 and Reg at 0xF100000 So this patch should be dropped as such. The size mentioned in documentation is also correct

Katherine, can you elaborate more on the hang you have observed? Any specific pins you use which causes this?

Signature · 1 line
~Vinod
#9 lore raw

Re: [PATCH v2 2/2] arm64: dts: sm8350: fix tlmm base address

Quoted 20 lines · Vinod Koul
Quoted 11 lines · Bjorn Andersson
Quoted 7 lines · Vinod Koul
Quoted 2 lines · Katherine Perez

TLMM controller base address is incorrect and will hang on some platforms. Fix by giving the correct address.

Thanks, recheck the spec this looks correct. We should have tlmm reg space here and not tlmm base which also contains xpu region (thus hang)

Aren't you reading the patch backwards?

I guess :(

Quoted 5 lines

Afaict downstream the driver carries an offset of 0x100000, which we dropped as we upstreamed the driver. As such changing reg to 0x0f000000 should cause most gpio register accesses to fall outside the actual register window.

Quoted 8 lines
Quoted 1 line

Or perhaps I'm missing something here?

I relooked and XPU is at 0xF000000 and Reg at 0xF100000 So this patch should be dropped as such. The size mentioned in documentation is also correct

Katherine, can you elaborate more on the hang you have observed? Any specific pins you use which causes this?

Hi Vinod,

Yes, it seems to hang in msm_pinctrl_probe. Specifically, line 734 in
gpiolib.c: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/gpiolib.c#n734.
On i=4, it hangs on assign_bit and the system goes into a reboot loop.
When I set the TLMM address to f000000, I don't see this issue at all.

Quoted 4 lines
Signature · 2 lines
-- 
~Vinod
#10 lore raw

Re: [PATCH v2 2/2] arm64: dts: sm8350: fix tlmm base address

Quoted 30 lines · Katherine Perez
Quoted 20 lines · Vinod Koul
Quoted 11 lines · Bjorn Andersson
Quoted 7 lines · Vinod Koul
Quoted 2 lines · Katherine Perez

TLMM controller base address is incorrect and will hang on some platforms. Fix by giving the correct address.

Thanks, recheck the spec this looks correct. We should have tlmm reg space here and not tlmm base which also contains xpu region (thus hang)

Aren't you reading the patch backwards?

I guess :(

Quoted 5 lines

Afaict downstream the driver carries an offset of 0x100000, which we dropped as we upstreamed the driver. As such changing reg to 0x0f000000 should cause most gpio register accesses to fall outside the actual register window.

Quoted 8 lines
Quoted 1 line

Or perhaps I'm missing something here?

I relooked and XPU is at 0xF000000 and Reg at 0xF100000 So this patch should be dropped as such. The size mentioned in documentation is also correct

Katherine, can you elaborate more on the hang you have observed? Any specific pins you use which causes this?

Quoted 7 lines

Hi Vinod,

Yes, it seems to hang in msm_pinctrl_probe. Specifically, line 734 in
gpiolib.c: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/gpiolib.c#n734.
On i=4, it hangs on assign_bit and the system goes into a reboot loop.
When I set the TLMM address to f000000, I don't see this issue at all.

The cause for that is quite likely that gc->get_direction() will read the configuration from gpio<i>'s registers and gpio4 in your system is reserved for use by some trusted application.

When you change the TLMM address you avoid this problem by just reading random registers outside the region that contains protected registers.

Adjust the gpio-reserved-ranges in your device's tlmm node to mark gpio4 (probably 4 pins long) as "invalid", gpiolib will then not touch them.

Regards,
Bjorn

Quoted 4 lines
Quoted 4 lines
Signature · 2 lines
-- 
~Vinod
#11 lore raw

Re: [PATCH v2 2/2] arm64: dts: sm8350: fix tlmm base address

Quoted 48 lines · Bjorn Andersson
Quoted 30 lines · Katherine Perez
Quoted 20 lines · Vinod Koul
Quoted 11 lines · Bjorn Andersson
Quoted 7 lines · Vinod Koul
Quoted 2 lines · Katherine Perez

TLMM controller base address is incorrect and will hang on some platforms. Fix by giving the correct address.

Thanks, recheck the spec this looks correct. We should have tlmm reg space here and not tlmm base which also contains xpu region (thus hang)

Aren't you reading the patch backwards?

I guess :(

Quoted 5 lines

Afaict downstream the driver carries an offset of 0x100000, which we dropped as we upstreamed the driver. As such changing reg to 0x0f000000 should cause most gpio register accesses to fall outside the actual register window.

Quoted 8 lines
Quoted 1 line

Or perhaps I'm missing something here?

I relooked and XPU is at 0xF000000 and Reg at 0xF100000 So this patch should be dropped as such. The size mentioned in documentation is also correct

Katherine, can you elaborate more on the hang you have observed? Any specific pins you use which causes this?

Quoted 7 lines

Hi Vinod,

Yes, it seems to hang in msm_pinctrl_probe. Specifically, line 734 in
gpiolib.c: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/gpiolib.c#n734.
On i=4, it hangs on assign_bit and the system goes into a reboot loop.
When I set the TLMM address to f000000, I don't see this issue at all.

The cause for that is quite likely that gc->get_direction() will read the configuration from gpio<i>'s registers and gpio4 in your system is reserved for use by some trusted application.

When you change the TLMM address you avoid this problem by just reading random registers outside the region that contains protected registers.

Quoted 5 lines

Adjust the gpio-reserved-ranges in your device's tlmm node to mark gpio4 (probably 4 pins long) as "invalid", gpiolib will then not touch them.

Regards,
Bjorn

Thanks, Bjorn. That makes sense. I'll resubmit with the changes to my device's TLMM node and will drop this patch.

-Katherine

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Signature · 2 lines
-- 
~Vinod