Skip to content

Commit abc00ff

Browse files
nmenonvireshk
authored andcommitted
cpufreq: ti-cpufreq: Introduce quirks to handle syscon fails appropriately
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 <[email protected]> Tested-by: Dhruva Gole <[email protected]> Reviewed-by: Kevin Hilman <[email protected]> Signed-off-by: Viresh Kumar <[email protected]>
1 parent 2b7ec33 commit abc00ff

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
@@ -90,6 +90,9 @@ struct ti_cpufreq_soc_data {
9090
unsigned long efuse_shift;
9191
unsigned long rev_offset;
9292
bool multi_regulator;
93+
/* Backward compatibility hack: Might have missing syscon */
94+
#define TI_QUIRK_SYSCON_MAY_BE_MISSING 0x1
95+
u8 quirks;
9396
};
9497

9598
struct ti_cpufreq_data {
@@ -254,6 +257,7 @@ static struct ti_cpufreq_soc_data omap34xx_soc_data = {
254257
.efuse_mask = BIT(3),
255258
.rev_offset = OMAP3_CONTROL_IDCODE - OMAP3_SYSCON_BASE,
256259
.multi_regulator = false,
260+
.quirks = TI_QUIRK_SYSCON_MAY_BE_MISSING,
257261
};
258262

259263
/*
@@ -281,6 +285,7 @@ static struct ti_cpufreq_soc_data omap36xx_soc_data = {
281285
.efuse_mask = BIT(9),
282286
.rev_offset = OMAP3_CONTROL_IDCODE - OMAP3_SYSCON_BASE,
283287
.multi_regulator = true,
288+
.quirks = TI_QUIRK_SYSCON_MAY_BE_MISSING,
284289
};
285290

286291
/*
@@ -295,6 +300,7 @@ static struct ti_cpufreq_soc_data am3517_soc_data = {
295300
.efuse_mask = 0,
296301
.rev_offset = OMAP3_CONTROL_IDCODE - OMAP3_SYSCON_BASE,
297302
.multi_regulator = false,
303+
.quirks = TI_QUIRK_SYSCON_MAY_BE_MISSING,
298304
};
299305

300306
static struct ti_cpufreq_soc_data am625_soc_data = {
@@ -340,7 +346,7 @@ static int ti_cpufreq_get_efuse(struct ti_cpufreq_data *opp_data,
340346

341347
ret = regmap_read(opp_data->syscon, opp_data->soc_data->efuse_offset,
342348
&efuse);
343-
if (ret == -EIO) {
349+
if (opp_data->soc_data->quirks & TI_QUIRK_SYSCON_MAY_BE_MISSING && ret == -EIO) {
344350
/* not a syscon register! */
345351
void __iomem *regs = ioremap(OMAP3_SYSCON_BASE +
346352
opp_data->soc_data->efuse_offset, 4);
@@ -381,7 +387,7 @@ static int ti_cpufreq_get_rev(struct ti_cpufreq_data *opp_data,
381387

382388
ret = regmap_read(opp_data->syscon, opp_data->soc_data->rev_offset,
383389
&revision);
384-
if (ret == -EIO) {
390+
if (opp_data->soc_data->quirks & TI_QUIRK_SYSCON_MAY_BE_MISSING && ret == -EIO) {
385391
/* not a syscon register! */
386392
void __iomem *regs = ioremap(OMAP3_SYSCON_BASE +
387393
opp_data->soc_data->rev_offset, 4);

0 commit comments

Comments
 (0)