]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
6caa1956 SG |
2 | /* |
3 | * Copyright (c) 2013, Google Inc. | |
4 | * | |
5 | * Copyright (C) 2011 | |
6 | * Corscience GmbH & Co. KG - Simon Schwarz <[email protected]> | |
7 | * - Added prep subcommand support | |
8 | * - Reorganized source - modeled after powerpc version | |
9 | * | |
10 | * (C) Copyright 2002 | |
11 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> | |
12 | * Marius Groeger <[email protected]> | |
13 | * | |
14 | * Copyright (C) 2001 Erik Mouw ([email protected]) | |
6caa1956 SG |
15 | */ |
16 | ||
17 | #include <common.h> | |
18 | #include <fdt_support.h> | |
4588d61a | 19 | #ifdef CONFIG_ARMV7_NONSEC |
d6b72da0 | 20 | #include <asm/armv7.h> |
4588d61a | 21 | #endif |
dd09f7e7 | 22 | #include <asm/psci.h> |
6b6024ea | 23 | #include <asm/spin_table.h> |
6caa1956 SG |
24 | |
25 | DECLARE_GLOBAL_DATA_PTR; | |
26 | ||
6bedf447 PK |
27 | #ifdef CONFIG_FMAN_ENET |
28 | __weak int fdt_update_ethernet_dt(void *blob) | |
29 | { | |
30 | return 0; | |
31 | } | |
32 | #endif | |
33 | ||
e29607ed | 34 | int arch_fixup_fdt(void *blob) |
6caa1956 | 35 | { |
020da843 | 36 | __maybe_unused int ret = 0; |
984a3c87 | 37 | #if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_OF_LIBFDT) |
6caa1956 | 38 | bd_t *bd = gd->bd; |
984a3c87 | 39 | int bank; |
6caa1956 SG |
40 | u64 start[CONFIG_NR_DRAM_BANKS]; |
41 | u64 size[CONFIG_NR_DRAM_BANKS]; | |
42 | ||
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; | |
d6b72da0 JK |
46 | #ifdef CONFIG_ARMV7_NONSEC |
47 | ret = armv7_apply_memory_carveout(&start[bank], &size[bank]); | |
48 | if (ret) | |
49 | return ret; | |
50 | #endif | |
6caa1956 SG |
51 | } |
52 | ||
984a3c87 | 53 | #ifdef CONFIG_OF_LIBFDT |
e771a3d5 | 54 | ret = fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS); |
e771a3d5 MZ |
55 | if (ret) |
56 | return ret; | |
984a3c87 | 57 | #endif |
e771a3d5 | 58 | |
6b6024ea MY |
59 | #ifdef CONFIG_ARMV8_SPIN_TABLE |
60 | ret = spin_table_update_dt(blob); | |
61 | if (ret) | |
62 | return ret; | |
63 | #endif | |
64 | ||
9a561753 | 65 | #if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV8_PSCI) || \ |
daa92644 | 66 | defined(CONFIG_SEC_FIRMWARE_ARMV8_PSCI) |
dd09f7e7 | 67 | ret = psci_update_dt(blob); |
6441e3de MY |
68 | if (ret) |
69 | return ret; | |
984a3c87 | 70 | #endif |
e771a3d5 | 71 | #endif |
6441e3de | 72 | |
6bedf447 PK |
73 | #ifdef CONFIG_FMAN_ENET |
74 | ret = fdt_update_ethernet_dt(blob); | |
75 | if (ret) | |
76 | return ret; | |
77 | #endif | |
6441e3de | 78 | return 0; |
6caa1956 | 79 | } |