File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
soc/renesas/smartbond/da1469x Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change 77#include <zephyr/init.h>
88#include <zephyr/linker/linker-defs.h>
99#include <zephyr/logging/log.h>
10+ #include <zephyr/sys/reboot.h>
1011#include <string.h>
1112#include <DA1469xAB.h>
1213#include <da1469x_clock.h>
@@ -36,9 +37,26 @@ static uint32_t z_renesas_cache_configured;
3637
3738void sys_arch_reboot (int type )
3839{
39- ARG_UNUSED (type );
40-
41- NVIC_SystemReset ();
40+ if (type == SYS_REBOOT_WARM ) {
41+ NVIC_SystemReset ();
42+ } else if (type == SYS_REBOOT_COLD ) {
43+ if ((SYS_WDOG -> WATCHDOG_REG & SYS_WDOG_WATCHDOG_REG_WDOG_VAL_NEG_Msk ) == 0 ) {
44+ /* Cannot write WATCHDOG_REG while WRITE_BUSY */
45+ while ((SYS_WDOG -> WATCHDOG_REG &
46+ SYS_WDOG_WATCHDOG_CTRL_REG_WRITE_BUSY_Msk ) != 0 ) {
47+ }
48+ /* Write WATCHDOG_REG */
49+ SYS_WDOG -> WATCHDOG_REG = BIT (SYS_WDOG_WATCHDOG_REG_WDOG_VAL_Pos );
50+
51+ GPREG -> RESET_FREEZE_REG = GPREG_SET_FREEZE_REG_FRZ_SYS_WDOG_Msk ;
52+ SYS_WDOG -> WATCHDOG_CTRL_REG &=
53+ ~SYS_WDOG_WATCHDOG_CTRL_REG_WDOG_FREEZE_EN_Msk ;
54+ }
55+ /* Wait */
56+ for (;;) {
57+ __NOP ();
58+ }
59+ }
4260}
4361
4462#if defined(CONFIG_BOOTLOADER_MCUBOOT )
You can’t perform that action at this time.
0 commit comments