Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq: ti-cpufreq: Allow backward compatibility for efuse syscon

The AM625 syscon for efuse was being taken earlier from the wkup_conf node
where the entire wkup_conf was marked as "syscon". This is wrong and will
be fixed in the devicetree. However, whenever that does happen will end up
breaking this driver for that device because of the change in efuse offset.

Hence, to avoid breaking any sort of backward compatibility of devicetrees
use a quirk to distinguish and accordingly use 0x0 offset for the new
syscon node.

Suggested-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

authored by

Dhruva Gole and committed by
Viresh Kumar
1724ae88 ea1829d4

+7
+7
drivers/cpufreq/ti-cpufreq.c
··· 93 93 bool multi_regulator; 94 94 /* Backward compatibility hack: Might have missing syscon */ 95 95 #define TI_QUIRK_SYSCON_MAY_BE_MISSING 0x1 96 + /* Backward compatibility hack: new syscon size is 1 register wide */ 97 + #define TI_QUIRK_SYSCON_IS_SINGLE_REG 0x2 96 98 u8 quirks; 97 99 }; 98 100 ··· 320 318 .efuse_shift = 0x6, 321 319 .rev_offset = 0x0014, 322 320 .multi_regulator = false, 321 + .quirks = TI_QUIRK_SYSCON_IS_SINGLE_REG, 323 322 }; 324 323 325 324 static struct ti_cpufreq_soc_data am62a7_soc_data = { ··· 357 354 358 355 ret = regmap_read(opp_data->syscon, opp_data->soc_data->efuse_offset, 359 356 &efuse); 357 + 358 + if (opp_data->soc_data->quirks & TI_QUIRK_SYSCON_IS_SINGLE_REG && ret == -EIO) 359 + ret = regmap_read(opp_data->syscon, 0x0, &efuse); 360 + 360 361 if (opp_data->soc_data->quirks & TI_QUIRK_SYSCON_MAY_BE_MISSING && ret == -EIO) { 361 362 /* not a syscon register! */ 362 363 void __iomem *regs = ioremap(OMAP3_SYSCON_BASE +