1*4549e789STom Rini // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause 22514c2d0SPatrick Delaunay /* 32514c2d0SPatrick Delaunay * Copyright (C) 2018, STMicroelectronics - All Rights Reserved 42514c2d0SPatrick Delaunay */ 52514c2d0SPatrick Delaunay 62514c2d0SPatrick Delaunay #include <common.h> 72514c2d0SPatrick Delaunay #include <dm.h> 82514c2d0SPatrick Delaunay #include <ram.h> 92514c2d0SPatrick Delaunay 102514c2d0SPatrick Delaunay DECLARE_GLOBAL_DATA_PTR; 112514c2d0SPatrick Delaunay dram_init(void)122514c2d0SPatrick Delaunayint dram_init(void) 132514c2d0SPatrick Delaunay { 142514c2d0SPatrick Delaunay struct ram_info ram; 152514c2d0SPatrick Delaunay struct udevice *dev; 162514c2d0SPatrick Delaunay int ret; 172514c2d0SPatrick Delaunay 182514c2d0SPatrick Delaunay ret = uclass_get_device(UCLASS_RAM, 0, &dev); 192514c2d0SPatrick Delaunay if (ret) { 202514c2d0SPatrick Delaunay debug("RAM init failed: %d\n", ret); 212514c2d0SPatrick Delaunay return ret; 222514c2d0SPatrick Delaunay } 232514c2d0SPatrick Delaunay ret = ram_get_info(dev, &ram); 242514c2d0SPatrick Delaunay if (ret) { 252514c2d0SPatrick Delaunay debug("Cannot get RAM size: %d\n", ret); 262514c2d0SPatrick Delaunay return ret; 272514c2d0SPatrick Delaunay } 282514c2d0SPatrick Delaunay debug("RAM init base=%lx, size=%x\n", ram.base, ram.size); 292514c2d0SPatrick Delaunay 302514c2d0SPatrick Delaunay gd->ram_size = ram.size; 312514c2d0SPatrick Delaunay 322514c2d0SPatrick Delaunay return 0; 332514c2d0SPatrick Delaunay } 34