soc: nordic: Add Nordic GPREGRET setting support

Adds support for setting GPREGRET register when rebooting.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdtech.com>
This commit is contained in:
Jamie McCrae 2018-10-29 11:46:54 +00:00 committed by Carles Cufí
commit 183e7445c6
3 changed files with 24 additions and 0 deletions

View file

@ -5,5 +5,6 @@ zephyr_compile_definitions_ifdef(
)
zephyr_sources(
power.c
soc.c
)

View file

@ -0,0 +1,15 @@
/*
* Copyright (c) 2018 Intel Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <nrf_power.h>
/* Overrides the weak ARM implementation:
Set general purpose retention register and reboot */
void sys_arch_reboot(int type)
{
nrf_power_gpregret_set((uint8_t)type);
NVIC_SystemReset();
}

View file

@ -115,3 +115,11 @@ bool _sys_soc_is_valid_power_state(enum power_states state)
return false;
}
/* Overrides the weak ARM implementation:
Set general purpose retention register and reboot */
void sys_arch_reboot(int type)
{
nrf_power_gpregret_set((uint8_t)type);
NVIC_SystemReset();
}