blob: d4f1578e9e96fcdbd1434b5c5e663339844ada83 [file] [log] [blame]
Simon Glass653909f2013-05-08 08:06:03 +00001/*
2 * Copyright (c) 2013, Google Inc.
3 *
4 * Copyright (C) 2011
5 * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de>
6 * - Added prep subcommand support
7 * - Reorganized source - modeled after powerpc version
8 *
9 * (C) Copyright 2002
10 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
11 * Marius Groeger <mgroeger@sysgo.de>
12 *
13 * Copyright (C) 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
14 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +020015 * SPDX-License-Identifier: GPL-2.0+
Simon Glass653909f2013-05-08 08:06:03 +000016 */
17
18#include <common.h>
19#include <fdt_support.h>
Marc Zyngierb32cf0e2014-07-12 14:24:07 +010020#include <asm/armv7.h>
Simon Glass653909f2013-05-08 08:06:03 +000021
22DECLARE_GLOBAL_DATA_PTR;
23
Ma Haijun62358242014-07-12 14:24:06 +010024int arch_fixup_fdt(void *blob)
Simon Glass653909f2013-05-08 08:06:03 +000025{
26 bd_t *bd = gd->bd;
Marc Zyngierb32cf0e2014-07-12 14:24:07 +010027 int bank, ret;
Simon Glass653909f2013-05-08 08:06:03 +000028 u64 start[CONFIG_NR_DRAM_BANKS];
29 u64 size[CONFIG_NR_DRAM_BANKS];
30
31 for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
32 start[bank] = bd->bi_dram[bank].start;
33 size[bank] = bd->bi_dram[bank].size;
34 }
35
Marc Zyngierb32cf0e2014-07-12 14:24:07 +010036 ret = fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
37#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV7_VIRT)
38 if (ret)
39 return ret;
40
41 ret = armv7_update_dt(blob);
42#endif
43 return ret;
Simon Glass653909f2013-05-08 08:06:03 +000044}