mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-04-24 23:31:31 +00:00
zynq: Add OF ram initialization support
Read ram size directly from DTB. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
This commit is contained in:
parent
345d3c0f01
commit
9e0e37accd
1 changed files with 21 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
#include <fdtdec.h>
|
||||||
#include <netdev.h>
|
#include <netdev.h>
|
||||||
#include <zynqpl.h>
|
#include <zynqpl.h>
|
||||||
#include <asm/arch/hardware.h>
|
#include <asm/arch/hardware.h>
|
||||||
|
@ -134,8 +135,27 @@ int board_mmc_init(bd_t *bd)
|
||||||
|
|
||||||
int dram_init(void)
|
int dram_init(void)
|
||||||
{
|
{
|
||||||
gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
|
#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();
|
zynq_ddrc_init();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue