]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
arm: mach-k3: use Kconfig options for ATF/OPTEE size
authorAnshul Dalal <anshuld@ti.com>
Thu, 12 Mar 2026 03:43:24 +0000 (09:13 +0530)
committerTom Rini <trini@konsulko.com>
Wed, 25 Mar 2026 20:37:09 +0000 (14:37 -0600)
The reserved memory sizes for ATF and OPTEE were hard-coded for K3
devices, this patch replaces them with a Kconfig option allowing for
easier modifications.

Acked-by: Andrew Davis <afd@ti.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Manorit Chawdhry <m-chawdhry@ti.com>
Signed-off-by: Anshul Dalal <anshuld@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
arch/arm/dts/k3-binman.dtsi
arch/arm/mach-k3/Kconfig
arch/arm/mach-k3/common_fdt.c

index 0fd93f9536a2f2f11b2fbd2b4797a0c48a5cde44..ad127663d03b397d2ff76819bcdd2351fa55ee91 100644 (file)
                                                FWPERM_SECURE_PRIV_RWCD |
                                                FWPERM_SECURE_USER_RWCD)>;
                start_address = <0x0 CONFIG_K3_ATF_LOAD_ADDR>;
-               end_address = <0x0 (CONFIG_K3_ATF_LOAD_ADDR + 0x1ffff)>;
+               end_address = <0x0 (CONFIG_K3_ATF_LOAD_ADDR + CONFIG_K3_ATF_RESERVED_SIZE - 1)>;
        };
        firewall_armv8_optee_fg: template-8 {
                control = <(FWCTRL_EN | FWCTRL_LOCK |
                                                FWPERM_SECURE_PRIV_RWCD |
                                                FWPERM_SECURE_USER_RWCD)>;
                start_address = <0x0 CONFIG_K3_OPTEE_LOAD_ADDR>;
-               end_address = <0x0 (CONFIG_K3_OPTEE_LOAD_ADDR + 0x17fffff)>;
+               end_address = <0x0 (CONFIG_K3_OPTEE_LOAD_ADDR + CONFIG_K3_OPTEE_RESERVED_SIZE - 1)>;
        };
 
        ti_falcon_template: template-9 {
index 1b8c0b1eb968f0414107c0bf3142f744ce8364c8..a32ed3a9683ffb1bc57deb88468409d0b29c3268 100644 (file)
@@ -130,6 +130,15 @@ config K3_ATF_LOAD_ADDR
          The load address for the ATF image. This value is used to build the
          FIT image header that places ATF in memory where it will run.
 
+config K3_ATF_RESERVED_SIZE
+       hex "Reserved memory size for ATF"
+       default 0x80000 if (SOC_K3_AM625 || SOC_K3_AM62A7 || SOC_K3_AM62P5 || SOC_K3_J722S)
+       default 0x20000
+       help
+         The runtime memory size reserved for ATF. This value is used to fixup the
+         kernel device-tree's reserved-memory node for ATF and configure the
+         firewall.
+
 config K3_OPTEE_LOAD_ADDR
        hex "Load address of OPTEE image"
        default 0x9e800000
@@ -137,6 +146,14 @@ config K3_OPTEE_LOAD_ADDR
          The load address for the OPTEE image. This value defaults to 0x9e800000
          if not provided in the board defconfig file.
 
+config K3_OPTEE_RESERVED_SIZE
+       hex "Reserved memory size for OPTEE"
+       default 0x1800000
+       help
+         The runtime memory size reserved for OPTEE. This value is used to fixup
+         the kernel device-tree's reserved-memory node for OPTEE and configure the
+         firewall.
+
 config K3_DM_FW
        bool "Separate DM firmware image"
        depends on CPU_V7R && !SOC_K3_AM642 && !SOC_K3_AM654 && !CLK_TI_SCI && !TI_SCI_POWER_DOMAIN
index cb0fb8274a5bf0f17305f1c7d22b9428e8f99b1d..39cb00c3f4394a13ad78466c327e0c7627489e1e 100644 (file)
@@ -173,12 +173,13 @@ int fdt_fixup_reserved(void *blob)
        int ret;
 
        ret = fdt_fixup_reserved_memory(blob, "tfa", CONFIG_K3_ATF_LOAD_ADDR,
-                                       0x80000);
+                                       CONFIG_K3_ATF_RESERVED_SIZE);
        if (ret)
                return ret;
 
        return fdt_fixup_reserved_memory(blob, "optee",
-                                        CONFIG_K3_OPTEE_LOAD_ADDR, 0x1800000);
+                                        CONFIG_K3_OPTEE_LOAD_ADDR,
+                                        CONFIG_K3_OPTEE_RESERVED_SIZE);
 }
 
 static int fdt_fixup_critical_trips(void *blob, int zoneoffset, int maxc)