diff options
-rw-r--r-- | arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi | 4 | ||||
-rw-r--r-- | arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 4 | ||||
-rw-r--r-- | arch/arm/dts/k3-binman.dtsi | 8 | ||||
-rw-r--r-- | arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi | 4 | ||||
-rw-r--r-- | arch/arm/mach-k3/Kconfig | 10 | ||||
-rw-r--r-- | arch/arm/mach-k3/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-k3/am625_fdt.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-k3/am62a7_fdt.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-k3/am62ax/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-k3/am62x/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/mach-k3/common_fdt.c | 52 | ||||
-rw-r--r-- | arch/arm/mach-k3/common_fdt.h | 2 | ||||
-rw-r--r-- | configs/am62ax_evm_a53_defconfig | 1 | ||||
-rw-r--r-- | configs/am62x_beagleplay_a53_defconfig | 1 | ||||
-rw-r--r-- | configs/am62x_evm_a53_defconfig | 1 | ||||
-rw-r--r-- | configs/phycore_am62x_a53_defconfig | 1 | ||||
-rw-r--r-- | configs/verdin-am62_a53_defconfig | 2 |
17 files changed, 96 insertions, 17 deletions
diff --git a/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi index a723caa..cca0f44 100644 --- a/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi +++ b/arch/arm/dts/k3-am625-beagleplay-u-boot.dtsi @@ -105,8 +105,8 @@ arch = "arm64"; compression = "none"; os = "tee"; - load = <0x9e800000>; - entry = <0x9e800000>; + load = <CONFIG_K3_OPTEE_LOAD_ADDR>; + entry = <CONFIG_K3_OPTEE_LOAD_ADDR>; tee-os { filename = "tee-raw.bin"; }; diff --git a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi index 64318d0..3a6db91 100644 --- a/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi +++ b/arch/arm/dts/k3-am65-iot2050-boot-image.dtsi @@ -51,8 +51,8 @@ arch = "arm64"; compression = "none"; os = "tee"; - load = <0x9e800000>; - entry = <0x9e800000>; + load = <CONFIG_K3_OPTEE_LOAD_ADDR>; + entry = <CONFIG_K3_OPTEE_LOAD_ADDR>; tee-os { }; }; diff --git a/arch/arm/dts/k3-binman.dtsi b/arch/arm/dts/k3-binman.dtsi index 5ef5af3..5163161 100644 --- a/arch/arm/dts/k3-binman.dtsi +++ b/arch/arm/dts/k3-binman.dtsi @@ -286,8 +286,8 @@ arch = "arm64"; compression = "none"; os = "tee"; - load = <0x9e800000>; - entry = <0x9e800000>; + load = <CONFIG_K3_OPTEE_LOAD_ADDR>; + entry = <CONFIG_K3_OPTEE_LOAD_ADDR>; ti-secure { content = <&tee>; keyfile = "custMpk.pem"; @@ -357,8 +357,8 @@ arch = "arm64"; compression = "none"; os = "tee"; - load = <0x9e800000>; - entry = <0x9e800000>; + load = <CONFIG_K3_OPTEE_LOAD_ADDR>; + entry = <CONFIG_K3_OPTEE_LOAD_ADDR>; tee-os { filename = "tee-raw.bin"; optional; diff --git a/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi b/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi index f83caf7..116ee37 100644 --- a/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi +++ b/arch/arm/dts/k3-j721e-beagleboneai64-u-boot.dtsi @@ -248,8 +248,8 @@ arch = "arm64"; compression = "none"; os = "tee"; - load = <0x9e800000>; - entry = <0x9e800000>; + load = <CONFIG_K3_OPTEE_LOAD_ADDR>; + entry = <CONFIG_K3_OPTEE_LOAD_ADDR>; tee-os { filename = "tee-raw.bin"; }; diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig index cb83bd2..fc971d5 100644 --- a/arch/arm/mach-k3/Kconfig +++ b/arch/arm/mach-k3/Kconfig @@ -118,9 +118,17 @@ config K3_EARLY_CONS_IDX config K3_ATF_LOAD_ADDR hex "Load address of ATF image" + default 0x80000000 if (SOC_K3_AM625 || SOC_K3_AM62A7) default 0x70000000 help - The load address for the ATF image. This value defaults to 0x70000000 + 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_OPTEE_LOAD_ADDR + hex "Load address of OPTEE image" + default 0x9e800000 + help + The load address for the OPTEE image. This value defaults to 0x9e800000 if not provided in the board defconfig file. config K3_DM_FW diff --git a/arch/arm/mach-k3/Makefile b/arch/arm/mach-k3/Makefile index 19b2d79..310a4c2 100644 --- a/arch/arm/mach-k3/Makefile +++ b/arch/arm/mach-k3/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_SOC_K3_AM654) += am654_fdt.o obj-$(CONFIG_SOC_K3_J721E) += j721e_fdt.o obj-$(CONFIG_SOC_K3_J721S2) += j721s2_fdt.o obj-$(CONFIG_SOC_K3_AM625) += am625_fdt.o +obj-$(CONFIG_SOC_K3_AM62A7) += am62a7_fdt.o obj-$(CONFIG_SOC_K3_J784S4) += j784s4_fdt.o endif ifeq ($(CONFIG_SPL_BUILD),y) diff --git a/arch/arm/mach-k3/am625_fdt.c b/arch/arm/mach-k3/am625_fdt.c index 3c46d10..c56adef 100644 --- a/arch/arm/mach-k3/am625_fdt.c +++ b/arch/arm/mach-k3/am625_fdt.c @@ -80,6 +80,8 @@ int ft_system_setup(void *blob, struct bd_info *bd) fdt_fixup_gpu_nodes_am625(blob, k3_has_gpu()); fdt_fixup_pru_node_am625(blob, k3_has_pru()); fdt_fixup_thermal_zone_nodes_am625(blob, k3_get_max_temp()); + fdt_fixup_reserved(blob, "tfa", CONFIG_K3_ATF_LOAD_ADDR, 0x80000); + fdt_fixup_reserved(blob, "optee", CONFIG_K3_OPTEE_LOAD_ADDR, 0x1800000); return 0; } diff --git a/arch/arm/mach-k3/am62a7_fdt.c b/arch/arm/mach-k3/am62a7_fdt.c new file mode 100644 index 0000000..d67f012 --- /dev/null +++ b/arch/arm/mach-k3/am62a7_fdt.c @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/ + */ + +#include <asm/hardware.h> +#include "common_fdt.h" +#include <fdt_support.h> + +int ft_system_setup(void *blob, struct bd_info *bd) +{ + fdt_fixup_reserved(blob, "tfa", CONFIG_K3_ATF_LOAD_ADDR, 0x80000); + fdt_fixup_reserved(blob, "optee", CONFIG_K3_OPTEE_LOAD_ADDR, 0x1800000); + + return 0; +} diff --git a/arch/arm/mach-k3/am62ax/Kconfig b/arch/arm/mach-k3/am62ax/Kconfig index c5f1ef8..bbd5497 100644 --- a/arch/arm/mach-k3/am62ax/Kconfig +++ b/arch/arm/mach-k3/am62ax/Kconfig @@ -13,6 +13,7 @@ config TARGET_AM62A7_A53_EVM bool "TI K3 based AM62A7 EVM running on A53" select ARM64 select BINMAN + select OF_SYSTEM_SETUP imply BOARD imply SPL_BOARD imply TI_I2C_BOARD_DETECT diff --git a/arch/arm/mach-k3/am62x/Kconfig b/arch/arm/mach-k3/am62x/Kconfig index 935d596..7c9bac2 100644 --- a/arch/arm/mach-k3/am62x/Kconfig +++ b/arch/arm/mach-k3/am62x/Kconfig @@ -13,6 +13,7 @@ config TARGET_AM625_A53_EVM bool "TI K3 based AM625 EVM running on A53" select ARM64 select BINMAN + select OF_SYSTEM_SETUP config TARGET_AM625_R5_EVM bool "TI K3 based AM625 EVM running on R5" @@ -29,6 +30,7 @@ config TARGET_PHYCORE_AM62X_A53 bool "PHYTEC phyCORE-AM62x running on A53" select ARM64 select BINMAN + select OF_SYSTEM_SETUP config TARGET_PHYCORE_AM62X_R5 bool "PHYTEC phyCORE-AM62x running on R5" @@ -45,6 +47,7 @@ config TARGET_VERDIN_AM62_A53 bool "Toradex Verdin AM62 running on A53" select ARM64 select BINMAN + select OF_SYSTEM_SETUP config TARGET_VERDIN_AM62_R5 bool "Toradex Verdin AM62 running on R5" diff --git a/arch/arm/mach-k3/common_fdt.c b/arch/arm/mach-k3/common_fdt.c index 645c4de..3bdedd7 100644 --- a/arch/arm/mach-k3/common_fdt.c +++ b/arch/arm/mach-k3/common_fdt.c @@ -112,3 +112,55 @@ int fdt_del_node_path(void *blob, const char *path) return ret; } + +int fdt_fixup_reserved(void *blob, const char *name, + unsigned int new_address, unsigned int new_size) +{ + int nodeoffset, subnode; + int ret; + + /* Find reserved-memory */ + nodeoffset = fdt_subnode_offset(blob, 0, "reserved-memory"); + if (nodeoffset < 0) { + debug("Could not find reserved-memory node\n"); + return 0; + } + + /* Find existing matching subnode and remove it */ + fdt_for_each_subnode(subnode, blob, nodeoffset) { + const char *node_name; + fdt_addr_t addr; + fdt_size_t size; + + /* Name matching */ + node_name = fdt_get_name(blob, subnode, NULL); + if (!name) + return -EINVAL; + if (!strncmp(node_name, name, strlen(name))) { + /* Read out old size first */ + addr = fdtdec_get_addr_size(blob, subnode, "reg", &size); + if (addr == FDT_ADDR_T_NONE) + return -EINVAL; + new_size = size; + + /* Delete node */ + ret = fdt_del_node(blob, subnode); + if (ret < 0) + return ret; + + /* Only one matching node */ + break; + } + } + + struct fdt_memory carveout = { + .start = new_address, + .end = new_address + new_size - 1, + }; + ret = fdtdec_add_reserved_memory(blob, name, &carveout, NULL, 0, NULL, + FDTDEC_RESERVED_MEMORY_NO_MAP); + if (ret < 0) + return ret; + + return 0; +} diff --git a/arch/arm/mach-k3/common_fdt.h b/arch/arm/mach-k3/common_fdt.h index 4d23ae6..52c0795 100644 --- a/arch/arm/mach-k3/common_fdt.h +++ b/arch/arm/mach-k3/common_fdt.h @@ -8,5 +8,7 @@ int fdt_fixup_msmc_ram_k3(void *blob); int fdt_del_node_path(void *blob, const char *path); +int fdt_fixup_reserved(void *blob, const char *name, + unsigned int new_address, unsigned int new_size); #endif /* _COMMON_FDT_H */ diff --git a/configs/am62ax_evm_a53_defconfig b/configs/am62ax_evm_a53_defconfig index e5fcd8c..e4490c2 100644 --- a/configs/am62ax_evm_a53_defconfig +++ b/configs/am62ax_evm_a53_defconfig @@ -5,7 +5,6 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_NR_DRAM_BANKS=2 CONFIG_SOC_K3_AM62A7=y -CONFIG_K3_ATF_LOAD_ADDR=0x9e780000 CONFIG_TARGET_AM62A7_A53_EVM=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000 diff --git a/configs/am62x_beagleplay_a53_defconfig b/configs/am62x_beagleplay_a53_defconfig index 1f43891..8a9edbf 100644 --- a/configs/am62x_beagleplay_a53_defconfig +++ b/configs/am62x_beagleplay_a53_defconfig @@ -6,7 +6,6 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_NR_DRAM_BANKS=2 CONFIG_SOC_K3_AM625=y -CONFIG_K3_ATF_LOAD_ADDR=0x9e780000 CONFIG_TARGET_AM625_A53_BEAGLEPLAY=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80b80000 diff --git a/configs/am62x_evm_a53_defconfig b/configs/am62x_evm_a53_defconfig index a39b82d..1c75069 100644 --- a/configs/am62x_evm_a53_defconfig +++ b/configs/am62x_evm_a53_defconfig @@ -5,7 +5,6 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_NR_DRAM_BANKS=2 CONFIG_SOC_K3_AM625=y -CONFIG_K3_ATF_LOAD_ADDR=0x9e780000 CONFIG_TARGET_AM625_A53_EVM=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80b80000 diff --git a/configs/phycore_am62x_a53_defconfig b/configs/phycore_am62x_a53_defconfig index 2d5d906..5ba0844 100644 --- a/configs/phycore_am62x_a53_defconfig +++ b/configs/phycore_am62x_a53_defconfig @@ -5,7 +5,6 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_NR_DRAM_BANKS=2 CONFIG_SOC_K3_AM625=y -CONFIG_K3_ATF_LOAD_ADDR=0x9e780000 CONFIG_TARGET_PHYCORE_AM62X_A53=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80b80000 diff --git a/configs/verdin-am62_a53_defconfig b/configs/verdin-am62_a53_defconfig index 956e3a1..902c437 100644 --- a/configs/verdin-am62_a53_defconfig +++ b/configs/verdin-am62_a53_defconfig @@ -8,7 +8,6 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_NR_DRAM_BANKS=2 CONFIG_SOC_K3_AM625=y -CONFIG_K3_ATF_LOAD_ADDR=0x9e780000 CONFIG_TARGET_VERDIN_AM62_A53=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80b80000 @@ -38,7 +37,6 @@ CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_SYS_BOOTM_LEN=0x40000000 CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTDELAY=1 -CONFIG_OF_SYSTEM_SETUP=y CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile k3-am625-verdin-${variant}-${fdt_board}.dtb" CONFIG_LOG=y |