Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Hou Zhiqiang | dae0277 | 2016-06-28 20:18:16 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2016 NXP Semiconductor, Inc. |
Hou Zhiqiang | dae0277 | 2016-06-28 20:18:16 +0800 | [diff] [blame] | 4 | */ |
| 5 | |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 6 | #include <asm/cache.h> |
Hou Zhiqiang | dae0277 | 2016-06-28 20:18:16 +0800 | [diff] [blame] | 7 | #include <asm/psci.h> |
macro.wave.z@gmail.com | 05725ed | 2016-12-08 11:58:25 +0800 | [diff] [blame] | 8 | #include <asm/system.h> |
Hou Zhiqiang | dae0277 | 2016-06-28 20:18:16 +0800 | [diff] [blame] | 9 | #include <asm/armv8/sec_firmware.h> |
Michael Walle | a281ad1 | 2022-02-28 13:48:37 +0100 | [diff] [blame] | 10 | #include <linux/libfdt.h> |
Hou Zhiqiang | dae0277 | 2016-06-28 20:18:16 +0800 | [diff] [blame] | 11 | |
Michael Walle | a281ad1 | 2022-02-28 13:48:37 +0100 | [diff] [blame] | 12 | __weak int psci_update_dt(void *fdt) |
Hou Zhiqiang | dae0277 | 2016-06-28 20:18:16 +0800 | [diff] [blame] | 13 | { |
Hou Zhiqiang | dae0277 | 2016-06-28 20:18:16 +0800 | [diff] [blame] | 14 | /* |
| 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 Walle | a281ad1 | 2022-02-28 13:48:37 +0100 | [diff] [blame] | 20 | if (CONFIG_IS_ENABLED(SEC_FIRMWARE_ARMV8_PSCI) && |
| 21 | sec_firmware_support_psci_version() == PSCI_INVALID_VER) |
Hou Zhiqiang | dae0277 | 2016-06-28 20:18:16 +0800 | [diff] [blame] | 22 | return 0; |
Michael Walle | a281ad1 | 2022-02-28 13:48:37 +0100 | [diff] [blame] | 23 | |
Hou Zhiqiang | dae0277 | 2016-06-28 20:18:16 +0800 | [diff] [blame] | 24 | fdt_psci(fdt); |
macro.wave.z@gmail.com | 05725ed | 2016-12-08 11:58:25 +0800 | [diff] [blame] | 25 | |
| 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 Zhiqiang | dae0277 | 2016-06-28 20:18:16 +0800 | [diff] [blame] | 32 | return 0; |
| 33 | } |