diff options
author | Michal Simek <michal.simek@xilinx.com> | 2014-02-24 11:16:32 +0100 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-03-04 09:27:36 -0500 |
commit | 9e0e37accde19e513caaddb18ad22a573910dbe7 (patch) | |
tree | 8b6446e5caab7ed24a172109072736bc4e1bd867 /board/xilinx | |
parent | 345d3c0f01172995da749fb9ac57faa8b639cfdc (diff) | |
download | u-boot-9e0e37accde19e513caaddb18ad22a573910dbe7.tar.gz u-boot-9e0e37accde19e513caaddb18ad22a573910dbe7.tar.bz2 u-boot-9e0e37accde19e513caaddb18ad22a573910dbe7.zip |
zynq: Add OF ram initialization support
Read ram size directly from DTB.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'board/xilinx')
-rw-r--r-- | board/xilinx/zynq/board.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 82f2345c95..485a5e4a24 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -5,6 +5,7 @@ */ #include <common.h> +#include <fdtdec.h> #include <netdev.h> #include <zynqpl.h> #include <asm/arch/hardware.h> @@ -134,8 +135,27 @@ int board_mmc_init(bd_t *bd) int dram_init(void) { +#ifdef CONFIG_OF_CONTROL + int node; + fdt_addr_t addr; + fdt_size_t size; + const void *blob = gd->fdt_blob; + + node = fdt_node_offset_by_prop_value(blob, -1, "device_type", + "memory", 7); + if (node == -FDT_ERR_NOTFOUND) { + debug("ZYNQ DRAM: Can't get memory node\n"); + return -1; + } + addr = fdtdec_get_addr_size(blob, node, "reg", &size); + if (addr == FDT_ADDR_T_NONE || size == 0) { + debug("ZYNQ DRAM: Can't get base address or size\n"); + return -1; + } + gd->ram_size = size; +#else gd->ram_size = CONFIG_SYS_SDRAM_SIZE; - +#endif zynq_ddrc_init(); return 0; |