arm64: dts: qcom: sc7180: Split up TF-A related PSCI configuration
authorNikita Travkin <nikita@trvn.ru>
Tue, 8 Aug 2023 10:10:13 +0000 (15:10 +0500)
committerBjorn Andersson <andersson@kernel.org>
Mon, 14 Aug 2023 03:19:02 +0000 (20:19 -0700)
When initially submitted, the sc7180 support only targeted CROS devices
that make use of alternative TF-A firmware and not the official Qualcomm
firmware. The PSCI implementations in those firmwares differ however so
devices that use qcom firmware, like WoA laptops such as aspire1 need
different setup.

This commit adjusts the SoC dtsi to the OSI mode PSCI setup, common to
the Qualcomm firmware and introduces new sc7180-firmware-tfa.dtsi that
overrides the PSCI setup for the PC mode and uses TF-A specific
psci-suspend-param. This dtsi is added to all boards that appear to use
TF-A.

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
Link: https://lore.kernel.org/r/20230808-sc7180-tfa-fw-v1-1-666d5d8467e5@trvn.ru
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
arch/arm64/boot/dts/qcom/sc7180-firmware-tfa.dtsi [new file with mode: 0644]
arch/arm64/boot/dts/qcom/sc7180-idp.dts
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
arch/arm64/boot/dts/qcom/sc7180.dtsi

diff --git a/arch/arm64/boot/dts/qcom/sc7180-firmware-tfa.dtsi b/arch/arm64/boot/dts/qcom/sc7180-firmware-tfa.dtsi
new file mode 100644 (file)
index 0000000..ee35a45
--- /dev/null
@@ -0,0 +1,107 @@
+// SPDX-License-Identifier: BSD-3-Clause
+
+/*
+ * Devices that use SC7180 with TrustedFirmware-A
+ * need PSCI PC mode instead of the OSI mode provided
+ * by Qualcomm firmware.
+ */
+
+&CPU0 {
+       /delete-property/ power-domains;
+       /delete-property/ power-domain-names;
+
+       cpu-idle-states = <&LITTLE_CPU_SLEEP_0
+                          &LITTLE_CPU_SLEEP_1
+                          &CLUSTER_SLEEP_0>;
+};
+
+&CPU1 {
+       /delete-property/ power-domains;
+       /delete-property/ power-domain-names;
+
+       cpu-idle-states = <&LITTLE_CPU_SLEEP_0
+                          &LITTLE_CPU_SLEEP_1
+                          &CLUSTER_SLEEP_0>;
+};
+
+&CPU2 {
+       /delete-property/ power-domains;
+       /delete-property/ power-domain-names;
+
+       cpu-idle-states = <&LITTLE_CPU_SLEEP_0
+                          &LITTLE_CPU_SLEEP_1
+                          &CLUSTER_SLEEP_0>;
+};
+
+&CPU3 {
+       /delete-property/ power-domains;
+       /delete-property/ power-domain-names;
+
+       cpu-idle-states = <&LITTLE_CPU_SLEEP_0
+                          &LITTLE_CPU_SLEEP_1
+                          &CLUSTER_SLEEP_0>;
+};
+
+&CPU4 {
+       /delete-property/ power-domains;
+       /delete-property/ power-domain-names;
+
+       cpu-idle-states = <&LITTLE_CPU_SLEEP_0
+                          &LITTLE_CPU_SLEEP_1
+                          &CLUSTER_SLEEP_0>;
+};
+
+&CPU5 {
+       /delete-property/ power-domains;
+       /delete-property/ power-domain-names;
+
+       cpu-idle-states = <&LITTLE_CPU_SLEEP_0
+                          &LITTLE_CPU_SLEEP_1
+                          &CLUSTER_SLEEP_0>;
+};
+
+&CPU6 {
+       /delete-property/ power-domains;
+       /delete-property/ power-domain-names;
+
+       cpu-idle-states = <&BIG_CPU_SLEEP_0
+                          &BIG_CPU_SLEEP_1
+                          &CLUSTER_SLEEP_0>;
+};
+
+&CPU7 {
+       /delete-property/ power-domains;
+       /delete-property/ power-domain-names;
+
+       cpu-idle-states = <&BIG_CPU_SLEEP_0
+                          &BIG_CPU_SLEEP_1
+                          &CLUSTER_SLEEP_0>;
+};
+
+/delete-node/ &domain_idle_states;
+
+&idle_states {
+       CLUSTER_SLEEP_0: cluster-sleep-0 {
+               compatible = "arm,idle-state";
+               idle-state-name = "cluster-power-down";
+               arm,psci-suspend-param = <0x40003444>;
+               entry-latency-us = <3263>;
+               exit-latency-us = <6562>;
+               min-residency-us = <9926>;
+               local-timer-stop;
+       };
+};
+
+/delete-node/ &CPU_PD0;
+/delete-node/ &CPU_PD1;
+/delete-node/ &CPU_PD2;
+/delete-node/ &CPU_PD3;
+/delete-node/ &CPU_PD4;
+/delete-node/ &CPU_PD5;
+/delete-node/ &CPU_PD6;
+/delete-node/ &CPU_PD7;
+/delete-node/ &CLUSTER_PD;
+
+&apps_rsc {
+       /delete-property/ power-domains;
+};
index a1c50be..0146fb0 100644 (file)
@@ -11,6 +11,7 @@
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
 #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
 #include "sc7180.dtsi"
