25
25
#define APPLE_DVFS_CMD 0x20
26
26
#define APPLE_DVFS_CMD_BUSY BIT(31)
27
27
#define APPLE_DVFS_CMD_SET BIT(25)
28
- #define APPLE_DVFS_CMD_PS2 GENMASK(16 , 12)
28
+ #define APPLE_DVFS_CMD_PS2 GENMASK(15 , 12)
29
29
#define APPLE_DVFS_CMD_PS1 GENMASK(4, 0)
30
30
31
31
/* Same timebase as CPU counter (24MHz) */
55
55
#define APPLE_DVFS_TRANSITION_TIMEOUT 100
56
56
57
57
struct apple_soc_cpufreq_info {
58
+ bool has_ps2 ;
58
59
u64 max_pstate ;
59
60
u64 cur_pstate_mask ;
60
61
u64 cur_pstate_shift ;
@@ -69,18 +70,21 @@ struct apple_cpu_priv {
69
70
static struct cpufreq_driver apple_soc_cpufreq_driver ;
70
71
71
72
static const struct apple_soc_cpufreq_info soc_t8103_info = {
73
+ .has_ps2 = true,
72
74
.max_pstate = 15 ,
73
75
.cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_T8103 ,
74
76
.cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8103 ,
75
77
};
76
78
77
79
static const struct apple_soc_cpufreq_info soc_t8112_info = {
80
+ .has_ps2 = false,
78
81
.max_pstate = 31 ,
79
82
.cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_T8112 ,
80
83
.cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8112 ,
81
84
};
82
85
83
86
static const struct apple_soc_cpufreq_info soc_default_info = {
87
+ .has_ps2 = false,
84
88
.max_pstate = 15 ,
85
89
.cur_pstate_mask = 0 , /* fallback */
86
90
};
@@ -148,9 +152,12 @@ static int apple_soc_cpufreq_set_target(struct cpufreq_policy *policy,
148
152
return - EIO ;
149
153
}
150
154
151
- reg &= ~( APPLE_DVFS_CMD_PS1 | APPLE_DVFS_CMD_PS2 ) ;
155
+ reg &= ~APPLE_DVFS_CMD_PS1 ;
152
156
reg |= FIELD_PREP (APPLE_DVFS_CMD_PS1 , pstate );
153
- reg |= FIELD_PREP (APPLE_DVFS_CMD_PS2 , pstate );
157
+ if (priv -> info -> has_ps2 ) {
158
+ reg &= ~APPLE_DVFS_CMD_PS2 ;
159
+ reg |= FIELD_PREP (APPLE_DVFS_CMD_PS2 , pstate );
160
+ }
154
161
reg |= APPLE_DVFS_CMD_SET ;
155
162
156
163
writeq_relaxed (reg , priv -> reg_base + APPLE_DVFS_CMD );
0 commit comments