init.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Configuration for MediaTek MT8518 SoC
  4. *
  5. * Copyright (C) 2019 MediaTek Inc.
  6. * Author: Mingming Lee <mingming.lee@mediatek.com>
  7. */
  8. #include <clk.h>
  9. #include <common.h>
  10. #include <cpu_func.h>
  11. #include <dm.h>
  12. #include <fdtdec.h>
  13. #include <init.h>
  14. #include <ram.h>
  15. #include <asm/arch/misc.h>
  16. #include <asm/armv8/mmu.h>
  17. #include <asm/cache.h>
  18. #include <asm/global_data.h>
  19. #include <asm/sections.h>
  20. #include <dm/uclass.h>
  21. #include <dt-bindings/clock/mt8518-clk.h>
  22. DECLARE_GLOBAL_DATA_PTR;
  23. int dram_init(void)
  24. {
  25. int ret;
  26. ret = fdtdec_setup_memory_banksize();
  27. if (ret)
  28. return ret;
  29. return fdtdec_setup_mem_size_base();
  30. }
  31. int dram_init_banksize(void)
  32. {
  33. gd->bd->bi_dram[0].start = gd->ram_base;
  34. gd->bd->bi_dram[0].size = gd->ram_size;
  35. return 0;
  36. }
  37. void reset_cpu(ulong addr)
  38. {
  39. psci_system_reset();
  40. }
  41. int print_cpuinfo(void)
  42. {
  43. printf("CPU: MediaTek MT8518\n");
  44. return 0;
  45. }
  46. static struct mm_region mt8518_mem_map[] = {
  47. {
  48. /* DDR */
  49. .virt = 0x40000000UL,
  50. .phys = 0x40000000UL,
  51. .size = 0x20000000UL,
  52. .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE,
  53. }, {
  54. .virt = 0x00000000UL,
  55. .phys = 0x00000000UL,
  56. .size = 0x20000000UL,
  57. .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
  58. PTE_BLOCK_NON_SHARE |
  59. PTE_BLOCK_PXN | PTE_BLOCK_UXN
  60. }, {
  61. 0,
  62. }
  63. };
  64. struct mm_region *mem_map = mt8518_mem_map;