dm: core: Add size operations on device tree references
Add functions to add size of addresses in the device tree using ofnode
references.
If the size is not set, return FDT_SIZE_T_NONE.
Signed-off-by: Chen Guanqiao <chenguanqiao@kuaishou.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 62d1660..e0a49b1 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -24,15 +24,16 @@
typedef phys_addr_t fdt_addr_t;
typedef phys_size_t fdt_size_t;
-#ifdef CONFIG_PHYS_64BIT
#define FDT_ADDR_T_NONE (-1U)
+#define FDT_SIZE_T_NONE (-1U)
+
+#ifdef CONFIG_PHYS_64BIT
#define fdt_addr_to_cpu(reg) be64_to_cpu(reg)
#define fdt_size_to_cpu(reg) be64_to_cpu(reg)
#define cpu_to_fdt_addr(reg) cpu_to_be64(reg)
#define cpu_to_fdt_size(reg) cpu_to_be64(reg)
typedef fdt64_t fdt_val_t;
#else
-#define FDT_ADDR_T_NONE (-1U)
#define fdt_addr_to_cpu(reg) be32_to_cpu(reg)
#define fdt_size_to_cpu(reg) be32_to_cpu(reg)
#define cpu_to_fdt_addr(reg) cpu_to_be32(reg)