From b921955e44eddf5344e197660919d1313f9d2679 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 5 Feb 2020 12:12:51 -0600 Subject: [PATCH] boards: arc: nsim: cleanup dts warnings Fix the following device tree warnings: unit-address and first reg (0x40000) don't match for iccm@0 unit-address and first reg (0x80040000) don't match for dccm@80000000 Re-work iccm and dccm reg address and size to be based on #defines. This allows the nsim_sem_normal.dts to override defaults that are set in nsim.dtsi. Utilize DT_ADDR macro to take a 'unit-address' still value and convert it into a hex value (just prepending 0x). Signed-off-by: Kumar Gala --- boards/arc/nsim/nsim.dtsi | 27 +++++++++++++++++++++++---- boards/arc/nsim/nsim_sem_normal.dts | 19 +++++++------------ soc/arc/snps_nsim/dts_fixup.h | 4 ++-- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/boards/arc/nsim/nsim.dtsi b/boards/arc/nsim/nsim.dtsi index aa0c0e6906b..4564e6c9691 100644 --- a/boards/arc/nsim/nsim.dtsi +++ b/boards/arc/nsim/nsim.dtsi @@ -7,6 +7,23 @@ /dts-v1/; #include "skeleton.dtsi" +#include + +#ifndef ICCM_ADDR +#define ICCM_ADDR 0 +#endif + +#ifndef ICCM_SIZE +#define ICCM_SIZE DT_SIZE_K(512) +#endif + +#ifndef DCCM_ADDR +#define DCCM_ADDR 80000000 +#endif + +#ifndef DCCM_SIZE +#define DCCM_SIZE DT_SIZE_K(512) +#endif / { cpus { @@ -20,14 +37,16 @@ }; }; - iccm0: iccm@0 { + iccm0: iccm@ICCM_ADDR { + device_type = "memory"; compatible = "arc,iccm"; - reg = <0x0 0x80000>; + reg = ; }; - dccm0: dccm@80000000 { + dccm0: dccm@DCCM_ADDR { compatible = "arc,dccm"; - reg = <0x80000000 0x80000>; + device_type = "memory"; + reg = ; }; uart0: uart@f0000000 { diff --git a/boards/arc/nsim/nsim_sem_normal.dts b/boards/arc/nsim/nsim_sem_normal.dts index 8e8cffcf32d..0d5d584da65 100644 --- a/boards/arc/nsim/nsim_sem_normal.dts +++ b/boards/arc/nsim/nsim_sem_normal.dts @@ -7,6 +7,13 @@ /dts-v1/; #include + +/* must be before include of nsim_em.dtsi */ +#define ICCM_ADDR 40000 +#define ICCM_SIZE DT_SIZE_K(256) +#define DCCM_ADDR 80040000 +#define DCCM_SIZE DT_SIZE_K(256) + #include "nsim_em.dtsi" / { @@ -14,18 +21,6 @@ model = "nsim_sem_normal"; compatible = "snps,nsim_sem_normal"; - iccm0: iccm@0 { - device_type = "memory"; - compatible = "arc,iccm"; - reg = <0x40000 DT_SIZE_K(256)>; - }; - - dccm0: dccm@80000000 { - device_type = "memory"; - compatible = "arc,dccm"; - reg = <0x80040000 DT_SIZE_K(256)>; - }; - chosen { zephyr,sram = &dccm0; }; diff --git a/soc/arc/snps_nsim/dts_fixup.h b/soc/arc/snps_nsim/dts_fixup.h index 1275d5949e1..2fa8e04c8f2 100644 --- a/soc/arc/snps_nsim/dts_fixup.h +++ b/soc/arc/snps_nsim/dts_fixup.h @@ -3,8 +3,8 @@ /* SoC level DTS fixup file */ /* CCM configuration */ -#define DT_DCCM_BASE_ADDRESS DT_ARC_DCCM_80000000_BASE_ADDRESS -#define DT_DCCM_SIZE (DT_ARC_DCCM_80000000_SIZE >> 10) +#define DT_DCCM_BASE_ADDRESS DT_INST_0_ARC_DCCM_BASE_ADDRESS +#define DT_DCCM_SIZE (DT_INST_0_ARC_DCCM_SIZE >> 10) #define DT_ICCM_BASE_ADDRESS DT_INST_0_ARC_ICCM_BASE_ADDRESS #define DT_ICCM_SIZE (DT_INST_0_ARC_ICCM_SIZE >> 10)