blob: e3c8aa2e6131b9af7d51333152bb119ba837a3a4 [file] [log] [blame]
Hou Zhiqiangdae02772016-06-28 20:18:16 +08001/*
2 * Copyright 2016 NXP Semiconductor, Inc.
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <asm/psci.h>
macro.wave.z@gmail.com05725ed2016-12-08 11:58:25 +08009#include <asm/system.h>
Hou Zhiqiangdae02772016-06-28 20:18:16 +080010#include <asm/armv8/sec_firmware.h>
Hou Zhiqiangdae02772016-06-28 20:18:16 +080011
Yuantian Tangaec3b142017-04-19 13:27:39 +080012#ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT
Hou Zhiqiangdae02772016-06-28 20:18:16 +080013int psci_update_dt(void *fdt)
14{
Hou Zhiqiangdae02772016-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 */
Yuantian Tangaec3b142017-04-19 13:27:39 +080021 if (sec_firmware_support_psci_version() == PSCI_INVALID_VER)
Hou Zhiqiangdae02772016-06-28 20:18:16 +080022 return 0;
Hou Zhiqiangdae02772016-06-28 20:18:16 +080023 fdt_psci(fdt);
macro.wave.z@gmail.com05725ed2016-12-08 11:58:25 +080024
25#if defined(CONFIG_ARMV8_PSCI) && !defined(CONFIG_ARMV8_SECURE_BASE)
26 /* secure code lives in RAM, keep it alive */
27 fdt_add_mem_rsv(fdt, (unsigned long)__secure_start,
28 __secure_end - __secure_start);
29#endif
30
Hou Zhiqiangdae02772016-06-28 20:18:16 +080031 return 0;
32}
Yuantian Tangaec3b142017-04-19 13:27:39 +080033#endif