+#include "sc7180-firmware-tfa.dtsi"
 #include "pm6150.dtsi"
 #include "pm6150l.dtsi"
 
index af16e36..5a33e16 100644 (file)
@@ -13,6 +13,7 @@
 #include <dt-bindings/sound/sc7180-lpass.h>
 
 #include "sc7180.dtsi"
+#include "sc7180-firmware-tfa.dtsi"
 /* PMICs depend on spmi_bus label and so must come after sc7180.dtsi */
 #include "pm6150.dtsi"
 #include "pm6150l.dtsi"
index 9af94e2..a79c0f2 100644 (file)
@@ -79,9 +79,8 @@
                        reg = <0x0 0x0>;
                        clocks = <&cpufreq_hw 0>;
                        enable-method = "psci";
-                       cpu-idle-states = <&LITTLE_CPU_SLEEP_0
-                                          &LITTLE_CPU_SLEEP_1
-                                          &CLUSTER_SLEEP_0>;
+                       power-domains = <&CPU_PD0>;
+                       power-domain-names = "psci";
                        capacity-dmips-mhz = <415>;
                        dynamic-power-coefficient = <137>;
                        operating-points-v2 = <&cpu0_opp_table>;
                        reg = <0x0 0x100>;
                        clocks = <&cpufreq_hw 0>;
                        enable-method = "psci";
-                       cpu-idle-states = <&LITTLE_CPU_SLEEP_0
-                                          &LITTLE_CPU_SLEEP_1
-                                          &CLUSTER_SLEEP_0>;
+                       power-domains = <&CPU_PD1>;
+                       power-domain-names = "psci";
                        capacity-dmips-mhz = <415>;
                        dynamic-power-coefficient = <137>;
                        next-level-cache = <&L2_100>;
                        reg = <0x0 0x200>;
                        clocks = <&cpufreq_hw 0>;
                        enable-method = "psci";
-                       cpu-idle-states = <&LITTLE_CPU_SLEEP_0
-                                          &LITTLE_CPU_SLEEP_1
-                                          &CLUSTER_SLEEP_0>;
+                       power-domains = <&CPU_PD2>;
+                       power-domain-names = "psci";
                        capacity-dmips-mhz = <415>;
                        dynamic-power-coefficient = <137>;
                        next-level-cache = <&L2_200>;
                        reg = <0x0 0x300>;
                        clocks = <&cpufreq_hw 0>;
                        enable-method = "psci";
-                       cpu-idle-states = <&LITTLE_CPU_SLEEP_0
-                                          &LITTLE_CPU_SLEEP_1
-                                          &CLUSTER_SLEEP_0>;
+                       power-domains = <&CPU_PD3>;
+                       power-domain-names = "psci";
                        capacity-dmips-mhz = <415>;
                        dynamic-power-coefficient = <137>;
                        next-level-cache = <&L2_300>;
                        reg = <0x0 0x400>;
                        clocks = <&cpufreq_hw 0>;
                        enable-method = "psci";
-                       cpu-idle-states = <&LITTLE_CPU_SLEEP_0
-                                          &LITTLE_CPU_SLEEP_1
-                                          &CLUSTER_SLEEP_0>;
+                       power-domains = <&CPU_PD4>;
+                       power-domain-names = "psci";
                        capacity-dmips-mhz = <415>;
                        dynamic-power-coefficient = <137>;
                        next-level-cache = <&L2_400>;
                        reg = <0x0 0x500>;
                        clocks = <&cpufreq_hw 0>;
                        enable-method = "psci";
-                       cpu-idle-states = <&LITTLE_CPU_SLEEP_0
-                                          &LITTLE_CPU_SLEEP_1
-                                          &CLUSTER_SLEEP_0>;
+                       power-domains = <&CPU_PD5>;
+                       power-domain-names = "psci";
                        capacity-dmips-mhz = <415>;
                        dynamic-power-coefficient = <137>;
                        next-level-cache = <&L2_500>;
                        reg = <0x0 0x600>;
                        clocks = <&cpufreq_hw 1>;
                        enable-method = "psci";
