Commit 4fb40b22 authored by Nikita Travkin's avatar Nikita Travkin Committed by Bjorn Andersson
Browse files

arm64: dts: qcom: sc7180: Split up TF-A related PSCI configuration



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: default avatarNikita Travkin <nikita@trvn.ru>
Link: https://lore.kernel.org/r/20230808-sc7180-tfa-fw-v1-1-666d5d8467e5@trvn.ru


Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
parent 1c63dd1c
Loading
Loading
Loading
Loading
+107 −0
Original line number Diff line number Diff line
// 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;
};
+1 −0
Original line number Diff line number Diff line
@@ -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"

+1 −0
Original line number Diff line number Diff line
@@ -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"
+97 −30
Original line number Diff line number Diff line
@@ -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>;
@@ -109,9 +108,8 @@
			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>;
@@ -134,9 +132,8 @@
			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>;
@@ -159,9 +156,8 @@
			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>;
@@ -184,9 +180,8 @@
			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>;
@@ -209,9 +204,8 @@
			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>;
@@ -234,9 +228,8 @@
			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>;
@@ -259,9 +252,8 @@
			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>;
@@ -314,7 +306,7 @@
			};
		};

		idle-states {
		idle_states: idle-states {
			entry-method = "psci";

			LITTLE_CPU_SLEEP_0: cpu-sleep-0-0 {
@@ -356,15 +348,34 @@
				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>;
			};
		};
	};
@@ -567,6 +578,61 @@
	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 {
@@ -3597,6 +3663,7 @@
					  <SLEEP_TCS   3>,
					  <WAKE_TCS    3>,
					  <CONTROL_TCS 1>;
			power-domains = <&CLUSTER_PD>;

			rpmhcc: clock-controller {
				compatible = "qcom,sc7180-rpmh-clk";