Skip to content

Commit ed2b44b

Browse files
taniyadas20Komal-Bajaj
authored andcommitted
cpufreq: qcom-cpufreq-hw: Add RIMPS based cpufreq support for Shikra SoC
The Qualcomm Shikra SoCs uses the RIMPS based hardware for cpufreq scaling. Introduce rimps_soc_data, which reuses the existing EPSS configurations, and accounts for the maximum LUT entries to 12 as per RIMPS hardware. Signed-off-by: Taniya Das <taniya.das@oss.qualcomm.com>
1 parent d2d3b96 commit ed2b44b

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

drivers/cpufreq/qcom-cpufreq-hw.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/*
33
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
4+
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
45
*/
56

67
#include <linux/bitfield.h>
@@ -40,6 +41,7 @@ struct qcom_cpufreq_soc_data {
4041
u32 reg_intr_clr;
4142
u32 reg_current_vote;
4243
u32 reg_perf_state;
44+
u32 lut_max_entries;
4345
u8 lut_row_size;
4446
};
4547

@@ -156,7 +158,7 @@ static unsigned int qcom_cpufreq_get_freq(struct cpufreq_policy *policy)
156158
soc_data = qcom_cpufreq.soc_data;
157159

158160
index = readl_relaxed(data->base + soc_data->reg_perf_state);
159-
index = min(index, LUT_MAX_ENTRIES - 1);
161+
index = min(index, soc_data->lut_max_entries - 1);
160162

161163
return policy->freq_table[index].frequency;
162164
}
@@ -211,7 +213,7 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
211213
struct qcom_cpufreq_data *drv_data = policy->driver_data;
212214
const struct qcom_cpufreq_soc_data *soc_data = qcom_cpufreq.soc_data;
213215

214-
table = kzalloc_objs(*table, LUT_MAX_ENTRIES + 1);
216+
table = kzalloc_objs(*table, soc_data->lut_max_entries + 1);
215217
if (!table)
216218
return -ENOMEM;
217219

@@ -236,7 +238,7 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
236238
icc_scaling_enabled = false;
237239
}
238240

239-
for (i = 0; i < LUT_MAX_ENTRIES; i++) {
241+
for (i = 0; i < soc_data->lut_max_entries; i++) {
240242
data = readl_relaxed(drv_data->base + soc_data->reg_freq_lut +
241243
i * soc_data->lut_row_size);
242244
src = FIELD_GET(LUT_SRC, data);
@@ -405,6 +407,7 @@ static const struct qcom_cpufreq_soc_data qcom_soc_data = {
405407
.reg_current_vote = 0x704,
406408
.reg_perf_state = 0x920,
407409
.lut_row_size = 32,
410+
.lut_max_entries = LUT_MAX_ENTRIES,
408411
};
409412

410413
static const struct qcom_cpufreq_soc_data epss_soc_data = {
@@ -416,11 +419,25 @@ static const struct qcom_cpufreq_soc_data epss_soc_data = {
416419
.reg_intr_clr = 0x308,
417420
.reg_perf_state = 0x320,
418421
.lut_row_size = 4,
422+
.lut_max_entries = LUT_MAX_ENTRIES,
423+
};
424+
425+
static const struct qcom_cpufreq_soc_data rimps_soc_data = {
426+
.reg_enable = 0x0,
427+
.reg_domain_state = 0x20,
428+
.reg_dcvs_ctrl = 0xb0,
429+
.reg_freq_lut = 0x100,
430+
.reg_volt_lut = 0x200,
431+
.reg_intr_clr = 0x308,
432+
.reg_perf_state = 0x320,
433+
.lut_row_size = 4,
434+
.lut_max_entries = 12,
419435
};
420436

421437
static const struct of_device_id qcom_cpufreq_hw_match[] = {
422438
{ .compatible = "qcom,cpufreq-hw", .data = &qcom_soc_data },
423439
{ .compatible = "qcom,cpufreq-epss", .data = &epss_soc_data },
440+
{ .compatible = "qcom,cpufreq-rimps", .data = &rimps_soc_data },
424441
{}
425442
};
426443
MODULE_DEVICE_TABLE(of, qcom_cpufreq_hw_match);

0 commit comments

Comments
 (0)