soc: nrf53: soc: Add nrf53_has_erratum19()

And add assert on bootup if workarounds are not enabled.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
This commit is contained in:
Øyvind Rønningstad 2020-02-24 16:42:44 +01:00 committed by Ioannis Glaropoulos
commit 6492dcec6f
2 changed files with 33 additions and 0 deletions

View file

@ -89,5 +89,34 @@ void z_platform_init(void)
SystemInit();
}
#if defined(CONFIG_SOC_NRF5340_CPUAPP) && \
!defined(CONFIG_TRUSTED_EXECUTION_NONSECURE)
bool nrf53_has_erratum19(void)
{
if (NRF_FICR->INFO.PART == 0x5340) {
if (NRF_FICR->INFO.VARIANT == 0x41414142) {
return true;
}
}
return false;
}
#ifndef CONFIG_NRF5340_CPUAPP_ERRATUM19
static int check_erratum19(struct device *arg)
{
ARG_UNUSED(arg);
if (nrf53_has_erratum19()) {
LOG_ERR("This device is affected by nRF53 Erratum 19,");
LOG_ERR("but workarounds have not been enabled.");
LOG_ERR("See CONFIG_NRF5340_CPUAPP_ERRATUM19.");
k_panic();
}
return 0;
}
SYS_INIT(check_erratum19, POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY);
#endif
#endif
SYS_INIT(nordicsemi_nrf53_init, PRE_KERNEL_1, 0);

View file

@ -29,4 +29,8 @@
#define FLASH_PAGE_MAX_CNT 128UL
#endif
#ifdef CONFIG_SOC_NRF5340_CPUAPP
bool nrf53_has_erratum19(void);
#endif
#endif /* _NORDICSEMI_NRF53_SOC_H_ */