-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nrf fromlist] soc: nordic: s2ram: Align s2ram marking procedures
Rework Nordic specific S2RAM marking procedures. The S2RAM marking procedures must not disrupt the stack due to the TLS pointer not yet being initialized during their execution. Upstream PR: zephyrproject-rtos/zephyr#80039 Signed-off-by: Adam Kondraciuk <[email protected]>
- Loading branch information
1 parent
d90712a
commit 19a78cd
Showing
4 changed files
with
94 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/** | ||
* @file | ||
* @brief Nordic suspend-to-RAM code (S2RAM) | ||
*/ | ||
|
||
#include <zephyr/toolchain.h> | ||
#include <zephyr/arch/cpu.h> | ||
#include <zephyr/arch/common/pm_s2ram.h> | ||
|
||
|
||
GTEXT(pm_s2ram_mark_set) | ||
SECTION_FUNC(TEXT, pm_s2ram_mark_set) | ||
/* | ||
* Restore the PC and continue | ||
*/ | ||
mov r15, r1 | ||
|
||
GTEXT(pm_s2ram_mark_check_and_clear) | ||
SECTION_FUNC(TEXT, pm_s2ram_mark_check_and_clear) | ||
/* | ||
* Set return value to 0 | ||
*/ | ||
mov r0, #0 | ||
|
||
/* | ||
* Load check RESETREAS register | ||
*/ | ||
ldr r2, =CONFIG_NRF_RESETINFO_PERIPH_ADDRESS | ||
ldr r5, =CONFIG_NRF_RESETREAS_LOCAL_REG_OFFSET | ||
ldr r3, [r5, r2] | ||
ldr r6, =CONFIG_NRF_RESETREAS_LOCAL_UNRETAINEDWAKE_FIELD | ||
cmp r3, r6 | ||
|
||
bne exit | ||
|
||
/* | ||
* Clear RESETREAS | ||
*/ | ||
str r0, [r5, r2] | ||
|
||
/* | ||
* Load RESTOREVALID register | ||
*/ | ||
ldr r5, =CONFIG_NRF_RESTOREVALID_REG_OFFSET | ||
ldr r3, [r5, r2] | ||
|
||
/* | ||
* Clear RESTOREVALID | ||
*/ | ||
str r0, [r5, r2] | ||
|
||
/* | ||
* Check RESTOREVALID register | ||
*/ | ||
ldr r5, =CONFIG_NRF_RESTOREVALID_PRESENT_FIELD | ||
cmp r3, r5 | ||
bne exit | ||
|
||
/* | ||
* Set return value to 1 | ||
*/ | ||
mov r0, #1 | ||
exit: | ||
/* | ||
* Restore the PC and continue | ||
*/ | ||
mov r15, r1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters