Simon Glass | 6caa195 | 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 | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 15 | * SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | 6caa195 | 2013-05-08 08:06:03 +0000 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | #include <common.h> |
| 19 | #include <fdt_support.h> |
Tom Rini | dd09f7e | 2015-03-05 20:19:36 -0500 | [diff] [blame^] | 20 | #include <asm/psci.h> |
Simon Glass | 6caa195 | 2013-05-08 08:06:03 +0000 | [diff] [blame] | 21 | |
| 22 | DECLARE_GLOBAL_DATA_PTR; |
| 23 | |
Ma Haijun | e29607e | 2014-07-12 14:24:06 +0100 | [diff] [blame] | 24 | int arch_fixup_fdt(void *blob) |
Simon Glass | 6caa195 | 2013-05-08 08:06:03 +0000 | [diff] [blame] | 25 | { |
| 26 | bd_t *bd = gd->bd; |
Marc Zyngier | e771a3d | 2014-07-12 14:24:07 +0100 | [diff] [blame] | 27 | int bank, ret; |
Simon Glass | 6caa195 | 2013-05-08 08:06:03 +0000 | [diff] [blame] | 28 | 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 Zyngier | e771a3d | 2014-07-12 14:24:07 +0100 | [diff] [blame] | 36 | 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 | |
Tom Rini | dd09f7e | 2015-03-05 20:19:36 -0500 | [diff] [blame^] | 41 | ret = psci_update_dt(blob); |
Marc Zyngier | e771a3d | 2014-07-12 14:24:07 +0100 | [diff] [blame] | 42 | #endif |
| 43 | return ret; |
Simon Glass | 6caa195 | 2013-05-08 08:06:03 +0000 | [diff] [blame] | 44 | } |