aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv8/fsl-layerscape
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/cpu/armv8/fsl-layerscape')
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/Kconfig60
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/Makefile1
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/ppa.c284
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/spl.c34
4 files changed, 0 insertions, 379 deletions
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
index d46934c..080fe3f 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
+++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
@@ -390,66 +390,6 @@ config HAS_FEATURE_ENHANCED_MSI
bool
default y if ARCH_LS1043A
-menu "Layerscape PPA"
-config FSL_LS_PPA
- bool "FSL Layerscape PPA firmware support"
- depends on !ARMV8_PSCI
- select ARMV8_SEC_FIRMWARE_SUPPORT
- select SEC_FIRMWARE_ARMV8_PSCI
- select ARMV8_SEC_FIRMWARE_ERET_ADDR_REVERT if FSL_LSCH2
- help
- The FSL Primary Protected Application (PPA) is a software component
- which is loaded during boot stage, and then remains resident in RAM
- and runs in the TrustZone after boot.
- Say y to enable it.
-
-config SPL_FSL_LS_PPA
- bool "FSL Layerscape PPA firmware support for SPL build"
- depends on !ARMV8_PSCI
- select SPL_ARMV8_SEC_FIRMWARE_SUPPORT
- select SEC_FIRMWARE_ARMV8_PSCI
- select ARMV8_SEC_FIRMWARE_ERET_ADDR_REVERT if FSL_LSCH2
- help
- The FSL Primary Protected Application (PPA) is a software component
- which is loaded during boot stage, and then remains resident in RAM
- and runs in the TrustZone after boot. This is to load PPA during SPL
- stage instead of the RAM version of U-Boot. Once PPA is initialized,
- the rest of U-Boot (including RAM version) runs at EL2.
-choice
- prompt "FSL Layerscape PPA firmware loading-media select"
- depends on FSL_LS_PPA
- default SYS_LS_PPA_FW_IN_MMC if SD_BOOT
- default SYS_LS_PPA_FW_IN_NAND if NAND_BOOT
- default SYS_LS_PPA_FW_IN_XIP
-
-config SYS_LS_PPA_FW_IN_XIP
- bool "XIP"
- help
- Say Y here if the PPA firmware locate at XIP flash, such
- as NOR or QSPI flash.
-
-config SYS_LS_PPA_FW_IN_MMC
- bool "eMMC or SD Card"
- help
- Say Y here if the PPA firmware locate at eMMC/SD card.
-
-config SYS_LS_PPA_FW_IN_NAND
- bool "NAND"
- help
- Say Y here if the PPA firmware locate at NAND flash.
-
-endchoice
-
-config LS_PPA_ESBC_HDR_SIZE
- hex "Length of PPA ESBC header"
- depends on FSL_LS_PPA && CHAIN_OF_TRUST && !SYS_LS_PPA_FW_IN_XIP
- default 0x2000
- help
- Length (in bytes) of PPA ESBC header to be copied from MMC/SD or
- NAND to memory to validate PPA image.
-
-endmenu
-
config SYS_FSL_ERRATUM_A008997
bool "Workaround for USB PHY erratum A008997"
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Makefile b/arch/arm/cpu/armv8/fsl-layerscape/Makefile
index 598c36e..eefdf12 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/Makefile
+++ b/arch/arm/cpu/armv8/fsl-layerscape/Makefile
@@ -10,7 +10,6 @@ obj-$(CONFIG_MP) += mp.o spintable.o
obj-$(CONFIG_OF_LIBFDT) += fdt.o
endif
obj-$(CONFIG_SPL) += spl.o
-obj-$(CONFIG_$(SPL_)FSL_LS_PPA) += ppa.o
ifneq ($(CONFIG_FSL_LSCH3),)
obj-y += fsl_lsch3_speed.o
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ppa.c b/arch/arm/cpu/armv8/fsl-layerscape/ppa.c
deleted file mode 100644
index 117b7a0..0000000
--- a/arch/arm/cpu/armv8/fsl-layerscape/ppa.c
+++ /dev/null
@@ -1,284 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2016 NXP Semiconductor, Inc.
- */
-#include <common.h>
-#include <log.h>
-#include <malloc.h>
-#include <config.h>
-#include <errno.h>
-#include <asm/cache.h>
-#include <asm/global_data.h>
-#include <asm/system.h>
-#include <asm/types.h>
-#include <asm/arch/soc.h>
-#ifdef CONFIG_FSL_LSCH3
-#include <asm/arch/immap_lsch3.h>
-#elif defined(CONFIG_FSL_LSCH2)
-#include <asm/arch/immap_lsch2.h>
-#endif
-#if CONFIG_IS_ENABLED(ARMV8_SEC_FIRMWARE_SUPPORT)
-#include <asm/armv8/sec_firmware.h>
-#endif
-#ifdef CONFIG_CHAIN_OF_TRUST
-#include <fsl_validate.h>
-#endif
-
-#ifdef CONFIG_SYS_LS_PPA_FW_IN_NAND
-#include <nand.h>
-#elif defined(CONFIG_SYS_LS_PPA_FW_IN_MMC)
-#include <mmc.h>
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-int ppa_init(void)
-{
- unsigned int el = current_el();
- void *ppa_fit_addr;
- u32 *boot_loc_ptr_l, *boot_loc_ptr_h;
- u32 *loadable_l, *loadable_h;
- int ret;
-
-#ifdef CONFIG_CHAIN_OF_TRUST
- uintptr_t ppa_esbc_hdr = 0;
- uintptr_t ppa_img_addr = 0;
-#if defined(CONFIG_SYS_LS_PPA_FW_IN_MMC) || \
- defined(CONFIG_SYS_LS_PPA_FW_IN_NAND)
- void *ppa_hdr_ddr;
-#endif
-#endif
-
- /* Skip if running at lower exception level */
- if (el < 3) {
- debug("Skipping PPA init, running at EL%d\n", el);
- return 0;
- }
-
-#ifdef CONFIG_SYS_LS_PPA_FW_IN_XIP
- ppa_fit_addr = (void *)CONFIG_SYS_LS_PPA_FW_ADDR;
- debug("%s: PPA image load from XIP\n", __func__);
-#ifdef CONFIG_CHAIN_OF_TRUST
- ppa_esbc_hdr = CONFIG_SYS_LS_PPA_ESBC_ADDR;
-#endif
-#else /* !CONFIG_SYS_LS_PPA_FW_IN_XIP */
- size_t fw_length, fdt_header_len = sizeof(struct fdt_header);
-
- /* Copy PPA image from MMC/SD/NAND to allocated memory */
-#ifdef CONFIG_SYS_LS_PPA_FW_IN_MMC
- struct mmc *mmc;
- int dev = CONFIG_SYS_MMC_ENV_DEV;
- struct fdt_header *fitp;
- u32 cnt;
- u32 blk;
-
- debug("%s: PPA image load from eMMC/SD\n", __func__);
-
- ret = mmc_initialize(gd->bd);
- if (ret) {
- printf("%s: mmc_initialize() failed\n", __func__);
- return ret;
- }
- mmc = find_mmc_device(dev);
- if (!mmc) {
- printf("PPA: MMC cannot find device for PPA firmware\n");
- return -ENODEV;
- }
-
- ret = mmc_init(mmc);
- if (ret) {
- printf("%s: mmc_init() failed\n", __func__);
- return ret;
- }
-
- fitp = malloc(roundup(fdt_header_len, 512));
- if (!fitp) {
- printf("PPA: malloc failed for FIT header(size 0x%zx)\n",
- roundup(fdt_header_len, 512));
- return -ENOMEM;
- }
-
- blk = CONFIG_SYS_LS_PPA_FW_ADDR / 512;
- cnt = DIV_ROUND_UP(fdt_header_len, 512);
- debug("%s: MMC read PPA FIT header: dev # %u, block # %u, count %u\n",
- __func__, dev, blk, cnt);
- ret = blk_dread(mmc_get_blk_desc(mmc), blk, cnt, fitp);
- if (ret != cnt) {
- free(fitp);
- printf("MMC/SD read of PPA FIT header at offset 0x%x failed\n",
- CONFIG_SYS_LS_PPA_FW_ADDR);
- return -EIO;
- }
-
- ret = fdt_check_header(fitp);
- if (ret) {
- free(fitp);
- printf("%s: fdt_check_header() failed\n", __func__);
- return ret;
- }
-
-#ifdef CONFIG_CHAIN_OF_TRUST
- ppa_hdr_ddr = malloc(CONFIG_LS_PPA_ESBC_HDR_SIZE);
- if (!ppa_hdr_ddr) {
- printf("PPA: malloc failed for PPA header\n");
- return -ENOMEM;
- }
-
- blk = CONFIG_SYS_LS_PPA_ESBC_ADDR >> 9;
- cnt = DIV_ROUND_UP(CONFIG_LS_PPA_ESBC_HDR_SIZE, 512);
- ret = blk_dread(mmc_get_blk_desc(mmc), blk, cnt, ppa_hdr_ddr);
- if (ret != cnt) {
- free(ppa_hdr_ddr);
- printf("MMC/SD read of PPA header failed\n");
- return -EIO;
- }
- debug("Read PPA header to 0x%p\n", ppa_hdr_ddr);
-
- ppa_esbc_hdr = (uintptr_t)ppa_hdr_ddr;
-#endif
-
- fw_length = fdt_totalsize(fitp);
- free(fitp);
-
- fw_length = roundup(fw_length, 512);
- ppa_fit_addr = malloc(fw_length);
- if (!ppa_fit_addr) {
- printf("PPA: malloc failed for PPA image(size 0x%zx)\n",
- fw_length);
- return -ENOMEM;
- }
-
- blk = CONFIG_SYS_LS_PPA_FW_ADDR / 512;
- cnt = DIV_ROUND_UP(fw_length, 512);
- debug("%s: MMC read PPA FIT image: dev # %u, block # %u, count %u\n",
- __func__, dev, blk, cnt);
- ret = blk_dread(mmc_get_blk_desc(mmc), blk, cnt, ppa_fit_addr);
- if (ret != cnt) {
- free(ppa_fit_addr);
- printf("MMC/SD read of PPA FIT header at offset 0x%x failed\n",
- CONFIG_SYS_LS_PPA_FW_ADDR);
- return -EIO;
- }
-
-#elif defined(CONFIG_SYS_LS_PPA_FW_IN_NAND)
- struct fdt_header fit;
-
- debug("%s: PPA image load from NAND\n", __func__);
-
- nand_init();
- ret = nand_read(get_nand_dev_by_index(0),
- (loff_t)CONFIG_SYS_LS_PPA_FW_ADDR,
- &fdt_header_len, (u_char *)&fit);
- if (ret == -EUCLEAN) {
- printf("NAND read of PPA FIT header at offset 0x%x failed\n",
- CONFIG_SYS_LS_PPA_FW_ADDR);
- return -EIO;
- }
-
- ret = fdt_check_header(&fit);
- if (ret) {
- printf("%s: fdt_check_header() failed\n", __func__);
- return ret;
- }
-
-#ifdef CONFIG_CHAIN_OF_TRUST
- ppa_hdr_ddr = malloc(CONFIG_LS_PPA_ESBC_HDR_SIZE);
- if (!ppa_hdr_ddr) {
- printf("PPA: malloc failed for PPA header\n");
- return -ENOMEM;
- }
-
- fw_length = CONFIG_LS_PPA_ESBC_HDR_SIZE;
-
- ret = nand_read(get_nand_dev_by_index(0),
- (loff_t)CONFIG_SYS_LS_PPA_ESBC_ADDR,
- &fw_length, (u_char *)ppa_hdr_ddr);
- if (ret == -EUCLEAN) {
- free(ppa_hdr_ddr);
- printf("NAND read of PPA firmware at offset 0x%x failed\n",
- CONFIG_SYS_LS_PPA_FW_ADDR);
- return -EIO;
- }
- debug("Read PPA header to 0x%p\n", ppa_hdr_ddr);
-
- ppa_esbc_hdr = (uintptr_t)ppa_hdr_ddr;
-#endif
-
- fw_length = fdt_totalsize(&fit);
-
- ppa_fit_addr = malloc(fw_length);
- if (!ppa_fit_addr) {
- printf("PPA: malloc failed for PPA image(size 0x%zx)\n",
- fw_length);
- return -ENOMEM;
- }
-
- ret = nand_read(get_nand_dev_by_index(0),
- (loff_t)CONFIG_SYS_LS_PPA_FW_ADDR,
- &fw_length, (u_char *)ppa_fit_addr);
- if (ret == -EUCLEAN) {
- free(ppa_fit_addr);
- printf("NAND read of PPA firmware at offset 0x%x failed\n",
- CONFIG_SYS_LS_PPA_FW_ADDR);
- return -EIO;
- }
-#else
-#error "No CONFIG_SYS_LS_PPA_FW_IN_xxx defined"
-#endif
-
-#endif
-
-#ifdef CONFIG_CHAIN_OF_TRUST
- ppa_img_addr = (uintptr_t)ppa_fit_addr;
- if (fsl_check_boot_mode_secure() != 0) {
- /*
- * In case of failure in validation, fsl_secboot_validate
- * would not return back in case of Production environment
- * with ITS=1. In Development environment (ITS=0 and
- * SB_EN=1), the function may return back in case of
- * non-fatal failures.
- */
- ret = fsl_secboot_validate(ppa_esbc_hdr,
- PPA_KEY_HASH,
- &ppa_img_addr);
- if (ret != 0)
- printf("SEC firmware(s) validation failed\n");
- else
- printf("SEC firmware(s) validation Successful\n");
- }
-#if defined(CONFIG_SYS_LS_PPA_FW_IN_MMC) || \
- defined(CONFIG_SYS_LS_PPA_FW_IN_NAND)
- free(ppa_hdr_ddr);
-#endif
-#endif
-
-#ifdef CONFIG_FSL_LSCH3
- struct ccsr_gur __iomem *gur = (void *)(CFG_SYS_FSL_GUTS_ADDR);
- boot_loc_ptr_l = &gur->bootlocptrl;
- boot_loc_ptr_h = &gur->bootlocptrh;
-
- /* Assign addresses to loadable ptrs */
- loadable_l = &gur->scratchrw[4];
- loadable_h = &gur->scratchrw[5];
-#elif defined(CONFIG_FSL_LSCH2)
- struct ccsr_scfg __iomem *scfg = (void *)(CFG_SYS_FSL_SCFG_ADDR);
- boot_loc_ptr_l = &scfg->scratchrw[1];
- boot_loc_ptr_h = &scfg->scratchrw[0];
-
- /* Assign addresses to loadable ptrs */
- loadable_l = &scfg->scratchrw[2];
- loadable_h = &scfg->scratchrw[3];
-#endif
-
- debug("fsl-ppa: boot_loc_ptr_l = 0x%p, boot_loc_ptr_h =0x%p\n",
- boot_loc_ptr_l, boot_loc_ptr_h);
- ret = sec_firmware_init(ppa_fit_addr, boot_loc_ptr_l, boot_loc_ptr_h,
- loadable_l, loadable_h);
-
-#if defined(CONFIG_SYS_LS_PPA_FW_IN_MMC) || \
- defined(CONFIG_SYS_LS_PPA_FW_IN_NAND)
- free(ppa_fit_addr);
-#endif
-
- return ret;
-}
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/spl.c b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
index 033f48d..232adfa 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/spl.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
@@ -21,7 +21,6 @@
#include <i2c.h>
#include <fsl_csu.h>
#include <asm/arch/fdt.h>
-#include <asm/arch/ppa.h>
#include <asm/arch/soc.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -62,9 +61,6 @@ void spl_board_init(void)
#ifdef CONFIG_LAYERSCAPE_NS_ACCESS
enable_layerscape_ns_access();
#endif
-#ifdef CONFIG_SPL_FSL_LS_PPA
- ppa_init();
-#endif
}
void tzpc_init(void)
@@ -120,36 +116,6 @@ void board_init_f(ulong dummy)
init_func_vid();
#endif
dram_init();
-#ifdef CONFIG_SPL_FSL_LS_PPA
-#ifndef CFG_SYS_MEM_RESERVE_SECURE
-#error Need secure RAM for PPA
-#endif
- /*
- * Secure memory location is determined in dram_init_banksize().
- * gd->ram_size is deducted by the size of secure ram.
- */
- dram_init_banksize();
-
- /*
- * After dram_init_bank_size(), we know U-Boot only uses the first
- * memory bank regardless how big the memory is.
- */
- gd->ram_top = gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size;
-
- /*
- * If PPA is loaded, U-Boot will resume running at EL2.
- * Cache and MMU will be enabled. Need a place for TLB.
- * U-Boot will be relocated to the end of available memory
- * in first bank. At this point, we cannot know how much
- * memory U-Boot uses. Put TLB table lower by SPL_TLB_SETBACK
- * to avoid overlapping. As soon as the RAM version U-Boot sets
- * up new MMU, this space is no longer needed.
- */
- gd->ram_top -= SPL_TLB_SETBACK;
- gd->arch.tlb_size = PGTABLE_SIZE;
- gd->arch.tlb_addr = (gd->ram_top - gd->arch.tlb_size) & ~(0x10000 - 1);
- gd->arch.tlb_allocated = gd->arch.tlb_addr;
-#endif /* CONFIG_SPL_FSL_LS_PPA */
#if defined(CONFIG_QSPI_AHB_INIT) && defined(CONFIG_QSPI_BOOT)
qspi_ahb_init();
#endif