blob: 97667e607a836e2c5847a550c5974948f4a6c825 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Hou Zhiqiangdae02772016-06-28 20:18:16 +08002/*
3 * Copyright 2016 NXP Semiconductor, Inc.
Hou Zhiqiangdae02772016-06-28 20:18:16 +08004 */
5
Simon Glass274e0b02020-05-10 11:39:56 -06006#include <asm/cache.h>
Hou Zhiqiangdae02772016-06-28 20:18:16 +08007#include <asm/psci.h>
macro.wave.z@gmail.com05725ed2016-12-08 11:58:25 +08008#include <asm/system.h>
Hou Zhiqiangdae02772016-06-28 20:18:16 +08009#include <asm/armv8/sec_firmware.h>
Michael Wallea281ad12022-02-28 13:48:37 +010010#include <linux/libfdt.h>
Hou Zhiqiangdae02772016-06-28 20:18:16 +080011
Michael Wallea281ad12022-02-28 13:48:37 +010012__weak int psci_update_dt(void *fdt)
Hou Zhiqiangdae02772016-06-28 20:18:16 +080013{
Hou Zhiqiangdae02772016-06-28 20:18:16 +080014 /*
15 * If the PSCI in SEC Firmware didn't work, avoid to update the
16 * device node of PSCI. But still return 0 instead of an error
17 * number to support detecting PSCI dynamically and then switching
18 * the SMP boot method between PSCI and spin-table.
19 */
Michael Wallea281ad12022-02-28 13:48:37 +010020 if (CONFIG_IS_ENABLED(SEC_FIRMWARE_ARMV8_PSCI) &&
21 sec_firmware_support_psci_version() == PSCI_INVALID_VER)
Hou Zhiqiangdae02772016-06-28 20:18:16 +080022 return 0;
Michael Wallea281ad12022-02-28 13:48:37 +010023
Hou Zhiqiangdae02772016-06-28 20:18:16 +080024 fdt_psci(fdt);
macro.wave.z@gmail.com05725ed2016-12-08 11:58:25 +080025
26#if defined(CONFIG_ARMV8_PSCI) && !defined(CONFIG_ARMV8_SECURE_BASE)
27 /* secure code lives in RAM, keep it alive */
28 fdt_add_mem_rsv(fdt, (unsigned long)__secure_start,
29 __secure_end - __secure_start);
30#endif
31
Hou Zhiqiangdae02772016-06-28 20:18:16 +080032 return 0;
33}