Skip to contentSkip to conversation

arm64: dts: qcom: sm8350-sagami: UFS

PATCH Applied Jan Paszkowski 4 participants 6 messages Sep 9 – Sep 18

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

cover arm64: dts: qcom: sm8350-sagami: UFS

This patch is about turning on the UFS for the sony xperia sagami platform.

The patch is small, but due to the grave risk of the patch combined with my inexperience I wanted to write this cover letter.

While digging through the reasons for the UFS bug in sony devices, I stumbled upon a downstream workaround in the initial commit for sm8250-sony-xperia devices [1]. The workaround did not mention the sagami platform. Looking through android patches for UFS for the sony sagami copyleft kernel, they seemed to be minor compared to previous generations[2].

With that I got a spare pdx215 to try this on. I compiled a kernel with postmarketOS tools. Normal flashing of pmOS on a single partition seemed to not work, though the UFS device was visible when booting on the sd card. That said both split flashing of pmOS onto two partitions and formating partitions worked, at least for super and userdata with ext4. The booted device detected the partitions and even worked without the sd card. With that I wanted to send it to the mailing lists in case the bug is gone this generation.

I guess that most likely I am missing something. If so please respond to this series. I am happy to test further to make sure it won't brick anybody's device.

[1] https://github.com/kholk/kernel/commit/2e7a9ee1c91a016baa0b826a7752ec45663a0561
[2] https://github.com/sonyxperiadev/kernel-copyleft/tree/61.0.A.11.xxx

Jan Paszkowski (1):
arm64: dts: qcom: sm8350-sony-xperia-sagami: enable UFS

 .../dts/qcom/sm8350-sony-xperia-sagami.dtsi     | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
Signature · 1 line
2.55.0
#1 lore raw

PATCH 1/1 arm64: dts: qcom: sm8350-sony-xperia-sagami: enable UFS

The UFS bug that haunted the Sony devices seems to be gone this generation. This patch enables it for the ability to use internal storage.

---
 .../dts/qcom/sm8350-sony-xperia-sagami.dtsi     | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi +14 -3
index 4b62ee50da7b..969c8cb31df9 100644
@@ -893,9 +893,20 @@ sdc2_card_det_sleep: sd-card-det-sleep-state {
 	};
 };
 
