nand_timings.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /*
  2. * Copyright (C) 2014 Free Electrons
  3. *
  4. * Author: Boris BREZILLON <boris.brezillon@free-electrons.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. */
  11. #include <common.h>
  12. #include <linux/kernel.h>
  13. #include <linux/mtd/nand.h>
  14. static const struct nand_sdr_timings onfi_sdr_timings[] = {
  15. /* Mode 0 */
  16. {
  17. .tADL_min = 200000,
  18. .tALH_min = 20000,
  19. .tALS_min = 50000,
  20. .tAR_min = 25000,
  21. .tCEA_max = 100000,
  22. .tCEH_min = 20000,
  23. .tCH_min = 20000,
  24. .tCHZ_max = 100000,
  25. .tCLH_min = 20000,
  26. .tCLR_min = 20000,
  27. .tCLS_min = 50000,
  28. .tCOH_min = 0,
  29. .tCS_min = 70000,
  30. .tDH_min = 20000,
  31. .tDS_min = 40000,
  32. .tFEAT_max = 1000000,
  33. .tIR_min = 10000,
  34. .tITC_max = 1000000,
  35. .tRC_min = 100000,
  36. .tREA_max = 40000,
  37. .tREH_min = 30000,
  38. .tRHOH_min = 0,
  39. .tRHW_min = 200000,
  40. .tRHZ_max = 200000,
  41. .tRLOH_min = 0,
  42. .tRP_min = 50000,
  43. .tRST_max = 250000000000ULL,
  44. .tWB_max = 200000,
  45. .tRR_min = 40000,
  46. .tWC_min = 100000,
  47. .tWH_min = 30000,
  48. .tWHR_min = 120000,
  49. .tWP_min = 50000,
  50. .tWW_min = 100000,
  51. },
  52. /* Mode 1 */
  53. {
  54. .tADL_min = 100000,
  55. .tALH_min = 10000,
  56. .tALS_min = 25000,
  57. .tAR_min = 10000,
  58. .tCEA_max = 45000,
  59. .tCEH_min = 20000,
  60. .tCH_min = 10000,
  61. .tCHZ_max = 50000,
  62. .tCLH_min = 10000,
  63. .tCLR_min = 10000,
  64. .tCLS_min = 25000,
  65. .tCOH_min = 15000,
  66. .tCS_min = 35000,
  67. .tDH_min = 10000,
  68. .tDS_min = 20000,
  69. .tFEAT_max = 1000000,
  70. .tIR_min = 0,
  71. .tITC_max = 1000000,
  72. .tRC_min = 50000,
  73. .tREA_max = 30000,
  74. .tREH_min = 15000,
  75. .tRHOH_min = 15000,
  76. .tRHW_min = 100000,
  77. .tRHZ_max = 100000,
  78. .tRLOH_min = 0,
  79. .tRP_min = 25000,
  80. .tRR_min = 20000,
  81. .tRST_max = 500000000,
  82. .tWB_max = 100000,
  83. .tWC_min = 45000,
  84. .tWH_min = 15000,
  85. .tWHR_min = 80000,
  86. .tWP_min = 25000,
  87. .tWW_min = 100000,
  88. },
  89. /* Mode 2 */
  90. {
  91. .tADL_min = 100000,
  92. .tALH_min = 10000,
  93. .tALS_min = 15000,
  94. .tAR_min = 10000,
  95. .tCEA_max = 30000,
  96. .tCEH_min = 20000,
  97. .tCH_min = 10000,
  98. .tCHZ_max = 50000,
  99. .tCLH_min = 10000,
  100. .tCLR_min = 10000,
  101. .tCLS_min = 15000,
  102. .tCOH_min = 15000,
  103. .tCS_min = 25000,
  104. .tDH_min = 5000,
  105. .tDS_min = 15000,
  106. .tFEAT_max = 1000000,
  107. .tIR_min = 0,
  108. .tITC_max = 1000000,
  109. .tRC_min = 35000,
  110. .tREA_max = 25000,
  111. .tREH_min = 15000,
  112. .tRHOH_min = 15000,
  113. .tRHW_min = 100000,
  114. .tRHZ_max = 100000,
  115. .tRLOH_min = 0,
  116. .tRR_min = 20000,
  117. .tRST_max = 500000000,
  118. .tWB_max = 100000,
  119. .tRP_min = 17000,
  120. .tWC_min = 35000,
  121. .tWH_min = 15000,
  122. .tWHR_min = 80000,
  123. .tWP_min = 17000,
  124. .tWW_min = 100000,
  125. },
  126. /* Mode 3 */
  127. {
  128. .tADL_min = 100000,
  129. .tALH_min = 5000,
  130. .tALS_min = 10000,
  131. .tAR_min = 10000,
  132. .tCEA_max = 25000,
  133. .tCEH_min = 20000,
  134. .tCH_min = 5000,
  135. .tCHZ_max = 50000,
  136. .tCLH_min = 5000,
  137. .tCLR_min = 10000,
  138. .tCLS_min = 10000,
  139. .tCOH_min = 15000,
  140. .tCS_min = 25000,
  141. .tDH_min = 5000,
  142. .tDS_min = 10000,
  143. .tFEAT_max = 1000000,
  144. .tIR_min = 0,
  145. .tITC_max = 1000000,
  146. .tRC_min = 30000,
  147. .tREA_max = 20000,
  148. .tREH_min = 10000,
  149. .tRHOH_min = 15000,
  150. .tRHW_min = 100000,
  151. .tRHZ_max = 100000,
  152. .tRLOH_min = 0,
  153. .tRP_min = 15000,
  154. .tRR_min = 20000,
  155. .tRST_max = 500000000,
  156. .tWB_max = 100000,
  157. .tWC_min = 30000,
  158. .tWH_min = 10000,
  159. .tWHR_min = 80000,
  160. .tWP_min = 15000,
  161. .tWW_min = 100000,
  162. },
  163. /* Mode 4 */
  164. {
  165. .tADL_min = 70000,
  166. .tALH_min = 5000,
  167. .tALS_min = 10000,
  168. .tAR_min = 10000,
  169. .tCEA_max = 25000,
  170. .tCEH_min = 20000,
  171. .tCH_min = 5000,
  172. .tCHZ_max = 30000,
  173. .tCLH_min = 5000,
  174. .tCLR_min = 10000,
  175. .tCLS_min = 10000,
  176. .tCOH_min = 15000,
  177. .tCS_min = 20000,
  178. .tDH_min = 5000,
  179. .tDS_min = 10000,
  180. .tFEAT_max = 1000000,
  181. .tIR_min = 0,
  182. .tITC_max = 1000000,
  183. .tRC_min = 25000,
  184. .tREA_max = 20000,
  185. .tREH_min = 10000,
  186. .tRHOH_min = 15000,
  187. .tRHW_min = 100000,
  188. .tRHZ_max = 100000,
  189. .tRLOH_min = 5000,
  190. .tRP_min = 12000,
  191. .tRR_min = 20000,
  192. .tRST_max = 500000000,
  193. .tWB_max = 100000,
  194. .tWC_min = 25000,
  195. .tWH_min = 10000,
  196. .tWHR_min = 80000,
  197. .tWP_min = 12000,
  198. .tWW_min = 100000,
  199. },
  200. /* Mode 5 */
  201. {
  202. .tADL_min = 70000,
  203. .tALH_min = 5000,
  204. .tALS_min = 10000,
  205. .tAR_min = 10000,
  206. .tCEA_max = 25000,
  207. .tCEH_min = 20000,
  208. .tCH_min = 5000,
  209. .tCHZ_max = 30000,
  210. .tCLH_min = 5000,
  211. .tCLR_min = 10000,
  212. .tCLS_min = 10000,
  213. .tCOH_min = 15000,
  214. .tCS_min = 15000,
  215. .tDH_min = 5000,
  216. .tDS_min = 7000,
  217. .tFEAT_max = 1000000,
  218. .tIR_min = 0,
  219. .tITC_max = 1000000,
  220. .tRC_min = 20000,
  221. .tREA_max = 16000,
  222. .tREH_min = 7000,
  223. .tRHOH_min = 15000,
  224. .tRHW_min = 100000,
  225. .tRHZ_max = 100000,
  226. .tRLOH_min = 5000,
  227. .tRP_min = 10000,
  228. .tRR_min = 20000,
  229. .tRST_max = 500000000,
  230. .tWB_max = 100000,
  231. .tWC_min = 20000,
  232. .tWH_min = 7000,
  233. .tWHR_min = 80000,
  234. .tWP_min = 10000,
  235. .tWW_min = 100000,
  236. },
  237. };
  238. /**
  239. * onfi_async_timing_mode_to_sdr_timings - [NAND Interface] Retrieve NAND
  240. * timings according to the given ONFI timing mode
  241. * @mode: ONFI timing mode
  242. */
  243. const struct nand_sdr_timings *onfi_async_timing_mode_to_sdr_timings(int mode)
  244. {
  245. if (mode < 0 || mode >= ARRAY_SIZE(onfi_sdr_timings))
  246. return ERR_PTR(-EINVAL);
  247. return &onfi_sdr_timings[mode];
  248. }
  249. EXPORT_SYMBOL(onfi_async_timing_mode_to_sdr_timings);