blob: 9bfe3815e51a0b6d4c1f34cb99edbb6331d27e78 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Hou Zhiqiang45684ae2016-06-28 20:18:16 +08002/*
3 * Copyright 2016 NXP Semiconductor, Inc.
Hou Zhiqiang45684ae2016-06-28 20:18:16 +08004 */
5
6#include <common.h>
Simon Glass90526e92020-05-10 11:39:56 -06007#include <asm/cache.h>
Hou Zhiqiang45684ae2016-06-28 20:18:16 +08008#include <asm/psci.h>
macro.wave.z@gmail.com9a561752016-12-08 11:58:25 +08009#include <asm/system.h>
Hou Zhiqiang45684ae2016-06-28 20:18:16 +080010#include <asm/armv8/sec_firmware.h>
Michael Walleeb217202022-02-28 13:48:37 +010011#include <linux/libfdt.h>
Hou Zhiqiang45684ae2016-06-28 20:18:16 +080012
Michael Walleeb217202022-02-28 13:48:37 +010013__weak int psci_update_dt(void *fdt)
Hou Zhiqiang45684ae2016-06-28 20:18:16 +080014{
Hou Zhiqiang45684ae2016-06-28 20:18:16 +080015 /*
16 * If the PSCI in SEC Firmware didn't work, avoid to update the
17 * device node of PSCI. But still return 0 instead of an error
18 * number to support detecting PSCI dynamically and then switching
19 * the SMP boot method between PSCI and spin-table.
20 */
Michael Walleeb217202022-02-28 13:48:37 +010021 if (CONFIG_IS_ENABLED(SEC_FIRMWARE_ARMV8_PSCI) &&
22 sec_firmware_support_psci_version() == PSCI_INVALID_VER)
Hou Zhiqiang45684ae2016-06-28 20:18:16 +080023 return 0;
Michael Walleeb217202022-02-28 13:48:37 +010024
Hou Zhiqiang45684ae2016-06-28 20:18:16 +080025 fdt_psci(fdt);
macro.wave.z@gmail.com9a561752016-12-08 11:58:25 +080026
27#if defined(CONFIG_ARMV8_PSCI) && !defined(CONFIG_ARMV8_SECURE_BASE)
28 /* secure code lives in RAM, keep it alive */
29 fdt_add_mem_rsv(fdt, (unsigned long)__secure_start,
30 __secure_end - __secure_start);
31#endif
32
Hou Zhiqiang45684ae2016-06-28 20:18:16 +080033 return 0;
34}