-/* BIG WARNING! DO NOT TOUCH UFS, YOUR DEVICE WILL DIE! */
-&ufs_mem_hc { status = "disabled"; };
-&ufs_mem_phy { status = "disabled"; };
+&ufs_mem_hc {
+	status = "okay";
+	reset-gpios = <&tlmm 203 GPIO_ACTIVE_LOW>;
+	vcc-supply = <&pm8350_l7>;
+	vcc-max-microamp = <800000>;
+	vccq-supply = <&pm8350_l9>;
+	vcc-max-microamp = <900000>;
+};
+
+&ufs_mem_phy {
+	status = "okay";
+	vdda-phy-supply = <&pm8350_l5>;
+	vdda-pll-supply = <&pm8350_l6>;
+};
 
 &usb_1 {
 	status = "okay";
Signature · 1 line
2.55.0
#2 lore raw

Re: [PATCH 1/1] arm64: dts: qcom: sm8350-sony-xperia-sagami: enable UFS

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Duplicate Device Tree property `vcc-max-microamp` overwrites the intended value and leaves…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Duplicate Device Tree property vcc-max-microamp overwrites the intended value and leaves vccq-max-microamp unconfigured. --

commit c3bcdc386d74df860f7d4d12d1aed983ad46ea5d
Author: Jan Paszkowski <[email protected]>

arm64: dts: qcom: sm8350-sony-xperia-sagami: enable UFS

This commit enables UFS on the sm8350-sony-xperia-sagami device, noting that previous device-killing bugs seem to be resolved.

Quoted 5 lines
arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi +0 -0
index 4b62ee50da7be..969c8cb31df9f 100644
@@ -893,9 +893,20 @@ sdc2_card_det_sleep: sd-card-det-sleep-state {

[ ... ]

arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi sdc2_card_det_sleep: sd-card-det-sleep-state { · line 902

Quoted 10 lines
arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi +7 -3
-/* BIG WARNING! DO NOT TOUCH UFS, YOUR DEVICE WILL DIE! */
-&ufs_mem_hc { status = "disabled"; };
-&ufs_mem_phy { status = "disabled"; };
+&ufs_mem_hc {
+	status = "okay";
+	reset-gpios = <&tlmm 203 GPIO_ACTIVE_LOW>;
+	vcc-supply = <&pm8350_l7>;
+	vcc-max-microamp = <800000>;
+	vccq-supply = <&pm8350_l9>;
+	vcc-max-microamp = <900000>;

[Severity: High]
Does this mistakenly define vcc-max-microamp twice instead of configuring vccq-max-microamp for the pm8350_l9 supply?

Because the property name is duplicated, the device tree compiler will overwrite the initial 800,000 uA value with 900,000 uA, leaving the vccq regulator without its intended maximum microamp constraint.

Given the history of UFS hardware issues mentioned in the commit message, could this unconfigured vccq regulator lead to system instability, boot failures, or hardware damage?

Quoted 7 lines
arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi +7 -0
+};
+
+&ufs_mem_phy {
+	status = "okay";
+	vdda-phy-supply = <&pm8350_l5>;
+	vdda-pll-supply = <&pm8350_l6>;
+};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

Re: [PATCH 1/1] arm64: dts: qcom: sm8350-sony-xperia-sagami: enable UFS

Quoted 35 lines · sashiko-bot

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Duplicate Device Tree property vcc-max-microamp overwrites the intended value and leaves vccq-max-microamp unconfigured. --

commit c3bcdc386d74df860f7d4d12d1aed983ad46ea5d
Author: Jan Paszkowski <[email protected]>

arm64: dts: qcom: sm8350-sony-xperia-sagami: enable UFS

This commit enables UFS on the sm8350-sony-xperia-sagami device, noting that previous device-killing bugs seem to be resolved.

Quoted 5 lines
arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi +0 -0
index 4b62ee50da7be..969c8cb31df9f 100644
@@ -893,9 +893,20 @@ sdc2_card_det_sleep: sd-card-det-sleep-state {

[ ... ]

arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi sdc2_card_det_sleep: sd-card-det-sleep-state { · line 902

Quoted 10 lines
arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi +7 -3
-/* BIG WARNING! DO NOT TOUCH UFS, YOUR DEVICE WILL DIE! */
-&ufs_mem_hc { status = "disabled"; };
-&ufs_mem_phy { status = "disabled"; };
+&ufs_mem_hc {
+	status = "okay";
+	reset-gpios = <&tlmm 203 GPIO_ACTIVE_LOW>;
+	vcc-supply = <&pm8350_l7>;
+	vcc-max-microamp = <800000>;
+	vccq-supply = <&pm8350_l9>;
+	vcc-max-microamp = <900000>;

[Severity: High]
Does this mistakenly define vcc-max-microamp twice instead of configuring vccq-max-microamp for the pm8350_l9 supply?

Quoted 8 lines

Because the property name is duplicated, the device tree compiler will overwrite the initial 800,000 uA value with 900,000 uA, leaving the vccq regulator without its intended maximum microamp constraint.

Given the history of UFS hardware issues mentioned in the commit message, could this unconfigured vccq regulator lead to system instability, boot failures, or hardware damage?

Yes, this is a typo in the sent patch. The patch I tested had vccq-max-microamp here. Sorry for that.

Quoted 7 lines
Quoted 7 lines
arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi +7 -0
+};
+
+&ufs_mem_phy {
+	status = "okay";
+	vdda-phy-supply = <&pm8350_l5>;
+	vdda-pll-supply = <&pm8350_l6>;
+};
Reviewed-by on v1 1/1
#4 lore raw

Re: [PATCH 1/1] arm64: dts: qcom: sm8350-sony-xperia-sagami: enable UFS

In reply to Jan Paszkowski
Quoted 14 lines · Jan Paszkowski

The UFS bug that haunted the Sony devices seems to be gone this generation. This patch enables it for the ability to use internal storage.

---
 .../dts/qcom/sm8350-sony-xperia-sagami.dtsi     | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi +0 -0
index 4b62ee50da7b..969c8cb31df9 100644

arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi sdc2_card_det_sleep: sd-card-det-sleep-state { · line 896

Quoted 4 lines
arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi +0 -1
@@ -893,9 +893,20 @@ sdc2_card_det_sleep: sd-card-det-sleep-state {
 	};
 };
 
-/* BIG WARNING! DO NOT TOUCH UFS, YOUR DEVICE WILL DIE! */

You were brave.

Signature · 2 lines
With best wishes
Dmitry
maintainer Applied
#5 lore raw

Re: (subset) [PATCH 0/1] arm64: dts: qcom: sm8350-sagami: UFS

In reply to Jan Paszkowski
Quoted 6 lines · Jan Paszkowski

This patch is about turning on the UFS for the sony xperia sagami platform.

The patch is small, but due to the grave risk of the patch combined with my inexperience I wanted to write this cover letter.

Quoted 8 lines

While digging through the reasons for the UFS bug in sony devices, I stumbled upon a downstream workaround in the initial commit for sm8250-sony-xperia devices [1]. The workaround did not mention the sagami platform. Looking through android patches for UFS for the sony sagami copyleft kernel, they seemed to be minor compared to previous generations[2].

[...]

Applied, thanks!

[1/1] arm64: dts: qcom: sm8350-sony-xperia-sagami: enable UFS

      commit: 8271e751016e30751a753916167d02b3fc27e8b2

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>