qos_init_m3_v10.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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 "../qos_common.h"
  9. #include "../qos_reg.h"
  10. #include "qos_init_m3_v10.h"
  11. #define RCAR_QOS_VERSION "rev.0.19"
  12. #include "qos_init_m3_v10_mstat.h"
  13. struct rcar_gen3_dbsc_qos_settings m3_v10_qos[] = {
  14. /* BUFCAM settings */
  15. /* DBSC_DBCAM0CNF0 not set */
  16. { DBSC_DBCAM0CNF1, 0x00048218U },
  17. { DBSC_DBCAM0CNF2, 0x000000F4 },
  18. { DBSC_DBCAM0CNF3, 0x00000000 },
  19. { DBSC_DBSCHCNT0, 0x080F0037 },
  20. /* DBSC_DBSCHCNT1 not set */
  21. { DBSC_DBSCHSZ0, 0x00000001 },
  22. { DBSC_DBSCHRW0, 0x22421111 },
  23. /* DDR3 */
  24. { DBSC_SCFCTST2, 0x012F1123 },
  25. /* QoS Settings */
  26. { DBSC_DBSCHQOS00, 0x00000F00 },
  27. { DBSC_DBSCHQOS01, 0x00000B00 },
  28. { DBSC_DBSCHQOS02, 0x00000000 },
  29. { DBSC_DBSCHQOS03, 0x00000000 },
  30. { DBSC_DBSCHQOS40, 0x00000300 },
  31. { DBSC_DBSCHQOS41, 0x000002F0 },
  32. { DBSC_DBSCHQOS42, 0x00000200 },
  33. { DBSC_DBSCHQOS43, 0x00000100 },
  34. { DBSC_DBSCHQOS90, 0x00000300 },
  35. { DBSC_DBSCHQOS91, 0x000002F0 },
  36. { DBSC_DBSCHQOS92, 0x00000200 },
  37. { DBSC_DBSCHQOS93, 0x00000100 },
  38. { DBSC_DBSCHQOS130, 0x00000100 },
  39. { DBSC_DBSCHQOS131, 0x000000F0 },
  40. { DBSC_DBSCHQOS132, 0x000000A0 },
  41. { DBSC_DBSCHQOS133, 0x00000040 },
  42. { DBSC_DBSCHQOS140, 0x000000C0 },
  43. { DBSC_DBSCHQOS141, 0x000000B0 },
  44. { DBSC_DBSCHQOS142, 0x00000080 },
  45. { DBSC_DBSCHQOS143, 0x00000040 },
  46. { DBSC_DBSCHQOS150, 0x00000040 },
  47. { DBSC_DBSCHQOS151, 0x00000030 },
  48. { DBSC_DBSCHQOS152, 0x00000020 },
  49. { DBSC_DBSCHQOS153, 0x00000010 },
  50. };
  51. void qos_init_m3_v10(void)
  52. {
  53. rcar_qos_dbsc_setting(m3_v10_qos, ARRAY_SIZE(m3_v10_qos), false);
  54. /* DRAM Split Address mapping */
  55. #if RCAR_DRAM_SPLIT == RCAR_DRAM_SPLIT_4CH
  56. #if RCAR_LSI == RCAR_M3
  57. #error "Don't set DRAM Split 4ch(M3)"
  58. #else
  59. ERROR("DRAM Split 4ch not supported.(M3)");
  60. panic();
  61. #endif
  62. #elif (RCAR_DRAM_SPLIT == RCAR_DRAM_SPLIT_2CH) || \
  63. (RCAR_DRAM_SPLIT == RCAR_DRAM_SPLIT_AUTO)
  64. NOTICE("BL2: DRAM Split is 2ch\n");
  65. io_write_32(AXI_ADSPLCR0, 0x00000000U);
  66. io_write_32(AXI_ADSPLCR1, ADSPLCR0_ADRMODE_DEFAULT
  67. | ADSPLCR0_SPLITSEL(0xFFU)
  68. | ADSPLCR0_AREA(0x1CU)
  69. | ADSPLCR0_SWP);
  70. io_write_32(AXI_ADSPLCR2, 0x089A0000U);
  71. io_write_32(AXI_ADSPLCR3, 0x00000000U);
  72. #else
  73. NOTICE("BL2: DRAM Split is OFF\n");
  74. #endif
  75. #if !(RCAR_QOS_TYPE == RCAR_QOS_NONE)
  76. #if RCAR_QOS_TYPE == RCAR_QOS_TYPE_DEFAULT
  77. NOTICE("BL2: QoS is default setting(%s)\n", RCAR_QOS_VERSION);
  78. #endif
  79. /* Resource Alloc setting */
  80. io_write_32(QOSCTRL_RAS, 0x00000028U);
  81. io_write_32(QOSCTRL_FIXTH, 0x000F0005U);
  82. io_write_32(QOSCTRL_REGGD, 0x00000000U);
  83. io_write_64(QOSCTRL_DANN, 0x0101010102020201UL);
  84. io_write_32(QOSCTRL_DANT, 0x00100804U);
  85. io_write_32(QOSCTRL_EC, 0x00000000U);
  86. io_write_64(QOSCTRL_EMS, 0x0000000000000000UL);
  87. io_write_32(QOSCTRL_FSS, 0x000003e8U);
  88. io_write_32(QOSCTRL_INSFC, 0xC7840001U);
  89. io_write_32(QOSCTRL_BERR, 0x00000000U);
  90. io_write_32(QOSCTRL_RACNT0, 0x00000000U);
  91. /* QOSBW setting */
  92. io_write_32(QOSCTRL_SL_INIT,
  93. SL_INIT_REFFSSLOT | SL_INIT_SLOTSSLOT | SL_INIT_SSLOTCLK);
  94. io_write_32(QOSCTRL_REF_ARS, 0x00330000U);
  95. /* QOSBW SRAM setting */
  96. uint32_t i;
  97. for (i = 0U; i < ARRAY_SIZE(mstat_fix); i++) {
  98. io_write_64(QOSBW_FIX_QOS_BANK0 + i * 8, mstat_fix[i]);
  99. io_write_64(QOSBW_FIX_QOS_BANK1 + i * 8, mstat_fix[i]);
  100. }
  101. for (i = 0U; i < ARRAY_SIZE(mstat_be); i++) {
  102. io_write_64(QOSBW_BE_QOS_BANK0 + i * 8, mstat_be[i]);
  103. io_write_64(QOSBW_BE_QOS_BANK1 + i * 8, mstat_be[i]);
  104. }
  105. /* 3DG bus Leaf setting */
  106. io_write_32(0xFD820808U, 0x00001234U);
  107. io_write_32(0xFD820800U, 0x00000006U);
  108. io_write_32(0xFD821800U, 0x00000006U);
  109. io_write_32(0xFD822800U, 0x00000006U);
  110. io_write_32(0xFD823800U, 0x00000006U);
  111. io_write_32(0xFD824800U, 0x00000006U);
  112. io_write_32(0xFD825800U, 0x00000006U);
  113. io_write_32(0xFD826800U, 0x00000006U);
  114. io_write_32(0xFD827800U, 0x00000006U);
  115. /* RT bus Leaf setting */
  116. io_write_32(0xFFC50800U, 0x00000000U);
  117. io_write_32(0xFFC51800U, 0x00000000U);
  118. /* Resource Alloc start */
  119. io_write_32(QOSCTRL_RAEN, 0x00000001U);
  120. /* QOSBW start */
  121. io_write_32(QOSCTRL_STATQC, 0x00000001U);
  122. #else
  123. NOTICE("BL2: QoS is None\n");
  124. /* Resource Alloc setting */
  125. io_write_32(QOSCTRL_EC, 0x00000000U);
  126. /* Resource Alloc start */
  127. io_write_32(QOSCTRL_RAEN, 0x00000001U);
  128. #endif /* !(RCAR_QOS_TYPE == RCAR_QOS_NONE) */
  129. }