marvell_plat_config.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * Copyright (C) 2021 Sartura Ltd.
  3. * Copyright (C) 2021 Globalscale technologies, Inc.
  4. * Copyright (C) 2021 Marvell International Ltd.
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. * https://spdx.org/licenses
  8. */
  9. #include <armada_common.h>
  10. /*
  11. * If bootrom is currently at BLE there's no need to include the memory
  12. * maps structure at this point
  13. */
  14. #include <mvebu_def.h>
  15. #ifndef IMAGE_BLE
  16. /*****************************************************************************
  17. * AMB Configuration
  18. *****************************************************************************
  19. */
  20. struct addr_map_win amb_memory_map[] = {
  21. /* CP0 SPI1 CS0 Direct Mode access */
  22. {0xf900, 0x1000000, AMB_SPI1_CS0_ID},
  23. };
  24. int marvell_get_amb_memory_map(struct addr_map_win **win,
  25. uint32_t *size, uintptr_t base)
  26. {
  27. *win = amb_memory_map;
  28. if (*win == NULL)
  29. *size = 0;
  30. else
  31. *size = ARRAY_SIZE(amb_memory_map);
  32. return 0;
  33. }
  34. #endif
  35. /*****************************************************************************
  36. * IO_WIN Configuration
  37. *****************************************************************************
  38. */
  39. struct addr_map_win io_win_memory_map[] = {
  40. #ifndef IMAGE_BLE
  41. /* MCI 0 indirect window */
  42. {MVEBU_MCI_REG_BASE_REMAP(0), 0x100000, MCI_0_TID},
  43. /* MCI 1 indirect window */
  44. {MVEBU_MCI_REG_BASE_REMAP(1), 0x100000, MCI_1_TID},
  45. #endif
  46. };
  47. uint32_t marvell_get_io_win_gcr_target(int ap_index)
  48. {
  49. return PIDI_TID;
  50. }
  51. int marvell_get_io_win_memory_map(int ap_index, struct addr_map_win **win,
  52. uint32_t *size)
  53. {
  54. *win = io_win_memory_map;
  55. if (*win == NULL)
  56. *size = 0;
  57. else
  58. *size = ARRAY_SIZE(io_win_memory_map);
  59. return 0;
  60. }
  61. #ifndef IMAGE_BLE
  62. /*****************************************************************************
  63. * IOB Configuration
  64. *****************************************************************************
  65. */
  66. struct addr_map_win iob_memory_map[] = {
  67. /* PEX1_X1 window */
  68. {0x00000000f7000000, 0x1000000, PEX1_TID},
  69. /* PEX2_X1 window */
  70. {0x00000000f8000000, 0x1000000, PEX2_TID},
  71. {0x00000000c0000000, 0x30000000, PEX2_TID},
  72. {0x0000000800000000, 0x100000000, PEX2_TID},
  73. /* PEX0_X4 window */
  74. {0x00000000f6000000, 0x1000000, PEX0_TID},
  75. /* SPI1_CS0 (RUNIT) window */
  76. {0x00000000f9000000, 0x1000000, RUNIT_TID},
  77. };
  78. int marvell_get_iob_memory_map(struct addr_map_win **win, uint32_t *size,
  79. uintptr_t base)
  80. {
  81. *win = iob_memory_map;
  82. *size = ARRAY_SIZE(iob_memory_map);
  83. return 0;
  84. }
  85. #endif
  86. /*****************************************************************************
  87. * CCU Configuration
  88. *****************************************************************************
  89. */
  90. struct addr_map_win ccu_memory_map[] = { /* IO window */
  91. #ifdef IMAGE_BLE
  92. {0x00000000f2000000, 0x4000000, IO_0_TID}, /* IO window */
  93. #else
  94. #if LLC_SRAM
  95. /* This entry is prepared for OP-TEE OS that enables the LLC SRAM
  96. * and changes the window target to SRAM_TID.
  97. */
  98. {PLAT_MARVELL_LLC_SRAM_BASE, PLAT_MARVELL_LLC_SRAM_SIZE, DRAM_0_TID},
  99. #endif
  100. {0x00000000f2000000, 0xe000000, IO_0_TID},
  101. {0x00000000c0000000, 0x30000000, IO_0_TID}, /* IO window */
  102. {0x0000000800000000, 0x100000000, IO_0_TID}, /* IO window */
  103. #endif
  104. };
  105. uint32_t marvell_get_ccu_gcr_target(int ap)
  106. {
  107. return DRAM_0_TID;
  108. }
  109. int marvell_get_ccu_memory_map(int ap_index, struct addr_map_win **win,
  110. uint32_t *size)
  111. {
  112. *win = ccu_memory_map;
  113. *size = ARRAY_SIZE(ccu_memory_map);
  114. return 0;
  115. }
  116. #ifdef IMAGE_BLE
  117. /*****************************************************************************
  118. * SKIP IMAGE Configuration
  119. *****************************************************************************
  120. */
  121. #if PLAT_RECOVERY_IMAGE_ENABLE
  122. void *plat_marvell_get_skip_image_data(void)
  123. {
  124. /* No recovery button on a70x0_mochabin board */
  125. return NULL;
  126. }
  127. #endif
  128. #endif