ddr.c 593 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (C) 2016 Imagination Technologies
  3. *
  4. * SPDX-License-Identifier: GPL-2.0
  5. */
  6. #include <common.h>
  7. #include <asm/io.h>
  8. #include "boston-regs.h"
  9. phys_size_t initdram(int board_type)
  10. {
  11. u32 ddrconf0 = __raw_readl((uint32_t *)BOSTON_PLAT_DDRCONF0);
  12. return (phys_size_t)(ddrconf0 & BOSTON_PLAT_DDRCONF0_SIZE) << 30;
  13. }
  14. ulong board_get_usable_ram_top(ulong total_size)
  15. {
  16. DECLARE_GLOBAL_DATA_PTR;
  17. if (gd->ram_top < CONFIG_SYS_SDRAM_BASE) {
  18. /* 2GB wrapped around to 0 */
  19. return CKSEG0ADDR(256 << 20);
  20. }
  21. return min_t(unsigned long, gd->ram_top, CKSEG0ADDR(256 << 20));
  22. }