1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2016 Imagination Technologies 4 */ 5 6#include <common.h> 7#include <init.h> 8#include <asm/global_data.h> 9 10#include <asm/io.h> 11 12#include "boston-regs.h" 13 14DECLARE_GLOBAL_DATA_PTR; 15 16int dram_init(void) 17{ 18 u32 ddrconf0 = __raw_readl((uint32_t *)BOSTON_PLAT_DDRCONF0); 19 20 gd->ram_size = (phys_size_t)(ddrconf0 & BOSTON_PLAT_DDRCONF0_SIZE) << 21 30; 22 23 return 0; 24} 25 26phys_addr_t board_get_usable_ram_top(phys_size_t total_size) 27{ 28 DECLARE_GLOBAL_DATA_PTR; 29 30 if (gd->ram_top < CFG_SYS_SDRAM_BASE) { 31 /* 2GB wrapped around to 0 */ 32 return CKSEG0ADDR(256 << 20); 33 } 34 35 return min_t(unsigned long, gd->ram_top, CKSEG0ADDR(256 << 20)); 36} 37