diff --git a/soc/arm/nordic_nrf/nrf53/soc.c b/soc/arm/nordic_nrf/nrf53/soc.c index 250ba5e2a45..64bd585c522 100644 --- a/soc/arm/nordic_nrf/nrf53/soc.c +++ b/soc/arm/nordic_nrf/nrf53/soc.c @@ -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); diff --git a/soc/arm/nordic_nrf/nrf53/soc.h b/soc/arm/nordic_nrf/nrf53/soc.h index 4a1c602e3aa..0322d74ee97 100644 --- a/soc/arm/nordic_nrf/nrf53/soc.h +++ b/soc/arm/nordic_nrf/nrf53/soc.h @@ -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_ */