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