blob: adb271dfb8fb6b09dd37355c8d3df31b6348638f [file] [log] [blame]
Miquel Raynald0935362019-10-03 19:50:03 +02001menuconfig MTD_RAW_NAND
Miquel Raynal8115c452018-08-16 17:30:08 +02002 bool "Raw NAND Device Support"
Alexander Dahl77374532024-03-20 10:02:11 +01003
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
Balamanikandan Gunasundarfe33c7d2022-10-25 16:21:01 +053051config DM_NAND_ATMEL
Alexander Dahl77374532024-03-20 10:02:11 +010052 bool "Support Atmel NAND controller with DM support"
53 select SYS_NAND_SELF_INIT
54 imply SYS_NAND_USE_FLASH_BBT
55 help
56 Enable this driver for NAND flash platforms using an Atmel NAND
57 controller.
Balamanikandan Gunasundarfe33c7d2022-10-25 16:21:01 +053058
Miquel Raynal1f1ae152018-08-16 17:30:07 +020059config NAND_ATMEL
60 bool "Support Atmel NAND controller"
Tom Rini98372452021-12-12 22:12:36 -050061 select SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +020062 imply SYS_NAND_USE_FLASH_BBT
63 help
64 Enable this driver for NAND flash platforms using an Atmel NAND
65 controller.
66
Derald D. Woods7830fc52018-12-15 01:36:46 -060067if NAND_ATMEL
68
69config ATMEL_NAND_HWECC
70 bool "Atmel Hardware ECC"
Derald D. Woods7830fc52018-12-15 01:36:46 -060071
72config ATMEL_NAND_HW_PMECC
73 bool "Atmel Programmable Multibit ECC (PMECC)"
74 select ATMEL_NAND_HWECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060075 help
76 The Programmable Multibit ECC (PMECC) controller is a programmable
77 binary BCH(Bose, Chaudhuri and Hocquenghem) encoder and decoder.
78
79config PMECC_CAP
80 int "PMECC Correctable ECC Bits"
81 depends on ATMEL_NAND_HW_PMECC
82 default 2
83 help
84 Correctable ECC bits, can be 2, 4, 8, 12, and 24.
85
86config PMECC_SECTOR_SIZE
87 int "PMECC Sector Size"
88 depends on ATMEL_NAND_HW_PMECC
89 default 512
90 help
91 Sector size, in bytes, can be 512 or 1024.
92
93config SPL_GENERATE_ATMEL_PMECC_HEADER
94 bool "Atmel PMECC Header Generation"
Tom Rini0a83cc22022-06-10 23:03:09 -040095 depends on SPL
Derald D. Woods7830fc52018-12-15 01:36:46 -060096 select ATMEL_NAND_HWECC
97 select ATMEL_NAND_HW_PMECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060098 help
99 Generate Programmable Multibit ECC (PMECC) header for SPL image.
100
Tom Rini70aa87d2022-11-12 17:36:42 -0500101choice
102 prompt "NAND bus width (bits)"
103 default SYS_NAND_DBW_8
104
105config SYS_NAND_DBW_8
106 bool "NAND bus width is 8 bits"
107
108config SYS_NAND_DBW_16
109 bool "NAND bus width is 16 bits"
110
111endchoice
112
Derald D. Woods7830fc52018-12-15 01:36:46 -0600113endif
114
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100115config NAND_BRCMNAND
116 bool "Support Broadcom NAND controller"
Miquel Raynala903be42019-10-03 19:50:04 +0200117 depends on OF_CONTROL && DM && DM_MTD
Tom Rini98372452021-12-12 22:12:36 -0500118 select SYS_NAND_SELF_INIT
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100119 help
120 Enable the driver for NAND flash on platforms using a Broadcom NAND
121 controller.
122
Linus Walleij84998f42024-10-11 16:49:54 +0200123config NAND_BRCMNAND_BCMBCA
124 bool "Support Broadcom NAND controller on BCMBCA platforms"
125 depends on NAND_BRCMNAND && ARCH_BCMBCA
126 help
127 Enable support for broadcom nand driver on BCA (broadband
128 access) platforms such as BCM6846.
129
Álvaro Fernández Rojasd9f9bfc2019-08-28 19:12:15 +0200130config NAND_BRCMNAND_6368
131 bool "Support Broadcom NAND controller on bcm6368"
132 depends on NAND_BRCMNAND && ARCH_BMIPS
133 help
134 Enable support for broadcom nand driver on bcm6368.
135
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100136config NAND_BRCMNAND_6838
Alexander Dahl77374532024-03-20 10:02:11 +0100137 bool "Support Broadcom NAND controller on bcm6838"
138 depends on NAND_BRCMNAND && ARCH_BMIPS && SOC_BMIPS_BCM6838
139 help
140 Enable support for broadcom nand driver on bcm6838.
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100141
Linus Walleij2306c332023-03-08 22:42:31 +0100142config NAND_BRCMNAND_IPROC
Alexander Dahl77374532024-03-20 10:02:11 +0100143 bool "Support Broadcom NAND controller on the iproc family"
144 depends on NAND_BRCMNAND
145 help
146 Enable support for broadcom nand driver on the Broadcom
147 iproc family such as Northstar (BCM5301x, BCM4708...)
Linus Walleij2306c332023-03-08 22:42:31 +0100148
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200149config NAND_DAVINCI
150 bool "Support TI Davinci NAND controller"
Tom Rini98372452021-12-12 22:12:36 -0500151 select SYS_NAND_SELF_INIT if TARGET_DA850EVM
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200152 help
153 Enable this driver for NAND flash controllers available in TI Davinci
154 and Keystone2 platforms
155
Tom Rinid1286e12022-11-12 17:36:45 -0500156choice
157 prompt "Type of ECC used on NAND"
158 default SYS_NAND_4BIT_HW_ECC_OOBFIRST
159 depends on NAND_DAVINCI
160
161config SYS_NAND_HW_ECC
162 bool "Use 1-bit HW ECC"
163
Tom Rini7f750f82022-10-28 20:27:11 -0400164config SYS_NAND_4BIT_HW_ECC_OOBFIRST
165 bool "Use 4-bit HW ECC with OOB at the front"
Tom Rinid1286e12022-11-12 17:36:45 -0500166
167config SYS_NAND_SOFT_ECC
168 bool "Use software ECC"
169
170endchoice
Tom Rini7f750f82022-10-28 20:27:11 -0400171
Tom Rini33adefd2022-11-12 17:36:49 -0500172choice
173 prompt "NAND page size"
174 depends on NAND_DAVINCI
175 default SYS_NAND_PAGE_2K
176
177config SYS_NAND_PAGE_2K
178 bool "Page size is 2K"
179
180config SYS_NAND_PAGE_4K
181 bool "Page size is 4K"
182
183endchoice
184
Tom Rinidada0e32021-09-12 20:32:24 -0400185config KEYSTONE_RBL_NAND
186 depends on ARCH_KEYSTONE
187 def_bool y
188
Tom Rinifae1dab2021-09-22 14:50:29 -0400189config SPL_NAND_LOAD
190 def_bool y
191 depends on NAND_DAVINCI && ARCH_DAVINCI && SPL_NAND_SUPPORT
192
Dinesh Maniyam1b8d1062025-02-27 00:18:26 +0800193config NAND_CADENCE
194 bool "Support Cadence NAND controller as a DT device"
195 depends on OF_CONTROL && DM_MTD
196 select SYS_NAND_SELF_INIT
Dinesh Maniyama073d1b2025-02-27 00:18:30 +0800197 select SPL_SYS_NAND_SELF_INIT
198 select SPL_NAND_BASE
199 select SPL_NAND_DRIVERS
200 select SPL_NAND_IDENT
201 select SPL_NAND_INIT
202 select SPL_NAND_ECC
Dinesh Maniyam1b8d1062025-02-27 00:18:26 +0800203 imply CMD_NAND
204 help
205 Enable the driver for NAND flash on platforms using a Cadence NAND
206 controller as a DT device.
207
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200208config NAND_DENALI
209 bool
210 select SYS_NAND_SELF_INIT
211 imply CMD_NAND
212
213config NAND_DENALI_DT
214 bool "Support Denali NAND controller as a DT device"
215 select NAND_DENALI
Lokanathan, Raaj791edf72022-12-11 23:37:42 +0800216 select SPL_SYS_NAND_SELF_INIT
Masahiro Yamada8fc53822020-01-30 22:07:59 +0900217 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200218 help
219 Enable the driver for NAND flash on platforms using a Denali NAND
220 controller as a DT device.
221
Tom Rinia73788c2021-09-22 14:50:37 -0400222config NAND_FSL_ELBC
223 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500224 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
225 select SPL_SYS_NAND_SELF_INIT
226 select SYS_NAND_SELF_INIT
Tom Rinia73788c2021-09-22 14:50:37 -0400227 depends on FSL_ELBC
228 help
229 Enable the Freescale Enhanced Local Bus Controller FCM NAND driver.
230
Pali Rohárbb834db2022-04-04 18:17:19 +0200231config NAND_FSL_ELBC_DT
232 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver (DT mode)"
233 depends on NAND_FSL_ELBC
234
Tom Rinia73788c2021-09-22 14:50:37 -0400235config NAND_FSL_IFC
236 bool "Support Freescale Integrated Flash Controller NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500237 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
Tom Rini1a9f23d2022-05-26 14:31:57 -0400238 select TPL_NAND_INIT if TPL && !TPL_FRAMEWORK
Tom Rini98372452021-12-12 22:12:36 -0500239 select SPL_SYS_NAND_SELF_INIT
240 select SYS_NAND_SELF_INIT
Tom Rini05b419e2021-12-11 14:55:49 -0500241 select FSL_IFC
Tom Rinia73788c2021-09-22 14:50:37 -0400242 help
243 Enable the Freescale Integrated Flash Controller NAND driver.
244
Tom Rinib91baf62022-11-19 18:45:29 -0500245config NAND_KIRKWOOD
246 bool "Support for Kirkwood NAND controller"
247 depends on ARCH_KIRKWOOD
248 default y
249
250config NAND_ECC_BCH
251 bool
252
253config NAND_KMETER1
254 bool "Support KMETER1 NAND controller"
255 depends on VENDOR_KM
256 select NAND_ECC_BCH
257
Tom Rini08204272021-09-22 14:50:28 -0400258config NAND_LPC32XX_MLC
259 bool "Support LPC32XX_MLC controller"
Tom Rini98372452021-12-12 22:12:36 -0500260 select SYS_NAND_SELF_INIT
Tom Rini08204272021-09-22 14:50:28 -0400261 help
262 Enable the LPC32XX MLC NAND controller.
263
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200264config NAND_LPC32XX_SLC
265 bool "Support LPC32XX_SLC controller"
266 help
267 Enable the LPC32XX SLC NAND controller.
268
269config NAND_OMAP_GPMC
270 bool "Support OMAP GPMC NAND controller"
Roger Quadros0bde4972022-10-11 14:50:00 +0300271 depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3
Roger Quadros80cf6372022-12-20 12:21:59 +0200272 select SYS_NAND_SELF_INIT if ARCH_K3
Roger Quadros685c4282022-12-20 12:22:00 +0200273 select SPL_NAND_INIT if ARCH_K3
274 select SPL_SYS_NAND_SELF_INIT if ARCH_K3
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200275 help
276 Enables omap_gpmc.c driver for OMAPx and AMxxxx platforms.
277 GPMC controller is used for parallel NAND flash devices, and can
278 do ECC calculation (not ECC error detection) for HAM1, BCH4, BCH8
279 and BCH16 ECC algorithms.
280
Tom Rinif6d26d82021-09-22 14:50:39 -0400281if NAND_OMAP_GPMC
282
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200283config NAND_OMAP_GPMC_PREFETCH
284 bool "Enable GPMC Prefetch"
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200285 default y
286 help
287 On OMAP platforms that use the GPMC controller
288 (CONFIG_NAND_OMAP_GPMC_PREFETCH), this options enables the code that
289 uses the prefetch mode to speed up read operations.
290
291config NAND_OMAP_ELM
292 bool "Enable ELM driver for OMAPxx and AMxx platforms."
Tom Rinif6d26d82021-09-22 14:50:39 -0400293 depends on !OMAP34XX
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200294 help
295 ELM controller is used for ECC error detection (not ECC calculation)
296 of BCH4, BCH8 and BCH16 ECC algorithms.
297 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
298 thus such SoC platforms need to depend on software library for ECC error
299 detection. However ECC calculation on such plaforms would still be
300 done by GPMC controller.
301
Tom Rinif6d26d82021-09-22 14:50:39 -0400302choice
303 prompt "ECC scheme"
304 default NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
305 help
306 On OMAP platforms, this CONFIG specifies NAND ECC scheme.
307 It can take following values:
308 OMAP_ECC_HAM1_CODE_SW
309 1-bit Hamming code using software lib.
310 (for legacy devices only)
311 OMAP_ECC_HAM1_CODE_HW
312 1-bit Hamming code using GPMC hardware.
313 (for legacy devices only)
314 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW
315 4-bit BCH code (unsupported)
316 OMAP_ECC_BCH4_CODE_HW
317 4-bit BCH code (unsupported)
318 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
319 8-bit BCH code with
320 - ecc calculation using GPMC hardware engine,
321 - error detection using software library.
322 - requires CONFIG_BCH to enable software BCH library
323 (For legacy device which do not have ELM h/w engine)
324 OMAP_ECC_BCH8_CODE_HW
325 8-bit BCH code with
326 - ecc calculation using GPMC hardware engine,
327 - error detection using ELM hardware engine.
328 OMAP_ECC_BCH16_CODE_HW
329 16-bit BCH code with
330 - ecc calculation using GPMC hardware engine,
331 - error detection using ELM hardware engine.
332
333 How to select ECC scheme on OMAP and AMxx platforms ?
334 -----------------------------------------------------
335 Though higher ECC schemes have more capability to detect and correct
336 bit-flips, but still selection of ECC scheme is dependent on following
337 - hardware engines present in SoC.
338 Some legacy OMAP SoC do not have ELM h/w engine thus such
339 SoC cannot support BCHx_HW ECC schemes.
340 - size of OOB/Spare region
341 With higher ECC schemes, more OOB/Spare area is required to
342 store ECC. So choice of ECC scheme is limited by NAND oobsize.
343
344 In general following expression can help:
345 NAND_OOBSIZE >= 2 + (NAND_PAGESIZE / 512) * ECC_BYTES
346 where
347 NAND_OOBSIZE = number of bytes available in
348 OOB/spare area per NAND page.
349 NAND_PAGESIZE = bytes in main-area of NAND page.
350 ECC_BYTES = number of ECC bytes generated to
351 protect 512 bytes of data, which is:
352 3 for HAM1_xx ecc schemes
353 7 for BCH4_xx ecc schemes
354 14 for BCH8_xx ecc schemes
355 26 for BCH16_xx ecc schemes
356
357 example to check for BCH16 on 2K page NAND
358 NAND_PAGESIZE = 2048
359 NAND_OOBSIZE = 64
360 2 + (2048 / 512) * 26 = 106 > NAND_OOBSIZE
361 Thus BCH16 cannot be supported on 2K page NAND.
362
363 However, for 4K pagesize NAND
364 NAND_PAGESIZE = 4096
365 NAND_OOBSIZE = 224
366 ECC_BYTES = 26
367 2 + (4096 / 512) * 26 = 210 < NAND_OOBSIZE
368 Thus BCH16 can be supported on 4K page NAND.
369
370config NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
371 bool "1-bit Hamming code using software lib"
372
373config NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
374 bool "1-bit Hamming code using GPMC hardware"
375
376config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
377 bool "8-bit BCH code with HW calculation SW error detection"
378
379config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
380 bool "8-bit BCH code with HW calculation and error detection"
381
382config NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
383 bool "16-bit BCH code with HW calculation and error detection"
384
385endchoice
386
387config NAND_OMAP_ECCSCHEME
388 int
389 default 1 if NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
390 default 2 if NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
391 default 5 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
392 default 6 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
393 default 7 if NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
394 help
395 This must be kept in sync with the enum in
396 include/linux/mtd/omap_gpmc.h
397
398endif
399
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200400config NAND_VF610_NFC
401 bool "Support for Freescale NFC for VF610"
402 select SYS_NAND_SELF_INIT
Stefan Agnerbd186142018-12-06 14:57:09 +0100403 select SYS_NAND_DRIVER_ECC_LAYOUT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200404 imply CMD_NAND
405 help
406 Enables support for NAND Flash Controller on some Freescale
407 processors like the VF610, MCF54418 or Kinetis K70.
408 The driver supports a maximum 2k page size. The driver
409 currently does not support hardware ECC.
410
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100411if NAND_VF610_NFC
412
413config NAND_VF610_NFC_DT
Alexander Dahl77374532024-03-20 10:02:11 +0100414 bool "Support Vybrid's vf610 NAND controller as a DT device"
415 depends on OF_CONTROL && DM_MTD
416 help
417 Enable the driver for Vybrid's vf610 NAND flash on platforms
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100418 using device tree.
419
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200420choice
421 prompt "Hardware ECC strength"
422 depends on NAND_VF610_NFC
423 default SYS_NAND_VF610_NFC_45_ECC_BYTES
424 help
425 Select the ECC strength used in the hardware BCH ECC block.
426
427config SYS_NAND_VF610_NFC_45_ECC_BYTES
428 bool "24-error correction (45 ECC bytes)"
429
430config SYS_NAND_VF610_NFC_60_ECC_BYTES
431 bool "32-error correction (60 ECC bytes)"
432
433endchoice
434
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100435endif
436
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200437config NAND_PXA3XX
438 bool "Support for NAND on PXA3xx and Armada 370/XP/38x"
439 select SYS_NAND_SELF_INIT
Shmuel Hazan759349e2020-10-29 08:52:18 +0200440 select DM_MTD
Shmuel Hazan58983222020-10-29 08:52:20 +0200441 select REGMAP
442 select SYSCON
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200443 imply CMD_NAND
444 help
445 This enables the driver for the NAND flash device found on
446 PXA3xx processors (NFCv1) and also on Armada 370/XP (NFCv2).
447
Sean Anderson326422b2023-11-04 16:37:52 -0400448config NAND_SANDBOX
449 bool "Support for NAND in sandbox"
450 depends on SANDBOX
451 select SYS_NAND_SELF_INIT
Sean Anderson765dc6a2023-11-04 16:37:53 -0400452 select SPL_SYS_NAND_SELF_INIT
453 select SPL_NAND_INIT
Sean Anderson326422b2023-11-04 16:37:52 -0400454 select SYS_NAND_SOFT_ECC
455 select BCH
456 select NAND_ECC_BCH
457 imply CMD_NAND
458 help
459 Enable a dummy NAND driver for sandbox. It simulates any number of
460 arbitrary NAND chips with a RAM buffer. It will also inject errors to
461 test ECC. At the moment, only 8-bit busses and single-chip devices are
462 supported.
463
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200464config NAND_SUNXI
465 bool "Support for NAND on Allwinner SoCs"
466 default ARCH_SUNXI
467 depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I
468 select SYS_NAND_SELF_INIT
469 select SYS_NAND_U_BOOT_LOCATIONS
470 select SPL_NAND_SUPPORT
Tom Rini98372452021-12-12 22:12:36 -0500471 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200472 imply CMD_NAND
Alexander Dahl77374532024-03-20 10:02:11 +0100473 help
474 Enable support for NAND. This option enables the standard and
475 SPL drivers.
476 The SPL driver only supports reading from the NAND using DMA
477 transfers.
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200478
479if NAND_SUNXI
480
481config NAND_SUNXI_SPL_ECC_STRENGTH
482 int "Allwinner NAND SPL ECC Strength"
483 default 64
484
485config NAND_SUNXI_SPL_ECC_SIZE
486 int "Allwinner NAND SPL ECC Step Size"
487 default 1024
488
489config NAND_SUNXI_SPL_USABLE_PAGE_SIZE
490 int "Allwinner NAND SPL Usable Page Size"
491 default 1024
492
493endif
494
495config NAND_ARASAN
496 bool "Configure Arasan Nand"
497 select SYS_NAND_SELF_INIT
Michal Simekc5587832020-08-19 09:59:52 +0200498 depends on DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200499 imply CMD_NAND
500 help
501 This enables Nand driver support for Arasan nand flash
502 controller. This uses the hardware ECC for read and
503 write operations.
504
Arseniy Krasnov55842b42024-02-11 01:39:27 +0300505config NAND_MESON
506 bool "Meson NAND support"
507 select SYS_NAND_SELF_INIT
508 depends on DM_MTD && ARCH_MESON
509 imply CMD_NAND
510 help
511 This enables Nand driver support for Meson raw NAND flash
512 controller.
513
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200514config NAND_MXC
515 bool "MXC NAND support"
516 depends on CPU_ARM926EJS || CPU_ARM1136 || MX5
517 imply CMD_NAND
518 help
519 This enables the NAND driver for the NAND flash controller on the
Haolin Lie8df55b2021-07-18 10:13:39 +0800520 i.MX27 / i.MX31 / i.MX5 processors.
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200521
Tom Rini1ba2a002022-11-12 17:36:50 -0500522config SYS_NAND_SIZE
523 int "Size of NAND in kilobytes"
524 depends on NAND_MXC && SPL_NAND_SUPPORT
525 default 268435456
526
Tom Rini17e67002022-12-02 16:42:37 -0500527config MXC_NAND_HWECC
528 bool "Hardware ECC support in MXC NAND"
529 depends on NAND_MXC
530
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200531config NAND_MXS
532 bool "MXS NAND support"
Peng Fan128abf42020-05-04 22:09:00 +0800533 depends on MX23 || MX28 || MX6 || MX7 || IMX8 || IMX8M
Tom Rini98372452021-12-12 22:12:36 -0500534 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200535 select SYS_NAND_SELF_INIT
536 imply CMD_NAND
537 select APBH_DMA
Peng Fan128abf42020-05-04 22:09:00 +0800538 select APBH_DMA_BURST if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
539 select APBH_DMA_BURST8 if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200540 help
541 This enables NAND driver for the NAND flash controller on the
542 MXS processors.
543
544if NAND_MXS
545
546config NAND_MXS_DT
547 bool "Support MXS NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200548 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200549 help
550 Enable the driver for MXS NAND flash on platforms using
551 device tree.
552
553config NAND_MXS_USE_MINIMUM_ECC
554 bool "Use minimum ECC strength supported by the controller"
555 default false
556
557endif
558
Zhengxun Li01551712021-09-14 13:43:51 +0800559config NAND_MXIC
560 bool "Macronix raw NAND controller"
561 select SYS_NAND_SELF_INIT
562 help
563 This selects the Macronix raw NAND controller driver.
564
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200565config NAND_ZYNQ
566 bool "Support for Zynq Nand controller"
Tom Rini98372452021-12-12 22:12:36 -0500567 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200568 select SYS_NAND_SELF_INIT
Ashok Reddy Somabb8448a2019-12-27 04:47:12 -0700569 select DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200570 imply CMD_NAND
571 help
572 This enables Nand driver support for Nand flash controller
573 found on Zynq SoC.
574
575config NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
576 bool "Enable use of 1st stage bootloader timing for NAND"
577 depends on NAND_ZYNQ
578 help
Michal Simek50fa1182023-05-17 09:17:16 +0200579 This flag prevent U-Boot reconfigure NAND flash controller and reuse
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200580 the NAND timing from 1st stage bootloader.
581
Suneel Garapati9de7d2b2020-08-26 14:37:22 +0200582config NAND_OCTEONTX
583 bool "Support for OcteonTX NAND controller"
584 select SYS_NAND_SELF_INIT
585 imply CMD_NAND
586 help
Alexander Dahl77374532024-03-20 10:02:11 +0100587 This enables Nand flash controller hardware found on the OcteonTX
588 processors.
Suneel Garapati9de7d2b2020-08-26 14:37:22 +0200589
590config NAND_OCTEONTX_HW_ECC
591 bool "Support Hardware ECC for OcteonTX NAND controller"
592 depends on NAND_OCTEONTX
593 default y
594 help
Alexander Dahl77374532024-03-20 10:02:11 +0100595 This enables Hardware BCH engine found on the OcteonTX processors to
596 support ECC for NAND flash controller.
Suneel Garapati9de7d2b2020-08-26 14:37:22 +0200597
Christophe Kerelloda141682019-04-05 11:41:50 +0200598config NAND_STM32_FMC2
599 bool "Support for NAND controller on STM32MP SoCs"
600 depends on ARCH_STM32MP
601 select SYS_NAND_SELF_INIT
602 imply CMD_NAND
603 help
604 Enables support for NAND Flash chips on SoCs containing the FMC2
605 NAND controller. This controller is found on STM32MP SoCs.
606 The controller supports a maximum 8k page size and supports
607 a maximum 8-bit correction error per sector of 512 bytes.
608
Kate Liu41ccd2e2020-12-11 13:46:12 -0800609config CORTINA_NAND
610 bool "Support for NAND controller on Cortina-Access SoCs"
611 depends on CORTINA_PLATFORM
612 select SYS_NAND_SELF_INIT
613 select DM_MTD
614 imply CMD_NAND
615 help
616 Enables support for NAND Flash chips on Coartina-Access SoCs platform
617 This controller is found on Presidio/Venus SoCs.
618 The controller supports a maximum 8k page size and supports
619 a maximum 40-bit error correction per sector of 1024 bytes.
620
Yifeng Zhao9e9021e2021-06-07 16:40:29 +0800621config ROCKCHIP_NAND
622 bool "Support for NAND controller on Rockchip SoCs"
623 depends on ARCH_ROCKCHIP
624 select SYS_NAND_SELF_INIT
625 select DM_MTD
626 imply CMD_NAND
627 help
628 Enables support for NAND Flash chips on Rockchip SoCs platform.
629 This controller is found on Rockchip SoCs.
630 There are four different versions of NAND FLASH Controllers,
631 including:
632 NFC v600: RK2928, RK3066, RK3188
633 NFC v622: RK3036, RK3128
634 NFC v800: RK3308, RV1108
635 NFC v900: PX30, RK3326
636
Johan Jonker904e0f02023-10-18 16:00:27 +0200637config ROCKCHIP_NAND_SKIP_BBTSCAN
638 bool "Skip the automatic BBT scan with Rockchip NAND controllers"
639 depends on ROCKCHIP_NAND
Johan Jonker904e0f02023-10-18 16:00:27 +0200640 help
641 Skip the automatic BBT scan with the NAND_SKIP_BBTSCAN
642 option when data content is not in MTD format or
643 must remain unchanged.
644
Tom Rini8f37ac42021-12-12 22:12:35 -0500645config TEGRA_NAND
646 bool "Support for NAND controller on Tegra SoCs"
647 depends on ARCH_TEGRA
648 select SYS_NAND_SELF_INIT
649 imply CMD_NAND
650 help
651 Enables support for NAND Flash chips on Tegra SoCs platforms.
652
developer10a61df2022-05-20 11:23:47 +0800653config NAND_MT7621
654 bool "Support for MediaTek MT7621 NAND flash controller"
655 depends on SOC_MT7621
656 select SYS_NAND_SELF_INIT
657 select SPL_SYS_NAND_SELF_INIT
658 imply CMD_NAND
659 help
660 This enables NAND driver for the NAND flash controller on MediaTek
661 MT7621 platform.
662 The controller supports 4~12 bits correction per 512 bytes with a
663 maximum 4KB page size.
664
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200665comment "Generic NAND options"
666
667config SYS_NAND_BLOCK_SIZE
668 hex "NAND chip eraseblock size"
Pali Rohár5c5cf602023-01-10 22:55:21 +0100669 depends on ARCH_SUNXI || SPL_NAND_SUPPORT || TPL_NAND_SUPPORT || \
670 MVEBU_SPL_BOOT_DEVICE_NAND
developer10a61df2022-05-20 11:23:47 +0800671 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && \
672 !NAND_FSL_IFC && !NAND_MT7621
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200673 help
674 Number of data bytes in one eraseblock for the NAND chip on the
675 board. This is the multiple of NAND_PAGE_SIZE and the number of
676 pages.
677
Tom Rinifdae0072021-09-22 14:50:34 -0400678config SYS_NAND_ONFI_DETECTION
679 bool "Enable detection of ONFI compliant devices during probe"
680 help
681 Enables detection of ONFI compliant devices during probe.
682 And fetching device parameters flashed on device, by parsing
683 ONFI parameter page.
684
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200685config SYS_NAND_PAGE_SIZE
686 hex "NAND chip page size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400687 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
688 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
Pali Rohár5c5cf602023-01-10 22:55:21 +0100689 MVEBU_SPL_BOOT_DEVICE_NAND || \
Sean Anderson765dc6a2023-11-04 16:37:53 -0400690 (NAND_ATMEL && SPL_NAND_SUPPORT) || \
Dinesh Maniyame94719b2025-02-27 00:18:32 +0800691 SPL_GENERATE_ATMEL_PMECC_HEADER || NAND_SANDBOX || NAND_CADENCE
developer10a61df2022-05-20 11:23:47 +0800692 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && !NAND_MT7621
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200693 help
694 Number of data bytes in one page for the NAND chip on the
695 board, not including the OOB area.
696
697config SYS_NAND_OOBSIZE
698 hex "NAND chip OOB size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400699 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
700 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
701 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
Tom Rinid24700f2021-10-30 23:03:56 -0400702 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200703 help
704 Number of bytes in the Out-Of-Band area for the NAND chip on
705 the board.
706
707# Enhance depends when converting drivers to Kconfig which use this config
708# option (mxc_nand, ndfc, omap_gpmc).
709config SYS_NAND_BUSWIDTH_16BIT
710 bool "Use 16-bit NAND interface"
711 depends on NAND_VF610_NFC || NAND_OMAP_GPMC || NAND_MXC || ARCH_DAVINCI
712 help
713 Indicates that NAND device has 16-bit wide data-bus. In absence of this
714 config, bus-width of NAND device is assumed to be either 8-bit and later
715 determined by reading ONFI params.
716 Above config is useful when NAND device's bus-width information cannot
717 be determined from on-chip ONFI params, like in following scenarios:
718 - SPL boot does not support reading of ONFI parameters. This is done to
719 keep SPL code foot-print small.
720 - In current U-Boot flow using nand_init(), driver initialization
721 happens in board_nand_init() which is called before any device probe
722 (nand_scan_ident + nand_scan_tail), thus device's ONFI parameters are
723 not available while configuring controller. So a static CONFIG_NAND_xx
724 is needed to know the device's bus-width in advance.
725
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200726if SPL
727
Tom Rini8e6d9c72021-09-22 14:50:33 -0400728config SYS_NAND_5_ADDR_CYCLE
729 bool "Wait 5 address cycles during NAND commands"
730 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_SIMPLE || \
731 (SPL_NAND_SUPPORT && NAND_ATMEL)
732 default y
733 help
734 Some controllers require waiting for 5 address cycles when issuing
735 some commands, on NAND chips larger than 128MiB.
736
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400737choice
Tom Rinifdae0072021-09-22 14:50:34 -0400738 prompt "NAND bad block marker/indicator position in the OOB"
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400739 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_DENALI || SPL_NAND_SIMPLE || \
740 SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC)
741 default HAS_NAND_LARGE_BADBLOCK_POS
742 help
743 In the OOB, which position contains the badblock information.
744
745config HAS_NAND_LARGE_BADBLOCK_POS
746 bool "Set the bad block marker/indicator to the 'large' position"
747
748config HAS_NAND_SMALL_BADBLOCK_POS
749 bool "Set the bad block marker/indicator to the 'small' position"
750
751endchoice
752
753config SYS_NAND_BAD_BLOCK_POS
754 int
755 default 0 if HAS_NAND_LARGE_BADBLOCK_POS
756 default 5 if HAS_NAND_SMALL_BADBLOCK_POS
757
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200758config SYS_NAND_U_BOOT_LOCATIONS
Michal Simek50fa1182023-05-17 09:17:16 +0200759 bool "Define U-Boot binaries locations in NAND"
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200760 help
Alexander Dahl77374532024-03-20 10:02:11 +0100761 Enable CONFIG_SYS_NAND_U_BOOT_OFFS though Kconfig.
762 This option should not be enabled when compiling U-Boot for boards
763 defining CONFIG_SYS_NAND_U_BOOT_OFFS in their include/configs/<board>.h
764 file.
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200765
766config SYS_NAND_U_BOOT_OFFS
767 hex "Location in NAND to read U-Boot from"
768 default 0x800000 if NAND_SUNXI
769 depends on SYS_NAND_U_BOOT_LOCATIONS
770 help
Alexander Dahl77374532024-03-20 10:02:11 +0100771 Set the offset from the start of the nand where u-boot should be
772 loaded from.
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200773
774config SYS_NAND_U_BOOT_OFFS_REDUND
775 hex "Location in NAND to read U-Boot from"
776 default SYS_NAND_U_BOOT_OFFS
777 depends on SYS_NAND_U_BOOT_LOCATIONS
778 help
Alexander Dahl77374532024-03-20 10:02:11 +0100779 Set the offset from the start of the nand where the redundant u-boot
780 should be loaded from.
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200781
782config SPL_NAND_AM33XX_BCH
783 bool "Enables SPL-NAND driver which supports ELM based"
Tom Rini0a83cc22022-06-10 23:03:09 -0400784 depends on SPL_NAND_SUPPORT && NAND_OMAP_GPMC && !OMAP34XX
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200785 default y
Alexander Dahl77374532024-03-20 10:02:11 +0100786 help
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200787 Hardware ECC correction. This is useful for platforms which have ELM
788 hardware engine and use NAND boot mode.
789 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
790 so those platforms should use CONFIG_SPL_NAND_SIMPLE for enabling
Alexander Dahl77374532024-03-20 10:02:11 +0100791 SPL-NAND driver with software ECC correction support.
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200792
Dinesh Maniyama073d1b2025-02-27 00:18:30 +0800793config SPL_NAND_CADENCE
794 bool "Support Cadence NAND controller for SPL"
795 depends on SPL_NAND_SUPPORT
796 help
797 This is a small implementation of the Cadence NAND controller
798 for use on SPL.
799
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200800config SPL_NAND_DENALI
801 bool "Support Denali NAND controller for SPL"
Tom Rini0a83cc22022-06-10 23:03:09 -0400802 depends on SPL_NAND_SUPPORT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200803 help
804 This is a small implementation of the Denali NAND controller
805 for use on SPL.
806
Masahiro Yamada64648cb2020-04-17 16:51:42 +0900807config NAND_DENALI_SPARE_AREA_SKIP_BYTES
808 int "Number of bytes skipped in OOB area"
809 depends on SPL_NAND_DENALI
810 range 0 63
811 help
812 This option specifies the number of bytes to skip from the beginning
813 of OOB area before last ECC sector data starts. This is potentially
814 used to preserve the bad block marker in the OOB area.
815
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200816config SPL_NAND_SIMPLE
817 bool "Use simple SPL NAND driver"
Tom Rini0a83cc22022-06-10 23:03:09 -0400818 depends on !SPL_NAND_AM33XX_BCH && SPL_NAND_SUPPORT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200819 help
820 Support for NAND boot using simple NAND drivers that
821 expose the cmd_ctrl() interface.
Tom Rini4251f7d2022-11-12 17:36:44 -0500822
823config SYS_NAND_HW_ECC_OOBFIRST
824 bool "In SPL, read the OOB first and then the data from NAND"
825 depends on SPL_NAND_SIMPLE
826
Alexander Dahl77374532024-03-20 10:02:11 +0100827endif # if SPL
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200828
Alexander Dahl77374532024-03-20 10:02:11 +0100829endif # if MTD_RAW_NAND