marvell_plat_config.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /*
  2. * Copyright (C) 2018 Marvell International Ltd.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. * https://spdx.org/licenses
  6. */
  7. #include <armada_common.h>
  8. #include <mvebu_def.h>
  9. /*
  10. * If bootrom is currently at BLE there's no need to include the memory
  11. * maps structure at this point
  12. */
  13. #ifndef IMAGE_BLE
  14. /*****************************************************************************
  15. * AMB Configuration
  16. *****************************************************************************
  17. */
  18. struct addr_map_win amb_memory_map_cp0[] = {
  19. /* CP0 SPI1 CS0 Direct Mode access */
  20. {0xe800, 0x2000000, AMB_SPI1_CS0_ID},
  21. };
  22. int marvell_get_amb_memory_map(struct addr_map_win **win, uint32_t *size,
  23. uintptr_t base)
  24. {
  25. switch (base) {
  26. case MVEBU_CP_REGS_BASE(0):
  27. *win = amb_memory_map_cp0;
  28. *size = ARRAY_SIZE(amb_memory_map_cp0);
  29. return 0;
  30. case MVEBU_CP_REGS_BASE(1):
  31. case MVEBU_CP_REGS_BASE(2):
  32. default:
  33. *size = 0;
  34. *win = 0;
  35. return 1;
  36. }
  37. }
  38. #endif
  39. /*****************************************************************************
  40. * IO WIN Configuration
  41. *****************************************************************************
  42. */
  43. struct addr_map_win io_win_memory_map[] = {
  44. #if (CP_COUNT > 1)
  45. /* SB (MCi0) internal regs */
  46. {0x00000000f4000000, 0x2000000, MCI_0_TID},
  47. #if (CP_COUNT > 2)
  48. /* SB (MCi1) internal regs */
  49. {0x00000000f6000000, 0x2000000, MCI_1_TID},
  50. #endif
  51. #endif
  52. #ifndef IMAGE_BLE
  53. /* SB (MCi0) PCIe0-2 on CP1 */
  54. {0x00000000e2000000, 0x3000000, MCI_0_TID},
  55. /* SB (MCi1) PCIe0-2 on CP2 */
  56. {0x00000000e5000000, 0x3000000, MCI_1_TID},
  57. /* MCI 0 indirect window */
  58. {MVEBU_MCI_REG_BASE_REMAP(0), 0x100000, MCI_0_TID},
  59. /* MCI 1 indirect window */
  60. {MVEBU_MCI_REG_BASE_REMAP(1), 0x100000, MCI_1_TID},
  61. #endif
  62. };
  63. /* Global Control Register - window default target */
  64. uint32_t marvell_get_io_win_gcr_target(int ap_index)
  65. {
  66. /*
  67. * PIDI == iMCIP AP to SB internal MoChi connection.
  68. * In other words CP0
  69. */
  70. return PIDI_TID;
  71. }
  72. int marvell_get_io_win_memory_map(int ap_index, struct addr_map_win **win,
  73. uint32_t *size)
  74. {
  75. *win = io_win_memory_map;
  76. if (*win == NULL)
  77. *size = 0;
  78. else
  79. *size = ARRAY_SIZE(io_win_memory_map);
  80. return 0;
  81. }
  82. #ifndef IMAGE_BLE
  83. /*****************************************************************************
  84. * IOB Configuration
  85. *****************************************************************************
  86. */
  87. struct addr_map_win iob_memory_map_cp0[] = {
  88. /* SPI1_CS0 (RUNIT) window */
  89. {0x00000000e8000000, 0x2000000, RUNIT_TID},
  90. /* PEX2_X1 window */
  91. {0x00000000e1000000, 0x1000000, PEX2_TID},
  92. /* PEX1_X1 window */
  93. {0x00000000e0000000, 0x1000000, PEX1_TID},
  94. /* PEX0_X4 window */
  95. {0x00000000c0000000, 0x20000000, PEX0_TID},
  96. };
  97. struct addr_map_win iob_memory_map_cp1[] = {
  98. /* PEX2_X1 window */
  99. {0x00000000e4000000, 0x1000000, PEX2_TID},
  100. /* PEX1_X1 window */
  101. {0x00000000e3000000, 0x1000000, PEX1_TID},
  102. /* PEX0_X4 window */
  103. {0x00000000e2000000, 0x1000000, PEX0_TID},
  104. };
  105. struct addr_map_win iob_memory_map_cp2[] = {
  106. /* PEX2_X1 window */
  107. {0x00000000e7000000, 0x1000000, PEX2_TID},
  108. /* PEX1_X1 window */
  109. {0x00000000e6000000, 0x1000000, PEX1_TID},
  110. /* PEX0_X4 window */
  111. {0x00000000e5000000, 0x1000000, PEX0_TID},
  112. };
  113. int marvell_get_iob_memory_map(struct addr_map_win **win, uint32_t *size,
  114. uintptr_t base)
  115. {
  116. switch (base) {
  117. case MVEBU_CP_REGS_BASE(0):
  118. *win = iob_memory_map_cp0;
  119. *size = ARRAY_SIZE(iob_memory_map_cp0);
  120. return 0;
  121. case MVEBU_CP_REGS_BASE(1):
  122. *win = iob_memory_map_cp1;
  123. *size = ARRAY_SIZE(iob_memory_map_cp1);
  124. return 0;
  125. case MVEBU_CP_REGS_BASE(2):
  126. *win = iob_memory_map_cp2;
  127. *size = ARRAY_SIZE(iob_memory_map_cp2);
  128. return 0;
  129. default:
  130. *size = 0;
  131. *win = 0;
  132. return 1;
  133. }
  134. }
  135. #endif
  136. /*****************************************************************************
  137. * CCU Configuration
  138. *****************************************************************************
  139. */
  140. struct addr_map_win ccu_memory_map[] = { /* IO window */
  141. #ifdef IMAGE_BLE
  142. {0x00000000f2000000, 0x6000000, IO_0_TID}, /* IO window */
  143. #else
  144. #if LLC_SRAM
  145. {PLAT_MARVELL_LLC_SRAM_BASE, PLAT_MARVELL_LLC_SRAM_SIZE, DRAM_0_TID},
  146. #endif
  147. {0x00000000f2000000, 0xe000000, IO_0_TID}, /* IO window */
  148. {0x00000000c0000000, 0x30000000, IO_0_TID}, /* IO window */
  149. {0x0000002000000000, 0x70e000000, IO_0_TID}, /* IO for CV-OS */
  150. #endif
  151. };
  152. uint32_t marvell_get_ccu_gcr_target(int ap)
  153. {
  154. return DRAM_0_TID;
  155. }
  156. int marvell_get_ccu_memory_map(int ap_index, struct addr_map_win **win,
  157. uint32_t *size)
  158. {
  159. *win = ccu_memory_map;
  160. *size = ARRAY_SIZE(ccu_memory_map);
  161. return 0;
  162. }
  163. #ifdef IMAGE_BLE
  164. /*****************************************************************************
  165. * SKIP IMAGE Configuration
  166. *****************************************************************************
  167. */
  168. void *plat_get_skip_image_data(void)
  169. {
  170. /* No recovery button on CN-9130 board? */
  171. return NULL;
  172. }
  173. #endif