Convert the board and config files to the use of device tree. Signed-off-by: Beniamino Galvani <b.galv...@gmail.com> --- arch/arm/mach-meson/board.c | 25 +++++++++++++++++++++++++ configs/odroid-c2_defconfig | 2 ++ 2 files changed, 27 insertions(+)
diff --git a/arch/arm/mach-meson/board.c b/arch/arm/mach-meson/board.c index 346a2c2..945a5f4 100644 --- a/arch/arm/mach-meson/board.c +++ b/arch/arm/mach-meson/board.c @@ -5,6 +5,8 @@ */ #include <common.h> +#include <libfdt.h> +#include <linux/err.h> #include <asm/arch/gxbb.h> #include <asm/armv8/mmu.h> @@ -17,9 +19,32 @@ int board_init(void) int dram_init(void) { + const fdt32_t *val; + int offset; + int len; + + offset = fdt_path_offset(gd->fdt_blob, "/memory"); + if (offset < 0) + return -EINVAL; + + val = fdt_getprop(gd->fdt_blob, offset, "reg", &len); + if (len < sizeof(*val) * 4) + return -EINVAL; + + /* Don't use fdt64_t to avoid unaligned access */ + gd->ram_size = (uint64_t)fdt32_to_cpu(val[2]) << 32; + gd->ram_size |= fdt32_to_cpu(val[3]); + return 0; } +void dram_init_banksize(void) +{ + /* Reserve first 16 MiB of RAM */ + gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE + (16 * 1024 * 1024); + gd->bd->bi_dram[0].size = gd->ram_size - (16 * 1024 * 1024); +} + void reset_cpu(ulong addr) { } diff --git a/configs/odroid-c2_defconfig b/configs/odroid-c2_defconfig index 8e6df12..765076a 100644 --- a/configs/odroid-c2_defconfig +++ b/configs/odroid-c2_defconfig @@ -2,6 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_MESON=y CONFIG_MESON_GXBB=y CONFIG_TARGET_ODROID_C2=y +CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-odroidc2" # CONFIG_CMD_BDI is not set # CONFIG_CMD_IMI is not set # CONFIG_CMD_IMLS is not set @@ -9,3 +10,4 @@ CONFIG_TARGET_ODROID_C2=y # CONFIG_CMD_FPGA is not set # CONFIG_CMD_SOURCE is not set # CONFIG_CMD_SETEXPR is not set +CONFIG_OF_CONTROL=y -- 2.7.3 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot