]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
ee422142 ÁFR |
2 | /* |
3 | * Copyright (C) 2016 Daniel Schwierzeck <[email protected]> | |
4 | * Copyright (C) 2017 Álvaro Fernández Rojas <[email protected]> | |
ee422142 ÁFR |
5 | */ |
6 | ||
7 | #include <common.h> | |
691d719d | 8 | #include <init.h> |
f7ae49fc | 9 | #include <log.h> |
ee422142 ÁFR |
10 | #include <ram.h> |
11 | #include <dm.h> | |
401d1c4f | 12 | #include <asm/global_data.h> |
ee422142 ÁFR |
13 | |
14 | DECLARE_GLOBAL_DATA_PTR; | |
15 | ||
16 | int dram_init(void) | |
17 | { | |
18 | struct ram_info ram; | |
19 | struct udevice *dev; | |
20 | int err; | |
21 | ||
22 | err = uclass_get_device(UCLASS_RAM, 0, &dev); | |
23 | if (err) { | |
24 | debug("DRAM init failed: %d\n", err); | |
25 | return 0; | |
26 | } | |
27 | ||
28 | err = ram_get_info(dev, &ram); | |
29 | if (err) { | |
30 | debug("Cannot get DRAM size: %d\n", err); | |
31 | return 0; | |
32 | } | |
33 | ||
34 | debug("SDRAM base=%zx, size=%x\n", ram.base, ram.size); | |
35 | ||
36 | gd->ram_size = ram.size; | |
37 | ||
38 | return 0; | |
39 | } |