Skip to content
Snippets Groups Projects
Commit 57ac430e authored by Yann Gautier's avatar Yann Gautier Committed by Sebastien Pasdeloup
Browse files

stm32mp1: move boot interface get and save functions to private file


Those functions are not directly linked to context, used for low-power
states. They are moved to stm32mp1_private.c file.

Change-Id: Id4b164aa078077fcf90557bedc2f14c4969fe5da
Signed-off-by: default avatarYann Gautier <yann.gautier@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/tf-a/+/188654


Reviewed-by: default avatarCITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: default avatarCIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: default avatarLionel DEBIEVE <lionel.debieve@st.com>
Tested-by: default avatarLionel DEBIEVE <lionel.debieve@st.com>
parent 1ce41e4c
No related branches found
No related tags found
No related merge requests found
......@@ -29,8 +29,6 @@ uint32_t stm32_get_zdata_from_context(void);
int stm32_get_pll1_settings_from_context(void);
bool stm32_are_pll1_settings_valid_in_context(void);
bool stm32_pm_context_is_valid(void);
int stm32_save_boot_interface(uint32_t interface, uint32_t instance);
int stm32_get_boot_interface(uint32_t *interface, uint32_t *instance);
void stm32_save_ddr_training_area(void);
void stm32_restore_ddr_training_area(void);
uint32_t stm32_pm_get_optee_ep(void);
......
......@@ -29,6 +29,9 @@ enum boot_device_e get_boot_device(void);
bool stm32mp1_addr_inside_backupsram(uintptr_t addr);
bool stm32mp1_is_wakeup_from_standby(void);
int stm32_save_boot_interface(uint32_t interface, uint32_t instance);
int stm32_get_boot_interface(uint32_t *interface, uint32_t *instance);
enum etzpc_decprot_attributes stm32mp_etzpc_binding2decprot(uint32_t mode);
void stm32mp1_syscfg_init(void);
......
......@@ -28,10 +28,6 @@
#include <boot_api.h>
#include <stm32mp1_critic_power.h>
#define TAMP_BOOT_ITF_BACKUP_REG_ID U(20)
#define TAMP_BOOT_ITF_MASK U(0x0000FF00)
#define TAMP_BOOT_ITF_SHIFT 8
#define TRAINING_AREA_SIZE 64
#define BL32_CANARY_ID U(0x424c3332)
......@@ -448,42 +444,6 @@ bool stm32_pm_context_is_valid(void)
return ret;
}
int stm32_save_boot_interface(uint32_t interface, uint32_t instance)
{
uint32_t bkpr_itf_idx = tamp_bkpr(TAMP_BOOT_ITF_BACKUP_REG_ID);
clk_enable(RTCAPB);
mmio_clrsetbits_32(bkpr_itf_idx,
TAMP_BOOT_ITF_MASK,
((interface << 4) | (instance & 0xFU)) <<
TAMP_BOOT_ITF_SHIFT);
clk_disable(RTCAPB);
return 0;
}
int stm32_get_boot_interface(uint32_t *interface, uint32_t *instance)
{
static uint32_t itf;
if (itf == 0U) {
uint32_t bkpr = tamp_bkpr(TAMP_BOOT_ITF_BACKUP_REG_ID);
clk_enable(RTCAPB);
itf = (mmio_read_32(bkpr) & TAMP_BOOT_ITF_MASK) >> TAMP_BOOT_ITF_SHIFT;
clk_disable(RTCAPB);
}
*interface = itf >> 4;
*instance = itf & 0xFU;
return 0;
}
#if defined(IMAGE_BL32)
/*
* When returning from STANDBY, the 64 first bytes of DDR will be overwritten
......
......@@ -44,6 +44,10 @@
BOARD_ID_VARFG_SHIFT)
#define BOARD_ID2BOM(_id) ((_id) & BOARD_ID_BOM_MASK)
#define TAMP_BOOT_ITF_BACKUP_REG_ID U(20)
#define TAMP_BOOT_ITF_MASK U(0x0000FF00)
#define TAMP_BOOT_ITF_SHIFT 8
#if defined(IMAGE_BL2)
#define MAP_SEC_SYSRAM MAP_REGION_FLAT(STM32MP_SYSRAM_BASE, \
STM32MP_SYSRAM_SIZE, \
......@@ -803,6 +807,42 @@ bool stm32mp1_is_wakeup_from_standby(void)
return stm32_pm_context_is_valid();
}
int stm32_save_boot_interface(uint32_t interface, uint32_t instance)
{
uint32_t bkpr_itf_idx = tamp_bkpr(TAMP_BOOT_ITF_BACKUP_REG_ID);
clk_enable(RTCAPB);
mmio_clrsetbits_32(bkpr_itf_idx,
TAMP_BOOT_ITF_MASK,
((interface << 4) | (instance & 0xFU)) <<
TAMP_BOOT_ITF_SHIFT);
clk_disable(RTCAPB);
return 0;
}
int stm32_get_boot_interface(uint32_t *interface, uint32_t *instance)
{
static uint32_t itf;
if (itf == 0U) {
uint32_t bkpr = tamp_bkpr(TAMP_BOOT_ITF_BACKUP_REG_ID);
clk_enable(RTCAPB);
itf = (mmio_read_32(bkpr) & TAMP_BOOT_ITF_MASK) >> TAMP_BOOT_ITF_SHIFT;
clk_disable(RTCAPB);
}
*interface = itf >> 4;
*instance = itf & 0xFU;
return 0;
}
#if defined(IMAGE_BL32) && DEBUG
static const char *const dump_table[] = {
"sp_usr ",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment