Simon Glass | 653909f | 2013-05-08 08:06:03 +0000 | [diff] [blame] | 1 | /* |
| 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 Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 15 | * SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | 653909f | 2013-05-08 08:06:03 +0000 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | #include <common.h> |
| 19 | #include <fdt_support.h> |
Tom Rini | 9fcb5ef | 2015-05-14 11:07:03 -0400 | [diff] [blame^] | 20 | #ifdef CONFIG_ARMV7_NONSEC |
Jan Kiszka | cb33440 | 2015-04-21 07:18:32 +0200 | [diff] [blame] | 21 | #include <asm/armv7.h> |
Tom Rini | 9fcb5ef | 2015-05-14 11:07:03 -0400 | [diff] [blame^] | 22 | #endif |
Tom Rini | fb02cc1 | 2015-03-05 20:19:36 -0500 | [diff] [blame] | 23 | #include <asm/psci.h> |
Simon Glass | 653909f | 2013-05-08 08:06:03 +0000 | [diff] [blame] | 24 | |
| 25 | DECLARE_GLOBAL_DATA_PTR; |
| 26 | |
Ma Haijun | 6235824 | 2014-07-12 14:24:06 +0100 | [diff] [blame] | 27 | int arch_fixup_fdt(void *blob) |
Simon Glass | 653909f | 2013-05-08 08:06:03 +0000 | [diff] [blame] | 28 | { |
| 29 | bd_t *bd = gd->bd; |
Marc Zyngier | b32cf0e | 2014-07-12 14:24:07 +0100 | [diff] [blame] | 30 | int bank, ret; |
Simon Glass | 653909f | 2013-05-08 08:06:03 +0000 | [diff] [blame] | 31 | u64 start[CONFIG_NR_DRAM_BANKS]; |
| 32 | u64 size[CONFIG_NR_DRAM_BANKS]; |
| 33 | |
| 34 | for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) { |
| 35 | start[bank] = bd->bi_dram[bank].start; |
| 36 | size[bank] = bd->bi_dram[bank].size; |
Jan Kiszka | cb33440 | 2015-04-21 07:18:32 +0200 | [diff] [blame] | 37 | #ifdef CONFIG_ARMV7_NONSEC |
| 38 | ret = armv7_apply_memory_carveout(&start[bank], &size[bank]); |
| 39 | if (ret) |
| 40 | return ret; |
| 41 | #endif |
Simon Glass | 653909f | 2013-05-08 08:06:03 +0000 | [diff] [blame] | 42 | } |
| 43 | |
Marc Zyngier | b32cf0e | 2014-07-12 14:24:07 +0100 | [diff] [blame] | 44 | ret = fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS); |
Jan Kiszka | ac31b5a | 2015-04-21 07:18:24 +0200 | [diff] [blame] | 45 | #ifdef CONFIG_ARMV7_NONSEC |
Marc Zyngier | b32cf0e | 2014-07-12 14:24:07 +0100 | [diff] [blame] | 46 | if (ret) |
| 47 | return ret; |
| 48 | |
Tom Rini | fb02cc1 | 2015-03-05 20:19:36 -0500 | [diff] [blame] | 49 | ret = psci_update_dt(blob); |
Marc Zyngier | b32cf0e | 2014-07-12 14:24:07 +0100 | [diff] [blame] | 50 | #endif |
| 51 | return ret; |
Simon Glass | 653909f | 2013-05-08 08:06:03 +0000 | [diff] [blame] | 52 | } |