stm32mp2_ddr.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * Copyright (C) 2021-2024, STMicroelectronics - All Rights Reserved
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
  5. */
  6. #ifndef STM32MP2_DDR_H
  7. #define STM32MP2_DDR_H
  8. #include <stdbool.h>
  9. #include <ddrphy_phyinit_struct.h>
  10. #include <drivers/st/stm32mp_ddr.h>
  11. struct stm32mp2_ddrctrl_reg {
  12. uint32_t mstr;
  13. uint32_t mrctrl0;
  14. uint32_t mrctrl1;
  15. uint32_t mrctrl2;
  16. uint32_t derateen;
  17. uint32_t derateint;
  18. uint32_t deratectl;
  19. uint32_t pwrctl;
  20. uint32_t pwrtmg;
  21. uint32_t hwlpctl;
  22. uint32_t rfshctl0;
  23. uint32_t rfshctl1;
  24. uint32_t rfshctl3;
  25. uint32_t crcparctl0;
  26. uint32_t crcparctl1;
  27. uint32_t init0;
  28. uint32_t init1;
  29. uint32_t init2;
  30. uint32_t init3;
  31. uint32_t init4;
  32. uint32_t init5;
  33. uint32_t init6;
  34. uint32_t init7;
  35. uint32_t dimmctl;
  36. uint32_t rankctl;
  37. uint32_t rankctl1;
  38. uint32_t zqctl0;
  39. uint32_t zqctl1;
  40. uint32_t zqctl2;
  41. uint32_t dfitmg0;
  42. uint32_t dfitmg1;
  43. uint32_t dfilpcfg0;
  44. uint32_t dfilpcfg1;
  45. uint32_t dfiupd0;
  46. uint32_t dfiupd1;
  47. uint32_t dfiupd2;
  48. uint32_t dfimisc;
  49. uint32_t dfitmg2;
  50. uint32_t dfitmg3;
  51. uint32_t dbictl;
  52. uint32_t dfiphymstr;
  53. uint32_t dbg0;
  54. uint32_t dbg1;
  55. uint32_t dbgcmd;
  56. uint32_t swctl;
  57. uint32_t swctlstatic;
  58. uint32_t poisoncfg;
  59. uint32_t pccfg;
  60. };
  61. struct stm32mp2_ddrctrl_timing {
  62. uint32_t rfshtmg;
  63. uint32_t rfshtmg1;
  64. uint32_t dramtmg0;
  65. uint32_t dramtmg1;
  66. uint32_t dramtmg2;
  67. uint32_t dramtmg3;
  68. uint32_t dramtmg4;
  69. uint32_t dramtmg5;
  70. uint32_t dramtmg6;
  71. uint32_t dramtmg7;
  72. uint32_t dramtmg8;
  73. uint32_t dramtmg9;
  74. uint32_t dramtmg10;
  75. uint32_t dramtmg11;
  76. uint32_t dramtmg12;
  77. uint32_t dramtmg13;
  78. uint32_t dramtmg14;
  79. uint32_t dramtmg15;
  80. uint32_t odtcfg;
  81. uint32_t odtmap;
  82. };
  83. struct stm32mp2_ddrctrl_map {
  84. uint32_t addrmap0;
  85. uint32_t addrmap1;
  86. uint32_t addrmap2;
  87. uint32_t addrmap3;
  88. uint32_t addrmap4;
  89. uint32_t addrmap5;
  90. uint32_t addrmap6;
  91. uint32_t addrmap7;
  92. uint32_t addrmap8;
  93. uint32_t addrmap9;
  94. uint32_t addrmap10;
  95. uint32_t addrmap11;
  96. };
  97. struct stm32mp2_ddrctrl_perf {
  98. uint32_t sched;
  99. uint32_t sched1;
  100. uint32_t perfhpr1;
  101. uint32_t perflpr1;
  102. uint32_t perfwr1;
  103. uint32_t sched3;
  104. uint32_t sched4;
  105. uint32_t pcfgr_0;
  106. uint32_t pcfgw_0;
  107. uint32_t pctrl_0;
  108. uint32_t pcfgqos0_0;
  109. uint32_t pcfgqos1_0;
  110. uint32_t pcfgwqos0_0;
  111. uint32_t pcfgwqos1_0;
  112. #if STM32MP_DDR_DUAL_AXI_PORT
  113. uint32_t pcfgr_1;
  114. uint32_t pcfgw_1;
  115. uint32_t pctrl_1;
  116. uint32_t pcfgqos0_1;
  117. uint32_t pcfgqos1_1;
  118. uint32_t pcfgwqos0_1;
  119. uint32_t pcfgwqos1_1;
  120. #endif /* STM32MP_DDR_DUAL_AXI_PORT */
  121. };
  122. struct stm32mp_ddr_config {
  123. struct stm32mp_ddr_info info;
  124. struct stm32mp2_ddrctrl_reg c_reg;
  125. struct stm32mp2_ddrctrl_timing c_timing;
  126. struct stm32mp2_ddrctrl_map c_map;
  127. struct stm32mp2_ddrctrl_perf c_perf;
  128. bool self_refresh;
  129. uint32_t zdata;
  130. struct user_input_basic uib;
  131. struct user_input_advanced uia;
  132. struct user_input_mode_register uim;
  133. struct user_input_swizzle uis;
  134. };
  135. void stm32mp2_ddr_init(struct stm32mp_ddr_priv *priv, struct stm32mp_ddr_config *config);
  136. #endif /* STM32MP2_DDR_H */