blob: ecb4c988d201af0b40a10b17aa0a2f62441f66cb [file] [log] [blame]
Patrick Delaunay2514c2d2018-03-12 10:46:10 +01001/*
2 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
3 *
4 * SPDX-License-Identifier: GPL-2.0+ BSD-3-Clause
5 */
6
7#include <common.h>
8#include <dm.h>
9#include <ram.h>
10
11DECLARE_GLOBAL_DATA_PTR;
12
13int dram_init(void)
14{
15 struct ram_info ram;
16 struct udevice *dev;
17 int ret;
18
19 ret = uclass_get_device(UCLASS_RAM, 0, &dev);
20 if (ret) {
21 debug("RAM init failed: %d\n", ret);
22 return ret;
23 }
24 ret = ram_get_info(dev, &ram);
25 if (ret) {
26 debug("Cannot get RAM size: %d\n", ret);
27 return ret;
28 }
29 debug("RAM init base=%lx, size=%x\n", ram.base, ram.size);
30
31 gd->ram_size = ram.size;
32
33 return 0;
34}