Setup the malloc base and limit for the SPL to be able to use the memory
allocation APIs.

Reviewed-by: Balaji Selvanathan <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Signed-off-by: Varadarajan Narayanan <[email protected]>
---
 arch/arm/mach-snapdragon/board_spl.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/mach-snapdragon/board_spl.c 
b/arch/arm/mach-snapdragon/board_spl.c
index c5e86458616..25b1779391a 100644
--- a/arch/arm/mach-snapdragon/board_spl.c
+++ b/arch/arm/mach-snapdragon/board_spl.c
@@ -238,3 +238,18 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc 
*mmc, ulong raw_sect)
        return 0;
 }
 #endif /* CONFIG_IS_ENABLED(MMC) */
+
+void qcom_spl_malloc_init_f(void)
+{
+       if (!CONFIG_IS_ENABLED(SYS_MALLOC_F))
+               return;
+       /*
+        * Set up by crt0.S
+        */
+       assert(gd->malloc_base);
+       gd->malloc_limit = CONFIG_VAL(SYS_MALLOC_F_LEN);
+       gd->malloc_ptr = 0;
+
+       mem_malloc_init(gd->malloc_base, gd->malloc_limit);
+       gd->flags |= GD_FLG_FULL_MALLOC_INIT;
+}

-- 
2.34.1

Reply via email to