stm32mp1_ddr.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * Copyright (C) 2018-2022, STMicroelectronics - All Rights Reserved
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
  5. */
  6. #ifndef STM32MP1_DDR_H
  7. #define STM32MP1_DDR_H
  8. #include <stdbool.h>
  9. #include <stdint.h>
  10. #include <drivers/st/stm32mp_ddr.h>
  11. struct stm32mp1_ddrctrl_reg {
  12. uint32_t mstr;
  13. uint32_t mrctrl0;
  14. uint32_t mrctrl1;
  15. uint32_t derateen;
  16. uint32_t derateint;
  17. uint32_t pwrctl;
  18. uint32_t pwrtmg;
  19. uint32_t hwlpctl;
  20. uint32_t rfshctl0;
  21. uint32_t rfshctl3;
  22. uint32_t crcparctl0;
  23. uint32_t zqctl0;
  24. uint32_t dfitmg0;
  25. uint32_t dfitmg1;
  26. uint32_t dfilpcfg0;
  27. uint32_t dfiupd0;
  28. uint32_t dfiupd1;
  29. uint32_t dfiupd2;
  30. uint32_t dfiphymstr;
  31. uint32_t odtmap;
  32. uint32_t dbg0;
  33. uint32_t dbg1;
  34. uint32_t dbgcmd;
  35. uint32_t poisoncfg;
  36. uint32_t pccfg;
  37. };
  38. struct stm32mp1_ddrctrl_timing {
  39. uint32_t rfshtmg;
  40. uint32_t dramtmg0;
  41. uint32_t dramtmg1;
  42. uint32_t dramtmg2;
  43. uint32_t dramtmg3;
  44. uint32_t dramtmg4;
  45. uint32_t dramtmg5;
  46. uint32_t dramtmg6;
  47. uint32_t dramtmg7;
  48. uint32_t dramtmg8;
  49. uint32_t dramtmg14;
  50. uint32_t odtcfg;
  51. };
  52. struct stm32mp1_ddrctrl_map {
  53. uint32_t addrmap1;
  54. uint32_t addrmap2;
  55. uint32_t addrmap3;
  56. uint32_t addrmap4;
  57. uint32_t addrmap5;
  58. uint32_t addrmap6;
  59. uint32_t addrmap9;
  60. uint32_t addrmap10;
  61. uint32_t addrmap11;
  62. };
  63. struct stm32mp1_ddrctrl_perf {
  64. uint32_t sched;
  65. uint32_t sched1;
  66. uint32_t perfhpr1;
  67. uint32_t perflpr1;
  68. uint32_t perfwr1;
  69. uint32_t pcfgr_0;
  70. uint32_t pcfgw_0;
  71. uint32_t pcfgqos0_0;
  72. uint32_t pcfgqos1_0;
  73. uint32_t pcfgwqos0_0;
  74. uint32_t pcfgwqos1_0;
  75. #if STM32MP_DDR_DUAL_AXI_PORT
  76. uint32_t pcfgr_1;
  77. uint32_t pcfgw_1;
  78. uint32_t pcfgqos0_1;
  79. uint32_t pcfgqos1_1;
  80. uint32_t pcfgwqos0_1;
  81. uint32_t pcfgwqos1_1;
  82. #endif
  83. };
  84. struct stm32mp1_ddrphy_reg {
  85. uint32_t pgcr;
  86. uint32_t aciocr;
  87. uint32_t dxccr;
  88. uint32_t dsgcr;
  89. uint32_t dcr;
  90. uint32_t odtcr;
  91. uint32_t zq0cr1;
  92. uint32_t dx0gcr;
  93. uint32_t dx1gcr;
  94. #if STM32MP_DDR_32BIT_INTERFACE
  95. uint32_t dx2gcr;
  96. uint32_t dx3gcr;
  97. #endif
  98. };
  99. struct stm32mp1_ddrphy_timing {
  100. uint32_t ptr0;
  101. uint32_t ptr1;
  102. uint32_t ptr2;
  103. uint32_t dtpr0;
  104. uint32_t dtpr1;
  105. uint32_t dtpr2;
  106. uint32_t mr0;
  107. uint32_t mr1;
  108. uint32_t mr2;
  109. uint32_t mr3;
  110. };
  111. struct stm32mp_ddr_config {
  112. struct stm32mp_ddr_info info;
  113. struct stm32mp1_ddrctrl_reg c_reg;
  114. struct stm32mp1_ddrctrl_timing c_timing;
  115. struct stm32mp1_ddrctrl_map c_map;
  116. struct stm32mp1_ddrctrl_perf c_perf;
  117. struct stm32mp1_ddrphy_reg p_reg;
  118. struct stm32mp1_ddrphy_timing p_timing;
  119. };
  120. int stm32mp1_ddr_clk_enable(struct stm32mp_ddr_priv *priv, uint32_t mem_speed);
  121. void stm32mp1_ddr_init(struct stm32mp_ddr_priv *priv, struct stm32mp_ddr_config *config);
  122. #endif /* STM32MP1_DDR_H */