blob: 7f2f49c5600f6349dfd34c6cb5f504e513f8e0ac [file] [log] [blame]
Miquel Raynal1f1ae152018-08-16 17:30:07 +02001
Miquel Raynald0935362019-10-03 19:50:03 +02002menuconfig MTD_RAW_NAND
Miquel Raynal8115c452018-08-16 17:30:08 +02003 bool "Raw NAND Device Support"
Miquel Raynald0935362019-10-03 19:50:03 +02004if MTD_RAW_NAND
Miquel Raynal1f1ae152018-08-16 17:30:07 +02005
6config SYS_NAND_SELF_INIT
7 bool
8 help
9 This option, if enabled, provides more flexible and linux-like
10 NAND initialization process.
11
Tom Rini98372452021-12-12 22:12:36 -050012config SPL_SYS_NAND_SELF_INIT
13 bool
14 depends on !SPL_NAND_SIMPLE
15 help
16 This option, if enabled, provides more flexible and linux-like
17 NAND initialization process, in SPL.
18
19config TPL_SYS_NAND_SELF_INIT
20 bool
21 depends on TPL_NAND_SUPPORT
22 help
23 This option, if enabled, provides more flexible and linux-like
24 NAND initialization process, in SPL.
25
Tom Rini1a9f23d2022-05-26 14:31:57 -040026config TPL_NAND_INIT
27 bool
28
Roger Quadros685c4282022-12-20 12:22:00 +020029config SPL_NAND_INIT
30 bool
31
Tom Riniac164de2022-10-28 20:27:04 -040032config SYS_MAX_NAND_DEVICE
33 int "Maximum number of NAND devices to support"
34 default 1
35
Stefan Agnerbd186142018-12-06 14:57:09 +010036config SYS_NAND_DRIVER_ECC_LAYOUT
Tom Rinid03e14e2021-12-11 14:55:54 -050037 bool "Omit standard ECC layouts to save space"
Stefan Agnerbd186142018-12-06 14:57:09 +010038 help
Tom Rinid03e14e2021-12-11 14:55:54 -050039 Omit standard ECC layouts to save space. Select this if your driver
Stefan Agnerbd186142018-12-06 14:57:09 +010040 is known to provide its own ECC layout.
41
Stefan Roese23b37f92019-08-22 12:28:04 +020042config SYS_NAND_USE_FLASH_BBT
43 bool "Enable BBT (Bad Block Table) support"
44 help
45 Enable the BBT (Bad Block Table) usage.
46
Tom Rini2b2696a2022-11-12 17:36:48 -050047config SYS_NAND_NO_SUBPAGE_WRITE
48 bool "Disable subpage write support"
49 depends on NAND_ARASAN || NAND_DAVINCI || NAND_KIRKWOOD
50
Miquel Raynal1f1ae152018-08-16 17:30:07 +020051config NAND_ATMEL
52 bool "Support Atmel NAND controller"
Tom Rini98372452021-12-12 22:12:36 -050053 select SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +020054 imply SYS_NAND_USE_FLASH_BBT
55 help
56 Enable this driver for NAND flash platforms using an Atmel NAND
57 controller.
58
Derald D. Woods7830fc52018-12-15 01:36:46 -060059if NAND_ATMEL
60
61config ATMEL_NAND_HWECC
62 bool "Atmel Hardware ECC"
Derald D. Woods7830fc52018-12-15 01:36:46 -060063
64config ATMEL_NAND_HW_PMECC
65 bool "Atmel Programmable Multibit ECC (PMECC)"
66 select ATMEL_NAND_HWECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060067 help
68 The Programmable Multibit ECC (PMECC) controller is a programmable
69 binary BCH(Bose, Chaudhuri and Hocquenghem) encoder and decoder.
70
71config PMECC_CAP
72 int "PMECC Correctable ECC Bits"
73 depends on ATMEL_NAND_HW_PMECC
74 default 2
75 help
76 Correctable ECC bits, can be 2, 4, 8, 12, and 24.
77
78config PMECC_SECTOR_SIZE
79 int "PMECC Sector Size"
80 depends on ATMEL_NAND_HW_PMECC
81 default 512
82 help
83 Sector size, in bytes, can be 512 or 1024.
84
85config SPL_GENERATE_ATMEL_PMECC_HEADER
86 bool "Atmel PMECC Header Generation"
Tom Rini0a83cc22022-06-10 23:03:09 -040087 depends on SPL
Derald D. Woods7830fc52018-12-15 01:36:46 -060088 select ATMEL_NAND_HWECC
89 select ATMEL_NAND_HW_PMECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060090 help
91 Generate Programmable Multibit ECC (PMECC) header for SPL image.
92
Tom Rini70aa87d2022-11-12 17:36:42 -050093choice
94 prompt "NAND bus width (bits)"
95 default SYS_NAND_DBW_8
96
97config SYS_NAND_DBW_8
98 bool "NAND bus width is 8 bits"
99
100config SYS_NAND_DBW_16
101 bool "NAND bus width is 16 bits"
102
103endchoice
104
Derald D. Woods7830fc52018-12-15 01:36:46 -0600105endif
106
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100107config NAND_BRCMNAND
108 bool "Support Broadcom NAND controller"
Miquel Raynala903be42019-10-03 19:50:04 +0200109 depends on OF_CONTROL && DM && DM_MTD
Tom Rini98372452021-12-12 22:12:36 -0500110 select SYS_NAND_SELF_INIT
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100111 help
112 Enable the driver for NAND flash on platforms using a Broadcom NAND
113 controller.
114
Álvaro Fernández Rojasd9f9bfc2019-08-28 19:12:15 +0200115config NAND_BRCMNAND_6368
116 bool "Support Broadcom NAND controller on bcm6368"
117 depends on NAND_BRCMNAND && ARCH_BMIPS
118 help
119 Enable support for broadcom nand driver on bcm6368.
120
Philippe Reynese175c322022-02-11 19:18:36 +0100121config NAND_BRCMNAND_6753
122 bool "Support Broadcom NAND controller on bcm6753"
William Zhang38921822022-08-22 11:49:08 -0700123 depends on NAND_BRCMNAND && BCM6855
Philippe Reynese175c322022-02-11 19:18:36 +0100124 help
125 Enable support for broadcom nand driver on bcm6753.
126
Philippe Reynes74ead742020-01-07 20:14:13 +0100127config NAND_BRCMNAND_68360
128 bool "Support Broadcom NAND controller on bcm68360"
William Zhangdf0b5bb2022-08-22 11:31:43 -0700129 depends on NAND_BRCMNAND && BCM6856
Philippe Reynes74ead742020-01-07 20:14:13 +0100130 help
131 Enable support for broadcom nand driver on bcm68360.
132
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100133config NAND_BRCMNAND_6838
134 bool "Support Broadcom NAND controller on bcm6838"
135 depends on NAND_BRCMNAND && ARCH_BMIPS && SOC_BMIPS_BCM6838
136 help
137 Enable support for broadcom nand driver on bcm6838.
138
139config NAND_BRCMNAND_6858
140 bool "Support Broadcom NAND controller on bcm6858"
William Zhang6b45fa62022-08-22 11:39:45 -0700141 depends on NAND_BRCMNAND && BCM6858
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100142 help
143 Enable support for broadcom nand driver on bcm6858.
144
145config NAND_BRCMNAND_63158
146 bool "Support Broadcom NAND controller on bcm63158"
William Zhang35a3ec1b2022-08-22 11:19:46 -0700147 depends on NAND_BRCMNAND && BCM63158
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100148 help
149 Enable support for broadcom nand driver on bcm63158.
150
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200151config NAND_DAVINCI
152 bool "Support TI Davinci NAND controller"
Tom Rini98372452021-12-12 22:12:36 -0500153 select SYS_NAND_SELF_INIT if TARGET_DA850EVM
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200154 help
155 Enable this driver for NAND flash controllers available in TI Davinci
156 and Keystone2 platforms
157
Tom Rinid1286e12022-11-12 17:36:45 -0500158choice
159 prompt "Type of ECC used on NAND"
160 default SYS_NAND_4BIT_HW_ECC_OOBFIRST
161 depends on NAND_DAVINCI
162
163config SYS_NAND_HW_ECC
164 bool "Use 1-bit HW ECC"
165
Tom Rini7f750f82022-10-28 20:27:11 -0400166config SYS_NAND_4BIT_HW_ECC_OOBFIRST
167 bool "Use 4-bit HW ECC with OOB at the front"
Tom Rinid1286e12022-11-12 17:36:45 -0500168
169config SYS_NAND_SOFT_ECC
170 bool "Use software ECC"
171
172endchoice
Tom Rini7f750f82022-10-28 20:27:11 -0400173
Tom Rini33adefd2022-11-12 17:36:49 -0500174choice
175 prompt "NAND page size"
176 depends on NAND_DAVINCI
177 default SYS_NAND_PAGE_2K
178
179config SYS_NAND_PAGE_2K
180 bool "Page size is 2K"
181
182config SYS_NAND_PAGE_4K
183 bool "Page size is 4K"
184
185endchoice
186
Tom Rinidada0e32021-09-12 20:32:24 -0400187config KEYSTONE_RBL_NAND
188 depends on ARCH_KEYSTONE
189 def_bool y
190
Tom Rinifae1dab2021-09-22 14:50:29 -0400191config SPL_NAND_LOAD
192 def_bool y
193 depends on NAND_DAVINCI && ARCH_DAVINCI && SPL_NAND_SUPPORT
194
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200195config NAND_DENALI
196 bool
197 select SYS_NAND_SELF_INIT
198 imply CMD_NAND
199
200config NAND_DENALI_DT
201 bool "Support Denali NAND controller as a DT device"
202 select NAND_DENALI
Lokanathan, Raaj791edf72022-12-11 23:37:42 +0800203 select SPL_SYS_NAND_SELF_INIT
Masahiro Yamada8fc53822020-01-30 22:07:59 +0900204 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200205 help
206 Enable the driver for NAND flash on platforms using a Denali NAND
207 controller as a DT device.
208
Tom Rinia73788c2021-09-22 14:50:37 -0400209config NAND_FSL_ELBC
210 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500211 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
212 select SPL_SYS_NAND_SELF_INIT
213 select SYS_NAND_SELF_INIT
Tom Rinia73788c2021-09-22 14:50:37 -0400214 depends on FSL_ELBC
215 help
216 Enable the Freescale Enhanced Local Bus Controller FCM NAND driver.
217
Pali Rohárbb834db2022-04-04 18:17:19 +0200218config NAND_FSL_ELBC_DT
219 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver (DT mode)"
220 depends on NAND_FSL_ELBC
221
Tom Rinia73788c2021-09-22 14:50:37 -0400222config NAND_FSL_IFC
223 bool "Support Freescale Integrated Flash Controller NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500224 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
Tom Rini1a9f23d2022-05-26 14:31:57 -0400225 select TPL_NAND_INIT if TPL && !TPL_FRAMEWORK
Tom Rini98372452021-12-12 22:12:36 -0500226 select SPL_SYS_NAND_SELF_INIT
227 select SYS_NAND_SELF_INIT
Tom Rini05b419e2021-12-11 14:55:49 -0500228 select FSL_IFC
Tom Rinia73788c2021-09-22 14:50:37 -0400229 help
230 Enable the Freescale Integrated Flash Controller NAND driver.
231
Tom Rinib91baf62022-11-19 18:45:29 -0500232config NAND_KIRKWOOD
233 bool "Support for Kirkwood NAND controller"
234 depends on ARCH_KIRKWOOD
235 default y
236
237config NAND_ECC_BCH
238 bool
239
240config NAND_KMETER1
241 bool "Support KMETER1 NAND controller"
242 depends on VENDOR_KM
243 select NAND_ECC_BCH
244
Tom Rini08204272021-09-22 14:50:28 -0400245config NAND_LPC32XX_MLC
246 bool "Support LPC32XX_MLC controller"
Tom Rini98372452021-12-12 22:12:36 -0500247 select SYS_NAND_SELF_INIT
Tom Rini08204272021-09-22 14:50:28 -0400248 help
249 Enable the LPC32XX MLC NAND controller.
250
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200251config NAND_LPC32XX_SLC
252 bool "Support LPC32XX_SLC controller"
253 help
254 Enable the LPC32XX SLC NAND controller.
255
256config NAND_OMAP_GPMC
257 bool "Support OMAP GPMC NAND controller"
Roger Quadros0bde4972022-10-11 14:50:00 +0300258 depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3
Roger Quadros80cf6372022-12-20 12:21:59 +0200259 select SYS_NAND_SELF_INIT if ARCH_K3
Roger Quadros685c4282022-12-20 12:22:00 +0200260 select SPL_NAND_INIT if ARCH_K3
261 select SPL_SYS_NAND_SELF_INIT if ARCH_K3
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200262 help
263 Enables omap_gpmc.c driver for OMAPx and AMxxxx platforms.
264 GPMC controller is used for parallel NAND flash devices, and can
265 do ECC calculation (not ECC error detection) for HAM1, BCH4, BCH8
266 and BCH16 ECC algorithms.
267
Tom Rinif6d26d82021-09-22 14:50:39 -0400268if NAND_OMAP_GPMC
269
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200270config NAND_OMAP_GPMC_PREFETCH
271 bool "Enable GPMC Prefetch"
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200272 default y
273 help
274 On OMAP platforms that use the GPMC controller
275 (CONFIG_NAND_OMAP_GPMC_PREFETCH), this options enables the code that
276 uses the prefetch mode to speed up read operations.
277
278config NAND_OMAP_ELM
279 bool "Enable ELM driver for OMAPxx and AMxx platforms."
Tom Rinif6d26d82021-09-22 14:50:39 -0400280 depends on !OMAP34XX
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200281 help
282 ELM controller is used for ECC error detection (not ECC calculation)
283 of BCH4, BCH8 and BCH16 ECC algorithms.
284 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
285 thus such SoC platforms need to depend on software library for ECC error
286 detection. However ECC calculation on such plaforms would still be
287 done by GPMC controller.
288
Tom Rinif6d26d82021-09-22 14:50:39 -0400289choice
290 prompt "ECC scheme"
291 default NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
292 help
293 On OMAP platforms, this CONFIG specifies NAND ECC scheme.
294 It can take following values:
295 OMAP_ECC_HAM1_CODE_SW
296 1-bit Hamming code using software lib.
297 (for legacy devices only)
298 OMAP_ECC_HAM1_CODE_HW
299 1-bit Hamming code using GPMC hardware.
300 (for legacy devices only)
301 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW
302 4-bit BCH code (unsupported)
303 OMAP_ECC_BCH4_CODE_HW
304 4-bit BCH code (unsupported)
305 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
306 8-bit BCH code with
307 - ecc calculation using GPMC hardware engine,
308 - error detection using software library.
309 - requires CONFIG_BCH to enable software BCH library
310 (For legacy device which do not have ELM h/w engine)
311 OMAP_ECC_BCH8_CODE_HW
312 8-bit BCH code with
313 - ecc calculation using GPMC hardware engine,
314 - error detection using ELM hardware engine.
315 OMAP_ECC_BCH16_CODE_HW
316 16-bit BCH code with
317 - ecc calculation using GPMC hardware engine,
318 - error detection using ELM hardware engine.
319
320 How to select ECC scheme on OMAP and AMxx platforms ?
321 -----------------------------------------------------
322 Though higher ECC schemes have more capability to detect and correct
323 bit-flips, but still selection of ECC scheme is dependent on following
324 - hardware engines present in SoC.
325 Some legacy OMAP SoC do not have ELM h/w engine thus such
326 SoC cannot support BCHx_HW ECC schemes.
327 - size of OOB/Spare region
328 With higher ECC schemes, more OOB/Spare area is required to
329 store ECC. So choice of ECC scheme is limited by NAND oobsize.
330
331 In general following expression can help:
332 NAND_OOBSIZE >= 2 + (NAND_PAGESIZE / 512) * ECC_BYTES
333 where
334 NAND_OOBSIZE = number of bytes available in
335 OOB/spare area per NAND page.
336 NAND_PAGESIZE = bytes in main-area of NAND page.
337 ECC_BYTES = number of ECC bytes generated to
338 protect 512 bytes of data, which is:
339 3 for HAM1_xx ecc schemes
340 7 for BCH4_xx ecc schemes
341 14 for BCH8_xx ecc schemes
342 26 for BCH16_xx ecc schemes
343
344 example to check for BCH16 on 2K page NAND
345 NAND_PAGESIZE = 2048
346 NAND_OOBSIZE = 64
347 2 + (2048 / 512) * 26 = 106 > NAND_OOBSIZE
348 Thus BCH16 cannot be supported on 2K page NAND.
349
350 However, for 4K pagesize NAND
351 NAND_PAGESIZE = 4096
352 NAND_OOBSIZE = 224
353 ECC_BYTES = 26
354 2 + (4096 / 512) * 26 = 210 < NAND_OOBSIZE
355 Thus BCH16 can be supported on 4K page NAND.
356
357config NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
358 bool "1-bit Hamming code using software lib"
359
360config NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
361 bool "1-bit Hamming code using GPMC hardware"
362
363config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
364 bool "8-bit BCH code with HW calculation SW error detection"
365
366config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
367 bool "8-bit BCH code with HW calculation and error detection"
368
369config NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
370 bool "16-bit BCH code with HW calculation and error detection"
371
372endchoice
373
374config NAND_OMAP_ECCSCHEME
375 int
376 default 1 if NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
377 default 2 if NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
378 default 5 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
379 default 6 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
380 default 7 if NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
381 help
382 This must be kept in sync with the enum in
383 include/linux/mtd/omap_gpmc.h
384
385endif
386
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200387config NAND_VF610_NFC
388 bool "Support for Freescale NFC for VF610"
389 select SYS_NAND_SELF_INIT
Stefan Agnerbd186142018-12-06 14:57:09 +0100390 select SYS_NAND_DRIVER_ECC_LAYOUT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200391 imply CMD_NAND
392 help
393 Enables support for NAND Flash Controller on some Freescale
394 processors like the VF610, MCF54418 or Kinetis K70.
395 The driver supports a maximum 2k page size. The driver
396 currently does not support hardware ECC.
397
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100398if NAND_VF610_NFC
399
400config NAND_VF610_NFC_DT
401 bool "Support Vybrid's vf610 NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200402 depends on OF_CONTROL && DM_MTD
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100403 help
404 Enable the driver for Vybrid's vf610 NAND flash on platforms
405 using device tree.
406
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200407choice
408 prompt "Hardware ECC strength"
409 depends on NAND_VF610_NFC
410 default SYS_NAND_VF610_NFC_45_ECC_BYTES
411 help
412 Select the ECC strength used in the hardware BCH ECC block.
413
414config SYS_NAND_VF610_NFC_45_ECC_BYTES
415 bool "24-error correction (45 ECC bytes)"
416
417config SYS_NAND_VF610_NFC_60_ECC_BYTES
418 bool "32-error correction (60 ECC bytes)"
419
420endchoice
421
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100422endif
423
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200424config NAND_PXA3XX
425 bool "Support for NAND on PXA3xx and Armada 370/XP/38x"
426 select SYS_NAND_SELF_INIT
Shmuel Hazan759349e2020-10-29 08:52:18 +0200427 select DM_MTD
Shmuel Hazan58983222020-10-29 08:52:20 +0200428 select REGMAP
429 select SYSCON
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200430 imply CMD_NAND
431 help
432 This enables the driver for the NAND flash device found on
433 PXA3xx processors (NFCv1) and also on Armada 370/XP (NFCv2).
434
435config NAND_SUNXI
436 bool "Support for NAND on Allwinner SoCs"
437 default ARCH_SUNXI
438 depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I
439 select SYS_NAND_SELF_INIT
440 select SYS_NAND_U_BOOT_LOCATIONS
441 select SPL_NAND_SUPPORT
Tom Rini98372452021-12-12 22:12:36 -0500442 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200443 imply CMD_NAND
444 ---help---
445 Enable support for NAND. This option enables the standard and
446 SPL drivers.
447 The SPL driver only supports reading from the NAND using DMA
448 transfers.
449
450if NAND_SUNXI
451
452config NAND_SUNXI_SPL_ECC_STRENGTH
453 int "Allwinner NAND SPL ECC Strength"
454 default 64
455
456config NAND_SUNXI_SPL_ECC_SIZE
457 int "Allwinner NAND SPL ECC Step Size"
458 default 1024
459
460config NAND_SUNXI_SPL_USABLE_PAGE_SIZE
461 int "Allwinner NAND SPL Usable Page Size"
462 default 1024
463
464endif
465
466config NAND_ARASAN
467 bool "Configure Arasan Nand"
468 select SYS_NAND_SELF_INIT
Michal Simekc5587832020-08-19 09:59:52 +0200469 depends on DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200470 imply CMD_NAND
471 help
472 This enables Nand driver support for Arasan nand flash
473 controller. This uses the hardware ECC for read and
474 write operations.
475
476config NAND_MXC
477 bool "MXC NAND support"
478 depends on CPU_ARM926EJS || CPU_ARM1136 || MX5
479 imply CMD_NAND
480 help
481 This enables the NAND driver for the NAND flash controller on the
Haolin Lie8df55b2021-07-18 10:13:39 +0800482 i.MX27 / i.MX31 / i.MX5 processors.
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200483
Tom Rini1ba2a002022-11-12 17:36:50 -0500484config SYS_NAND_SIZE
485 int "Size of NAND in kilobytes"
486 depends on NAND_MXC && SPL_NAND_SUPPORT
487 default 268435456
488
Tom Rini17e67002022-12-02 16:42:37 -0500489config MXC_NAND_HWECC
490 bool "Hardware ECC support in MXC NAND"
491 depends on NAND_MXC
492
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200493config NAND_MXS
494 bool "MXS NAND support"
Peng Fan128abf42020-05-04 22:09:00 +0800495 depends on MX23 || MX28 || MX6 || MX7 || IMX8 || IMX8M
Tom Rini98372452021-12-12 22:12:36 -0500496 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200497 select SYS_NAND_SELF_INIT
498 imply CMD_NAND
499 select APBH_DMA
Peng Fan128abf42020-05-04 22:09:00 +0800500 select APBH_DMA_BURST if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
501 select APBH_DMA_BURST8 if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200502 help
503 This enables NAND driver for the NAND flash controller on the
504 MXS processors.
505
506if NAND_MXS
507
508config NAND_MXS_DT
509 bool "Support MXS NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200510 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200511 help
512 Enable the driver for MXS NAND flash on platforms using
513 device tree.
514
515config NAND_MXS_USE_MINIMUM_ECC
516 bool "Use minimum ECC strength supported by the controller"
517 default false
518
519endif
520
Zhengxun Li01551712021-09-14 13:43:51 +0800521config NAND_MXIC
522 bool "Macronix raw NAND controller"
523 select SYS_NAND_SELF_INIT
524 help
525 This selects the Macronix raw NAND controller driver.
526
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200527config NAND_ZYNQ
528 bool "Support for Zynq Nand controller"
Tom Rini98372452021-12-12 22:12:36 -0500529 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200530 select SYS_NAND_SELF_INIT
Ashok Reddy Somabb8448a2019-12-27 04:47:12 -0700531 select DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200532 imply CMD_NAND
533 help
534 This enables Nand driver support for Nand flash controller
535 found on Zynq SoC.
536
537config NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
538 bool "Enable use of 1st stage bootloader timing for NAND"
539 depends on NAND_ZYNQ
540 help
541 This flag prevent U-boot reconfigure NAND flash controller and reuse
542 the NAND timing from 1st stage bootloader.
543
Suneel Garapati9de7d2b2020-08-26 14:37:22 +0200544config NAND_OCTEONTX
545 bool "Support for OcteonTX NAND controller"
546 select SYS_NAND_SELF_INIT
547 imply CMD_NAND
548 help
549 This enables Nand flash controller hardware found on the OcteonTX
550 processors.
551
552config NAND_OCTEONTX_HW_ECC
553 bool "Support Hardware ECC for OcteonTX NAND controller"
554 depends on NAND_OCTEONTX
555 default y
556 help
557 This enables Hardware BCH engine found on the OcteonTX processors to
558 support ECC for NAND flash controller.
559
Christophe Kerelloda141682019-04-05 11:41:50 +0200560config NAND_STM32_FMC2
561 bool "Support for NAND controller on STM32MP SoCs"
562 depends on ARCH_STM32MP
563 select SYS_NAND_SELF_INIT
564 imply CMD_NAND
565 help
566 Enables support for NAND Flash chips on SoCs containing the FMC2
567 NAND controller. This controller is found on STM32MP SoCs.
568 The controller supports a maximum 8k page size and supports
569 a maximum 8-bit correction error per sector of 512 bytes.
570
Kate Liu41ccd2e2020-12-11 13:46:12 -0800571config CORTINA_NAND
572 bool "Support for NAND controller on Cortina-Access SoCs"
573 depends on CORTINA_PLATFORM
574 select SYS_NAND_SELF_INIT
575 select DM_MTD
576 imply CMD_NAND
577 help
578 Enables support for NAND Flash chips on Coartina-Access SoCs platform
579 This controller is found on Presidio/Venus SoCs.
580 The controller supports a maximum 8k page size and supports
581 a maximum 40-bit error correction per sector of 1024 bytes.
582
Yifeng Zhao9e9021e2021-06-07 16:40:29 +0800583config ROCKCHIP_NAND
584 bool "Support for NAND controller on Rockchip SoCs"
585 depends on ARCH_ROCKCHIP
586 select SYS_NAND_SELF_INIT
587 select DM_MTD
588 imply CMD_NAND
589 help
590 Enables support for NAND Flash chips on Rockchip SoCs platform.
591 This controller is found on Rockchip SoCs.
592 There are four different versions of NAND FLASH Controllers,
593 including:
594 NFC v600: RK2928, RK3066, RK3188
595 NFC v622: RK3036, RK3128
596 NFC v800: RK3308, RV1108
597 NFC v900: PX30, RK3326
598
Tom Rini8f37ac42021-12-12 22:12:35 -0500599config TEGRA_NAND
600 bool "Support for NAND controller on Tegra SoCs"
601 depends on ARCH_TEGRA
602 select SYS_NAND_SELF_INIT
603 imply CMD_NAND
604 help
605 Enables support for NAND Flash chips on Tegra SoCs platforms.
606
developer10a61df2022-05-20 11:23:47 +0800607config NAND_MT7621
608 bool "Support for MediaTek MT7621 NAND flash controller"
609 depends on SOC_MT7621
610 select SYS_NAND_SELF_INIT
611 select SPL_SYS_NAND_SELF_INIT
612 imply CMD_NAND
613 help
614 This enables NAND driver for the NAND flash controller on MediaTek
615 MT7621 platform.
616 The controller supports 4~12 bits correction per 512 bytes with a
617 maximum 4KB page size.
618
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200619comment "Generic NAND options"
620
621config SYS_NAND_BLOCK_SIZE
622 hex "NAND chip eraseblock size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400623 depends on ARCH_SUNXI || SPL_NAND_SUPPORT || TPL_NAND_SUPPORT
developer10a61df2022-05-20 11:23:47 +0800624 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && \
625 !NAND_FSL_IFC && !NAND_MT7621
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200626 help
627 Number of data bytes in one eraseblock for the NAND chip on the
628 board. This is the multiple of NAND_PAGE_SIZE and the number of
629 pages.
630
Tom Rinifdae0072021-09-22 14:50:34 -0400631config SYS_NAND_ONFI_DETECTION
632 bool "Enable detection of ONFI compliant devices during probe"
633 help
634 Enables detection of ONFI compliant devices during probe.
635 And fetching device parameters flashed on device, by parsing
636 ONFI parameter page.
637
Tom Rini2510a812021-09-22 14:50:30 -0400638config SYS_NAND_PAGE_COUNT
639 hex "NAND chip page count"
640 depends on SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC || \
641 SPL_NAND_AM33XX_BCH || SPL_NAND_LOAD || SPL_NAND_SIMPLE)
642 help
643 Number of pages in the NAND chip.
644
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200645config SYS_NAND_PAGE_SIZE
646 hex "NAND chip page size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400647 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
648 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
649 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
developer10a61df2022-05-20 11:23:47 +0800650 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && !NAND_MT7621
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200651 help
652 Number of data bytes in one page for the NAND chip on the
653 board, not including the OOB area.
654
655config SYS_NAND_OOBSIZE
656 hex "NAND chip OOB size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400657 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
658 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
659 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
Tom Rinid24700f2021-10-30 23:03:56 -0400660 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200661 help
662 Number of bytes in the Out-Of-Band area for the NAND chip on
663 the board.
664
665# Enhance depends when converting drivers to Kconfig which use this config
666# option (mxc_nand, ndfc, omap_gpmc).
667config SYS_NAND_BUSWIDTH_16BIT
668 bool "Use 16-bit NAND interface"
669 depends on NAND_VF610_NFC || NAND_OMAP_GPMC || NAND_MXC || ARCH_DAVINCI
670 help
671 Indicates that NAND device has 16-bit wide data-bus. In absence of this
672 config, bus-width of NAND device is assumed to be either 8-bit and later
673 determined by reading ONFI params.
674 Above config is useful when NAND device's bus-width information cannot
675 be determined from on-chip ONFI params, like in following scenarios:
676 - SPL boot does not support reading of ONFI parameters. This is done to
677 keep SPL code foot-print small.
678 - In current U-Boot flow using nand_init(), driver initialization
679 happens in board_nand_init() which is called before any device probe
680 (nand_scan_ident + nand_scan_tail), thus device's ONFI parameters are
681 not available while configuring controller. So a static CONFIG_NAND_xx
682 is needed to know the device's bus-width in advance.
683
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200684if SPL
685
Tom Rini8e6d9c72021-09-22 14:50:33 -0400686config SYS_NAND_5_ADDR_CYCLE
687 bool "Wait 5 address cycles during NAND commands"
688 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_SIMPLE || \
689 (SPL_NAND_SUPPORT && NAND_ATMEL)
690 default y
691 help
692 Some controllers require waiting for 5 address cycles when issuing
693 some commands, on NAND chips larger than 128MiB.
694
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400695choice
Tom Rinifdae0072021-09-22 14:50:34 -0400696 prompt "NAND bad block marker/indicator position in the OOB"
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400697 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_DENALI || SPL_NAND_SIMPLE || \
698 SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC)
699 default HAS_NAND_LARGE_BADBLOCK_POS
700 help
701 In the OOB, which position contains the badblock information.
702
703config HAS_NAND_LARGE_BADBLOCK_POS
704 bool "Set the bad block marker/indicator to the 'large' position"
705
706config HAS_NAND_SMALL_BADBLOCK_POS
707 bool "Set the bad block marker/indicator to the 'small' position"
708
709endchoice
710
711config SYS_NAND_BAD_BLOCK_POS
712 int
713 default 0 if HAS_NAND_LARGE_BADBLOCK_POS
714 default 5 if HAS_NAND_SMALL_BADBLOCK_POS
715
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200716config SYS_NAND_U_BOOT_LOCATIONS
717 bool "Define U-boot binaries locations in NAND"
718 help
719 Enable CONFIG_SYS_NAND_U_BOOT_OFFS though Kconfig.
720 This option should not be enabled when compiling U-boot for boards
721 defining CONFIG_SYS_NAND_U_BOOT_OFFS in their include/configs/<board>.h
722 file.
723
724config SYS_NAND_U_BOOT_OFFS
725 hex "Location in NAND to read U-Boot from"
726 default 0x800000 if NAND_SUNXI
727 depends on SYS_NAND_U_BOOT_LOCATIONS
728 help
729 Set the offset from the start of the nand where u-boot should be
730 loaded from.
731
732config SYS_NAND_U_BOOT_OFFS_REDUND
733 hex "Location in NAND to read U-Boot from"
734 default SYS_NAND_U_BOOT_OFFS
735 depends on SYS_NAND_U_BOOT_LOCATIONS
736 help
737 Set the offset from the start of the nand where the redundant u-boot
738 should be loaded from.
739
740config SPL_NAND_AM33XX_BCH
741 bool "Enables SPL-NAND driver which supports ELM based"
Tom Rini0a83cc22022-06-10 23:03:09 -0400742 depends on SPL_NAND_SUPPORT && NAND_OMAP_GPMC && !OMAP34XX
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200743 default y
744 help
745 Hardware ECC correction. This is useful for platforms which have ELM
746 hardware engine and use NAND boot mode.
747 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
748 so those platforms should use CONFIG_SPL_NAND_SIMPLE for enabling
749 SPL-NAND driver with software ECC correction support.
750
751config SPL_NAND_DENALI
752 bool "Support Denali NAND controller for SPL"
Tom Rini0a83cc22022-06-10 23:03:09 -0400753 depends on SPL_NAND_SUPPORT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200754 help
755 This is a small implementation of the Denali NAND controller
756 for use on SPL.
757
Masahiro Yamada64648cb2020-04-17 16:51:42 +0900758config NAND_DENALI_SPARE_AREA_SKIP_BYTES
759 int "Number of bytes skipped in OOB area"
760 depends on SPL_NAND_DENALI
761 range 0 63
762 help
763 This option specifies the number of bytes to skip from the beginning
764 of OOB area before last ECC sector data starts. This is potentially
765 used to preserve the bad block marker in the OOB area.
766
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200767config SPL_NAND_SIMPLE
768 bool "Use simple SPL NAND driver"
Tom Rini0a83cc22022-06-10 23:03:09 -0400769 depends on !SPL_NAND_AM33XX_BCH && SPL_NAND_SUPPORT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200770 help
771 Support for NAND boot using simple NAND drivers that
772 expose the cmd_ctrl() interface.
Tom Rini4251f7d2022-11-12 17:36:44 -0500773
774config SYS_NAND_HW_ECC_OOBFIRST
775 bool "In SPL, read the OOB first and then the data from NAND"
776 depends on SPL_NAND_SIMPLE
777
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200778endif
779
780endif # if NAND