1 /*
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 
11 DECLARE_GLOBAL_DATA_PTR;
12 
13 int 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 }
35