From ccb665aa2bf3255f903bc5afb508a7e88f748e78 Mon Sep 17 00:00:00 2001 From: Raghavendra Kakarla Date: Mon, 31 Aug 2020 14:37:26 +0530 Subject: [PATCH] drivers: lpm-levels: Update the RIMPS register pasring from DT This patch adds the logic to get the RIMPS address with passing domain name and stores the rimps address to lpm_cpu structure so that it can access from the last core of corresponding cluster domain going to rail-pc to program the RIMPS timer value. Change-Id: I90418d280440e3f26615583454116c01cec04126 Signed-off-by: Raghavendra Kakarla --- drivers/cpuidle/lpm-levels-of.c | 16 ++++++++++++++-- drivers/cpuidle/lpm-levels.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/cpuidle/lpm-levels-of.c b/drivers/cpuidle/lpm-levels-of.c index db77b020c4a2..28cf6c6a3791 100644 --- a/drivers/cpuidle/lpm-levels-of.c +++ b/drivers/cpuidle/lpm-levels-of.c @@ -549,6 +549,7 @@ static int parse_cpu_levels(struct device_node *dn, struct lpm_cluster *c) cpu->parent = c; + of_property_read_string(dn, "label", &cpu->domain_name); ret = lpm_of_read_u32(dn, "qcom,psci-mode-shift", &cpu->psci_mode_shift, true); if (ret) @@ -696,7 +697,7 @@ static void add_rimps_tmr_register(struct device_node *dn, { struct lpm_cpu *lpm_cpu; uint32_t rimps_threshold = 0; - static uint32_t i; + uint32_t index; if (list_empty(&cl->cpu)) { struct lpm_cluster *n; @@ -708,7 +709,18 @@ static void add_rimps_tmr_register(struct device_node *dn, list_for_each_entry(lpm_cpu, &cl->cpu, list) { int idx = lpm_cpu->nlevels-1; - lpm_cpu->rimps_tmr_base = of_iomap(dn, i++); + if (!lpm_cpu->domain_name) { + pr_debug("cpu domain name not found\n"); + return; + } + + index = of_property_match_string(dn, "reg-names", lpm_cpu->domain_name); + if (index < 0) { + pr_debug("reg name field not found for %s\n", lpm_cpu->domain_name); + return; + } + + lpm_cpu->rimps_tmr_base = of_iomap(dn, index); if (!lpm_cpu->rimps_tmr_base) { pr_debug("Unable to get rimps base address\n"); return; diff --git a/drivers/cpuidle/lpm-levels.h b/drivers/cpuidle/lpm-levels.h index e0f844b10cee..5b4fa93f1632 100644 --- a/drivers/cpuidle/lpm-levels.h +++ b/drivers/cpuidle/lpm-levels.h @@ -56,6 +56,7 @@ struct lpm_cpu { struct cpumask related_cpus; struct lpm_cpu_level levels[NR_LPM_LEVELS]; int nlevels; + const char *domain_name; unsigned int psci_mode_shift; unsigned int psci_mode_mask; uint32_t ref_stddev;