Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb8f3481 authored by Murali Nalajala's avatar Murali Nalajala
Browse files

cpuidle: lpm-levels: Save restore jtag registers for 8996



Jtag registers are lost when the CPUs are power collapsed.
Without save restore of these registers ETM tracing may
not work properly. Save restore jtag registers across CPU
power collapses.

Change-Id: If12105602fa0d1d6911077a29dfe3d870fec261f
Signed-off-by: default avatarMurali Nalajala <mnalajal@codeaurora.org>
parent 8cebd075
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -123,6 +123,8 @@ qcom,pm-cpu-levels.
	- qcom,psci-mode-mask: Same as cluster level fields.
	- qcom,psci-cpu-mode: ID to be passed into PSCI firmware.
	- qcom,cpu-is-reset: Whether CPU get reset are not.
	- qcom,jtag-save-restore: A boolean specifying jtag registers save and restore
	required are not.

[Example dts]

+3 −0
Original line number Diff line number Diff line
@@ -640,6 +640,9 @@ static int parse_cpu_levels(struct device_node *node, struct lpm_cluster *c)

		key = "qcom,cpu-is-reset";
		l->is_reset = of_property_read_bool(n, key);

		key = "qcom,jtag-save-restore";
		l->jtag_save_restore = of_property_read_bool(n, key);
	}
	return 0;
failed:
+17 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
#include <soc/qcom/rpm-notifier.h>
#include <soc/qcom/event_timer.h>
#include <soc/qcom/lpm-stats.h>
#include <soc/qcom/jtag.h>
#include <asm/cputype.h>
#include <asm/arch_timer.h>
#include <asm/cacheflush.h>
@@ -685,6 +686,8 @@ static inline void cpu_prepare(struct lpm_cluster *cluster, int cpu_index,
{
	struct lpm_cpu_level *cpu_level = &cluster->cpu->levels[cpu_index];
	unsigned int cpu = raw_smp_processor_id();
	bool jtag_save_restore =
			cluster->cpu->levels[cpu_index].jtag_save_restore;

	/* Use broadcast timer for aggregating sleep mode within a cluster.
	 * A broadcast timer could be used in the following scenarios
@@ -705,6 +708,12 @@ static inline void cpu_prepare(struct lpm_cluster *cluster, int cpu_index,
			MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)
			|| (cpu_level->is_reset)))
		cpu_pm_enter();

	/*
	 * Save JTAG registers for 8996v1.0 & 8996v2.x in C4 LPM
	 */
	if (jtag_save_restore)
		msm_jtag_save_state();
}

static inline void cpu_unprepare(struct lpm_cluster *cluster, int cpu_index,
@@ -712,6 +721,8 @@ static inline void cpu_unprepare(struct lpm_cluster *cluster, int cpu_index,
{
	struct lpm_cpu_level *cpu_level = &cluster->cpu->levels[cpu_index];
	unsigned int cpu = raw_smp_processor_id();
	bool jtag_save_restore =
			cluster->cpu->levels[cpu_index].jtag_save_restore;

	if (from_idle && (cpu_level->use_bc_timer ||
			(cpu_index >= cluster->min_child_level)))
@@ -722,6 +733,12 @@ static inline void cpu_unprepare(struct lpm_cluster *cluster, int cpu_index,
			MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)
		|| cpu_level->is_reset))
		cpu_pm_exit();

	/*
	 * Restore JTAG registers for 8996v1.0 & 8996v2.x in C4 LPM
	 */
	if (jtag_save_restore)
		msm_jtag_restore_state();
}

int get_cluster_id(struct lpm_cluster *cluster, int *aff_lvl)
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ struct lpm_cpu_level {
	struct power_params pwr;
	unsigned int psci_id;
	bool is_reset;
	bool jtag_save_restore;
};

struct lpm_cpu {