marvell_plat_config.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. /* CP0 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,
  23. uint32_t *size, 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. #ifndef IMAGE_BLE
  39. /* MCI 0 indirect window */
  40. {MVEBU_MCI_REG_BASE_REMAP(0), 0x100000, MCI_0_TID},
  41. /* MCI 1 indirect window */
  42. {MVEBU_MCI_REG_BASE_REMAP(1), 0x100000, MCI_1_TID},
  43. #endif
  44. };
  45. uint32_t marvell_get_io_win_gcr_target(int ap_index)
  46. {
  47. return PIDI_TID;
  48. }
  49. int marvell_get_io_win_memory_map(int ap_index, struct addr_map_win **win,
  50. uint32_t *size)
  51. {
  52. *win = io_win_memory_map;
  53. if (*win == NULL)
  54. *size = 0;
  55. else
  56. *size = ARRAY_SIZE(io_win_memory_map);
  57. return 0;
  58. }
  59. #ifndef IMAGE_BLE
  60. /*****************************************************************************
  61. * IOB Configuration
  62. *****************************************************************************
  63. */
  64. struct addr_map_win iob_memory_map[] = {
  65. /* PEX1_X1 window */
  66. {0x00000000f7000000, 0x1000000, PEX1_TID},
  67. /* PEX2_X1 window */
  68. {0x00000000f8000000, 0x1000000, PEX2_TID},
  69. {0x00000000c0000000, 0x30000000, PEX2_TID},
  70. {0x0000000800000000, 0x100000000, PEX2_TID},
  71. /* PEX0_X4 window */
  72. {0x00000000f6000000, 0x1000000, PEX0_TID},
  73. /* SPI1_CS0 (RUNIT) window */
  74. {0x00000000f9000000, 0x1000000, RUNIT_TID},
  75. };
  76. int marvell_get_iob_memory_map(struct addr_map_win **win, uint32_t *size,
  77. uintptr_t base)
  78. {
  79. *win = iob_memory_map;
  80. *size = ARRAY_SIZE(iob_memory_map);
  81. return 0;
  82. }
  83. #endif
  84. /*****************************************************************************
  85. * CCU Configuration
  86. *****************************************************************************
  87. */
  88. struct addr_map_win ccu_memory_map[] = { /* IO window */
  89. #ifdef IMAGE_BLE
  90. {0x00000000f2000000, 0x4000000, IO_0_TID}, /* IO window */
  91. #else
  92. #if LLC_SRAM
  93. /* This entry is prepared for OP-TEE OS that enables the LLC SRAM
  94. * and changes the window target to SRAM_TID.
  95. */
  96. {PLAT_MARVELL_LLC_SRAM_BASE, PLAT_MARVELL_LLC_SRAM_SIZE, DRAM_0_TID},
  97. #endif
  98. {0x00000000f2000000, 0xe000000, IO_0_TID},
  99. {0x00000000c0000000, 0x30000000, IO_0_TID}, /* IO window */
  100. {0x0000000800000000, 0x100000000, IO_0_TID}, /* IO window */
  101. #endif
  102. };
  103. uint32_t marvell_get_ccu_gcr_target(int ap)
  104. {
  105. return DRAM_0_TID;
  106. }
  107. int marvell_get_ccu_memory_map(int ap_index, struct addr_map_win **win,
  108. uint32_t *size)
  109. {
  110. *win = ccu_memory_map;
  111. *size = ARRAY_SIZE(ccu_memory_map);
  112. return 0;
  113. }
  114. #ifdef IMAGE_BLE
  115. /*****************************************************************************
  116. * SKIP IMAGE Configuration
  117. *****************************************************************************
  118. */
  119. #if PLAT_RECOVERY_IMAGE_ENABLE
  120. struct skip_image skip_im = {
  121. .detection_method = GPIO,
  122. .info.gpio.num = 33,
  123. .info.gpio.button_state = HIGH,
  124. .info.test.cp_ap = CP,
  125. .info.test.cp_index = 0,
  126. };
  127. void *plat_marvell_get_skip_image_data(void)
  128. {
  129. /* Return the skip_image configurations */
  130. return &skip_im;
  131. }
  132. #endif
  133. #endif