Simon Glass | 2444dae | 2015-08-30 16:55:38 -0600 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2015 Google, Inc |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <dm.h> |
| 9 | #include <ram.h> |
| 10 | |
| 11 | DECLARE_GLOBAL_DATA_PTR; |
| 12 | |
| 13 | int board_init(void) |
| 14 | { |
| 15 | return 0; |
| 16 | } |
| 17 | |
| 18 | int dram_init(void) |
| 19 | { |
| 20 | struct ram_info ram; |
| 21 | struct udevice *dev; |
| 22 | int ret; |
| 23 | |
| 24 | ret = uclass_get_device(UCLASS_RAM, 0, &dev); |
| 25 | if (ret) { |
| 26 | debug("DRAM init failed: %d\n", ret); |
| 27 | return ret; |
| 28 | } |
| 29 | ret = ram_get_info(dev, &ram); |
| 30 | if (ret) { |
| 31 | debug("Cannot get DRAM size: %d\n", ret); |
| 32 | return ret; |
| 33 | } |
| 34 | debug("SDRAM base=%lx, size=%x\n", ram.base, ram.size); |
| 35 | gd->ram_size = ram.size; |
| 36 | |
| 37 | return 0; |
| 38 | } |
| 39 | |
| 40 | #ifndef CONFIG_SYS_DCACHE_OFF |
| 41 | void enable_caches(void) |
| 42 | { |
| 43 | /* Enable D-cache. I-cache is already enabled in start.S */ |
| 44 | dcache_enable(); |
| 45 | } |
| 46 | #endif |