reg_umi.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. /*****************************************************************************
  2. * Copyright 2005 - 2008 Broadcom Corporation. All rights reserved.
  3. *
  4. * Unless you and Broadcom execute a separate written software license
  5. * agreement governing use of this software, this software is licensed to you
  6. * under the terms of the GNU General Public License version 2, available at
  7. * http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
  8. *
  9. * Notwithstanding the above, under no circumstances may you combine this
  10. * software in any way with any other Broadcom software provided under a
  11. * license other than the GPL, without Broadcom's express prior written
  12. * consent.
  13. *****************************************************************************/
  14. /*
  15. *
  16. *****************************************************************************
  17. *
  18. * REG_UMI.h
  19. *
  20. * PURPOSE:
  21. *
  22. * This file contains definitions for the nand registers:
  23. *
  24. * NOTES:
  25. *
  26. *****************************************************************************/
  27. #if !defined(__ASM_ARCH_REG_UMI_H)
  28. #define __ASM_ARCH_REG_UMI_H
  29. /* ---- Include Files ---------------------------------------------------- */
  30. #include <csp/reg.h>
  31. #include <mach/csp/mm_io.h>
  32. /* ---- Constants and Types ---------------------------------------------- */
  33. /* Unified Memory Interface Ctrl Register */
  34. #define HW_UMI_BASE MM_IO_BASE_UMI
  35. /* Flash bank 0 timing and control register */
  36. #define REG_UMI_FLASH0_TCR __REG32(HW_UMI_BASE + 0x00)
  37. /* Flash bank 1 timing and control register */
  38. #define REG_UMI_FLASH1_TCR __REG32(HW_UMI_BASE + 0x04)
  39. /* Flash bank 2 timing and control register */
  40. #define REG_UMI_FLASH2_TCR __REG32(HW_UMI_BASE + 0x08)
  41. /* MMD interface and control register */
  42. #define REG_UMI_MMD_ICR __REG32(HW_UMI_BASE + 0x0c)
  43. /* NAND timing and control register */
  44. #define REG_UMI_NAND_TCR __REG32(HW_UMI_BASE + 0x18)
  45. /* NAND ready/chip select register */
  46. #define REG_UMI_NAND_RCSR __REG32(HW_UMI_BASE + 0x1c)
  47. /* NAND ECC control & status register */
  48. #define REG_UMI_NAND_ECC_CSR __REG32(HW_UMI_BASE + 0x20)
  49. /* NAND ECC data register XXB2B1B0 */
  50. #define REG_UMI_NAND_ECC_DATA __REG32(HW_UMI_BASE + 0x24)
  51. /* BCH ECC Parameter N */
  52. #define REG_UMI_BCH_N __REG32(HW_UMI_BASE + 0x40)
  53. /* BCH ECC Parameter T */
  54. #define REG_UMI_BCH_K __REG32(HW_UMI_BASE + 0x44)
  55. /* BCH ECC Parameter K */
  56. #define REG_UMI_BCH_T __REG32(HW_UMI_BASE + 0x48)
  57. /* BCH ECC Contro Status */
  58. #define REG_UMI_BCH_CTRL_STATUS __REG32(HW_UMI_BASE + 0x4C)
  59. /* BCH WR ECC 31:0 */
  60. #define REG_UMI_BCH_WR_ECC_0 __REG32(HW_UMI_BASE + 0x50)
  61. /* BCH WR ECC 63:32 */
  62. #define REG_UMI_BCH_WR_ECC_1 __REG32(HW_UMI_BASE + 0x54)
  63. /* BCH WR ECC 95:64 */
  64. #define REG_UMI_BCH_WR_ECC_2 __REG32(HW_UMI_BASE + 0x58)
  65. /* BCH WR ECC 127:96 */
  66. #define REG_UMI_BCH_WR_ECC_3 __REG32(HW_UMI_BASE + 0x5c)
  67. /* BCH WR ECC 155:128 */
  68. #define REG_UMI_BCH_WR_ECC_4 __REG32(HW_UMI_BASE + 0x60)
  69. /* BCH Read Error Location 1,0 */
  70. #define REG_UMI_BCH_RD_ERR_LOC_1_0 __REG32(HW_UMI_BASE + 0x64)
  71. /* BCH Read Error Location 3,2 */
  72. #define REG_UMI_BCH_RD_ERR_LOC_3_2 __REG32(HW_UMI_BASE + 0x68)
  73. /* BCH Read Error Location 5,4 */
  74. #define REG_UMI_BCH_RD_ERR_LOC_5_4 __REG32(HW_UMI_BASE + 0x6c)
  75. /* BCH Read Error Location 7,6 */
  76. #define REG_UMI_BCH_RD_ERR_LOC_7_6 __REG32(HW_UMI_BASE + 0x70)
  77. /* BCH Read Error Location 9,8 */
  78. #define REG_UMI_BCH_RD_ERR_LOC_9_8 __REG32(HW_UMI_BASE + 0x74)
  79. /* BCH Read Error Location 11,10 */
  80. #define REG_UMI_BCH_RD_ERR_LOC_B_A __REG32(HW_UMI_BASE + 0x78)
  81. /* REG_UMI_FLASH0/1/2_TCR, REG_UMI_SRAM0/1_TCR bits */
  82. /* Enable wait pin during burst write or read */
  83. #define REG_UMI_TCR_WAITEN 0x80000000
  84. /* Enable mem ctrlr to work iwth ext mem of lower freq than AHB clk */
  85. #define REG_UMI_TCR_LOWFREQ 0x40000000
  86. /* 1=synch write, 0=async write */
  87. #define REG_UMI_TCR_MEMTYPE_SYNCWRITE 0x20000000
  88. /* 1=synch read, 0=async read */
  89. #define REG_UMI_TCR_MEMTYPE_SYNCREAD 0x10000000
  90. /* 1=page mode read, 0=normal mode read */
  91. #define REG_UMI_TCR_MEMTYPE_PAGEREAD 0x08000000
  92. /* page size/burst size (wrap only) */
  93. #define REG_UMI_TCR_MEMTYPE_PGSZ_MASK 0x07000000
  94. /* 4 word */
  95. #define REG_UMI_TCR_MEMTYPE_PGSZ_4 0x00000000
  96. /* 8 word */
  97. #define REG_UMI_TCR_MEMTYPE_PGSZ_8 0x01000000
  98. /* 16 word */
  99. #define REG_UMI_TCR_MEMTYPE_PGSZ_16 0x02000000
  100. /* 32 word */
  101. #define REG_UMI_TCR_MEMTYPE_PGSZ_32 0x03000000
  102. /* 64 word */
  103. #define REG_UMI_TCR_MEMTYPE_PGSZ_64 0x04000000
  104. /* 128 word */
  105. #define REG_UMI_TCR_MEMTYPE_PGSZ_128 0x05000000
  106. /* 256 word */
  107. #define REG_UMI_TCR_MEMTYPE_PGSZ_256 0x06000000
  108. /* 512 word */
  109. #define REG_UMI_TCR_MEMTYPE_PGSZ_512 0x07000000
  110. /* Page read access cycle / Burst write latency (n+2 / n+1) */
  111. #define REG_UMI_TCR_TPRC_TWLC_MASK 0x00f80000
  112. /* Bus turnaround cycle (n) */
  113. #define REG_UMI_TCR_TBTA_MASK 0x00070000
  114. /* Write pulse width cycle (n+1) */
  115. #define REG_UMI_TCR_TWP_MASK 0x0000f800
  116. /* Write recovery cycle (n+1) */
  117. #define REG_UMI_TCR_TWR_MASK 0x00000600
  118. /* Write address setup cycle (n+1) */
  119. #define REG_UMI_TCR_TAS_MASK 0x00000180
  120. /* Output enable delay cycle (n) */
  121. #define REG_UMI_TCR_TOE_MASK 0x00000060
  122. /* Read access cycle / Burst read latency (n+2 / n+1) */
  123. #define REG_UMI_TCR_TRC_TLC_MASK 0x0000001f
  124. /* REG_UMI_MMD_ICR bits */
  125. /* Flash write protection pin control */
  126. #define REG_UMI_MMD_ICR_FLASH_WP 0x8000
  127. /* Extend hold time for sram0, sram1 csn (39 MHz operation) */
  128. #define REG_UMI_MMD_ICR_XHCS 0x4000
  129. /* Enable SDRAM 2 interface control */
  130. #define REG_UMI_MMD_ICR_SDRAM2EN 0x2000
  131. /* Enable merge of flash banks 0/1 to 512 MBit bank */
  132. #define REG_UMI_MMD_ICR_INST512 0x1000
  133. /* Enable merge of flash banks 1/2 to 512 MBit bank */
  134. #define REG_UMI_MMD_ICR_DATA512 0x0800
  135. /* Enable SDRAM interface control */
  136. #define REG_UMI_MMD_ICR_SDRAMEN 0x0400
  137. /* Polarity of busy state of Burst Wait Signal */
  138. #define REG_UMI_MMD_ICR_WAITPOL 0x0200
  139. /* Enable burst clock stopped when not accessing external burst flash/sram */
  140. #define REG_UMI_MMD_ICR_BCLKSTOP 0x0100
  141. /* Enable the peri1_csn to replace flash1_csn in 512 Mb flash mode */
  142. #define REG_UMI_MMD_ICR_PERI1EN 0x0080
  143. /* Enable the peri2_csn to replace sdram_csn */
  144. #define REG_UMI_MMD_ICR_PERI2EN 0x0040
  145. /* Enable the peri3_csn to replace sdram2_csn */
  146. #define REG_UMI_MMD_ICR_PERI3EN 0x0020
  147. /* Enable sram bank1 for H/W controlled MRS */
  148. #define REG_UMI_MMD_ICR_MRSB1 0x0010
  149. /* Enable sram bank0 for H/W controlled MRS */
  150. #define REG_UMI_MMD_ICR_MRSB0 0x0008
  151. /* Polarity for assert3ed state of H/W controlled MRS */
  152. #define REG_UMI_MMD_ICR_MRSPOL 0x0004
  153. /* 0: S/W controllable ZZ/MRS/CRE/P-Mode pin */
  154. /* 1: H/W controlled ZZ/MRS/CRE/P-Mode, same timing as CS */
  155. #define REG_UMI_MMD_ICR_MRSMODE 0x0002
  156. /* MRS state for S/W controlled mode */
  157. #define REG_UMI_MMD_ICR_MRSSTATE 0x0001
  158. /* REG_UMI_NAND_TCR bits */
  159. /* Enable software to control CS */
  160. #define REG_UMI_NAND_TCR_CS_SWCTRL 0x80000000
  161. /* 16-bit nand wordsize if set */
  162. #define REG_UMI_NAND_TCR_WORD16 0x40000000
  163. /* Bus turnaround cycle (n) */
  164. #define REG_UMI_NAND_TCR_TBTA_MASK 0x00070000
  165. /* Write pulse width cycle (n+1) */
  166. #define REG_UMI_NAND_TCR_TWP_MASK 0x0000f800
  167. /* Write recovery cycle (n+1) */
  168. #define REG_UMI_NAND_TCR_TWR_MASK 0x00000600
  169. /* Write address setup cycle (n+1) */
  170. #define REG_UMI_NAND_TCR_TAS_MASK 0x00000180
  171. /* Output enable delay cycle (n) */
  172. #define REG_UMI_NAND_TCR_TOE_MASK 0x00000060
  173. /* Read access cycle (n+2) */
  174. #define REG_UMI_NAND_TCR_TRC_TLC_MASK 0x0000001f
  175. /* REG_UMI_NAND_RCSR bits */
  176. /* Status: Ready=1, Busy=0 */
  177. #define REG_UMI_NAND_RCSR_RDY 0x02
  178. /* Keep CS asserted during operation */
  179. #define REG_UMI_NAND_RCSR_CS_ASSERTED 0x01
  180. /* REG_UMI_NAND_ECC_CSR bits */
  181. /* Interrupt status - read-only */
  182. #define REG_UMI_NAND_ECC_CSR_NANDINT 0x80000000
  183. /* Read: Status of ECC done, Write: clear ECC interrupt */
  184. #define REG_UMI_NAND_ECC_CSR_ECCINT_RAW 0x00800000
  185. /* Read: Status of R/B, Write: clear R/B interrupt */
  186. #define REG_UMI_NAND_ECC_CSR_RBINT_RAW 0x00400000
  187. /* 1 = Enable ECC Interrupt */
  188. #define REG_UMI_NAND_ECC_CSR_ECCINT_ENABLE 0x00008000
  189. /* 1 = Assert interrupt at rising edge of R/B_ */
  190. #define REG_UMI_NAND_ECC_CSR_RBINT_ENABLE 0x00004000
  191. /* Calculate ECC by 0=512 bytes, 1=256 bytes */
  192. #define REG_UMI_NAND_ECC_CSR_256BYTE 0x00000080
  193. /* Enable ECC in hardware */
  194. #define REG_UMI_NAND_ECC_CSR_ECC_ENABLE 0x00000001
  195. /* REG_UMI_BCH_CTRL_STATUS bits */
  196. /* Shift to Indicate Number of correctable errors detected */
  197. #define REG_UMI_BCH_CTRL_STATUS_NB_CORR_ERROR_SHIFT 20
  198. /* Indicate Number of correctable errors detected */
  199. #define REG_UMI_BCH_CTRL_STATUS_NB_CORR_ERROR 0x00F00000
  200. /* Indicate Errors detected during read but uncorrectable */
  201. #define REG_UMI_BCH_CTRL_STATUS_UNCORR_ERR 0x00080000
  202. /* Indicate Errors detected during read and are correctable */
  203. #define REG_UMI_BCH_CTRL_STATUS_CORR_ERR 0x00040000
  204. /* Flag indicates BCH's ECC status of read process are valid */
  205. #define REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID 0x00020000
  206. /* Flag indicates BCH's ECC status of write process are valid */
  207. #define REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID 0x00010000
  208. /* Pause ECC calculation */
  209. #define REG_UMI_BCH_CTRL_STATUS_PAUSE_ECC_DEC 0x00000010
  210. /* Enable Interrupt */
  211. #define REG_UMI_BCH_CTRL_STATUS_INT_EN 0x00000004
  212. /* Enable ECC during read */
  213. #define REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN 0x00000002
  214. /* Enable ECC during write */
  215. #define REG_UMI_BCH_CTRL_STATUS_ECC_WR_EN 0x00000001
  216. /* Mask for location */
  217. #define REG_UMI_BCH_ERR_LOC_MASK 0x00001FFF
  218. /* location within a byte */
  219. #define REG_UMI_BCH_ERR_LOC_BYTE 0x00000007
  220. /* location within a word */
  221. #define REG_UMI_BCH_ERR_LOC_WORD 0x00000018
  222. /* location within a page (512 byte) */
  223. #define REG_UMI_BCH_ERR_LOC_PAGE 0x00001FE0
  224. #define REG_UMI_BCH_ERR_LOC_ADDR(index) (__REG32(HW_UMI_BASE + 0x64 + (index / 2)*4) >> ((index % 2) * 16))
  225. #endif