mem.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. /*
  2. * (C) Copyright 2006-2008
  3. * Texas Instruments, <www.ti.com>
  4. * Richard Woodruff <r-woodruff2@ti.com>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #ifndef _MEM_H_
  25. #define _MEM_H_
  26. #define CS0 0x0
  27. #define CS1 0x1 /* mirror CS1 regs appear offset 0x30 from CS0 */
  28. #ifndef __ASSEMBLY__
  29. enum {
  30. STACKED = 0,
  31. IP_DDR = 1,
  32. COMBO_DDR = 2,
  33. IP_SDR = 3,
  34. };
  35. #endif /* __ASSEMBLY__ */
  36. #define EARLY_INIT 1
  37. /* Slower full frequency range default timings for x32 operation*/
  38. #define SDRC_SHARING 0x00000100
  39. #define SDRC_MR_0_SDR 0x00000031
  40. #define DLL_OFFSET 0
  41. #define DLL_WRITEDDRCLKX2DIS 1
  42. #define DLL_ENADLL 1
  43. #define DLL_LOCKDLL 0
  44. #define DLL_DLLPHASE_72 0
  45. #define DLL_DLLPHASE_90 1
  46. /* rkw - need to find of 90/72 degree recommendation for speed like before */
  47. #define SDP_SDRC_DLLAB_CTRL ((DLL_ENADLL << 3) | \
  48. (DLL_LOCKDLL << 2) | (DLL_DLLPHASE_90 << 1))
  49. /* Infineon part of 3430SDP (165MHz optimized) 6.06ns
  50. * ACTIMA
  51. * TDAL = Twr/Tck + Trp/tck = 15/6 + 18/6 = 2.5 + 3 = 5.5 -> 6
  52. * TDPL (Twr) = 15/6 = 2.5 -> 3
  53. * TRRD = 12/6 = 2
  54. * TRCD = 18/6 = 3
  55. * TRP = 18/6 = 3
  56. * TRAS = 42/6 = 7
  57. * TRC = 60/6 = 10
  58. * TRFC = 72/6 = 12
  59. * ACTIMB
  60. * TCKE = 2
  61. * XSR = 120/6 = 20
  62. */
  63. #define INFINEON_TDAL_165 6
  64. #define INFINEON_TDPL_165 3
  65. #define INFINEON_TRRD_165 2
  66. #define INFINEON_TRCD_165 3
  67. #define INFINEON_TRP_165 3
  68. #define INFINEON_TRAS_165 7
  69. #define INFINEON_TRC_165 10
  70. #define INFINEON_TRFC_165 12
  71. #define INFINEON_V_ACTIMA_165 ((INFINEON_TRFC_165 << 27) | \
  72. (INFINEON_TRC_165 << 22) | (INFINEON_TRAS_165 << 18) | \
  73. (INFINEON_TRP_165 << 15) | (INFINEON_TRCD_165 << 12) | \
  74. (INFINEON_TRRD_165 << 9) | (INFINEON_TDPL_165 << 6) | \
  75. (INFINEON_TDAL_165))
  76. #define INFINEON_TWTR_165 1
  77. #define INFINEON_TCKE_165 2
  78. #define INFINEON_TXP_165 2
  79. #define INFINEON_XSR_165 20
  80. #define INFINEON_V_ACTIMB_165 ((INFINEON_TCKE_165 << 12) | \
  81. (INFINEON_XSR_165 << 0) | (INFINEON_TXP_165 << 8) | \
  82. (INFINEON_TWTR_165 << 16))
  83. /* Micron part of 3430 EVM (165MHz optimized) 6.06ns
  84. * ACTIMA
  85. * TDAL = Twr/Tck + Trp/tck= 15/6 + 18 /6 = 2.5 + 3 = 5.5 -> 6
  86. * TDPL (Twr) = 15/6 = 2.5 -> 3
  87. * TRRD = 12/6 = 2
  88. * TRCD = 18/6 = 3
  89. * TRP = 18/6 = 3
  90. * TRAS = 42/6 = 7
  91. * TRC = 60/6 = 10
  92. * TRFC = 125/6 = 21
  93. * ACTIMB
  94. * TWTR = 1
  95. * TCKE = 1
  96. * TXSR = 138/6 = 23
  97. * TXP = 25/6 = 4.1 ~5
  98. */
  99. #define MICRON_TDAL_165 6
  100. #define MICRON_TDPL_165 3
  101. #define MICRON_TRRD_165 2
  102. #define MICRON_TRCD_165 3
  103. #define MICRON_TRP_165 3
  104. #define MICRON_TRAS_165 7
  105. #define MICRON_TRC_165 10
  106. #define MICRON_TRFC_165 21
  107. #define MICRON_V_ACTIMA_165 ((MICRON_TRFC_165 << 27) | \
  108. (MICRON_TRC_165 << 22) | (MICRON_TRAS_165 << 18) | \
  109. (MICRON_TRP_165 << 15) | (MICRON_TRCD_165 << 12) | \
  110. (MICRON_TRRD_165 << 9) | (MICRON_TDPL_165 << 6) | \
  111. (MICRON_TDAL_165))
  112. #define MICRON_TWTR_165 1
  113. #define MICRON_TCKE_165 1
  114. #define MICRON_XSR_165 23
  115. #define MICRON_TXP_165 5
  116. #define MICRON_V_ACTIMB_165 ((MICRON_TCKE_165 << 12) | \
  117. (MICRON_XSR_165 << 0) | (MICRON_TXP_165 << 8) | \
  118. (MICRON_TWTR_165 << 16))
  119. /*
  120. * NUMONYX part of IGEP v2 (165MHz optimized) 6.06ns
  121. * ACTIMA
  122. * TDAL = Twr/Tck + Trp/tck = 15/6 + 18/6 = 2.5 + 3 = 5.5 -> 6
  123. * TDPL (Twr) = 15/6 = 2.5 -> 3
  124. * TRRD = 12/6 = 2
  125. * TRCD = 22.5/6 = 3.75 -> 4
  126. * TRP = 18/6 = 3
  127. * TRAS = 42/6 = 7
  128. * TRC = 60/6 = 10
  129. * TRFC = 140/6 = 23.3 -> 24
  130. * ACTIMB
  131. * TWTR = 2
  132. * TCKE = 2
  133. * TXSR = 200/6 = 33.3 -> 34
  134. * TXP = 1.0 + 1.1 = 2.1 -> 3
  135. */
  136. #define NUMONYX_TDAL_165 6
  137. #define NUMONYX_TDPL_165 3
  138. #define NUMONYX_TRRD_165 2
  139. #define NUMONYX_TRCD_165 4
  140. #define NUMONYX_TRP_165 3
  141. #define NUMONYX_TRAS_165 7
  142. #define NUMONYX_TRC_165 10
  143. #define NUMONYX_TRFC_165 24
  144. #define NUMONYX_V_ACTIMA_165 ((NUMONYX_TRFC_165 << 27) | \
  145. (NUMONYX_TRC_165 << 22) | (NUMONYX_TRAS_165 << 18) | \
  146. (NUMONYX_TRP_165 << 15) | (NUMONYX_TRCD_165 << 12) | \
  147. (NUMONYX_TRRD_165 << 9) | (NUMONYX_TDPL_165 << 6) | \
  148. (NUMONYX_TDAL_165))
  149. #define NUMONYX_TWTR_165 2
  150. #define NUMONYX_TCKE_165 2
  151. #define NUMONYX_TXP_165 3
  152. #define NUMONYX_XSR_165 34
  153. #define NUMONYX_V_ACTIMB_165 ((NUMONYX_TCKE_165 << 12) | \
  154. (NUMONYX_XSR_165 << 0) | (NUMONYX_TXP_165 << 8) | \
  155. (NUMONYX_TWTR_165 << 16))
  156. #ifdef CONFIG_OMAP3_INFINEON_DDR
  157. #define V_ACTIMA_165 INFINEON_V_ACTIMA_165
  158. #define V_ACTIMB_165 INFINEON_V_ACTIMB_165
  159. #endif
  160. #ifdef CONFIG_OMAP3_MICRON_DDR
  161. #define V_ACTIMA_165 MICRON_V_ACTIMA_165
  162. #define V_ACTIMB_165 MICRON_V_ACTIMB_165
  163. #endif
  164. #ifdef CONFIG_OMAP3_NUMONYX_DDR
  165. #define V_ACTIMA_165 NUMONYX_V_ACTIMA_165
  166. #define V_ACTIMB_165 NUMONYX_V_ACTIMB_165
  167. #endif
  168. #if !defined(V_ACTIMA_165) || !defined(V_ACTIMB_165)
  169. #error "Please choose the right DDR type in config header"
  170. #endif
  171. /*
  172. * GPMC settings -
  173. * Definitions is as per the following format
  174. * #define <PART>_GPMC_CONFIG<x> <value>
  175. * Where:
  176. * PART is the part name e.g. STNOR - Intel Strata Flash
  177. * x is GPMC config registers from 1 to 6 (there will be 6 macros)
  178. * Value is corresponding value
  179. *
  180. * For every valid PRCM configuration there should be only one definition of
  181. * the same. if values are independent of the board, this definition will be
  182. * present in this file if values are dependent on the board, then this should
  183. * go into corresponding mem-boardName.h file
  184. *
  185. * Currently valid part Names are (PART):
  186. * STNOR - Intel Strata Flash
  187. * SMNAND - Samsung NAND
  188. * MPDB - H4 MPDB board
  189. * SBNOR - Sibley NOR
  190. * MNAND - Micron Large page x16 NAND
  191. * ONNAND - Samsung One NAND
  192. *
  193. * include/configs/file.h contains the defn - for all CS we are interested
  194. * #define OMAP34XX_GPMC_CSx PART
  195. * #define OMAP34XX_GPMC_CSx_SIZE Size
  196. * #define OMAP34XX_GPMC_CSx_MAP Map
  197. * Where:
  198. * x - CS number
  199. * PART - Part Name as defined above
  200. * SIZE - how big is the mapping to be
  201. * GPMC_SIZE_128M - 0x8
  202. * GPMC_SIZE_64M - 0xC
  203. * GPMC_SIZE_32M - 0xE
  204. * GPMC_SIZE_16M - 0xF
  205. * MAP - Map this CS to which address(GPMC address space)- Absolute address
  206. * >>24 before being used.
  207. */
  208. #define GPMC_SIZE_128M 0x8
  209. #define GPMC_SIZE_64M 0xC
  210. #define GPMC_SIZE_32M 0xE
  211. #define GPMC_SIZE_16M 0xF
  212. #define SMNAND_GPMC_CONFIG1 0x00000800
  213. #define SMNAND_GPMC_CONFIG2 0x00141400
  214. #define SMNAND_GPMC_CONFIG3 0x00141400
  215. #define SMNAND_GPMC_CONFIG4 0x0F010F01
  216. #define SMNAND_GPMC_CONFIG5 0x010C1414
  217. #define SMNAND_GPMC_CONFIG6 0x1F0F0A80
  218. #define SMNAND_GPMC_CONFIG7 0x00000C44
  219. #define M_NAND_GPMC_CONFIG1 0x00001800
  220. #define M_NAND_GPMC_CONFIG2 0x00141400
  221. #define M_NAND_GPMC_CONFIG3 0x00141400
  222. #define M_NAND_GPMC_CONFIG4 0x0F010F01
  223. #define M_NAND_GPMC_CONFIG5 0x010C1414
  224. #define M_NAND_GPMC_CONFIG6 0x1f0f0A80
  225. #define M_NAND_GPMC_CONFIG7 0x00000C44
  226. #define STNOR_GPMC_CONFIG1 0x3
  227. #define STNOR_GPMC_CONFIG2 0x00151501
  228. #define STNOR_GPMC_CONFIG3 0x00060602
  229. #define STNOR_GPMC_CONFIG4 0x11091109
  230. #define STNOR_GPMC_CONFIG5 0x01141F1F
  231. #define STNOR_GPMC_CONFIG6 0x000004c4
  232. #define SIBNOR_GPMC_CONFIG1 0x1200
  233. #define SIBNOR_GPMC_CONFIG2 0x001f1f00
  234. #define SIBNOR_GPMC_CONFIG3 0x00080802
  235. #define SIBNOR_GPMC_CONFIG4 0x1C091C09
  236. #define SIBNOR_GPMC_CONFIG5 0x01131F1F
  237. #define SIBNOR_GPMC_CONFIG6 0x1F0F03C2
  238. #define SDPV2_MPDB_GPMC_CONFIG1 0x00611200
  239. #define SDPV2_MPDB_GPMC_CONFIG2 0x001F1F01
  240. #define SDPV2_MPDB_GPMC_CONFIG3 0x00080803
  241. #define SDPV2_MPDB_GPMC_CONFIG4 0x1D091D09
  242. #define SDPV2_MPDB_GPMC_CONFIG5 0x041D1F1F
  243. #define SDPV2_MPDB_GPMC_CONFIG6 0x1D0904C4
  244. #define MPDB_GPMC_CONFIG1 0x00011000
  245. #define MPDB_GPMC_CONFIG2 0x001f1f01
  246. #define MPDB_GPMC_CONFIG3 0x00080803
  247. #define MPDB_GPMC_CONFIG4 0x1c0b1c0a
  248. #define MPDB_GPMC_CONFIG5 0x041f1F1F
  249. #define MPDB_GPMC_CONFIG6 0x1F0F04C4
  250. #define P2_GPMC_CONFIG1 0x0
  251. #define P2_GPMC_CONFIG2 0x0
  252. #define P2_GPMC_CONFIG3 0x0
  253. #define P2_GPMC_CONFIG4 0x0
  254. #define P2_GPMC_CONFIG5 0x0
  255. #define P2_GPMC_CONFIG6 0x0
  256. #define ONENAND_GPMC_CONFIG1 0x00001200
  257. #define ONENAND_GPMC_CONFIG2 0x000F0F01
  258. #define ONENAND_GPMC_CONFIG3 0x00030301
  259. #define ONENAND_GPMC_CONFIG4 0x0F040F04
  260. #define ONENAND_GPMC_CONFIG5 0x010F1010
  261. #define ONENAND_GPMC_CONFIG6 0x1F060000
  262. #define NET_GPMC_CONFIG1 0x00001000
  263. #define NET_GPMC_CONFIG2 0x001e1e01
  264. #define NET_GPMC_CONFIG3 0x00080300
  265. #define NET_GPMC_CONFIG4 0x1c091c09
  266. #define NET_GPMC_CONFIG5 0x04181f1f
  267. #define NET_GPMC_CONFIG6 0x00000FCF
  268. #define NET_GPMC_CONFIG7 0x00000f6c
  269. /* max number of GPMC Chip Selects */
  270. #define GPMC_MAX_CS 8
  271. /* max number of GPMC regs */
  272. #define GPMC_MAX_REG 7
  273. #define PISMO1_NOR 1
  274. #define PISMO1_NAND 2
  275. #define PISMO2_CS0 3
  276. #define PISMO2_CS1 4
  277. #define PISMO1_ONENAND 5
  278. #define DBG_MPDB 6
  279. #define PISMO2_NAND_CS0 7
  280. #define PISMO2_NAND_CS1 8
  281. /* make it readable for the gpmc_init */
  282. #define PISMO1_NOR_BASE FLASH_BASE
  283. #define PISMO1_NAND_BASE NAND_BASE
  284. #define PISMO2_CS0_BASE PISMO2_MAP1
  285. #define PISMO1_ONEN_BASE ONENAND_MAP
  286. #define DBG_MPDB_BASE DEBUG_BASE
  287. #ifndef __ASSEMBLY__
  288. /* Function prototypes */
  289. void mem_init(void);
  290. u32 is_mem_sdr(void);
  291. u32 mem_ok(u32 cs);
  292. u32 get_sdr_cs_size(u32);
  293. u32 get_sdr_cs_offset(u32);
  294. #endif /* __ASSEMBLY__ */
  295. #endif /* endif _MEM_H_ */