ARM: at91: pm: set soc_pm.data.mode in at91_pm_secure_init()
PATCH 1/1 ARM: at91: pm: set soc_pm.data.mode in at91_pm_secure_init()
From: Thomas Perrot <[email protected]>
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().
--- arch/arm/mach-at91/pm.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/mach-at91/pm.c +3 -0
@@ -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" },
Signature · 1 line
2.41.0
Quoted 14 lines · On 20/10/2023 at 15:02, [email protected] wrote:
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
From: Thomas Perrot <[email protected]>
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 inat91_pm_secure_init().
Quoted 2 lines
Signed-off-by Clément Léger <[email protected]>Signed-off-by Thomas Perrot <[email protected]>
Thanks, best regards,
Nicolas
Quoted 35 lines
--- arch/arm/mach-at91/pm.c | 3 +++ 1 file changed, 3 insertions(+)arch/arm/mach-at91/pm.c +3
-1@@ -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" }, --2.41.0
claudiu beznea
maintainerHi, Thomas,
Quoted 31 lines · On 20.10.2023 16:02, [email protected] wrote:
From: Thomas Perrot <[email protected]>
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 inat91_pm_secure_init().Signed-off-by Clément Léger <[email protected]>Signed-off-by Thomas Perrot <[email protected]>--- arch/arm/mach-at91/pm.c | 3 +++ 1 file changed, 3 insertions(+)arch/arm/mach-at91/pm.c +1
-0@@ -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 ; }
arch/arm/mach-at91/pm.c static void __init at91_pm_secure_init(void) · line 1116
Quoted 4 lines
arch/arm/mach-at91/pm.c +1
-0@@ -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 ;
As this variable's type is unsigned int setting it -1 will make at91_suspend_entering_slow_clock() return true all the time. Is this what you intend?
Thank you,
Claudiu Beznea
Quoted 11 lines
arch/arm/mach-at91/pm.c +1
-0return ; }@@ -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" },
Hello Claudiu,
Quoted 24 lines · claudiu beznea
Quoted 24 lines
Hi, Thomas,
Quoted 22 lines
Quoted 22 lines
arch/arm/mach-at91/pm.c +0
-0@@ -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;
}arch/arm/mach-at91/pm.c +0
-0@@ -1112,6 +1113,7 @@ static void __initat91_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");
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
+ soc_pm.data.mode = -1;
As this variable's type is unsigned int setting it -1 will make
at91_suspend_entering_slow_clock()return true all the time. Is this
what
you intend?
Yes, to set it at the same default value, as in at91_pm_begin() [1], when an unsupported mode is used and can’t get the default value from the secure monitor.
[1]https://elixir.bootlin.com/linux/latest/source/arch/arm/mach-at91/pm.c#L470
Kind regards,
Thomas Perrot
Quoted 15 lines
Quoted 15 lines
Thank you,
Claudiu BezneaQuoted 12 lines
Quoted 12 lines
return;
}arch/arm/mach-at91/pm.c +0
-0@@ -1119,6 +1121,7 @@ static void __initat91_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 structof_device_idatmel_shdwc_ids[] = { { .compatible = "atmel,sama5d2-shdwc" },
Signature · 9 lines
Thomas Perrot, Bootlin Embedded Linux and kernel engineering https://bootlin.com -- Thomas Perrot, Bootlin Embedded Linux and kernel engineering https://bootlin.com
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 12 lines · On 20.10.2023 16:02, [email protected] wrote:
From: Thomas Perrot <[email protected]>
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 inat91_pm_secure_init().
Quoted 2 lines
Signed-off-by Clément Léger <[email protected]>Signed-off-by Thomas Perrot <[email protected]>
Applied to at91-soc, thanks!