soc: samsung: exynos-pmu: Add regmap support for SoCs that protect PMU regs
authorPeter Griffin <peter.griffin@linaro.org>
Tue, 20 Feb 2024 22:06:12 +0000 (22:06 +0000)
committerKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sun, 25 Feb 2024 10:39:23 +0000 (11:39 +0100)
commit0b7c6075022ccff529318597dc6b165dd6a25c8f
treec4bade4c8908f30099e8fee7972e7330c7379b70
parent9690b9de81d1ad40a70b3d34b9d7e26486a5e83a
soc: samsung: exynos-pmu: Add regmap support for SoCs that protect PMU regs

Some Exynos based SoCs like Tensor gs101 protect the PMU registers for
security hardening reasons so that they are only write accessible in el3
via an SMC call.

As most Exynos drivers that need to write PMU registers currently obtain a
regmap via syscon (phys, pinctrl, watchdog). Support for the above usecase
is implemented in this driver using a custom regmap similar to syscon to
handle the SMC call. Platforms that don't secure PMU registers, get a mmio
regmap like before. As regmaps abstract out the underlying register access
changes to the leaf drivers are minimal.

A new API exynos_get_pmu_regmap_by_phandle() is provided for leaf drivers
that currently use syscon_regmap_lookup_by_phandle(). This also handles
deferred probing.

Tested-by: Sam Protsenko <semen.protsenko@linaro.org>
Tested-by: Alexey Klimov <alexey.klimov@linaro.org>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20240220220613.797068-2-peter.griffin@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
drivers/soc/samsung/Kconfig
drivers/soc/samsung/exynos-pmu.c
drivers/soc/samsung/exynos-pmu.h
include/linux/soc/samsung/exynos-pmu.h