Skip to content
Permalink
Browse files

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>
  • Loading branch information...
aurel32 authored and nashif committed Feb 7, 2019
1 parent 997ab93 commit 805dca917ad75c19177b141a48df54c0ae34f0fd
Showing with 10 additions and 0 deletions.
  1. +10 −0 soc/arm/atmel_sam/same70/soc.c
@@ -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;
}

0 comments on commit 805dca9

Please sign in to comment.
You can’t perform that action at this time.