qos_init_e3_v10.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * Copyright (c) 2018-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_e3_v10.h"
  11. #define RCAR_QOS_VERSION "rev.0.05"
  12. #define REF_ARS_ARBSTOPCYCLE_E3 (((SL_INIT_SSLOTCLK_E3) - 5U) << 16U)
  13. #if RCAR_QOS_TYPE == RCAR_QOS_TYPE_DEFAULT
  14. #if RCAR_REF_INT == RCAR_REF_DEFAULT
  15. #include "qos_init_e3_v10_mstat390.h"
  16. #else
  17. #include "qos_init_e3_v10_mstat780.h"
  18. #endif
  19. #endif
  20. struct rcar_gen3_dbsc_qos_settings e3_qos[] = {
  21. /* BUFCAM settings */
  22. { DBSC_DBCAM0CNF1, 0x00048218U },
  23. { DBSC_DBCAM0CNF2, 0x000000F4 },
  24. { DBSC_DBSCHCNT0, 0x000F0037 },
  25. { DBSC_DBSCHSZ0, 0x00000001 },
  26. { DBSC_DBSCHRW0, 0x22421111 },
  27. /* DDR3 */
  28. { DBSC_SCFCTST2, 0x012F1123 },
  29. /* QoS Settings */
  30. { DBSC_DBSCHQOS00, 0x00000F00 },
  31. { DBSC_DBSCHQOS01, 0x00000B00 },
  32. { DBSC_DBSCHQOS02, 0x00000000 },
  33. { DBSC_DBSCHQOS03, 0x00000000 },
  34. { DBSC_DBSCHQOS40, 0x00000300 },
  35. { DBSC_DBSCHQOS41, 0x000002F0 },
  36. { DBSC_DBSCHQOS42, 0x00000200 },
  37. { DBSC_DBSCHQOS43, 0x00000100 },
  38. { DBSC_DBSCHQOS90, 0x00000100 },
  39. { DBSC_DBSCHQOS91, 0x000000F0 },
  40. { DBSC_DBSCHQOS92, 0x000000A0 },
  41. { DBSC_DBSCHQOS93, 0x00000040 },
  42. { DBSC_DBSCHQOS130, 0x00000100 },
  43. { DBSC_DBSCHQOS131, 0x000000F0 },
  44. { DBSC_DBSCHQOS132, 0x000000A0 },
  45. { DBSC_DBSCHQOS133, 0x00000040 },
  46. { DBSC_DBSCHQOS140, 0x000000C0 },
  47. { DBSC_DBSCHQOS141, 0x000000B0 },
  48. { DBSC_DBSCHQOS142, 0x00000080 },
  49. { DBSC_DBSCHQOS143, 0x00000040 },
  50. { DBSC_DBSCHQOS150, 0x00000040 },
  51. { DBSC_DBSCHQOS151, 0x00000030 },
  52. { DBSC_DBSCHQOS152, 0x00000020 },
  53. { DBSC_DBSCHQOS153, 0x00000010 },
  54. };
  55. void qos_init_e3_v10(void)
  56. {
  57. rcar_qos_dbsc_setting(e3_qos, ARRAY_SIZE(e3_qos), true);
  58. /* DRAM Split Address mapping */
  59. #if RCAR_DRAM_SPLIT == RCAR_DRAM_SPLIT_4CH
  60. #if RCAR_LSI == RCAR_E3
  61. #error "Don't set DRAM Split 4ch(E3)"
  62. #else
  63. ERROR("DRAM Split 4ch not supported.(E3)");
  64. panic();
  65. #endif
  66. #elif (RCAR_DRAM_SPLIT == RCAR_DRAM_SPLIT_2CH)
  67. #if RCAR_LSI == RCAR_E3
  68. #error "Don't set DRAM Split 2ch(E3)"
  69. #else
  70. ERROR("DRAM Split 2ch not supported.(E3)");
  71. panic();
  72. #endif
  73. #else
  74. NOTICE("BL2: DRAM Split is OFF\n");
  75. #endif
  76. #if !(RCAR_QOS_TYPE == RCAR_QOS_NONE)
  77. #if RCAR_QOS_TYPE == RCAR_QOS_TYPE_DEFAULT
  78. NOTICE("BL2: QoS is default setting(%s)\n", RCAR_QOS_VERSION);
  79. #endif
  80. #if RCAR_REF_INT == RCAR_REF_DEFAULT
  81. NOTICE("BL2: DRAM refresh interval 3.9 usec\n");
  82. #else
  83. NOTICE("BL2: DRAM refresh interval 7.8 usec\n");
  84. #endif
  85. io_write_32(QOSCTRL_RAS, 0x00000020U);
  86. io_write_64(QOSCTRL_DANN, 0x0404020002020201UL);
  87. io_write_32(QOSCTRL_DANT, 0x00100804U);
  88. io_write_32(QOSCTRL_FSS, 0x0000000AU);
  89. io_write_32(QOSCTRL_INSFC, 0x06330001U);
  90. io_write_32(QOSCTRL_EARLYR, 0x00000000U);
  91. io_write_32(QOSCTRL_RACNT0, 0x00010003U);
  92. io_write_32(QOSCTRL_SL_INIT,
  93. SL_INIT_REFFSSLOT | SL_INIT_SLOTSSLOT |
  94. SL_INIT_SSLOTCLK_E3);
  95. io_write_32(QOSCTRL_REF_ARS, REF_ARS_ARBSTOPCYCLE_E3);
  96. /* QOSBW SRAM setting */
  97. uint32_t i;
  98. for (i = 0U; i < ARRAY_SIZE(mstat_fix); i++) {
  99. io_write_64(QOSBW_FIX_QOS_BANK0 + i * 8, mstat_fix[i]);
  100. io_write_64(QOSBW_FIX_QOS_BANK1 + i * 8, mstat_fix[i]);
  101. }
  102. for (i = 0U; i < ARRAY_SIZE(mstat_be); i++) {
  103. io_write_64(QOSBW_BE_QOS_BANK0 + i * 8, mstat_be[i]);
  104. io_write_64(QOSBW_BE_QOS_BANK1 + i * 8, mstat_be[i]);
  105. }
  106. /* RT bus Leaf setting */
  107. io_write_32(RT_ACT0, 0x00000000U);
  108. io_write_32(RT_ACT1, 0x00000000U);
  109. /* CCI bus Leaf setting */
  110. io_write_32(CPU_ACT0, 0x00000003U);
  111. io_write_32(CPU_ACT1, 0x00000003U);
  112. io_write_32(QOSCTRL_RAEN, 0x00000001U);
  113. io_write_32(QOSCTRL_STATQC, 0x00000001U);
  114. #else
  115. NOTICE("BL2: QoS is None\n");
  116. io_write_32(QOSCTRL_RAEN, 0x00000001U);
  117. #endif
  118. }