dram.c 739 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
  4. */
  5. #include <common.h>
  6. #include <fdtdec.h>
  7. #include <init.h>
  8. #include <linux/sizes.h>
  9. DECLARE_GLOBAL_DATA_PTR;
  10. int dram_init(void)
  11. {
  12. return fdtdec_setup_mem_size_base();
  13. }
  14. int dram_init_banksize(void)
  15. {
  16. return fdtdec_setup_memory_banksize();
  17. }
  18. ulong board_get_usable_ram_top(ulong total_size)
  19. {
  20. #ifdef CONFIG_64BIT
  21. /*
  22. * Ensure that we run from first 4GB so that all
  23. * addresses used by U-Boot are 32bit addresses.
  24. *
  25. * This in-turn ensures that 32bit DMA capable
  26. * devices work fine because DMA mapping APIs will
  27. * provide 32bit DMA addresses only.
  28. */
  29. if (gd->ram_top > SZ_4G)
  30. return SZ_4G;
  31. #endif
  32. return gd->ram_top;
  33. }