soc: same70: check for mismatch between chip and HAL CIDR
The revision A and B of the chip are very close, so most of the code will work if the wrong revision is selected. To avoid that, check that the selected HAL and the chip CIDR match. Otherwise emit a warning in the logs. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
997ab93595
commit
805dca917a
|
@ -15,6 +15,10 @@
|
|||
#include <init.h>
|
||||
#include <soc.h>
|
||||
#include <cortex_m/exc.h>
|
||||
#include <logging/log.h>
|
||||
|
||||
#define LOG_LEVEL CONFIG_SOC_LOG_LEVEL
|
||||
LOG_MODULE_REGISTER(soc);
|
||||
|
||||
/* Power Manager Controller */
|
||||
|
||||
|
@ -254,6 +258,12 @@ static int atmel_same70_init(struct device *arg)
|
|||
|
||||
irq_unlock(key);
|
||||
|
||||
/* Check that the CHIP CIDR matches the HAL one */
|
||||
if (CHIPID->CHIPID_CIDR != CHIP_CIDR) {
|
||||
LOG_WRN("CIDR mismatch: chip = 0x%08x vs HAL = 0x%08x",
|
||||
(u32_t)CHIPID->CHIPID_CIDR, (u32_t)CHIP_CIDR);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue