From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lokesh Vutla Date: Thu, 25 Oct 2018 13:30:54 +0530 Subject: [U-Boot] [PATCH v3 04/10] armv7R: K3: am654: Add support to start ATF from R5 SPL In-Reply-To: <20181025080100.30176-1-lokeshvutla@ti.com> References: <20181025080100.30176-1-lokeshvutla@ti.com> Message-ID: <20181025080100.30176-5-lokeshvutla@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Considering the boot time requirements, Cortex-A core should be able to start immediately after SPL on R5. Add support for the same. Reviewed-by: Tom Rini Signed-off-by: Lokesh Vutla --- arch/arm/mach-k3/Kconfig | 7 ++++++ arch/arm/mach-k3/Makefile | 1 + arch/arm/mach-k3/common.c | 52 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 arch/arm/mach-k3/common.c diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig index 9f5e8e5ee4..e677a2e01b 100644 --- a/arch/arm/mach-k3/Kconfig +++ b/arch/arm/mach-k3/Kconfig @@ -58,5 +58,12 @@ config SYS_K3_BOOT_CORE_ID int default 16 +config SYS_K3_SPL_ATF + bool "Start Cortex-A from SPL" + depends on SPL && CPU_V7R + help + Enabling this will try to start Cortex-A (typically with ATF) + after SPL from R5. + source "board/ti/am65x/Kconfig" endif diff --git a/arch/arm/mach-k3/Makefile b/arch/arm/mach-k3/Makefile index 619733fb87..406dda3b02 100644 --- a/arch/arm/mach-k3/Makefile +++ b/arch/arm/mach-k3/Makefile @@ -6,3 +6,4 @@ obj-$(CONFIG_SOC_K3_AM6) += am6_init.o obj-$(CONFIG_ARM64) += arm64-mmu.o obj-$(CONFIG_CPU_V7R) += r5_mpu.o +obj-y += common.o diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c new file mode 100644 index 0000000000..cc89d4a296 --- /dev/null +++ b/arch/arm/mach-k3/common.c @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * K3: Common Architecture initialization + * + * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ + * Lokesh Vutla + */ + +#include +#include +#include "common.h" +#include +#include + +#ifdef CONFIG_SYS_K3_SPL_ATF +void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) +{ + int ret; + + /* + * It is assumed that remoteproc device 1 is the corresponding + * cortex A core which runs ATF. Make sure DT reflects the same. + */ + ret = rproc_dev_init(1); + if (ret) { + printf("%s: ATF failed to Initialize on rproc: ret= %d\n", + __func__, ret); + hang(); + } + + ret = rproc_load(1, spl_image->entry_point, 0x200); + if (ret) { + printf("%s: ATF failed to load on rproc: ret= %d\n", + __func__, ret); + hang(); + } + + /* Add an extra newline to differentiate the ATF logs from SPL*/ + printf("Starting ATF on ARM64 core...\n\n"); + + ret = rproc_start(1); + if (ret) { + printf("%s: ATF failed to start on rproc: ret= %d\n", + __func__, ret); + hang(); + } + + debug("ATF started. Wait indefiniely\n"); + while (1) + asm volatile("wfe"); +} +#endif -- 2.19.1