-                       cpu-idle-states = <&BIG_CPU_SLEEP_0
-                                          &BIG_CPU_SLEEP_1
-                                          &CLUSTER_SLEEP_0>;
+                       power-domains = <&CPU_PD6>;
+                       power-domain-names = "psci";
                        capacity-dmips-mhz = <1024>;
                        dynamic-power-coefficient = <480>;
                        next-level-cache = <&L2_600>;
                        reg = <0x0 0x700>;
                        clocks = <&cpufreq_hw 1>;
                        enable-method = "psci";
-                       cpu-idle-states = <&BIG_CPU_SLEEP_0
-                                          &BIG_CPU_SLEEP_1
-                                          &CLUSTER_SLEEP_0>;
+                       power-domains = <&CPU_PD7>;
+                       power-domain-names = "psci";
                        capacity-dmips-mhz = <1024>;
                        dynamic-power-coefficient = <480>;
                        next-level-cache = <&L2_700>;
                        };
                };
 
-               idle-states {
+               idle_states: idle-states {
                        entry-method = "psci";
 
                        LITTLE_CPU_SLEEP_0: cpu-sleep-0-0 {
                                min-residency-us = <5555>;
                                local-timer-stop;
                        };
+               };
 
-                       CLUSTER_SLEEP_0: cluster-sleep-0 {
-                               compatible = "arm,idle-state";
+               domain_idle_states: domain-idle-states {
+                       CLUSTER_SLEEP_PC: cluster-sleep-0 {
+                               compatible = "domain-idle-state";
+                               idle-state-name = "cluster-l3-power-collapse";
+                               arm,psci-suspend-param = <0x41000044>;
+                               entry-latency-us = <2752>;
+                               exit-latency-us = <3048>;
+                               min-residency-us = <6118>;
+                       };
+
+                       CLUSTER_SLEEP_CX_RET: cluster-sleep-1 {
+                               compatible = "domain-idle-state";
+                               idle-state-name = "cluster-cx-retention";
+                               arm,psci-suspend-param = <0x41001244>;
+                               entry-latency-us = <3638>;
+                               exit-latency-us = <4562>;
+                               min-residency-us = <8467>;
+                       };
+
+                       CLUSTER_AOSS_SLEEP: cluster-sleep-2 {
+                               compatible = "domain-idle-state";
                                idle-state-name = "cluster-power-down";
-                               arm,psci-suspend-param = <0x40003444>;
+                               arm,psci-suspend-param = <0x4100b244>;
                                entry-latency-us = <3263>;
                                exit-latency-us = <6562>;
-                               min-residency-us = <9926>;
-                               local-timer-stop;
+                               min-residency-us = <9826>;
                        };
                };
        };
        psci {
                compatible = "arm,psci-1.0";
                method = "smc";
+
+               CPU_PD0: cpu0 {
+                       #power-domain-cells = <0>;
+                       power-domains = <&CLUSTER_PD>;
+                       domain-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1>;
+               };
+
+               CPU_PD1: cpu1 {
+                       #power-domain-cells = <0>;
+                       power-domains = <&CLUSTER_PD>;
+                       domain-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1>;
+               };
+
+               CPU_PD2: cpu2 {
+                       #power-domain-cells = <0>;
+                       power-domains = <&CLUSTER_PD>;
+                       domain-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1>;
+               };
+
+               CPU_PD3: cpu3 {
+                       #power-domain-cells = <0>;
+                       power-domains = <&CLUSTER_PD>;
+                       domain-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1>;
+               };
+
+               CPU_PD4: cpu4 {
+                       #power-domain-cells = <0>;
+                       power-domains = <&CLUSTER_PD>;
+                       domain-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1>;
+               };
+
+               CPU_PD5: cpu5 {
+                       #power-domain-cells = <0>;
+                       power-domains = <&CLUSTER_PD>;
+                       domain-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1>;
+               };
+
+               CPU_PD6: cpu6 {
+                       #power-domain-cells = <0>;
+                       power-domains = <&CLUSTER_PD>;
+                       domain-idle-states = <&BIG_CPU_SLEEP_0 &BIG_CPU_SLEEP_1>;
+               };
+
+               CPU_PD7: cpu7 {
+                       #power-domain-cells = <0>;
+                       power-domains = <&CLUSTER_PD>;
+                       domain-idle-states = <&BIG_CPU_SLEEP_0 &BIG_CPU_SLEEP_1>;
+               };
+
+               CLUSTER_PD: cpu-cluster0 {
+                       #power-domain-cells = <0>;
+                       domain-idle-states = <&CLUSTER_SLEEP_PC
+                                             &CLUSTER_SLEEP_CX_RET
+                                             &CLUSTER_AOSS_SLEEP>;
+               };
        };
 
        reserved_memory: reserved-memory {
                                          <SLEEP_TCS   3>,
                                          <WAKE_TCS    3>,
                                          <CONTROL_TCS 1>;
+                       power-domains = <&CLUSTER_PD>;
 
                        rpmhcc: clock-controller {
                                compatible = "qcom,sc7180-rpmh-clk";