2 * Copyright 2016 NXP Semiconductor, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
9 #include <asm/system.h>
10 #include <asm/types.h>
11 #include <asm/arch/soc.h>
12 #ifdef CONFIG_FSL_LSCH3
13 #include <asm/arch/immap_lsch3.h>
14 #elif defined(CONFIG_FSL_LSCH2)
15 #include <asm/arch/immap_lsch2.h>
17 #ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT
18 #include <asm/armv8/sec_firmware.h>
20 #ifdef CONFIG_CHAIN_OF_TRUST
21 #include <fsl_validate.h>
26 const void *ppa_fit_addr;
27 u32 *boot_loc_ptr_l, *boot_loc_ptr_h;
30 #ifdef CONFIG_CHAIN_OF_TRUST
31 uintptr_t ppa_esbc_hdr = CONFIG_SYS_LS_PPA_ESBC_ADDR;
32 uintptr_t ppa_img_addr = 0;
35 #ifdef CONFIG_SYS_LS_PPA_FW_IN_XIP
36 ppa_fit_addr = (void *)CONFIG_SYS_LS_PPA_FW_ADDR;
38 #error "No CONFIG_SYS_LS_PPA_FW_IN_xxx defined"
41 #ifdef CONFIG_CHAIN_OF_TRUST
42 ppa_img_addr = (uintptr_t)ppa_fit_addr;
43 if (fsl_check_boot_mode_secure() != 0) {
44 ret = fsl_secboot_validate(ppa_esbc_hdr,
48 printf("PPA validation failed\n");
50 printf("PPA validation Successful\n");
54 #ifdef CONFIG_FSL_LSCH3
55 struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
56 boot_loc_ptr_l = &gur->bootlocptrl;
57 boot_loc_ptr_h = &gur->bootlocptrh;
58 #elif defined(CONFIG_FSL_LSCH2)
59 struct ccsr_scfg __iomem *scfg = (void *)(CONFIG_SYS_FSL_SCFG_ADDR);
60 boot_loc_ptr_l = &scfg->scratchrw[1];
61 boot_loc_ptr_h = &scfg->scratchrw[0];
64 debug("fsl-ppa: boot_loc_ptr_l = 0x%p, boot_loc_ptr_h =0x%p\n",
65 boot_loc_ptr_l, boot_loc_ptr_h);
66 ret = sec_firmware_init(ppa_fit_addr, boot_loc_ptr_l, boot_loc_ptr_h);