]> Git Repo - J-u-boot.git/blame - arch/arm/lib/bootm-fdt.c
Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-samsung
[J-u-boot.git] / arch / arm / lib / bootm-fdt.c
CommitLineData
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
401d1c4f 22#include <asm/global_data.h>
dd09f7e7 23#include <asm/psci.h>
6b6024ea 24#include <asm/spin_table.h>
6caa1956
SG
25
26DECLARE_GLOBAL_DATA_PTR;
27
6bedf447
PK
28#ifdef CONFIG_FMAN_ENET
29__weak int fdt_update_ethernet_dt(void *blob)
30{
31 return 0;
32}
33#endif
34
e29607ed 35int arch_fixup_fdt(void *blob)
6caa1956 36{
020da843 37 __maybe_unused int ret = 0;
984a3c87 38#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_OF_LIBFDT)
b75d8dc5 39 struct bd_info *bd = gd->bd;
984a3c87 40 int bank;
6caa1956
SG
41 u64 start[CONFIG_NR_DRAM_BANKS];
42 u64 size[CONFIG_NR_DRAM_BANKS];
43
44 for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
45 start[bank] = bd->bi_dram[bank].start;
46 size[bank] = bd->bi_dram[bank].size;
d6b72da0
JK
47#ifdef CONFIG_ARMV7_NONSEC
48 ret = armv7_apply_memory_carveout(&start[bank], &size[bank]);
49 if (ret)
50 return ret;
51#endif
6caa1956
SG
52 }
53
984a3c87 54#ifdef CONFIG_OF_LIBFDT
e771a3d5 55 ret = fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
e771a3d5
MZ
56 if (ret)
57 return ret;
984a3c87 58#endif
e771a3d5 59
6b6024ea
MY
60#ifdef CONFIG_ARMV8_SPIN_TABLE
61 ret = spin_table_update_dt(blob);
62 if (ret)
63 return ret;
64#endif
65
9a561753 66#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV8_PSCI) || \
59b07a25 67 CONFIG_IS_ENABLED(SEC_FIRMWARE_ARMV8_PSCI)
dd09f7e7 68 ret = psci_update_dt(blob);
6441e3de
MY
69 if (ret)
70 return ret;
984a3c87 71#endif
e771a3d5 72#endif
6441e3de 73
6bedf447
PK
74#ifdef CONFIG_FMAN_ENET
75 ret = fdt_update_ethernet_dt(blob);
76 if (ret)
77 return ret;
78#endif
6441e3de 79 return 0;
6caa1956 80}
This page took 0.445425 seconds and 4 git commands to generate.