thunderx.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /**
  3. * (C) Copyright 2014, Cavium Inc.
  4. **/
  5. #include <common.h>
  6. #include <cpu_func.h>
  7. #include <dm.h>
  8. #include <init.h>
  9. #include <malloc.h>
  10. #include <errno.h>
  11. #include <net.h>
  12. #include <asm/global_data.h>
  13. #include <linux/compiler.h>
  14. #include <cavium/atf.h>
  15. #include <asm/armv8/mmu.h>
  16. #if !CONFIG_IS_ENABLED(OF_CONTROL)
  17. #include <dm/platform_data/serial_pl01x.h>
  18. static const struct pl01x_serial_plat serial0 = {
  19. .base = CONFIG_SYS_SERIAL0,
  20. .type = TYPE_PL011,
  21. .clock = 0,
  22. .skip_init = true,
  23. };
  24. U_BOOT_DRVINFO(thunderx_serial0) = {
  25. .name = "serial_pl01x",
  26. .plat = &serial0,
  27. };
  28. static const struct pl01x_serial_plat serial1 = {
  29. .base = CONFIG_SYS_SERIAL1,
  30. .type = TYPE_PL011,
  31. .clock = 0,
  32. .skip_init = true,
  33. };
  34. U_BOOT_DRVINFO(thunderx_serial1) = {
  35. .name = "serial_pl01x",
  36. .plat = &serial1,
  37. };
  38. #endif
  39. DECLARE_GLOBAL_DATA_PTR;
  40. static struct mm_region thunderx_mem_map[] = {
  41. {
  42. .virt = 0x000000000000UL,
  43. .phys = 0x000000000000UL,
  44. .size = 0x40000000000UL,
  45. .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_NON_SHARE,
  46. }, {
  47. .virt = 0x800000000000UL,
  48. .phys = 0x800000000000UL,
  49. .size = 0x40000000000UL,
  50. .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
  51. PTE_BLOCK_NON_SHARE,
  52. }, {
  53. .virt = 0x840000000000UL,
  54. .phys = 0x840000000000UL,
  55. .size = 0x40000000000UL,
  56. .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
  57. PTE_BLOCK_NON_SHARE,
  58. }, {
  59. /* List terminator */
  60. 0,
  61. }
  62. };
  63. struct mm_region *mem_map = thunderx_mem_map;
  64. int board_init(void)
  65. {
  66. return 0;
  67. }
  68. int timer_init(void)
  69. {
  70. return 0;
  71. }
  72. int dram_init(void)
  73. {
  74. ssize_t node_count = atf_node_count();
  75. ssize_t dram_size;
  76. int node;
  77. printf("Initializing\nNodes in system: %zd\n", node_count);
  78. gd->ram_size = 0;
  79. for (node = 0; node < node_count; node++) {
  80. dram_size = atf_dram_size(node);
  81. printf("Node %d: %zd MBytes of DRAM\n", node, dram_size >> 20);
  82. gd->ram_size += dram_size;
  83. }
  84. gd->ram_size -= MEM_BASE;
  85. *(unsigned long *)CPU_RELEASE_ADDR = 0;
  86. puts("DRAM size:");
  87. return 0;
  88. }
  89. /*
  90. * Board specific reset that is system reset.
  91. */
  92. void reset_cpu(void)
  93. {
  94. }
  95. /*
  96. * Board specific ethernet initialization routine.
  97. */
  98. int board_eth_init(struct bd_info *bis)
  99. {
  100. int rc = 0;
  101. return rc;
  102. }