feat(stm32mp1): add stm32_get_boot_interface function
Add function stm32_get_boot_interface to get the current boot interface from information saved in the TAMP register. Change-Id: I23af43c68eeaebe4c45920a57d739117aea3fbb1 Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
This commit is contained in:
parent
4dc77a35e3
commit
a6bfa75cf2
|
@ -115,7 +115,8 @@ int stm32mp_check_header(boot_api_image_header_t *header, uintptr_t buffer);
|
|||
int stm32mp_map_ddr_non_cacheable(void);
|
||||
int stm32mp_unmap_ddr(void);
|
||||
|
||||
/* Function to save boot peripheral info */
|
||||
/* Functions to save and get boot peripheral info */
|
||||
void stm32_save_boot_interface(uint32_t interface, uint32_t instance);
|
||||
void stm32_get_boot_interface(uint32_t *interface, uint32_t *instance);
|
||||
|
||||
#endif /* STM32MP_COMMON_H */
|
||||
|
|
|
@ -575,3 +575,22 @@ void stm32_save_boot_interface(uint32_t interface, uint32_t instance)
|
|||
|
||||
stm32mp_clk_disable(RTCAPB);
|
||||
}
|
||||
|
||||
void stm32_get_boot_interface(uint32_t *interface, uint32_t *instance)
|
||||
{
|
||||
static uint32_t itf;
|
||||
|
||||
if (itf == 0U) {
|
||||
uint32_t bkpr = tamp_bkpr(TAMP_BOOT_MODE_BACKUP_REG_ID);
|
||||
|
||||
stm32mp_clk_enable(RTCAPB);
|
||||
|
||||
itf = (mmio_read_32(bkpr) & TAMP_BOOT_MODE_ITF_MASK) >>
|
||||
TAMP_BOOT_MODE_ITF_SHIFT;
|
||||
|
||||
stm32mp_clk_disable(RTCAPB);
|
||||
}
|
||||
|
||||
*interface = itf >> 4;
|
||||
*instance = itf & 0xFU;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue