1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2013, Google Inc.
6 * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de>
7 * - Added prep subcommand support
8 * - Reorganized source - modeled after powerpc version
11 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
12 * Marius Groeger <mgroeger@sysgo.de>
14 * Copyright (C) 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
18 #include <fdt_support.h>
19 #ifdef CONFIG_ARMV7_NONSEC
20 #include <asm/armv7.h>
23 #include <asm/spin_table.h>
25 DECLARE_GLOBAL_DATA_PTR;
27 #ifdef CONFIG_FMAN_ENET
28 __weak int fdt_update_ethernet_dt(void *blob)
34 int arch_fixup_fdt(void *blob)
36 __maybe_unused int ret = 0;
37 #if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_OF_LIBFDT)
38 struct bd_info *bd = gd->bd;
40 u64 start[CONFIG_NR_DRAM_BANKS];
41 u64 size[CONFIG_NR_DRAM_BANKS];
43 for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
44 start[bank] = bd->bi_dram[bank].start;
45 size[bank] = bd->bi_dram[bank].size;
46 #ifdef CONFIG_ARMV7_NONSEC
47 ret = armv7_apply_memory_carveout(&start[bank], &size[bank]);
53 #ifdef CONFIG_OF_LIBFDT
54 ret = fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
59 #ifdef CONFIG_ARMV8_SPIN_TABLE
60 ret = spin_table_update_dt(blob);
65 #if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV8_PSCI) || \
66 defined(CONFIG_SEC_FIRMWARE_ARMV8_PSCI)
67 ret = psci_update_dt(blob);
73 #ifdef CONFIG_FMAN_ENET
74 ret = fdt_update_ethernet_dt(blob);