Skip to content

Commit 6b612d1

Browse files
DhruvaG2000vireshk
authored andcommitted
cpufreq: ti-cpufreq: Use socinfo to get revision in AM62 family
In the AM62x, AM62Ax, and AM62Px devices, we already have the revision info within the k3-socinfo driver. Hence, re-use this information from there instead of re using the offset for 2 drivers trying to get the same information ie. revision. Signed-off-by: Dhruva Gole <[email protected]> Signed-off-by: Viresh Kumar <[email protected]>
1 parent 87fa4bd commit 6b612d1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

drivers/cpufreq/ti-cpufreq.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/pm_opp.h>
1717
#include <linux/regmap.h>
1818
#include <linux/slab.h>
19+
#include <linux/sys_soc.h>
1920

2021
#define REVISION_MASK 0xF
2122
#define REVISION_SHIFT 28
@@ -303,6 +304,13 @@ static struct ti_cpufreq_soc_data am3517_soc_data = {
303304
.quirks = TI_QUIRK_SYSCON_MAY_BE_MISSING,
304305
};
305306

307+
static const struct soc_device_attribute k3_cpufreq_soc[] = {
308+
{ .family = "AM62X", .revision = "SR1.0" },
309+
{ .family = "AM62AX", .revision = "SR1.0" },
310+
{ .family = "AM62PX", .revision = "SR1.0" },
311+
{ /* sentinel */ }
312+
};
313+
306314
static struct ti_cpufreq_soc_data am625_soc_data = {
307315
.efuse_xlate = am625_efuse_xlate,
308316
.efuse_offset = 0x0018,
@@ -384,6 +392,16 @@ static int ti_cpufreq_get_rev(struct ti_cpufreq_data *opp_data,
384392
struct device *dev = opp_data->cpu_dev;
385393
u32 revision;
386394
int ret;
395+
if (soc_device_match(k3_cpufreq_soc)) {
396+
/*
397+
* Since the SR is 1.0, hard code the revision_value as
398+
* 0x1 here. This way we avoid re using the same register
399+
* that is giving us required information inside socinfo
400+
* anyway.
401+
*/
402+
*revision_value = 0x1;
403+
goto done;
404+
}
387405

388406
ret = regmap_read(opp_data->syscon, opp_data->soc_data->rev_offset,
389407
&revision);
@@ -406,6 +424,7 @@ static int ti_cpufreq_get_rev(struct ti_cpufreq_data *opp_data,
406424

407425
*revision_value = BIT((revision >> REVISION_SHIFT) & REVISION_MASK);
408426

427+
done:
409428
return 0;
410429
}
411430

0 commit comments

Comments
 (0)