diff mbox series

[U-Boot,v2,3/6] stm32mp1: reset coprocessor status at cold boot

Message ID 1572442713-26353-4-git-send-email-fabien.dessenne@st.com
State Accepted
Commit 7bff971a145c9fa0aa59c61c1fe0081c6b2db6dd
Delegated to: Tom Rini
Headers show
Series remoteproc: add elf resource table loader | expand

Commit Message

Fabien DESSENNE Oct. 30, 2019, 1:38 p.m. UTC
Reset ResourceTableAddress and CoprocessorState at cold boot, preserve
these values at standby wakeup.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
 arch/arm/mach-stm32mp/cpu.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Patrick DELAUNAY Nov. 25, 2019, 4:55 p.m. UTC | #1
Hi Fabien,

> From: Fabien DESSENNE <fabien.dessenne@st.com>
> Sent: mercredi 30 octobre 2019 14:39
> 
> Reset ResourceTableAddress and CoprocessorState at cold boot, preserve these
> values at standby wakeup.
> 
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>

Acked-by: Patrick Delaunay <patrick.delaunay@st.com>

Thanks

Patrick
Tom Rini Jan. 8, 2020, 8:11 p.m. UTC | #2
On Wed, Oct 30, 2019 at 02:38:30PM +0100, Fabien Dessenne wrote:

> Reset ResourceTableAddress and CoprocessorState at cold boot, preserve
> these values at standby wakeup.
> 
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> Acked-by: Patrick Delaunay <patrick.delaunay@st.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
index a46e843..e24abf5 100644
--- a/arch/arm/mach-stm32mp/cpu.c
+++ b/arch/arm/mach-stm32mp/cpu.c
@@ -34,7 +34,9 @@ 
 #define TAMP_CR1		(STM32_TAMP_BASE + 0x00)
 
 #define PWR_CR1			(STM32_PWR_BASE + 0x00)
+#define PWR_MCUCR		(STM32_PWR_BASE + 0x14)
 #define PWR_CR1_DBP		BIT(8)
+#define PWR_MCUCR_SBF		BIT(6)
 
 /* DBGMCU register */
 #define DBGMCU_IDC		(STM32_DBGMCU_BASE + 0x00)
@@ -205,6 +207,11 @@  int arch_cpu_init(void)
 	security_init();
 	update_bootmode();
 #endif
+	/* Reset Coprocessor state unless it wakes up from Standby power mode */
+	if (!(readl(PWR_MCUCR) & PWR_MCUCR_SBF)) {
+		writel(TAMP_COPRO_STATE_OFF, TAMP_COPRO_STATE);
+		writel(0, TAMP_COPRO_RSC_TBL_ADDRESS);
+	}
 #endif
 
 	boot_mode = get_bootmode();