mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-28 08:59:50 +00:00

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>
41 lines
875 B
C
41 lines
875 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
|
|
* http://www.samsung.com
|
|
*
|
|
* Header for Exynos PMU Driver support
|
|
*/
|
|
|
|
#ifndef __LINUX_SOC_EXYNOS_PMU_H
|
|
#define __LINUX_SOC_EXYNOS_PMU_H
|
|
|
|
struct regmap;
|
|
struct device_node;
|
|
|
|
enum sys_powerdown {
|
|
SYS_AFTR,
|
|
SYS_LPA,
|
|
SYS_SLEEP,
|
|
NUM_SYS_POWERDOWN,
|
|
};
|
|
|
|
extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
|
|
#ifdef CONFIG_EXYNOS_PMU
|
|
struct regmap *exynos_get_pmu_regmap(void);
|
|
struct regmap *exynos_get_pmu_regmap_by_phandle(struct device_node *np,
|
|
const char *propname);
|
|
#else
|
|
static inline struct regmap *exynos_get_pmu_regmap(void)
|
|
{
|
|
return ERR_PTR(-ENODEV);
|
|
}
|
|
|
|
static inline struct regmap *exynos_get_pmu_regmap_by_phandle(struct device_node *np,
|
|
const char *propname)
|
|
{
|
|
return ERR_PTR(-ENODEV);
|
|
}
|
|
#endif
|
|
|
|
#endif /* __LINUX_SOC_EXYNOS_PMU_H */
|