ddr2_regs.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * (c) 2015 Purna Chandra Mandal <purna.mandal@microchip.com>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. *
  6. */
  7. #ifndef __MICROCHIP_DDR2_REGS_H
  8. #define __MICROCHIP_DDR2_REGS_H
  9. #include <linux/bitops.h>
  10. /* DDR2 Controller */
  11. struct ddr2_ctrl_regs {
  12. u32 tsel;
  13. u32 minlim;
  14. u32 reqprd;
  15. u32 mincmd;
  16. u32 memcon;
  17. u32 memcfg0;
  18. u32 memcfg1;
  19. u32 memcfg2;
  20. u32 memcfg3;
  21. u32 memcfg4;
  22. u32 refcfg;
  23. u32 pwrcfg;
  24. u32 dlycfg0;
  25. u32 dlycfg1;
  26. u32 dlycfg2;
  27. u32 dlycfg3;
  28. u32 odtcfg;
  29. u32 xfercfg;
  30. u32 cmdissue;
  31. u32 odtencfg;
  32. u32 memwidth;
  33. u32 unused[11];
  34. u32 cmd10[16];
  35. u32 cmd20[16];
  36. };
  37. /* Arbiter Config */
  38. #define MIN_LIM_WIDTH 5
  39. #define RQST_PERIOD_WIDTH 8
  40. #define MIN_CMDACPT_WIDTH 8
  41. /* Refresh Config */
  42. #define REFCNT_CLK(x) (x)
  43. #define REFDLY_CLK(x) ((x) << 16)
  44. #define MAX_PEND_REF(x) ((x) << 24)
  45. /* Power Config */
  46. #define PRECH_PWR_DN_ONLY(x) ((x) << 22)
  47. #define SELF_REF_DLY(x) ((x) << 12)
  48. #define PWR_DN_DLY(x) ((x) << 4)
  49. #define EN_AUTO_SELF_REF(x) ((x) << 3)
  50. #define EN_AUTO_PWR_DN(x) ((x) << 2)
  51. #define ERR_CORR_EN(x) ((x) << 1)
  52. #define ECC_EN(x) (x)
  53. /* Memory Width */
  54. #define HALF_RATE_MODE BIT(3)
  55. /* Delay Config */
  56. #define ODTWLEN(x) ((x) << 20)
  57. #define ODTRLEN(x) ((x) << 16)
  58. #define ODTWDLY(x) ((x) << 12)
  59. #define ODTRDLY(x) ((x) << 8)
  60. /* Xfer Config */
  61. #define BIG_ENDIAN(x) ((x) << 31)
  62. #define MAX_BURST(x) ((x) << 24)
  63. #define RDATENDLY(x) ((x) << 16)
  64. #define NXDATAVDLY(x) ((x) << 4)
  65. #define NXTDATRQDLY(x) ((x) << 0)
  66. /* Host Commands */
  67. #define IDLE_NOP 0x00ffffff
  68. #define PRECH_ALL_CMD 0x00fff401
  69. #define REF_CMD 0x00fff801
  70. #define LOAD_MODE_CMD 0x00fff001
  71. #define CKE_LOW 0x00ffeffe
  72. #define NUM_HOST_CMDS 12
  73. /* Host CMD Issue */
  74. #define CMD_VALID BIT(4)
  75. #define NUMHOSTCMD(x) (x)
  76. /* Memory Control */
  77. #define INIT_DONE BIT(1)
  78. #define INIT_START BIT(0)
  79. /* Address Control */
  80. #define EN_AUTO_PRECH 0
  81. #define SB_PRI 1
  82. /* DDR2 Phy Register */
  83. struct ddr2_phy_regs {
  84. u32 scl_start;
  85. u32 unused1[2];
  86. u32 scl_latency;
  87. u32 unused2[2];
  88. u32 scl_config_1;
  89. u32 scl_config_2;
  90. u32 pad_ctrl;
  91. u32 dll_recalib;
  92. };
  93. /* PHY PAD CONTROL */
  94. #define ODT_SEL BIT(0)
  95. #define ODT_EN BIT(1)
  96. #define DRIVE_SEL(x) ((x) << 2)
  97. #define ODT_PULLDOWN(x) ((x) << 4)
  98. #define ODT_PULLUP(x) ((x) << 6)
  99. #define EXTRA_OEN_CLK(x) ((x) << 8)
  100. #define NOEXT_DLL BIT(9)
  101. #define DLR_DFT_WRCMD BIT(13)
  102. #define HALF_RATE BIT(14)
  103. #define DRVSTR_PFET(x) ((x) << 16)
  104. #define DRVSTR_NFET(x) ((x) << 20)
  105. #define RCVR_EN BIT(28)
  106. #define PREAMBLE_DLY(x) ((x) << 29)
  107. /* PHY DLL RECALIBRATE */
  108. #define RECALIB_CNT(x) ((x) << 8)
  109. #define DISABLE_RECALIB(x) ((x) << 26)
  110. #define DELAY_START_VAL(x) ((x) << 28)
  111. /* PHY SCL CONFIG1 */
  112. #define SCL_BURST8 BIT(0)
  113. #define SCL_DDR_CONNECTED BIT(1)
  114. #define SCL_RCAS_LAT(x) ((x) << 4)
  115. #define SCL_ODTCSWW BIT(24)
  116. /* PHY SCL CONFIG2 */
  117. #define SCL_CSEN BIT(0)
  118. #define SCL_WCAS_LAT(x) ((x) << 8)
  119. /* PHY SCL Latency */
  120. #define SCL_CAPCLKDLY(x) ((x) << 0)
  121. #define SCL_DDRCLKDLY(x) ((x) << 4)
  122. /* PHY SCL START */
  123. #define SCL_START BIT(28)
  124. #define SCL_EN BIT(26)
  125. #define SCL_LUBPASS (BIT(1) | BIT(0))
  126. #endif /* __MICROCHIP_DDR2_REGS_H */