2013-05-08 08:06:03 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013, Google Inc.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011
|
|
|
|
* Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de>
|
|
|
|
* - Added prep subcommand support
|
|
|
|
* - Reorganized source - modeled after powerpc version
|
|
|
|
*
|
|
|
|
* (C) Copyright 2002
|
|
|
|
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
|
|
|
* Marius Groeger <mgroeger@sysgo.de>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2013-05-08 08:06:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <fdt_support.h>
|
2015-05-14 15:07:03 +00:00
|
|
|
#ifdef CONFIG_ARMV7_NONSEC
|
2015-04-21 05:18:32 +00:00
|
|
|
#include <asm/armv7.h>
|
2015-05-14 15:07:03 +00:00
|
|
|
#endif
|
2015-03-06 01:19:36 +00:00
|
|
|
#include <asm/psci.h>
|
2016-06-27 10:31:05 +00:00
|
|
|
#include <asm/spin_table.h>
|
2013-05-08 08:06:03 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2016-07-28 07:06:41 +00:00
|
|
|
#ifdef CONFIG_ARCH_FIXUP_FDT
|
2014-07-12 13:24:06 +00:00
|
|
|
int arch_fixup_fdt(void *blob)
|
2013-05-08 08:06:03 +00:00
|
|
|
{
|
|
|
|
bd_t *bd = gd->bd;
|
2014-07-12 13:24:07 +00:00
|
|
|
int bank, ret;
|
2013-05-08 08:06:03 +00:00
|
|
|
u64 start[CONFIG_NR_DRAM_BANKS];
|
|
|
|
u64 size[CONFIG_NR_DRAM_BANKS];
|
|
|
|
|
|
|
|
for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
|
|
|
|
start[bank] = bd->bi_dram[bank].start;
|
|
|
|
size[bank] = bd->bi_dram[bank].size;
|
2015-04-21 05:18:32 +00:00
|
|
|
#ifdef CONFIG_ARMV7_NONSEC
|
|
|
|
ret = armv7_apply_memory_carveout(&start[bank], &size[bank]);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
#endif
|
2013-05-08 08:06:03 +00:00
|
|
|
}
|
|
|
|
|
2014-07-12 13:24:07 +00:00
|
|
|
ret = fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
2016-06-27 10:31:05 +00:00
|
|
|
#ifdef CONFIG_ARMV8_SPIN_TABLE
|
|
|
|
ret = spin_table_update_dt(blob);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
#endif
|
|
|
|
|
2016-06-28 12:18:16 +00:00
|
|
|
#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV8_PSCI)
|
2015-03-06 01:19:36 +00:00
|
|
|
ret = psci_update_dt(blob);
|
2016-06-17 12:51:48 +00:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
2014-07-12 13:24:07 +00:00
|
|
|
#endif
|
2016-06-17 12:51:48 +00:00
|
|
|
|
|
|
|
return 0;
|
2013-05-08 08:06:03 +00:00
|
|
|
}
|
2016-07-28 07:06:41 +00:00
|
|
|
#endif
|