]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
stm32mp: dram_init: Get RAM size from DT if no RAM driver found
authorPatrice Chotard <patrice.chotard@st.com>
Fri, 27 Oct 2023 14:42:57 +0000 (16:42 +0200)
committerPatrice Chotard <patrice.chotard@foss.st.com>
Mon, 13 Nov 2023 09:55:38 +0000 (10:55 +0100)
In case there is no RAM driver retrieve RAM size from DT as fallback.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
arch/arm/mach-stm32mp/dram_init.c

index 7f37b0d2aa2cdd50649fc86ac8133ad35a5750b1..a1e77a42e4f60bac074c26fffa2c263257f5c7d0 100644 (file)
@@ -24,8 +24,11 @@ int dram_init(void)
        int ret;
 
        ret = uclass_get_device(UCLASS_RAM, 0, &dev);
-       if (ret) {
-               log_debug("RAM init failed: %d\n", ret);
+       /* in case there is no RAM driver, retrieve DDR size from DT */
+       if (ret == -ENODEV) {
+               return fdtdec_setup_mem_size_base();
+       } else if (ret) {
+               log_err("RAM init failed: %d\n", ret);
                return ret;
        }
        ret = ram_get_info(dev, &ram);