Browse Source

feat(st-reset): add system reset management

Add the system reset management into the stm32mp
reset driver.

Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Change-Id: I748f10de2398e1323160f479f99e92abd2f65dca
pull/1996/merge
Lionel Debieve 4 years ago
committed by Yann Gautier
parent
commit
d91d10ab39
  1. 19
      drivers/st/reset/stm32mp1_reset.c
  2. 7
      include/drivers/st/stm32mp_reset.h
  3. 11
      plat/st/stm32mp1/stm32mp1_pm.c

19
drivers/st/reset/stm32mp1_reset.c

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2019, STMicroelectronics - All Rights Reserved
* Copyright (c) 2018-2024, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -7,8 +7,6 @@
#include <errno.h>
#include <limits.h>
#include <platform_def.h>
#include <common/bl_common.h>
#include <common/debug.h>
#include <drivers/delay_timer.h>
@ -16,6 +14,8 @@
#include <lib/mmio.h>
#include <lib/utils_def.h>
#include <platform_def.h>
static uint32_t id2reg_offset(unsigned int reset_id)
{
return ((reset_id & GENMASK(31, 5)) >> 5) * sizeof(uint32_t);
@ -67,3 +67,16 @@ int stm32mp_reset_deassert(uint32_t id, unsigned int to_us)
return 0;
}
void __dead2 stm32mp_system_reset(void)
{
uintptr_t rcc_base = stm32mp_rcc_base();
mmio_setbits_32(rcc_base + RCC_MP_GRSTCSETR,
RCC_MP_GRSTCSETR_MPSYSRST);
/* Loop in case system reset is not immediately caught */
while (true) {
wfi();
}
}

7
include/drivers/st/stm32mp_reset.h

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2019, STMicroelectronics - All Rights Reserved
* Copyright (c) 2018-2024, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -47,4 +47,9 @@ static inline void stm32mp_reset_release(uint32_t reset_id)
(void)stm32mp_reset_deassert(reset_id, 0U);
}
/*
* Manage system reset control
*/
void __dead2 stm32mp_system_reset(void);
#endif /* STM32MP_RESET_H */

11
plat/st/stm32mp1/stm32mp1_pm.c

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -13,6 +13,7 @@
#include <drivers/arm/gic_common.h>
#include <drivers/arm/gicv2.h>
#include <drivers/clk.h>
#include <drivers/st/stm32mp_reset.h>
#include <dt-bindings/clock/stm32mp1-clks.h>
#include <lib/mmio.h>
#include <lib/psci/psci.h>
@ -149,13 +150,7 @@ static void __dead2 stm32_system_off(void)
static void __dead2 stm32_system_reset(void)
{
mmio_setbits_32(stm32mp_rcc_base() + RCC_MP_GRSTCSETR,
RCC_MP_GRSTCSETR_MPSYSRST);
/* Loop in case system reset is not immediately caught */
for ( ; ; ) {
;
}
stm32mp_system_reset();
}
static int stm32_validate_power_state(unsigned int power_state,

Loading…
Cancel
Save