blob: f026abf0b1681923a79ca53331237ecbfa21e81f [file] [log] [blame]
Simon Glass2444dae2015-08-30 16:55:38 -06001/*
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 linbe1d5e02015-11-17 14:20:27 +080010#include <asm/io.h>
Simon Glass2444dae2015-08-30 16:55:38 -060011
12DECLARE_GLOBAL_DATA_PTR;
13
14int board_init(void)
15{
16 return 0;
17}
18
19int 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
42void enable_caches(void)
43{
44 /* Enable D-cache. I-cache is already enabled in start.S */
45 dcache_enable();
46}
47#endif