blob: 0f2eaebfdbf82a91adfc57caacc420f64728f0fd [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
Tom Riniac164de2022-10-28 20:27:04 -040029config SYS_MAX_NAND_DEVICE
30 int "Maximum number of NAND devices to support"
31 default 1
32
Stefan Agnerbd186142018-12-06 14:57:09 +010033config SYS_NAND_DRIVER_ECC_LAYOUT
Tom Rinid03e14e2021-12-11 14:55:54 -050034 bool "Omit standard ECC layouts to save space"
Stefan Agnerbd186142018-12-06 14:57:09 +010035 help
Tom Rinid03e14e2021-12-11 14:55:54 -050036 Omit standard ECC layouts to save space. Select this if your driver
Stefan Agnerbd186142018-12-06 14:57:09 +010037 is known to provide its own ECC layout.
38
Stefan Roese23b37f92019-08-22 12:28:04 +020039config SYS_NAND_USE_FLASH_BBT
40 bool "Enable BBT (Bad Block Table) support"
41 help
42 Enable the BBT (Bad Block Table) usage.
43
Tom Rini2b2696a2022-11-12 17:36:48 -050044config SYS_NAND_NO_SUBPAGE_WRITE
45 bool "Disable subpage write support"
46 depends on NAND_ARASAN || NAND_DAVINCI || NAND_KIRKWOOD
47
Balamanikandan Gunasundarfe33c7d2022-10-25 16:21:01 +053048config DM_NAND_ATMEL
49 bool "Support Atmel NAND controller with DM support"
50 select SYS_NAND_SELF_INIT
51 imply SYS_NAND_USE_FLASH_BBT
52 help
53 Enable this driver for NAND flash platforms using an Atmel NAND
54 controller.
55
Miquel Raynal1f1ae152018-08-16 17:30:07 +020056config NAND_ATMEL
57 bool "Support Atmel NAND controller"
Tom Rini98372452021-12-12 22:12:36 -050058 select SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +020059 imply SYS_NAND_USE_FLASH_BBT
60 help
61 Enable this driver for NAND flash platforms using an Atmel NAND
62 controller.
63
Derald D. Woods7830fc52018-12-15 01:36:46 -060064if NAND_ATMEL
65
66config ATMEL_NAND_HWECC
67 bool "Atmel Hardware ECC"
Derald D. Woods7830fc52018-12-15 01:36:46 -060068
69config ATMEL_NAND_HW_PMECC
70 bool "Atmel Programmable Multibit ECC (PMECC)"
71 select ATMEL_NAND_HWECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060072 help
73 The Programmable Multibit ECC (PMECC) controller is a programmable
74 binary BCH(Bose, Chaudhuri and Hocquenghem) encoder and decoder.
75
76config PMECC_CAP
77 int "PMECC Correctable ECC Bits"
78 depends on ATMEL_NAND_HW_PMECC
79 default 2
80 help
81 Correctable ECC bits, can be 2, 4, 8, 12, and 24.
82
83config PMECC_SECTOR_SIZE
84 int "PMECC Sector Size"
85 depends on ATMEL_NAND_HW_PMECC
86 default 512
87 help
88 Sector size, in bytes, can be 512 or 1024.
89
90config SPL_GENERATE_ATMEL_PMECC_HEADER
91 bool "Atmel PMECC Header Generation"
Tom Rini0a83cc22022-06-10 23:03:09 -040092 depends on SPL
Derald D. Woods7830fc52018-12-15 01:36:46 -060093 select ATMEL_NAND_HWECC
94 select ATMEL_NAND_HW_PMECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060095 help
96 Generate Programmable Multibit ECC (PMECC) header for SPL image.
97
Tom Rini70aa87d2022-11-12 17:36:42 -050098choice
99 prompt "NAND bus width (bits)"
100 default SYS_NAND_DBW_8
101
102config SYS_NAND_DBW_8
103 bool "NAND bus width is 8 bits"
104
105config SYS_NAND_DBW_16
106 bool "NAND bus width is 16 bits"
107
108endchoice
109
Derald D. Woods7830fc52018-12-15 01:36:46 -0600110endif
111
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100112config NAND_BRCMNAND
113 bool "Support Broadcom NAND controller"
Miquel Raynala903be42019-10-03 19:50:04 +0200114 depends on OF_CONTROL && DM && DM_MTD
Tom Rini98372452021-12-12 22:12:36 -0500115 select SYS_NAND_SELF_INIT
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100116 help
117 Enable the driver for NAND flash on platforms using a Broadcom NAND
118 controller.
119
Álvaro Fernández Rojasd9f9bfc2019-08-28 19:12:15 +0200120config NAND_BRCMNAND_6368
121 bool "Support Broadcom NAND controller on bcm6368"
122 depends on NAND_BRCMNAND && ARCH_BMIPS
123 help
124 Enable support for broadcom nand driver on bcm6368.
125
Philippe Reynese175c322022-02-11 19:18:36 +0100126config NAND_BRCMNAND_6753
127 bool "Support Broadcom NAND controller on bcm6753"
William Zhang38921822022-08-22 11:49:08 -0700128 depends on NAND_BRCMNAND && BCM6855
Philippe Reynese175c322022-02-11 19:18:36 +0100129 help
130 Enable support for broadcom nand driver on bcm6753.
131
Philippe Reynes74ead742020-01-07 20:14:13 +0100132config NAND_BRCMNAND_68360
133 bool "Support Broadcom NAND controller on bcm68360"
William Zhangdf0b5bb2022-08-22 11:31:43 -0700134 depends on NAND_BRCMNAND && BCM6856
Philippe Reynes74ead742020-01-07 20:14:13 +0100135 help
136 Enable support for broadcom nand driver on bcm68360.
137
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100138config NAND_BRCMNAND_6838
139 bool "Support Broadcom NAND controller on bcm6838"
140 depends on NAND_BRCMNAND && ARCH_BMIPS && SOC_BMIPS_BCM6838
141 help
142 Enable support for broadcom nand driver on bcm6838.
143
144config NAND_BRCMNAND_6858
145 bool "Support Broadcom NAND controller on bcm6858"
William Zhang6b45fa62022-08-22 11:39:45 -0700146 depends on NAND_BRCMNAND && BCM6858
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100147 help
148 Enable support for broadcom nand driver on bcm6858.
149
150config NAND_BRCMNAND_63158
151 bool "Support Broadcom NAND controller on bcm63158"
William Zhang35a3ec1b2022-08-22 11:19:46 -0700152 depends on NAND_BRCMNAND && BCM63158
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100153 help
154 Enable support for broadcom nand driver on bcm63158.
155
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200156config NAND_DAVINCI
157 bool "Support TI Davinci NAND controller"
Tom Rini98372452021-12-12 22:12:36 -0500158 select SYS_NAND_SELF_INIT if TARGET_DA850EVM
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200159 help
160 Enable this driver for NAND flash controllers available in TI Davinci
161 and Keystone2 platforms
162
Tom Rinid1286e12022-11-12 17:36:45 -0500163choice
164 prompt "Type of ECC used on NAND"
165 default SYS_NAND_4BIT_HW_ECC_OOBFIRST
166 depends on NAND_DAVINCI
167
168config SYS_NAND_HW_ECC
169 bool "Use 1-bit HW ECC"
170
Tom Rini7f750f82022-10-28 20:27:11 -0400171config SYS_NAND_4BIT_HW_ECC_OOBFIRST
172 bool "Use 4-bit HW ECC with OOB at the front"
Tom Rinid1286e12022-11-12 17:36:45 -0500173
174config SYS_NAND_SOFT_ECC
175 bool "Use software ECC"
176
177endchoice
Tom Rini7f750f82022-10-28 20:27:11 -0400178
Tom Rini33adefd2022-11-12 17:36:49 -0500179choice
180 prompt "NAND page size"
181 depends on NAND_DAVINCI
182 default SYS_NAND_PAGE_2K
183
184config SYS_NAND_PAGE_2K
185 bool "Page size is 2K"
186
187config SYS_NAND_PAGE_4K
188 bool "Page size is 4K"
189
190endchoice
191
Tom Rinidada0e32021-09-12 20:32:24 -0400192config KEYSTONE_RBL_NAND
193 depends on ARCH_KEYSTONE
194 def_bool y
195
Tom Rinifae1dab2021-09-22 14:50:29 -0400196config SPL_NAND_LOAD
197 def_bool y
198 depends on NAND_DAVINCI && ARCH_DAVINCI && SPL_NAND_SUPPORT
199
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200200config NAND_DENALI
201 bool
202 select SYS_NAND_SELF_INIT
203 imply CMD_NAND
204
205config NAND_DENALI_DT
206 bool "Support Denali NAND controller as a DT device"
207 select NAND_DENALI
Masahiro Yamada8fc53822020-01-30 22:07:59 +0900208 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200209 help
210 Enable the driver for NAND flash on platforms using a Denali NAND
211 controller as a DT device.
212
Tom Rinia73788c2021-09-22 14:50:37 -0400213config NAND_FSL_ELBC
214 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500215 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
216 select SPL_SYS_NAND_SELF_INIT
217 select SYS_NAND_SELF_INIT
Tom Rinia73788c2021-09-22 14:50:37 -0400218 depends on FSL_ELBC
219 help
220 Enable the Freescale Enhanced Local Bus Controller FCM NAND driver.
221
Pali Rohárbb834db2022-04-04 18:17:19 +0200222config NAND_FSL_ELBC_DT
223 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver (DT mode)"
224 depends on NAND_FSL_ELBC
225
Tom Rinia73788c2021-09-22 14:50:37 -0400226config NAND_FSL_IFC
227 bool "Support Freescale Integrated Flash Controller NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500228 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
Tom Rini1a9f23d2022-05-26 14:31:57 -0400229 select TPL_NAND_INIT if TPL && !TPL_FRAMEWORK
Tom Rini98372452021-12-12 22:12:36 -0500230 select SPL_SYS_NAND_SELF_INIT
231 select SYS_NAND_SELF_INIT
Tom Rini05b419e2021-12-11 14:55:49 -0500232 select FSL_IFC
Tom Rinia73788c2021-09-22 14:50:37 -0400233 help
234 Enable the Freescale Integrated Flash Controller NAND driver.
235
Tom Rinib91baf62022-11-19 18:45:29 -0500236config NAND_KIRKWOOD
237 bool "Support for Kirkwood NAND controller"
238 depends on ARCH_KIRKWOOD
239 default y
240
241config NAND_ECC_BCH
242 bool
243
244config NAND_KMETER1
245 bool "Support KMETER1 NAND controller"
246 depends on VENDOR_KM
247 select NAND_ECC_BCH
248
Tom Rini08204272021-09-22 14:50:28 -0400249config NAND_LPC32XX_MLC
250 bool "Support LPC32XX_MLC controller"
Tom Rini98372452021-12-12 22:12:36 -0500251 select SYS_NAND_SELF_INIT
Tom Rini08204272021-09-22 14:50:28 -0400252 help
253 Enable the LPC32XX MLC NAND controller.
254
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200255config NAND_LPC32XX_SLC
256 bool "Support LPC32XX_SLC controller"
257 help
258 Enable the LPC32XX SLC NAND controller.
259
260config NAND_OMAP_GPMC
261 bool "Support OMAP GPMC NAND controller"
262 depends on ARCH_OMAP2PLUS
263 help
264 Enables omap_gpmc.c driver for OMAPx and AMxxxx platforms.
265 GPMC controller is used for parallel NAND flash devices, and can
266 do ECC calculation (not ECC error detection) for HAM1, BCH4, BCH8
267 and BCH16 ECC algorithms.
268
Tom Rinif6d26d82021-09-22 14:50:39 -0400269if NAND_OMAP_GPMC
270
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200271config NAND_OMAP_GPMC_PREFETCH
272 bool "Enable GPMC Prefetch"
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200273 default y
274 help
275 On OMAP platforms that use the GPMC controller
276 (CONFIG_NAND_OMAP_GPMC_PREFETCH), this options enables the code that
277 uses the prefetch mode to speed up read operations.
278
279config NAND_OMAP_ELM
280 bool "Enable ELM driver for OMAPxx and AMxx platforms."
Tom Rinif6d26d82021-09-22 14:50:39 -0400281 depends on !OMAP34XX
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200282 help
283 ELM controller is used for ECC error detection (not ECC calculation)
284 of BCH4, BCH8 and BCH16 ECC algorithms.
285 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
286 thus such SoC platforms need to depend on software library for ECC error
287 detection. However ECC calculation on such plaforms would still be
288 done by GPMC controller.
289
Tom Rinif6d26d82021-09-22 14:50:39 -0400290choice
291 prompt "ECC scheme"
292 default NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
293 help
294 On OMAP platforms, this CONFIG specifies NAND ECC scheme.
295 It can take following values:
296 OMAP_ECC_HAM1_CODE_SW
297 1-bit Hamming code using software lib.
298 (for legacy devices only)
299 OMAP_ECC_HAM1_CODE_HW
300 1-bit Hamming code using GPMC hardware.
301 (for legacy devices only)
302 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW
303 4-bit BCH code (unsupported)
304 OMAP_ECC_BCH4_CODE_HW
305 4-bit BCH code (unsupported)
306 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
307 8-bit BCH code with
308 - ecc calculation using GPMC hardware engine,
309 - error detection using software library.
310 - requires CONFIG_BCH to enable software BCH library
311 (For legacy device which do not have ELM h/w engine)
312 OMAP_ECC_BCH8_CODE_HW
313 8-bit BCH code with
314 - ecc calculation using GPMC hardware engine,
315 - error detection using ELM hardware engine.
316 OMAP_ECC_BCH16_CODE_HW
317 16-bit BCH code with
318 - ecc calculation using GPMC hardware engine,
319 - error detection using ELM hardware engine.
320
321 How to select ECC scheme on OMAP and AMxx platforms ?
322 -----------------------------------------------------
323 Though higher ECC schemes have more capability to detect and correct
324 bit-flips, but still selection of ECC scheme is dependent on following
325 - hardware engines present in SoC.
326 Some legacy OMAP SoC do not have ELM h/w engine thus such
327 SoC cannot support BCHx_HW ECC schemes.
328 - size of OOB/Spare region
329 With higher ECC schemes, more OOB/Spare area is required to
330 store ECC. So choice of ECC scheme is limited by NAND oobsize.
331
332 In general following expression can help:
333 NAND_OOBSIZE >= 2 + (NAND_PAGESIZE / 512) * ECC_BYTES
334 where
335 NAND_OOBSIZE = number of bytes available in
336 OOB/spare area per NAND page.
337 NAND_PAGESIZE = bytes in main-area of NAND page.
338 ECC_BYTES = number of ECC bytes generated to
339 protect 512 bytes of data, which is:
340 3 for HAM1_xx ecc schemes
341 7 for BCH4_xx ecc schemes
342 14 for BCH8_xx ecc schemes
343 26 for BCH16_xx ecc schemes
344
345 example to check for BCH16 on 2K page NAND
346 NAND_PAGESIZE = 2048
347 NAND_OOBSIZE = 64
348 2 + (2048 / 512) * 26 = 106 > NAND_OOBSIZE
349 Thus BCH16 cannot be supported on 2K page NAND.
350
351 However, for 4K pagesize NAND
352 NAND_PAGESIZE = 4096
353 NAND_OOBSIZE = 224
354 ECC_BYTES = 26
355 2 + (4096 / 512) * 26 = 210 < NAND_OOBSIZE
356 Thus BCH16 can be supported on 4K page NAND.
357
358config NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
359 bool "1-bit Hamming code using software lib"
360
361config NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
362 bool "1-bit Hamming code using GPMC hardware"
363
364config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
365 bool "8-bit BCH code with HW calculation SW error detection"
366
367config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
368 bool "8-bit BCH code with HW calculation and error detection"
369
370config NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
371 bool "16-bit BCH code with HW calculation and error detection"
372
373endchoice
374
375config NAND_OMAP_ECCSCHEME
376 int
377 default 1 if NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
378 default 2 if NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
379 default 5 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
380 default 6 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
381 default 7 if NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
382 help
383 This must be kept in sync with the enum in
384 include/linux/mtd/omap_gpmc.h
385
386endif
387
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200388config NAND_VF610_NFC
389 bool "Support for Freescale NFC for VF610"
390 select SYS_NAND_SELF_INIT
Stefan Agnerbd186142018-12-06 14:57:09 +0100391 select SYS_NAND_DRIVER_ECC_LAYOUT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200392 imply CMD_NAND
393 help
394 Enables support for NAND Flash Controller on some Freescale
395 processors like the VF610, MCF54418 or Kinetis K70.
396 The driver supports a maximum 2k page size. The driver
397 currently does not support hardware ECC.
398
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100399if NAND_VF610_NFC
400
401config NAND_VF610_NFC_DT
402 bool "Support Vybrid's vf610 NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200403 depends on OF_CONTROL && DM_MTD
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100404 help
405 Enable the driver for Vybrid's vf610 NAND flash on platforms
406 using device tree.
407
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200408choice
409 prompt "Hardware ECC strength"
410 depends on NAND_VF610_NFC
411 default SYS_NAND_VF610_NFC_45_ECC_BYTES
412 help
413 Select the ECC strength used in the hardware BCH ECC block.
414
415config SYS_NAND_VF610_NFC_45_ECC_BYTES
416 bool "24-error correction (45 ECC bytes)"
417
418config SYS_NAND_VF610_NFC_60_ECC_BYTES
419 bool "32-error correction (60 ECC bytes)"
420
421endchoice
422
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100423endif
424
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200425config NAND_PXA3XX
426 bool "Support for NAND on PXA3xx and Armada 370/XP/38x"
427 select SYS_NAND_SELF_INIT
Shmuel Hazan759349e2020-10-29 08:52:18 +0200428 select DM_MTD
Shmuel Hazan58983222020-10-29 08:52:20 +0200429 select REGMAP
430 select SYSCON
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200431 imply CMD_NAND
432 help
433 This enables the driver for the NAND flash device found on
434 PXA3xx processors (NFCv1) and also on Armada 370/XP (NFCv2).
435
436config NAND_SUNXI
437 bool "Support for NAND on Allwinner SoCs"
438 default ARCH_SUNXI
439 depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I
440 select SYS_NAND_SELF_INIT
441 select SYS_NAND_U_BOOT_LOCATIONS
442 select SPL_NAND_SUPPORT
Tom Rini98372452021-12-12 22:12:36 -0500443 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200444 imply CMD_NAND
445 ---help---
446 Enable support for NAND. This option enables the standard and
447 SPL drivers.
448 The SPL driver only supports reading from the NAND using DMA
449 transfers.
450
451if NAND_SUNXI
452
453config NAND_SUNXI_SPL_ECC_STRENGTH
454 int "Allwinner NAND SPL ECC Strength"
455 default 64
456
457config NAND_SUNXI_SPL_ECC_SIZE
458 int "Allwinner NAND SPL ECC Step Size"
459 default 1024
460
461config NAND_SUNXI_SPL_USABLE_PAGE_SIZE
462 int "Allwinner NAND SPL Usable Page Size"
463 default 1024
464
465endif
466
467config NAND_ARASAN
468 bool "Configure Arasan Nand"
469 select SYS_NAND_SELF_INIT
Michal Simekc5587832020-08-19 09:59:52 +0200470 depends on DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200471 imply CMD_NAND
472 help
473 This enables Nand driver support for Arasan nand flash
474 controller. This uses the hardware ECC for read and
475 write operations.
476
477config NAND_MXC
478 bool "MXC NAND support"
479 depends on CPU_ARM926EJS || CPU_ARM1136 || MX5
480 imply CMD_NAND
481 help
482 This enables the NAND driver for the NAND flash controller on the
Haolin Lie8df55b2021-07-18 10:13:39 +0800483 i.MX27 / i.MX31 / i.MX5 processors.
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200484
Tom Rini1ba2a002022-11-12 17:36:50 -0500485config SYS_NAND_SIZE
486 int "Size of NAND in kilobytes"
487 depends on NAND_MXC && SPL_NAND_SUPPORT
488 default 268435456
489
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200490config NAND_MXS
491 bool "MXS NAND support"
Peng Fan128abf42020-05-04 22:09:00 +0800492 depends on MX23 || MX28 || MX6 || MX7 || IMX8 || IMX8M
Tom Rini98372452021-12-12 22:12:36 -0500493 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200494 select SYS_NAND_SELF_INIT
495 imply CMD_NAND
496 select APBH_DMA
Peng Fan128abf42020-05-04 22:09:00 +0800497 select APBH_DMA_BURST if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
498 select APBH_DMA_BURST8 if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200499 help
500 This enables NAND driver for the NAND flash controller on the
501 MXS processors.
502
503if NAND_MXS
504
505config NAND_MXS_DT
506 bool "Support MXS NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200507 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200508 help
509 Enable the driver for MXS NAND flash on platforms using
510 device tree.
511
512config NAND_MXS_USE_MINIMUM_ECC
513 bool "Use minimum ECC strength supported by the controller"
514 default false
515
516endif
517
Zhengxun Li01551712021-09-14 13:43:51 +0800518config NAND_MXIC
519 bool "Macronix raw NAND controller"
520 select SYS_NAND_SELF_INIT
521 help
522 This selects the Macronix raw NAND controller driver.
523
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200524config NAND_ZYNQ
525 bool "Support for Zynq Nand controller"
Tom Rini98372452021-12-12 22:12:36 -0500526 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200527 select SYS_NAND_SELF_INIT
Ashok Reddy Somabb8448a2019-12-27 04:47:12 -0700528 select DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200529 imply CMD_NAND
530 help
531 This enables Nand driver support for Nand flash controller
532 found on Zynq SoC.
533
534config NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
535 bool "Enable use of 1st stage bootloader timing for NAND"
536 depends on NAND_ZYNQ
537 help
538 This flag prevent U-boot reconfigure NAND flash controller and reuse
539 the NAND timing from 1st stage bootloader.
540
Suneel Garapati9de7d2b2020-08-26 14:37:22 +0200541config NAND_OCTEONTX
542 bool "Support for OcteonTX NAND controller"
543 select SYS_NAND_SELF_INIT
544 imply CMD_NAND
545 help
546 This enables Nand flash controller hardware found on the OcteonTX
547 processors.
548
549config NAND_OCTEONTX_HW_ECC
550 bool "Support Hardware ECC for OcteonTX NAND controller"
551 depends on NAND_OCTEONTX
552 default y
553 help
554 This enables Hardware BCH engine found on the OcteonTX processors to
555 support ECC for NAND flash controller.
556
Christophe Kerelloda141682019-04-05 11:41:50 +0200557config NAND_STM32_FMC2
558 bool "Support for NAND controller on STM32MP SoCs"
559 depends on ARCH_STM32MP
560 select SYS_NAND_SELF_INIT
561 imply CMD_NAND
562 help
563 Enables support for NAND Flash chips on SoCs containing the FMC2
564 NAND controller. This controller is found on STM32MP SoCs.
565 The controller supports a maximum 8k page size and supports
566 a maximum 8-bit correction error per sector of 512 bytes.
567
Kate Liu41ccd2e2020-12-11 13:46:12 -0800568config CORTINA_NAND
569 bool "Support for NAND controller on Cortina-Access SoCs"
570 depends on CORTINA_PLATFORM
571 select SYS_NAND_SELF_INIT
572 select DM_MTD
573 imply CMD_NAND
574 help
575 Enables support for NAND Flash chips on Coartina-Access SoCs platform
576 This controller is found on Presidio/Venus SoCs.
577 The controller supports a maximum 8k page size and supports
578 a maximum 40-bit error correction per sector of 1024 bytes.
579
Yifeng Zhao9e9021e2021-06-07 16:40:29 +0800580config ROCKCHIP_NAND
581 bool "Support for NAND controller on Rockchip SoCs"
582 depends on ARCH_ROCKCHIP
583 select SYS_NAND_SELF_INIT
584 select DM_MTD
585 imply CMD_NAND
586 help
587 Enables support for NAND Flash chips on Rockchip SoCs platform.
588 This controller is found on Rockchip SoCs.
589 There are four different versions of NAND FLASH Controllers,
590 including:
591 NFC v600: RK2928, RK3066, RK3188
592 NFC v622: RK3036, RK3128
593 NFC v800: RK3308, RV1108
594 NFC v900: PX30, RK3326
595
Tom Rini8f37ac42021-12-12 22:12:35 -0500596config TEGRA_NAND
597 bool "Support for NAND controller on Tegra SoCs"
598 depends on ARCH_TEGRA
599 select SYS_NAND_SELF_INIT
600 imply CMD_NAND
601 help
602 Enables support for NAND Flash chips on Tegra SoCs platforms.
603
developer10a61df2022-05-20 11:23:47 +0800604config NAND_MT7621
605 bool "Support for MediaTek MT7621 NAND flash controller"
606 depends on SOC_MT7621
607 select SYS_NAND_SELF_INIT
608 select SPL_SYS_NAND_SELF_INIT
609 imply CMD_NAND
610 help
611 This enables NAND driver for the NAND flash controller on MediaTek
612 MT7621 platform.
613 The controller supports 4~12 bits correction per 512 bytes with a
614 maximum 4KB page size.
615
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200616comment "Generic NAND options"
617
618config SYS_NAND_BLOCK_SIZE
619 hex "NAND chip eraseblock size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400620 depends on ARCH_SUNXI || SPL_NAND_SUPPORT || TPL_NAND_SUPPORT
developer10a61df2022-05-20 11:23:47 +0800621 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && \
622 !NAND_FSL_IFC && !NAND_MT7621
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200623 help
624 Number of data bytes in one eraseblock for the NAND chip on the
625 board. This is the multiple of NAND_PAGE_SIZE and the number of
626 pages.
627
Tom Rinifdae0072021-09-22 14:50:34 -0400628config SYS_NAND_ONFI_DETECTION
629 bool "Enable detection of ONFI compliant devices during probe"
630 help
631 Enables detection of ONFI compliant devices during probe.
632 And fetching device parameters flashed on device, by parsing
633 ONFI parameter page.
634
Tom Rini2510a812021-09-22 14:50:30 -0400635config SYS_NAND_PAGE_COUNT
636 hex "NAND chip page count"
637 depends on SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC || \
638 SPL_NAND_AM33XX_BCH || SPL_NAND_LOAD || SPL_NAND_SIMPLE)
639 help
640 Number of pages in the NAND chip.
641
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200642config SYS_NAND_PAGE_SIZE
643 hex "NAND chip page size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400644 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
645 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
646 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
developer10a61df2022-05-20 11:23:47 +0800647 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && !NAND_MT7621
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200648 help
649 Number of data bytes in one page for the NAND chip on the
650 board, not including the OOB area.
651
652config SYS_NAND_OOBSIZE
653 hex "NAND chip OOB size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400654 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
655 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
656 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
Tom Rinid24700f2021-10-30 23:03:56 -0400657 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200658 help
659 Number of bytes in the Out-Of-Band area for the NAND chip on
660 the board.
661
662# Enhance depends when converting drivers to Kconfig which use this config
663# option (mxc_nand, ndfc, omap_gpmc).
664config SYS_NAND_BUSWIDTH_16BIT
665 bool "Use 16-bit NAND interface"
666 depends on NAND_VF610_NFC || NAND_OMAP_GPMC || NAND_MXC || ARCH_DAVINCI
667 help
668 Indicates that NAND device has 16-bit wide data-bus. In absence of this
669 config, bus-width of NAND device is assumed to be either 8-bit and later
670 determined by reading ONFI params.
671 Above config is useful when NAND device's bus-width information cannot
672 be determined from on-chip ONFI params, like in following scenarios:
673 - SPL boot does not support reading of ONFI parameters. This is done to
674 keep SPL code foot-print small.
675 - In current U-Boot flow using nand_init(), driver initialization
676 happens in board_nand_init() which is called before any device probe
677 (nand_scan_ident + nand_scan_tail), thus device's ONFI parameters are
678 not available while configuring controller. So a static CONFIG_NAND_xx
679 is needed to know the device's bus-width in advance.
680
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200681if SPL
682
Tom Rini8e6d9c72021-09-22 14:50:33 -0400683config SYS_NAND_5_ADDR_CYCLE
684 bool "Wait 5 address cycles during NAND commands"
685 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_SIMPLE || \
686 (SPL_NAND_SUPPORT && NAND_ATMEL)
687 default y
688 help
689 Some controllers require waiting for 5 address cycles when issuing
690 some commands, on NAND chips larger than 128MiB.
691
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400692choice
Tom Rinifdae0072021-09-22 14:50:34 -0400693 prompt "NAND bad block marker/indicator position in the OOB"
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400694 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_DENALI || SPL_NAND_SIMPLE || \
695 SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC)
696 default HAS_NAND_LARGE_BADBLOCK_POS
697 help
698 In the OOB, which position contains the badblock information.
699
700config HAS_NAND_LARGE_BADBLOCK_POS
701 bool "Set the bad block marker/indicator to the 'large' position"
702
703config HAS_NAND_SMALL_BADBLOCK_POS
704 bool "Set the bad block marker/indicator to the 'small' position"
705
706endchoice
707
708config SYS_NAND_BAD_BLOCK_POS
709 int
710 default 0 if HAS_NAND_LARGE_BADBLOCK_POS
711 default 5 if HAS_NAND_SMALL_BADBLOCK_POS
712
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200713config SYS_NAND_U_BOOT_LOCATIONS
714 bool "Define U-boot binaries locations in NAND"
715 help
716 Enable CONFIG_SYS_NAND_U_BOOT_OFFS though Kconfig.
717 This option should not be enabled when compiling U-boot for boards
718 defining CONFIG_SYS_NAND_U_BOOT_OFFS in their include/configs/<board>.h
719 file.
720
721config SYS_NAND_U_BOOT_OFFS
722 hex "Location in NAND to read U-Boot from"
723 default 0x800000 if NAND_SUNXI
724 depends on SYS_NAND_U_BOOT_LOCATIONS
725 help
726 Set the offset from the start of the nand where u-boot should be
727 loaded from.
728
729config SYS_NAND_U_BOOT_OFFS_REDUND
730 hex "Location in NAND to read U-Boot from"
731 default SYS_NAND_U_BOOT_OFFS
732 depends on SYS_NAND_U_BOOT_LOCATIONS
733 help
734 Set the offset from the start of the nand where the redundant u-boot
735 should be loaded from.
736
737config SPL_NAND_AM33XX_BCH
738 bool "Enables SPL-NAND driver which supports ELM based"
Tom Rini0a83cc22022-06-10 23:03:09 -0400739 depends on SPL_NAND_SUPPORT && NAND_OMAP_GPMC && !OMAP34XX
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200740 default y
741 help
742 Hardware ECC correction. This is useful for platforms which have ELM
743 hardware engine and use NAND boot mode.
744 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
745 so those platforms should use CONFIG_SPL_NAND_SIMPLE for enabling
746 SPL-NAND driver with software ECC correction support.
747
748config SPL_NAND_DENALI
749 bool "Support Denali NAND controller for SPL"
Tom Rini0a83cc22022-06-10 23:03:09 -0400750 depends on SPL_NAND_SUPPORT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200751 help
752 This is a small implementation of the Denali NAND controller
753 for use on SPL.
754
Masahiro Yamada64648cb2020-04-17 16:51:42 +0900755config NAND_DENALI_SPARE_AREA_SKIP_BYTES
756 int "Number of bytes skipped in OOB area"
757 depends on SPL_NAND_DENALI
758 range 0 63
759 help
760 This option specifies the number of bytes to skip from the beginning
761 of OOB area before last ECC sector data starts. This is potentially
762 used to preserve the bad block marker in the OOB area.
763
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200764config SPL_NAND_SIMPLE
765 bool "Use simple SPL NAND driver"
Tom Rini0a83cc22022-06-10 23:03:09 -0400766 depends on !SPL_NAND_AM33XX_BCH && SPL_NAND_SUPPORT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200767 help
768 Support for NAND boot using simple NAND drivers that
769 expose the cmd_ctrl() interface.
Tom Rini4251f7d2022-11-12 17:36:44 -0500770
771config SYS_NAND_HW_ECC_OOBFIRST
772 bool "In SPL, read the OOB first and then the data from NAND"
773 depends on SPL_NAND_SIMPLE
774
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200775endif
776
777endif # if NAND