sonyxperiadev / bug_tracker

Empty repository that is used as a bugtracker for Open Devices project
52 stars 13 forks source link

[Tama][XZ3] SDM845 PostmarketOS on mailine kernel Dreaded UFS support #802

Open phodina opened 1 year ago

phodina commented 1 year ago

Hi, since the display panel is working on the SDM845 akatsuki device it's time to start investigating the possibility of testing the UFS patches.

https://github.com/sonyxperiadev/bug_tracker/issues/799

Any ideas for checklist what to do before attempting that? Also what logs might be of interest for the test? How to get/store them? SD card or Ethernet over USB?

phodina commented 1 year ago

CC: @bartcubbins @kholk

phodina commented 1 year ago

Btw is this issue also present on the MediaTek devices? I know it's highlighted on devices running Qualcomm chipsets.

phodina commented 1 year ago

So I managed to get my hands on akari phone and working PostmarketOS build there - mainline kernel.

Are there any ideas what to do next?

bartcubbins commented 1 year ago

The issue is present on all OEMs with similar memory chips. You can look at the quirks in the SODP kernel, but as it is, it will never lands on the mainline. Also you have to be extremely careful, because only one write cycle and your memory will be purged (sort of). UFS_DEVICE_QUIRK_NO_PURGE and UFS_DEVICE_QUIRK_EXTEND_SYNC_LENGTH are the first places to look.

But I will warn you again, if you don’t know what you are doing, then you should keep away from flashing the kernel with the UFS driver enabled, otherwise it will simply turn your device into garbage

phodina commented 1 year ago

@bartcubbins thanks, I've started to look at the UFS driver and went over the patch made by @kholk.

I don't intend to flash the mainline to the device yet just gather enough so it might be worth trying.

Would it be of any use to trace the Android driver or is it enough to just stick with the source code and check for any deviations?

In order to use the UFS I'll have to use similar code, right?

--- a/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi
@@ -785,9 +785,20 @@ &uart9 {
        status = "okay";
 };

-/* 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 150 GPIO_ACTIVE_LOW>;
+
+       vcc-supply = <&vreg_l20a_2p95>;
+       vcc-max-microamp = <600000>;
+};
+
+&ufs_mem_phy {
+       status = "okay";
+       vdda-phy-supply = <&vreg_l1a_0p875>;
+       vdda-pll-supply = <&vreg_l26a_1p2>;
+};