Add support for fixing up DM firmware reserved memory in the kernel
device tree for K3 SoCs that use separate DM firmware.

The fixup uses the CONFIG_K3_DM_FW_RESERVED_ADDR and
CONFIG_K3_DM_FW_RESERVED_SIZE Kconfig options to update the
reserved-memory node with the correct DM firmware carveout.

Note that the fixup needs DM reserved memory node is to be renamed in
dts. Example memory@9c900000 → dm@9c900000

Signed-off-by: Paresh Bhagat <[email protected]>
---
 arch/arm/mach-k3/common_fdt.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-k3/common_fdt.c b/arch/arm/mach-k3/common_fdt.c
index 4b833f5fabe..18f30e9d052 100644
--- a/arch/arm/mach-k3/common_fdt.c
+++ b/arch/arm/mach-k3/common_fdt.c
@@ -160,9 +160,23 @@ int fdt_fixup_reserved(void *blob)
        if (ret)
                return ret;
 
-       return fdt_fixup_reserved_memory(blob, "optee",
-                                        CONFIG_K3_OPTEE_LOAD_ADDR,
-                                        CONFIG_K3_OPTEE_RESERVED_SIZE);
+       ret = fdt_fixup_reserved_memory(blob, "optee",
+                                       CONFIG_K3_OPTEE_LOAD_ADDR,
+                                       CONFIG_K3_OPTEE_RESERVED_SIZE);
+
+       if (ret)
+               return ret;
+
+#if defined(CONFIG_K3_DM_FW_RESERVED_ADDR) && 
defined(CONFIG_K3_DM_FW_RESERVED_SIZE)
+       ret = fdt_fixup_reserved_memory(blob, "dm",
+                                       CONFIG_K3_DM_FW_RESERVED_ADDR,
+                                       CONFIG_K3_DM_FW_RESERVED_SIZE);
+
+       if (ret)
+               return ret;
+#endif
+
+       return 0;
 }
 
 static int fdt_fixup_critical_trips(void *blob, int zoneoffset, int maxc)
-- 
2.34.1

Reply via email to