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