ddr3_training_ip_def.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. * Copyright (C) Marvell International Ltd. and its affiliates
  3. *
  4. * SPDX-License-Identifier: GPL-2.0
  5. */
  6. #ifndef _DDR3_TRAINING_IP_DEF_H
  7. #define _DDR3_TRAINING_IP_DEF_H
  8. #include "silicon_if.h"
  9. #define PATTERN_55 0x55555555
  10. #define PATTERN_AA 0xaaaaaaaa
  11. #define PATTERN_80 0x80808080
  12. #define PATTERN_20 0x20202020
  13. #define PATTERN_01 0x01010101
  14. #define PATTERN_FF 0xffffffff
  15. #define PATTERN_00 0x00000000
  16. /* 16bit bus width patterns */
  17. #define PATTERN_55AA 0x5555aaaa
  18. #define PATTERN_00FF 0x0000ffff
  19. #define PATTERN_0080 0x00008080
  20. #define INVALID_VALUE 0xffffffff
  21. #define MAX_NUM_OF_DUNITS 32
  22. /*
  23. * length *2 = length in words of pattern, first low address,
  24. * second high address
  25. */
  26. #define TEST_PATTERN_LENGTH 4
  27. #define KILLER_PATTERN_DQ_NUMBER 8
  28. #define SSO_DQ_NUMBER 4
  29. #define PATTERN_MAXIMUM_LENGTH 64
  30. #define ADLL_TX_LENGTH 64
  31. #define ADLL_RX_LENGTH 32
  32. #define PARAM_NOT_CARE 0
  33. #define READ_LEVELING_PHY_OFFSET 2
  34. #define WRITE_LEVELING_PHY_OFFSET 0
  35. #define MASK_ALL_BITS 0xffffffff
  36. #define CS_BIT_MASK 0xf
  37. /* DFX access */
  38. #define BROADCAST_ID 28
  39. #define MULTICAST_ID 29
  40. #define XSB_BASE_ADDR 0x00004000
  41. #define XSB_CTRL_0_REG 0x00000000
  42. #define XSB_CTRL_1_REG 0x00000004
  43. #define XSB_CMD_REG 0x00000008
  44. #define XSB_ADDRESS_REG 0x0000000c
  45. #define XSB_DATA_REG 0x00000010
  46. #define PIPE_ENABLE_ADDR 0x000f8000
  47. #define ENABLE_DDR_TUNING_ADDR 0x000f829c
  48. #define CLIENT_BASE_ADDR 0x00002000
  49. #define CLIENT_CTRL_REG 0x00000000
  50. #define TARGET_INT 0x1801
  51. #define TARGET_EXT 0x180e
  52. #define BYTE_EN 0
  53. #define CMD_READ 0
  54. #define CMD_WRITE 1
  55. #define INTERNAL_ACCESS_PORT 1
  56. #define EXECUTING 1
  57. #define ACCESS_EXT 1
  58. #define CS2_EXIST_BIT 2
  59. #define TRAINING_ID 0xf
  60. #define EXT_TRAINING_ID 1
  61. #define EXT_MODE 0x4
  62. #define GET_RESULT_STATE(res) (res)
  63. #define SET_RESULT_STATE(res, state) (res = state)
  64. #define _1K 0x00000400
  65. #define _4K 0x00001000
  66. #define _8K 0x00002000
  67. #define _16K 0x00004000
  68. #define _32K 0x00008000
  69. #define _64K 0x00010000
  70. #define _128K 0x00020000
  71. #define _256K 0x00040000
  72. #define _512K 0x00080000
  73. #define _1M 0x00100000
  74. #define _2M 0x00200000
  75. #define _4M 0x00400000
  76. #define _8M 0x00800000
  77. #define _16M 0x01000000
  78. #define _32M 0x02000000
  79. #define _64M 0x04000000
  80. #define _128M 0x08000000
  81. #define _256M 0x10000000
  82. #define _512M 0x20000000
  83. #define _1G 0x40000000
  84. #define _2G 0x80000000
  85. #define ADDR_SIZE_512MB 0x04000000
  86. #define ADDR_SIZE_1GB 0x08000000
  87. #define ADDR_SIZE_2GB 0x10000000
  88. #define ADDR_SIZE_4GB 0x20000000
  89. #define ADDR_SIZE_8GB 0x40000000
  90. enum hws_edge_compare {
  91. EDGE_PF,
  92. EDGE_FP,
  93. EDGE_FPF,
  94. EDGE_PFP
  95. };
  96. enum hws_control_element {
  97. HWS_CONTROL_ELEMENT_ADLL, /* per bit 1 edge */
  98. HWS_CONTROL_ELEMENT_DQ_SKEW,
  99. HWS_CONTROL_ELEMENT_DQS_SKEW
  100. };
  101. enum hws_search_dir {
  102. HWS_LOW2HIGH,
  103. HWS_HIGH2LOW,
  104. HWS_SEARCH_DIR_LIMIT
  105. };
  106. enum hws_page_size {
  107. PAGE_SIZE_1K,
  108. PAGE_SIZE_2K
  109. };
  110. enum hws_operation {
  111. OPERATION_READ = 0,
  112. OPERATION_WRITE = 1
  113. };
  114. enum hws_training_ip_stat {
  115. HWS_TRAINING_IP_STATUS_FAIL,
  116. HWS_TRAINING_IP_STATUS_SUCCESS,
  117. HWS_TRAINING_IP_STATUS_TIMEOUT
  118. };
  119. enum hws_ddr_cs {
  120. CS_SINGLE,
  121. CS_NON_SINGLE
  122. };
  123. enum hws_ddr_phy {
  124. DDR_PHY_DATA = 0,
  125. DDR_PHY_CONTROL = 1
  126. };
  127. enum hws_dir {
  128. OPER_WRITE,
  129. OPER_READ,
  130. OPER_WRITE_AND_READ
  131. };
  132. enum hws_wl_supp {
  133. PHASE_SHIFT,
  134. CLOCK_SHIFT,
  135. ALIGN_SHIFT
  136. };
  137. struct reg_data {
  138. u32 reg_addr;
  139. u32 reg_data;
  140. u32 reg_mask;
  141. };
  142. #endif /* _DDR3_TRAINING_IP_DEF_H */