bch-regs.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * Freescale GPMI NAND Flash Driver
  3. *
  4. * Copyright 2008-2011 Freescale Semiconductor, Inc.
  5. * Copyright 2008 Embedded Alley Solutions, Inc.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, write to the Free Software Foundation, Inc.,
  19. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  20. */
  21. #ifndef __GPMI_NAND_BCH_REGS_H
  22. #define __GPMI_NAND_BCH_REGS_H
  23. #define HW_BCH_CTRL 0x00000000
  24. #define HW_BCH_CTRL_SET 0x00000004
  25. #define HW_BCH_CTRL_CLR 0x00000008
  26. #define HW_BCH_CTRL_TOG 0x0000000c
  27. #define BM_BCH_CTRL_COMPLETE_IRQ_EN (1 << 8)
  28. #define BM_BCH_CTRL_COMPLETE_IRQ (1 << 0)
  29. #define HW_BCH_STATUS0 0x00000010
  30. #define HW_BCH_MODE 0x00000020
  31. #define HW_BCH_ENCODEPTR 0x00000030
  32. #define HW_BCH_DATAPTR 0x00000040
  33. #define HW_BCH_METAPTR 0x00000050
  34. #define HW_BCH_LAYOUTSELECT 0x00000070
  35. #define HW_BCH_FLASH0LAYOUT0 0x00000080
  36. #define BP_BCH_FLASH0LAYOUT0_NBLOCKS 24
  37. #define BM_BCH_FLASH0LAYOUT0_NBLOCKS (0xff << BP_BCH_FLASH0LAYOUT0_NBLOCKS)
  38. #define BF_BCH_FLASH0LAYOUT0_NBLOCKS(v) \
  39. (((v) << BP_BCH_FLASH0LAYOUT0_NBLOCKS) & BM_BCH_FLASH0LAYOUT0_NBLOCKS)
  40. #define BP_BCH_FLASH0LAYOUT0_META_SIZE 16
  41. #define BM_BCH_FLASH0LAYOUT0_META_SIZE (0xff << BP_BCH_FLASH0LAYOUT0_META_SIZE)
  42. #define BF_BCH_FLASH0LAYOUT0_META_SIZE(v) \
  43. (((v) << BP_BCH_FLASH0LAYOUT0_META_SIZE)\
  44. & BM_BCH_FLASH0LAYOUT0_META_SIZE)
  45. #define BP_BCH_FLASH0LAYOUT0_ECC0 12
  46. #define BM_BCH_FLASH0LAYOUT0_ECC0 (0xf << BP_BCH_FLASH0LAYOUT0_ECC0)
  47. #define MX6Q_BP_BCH_FLASH0LAYOUT0_ECC0 11
  48. #define MX6Q_BM_BCH_FLASH0LAYOUT0_ECC0 (0x1f << MX6Q_BP_BCH_FLASH0LAYOUT0_ECC0)
  49. #define BF_BCH_FLASH0LAYOUT0_ECC0(v, x) \
  50. (GPMI_IS_MX6(x) \
  51. ? (((v) << MX6Q_BP_BCH_FLASH0LAYOUT0_ECC0) \
  52. & MX6Q_BM_BCH_FLASH0LAYOUT0_ECC0) \
  53. : (((v) << BP_BCH_FLASH0LAYOUT0_ECC0) \
  54. & BM_BCH_FLASH0LAYOUT0_ECC0) \
  55. )
  56. #define MX6Q_BP_BCH_FLASH0LAYOUT0_GF_13_14 10
  57. #define MX6Q_BM_BCH_FLASH0LAYOUT0_GF_13_14 \
  58. (0x1 << MX6Q_BP_BCH_FLASH0LAYOUT0_GF_13_14)
  59. #define BF_BCH_FLASH0LAYOUT0_GF(v, x) \
  60. ((GPMI_IS_MX6(x) && ((v) == 14)) \
  61. ? (((1) << MX6Q_BP_BCH_FLASH0LAYOUT0_GF_13_14) \
  62. & MX6Q_BM_BCH_FLASH0LAYOUT0_GF_13_14) \
  63. : 0 \
  64. )
  65. #define BP_BCH_FLASH0LAYOUT0_DATA0_SIZE 0
  66. #define BM_BCH_FLASH0LAYOUT0_DATA0_SIZE \
  67. (0xfff << BP_BCH_FLASH0LAYOUT0_DATA0_SIZE)
  68. #define MX6Q_BM_BCH_FLASH0LAYOUT0_DATA0_SIZE \
  69. (0x3ff << BP_BCH_FLASH0LAYOUT0_DATA0_SIZE)
  70. #define BF_BCH_FLASH0LAYOUT0_DATA0_SIZE(v, x) \
  71. (GPMI_IS_MX6(x) \
  72. ? (((v) >> 2) & MX6Q_BM_BCH_FLASH0LAYOUT0_DATA0_SIZE) \
  73. : ((v) & BM_BCH_FLASH0LAYOUT0_DATA0_SIZE) \
  74. )
  75. #define HW_BCH_FLASH0LAYOUT1 0x00000090
  76. #define BP_BCH_FLASH0LAYOUT1_PAGE_SIZE 16
  77. #define BM_BCH_FLASH0LAYOUT1_PAGE_SIZE \
  78. (0xffff << BP_BCH_FLASH0LAYOUT1_PAGE_SIZE)
  79. #define BF_BCH_FLASH0LAYOUT1_PAGE_SIZE(v) \
  80. (((v) << BP_BCH_FLASH0LAYOUT1_PAGE_SIZE) \
  81. & BM_BCH_FLASH0LAYOUT1_PAGE_SIZE)
  82. #define BP_BCH_FLASH0LAYOUT1_ECCN 12
  83. #define BM_BCH_FLASH0LAYOUT1_ECCN (0xf << BP_BCH_FLASH0LAYOUT1_ECCN)
  84. #define MX6Q_BP_BCH_FLASH0LAYOUT1_ECCN 11
  85. #define MX6Q_BM_BCH_FLASH0LAYOUT1_ECCN (0x1f << MX6Q_BP_BCH_FLASH0LAYOUT1_ECCN)
  86. #define BF_BCH_FLASH0LAYOUT1_ECCN(v, x) \
  87. (GPMI_IS_MX6(x) \
  88. ? (((v) << MX6Q_BP_BCH_FLASH0LAYOUT1_ECCN) \
  89. & MX6Q_BM_BCH_FLASH0LAYOUT1_ECCN) \
  90. : (((v) << BP_BCH_FLASH0LAYOUT1_ECCN) \
  91. & BM_BCH_FLASH0LAYOUT1_ECCN) \
  92. )
  93. #define MX6Q_BP_BCH_FLASH0LAYOUT1_GF_13_14 10
  94. #define MX6Q_BM_BCH_FLASH0LAYOUT1_GF_13_14 \
  95. (0x1 << MX6Q_BP_BCH_FLASH0LAYOUT1_GF_13_14)
  96. #define BF_BCH_FLASH0LAYOUT1_GF(v, x) \
  97. ((GPMI_IS_MX6(x) && ((v) == 14)) \
  98. ? (((1) << MX6Q_BP_BCH_FLASH0LAYOUT1_GF_13_14) \
  99. & MX6Q_BM_BCH_FLASH0LAYOUT1_GF_13_14) \
  100. : 0 \
  101. )
  102. #define BP_BCH_FLASH0LAYOUT1_DATAN_SIZE 0
  103. #define BM_BCH_FLASH0LAYOUT1_DATAN_SIZE \
  104. (0xfff << BP_BCH_FLASH0LAYOUT1_DATAN_SIZE)
  105. #define MX6Q_BM_BCH_FLASH0LAYOUT1_DATAN_SIZE \
  106. (0x3ff << BP_BCH_FLASH0LAYOUT1_DATAN_SIZE)
  107. #define BF_BCH_FLASH0LAYOUT1_DATAN_SIZE(v, x) \
  108. (GPMI_IS_MX6(x) \
  109. ? (((v) >> 2) & MX6Q_BM_BCH_FLASH0LAYOUT1_DATAN_SIZE) \
  110. : ((v) & BM_BCH_FLASH0LAYOUT1_DATAN_SIZE) \
  111. )
  112. #define HW_BCH_VERSION 0x00000160
  113. #endif