2525#define APPLE_DVFS_CMD 0x20
2626#define APPLE_DVFS_CMD_BUSY BIT(31)
2727#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)
2929#define APPLE_DVFS_CMD_PS1 GENMASK(4, 0)
3030
3131/* Same timebase as CPU counter (24MHz) */
5555#define APPLE_DVFS_TRANSITION_TIMEOUT 100
5656
5757struct apple_soc_cpufreq_info {
58+ bool has_ps2 ;
5859 u64 max_pstate ;
5960 u64 cur_pstate_mask ;
6061 u64 cur_pstate_shift ;
@@ -69,18 +70,21 @@ struct apple_cpu_priv {
6970static struct cpufreq_driver apple_soc_cpufreq_driver ;
7071
7172static const struct apple_soc_cpufreq_info soc_t8103_info = {
73+ .has_ps2 = true,
7274 .max_pstate = 15 ,
7375 .cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_T8103 ,
7476 .cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8103 ,
7577};
7678
7779static const struct apple_soc_cpufreq_info soc_t8112_info = {
80+ .has_ps2 = false,
7881 .max_pstate = 31 ,
7982 .cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_T8112 ,
8083 .cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8112 ,
8184};
8285
8386static const struct apple_soc_cpufreq_info soc_default_info = {
87+ .has_ps2 = false,
8488 .max_pstate = 15 ,
8589 .cur_pstate_mask = 0 , /* fallback */
8690};
@@ -148,9 +152,12 @@ static int apple_soc_cpufreq_set_target(struct cpufreq_policy *policy,
148152 return - EIO ;
149153 }
150154
151- reg &= ~( APPLE_DVFS_CMD_PS1 | APPLE_DVFS_CMD_PS2 ) ;
155+ reg &= ~APPLE_DVFS_CMD_PS1 ;
152156 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+ }
154161 reg |= APPLE_DVFS_CMD_SET ;
155162
156163 writeq_relaxed (reg , priv -> reg_base + APPLE_DVFS_CMD );
0 commit comments