at91_ddrsdrc.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. #ifndef _ARCH_ARM_AT91_DDRSDRC_H_
  2. #define _ARCH_ARM_AT91_DDRSDRC_H_
  3. /*
  4. * Copyright (C) 2013 by egnite GmbH
  5. *
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. * 3. Neither the name of the copyright holders nor the names of
  18. * contributors may be used to endorse or promote products derived
  19. * from this software without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  31. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. * SUCH DAMAGE.
  33. *
  34. * For additional information see http://www.ethernut.de/
  35. */
  36. /*!
  37. * \file arch/arm/at91_ddrsdrc.h
  38. * \brief AT91 DDR SDR SDRAM Controller.
  39. *
  40. * \verbatim
  41. * $Id$
  42. * \endverbatim
  43. */
  44. /*!
  45. * \addtogroup xgNutArchArmAt91DdrSdrc
  46. */
  47. /*@{*/
  48. /*! \name DDRSDRC Mode Register */
  49. /*@{*/
  50. #define DDRSDRC_MR_OFF 0x00000000 /*!< \brief DDRSDRC mode register offset. */
  51. #define DDRSDRC0_MR (DDRSDRC0_BASE + DDRSDRC_MR_OFF) /*!< \brief DDRSDRC0 mode register address. */
  52. #define DDRSDRC1_MR (DDRSDRC1_BASE + DDRSDRC_MR_OFF) /*!< \brief DDRSDRC1 mode register address. */
  53. #define DDRSDRC_MODE 0x00000007 /*!< \brief Command mode mask. */
  54. #define DDRSDRC_MODE_NORMAL 0x00000000 /*!< \brief Normal mode. */
  55. #define DDRSDRC_MODE_NOP 0x00000001 /*!< \brief Issue NOP command when accessed. */
  56. #define DDRSDRC_MODE_PRCGALL 0x00000002 /*!< \brief Issue "All Banks Precharge" command when accessed. */
  57. #define DDRSDRC_MODE_LMR 0x00000003 /*!< \brief Issue "Load Mode Register" command when accessed. */
  58. #define DDRSDRC_MODE_RFSH 0x00000004 /*!< \brief Issue "Auto Refresh" command when accessed. */
  59. #define DDRSDRC_MODE_EXT_LMR 0x00000005 /*!< \brief Issue "Extended Load Mode Register" command when accessed. */
  60. #define DDRSDRC_MODE_DEEP 0x00000006 /*!< \brief Enter deep power down mode. */
  61. /*@}*/
  62. /*! \name DDRSDRC Refresh Timer Register */
  63. /*@{*/
  64. #define DDRSDRC_RTR_OFF 0x00000004 /*!< \brief DDRSDRC refresh timer register offset. */
  65. #define DDRSDRC0_RTR (DDRSDRC0_BASE + DDRSDRC_RTR_OFF) /*!< \brief DDRSDRC0 refresh timer register address. */
  66. #define DDRSDRC1_RTR (DDRSDRC1_BASE + DDRSDRC_RTR_OFF) /*!< \brief DDRSDRC1 refresh timer register address. */
  67. #define DDRSDRC_COUNT 0x00000FFF /*!< \brief Refresh timer count mask. */
  68. /*@}*/
  69. /*! \name DDRSDRC Configuration Register */
  70. /*@{*/
  71. #define DDRSDRC_CR_OFF 0x00000008 /*!< \brief DDRSDRC configuration register offset. */
  72. #define DDRSDRC0_CR (DDRSDRC0_BASE + DDRSDRC_CR_OFF) /*!< \brief DDRSDRC0 configuration register address. */
  73. #define DDRSDRC1_CR (DDRSDRC1_BASE + DDRSDRC_CR_OFF) /*!< \brief DDRSDRC1 configuration register address. */
  74. #define DDRSDRC_NC 0x00000003 /*!< \brief Number of column bits. */
  75. #define DDRSDRC_NC_LSB 0
  76. #define DDRSDRC_NC_DDROFF 9
  77. #define DDRSDRC_NC_SDROFF 8
  78. #define DDRSDRC_NC_DDR9_SDR8 0x00000000 /*!< \brief 9 DDR or 8 SDR column bits. */
  79. #define DDRSDRC_NC_DDR10_SDR9 0x00000001 /*!< \brief 10 DDR or 9 SDR column bits. */
  80. #define DDRSDRC_NC_DDR11_SDR10 0x00000002 /*!< \brief 11 DDR or 10 SDR column bits. */
  81. #define DDRSDRC_NC_DDR12_SDR11 0x00000003 /*!< \brief 12 DDR or 11 SDR column bits. */
  82. #define DDRSDRC_NR 0x0000000C /*!< \brief Number of row bits. */
  83. #define DDRSDRC_NR_LSB 2
  84. #define DDRSDRC_NR_OFF 11
  85. #define DDRSDRC_NR_11 0x00000000 /*!< \brief 11 row bits. */
  86. #define DDRSDRC_NR_12 0x00000004 /*!< \brief 12 row bits. */
  87. #define DDRSDRC_NR_13 0x00000008 /*!< \brief 13 row bits. */
  88. #define DDRSDRC_NR_14 0x0000000C /*!< \brief 14 row bits. */
  89. #define DDRSDRC_CAS 0x00000070 /*!< \brief CAS latency. */
  90. #define DDRSDRC_CAS_2 0x00000020 /*!< \brief CAS latency of 2 cycles. */
  91. #define DDRSDRC_CAS_3 0x00000030 /*!< \brief CAS latency of 3 cycles. */
  92. #define DDRSDRC_DLL 0x00000080 /*!< \brief Reset DLL. */
  93. #define DDRSDRC_DDIC_DS 0x00000100 /*!< \brief Output driver impedance control. */
  94. #define DDRSDRC_DIS_DLL 0x00000200 /*!< \brief Disable DLL. */
  95. #define DDRSDRC_OCD 0x00007000 /*!< \brief Off-chip driver mask. */
  96. #define DDRSDRC_OCD_LSB 12 /*!< \brief Off-chip driver mask LSB. */
  97. #define DDRSDRC_EBISHARE 0x00010000 /*!< \brief External bus interface is shared. */
  98. #define DDRSDRC_ACTBST 0x00040000 /*!< \brief Active bank X to burst stop read access bank Y. */
  99. /*@}*/
  100. /*! \name DDRSDRC Timing Parameter 0 Register */
  101. /*@{*/
  102. #define DDRSDRC_T0PR_OFF 0x0000000C /*!< \brief DDRSDRC timing parameter 0 register offset. */
  103. #define DDRSDRC0_T0PR (DDRSDRC0_BASE + DDRSDRC_T0PR_OFF)/*!< \brief DDRSDRC0 timing parameter 0 register address. */
  104. #define DDRSDRC1_T0PR (DDRSDRC1_BASE + DDRSDRC_T0PR_OFF)/*!< \brief DDRSDRC1 timing parameter 0 register address. */
  105. #define DDRSDRC_TRAS 0x0000000F
  106. #define DDRSDRC_TRAS_LSB 0
  107. #define DDRSDRC_TRCD 0x000000F0
  108. #define DDRSDRC_TRCD_LSB 4
  109. #define DDRSDRC_TWR 0x00000F00
  110. #define DDRSDRC_TWR_LSB 8
  111. #define DDRSDRC_TRC 0x0000F000
  112. #define DDRSDRC_TRC_LSB 12
  113. #define DDRSDRC_TRP 0x000F0000
  114. #define DDRSDRC_TRP_LSB 16
  115. #define DDRSDRC_TRRD 0x00F00000
  116. #define DDRSDRC_TRRD_LSB 20
  117. #define DDRSDRC_TWTR 0x07000000
  118. #define DDRSDRC_TWTR_LSB 24
  119. #define DDRSDRC_REDUCE_WRRD 0x08000000
  120. #define DDRSDRC_TMRD 0xF0000000
  121. #define DDRSDRC_TMRD_LSB 28
  122. /*@}*/
  123. /*! \name DDRSDRC Timing Parameter 1 Register */
  124. /*@{*/
  125. #define DDRSDRC_T1PR_OFF 0x00000010 /*!< \brief DDRSDRC timing parameter 1 register offset. */
  126. #define DDRSDRC0_T1PR (DDRSDRC0_BASE + DDRSDRC_T1PR_OFF)/*!< \brief DDRSDRC0 timing parameter 1 register address. */
  127. #define DDRSDRC1_T1PR (DDRSDRC1_BASE + DDRSDRC_T1PR_OFF)/*!< \brief DDRSDRC1 timing parameter 1 register address. */
  128. #define DDRSDRC_TRFC 0x0000001F
  129. #define DDRSDRC_TRFC_LSB 0
  130. #define DDRSDRC_TXSNR 0x0000FF00
  131. #define DDRSDRC_TXSNR_LSB 8
  132. #define DDRSDRC_TXSRD 0x00FF0000
  133. #define DDRSDRC_TXSRD_LSB 16
  134. #define DDRSDRC_TXP 0x0F000000
  135. #define DDRSDRC_TXP_LSB 24
  136. /*@}*/
  137. /*! \name DDRSDRC Timing Parameter 2 Register */
  138. /*@{*/
  139. #define DDRSDRC_T2PR_OFF 0x00000014 /*!< \brief DDRSDRC timing parameter 2 register offset. */
  140. #define DDRSDRC0_T2PR (DDRSDRC0_BASE + DDRSDRC_T2PR_OFF)/*!< \brief DDRSDRC0 timing parameter 2 register address. */
  141. #define DDRSDRC1_T2PR (DDRSDRC1_BASE + DDRSDRC_T2PR_OFF)/*!< \brief DDRSDRC1 timing parameter 2 register address. */
  142. #define DDRSDRC_TXARD 0x0000000F
  143. #define DDRSDRC_TXARD_LSB 0
  144. #define DDRSDRC_TXARDS 0x000000F0
  145. #define DDRSDRC_TXARDS_LSB 4
  146. #define DDRSDRC_TRPA 0x00000F00
  147. #define DDRSDRC_TRPA_LSB 8
  148. #define DDRSDRC_TRTP 0x00007000
  149. #define DDRSDRC_TRTP_LSB 12
  150. /*@}*/
  151. /*! \name DDRSDRC Low-Power Register */
  152. /*@{*/
  153. #define DDRSDRC_LPR_OFF 0x0000001C /*!< \brief DDRSDRC low-power register offset. */
  154. #define DDRSDRC0_LPR (DDRSDRC0_BASE + DDRSDRC_LPR_OFF) /*!< \brief DDRSDRC0 low-power register address. */
  155. #define DDRSDRC1_LPR (DDRSDRC1_BASE + DDRSDRC_LPR_OFF) /*!< \brief DDRSDRC1 low-power register address. */
  156. #define DDRSDRC_LPCB 0x00000003
  157. #define DDRSDRC_LPCB_DISABLED 0x00000000 /*!< \brief Low-power feature inhibited. */
  158. #define DDRSDRC_LPCB_SELFREFRESH 0x00000001 /*!< \brief Issues a self refresh, clocks are disabled and CKE is set low. */
  159. #define DDRSDRC_LPCB_POWERDOWN 0x00000002 /*!< \brief Issues a power-down after each access, CKE set to low. */
  160. #define DDRSDRC_LPCB_DEEP_PWD 0x00000003 /*!< \brief Issues a deep power-down. */
  161. #define DDRSDRC_CLK_FR 0x00000004
  162. #define DDRSDRC_PASR 0x00000070
  163. #define DDRSDRC_PASR_LSB 4
  164. #define DDRSDRC_TCR 0x00000300
  165. #define DDRSDRC_TCR_LSB 8
  166. #define DDRSDRC_DS 0x00000C00
  167. #define DDRSDRC_DS_LSB 10
  168. #define DDRSDRC_TIMEOUT 0x00003000
  169. #define DDRSDRC_TIMEOUT_0 0x00000000 /*!< \brief Activate low-power mode immediately. */
  170. #define DDRSDRC_TIMEOUT_64 0x00001000 /*!< \brief Activate low-power mode after 64 clock cycles. */
  171. #define DDRSDRC_TIMEOUT_128 0x00002000 /*!< \brief Activate low-power mode after 128 clock cycles. */
  172. #define DDRSDRC_APDE 0x00010000
  173. #define DDRSDRC_UPD_MR 0x00300000
  174. #define DDRSDRC_UPD_MR_DISABLED 0x00000000
  175. #define DDRSDRC_UPD_MR_EBI 0x00100000
  176. #define DDRSDRC_UPD_MR_NO_EBI 0x00200000
  177. /*@}*/
  178. /*! \name DDRSDRC Memory Device Register */
  179. /*@{*/
  180. #define DDRSDRC_MD_OFF 0x00000020 /*!< \brief DDRSDRC memory device register offset. */
  181. #define DDRSDRC0_MD (DDRSDRC0_BASE + DDRSDRC_MD_OFF) /*!< \brief DDRSDRC0 memory device register address. */
  182. #define DDRSDRC1_MD (DDRSDRC1_BASE + DDRSDRC_MD_OFF) /*!< \brief DDRSDRC1 memory device register address. */
  183. #define DDRSDRC_MD_SDR_SDRAM 0x00000000 /*!< \brief SDR SDRAM. */
  184. #define DDRSDRC_MD_LP_SDR_SDRAM 0x00000001 /*!< \brief Low-power SDR SDRAM. */
  185. #define DDRSDRC_MD_DDR_SDRAM 0x00000002 /*!< \brief DDR SDRAM. */
  186. #define DDRSDRC_MD_LP_DDR_SDRAM 0x00000003 /*!< \brief Low-power DDR SDRAM. */
  187. #define DDRSDRC_MD_DDR2_SDRAM 0x00000006 /*!< \brief DDR2 SDRAM. */
  188. #define DDRSDRC_MD_DBW_16 0x00000010 /*!< \brief 16 Bits datas bus. */
  189. /*@}*/
  190. /*! \name DDRSDRC DLL Information Register */
  191. /*@{*/
  192. #define DDRSDRC_DLL_OFF 0x00000024 /*!< \brief DDRSDRC DLL information register offset. */
  193. #define DDRSDRC0_DLL (DDRSDRC0_BASE + DDRSDRC_DLL_OFF) /*!< \brief DDRSDRC0 DLL information register address. */
  194. #define DDRSDRC1_DLL (DDRSDRC1_BASE + DDRSDRC_DLL_OFF) /*!< \brief DDRSDRC1 DLL information register address. */
  195. #define DDRSDRC_DLL_MDINC 0x00000001
  196. #define DDRSDRC_DLL_MDDEC 0x00000002
  197. #define DDRSDRC_DLL_MDOVF 0x00000004
  198. #define DDRSDRC_DLL_MDVAL 0x0000FF00
  199. #define DDRSDRC_DLL_MDVAL_LSB 8
  200. /*@}*/
  201. /*! \name DDRSDRC High Speed Register */
  202. /*@{*/
  203. #define DDRSDRC_HS_OFF 0x0000002C /*!< \brief DDRSDRC high speed register offset. */
  204. #define DDRSDRC0_HS (DDRSDRC0_BASE + DDRSDRC_HS_OFF) /*!< \brief DDRSDRC0 high speed register address. */
  205. #define DDRSDRC1_HS (DDRSDRC1_BASE + DDRSDRC_HS_OFF) /*!< \brief DDRSDRC1 high speed register address. */
  206. #define DDRSDRC_DIS_ANTICIP_READ 0x00000004 /*!< \brief Disable anticipated read access. */
  207. /*@}*/
  208. /*! \name DDRSDRC Delay I/O Registers */
  209. /*@{*/
  210. #define DDRSDRC_DELAY_OFF(x) ((x) * 4 + 0x00000040) /*!< \brief DDRSDRC delay I/O register offsets. */
  211. #define DDRSDRC0_DELAY(x) (DDRSDRC0_BASE + DDRSDRC_DELAY_OFF(x)) /*!< \brief DDRSDRC0 delay I/O register addresses. */
  212. #define DDRSDRC1_DELAY(x) (DDRSDRC1_BASE + DDRSDRC_DELAY_OFF(x)) /*!< \brief DDRSDRC1 delay I/O register addresses. */
  213. #define DDRSDRC_DELAY1 0x0000000F
  214. #define DDRSDRC_DELAY1_LSB 0
  215. #define DDRSDRC_DELAY2 0x000000F0
  216. #define DDRSDRC_DELAY2_LSB 4
  217. #define DDRSDRC_DELAY3 0x00000F00
  218. #define DDRSDRC_DELAY3_LSB 8
  219. #define DDRSDRC_DELAY4 0x0000F000
  220. #define DDRSDRC_DELAY4_LSB 12
  221. #define DDRSDRC_DELAY5 0x000F0000
  222. #define DDRSDRC_DELAY5_LSB 16
  223. #define DDRSDRC_DELAY6 0x00F00000
  224. #define DDRSDRC_DELAY6_LSB 20
  225. #define DDRSDRC_DELAY7 0x0F000000
  226. #define DDRSDRC_DELAY7_LSB 24
  227. #define DDRSDRC_DELAY8 0xF0000000
  228. #define DDRSDRC_DELAY8_LSB 28
  229. /*@}*/
  230. /*! \name DDRSDRC Write Protect Mode Register */
  231. /*@{*/
  232. #define DDRSDRC_WPMR_OFF 0x000000E4 /*!< \brief DDRSDRC write protect mode register offset. */
  233. #define DDRSDRC0_WPMR (DDRSDRC0_BASE + DDRSDRC_WPMR_OFF)/*!< \brief DDRSDRC0 write protect mode register address. */
  234. #define DDRSDRC1_WPMR (DDRSDRC1_BASE + DDRSDRC_WPMR_OFF)/*!< \brief DDRSDRC1 write protect mode register address. */
  235. #define DDRSDRC_WPEN 0x00000001
  236. #define DDRSDRC_WPKEY 0x44445200
  237. /*@}*/
  238. /*! \name DDRSDRC Write Protect Status Register */
  239. /*@{*/
  240. #define DDRSDRC_WPSR_OFF 0x000000E8 /*!< \brief DDRSDRC write protect status register offset. */
  241. #define DDRSDRC0_WPSR (DDRSDRC0_BASE + DDRSDRC_WPSR_OFF)/*!< \brief DDRSDRC0 write protect status register address. */
  242. #define DDRSDRC1_WPSR (DDRSDRC1_BASE + DDRSDRC_WPSR_OFF)/*!< \brief DDRSDRC1 write protect status register address. */
  243. #define DDRSDRC_WPVS 0x00000001 /*!< \brief Write protect violation. */
  244. #define DDRSDRC_WPVSRC 0x00FFFF00 /*!< \brief Write protect violation source mask. */
  245. #define DDRSDRC_WPVSRC_LSB 8 /*!< \brief Write protect violation source LSB. */
  246. /*@}*/
  247. /*@} xgNutArchArmAt91DdrSdrc */
  248. #endif /* _ARCH_ARM_AT91_DDRSDRC_H_ */