From mboxrd@z Thu Jan 1 00:00:00 1970 From: Beniamino Galvani Date: Sun, 3 Apr 2016 09:18:12 +0200 Subject: [U-Boot] [PATCH v2 4/9] arm: meson: use device tree In-Reply-To: <1459667897-2824-1-git-send-email-b.galvani@gmail.com> References: <1459667897-2824-1-git-send-email-b.galvani@gmail.com> Message-ID: <1459667897-2824-5-git-send-email-b.galvani@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Convert the board and config files to the use of device tree. Signed-off-by: Beniamino Galvani --- 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 +#include +#include #include #include @@ -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