marvell_plat_config.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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. /*
  9. * If bootrom is currently at BLE there's no need to include the memory
  10. * maps structure at this point
  11. */
  12. #include <mvebu_def.h>
  13. #ifndef IMAGE_BLE
  14. /*****************************************************************************
  15. * AMB Configuration
  16. *****************************************************************************
  17. */
  18. struct addr_map_win amb_memory_map[] = {
  19. /* CP1 SPI1 CS0 Direct Mode access */
  20. {0xf900, 0x1000000, 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. *win = amb_memory_map;
  26. if (*win == NULL)
  27. *size = 0;
  28. else
  29. *size = ARRAY_SIZE(amb_memory_map);
  30. return 0;
  31. }
  32. #endif
  33. /*****************************************************************************
  34. * IO WIN Configuration
  35. *****************************************************************************
  36. */
  37. struct addr_map_win io_win_memory_map[] = {
  38. /* CP1 (MCI0) internal regs */
  39. {0x00000000f4000000, 0x2000000, MCI_0_TID},
  40. #ifndef IMAGE_BLE
  41. /* PCIe0 and SPI1_CS0 (RUNIT) on CP1*/
  42. {0x00000000f9000000, 0x2000000, MCI_0_TID},
  43. /* PCIe1 on CP1*/
  44. {0x00000000fb000000, 0x1000000, MCI_0_TID},
  45. /* PCIe2 on CP1*/
  46. {0x00000000fc000000, 0x1000000, MCI_0_TID},
  47. /* MCI 0 indirect window */
  48. {MVEBU_MCI_REG_BASE_REMAP(0), 0x100000, MCI_0_TID},
  49. /* MCI 1 indirect window */
  50. {MVEBU_MCI_REG_BASE_REMAP(1), 0x100000, MCI_1_TID},
  51. #endif
  52. };
  53. uint32_t marvell_get_io_win_gcr_target(int ap_index)
  54. {
  55. return PIDI_TID;
  56. }
  57. int marvell_get_io_win_memory_map(int ap_index, struct addr_map_win **win,
  58. uint32_t *size)
  59. {
  60. *win = io_win_memory_map;
  61. if (*win == NULL)
  62. *size = 0;
  63. else
  64. *size = ARRAY_SIZE(io_win_memory_map);
  65. return 0;
  66. }
  67. #ifndef IMAGE_BLE
  68. /*****************************************************************************
  69. * IOB Configuration
  70. *****************************************************************************
  71. */
  72. struct addr_map_win iob_memory_map_cp0[] = {
  73. /* CP0 */
  74. /* PEX1_X1 window */
  75. {0x00000000f7000000, 0x1000000, PEX1_TID},
  76. /* PEX2_X1 window */
  77. {0x00000000f8000000, 0x1000000, PEX2_TID},
  78. /* PEX0_X4 window */
  79. {0x00000000f6000000, 0x1000000, PEX0_TID},
  80. {0x00000000c0000000, 0x30000000, PEX0_TID},
  81. {0x0000000800000000, 0x100000000, PEX0_TID},
  82. };
  83. struct addr_map_win iob_memory_map_cp1[] = {
  84. /* CP1 */
  85. /* SPI1_CS0 (RUNIT) window */
  86. {0x00000000f9000000, 0x1000000, RUNIT_TID},
  87. /* PEX1_X1 window */
  88. {0x00000000fb000000, 0x1000000, PEX1_TID},
  89. /* PEX2_X1 window */
  90. {0x00000000fc000000, 0x1000000, PEX2_TID},
  91. /* PEX0_X4 window */
  92. {0x00000000fa000000, 0x1000000, PEX0_TID}
  93. };
  94. int marvell_get_iob_memory_map(struct addr_map_win **win, uint32_t *size,
  95. uintptr_t base)
  96. {
  97. switch (base) {
  98. case MVEBU_CP_REGS_BASE(0):
  99. *win = iob_memory_map_cp0;
  100. *size = ARRAY_SIZE(iob_memory_map_cp0);
  101. return 0;
  102. case MVEBU_CP_REGS_BASE(1):
  103. *win = iob_memory_map_cp1;
  104. *size = ARRAY_SIZE(iob_memory_map_cp1);
  105. return 0;
  106. default:
  107. *size = 0;
  108. *win = 0;
  109. return 1;
  110. }
  111. }
  112. #endif
  113. /*****************************************************************************
  114. * CCU Configuration
  115. *****************************************************************************
  116. */
  117. struct addr_map_win ccu_memory_map[] = {
  118. #ifdef IMAGE_BLE
  119. {0x00000000f2000000, 0x4000000, IO_0_TID}, /* IO window */
  120. #else
  121. #if LLC_SRAM
  122. /* This entry is prepared for OP-TEE OS that enables the LLC SRAM
  123. * and changes the window target to SRAM_TID.
  124. */
  125. {PLAT_MARVELL_LLC_SRAM_BASE, PLAT_MARVELL_LLC_SRAM_SIZE, DRAM_0_TID},
  126. #endif
  127. {0x00000000f2000000, 0xe000000, IO_0_TID}, /* IO window */
  128. {0x00000000c0000000, 0x30000000, IO_0_TID}, /* IO window */
  129. {0x0000000800000000, 0x100000000, IO_0_TID}, /* IO window */
  130. #endif
  131. };
  132. uint32_t marvell_get_ccu_gcr_target(int ap)
  133. {
  134. return DRAM_0_TID;
  135. }
  136. int marvell_get_ccu_memory_map(int ap, struct addr_map_win **win,
  137. uint32_t *size)
  138. {
  139. *win = ccu_memory_map;
  140. *size = ARRAY_SIZE(ccu_memory_map);
  141. return 0;
  142. }
  143. #ifndef IMAGE_BLE
  144. /*****************************************************************************
  145. * SoC PM configuration
  146. *****************************************************************************
  147. */
  148. /* CP GPIO should be used and the GPIOs should be within same GPIO register */
  149. struct power_off_method pm_cfg = {
  150. .type = PMIC_GPIO,
  151. .cfg.gpio.pin_count = 1,
  152. .cfg.gpio.info = {{0, 35} },
  153. .cfg.gpio.step_count = 7,
  154. .cfg.gpio.seq = {1, 0, 1, 0, 1, 0, 1},
  155. .cfg.gpio.delay_ms = 10,
  156. };
  157. void *plat_marvell_get_pm_cfg(void)
  158. {
  159. /* Return the PM configurations */
  160. return &pm_cfg;
  161. }
  162. /* In reference to #ifndef IMAGE_BLE, this part is used for BLE only. */
  163. #else
  164. /*****************************************************************************
  165. * SKIP IMAGE Configuration
  166. *****************************************************************************
  167. */
  168. #if PLAT_RECOVERY_IMAGE_ENABLE
  169. struct skip_image skip_im = {
  170. .detection_method = GPIO,
  171. .info.gpio.num = 33,
  172. .info.gpio.button_state = HIGH,
  173. .info.test.cp_ap = CP,
  174. .info.test.cp_index = 0,
  175. };
  176. void *plat_marvell_get_skip_image_data(void)
  177. {
  178. /* Return the skip_image configurations */
  179. return &skip_im;
  180. }
  181. #endif
  182. #endif