cpufreq: Fix a dumb bug and drop the DESIRED2 field

I don't think that field ever did anything and Apple don't set it on
newer macOS/SoCs. Also expand DESIRED1 to T602x width.

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2023-04-18 02:40:34 +09:00
parent b2a479f1bf
commit 145d39092f

View file

@ -10,8 +10,7 @@
#define CLUSTER_PSTATE_BUSY BIT(31)
#define CLUSTER_PSTATE_SET BIT(25)
#define CLUSTER_PSTATE_DESIRED2 GENMASK(15, 12)
#define CLUSTER_PSTATE_DESIRED1 GENMASK(3, 0)
#define CLUSTER_PSTATE_DESIRED1 GENMASK(4, 0)
#define CLUSTER_CONFIG_ENABLE BIT(63)
#define CLUSTER_CONFIG_DVMR1 BIT(32)
@ -41,9 +40,8 @@ int cpufreq_init_cluster(const struct cluster_t *cluster)
val = read64(cluster->base + CLUSTER_PSTATE);
if (FIELD_GET(CLUSTER_PSTATE_DESIRED1, val) != cluster->boot_pstate) {
val &= CLUSTER_PSTATE_DESIRED1 | CLUSTER_PSTATE_DESIRED2;
val |= CLUSTER_PSTATE_SET | FIELD_PREP(CLUSTER_PSTATE_DESIRED1, cluster->boot_pstate) |
FIELD_PREP(CLUSTER_PSTATE_DESIRED2, cluster->boot_pstate);
val &= ~CLUSTER_PSTATE_DESIRED1;
val |= CLUSTER_PSTATE_SET | FIELD_PREP(CLUSTER_PSTATE_DESIRED1, cluster->boot_pstate);
printf("cpufreq: Switching cluster %s to P-State %d\n", cluster->name,
cluster->boot_pstate);
write64(cluster->base + CLUSTER_PSTATE, val);