qos_init_h3_v11.c 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. * Copyright (c) 2015-2024, Renesas Electronics Corporation. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <stdint.h>
  7. #include <common/debug.h>
  8. #include <rcar_def.h>
  9. #include "../qos_common.h"
  10. #include "../qos_reg.h"
  11. #include "qos_init_h3_v11.h"
  12. #define RCAR_QOS_VERSION "rev.0.37"
  13. #include "qos_init_h3_v11_mstat.h"
  14. struct rcar_gen3_dbsc_qos_settings h3_v11_qos[] = {
  15. /* BUFCAM settings */
  16. /* DBSC_DBCAM0CNF0 not set */
  17. { DBSC_DBCAM0CNF1, 0x00048218U },
  18. { DBSC_DBCAM0CNF2, 0x000000F4 },
  19. /* DBSC_DBCAM0CNF3 not set */
  20. { DBSC_DBSCHCNT0, 0x080F0037 },
  21. { DBSC_DBSCHCNT1, 0x00001010 },
  22. { DBSC_DBSCHSZ0, 0x00000001 },
  23. { DBSC_DBSCHRW0, 0x22421111 },
  24. /* DDR3 */
  25. { DBSC_SCFCTST2, 0x012F1123 },
  26. /* QoS Settings */
  27. { DBSC_DBSCHQOS00, 0x0000F000 },
  28. { DBSC_DBSCHQOS01, 0x0000E000 },
  29. { DBSC_DBSCHQOS02, 0x00007000 },
  30. { DBSC_DBSCHQOS03, 0x00000000 },
  31. { DBSC_DBSCHQOS40, 0x00000E00 },
  32. { DBSC_DBSCHQOS41, 0x00000DFF },
  33. { DBSC_DBSCHQOS42, 0x00000400 },
  34. { DBSC_DBSCHQOS43, 0x00000200 },
  35. { DBSC_DBSCHQOS90, 0x00000C00 },
  36. { DBSC_DBSCHQOS91, 0x00000BFF },
  37. { DBSC_DBSCHQOS92, 0x00000400 },
  38. { DBSC_DBSCHQOS93, 0x00000200 },
  39. { DBSC_DBSCHQOS130, 0x00000980 },
  40. { DBSC_DBSCHQOS131, 0x0000097F },
  41. { DBSC_DBSCHQOS132, 0x00000300 },
  42. { DBSC_DBSCHQOS133, 0x00000180 },
  43. { DBSC_DBSCHQOS140, 0x00000800 },
  44. { DBSC_DBSCHQOS141, 0x000007FF },
  45. { DBSC_DBSCHQOS142, 0x00000300 },
  46. { DBSC_DBSCHQOS143, 0x00000180 },
  47. { DBSC_DBSCHQOS150, 0x000007D0 },
  48. { DBSC_DBSCHQOS151, 0x000007CF },
  49. { DBSC_DBSCHQOS152, 0x000005D0 },
  50. { DBSC_DBSCHQOS153, 0x000003D0 },
  51. };
  52. void qos_init_h3_v11(void)
  53. {
  54. rcar_qos_dbsc_setting(h3_v11_qos, ARRAY_SIZE(h3_v11_qos), false);
  55. /* DRAM Split Address mapping */
  56. #if (RCAR_DRAM_SPLIT == RCAR_DRAM_SPLIT_4CH) || \
  57. (RCAR_DRAM_SPLIT == RCAR_DRAM_SPLIT_AUTO)
  58. NOTICE("BL2: DRAM Split is 4ch\n");
  59. io_write_32(AXI_ADSPLCR0, ADSPLCR0_ADRMODE_DEFAULT
  60. | ADSPLCR0_SPLITSEL(0xFFU)
  61. | ADSPLCR0_AREA(0x1BU)
  62. | ADSPLCR0_SWP);
  63. io_write_32(AXI_ADSPLCR1, 0x00000000U);
  64. io_write_32(AXI_ADSPLCR2, 0xA8A90000U);
  65. io_write_32(AXI_ADSPLCR3, 0x00000000U);
  66. #elif RCAR_DRAM_SPLIT == RCAR_DRAM_SPLIT_2CH
  67. NOTICE("BL2: DRAM Split is 2ch\n");
  68. io_write_32(AXI_ADSPLCR0, 0x00000000U);
  69. io_write_32(AXI_ADSPLCR1, ADSPLCR0_ADRMODE_DEFAULT
  70. | ADSPLCR0_SPLITSEL(0xFFU)
  71. | ADSPLCR0_AREA(0x1BU)
  72. | ADSPLCR0_SWP);
  73. io_write_32(AXI_ADSPLCR2, 0x00000000U);
  74. io_write_32(AXI_ADSPLCR3, 0x00000000U);
  75. #else
  76. NOTICE("BL2: DRAM Split is OFF\n");
  77. #endif
  78. #if !(RCAR_QOS_TYPE == RCAR_QOS_NONE)
  79. #if RCAR_QOS_TYPE == RCAR_QOS_TYPE_DEFAULT
  80. NOTICE("BL2: QoS is default setting(%s)\n", RCAR_QOS_VERSION);
  81. #endif
  82. /* AR Cache setting */
  83. io_write_32(0xE67D1000U, 0x00000100U);
  84. io_write_32(0xE67D1008U, 0x00000100U);
  85. /* Resource Alloc setting */
  86. #if RCAR_DRAM_SPLIT == RCAR_DRAM_SPLIT_2CH
  87. io_write_32(QOSCTRL_RAS, 0x00000020U);
  88. #else
  89. io_write_32(QOSCTRL_RAS, 0x00000040U);
  90. #endif
  91. io_write_32(QOSCTRL_FIXTH, 0x000F0005U);
  92. io_write_32(QOSCTRL_REGGD, 0x00000000U);
  93. #if RCAR_DRAM_SPLIT == RCAR_DRAM_SPLIT_2CH
  94. io_write_64(QOSCTRL_DANN, 0x0101010102020201UL);
  95. io_write_32(QOSCTRL_DANT, 0x00181008U);
  96. #else
  97. io_write_64(QOSCTRL_DANN, 0x0101000004040401UL);
  98. io_write_32(QOSCTRL_DANT, 0x003C2010U);
  99. #endif
  100. io_write_32(QOSCTRL_EC, 0x00080001U); /* need for H3 v1.* */
  101. io_write_64(QOSCTRL_EMS, 0x0000000000000000UL);
  102. io_write_32(QOSCTRL_INSFC, 0xC7840001U);
  103. io_write_32(QOSCTRL_BERR, 0x00000000U);
  104. io_write_32(QOSCTRL_RACNT0, 0x00000000U);
  105. /* QOSBW setting */
  106. io_write_32(QOSCTRL_SL_INIT,
  107. SL_INIT_REFFSSLOT | SL_INIT_SLOTSSLOT | SL_INIT_SSLOTCLK);
  108. io_write_32(QOSCTRL_REF_ARS, 0x00330000U);
  109. /* QOSBW SRAM setting */
  110. uint32_t i;
  111. for (i = 0U; i < ARRAY_SIZE(mstat_fix); i++) {
  112. io_write_64(QOSBW_FIX_QOS_BANK0 + i * 8, mstat_fix[i]);
  113. io_write_64(QOSBW_FIX_QOS_BANK1 + i * 8, mstat_fix[i]);
  114. }
  115. for (i = 0U; i < ARRAY_SIZE(mstat_be); i++) {
  116. io_write_64(QOSBW_BE_QOS_BANK0 + i * 8, mstat_be[i]);
  117. io_write_64(QOSBW_BE_QOS_BANK1 + i * 8, mstat_be[i]);
  118. }
  119. /* 3DG bus Leaf setting */
  120. io_write_32(0xFD820808U, 0x00001234U);
  121. io_write_32(0xFD820800U, 0x0000003FU);
  122. io_write_32(0xFD821800U, 0x0000003FU);
  123. io_write_32(0xFD822800U, 0x0000003FU);
  124. io_write_32(0xFD823800U, 0x0000003FU);
  125. io_write_32(0xFD824800U, 0x0000003FU);
  126. io_write_32(0xFD825800U, 0x0000003FU);
  127. io_write_32(0xFD826800U, 0x0000003FU);
  128. io_write_32(0xFD827800U, 0x0000003FU);
  129. /* VIO bus Leaf setting */
  130. io_write_32(0xFEB89800, 0x00000001U);
  131. io_write_32(0xFEB8A800, 0x00000001U);
  132. io_write_32(0xFEB8B800, 0x00000001U);
  133. io_write_32(0xFEB8C800, 0x00000001U);
  134. /* HSC bus Leaf setting */
  135. io_write_32(0xE6430800, 0x00000001U);
  136. io_write_32(0xE6431800, 0x00000001U);
  137. io_write_32(0xE6432800, 0x00000001U);
  138. io_write_32(0xE6433800, 0x00000001U);
  139. /* MP bus Leaf setting */
  140. io_write_32(0xEC620800, 0x00000001U);
  141. io_write_32(0xEC621800, 0x00000001U);
  142. /* PERIE bus Leaf setting */
  143. io_write_32(0xE7760800, 0x00000001U);
  144. io_write_32(0xE7768800, 0x00000001U);
  145. /* PERIW bus Leaf setting */
  146. io_write_32(0xE6760800, 0x00000001U);
  147. io_write_32(0xE6768800, 0x00000001U);
  148. /* RT bus Leaf setting */
  149. io_write_32(0xFFC50800, 0x00000001U);
  150. io_write_32(0xFFC51800, 0x00000001U);
  151. /* CCI bus Leaf setting */
  152. uint32_t modemr = io_read_32(RCAR_MODEMR);
  153. modemr &= MODEMR_BOOT_CPU_MASK;
  154. if ((modemr == MODEMR_BOOT_CPU_CA57) ||
  155. (modemr == MODEMR_BOOT_CPU_CA53)) {
  156. io_write_32(0xF1300800, 0x00000001U);
  157. io_write_32(0xF1340800, 0x00000001U);
  158. io_write_32(0xF1380800, 0x00000001U);
  159. io_write_32(0xF13C0800, 0x00000001U);
  160. }
  161. /* Resource Alloc start */
  162. io_write_32(QOSCTRL_RAEN, 0x00000001U);
  163. /* QOSBW start */
  164. io_write_32(QOSCTRL_STATQC, 0x00000001U);
  165. #else
  166. NOTICE("BL2: QoS is None\n");
  167. /* Resource Alloc setting */
  168. io_write_32(QOSCTRL_EC, 0x00080001U); /* need for H3 v1.* */
  169. #endif /* !(RCAR_QOS_TYPE == RCAR_QOS_NONE) */
  170. }