mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-26 06:50:10 +00:00
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
This commit is contained in:
parent
6cec23dc12
commit
d91d10ab39
3 changed files with 25 additions and 12 deletions
|
@ -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
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -7,8 +7,6 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include <platform_def.h>
|
|
||||||
|
|
||||||
#include <common/bl_common.h>
|
#include <common/bl_common.h>
|
||||||
#include <common/debug.h>
|
#include <common/debug.h>
|
||||||
#include <drivers/delay_timer.h>
|
#include <drivers/delay_timer.h>
|
||||||
|
@ -16,6 +14,8 @@
|
||||||
#include <lib/mmio.h>
|
#include <lib/mmio.h>
|
||||||
#include <lib/utils_def.h>
|
#include <lib/utils_def.h>
|
||||||
|
|
||||||
|
#include <platform_def.h>
|
||||||
|
|
||||||
static uint32_t id2reg_offset(unsigned int reset_id)
|
static uint32_t id2reg_offset(unsigned int reset_id)
|
||||||
{
|
{
|
||||||
return ((reset_id & GENMASK(31, 5)) >> 5) * sizeof(uint32_t);
|
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;
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
* 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);
|
(void)stm32mp_reset_deassert(reset_id, 0U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Manage system reset control
|
||||||
|
*/
|
||||||
|
void __dead2 stm32mp_system_reset(void);
|
||||||
|
|
||||||
#endif /* STM32MP_RESET_H */
|
#endif /* STM32MP_RESET_H */
|
||||||
|
|
|
@ -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
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
#include <drivers/arm/gic_common.h>
|
#include <drivers/arm/gic_common.h>
|
||||||
#include <drivers/arm/gicv2.h>
|
#include <drivers/arm/gicv2.h>
|
||||||
#include <drivers/clk.h>
|
#include <drivers/clk.h>
|
||||||
|
#include <drivers/st/stm32mp_reset.h>
|
||||||
#include <dt-bindings/clock/stm32mp1-clks.h>
|
#include <dt-bindings/clock/stm32mp1-clks.h>
|
||||||
#include <lib/mmio.h>
|
#include <lib/mmio.h>
|
||||||
#include <lib/psci/psci.h>
|
#include <lib/psci/psci.h>
|
||||||
|
@ -149,13 +150,7 @@ static void __dead2 stm32_system_off(void)
|
||||||
|
|
||||||
static void __dead2 stm32_system_reset(void)
|
static void __dead2 stm32_system_reset(void)
|
||||||
{
|
{
|
||||||
mmio_setbits_32(stm32mp_rcc_base() + RCC_MP_GRSTCSETR,
|
stm32mp_system_reset();
|
||||||
RCC_MP_GRSTCSETR_MPSYSRST);
|
|
||||||
|
|
||||||
/* Loop in case system reset is not immediately caught */
|
|
||||||
for ( ; ; ) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stm32_validate_power_state(unsigned int power_state,
|
static int stm32_validate_power_state(unsigned int power_state,
|
||||||
|
|
Loading…
Add table
Reference in a new issue