common.c 951 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * board/renesas/rcar-common/common.c
  4. *
  5. * Copyright (C) 2013 Renesas Electronics Corporation
  6. * Copyright (C) 2013 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
  7. * Copyright (C) 2015 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  8. */
  9. #include <common.h>
  10. #include <dm.h>
  11. #include <init.h>
  12. #include <dm/uclass-internal.h>
  13. #include <asm/arch/rmobile.h>
  14. #include <linux/libfdt.h>
  15. #ifdef CONFIG_RCAR_GEN3
  16. DECLARE_GLOBAL_DATA_PTR;
  17. /* If the firmware passed a device tree use it for U-Boot DRAM setup. */
  18. extern u64 rcar_atf_boot_args[];
  19. int fdtdec_board_setup(const void *fdt_blob)
  20. {
  21. void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]);
  22. if (fdt_magic(atf_fdt_blob) == FDT_MAGIC)
  23. fdt_overlay_apply_node((void *)fdt_blob, 0, atf_fdt_blob, 0);
  24. return 0;
  25. }
  26. int dram_init(void)
  27. {
  28. return fdtdec_setup_mem_size_base();
  29. }
  30. int dram_init_banksize(void)
  31. {
  32. fdtdec_setup_memory_banksize();
  33. return 0;
  34. }
  35. #endif