[PATCH 05/10] mach-snapdragon: Update gd->ram_size in msm_fixup_memory
Varadarajan Narayanan
quic_varada at quicinc.com
Mon Feb 26 11:08:02 CET 2024
* gd->ram_size: msm_fixup_memory calculates the amount of memory
present in the system. Update 'gd->ram_size' with the computed
value.
* Update FDT only if 'blob' is not null
Signed-off-by: Varadarajan Narayanan <quic_varada at quicinc.com>
---
arch/arm/mach-snapdragon/dram.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-snapdragon/dram.c b/arch/arm/mach-snapdragon/dram.c
index 499dfdf0da..08d681555d 100644
--- a/arch/arm/mach-snapdragon/dram.c
+++ b/arch/arm/mach-snapdragon/dram.c
@@ -74,10 +74,12 @@ int msm_fixup_memory(void *blob)
return -ENODEV;
}
+ gd->ram_size = 0;
/* Check validy of RAM */
for (i = 0; i < RAM_NUM_PART_ENTRIES; i++) {
p = &ram_ptable->parts[i];
if (p->category == CATEGORY_SDRAM && p->type == TYPE_SYSMEM) {
+ gd->ram_size += p->size;
bank_start[count] = p->start;
bank_size[count] = p->size;
debug("Detected memory bank %u: start: 0x%llx size: 0x%llx\n",
@@ -91,9 +93,9 @@ int msm_fixup_memory(void *blob)
return -ENODEV;
}
- ret = fdt_fixup_memory_banks(blob, bank_start, bank_size, count);
- if (ret)
- return ret;
+ if (blob)
+ return fdt_fixup_memory_banks(blob, bank_start,
+ bank_size, count);
- return 0;
+ return ret;
}
--
2.34.1
More information about the U-Boot
mailing list