Skip to content

Commit 4d3608a

Browse files
nmenongregkh
authored andcommitted
cpufreq: ti-cpufreq: Introduce quirks to handle syscon fails appropriately
[ Upstream commit abc00ff ] Commit b4bc9f9 ("cpufreq: ti-cpufreq: add support for omap34xx and omap36xx") introduced special handling for OMAP3 class devices where syscon node may not be present. However, this also creates a bug where the syscon node is present, however the offset used to read is beyond the syscon defined range. Fix this by providing a quirk option that is populated when such special handling is required. This allows proper failure for all other platforms when the syscon node and efuse offsets are mismatched. Fixes: b4bc9f9 ("cpufreq: ti-cpufreq: add support for omap34xx and omap36xx") Signed-off-by: Nishanth Menon <nm@ti.com> Tested-by: Dhruva Gole <d-gole@ti.com> Reviewed-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c902e51 commit 4d3608a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/cpufreq/ti-cpufreq.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ struct ti_cpufreq_soc_data {
6161
unsigned long efuse_shift;
6262
unsigned long rev_offset;
6363
bool multi_regulator;
64+
/* Backward compatibility hack: Might have missing syscon */
65+
#define TI_QUIRK_SYSCON_MAY_BE_MISSING 0x1
66+
u8 quirks;
6467
};
6568

6669
struct ti_cpufreq_data {
@@ -182,6 +185,7 @@ static struct ti_cpufreq_soc_data omap34xx_soc_data = {
182185
.efuse_mask = BIT(3),
183186
.rev_offset = OMAP3_CONTROL_IDCODE - OMAP3_SYSCON_BASE,
184187
.multi_regulator = false,
188+
.quirks = TI_QUIRK_SYSCON_MAY_BE_MISSING,
185189
};
186190

187191
/*
@@ -209,6 +213,7 @@ static struct ti_cpufreq_soc_data omap36xx_soc_data = {
209213
.efuse_mask = BIT(9),
210214
.rev_offset = OMAP3_CONTROL_IDCODE - OMAP3_SYSCON_BASE,
211215
.multi_regulator = true,
216+
.quirks = TI_QUIRK_SYSCON_MAY_BE_MISSING,
212217
};
213218

214219
/*
@@ -223,6 +228,7 @@ static struct ti_cpufreq_soc_data am3517_soc_data = {
223228
.efuse_mask = 0,
224229
.rev_offset = OMAP3_CONTROL_IDCODE - OMAP3_SYSCON_BASE,
225230
.multi_regulator = false,
231+
.quirks = TI_QUIRK_SYSCON_MAY_BE_MISSING,
226232
};
227233

228234
static struct ti_cpufreq_soc_data am625_soc_data = {
@@ -250,7 +256,7 @@ static int ti_cpufreq_get_efuse(struct ti_cpufreq_data *opp_data,
250256

251257
ret = regmap_read(opp_data->syscon, opp_data->soc_data->efuse_offset,
252258
&efuse);
253-
if (ret == -EIO) {
259+
if (opp_data->soc_data->quirks & TI_QUIRK_SYSCON_MAY_BE_MISSING && ret == -EIO) {
254260
/* not a syscon register! */
255261
void __iomem *regs = ioremap(OMAP3_SYSCON_BASE +
256262
opp_data->soc_data->efuse_offset, 4);
@@ -291,7 +297,7 @@ static int ti_cpufreq_get_rev(struct ti_cpufreq_data *opp_data,
291297

292298
ret = regmap_read(opp_data->syscon, opp_data->soc_data->rev_offset,
293299
&revision);
294-
if (ret == -EIO) {
300+
if (opp_data->soc_data->quirks & TI_QUIRK_SYSCON_MAY_BE_MISSING && ret == -EIO) {
295301
/* not a syscon register! */
296302
void __iomem *regs = ioremap(OMAP3_SYSCON_BASE +
297303
opp_data->soc_data->rev_offset, 4);

0 commit comments

Comments
 (0)