Skip to contentSkip to conversation

ARM: stm32: Inhibit PDDS because CSTBYDIS is set

PATCH In review Marek Vasut 3 participants 3 messages Jul 6, 2023 – Aug 16, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: stm32: Inhibit PDDS because CSTBYDIS is set

The PWR_MPUCR CSTBYDIS bit is set, therefore the CA cores can never enter CStandby state and would always end up in CStop state. Clear the PDDS bit, which indicates the CA cores can enter CStandby state as it makes little sense to keep it set with CSTBYDIS also set.

This does however fix a problem too. When both PWR_MPUCR and PWR_MCUCR PDDS bits are set, then the chip enters CStandby state even though the PWR_MCUCR CSTBYDIS is set. Clearing the PWR_MPUCR PDDS prevents that from happening.

---
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: [email protected]

---
 arch/arm/mach-stm32mp/psci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-stm32mp/psci.c +1 -1
index 50e3fc4ae45..79734b5289b 100644
@@ -754,7 +754,7 @@ void __secure psci_system_suspend(u32 __always_unused function_id,
 	setbits_le32(STM32_RCC_BASE + RCC_MP_CIER, RCC_MP_CIFR_WKUPF);
 
 	setbits_le32(STM32_PWR_BASE + PWR_MPUCR,
-		     PWR_MPUCR_CSSF | PWR_MPUCR_CSTDBYDIS | PWR_MPUCR_PDDS);
+		     PWR_MPUCR_CSSF | PWR_MPUCR_CSTDBYDIS);
 
 	saved_mcudivr = readl(STM32_RCC_BASE + RCC_MCUDIVR);
 	saved_pll3cr = readl(STM32_RCC_BASE + RCC_PLL3CR);
Signature · 1 line
2.40.1
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 24 lines · Marek Vasut

The PWR_MPUCR CSTBYDIS bit is set, therefore the CA cores can never enter CStandby state and would always end up in CStop state. Clear the PDDS bit, which indicates the CA cores can enter CStandby state as it makes little sense to keep it set with CSTBYDIS also set.

This does however fix a problem too. When both PWR_MPUCR and PWR_MCUCR PDDS bits are set, then the chip enters CStandby state even though the PWR_MCUCR CSTBYDIS is set. Clearing the PWR_MPUCR PDDS prevents that from happening.

---
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: [email protected]

---
  arch/arm/mach-stm32mp/psci.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-stm32mp/psci.c +0 -0
index 50e3fc4ae45..79734b5289b 100644

arch/arm/mach-stm32mp/psci.c void __secure psci_system_suspend(u32 __always_unused function_id, · line 760

Quoted 8 lines
arch/arm/mach-stm32mp/psci.c +1 -1
@@ -754,7 +754,7 @@ void __secure psci_system_suspend(u32 __always_unused function_id,
  	setbits_le32(STM32_RCC_BASE + RCC_MP_CIER, RCC_MP_CIFR_WKUPF);
 
  	setbits_le32(STM32_PWR_BASE + PWR_MPUCR,
-		     PWR_MPUCR_CSSF | PWR_MPUCR_CSTDBYDIS | PWR_MPUCR_PDDS);
+		     PWR_MPUCR_CSSF | PWR_MPUCR_CSTDBYDIS);
 
  	saved_mcudivr = readl(STM32_RCC_BASE + RCC_MCUDIVR);
  	saved_pll3cr = readl(STM32_RCC_BASE + RCC_PLL3CR);

Thanks
Patrick

#2 lore raw
In reply to Marek Vasut
Quoted 24 lines · Marek Vasut

The PWR_MPUCR CSTBYDIS bit is set, therefore the CA cores can never enter CStandby state and would always end up in CStop state. Clear the PDDS bit, which indicates the CA cores can enter CStandby state as it makes little sense to keep it set with CSTBYDIS also set.

This does however fix a problem too. When both PWR_MPUCR and PWR_MCUCR PDDS bits are set, then the chip enters CStandby state even though the PWR_MCUCR CSTBYDIS is set. Clearing the PWR_MPUCR PDDS prevents that from happening.

---
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: [email protected]

---
 arch/arm/mach-stm32mp/psci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-stm32mp/psci.c +0 -0
index 50e3fc4ae45..79734b5289b 100644

arch/arm/mach-stm32mp/psci.c void __secure psci_system_suspend(u32 __always_unused function_id, · line 760

Quoted 8 lines
arch/arm/mach-stm32mp/psci.c +1 -1
@@ -754,7 +754,7 @@ void __secure psci_system_suspend(u32 __always_unused function_id,
 	setbits_le32(STM32_RCC_BASE + RCC_MP_CIER, RCC_MP_CIFR_WKUPF);
 
 	setbits_le32(STM32_PWR_BASE + PWR_MPUCR,
-		     PWR_MPUCR_CSSF | PWR_MPUCR_CSTDBYDIS | PWR_MPUCR_PDDS);
+		     PWR_MPUCR_CSSF | PWR_MPUCR_CSTDBYDIS);
 
 	saved_mcudivr = readl(STM32_RCC_BASE + RCC_MCUDIVR);
 	saved_pll3cr = readl(STM32_RCC_BASE + RCC_PLL3CR);

Applied on stm32-master

Thanks
Patrice