Skip to content

Commit b8b76f3

Browse files
committed
cpufreq: Correct fixup for M2 devices
Signed-off-by: Hector Martin <[email protected]>
1 parent a81314f commit b8b76f3

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

src/cpufreq.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
#define CLUSTER_PSTATE_BUSY BIT(31)
1313
#define CLUSTER_PSTATE_SET BIT(25)
14-
#define CLUSTER_PSTATE_UNK BIT(20)
14+
#define CLUSTER_PSTATE_UNK_M2 BIT(22)
15+
#define CLUSTER_PSTATE_UNK_M1 BIT(20)
1516
#define CLUSTER_PSTATE_DESIRED2 GENMASK(16, 12)
1617
#define CLUSTER_PSTATE_DESIRED1 GENMASK(4, 0)
1718

@@ -62,13 +63,26 @@ void cpufreq_fixup_cluster(const struct cluster_t *cluster)
6263
{
6364
u64 val = read64(cluster->base + CLUSTER_PSTATE);
6465

65-
// Older versions of m1n1 stage 1 erroneously cleared CLUSTER_PSTATE_UNK, so put it back for
66+
// Older versions of m1n1 stage 1 erroneously cleared CLUSTER_PSTATE_UNK_Mx, so put it back for
6667
// firmwares it supported (don't touch anything newer, which includes newer devices).
6768
// Also clear the CLUSTER_PSTATE_DESIRED2 field since it doesn't seem to do anything, and isn't
6869
// used on newer chips.
6970
if (os_firmware.version != V_UNKNOWN && os_firmware.version <= V13_3) {
70-
if (!(val & CLUSTER_PSTATE_UNK) || (val & CLUSTER_PSTATE_DESIRED2)) {
71-
val |= CLUSTER_PSTATE_UNK;
71+
u64 bits = 0;
72+
switch (chip_id) {
73+
case T8103:
74+
case T6000 ... T6002:
75+
bits = CLUSTER_PSTATE_UNK_M1;
76+
break;
77+
case T8112:
78+
case T6020 ... T6021:
79+
bits = CLUSTER_PSTATE_UNK_M2;
80+
break;
81+
default:
82+
return;
83+
}
84+
if (!(val & bits) || (val & CLUSTER_PSTATE_DESIRED2)) {
85+
val |= bits;
7286
val &= ~CLUSTER_PSTATE_DESIRED2;
7387
printf("cpufreq: Correcting setting for cluster %s\n", cluster->name);
7488
write64(cluster->base + CLUSTER_PSTATE, val);

0 commit comments

Comments
 (0)