2 * Copyright (c) 2013, Google Inc.
5 * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de>
6 * - Added prep subcommand support
7 * - Reorganized source - modeled after powerpc version
10 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
11 * Marius Groeger <mgroeger@sysgo.de>
13 * Copyright (C) 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
15 * SPDX-License-Identifier: GPL-2.0+
19 #include <fdt_support.h>
20 #ifdef CONFIG_ARMV7_NONSEC
21 #include <asm/armv7.h>
24 #include <asm/spin_table.h>
26 DECLARE_GLOBAL_DATA_PTR;
28 int arch_fixup_fdt(void *blob)
31 #if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_OF_LIBFDT)
34 u64 start[CONFIG_NR_DRAM_BANKS];
35 u64 size[CONFIG_NR_DRAM_BANKS];
37 for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
38 start[bank] = bd->bi_dram[bank].start;
39 size[bank] = bd->bi_dram[bank].size;
40 #ifdef CONFIG_ARMV7_NONSEC
41 ret = armv7_apply_memory_carveout(&start[bank], &size[bank]);
47 #ifdef CONFIG_OF_LIBFDT
48 ret = fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
53 #ifdef CONFIG_ARMV8_SPIN_TABLE
54 ret = spin_table_update_dt(blob);
59 #if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV8_PSCI) || \
60 defined(CONFIG_SEC_FIRMWARE_ARMV8_PSCI)
61 ret = psci_update_dt(blob);