summaryrefslogtreecommitdiff
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
authorThomas Perrot <thomas.perrot@bootlin.com>2023-10-20 15:02:19 +0200
committerClaudiu Beznea <claudiu.beznea@tuxon.dev>2023-11-19 11:32:44 +0200
commitaa1cfba75b77ca93ab9a0b03c2c9124a16d96479 (patch)
treef56b999dc62394d83a536b93cafce147fcad3b00 /arch/arm/mach-at91
parentb85ea95d086471afb4ad062012a4d73cd328fa86 (diff)
ARM: at91: pm: set soc_pm.data.mode in at91_pm_secure_init()
In non secure mode, soc_pm.data.mode is set when entering pm in at91_pm_begin(). This value is used (not only) to determine if the system is going into slow clock mode (at91_suspend_entering_slow_clock()). This function is called from various drivers to check this and act accordingly. If not set, the driver might enter an incorrect suspend mode. When using secure suspend mode, at91_pm_begin() is not called and thus soc_pm.data.mode is not set. Since when using secure suspend, only one suspend mode is supported, set this value directly in at91_pm_secure_init(). Signed-off-by: Clément Léger <clement.leger@bootlin.com> Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Link: https://lore.kernel.org/r/20231020130219.1255937-1-thomas.perrot@bootlin.com Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/pm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 1a26af0fabc7..345b91dc6627 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -1103,6 +1103,7 @@ static void __init at91_pm_secure_init(void)
if (res.a0 == 0) {
pr_info("AT91: Secure PM: suspend mode set to %s\n",
pm_modes[suspend_mode].pattern);
+ soc_pm.data.mode = suspend_mode;
return;
}
@@ -1112,6 +1113,7 @@ static void __init at91_pm_secure_init(void)
res = sam_smccc_call(SAMA5_SMC_SIP_GET_SUSPEND_MODE, 0, 0);
if (res.a0 == 0) {
pr_warn("AT91: Secure PM: failed to get default mode\n");
+ soc_pm.data.mode = -1;
return;
}
@@ -1119,6 +1121,7 @@ static void __init at91_pm_secure_init(void)
pm_modes[suspend_mode].pattern);
soc_pm.data.suspend_mode = res.a1;
+ soc_pm.data.mode = soc_pm.data.suspend_mode;
}
static const struct of_device_id atmel_shdwc_ids[] = {
{ .compatible = "atmel,sama5d2-shdwc" },