Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Patrice Chotard | 246771b | 2017-09-13 18:00:12 +0200 | [diff] [blame] | 2 | /* |
Patrice Chotard | 3bc599c | 2017-10-23 09:53:58 +0200 | [diff] [blame] | 3 | * Copyright (C) 2017, STMicroelectronics - All Rights Reserved |
Patrice Chotard | 0f8106f | 2020-12-02 18:47:30 +0100 | [diff] [blame] | 4 | * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics. |
Patrice Chotard | 246771b | 2017-09-13 18:00:12 +0200 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <dm.h> |
Simon Glass | 5255932 | 2019-11-14 12:57:46 -0700 | [diff] [blame] | 9 | #include <init.h> |
Simon Glass | f7ae49f | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 10 | #include <log.h> |
Simon Glass | 401d1c4 | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 11 | #include <asm/global_data.h> |
Patrice Chotard | 246771b | 2017-09-13 18:00:12 +0200 | [diff] [blame] | 12 | |
| 13 | DECLARE_GLOBAL_DATA_PTR; |
| 14 | |
| 15 | int dram_init(void) |
| 16 | { |
| 17 | struct udevice *dev; |
| 18 | int ret; |
| 19 | |
| 20 | ret = uclass_get_device(UCLASS_RAM, 0, &dev); |
| 21 | if (ret) { |
| 22 | debug("DRAM init failed: %d\n", ret); |
| 23 | return ret; |
| 24 | } |
| 25 | |
Siva Durga Prasad Paladugu | 12308b1 | 2018-07-16 15:56:11 +0530 | [diff] [blame] | 26 | if (fdtdec_setup_mem_size_base() != 0) |
Patrice Chotard | 246771b | 2017-09-13 18:00:12 +0200 | [diff] [blame] | 27 | ret = -EINVAL; |
| 28 | |
| 29 | return ret; |
| 30 | } |
| 31 | |
| 32 | int dram_init_banksize(void) |
| 33 | { |
| 34 | fdtdec_setup_memory_banksize(); |
| 35 | |
| 36 | return 0; |
| 37 | } |
| 38 | |
Patrice Chotard | 246771b | 2017-09-13 18:00:12 +0200 | [diff] [blame] | 39 | int board_init(void) |
| 40 | { |
| 41 | gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100; |
| 42 | return 0; |
| 43 | } |