Both LS1046a boards supported by barebox have been switched to TF-A, so drop no longer used PPA support. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- arch/arm/mach-layerscape/Kconfig | 12 --- arch/arm/mach-layerscape/Makefile | 1 - arch/arm/mach-layerscape/ppa-entry.S | 32 -------- arch/arm/mach-layerscape/ppa.c | 147 ----------------------------------- firmware/Makefile | 1 - include/mach/layerscape/layerscape.h | 10 --- test/generate-dummy-fw.sh | 1 - 7 files changed, 204 deletions(-) diff --git a/arch/arm/mach-layerscape/Kconfig b/arch/arm/mach-layerscape/Kconfig index 9d15ba0173..415ee93b99 100644 --- a/arch/arm/mach-layerscape/Kconfig +++ b/arch/arm/mach-layerscape/Kconfig @@ -2,18 +2,6 @@ if ARCH_LAYERSCAPE -config ARCH_LAYERSCAPE_PPA - bool "Include PPA firmware" - select ARM_PSCI_OF - select ARM_SMCCC - select FITIMAGE - help - The "Primary Protected Application" (PPA) is a PSCI compliant firmware - distributed by NXP. It is needed to start the secondary cores on - Layerscape SoCs. Without it Linux will be started in EL3 and doesn't - work properly. The precompiled firmware images can be found here: - https://github.com/NXP/qoriq-ppa-binary - config ARCH_LS1028 bool select CPU_V8 diff --git a/arch/arm/mach-layerscape/Makefile b/arch/arm/mach-layerscape/Makefile index ee7df5ea19..10e1c031b9 100644 --- a/arch/arm/mach-layerscape/Makefile +++ b/arch/arm/mach-layerscape/Makefile @@ -7,7 +7,6 @@ obj-$(CONFIG_ARCH_LS1046) += icid.o obj-pbl-y += boot.o soc.o pbl-y += xload-qspi.o xload.o pbl-$(CONFIG_ARCH_LS1028) += tzc400.o -obj-$(CONFIG_ARCH_LAYERSCAPE_PPA) += ppa.o ppa-entry.o obj-$(CONFIG_BOOTM) += pblimage.o lwl-$(CONFIG_ARCH_LS1021) += lowlevel-ls102xa.o diff --git a/arch/arm/mach-layerscape/ppa-entry.S b/arch/arm/mach-layerscape/ppa-entry.S deleted file mode 100644 index f5f30b6719..0000000000 --- a/arch/arm/mach-layerscape/ppa-entry.S +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#include <linux/linkage.h> - -.section .text.ppa_entry -ENTRY(ppa_entry) - /* - * x0: Secure Firmware entry point - * x1: Exception return address Low - * x2: Exception return address High - */ - - /* Save stack pointer for EL2 */ - mov x3, sp - msr sp_el2, x3 - - /* Set exception return address hold pointer */ - adr x4, 1f - mov x3, x4 - rev w3, w3 - str w3, [x1] - lsr x3, x4, #32 - rev w3, w3 - str w3, [x2] - - /* Call SEC monitor */ - br x0 - -1: - mov x0, #0 - ret -ENDPROC(ppa_entry) diff --git a/arch/arm/mach-layerscape/ppa.c b/arch/arm/mach-layerscape/ppa.c deleted file mode 100644 index 99b76b4c30..0000000000 --- a/arch/arm/mach-layerscape/ppa.c +++ /dev/null @@ -1,147 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#define pr_fmt(fmt) "ppa: " fmt - -#include <common.h> -#include <init.h> -#include <mmu.h> -#include <firmware.h> -#include <memory.h> -#include <linux/sizes.h> -#include <linux/arm-smccc.h> -#include <asm/mmu.h> -#include <soc/fsl/immap_lsch2.h> -#include <asm/system.h> -#include <image-fit.h> -#include <asm/psci.h> -#include <mach/layerscape/layerscape.h> -#include <asm/cache.h> - -int ppa_entry(const void *, u32 *, u32 *); - -#define SEC_JR3_OFFSET 0x40000 - -static int of_psci_do_fixup(struct device_node *root, void *unused) -{ - unsigned long psci_version; - struct device_node *np; - struct arm_smccc_res res = {}; - - arm_smccc_smc(ARM_PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0, 0, 0, 0, 0, &res); - psci_version = res.a0; - - for_each_compatible_node_from(np, root, NULL, "fsl,sec-v4.0-job-ring") { - const void *reg; - int na = of_n_addr_cells(np); - u64 offset; - - reg = of_get_property(np, "reg", NULL); - if (!reg) - continue; - - offset = of_read_number(reg, na); - if (offset != SEC_JR3_OFFSET) - continue; - - of_delete_node(np); - break; - } - - return of_psci_fixup(root, psci_version, "smc"); -} - -static int ppa_init(void *ppa, size_t ppa_size, void *sec_firmware_addr) -{ - int ret; - u32 *boot_loc_ptr_l, *boot_loc_ptr_h; - struct ccsr_scfg __iomem *scfg = (void *)(LSCH2_SCFG_ADDR); - struct fit_handle *fit; - void *conf; - const void *buf; - unsigned long firmware_size; - - boot_loc_ptr_l = &scfg->scratchrw[1]; - boot_loc_ptr_h = &scfg->scratchrw[0]; - - fit = fit_open_buf(ppa, ppa_size, false, BOOTM_VERIFY_AVAILABLE); - if (IS_ERR(fit)) { - pr_err("Cannot open ppa FIT image: %pe\n", fit); - return PTR_ERR(fit); - } - - conf = fit_open_configuration(fit, NULL); - if (IS_ERR(conf)) { - pr_err("Cannot open default config in ppa FIT image: %pe\n", conf); - ret = PTR_ERR(conf); - goto err; - } - - - ret = fit_open_image(fit, conf, "firmware", &buf, &firmware_size); - if (ret) { - pr_err("Cannot open firmware image in ppa FIT image: %s\n", - strerror(-ret)); - goto err; - } - - /* Copy the secure firmware to secure memory */ - memcpy(sec_firmware_addr, buf, firmware_size); - sync_caches_for_execution(); - - ret = ppa_entry(sec_firmware_addr, boot_loc_ptr_l, boot_loc_ptr_h); - if (ret) { - pr_err("Couldn't install PPA firmware: %s\n", strerror(-ret)); - goto err; - } - - pr_info("PPA firmware installed at 0x%p, now in EL%d\n", - sec_firmware_addr, current_el()); - - of_register_fixup(of_psci_do_fixup, NULL); -err: - fit_close(fit); - - return ret; -} - -int ls1046a_ppa_init(resource_size_t ppa_start, resource_size_t ppa_size) -{ - resource_size_t ppa_end = ppa_start + ppa_size - 1; - struct resource *res; - void *ppa_fw; - size_t ppa_fw_size; - int el = current_el(); - int ret; - - res = reserve_sdram_region("ppa", ppa_start, ppa_size); - if (!res) { - pr_err("Cannot request SDRAM region %pa - %pa\n", - &ppa_start, &ppa_end); - return -EINVAL; - } - - get_builtin_firmware(ppa_ls1046a_bin, &ppa_fw, &ppa_fw_size); - if (!ppa_fw_size) { - pr_err("PPA Firmware was not included in build\n"); - return -ENOSYS; - } - - if (el == 3) { - unsigned long cr; - - asm volatile("mrs %0, sctlr_el3" : "=r" (cr) : : "cc"); - remap_range((void *)ppa_start, ppa_size, MAP_CACHED); - - ret = ppa_init(ppa_fw, ppa_fw_size, (void *)ppa_start); - - asm volatile("msr sctlr_el2, %0" : : "r" (cr) : "cc"); - remap_range((void *)ppa_start, ppa_size, MAP_UNCACHED); - - if (ret) - return ret; - } - - of_register_fixup(of_fixup_reserved_memory, res); - - return 0; -} diff --git a/firmware/Makefile b/firmware/Makefile index 9351e24e86..fd63de1c55 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -31,7 +31,6 @@ pbl-firmware-$(CONFIG_ARCH_RK3399) += rk3399-bl31.bin pbl-firmware-$(CONFIG_ARCH_RK3399_OPTEE) += rk3399-op-tee.bin firmware-$(CONFIG_DRIVER_NET_FSL_FMAN) += fsl_fman_ucode_ls1046_r1.0_106_4_18.bin -firmware-$(CONFIG_ARCH_LAYERSCAPE_PPA) += ppa-ls1046a.bin fw-external-$(CONFIG_FIRMWARE_LS1028A_ATF) += ls1028a-bl31.bin fw-external-$(CONFIG_FIRMWARE_LS1046A_ATF) += ls1046a-bl31.bin diff --git a/include/mach/layerscape/layerscape.h b/include/mach/layerscape/layerscape.h index 7f9dc7d8a1..ab8304ede0 100644 --- a/include/mach/layerscape/layerscape.h +++ b/include/mach/layerscape/layerscape.h @@ -32,16 +32,6 @@ enum bootsource ls1021a_bootsource_get(void); #define LAYERSCAPE_SOC_LS1028A 1028 #define LAYERSCAPE_SOC_LS1046A 1046 -#ifdef CONFIG_ARCH_LAYERSCAPE_PPA -int ls1046a_ppa_init(resource_size_t ppa_start, resource_size_t ppa_size); -#else -static inline int ls1046a_ppa_init(resource_size_t ppa_start, - resource_size_t ppa_size) -{ - return -ENOSYS; -} -#endif - struct dram_region_info { uint64_t addr; uint64_t size; diff --git a/test/generate-dummy-fw.sh b/test/generate-dummy-fw.sh index 77d557da21..67c2cb0eee 100755 --- a/test/generate-dummy-fw.sh +++ b/test/generate-dummy-fw.sh @@ -49,7 +49,6 @@ FW_MVEBU_BINARY0=" FW_NXP_LAYERSCAPE=" firmware/fsl_fman_ucode_ls1046_r1.0_106_4_18.bin firmware/ls1046a-bl31.bin - firmware/ppa-ls1046a.bin " FW=" -- 2.39.5