summaryrefslogtreecommitdiff
path: root/lib/fdtdec.c
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2018-09-09 16:30:11 +0200
committerTom Rini <trini@konsulko.com>2018-09-10 09:05:41 -0400
commitf850371997fb3688885a814902fed07d22f113ef (patch)
tree33104232a8e4f5298a940fb265ea5f1f27374f49 /lib/fdtdec.c
parent792b204798453d96b00e0817e8472c19455e92a2 (diff)
fdt: fix get_next_memory_node()
The get_next_memory_node() always sets mem to -1 , which is incorrect, because then every iteration of memory bank parsing will start from the first memory bank instead of the previous one. On systems with 1 memory bank defined in DT and CONFIG_NR_DRAM_BANKS=4 , like ie. r8a77965-salvator-x , this will result in U-Boot incorrectly reporting four identical memory banks with the same memory configuration. Fix this by setting mem to startoffset value, which restores the behavior before the fixed patch was applied. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Jens Wiklander <jens.wiklander@linaro.org> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Fixes: 452bc121027d ("fdt: fix fdtdec_setup_memory_banksize()") Tested-by: Michal Simek <michal.simek@xilinx.com> [on ZynqMP}
Diffstat (limited to 'lib/fdtdec.c')
-rw-r--r--lib/fdtdec.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index a208589c48..b2ec12e9b5 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1182,10 +1182,8 @@ int fdtdec_setup_mem_size_base(void)
#if defined(CONFIG_NR_DRAM_BANKS)
-static int get_next_memory_node(const void *blob, int startoffset)
+static int get_next_memory_node(const void *blob, int mem)
{
- int mem = -1;
-
do {
mem = fdt_node_offset_by_prop_value(gd->fdt_blob, mem,
"device_type", "memory", 7);