From: Marek Vasut Date: Mon, 10 Sep 2018 13:27:42 +0200 Subject: [U-Boot] [PATCH] fdt: fix get_next_memory_node() In-Reply-To: <42dc85d5-d3e3-030e-9feb-cf98e8388be7@monstr.eu> References: <20180909143011.4001-1-marek.vasut+renesas@gmail.com> <42dc85d5-d3e3-030e-9feb-cf98e8388be7@monstr.eu> Message-ID: <4abcff91-4158-d2c4-47c1-ad1f8f16a0a8@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 On 09/10/2018 01:23 PM, Michal Simek wrote: > On 9.9.2018 16:30, Marek Vasut wrote: >> 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 >> Cc: Jens Wiklander >> Cc: Simon Glass >> Cc: Tom Rini >> Fixes: 452bc121027d ("fdt: fix fdtdec_setup_memory_banksize()") > > > Tested-by: Michal Simek [on ZynqMP} > > Before > arch_number = 0x00000000 > boot_params = 0x00000000 > DRAM bank = 0x00000000 > -> start = 0x00000000 > -> size = 0x10000000 > DRAM bank = 0x00000001 > -> start = 0x10000000 > -> size = 0x40000000 > DRAM bank = 0x00000002 > -> start = 0x50000000 > -> size = 0x30000000 > DRAM bank = 0x00000003 > -> start = 0x00000000 > -> size = 0x10000000 > > > after > arch_number = 0x00000000 > boot_params = 0x00000000 > DRAM bank = 0x00000000 > -> start = 0x00000000 > -> size = 0x10000000 > DRAM bank = 0x00000001 > -> start = 0x10000000 > -> size = 0x40000000 > DRAM bank = 0x00000002 > -> start = 0x50000000 > -> size = 0x30000000 That's on a system with three banks, so it was broken before this patch? -- Best regards, Marek Vasut