blob: 49b7a4b04bb4e15b307d6721fde150beee97c3bc [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
Miquel Raynal1f1ae152018-08-16 17:30:07 +020044config NAND_ATMEL
45 bool "Support Atmel NAND controller"
Tom Rini98372452021-12-12 22:12:36 -050046 select SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +020047 imply SYS_NAND_USE_FLASH_BBT
48 help
49 Enable this driver for NAND flash platforms using an Atmel NAND
50 controller.
51
Derald D. Woods7830fc52018-12-15 01:36:46 -060052if NAND_ATMEL
53
54config ATMEL_NAND_HWECC
55 bool "Atmel Hardware ECC"
Derald D. Woods7830fc52018-12-15 01:36:46 -060056
57config ATMEL_NAND_HW_PMECC
58 bool "Atmel Programmable Multibit ECC (PMECC)"
59 select ATMEL_NAND_HWECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060060 help
61 The Programmable Multibit ECC (PMECC) controller is a programmable
62 binary BCH(Bose, Chaudhuri and Hocquenghem) encoder and decoder.
63
64config PMECC_CAP
65 int "PMECC Correctable ECC Bits"
66 depends on ATMEL_NAND_HW_PMECC
67 default 2
68 help
69 Correctable ECC bits, can be 2, 4, 8, 12, and 24.
70
71config PMECC_SECTOR_SIZE
72 int "PMECC Sector Size"
73 depends on ATMEL_NAND_HW_PMECC
74 default 512
75 help
76 Sector size, in bytes, can be 512 or 1024.
77
78config SPL_GENERATE_ATMEL_PMECC_HEADER
79 bool "Atmel PMECC Header Generation"
Tom Rini0a83cc22022-06-10 23:03:09 -040080 depends on SPL
Derald D. Woods7830fc52018-12-15 01:36:46 -060081 select ATMEL_NAND_HWECC
82 select ATMEL_NAND_HW_PMECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060083 help
84 Generate Programmable Multibit ECC (PMECC) header for SPL image.
85
Tom Rini70aa87d2022-11-12 17:36:42 -050086choice
87 prompt "NAND bus width (bits)"
88 default SYS_NAND_DBW_8
89
90config SYS_NAND_DBW_8
91 bool "NAND bus width is 8 bits"
92
93config SYS_NAND_DBW_16
94 bool "NAND bus width is 16 bits"
95
96endchoice
97
Derald D. Woods7830fc52018-12-15 01:36:46 -060098endif
99
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100100config NAND_BRCMNAND
101 bool "Support Broadcom NAND controller"
Miquel Raynala903be42019-10-03 19:50:04 +0200102 depends on OF_CONTROL && DM && DM_MTD
Tom Rini98372452021-12-12 22:12:36 -0500103 select SYS_NAND_SELF_INIT
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100104 help
105 Enable the driver for NAND flash on platforms using a Broadcom NAND
106 controller.
107
Álvaro Fernández Rojasd9f9bfc2019-08-28 19:12:15 +0200108config NAND_BRCMNAND_6368
109 bool "Support Broadcom NAND controller on bcm6368"
110 depends on NAND_BRCMNAND && ARCH_BMIPS
111 help
112 Enable support for broadcom nand driver on bcm6368.
113
Philippe Reynese175c322022-02-11 19:18:36 +0100114config NAND_BRCMNAND_6753
115 bool "Support Broadcom NAND controller on bcm6753"
William Zhang38921822022-08-22 11:49:08 -0700116 depends on NAND_BRCMNAND && BCM6855
Philippe Reynese175c322022-02-11 19:18:36 +0100117 help
118 Enable support for broadcom nand driver on bcm6753.
119
Philippe Reynes74ead742020-01-07 20:14:13 +0100120config NAND_BRCMNAND_68360
121 bool "Support Broadcom NAND controller on bcm68360"
William Zhangdf0b5bb2022-08-22 11:31:43 -0700122 depends on NAND_BRCMNAND && BCM6856
Philippe Reynes74ead742020-01-07 20:14:13 +0100123 help
124 Enable support for broadcom nand driver on bcm68360.
125
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100126config NAND_BRCMNAND_6838
127 bool "Support Broadcom NAND controller on bcm6838"
128 depends on NAND_BRCMNAND && ARCH_BMIPS && SOC_BMIPS_BCM6838
129 help
130 Enable support for broadcom nand driver on bcm6838.
131
132config NAND_BRCMNAND_6858
133 bool "Support Broadcom NAND controller on bcm6858"
William Zhang6b45fa62022-08-22 11:39:45 -0700134 depends on NAND_BRCMNAND && BCM6858
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100135 help
136 Enable support for broadcom nand driver on bcm6858.
137
138config NAND_BRCMNAND_63158
139 bool "Support Broadcom NAND controller on bcm63158"
William Zhang35a3ec1b2022-08-22 11:19:46 -0700140 depends on NAND_BRCMNAND && BCM63158
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100141 help
142 Enable support for broadcom nand driver on bcm63158.
143
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200144config NAND_DAVINCI
145 bool "Support TI Davinci NAND controller"
Tom Rini98372452021-12-12 22:12:36 -0500146 select SYS_NAND_SELF_INIT if TARGET_DA850EVM
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200147 help
148 Enable this driver for NAND flash controllers available in TI Davinci
149 and Keystone2 platforms
150
Tom Rini7f750f82022-10-28 20:27:11 -0400151config SYS_NAND_4BIT_HW_ECC_OOBFIRST
152 bool "Use 4-bit HW ECC with OOB at the front"
153 depends on NAND_DAVINCI
154
Tom Rinidada0e32021-09-12 20:32:24 -0400155config KEYSTONE_RBL_NAND
156 depends on ARCH_KEYSTONE
157 def_bool y
158
Tom Rinifae1dab2021-09-22 14:50:29 -0400159config SPL_NAND_LOAD
160 def_bool y
161 depends on NAND_DAVINCI && ARCH_DAVINCI && SPL_NAND_SUPPORT
162
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200163config NAND_DENALI
164 bool
165 select SYS_NAND_SELF_INIT
166 imply CMD_NAND
167
168config NAND_DENALI_DT
169 bool "Support Denali NAND controller as a DT device"
170 select NAND_DENALI
Masahiro Yamada8fc53822020-01-30 22:07:59 +0900171 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200172 help
173 Enable the driver for NAND flash on platforms using a Denali NAND
174 controller as a DT device.
175
Tom Rinia73788c2021-09-22 14:50:37 -0400176config NAND_FSL_ELBC
177 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500178 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
179 select SPL_SYS_NAND_SELF_INIT
180 select SYS_NAND_SELF_INIT
Tom Rinia73788c2021-09-22 14:50:37 -0400181 depends on FSL_ELBC
182 help
183 Enable the Freescale Enhanced Local Bus Controller FCM NAND driver.
184
Pali Rohárbb834db2022-04-04 18:17:19 +0200185config NAND_FSL_ELBC_DT
186 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver (DT mode)"
187 depends on NAND_FSL_ELBC
188
Tom Rinia73788c2021-09-22 14:50:37 -0400189config NAND_FSL_IFC
190 bool "Support Freescale Integrated Flash Controller NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500191 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
Tom Rini1a9f23d2022-05-26 14:31:57 -0400192 select TPL_NAND_INIT if TPL && !TPL_FRAMEWORK
Tom Rini98372452021-12-12 22:12:36 -0500193 select SPL_SYS_NAND_SELF_INIT
194 select SYS_NAND_SELF_INIT
Tom Rini05b419e2021-12-11 14:55:49 -0500195 select FSL_IFC
Tom Rinia73788c2021-09-22 14:50:37 -0400196 help
197 Enable the Freescale Integrated Flash Controller NAND driver.
198
Tom Rini08204272021-09-22 14:50:28 -0400199config NAND_LPC32XX_MLC
200 bool "Support LPC32XX_MLC controller"
Tom Rini98372452021-12-12 22:12:36 -0500201 select SYS_NAND_SELF_INIT
Tom Rini08204272021-09-22 14:50:28 -0400202 help
203 Enable the LPC32XX MLC NAND controller.
204
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200205config NAND_LPC32XX_SLC
206 bool "Support LPC32XX_SLC controller"
207 help
208 Enable the LPC32XX SLC NAND controller.
209
210config NAND_OMAP_GPMC
211 bool "Support OMAP GPMC NAND controller"
212 depends on ARCH_OMAP2PLUS
213 help
214 Enables omap_gpmc.c driver for OMAPx and AMxxxx platforms.
215 GPMC controller is used for parallel NAND flash devices, and can
216 do ECC calculation (not ECC error detection) for HAM1, BCH4, BCH8
217 and BCH16 ECC algorithms.
218
Tom Rinif6d26d82021-09-22 14:50:39 -0400219if NAND_OMAP_GPMC
220
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200221config NAND_OMAP_GPMC_PREFETCH
222 bool "Enable GPMC Prefetch"
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200223 default y
224 help
225 On OMAP platforms that use the GPMC controller
226 (CONFIG_NAND_OMAP_GPMC_PREFETCH), this options enables the code that
227 uses the prefetch mode to speed up read operations.
228
229config NAND_OMAP_ELM
230 bool "Enable ELM driver for OMAPxx and AMxx platforms."
Tom Rinif6d26d82021-09-22 14:50:39 -0400231 depends on !OMAP34XX
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200232 help
233 ELM controller is used for ECC error detection (not ECC calculation)
234 of BCH4, BCH8 and BCH16 ECC algorithms.
235 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
236 thus such SoC platforms need to depend on software library for ECC error
237 detection. However ECC calculation on such plaforms would still be
238 done by GPMC controller.
239
Tom Rinif6d26d82021-09-22 14:50:39 -0400240choice
241 prompt "ECC scheme"
242 default NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
243 help
244 On OMAP platforms, this CONFIG specifies NAND ECC scheme.
245 It can take following values:
246 OMAP_ECC_HAM1_CODE_SW
247 1-bit Hamming code using software lib.
248 (for legacy devices only)
249 OMAP_ECC_HAM1_CODE_HW
250 1-bit Hamming code using GPMC hardware.
251 (for legacy devices only)
252 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW
253 4-bit BCH code (unsupported)
254 OMAP_ECC_BCH4_CODE_HW
255 4-bit BCH code (unsupported)
256 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
257 8-bit BCH code with
258 - ecc calculation using GPMC hardware engine,
259 - error detection using software library.
260 - requires CONFIG_BCH to enable software BCH library
261 (For legacy device which do not have ELM h/w engine)
262 OMAP_ECC_BCH8_CODE_HW
263 8-bit BCH code with
264 - ecc calculation using GPMC hardware engine,
265 - error detection using ELM hardware engine.
266 OMAP_ECC_BCH16_CODE_HW
267 16-bit BCH code with
268 - ecc calculation using GPMC hardware engine,
269 - error detection using ELM hardware engine.
270
271 How to select ECC scheme on OMAP and AMxx platforms ?
272 -----------------------------------------------------
273 Though higher ECC schemes have more capability to detect and correct
274 bit-flips, but still selection of ECC scheme is dependent on following
275 - hardware engines present in SoC.
276 Some legacy OMAP SoC do not have ELM h/w engine thus such
277 SoC cannot support BCHx_HW ECC schemes.
278 - size of OOB/Spare region
279 With higher ECC schemes, more OOB/Spare area is required to
280 store ECC. So choice of ECC scheme is limited by NAND oobsize.
281
282 In general following expression can help:
283 NAND_OOBSIZE >= 2 + (NAND_PAGESIZE / 512) * ECC_BYTES
284 where
285 NAND_OOBSIZE = number of bytes available in
286 OOB/spare area per NAND page.
287 NAND_PAGESIZE = bytes in main-area of NAND page.
288 ECC_BYTES = number of ECC bytes generated to
289 protect 512 bytes of data, which is:
290 3 for HAM1_xx ecc schemes
291 7 for BCH4_xx ecc schemes
292 14 for BCH8_xx ecc schemes
293 26 for BCH16_xx ecc schemes
294
295 example to check for BCH16 on 2K page NAND
296 NAND_PAGESIZE = 2048
297 NAND_OOBSIZE = 64
298 2 + (2048 / 512) * 26 = 106 > NAND_OOBSIZE
299 Thus BCH16 cannot be supported on 2K page NAND.
300
301 However, for 4K pagesize NAND
302 NAND_PAGESIZE = 4096
303 NAND_OOBSIZE = 224
304 ECC_BYTES = 26
305 2 + (4096 / 512) * 26 = 210 < NAND_OOBSIZE
306 Thus BCH16 can be supported on 4K page NAND.
307
308config NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
309 bool "1-bit Hamming code using software lib"
310
311config NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
312 bool "1-bit Hamming code using GPMC hardware"
313
314config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
315 bool "8-bit BCH code with HW calculation SW error detection"
316
317config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
318 bool "8-bit BCH code with HW calculation and error detection"
319
320config NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
321 bool "16-bit BCH code with HW calculation and error detection"
322
323endchoice
324
325config NAND_OMAP_ECCSCHEME
326 int
327 default 1 if NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
328 default 2 if NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
329 default 5 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
330 default 6 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
331 default 7 if NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
332 help
333 This must be kept in sync with the enum in
334 include/linux/mtd/omap_gpmc.h
335
336endif
337
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200338config NAND_VF610_NFC
339 bool "Support for Freescale NFC for VF610"
340 select SYS_NAND_SELF_INIT
Stefan Agnerbd186142018-12-06 14:57:09 +0100341 select SYS_NAND_DRIVER_ECC_LAYOUT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200342 imply CMD_NAND
343 help
344 Enables support for NAND Flash Controller on some Freescale
345 processors like the VF610, MCF54418 or Kinetis K70.
346 The driver supports a maximum 2k page size. The driver
347 currently does not support hardware ECC.
348
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100349if NAND_VF610_NFC
350
351config NAND_VF610_NFC_DT
352 bool "Support Vybrid's vf610 NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200353 depends on OF_CONTROL && DM_MTD
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100354 help
355 Enable the driver for Vybrid's vf610 NAND flash on platforms
356 using device tree.
357
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200358choice
359 prompt "Hardware ECC strength"
360 depends on NAND_VF610_NFC
361 default SYS_NAND_VF610_NFC_45_ECC_BYTES
362 help
363 Select the ECC strength used in the hardware BCH ECC block.
364
365config SYS_NAND_VF610_NFC_45_ECC_BYTES
366 bool "24-error correction (45 ECC bytes)"
367
368config SYS_NAND_VF610_NFC_60_ECC_BYTES
369 bool "32-error correction (60 ECC bytes)"
370
371endchoice
372
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100373endif
374
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200375config NAND_PXA3XX
376 bool "Support for NAND on PXA3xx and Armada 370/XP/38x"
377 select SYS_NAND_SELF_INIT
Shmuel Hazan759349e2020-10-29 08:52:18 +0200378 select DM_MTD
Shmuel Hazan58983222020-10-29 08:52:20 +0200379 select REGMAP
380 select SYSCON
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200381 imply CMD_NAND
382 help
383 This enables the driver for the NAND flash device found on
384 PXA3xx processors (NFCv1) and also on Armada 370/XP (NFCv2).
385
386config NAND_SUNXI
387 bool "Support for NAND on Allwinner SoCs"
388 default ARCH_SUNXI
389 depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I
390 select SYS_NAND_SELF_INIT
391 select SYS_NAND_U_BOOT_LOCATIONS
392 select SPL_NAND_SUPPORT
Tom Rini98372452021-12-12 22:12:36 -0500393 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200394 imply CMD_NAND
395 ---help---
396 Enable support for NAND. This option enables the standard and
397 SPL drivers.
398 The SPL driver only supports reading from the NAND using DMA
399 transfers.
400
401if NAND_SUNXI
402
403config NAND_SUNXI_SPL_ECC_STRENGTH
404 int "Allwinner NAND SPL ECC Strength"
405 default 64
406
407config NAND_SUNXI_SPL_ECC_SIZE
408 int "Allwinner NAND SPL ECC Step Size"
409 default 1024
410
411config NAND_SUNXI_SPL_USABLE_PAGE_SIZE
412 int "Allwinner NAND SPL Usable Page Size"
413 default 1024
414
415endif
416
417config NAND_ARASAN
418 bool "Configure Arasan Nand"
419 select SYS_NAND_SELF_INIT
Michal Simekc5587832020-08-19 09:59:52 +0200420 depends on DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200421 imply CMD_NAND
422 help
423 This enables Nand driver support for Arasan nand flash
424 controller. This uses the hardware ECC for read and
425 write operations.
426
427config NAND_MXC
428 bool "MXC NAND support"
429 depends on CPU_ARM926EJS || CPU_ARM1136 || MX5
430 imply CMD_NAND
431 help
432 This enables the NAND driver for the NAND flash controller on the
Haolin Lie8df55b2021-07-18 10:13:39 +0800433 i.MX27 / i.MX31 / i.MX5 processors.
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200434
435config NAND_MXS
436 bool "MXS NAND support"
Peng Fan128abf42020-05-04 22:09:00 +0800437 depends on MX23 || MX28 || MX6 || MX7 || IMX8 || IMX8M
Tom Rini98372452021-12-12 22:12:36 -0500438 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200439 select SYS_NAND_SELF_INIT
440 imply CMD_NAND
441 select APBH_DMA
Peng Fan128abf42020-05-04 22:09:00 +0800442 select APBH_DMA_BURST if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
443 select APBH_DMA_BURST8 if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200444 help
445 This enables NAND driver for the NAND flash controller on the
446 MXS processors.
447
448if NAND_MXS
449
450config NAND_MXS_DT
451 bool "Support MXS NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200452 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200453 help
454 Enable the driver for MXS NAND flash on platforms using
455 device tree.
456
457config NAND_MXS_USE_MINIMUM_ECC
458 bool "Use minimum ECC strength supported by the controller"
459 default false
460
461endif
462
Zhengxun Li01551712021-09-14 13:43:51 +0800463config NAND_MXIC
464 bool "Macronix raw NAND controller"
465 select SYS_NAND_SELF_INIT
466 help
467 This selects the Macronix raw NAND controller driver.
468
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200469config NAND_ZYNQ
470 bool "Support for Zynq Nand controller"
Tom Rini98372452021-12-12 22:12:36 -0500471 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200472 select SYS_NAND_SELF_INIT
Ashok Reddy Somabb8448a2019-12-27 04:47:12 -0700473 select DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200474 imply CMD_NAND
475 help
476 This enables Nand driver support for Nand flash controller
477 found on Zynq SoC.
478
479config NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
480 bool "Enable use of 1st stage bootloader timing for NAND"
481 depends on NAND_ZYNQ
482 help
483 This flag prevent U-boot reconfigure NAND flash controller and reuse
484 the NAND timing from 1st stage bootloader.
485
Suneel Garapati9de7d2b2020-08-26 14:37:22 +0200486config NAND_OCTEONTX
487 bool "Support for OcteonTX NAND controller"
488 select SYS_NAND_SELF_INIT
489 imply CMD_NAND
490 help
491 This enables Nand flash controller hardware found on the OcteonTX
492 processors.
493
494config NAND_OCTEONTX_HW_ECC
495 bool "Support Hardware ECC for OcteonTX NAND controller"
496 depends on NAND_OCTEONTX
497 default y
498 help
499 This enables Hardware BCH engine found on the OcteonTX processors to
500 support ECC for NAND flash controller.
501
Christophe Kerelloda141682019-04-05 11:41:50 +0200502config NAND_STM32_FMC2
503 bool "Support for NAND controller on STM32MP SoCs"
504 depends on ARCH_STM32MP
505 select SYS_NAND_SELF_INIT
506 imply CMD_NAND
507 help
508 Enables support for NAND Flash chips on SoCs containing the FMC2
509 NAND controller. This controller is found on STM32MP SoCs.
510 The controller supports a maximum 8k page size and supports
511 a maximum 8-bit correction error per sector of 512 bytes.
512
Kate Liu41ccd2e2020-12-11 13:46:12 -0800513config CORTINA_NAND
514 bool "Support for NAND controller on Cortina-Access SoCs"
515 depends on CORTINA_PLATFORM
516 select SYS_NAND_SELF_INIT
517 select DM_MTD
518 imply CMD_NAND
519 help
520 Enables support for NAND Flash chips on Coartina-Access SoCs platform
521 This controller is found on Presidio/Venus SoCs.
522 The controller supports a maximum 8k page size and supports
523 a maximum 40-bit error correction per sector of 1024 bytes.
524
Yifeng Zhao9e9021e2021-06-07 16:40:29 +0800525config ROCKCHIP_NAND
526 bool "Support for NAND controller on Rockchip SoCs"
527 depends on ARCH_ROCKCHIP
528 select SYS_NAND_SELF_INIT
529 select DM_MTD
530 imply CMD_NAND
531 help
532 Enables support for NAND Flash chips on Rockchip SoCs platform.
533 This controller is found on Rockchip SoCs.
534 There are four different versions of NAND FLASH Controllers,
535 including:
536 NFC v600: RK2928, RK3066, RK3188
537 NFC v622: RK3036, RK3128
538 NFC v800: RK3308, RV1108
539 NFC v900: PX30, RK3326
540
Tom Rini8f37ac42021-12-12 22:12:35 -0500541config TEGRA_NAND
542 bool "Support for NAND controller on Tegra SoCs"
543 depends on ARCH_TEGRA
544 select SYS_NAND_SELF_INIT
545 imply CMD_NAND
546 help
547 Enables support for NAND Flash chips on Tegra SoCs platforms.
548
developer10a61df2022-05-20 11:23:47 +0800549config NAND_MT7621
550 bool "Support for MediaTek MT7621 NAND flash controller"
551 depends on SOC_MT7621
552 select SYS_NAND_SELF_INIT
553 select SPL_SYS_NAND_SELF_INIT
554 imply CMD_NAND
555 help
556 This enables NAND driver for the NAND flash controller on MediaTek
557 MT7621 platform.
558 The controller supports 4~12 bits correction per 512 bytes with a
559 maximum 4KB page size.
560
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200561comment "Generic NAND options"
562
563config SYS_NAND_BLOCK_SIZE
564 hex "NAND chip eraseblock size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400565 depends on ARCH_SUNXI || SPL_NAND_SUPPORT || TPL_NAND_SUPPORT
developer10a61df2022-05-20 11:23:47 +0800566 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && \
567 !NAND_FSL_IFC && !NAND_MT7621
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200568 help
569 Number of data bytes in one eraseblock for the NAND chip on the
570 board. This is the multiple of NAND_PAGE_SIZE and the number of
571 pages.
572
Tom Rinifdae0072021-09-22 14:50:34 -0400573config SYS_NAND_ONFI_DETECTION
574 bool "Enable detection of ONFI compliant devices during probe"
575 help
576 Enables detection of ONFI compliant devices during probe.
577 And fetching device parameters flashed on device, by parsing
578 ONFI parameter page.
579
Tom Rini2510a812021-09-22 14:50:30 -0400580config SYS_NAND_PAGE_COUNT
581 hex "NAND chip page count"
582 depends on SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC || \
583 SPL_NAND_AM33XX_BCH || SPL_NAND_LOAD || SPL_NAND_SIMPLE)
584 help
585 Number of pages in the NAND chip.
586
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200587config SYS_NAND_PAGE_SIZE
588 hex "NAND chip page size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400589 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
590 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
591 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
developer10a61df2022-05-20 11:23:47 +0800592 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && !NAND_MT7621
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200593 help
594 Number of data bytes in one page for the NAND chip on the
595 board, not including the OOB area.
596
597config SYS_NAND_OOBSIZE
598 hex "NAND chip OOB size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400599 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
600 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
601 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
Tom Rinid24700f2021-10-30 23:03:56 -0400602 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200603 help
604 Number of bytes in the Out-Of-Band area for the NAND chip on
605 the board.
606
607# Enhance depends when converting drivers to Kconfig which use this config
608# option (mxc_nand, ndfc, omap_gpmc).
609config SYS_NAND_BUSWIDTH_16BIT
610 bool "Use 16-bit NAND interface"
611 depends on NAND_VF610_NFC || NAND_OMAP_GPMC || NAND_MXC || ARCH_DAVINCI
612 help
613 Indicates that NAND device has 16-bit wide data-bus. In absence of this
614 config, bus-width of NAND device is assumed to be either 8-bit and later
615 determined by reading ONFI params.
616 Above config is useful when NAND device's bus-width information cannot
617 be determined from on-chip ONFI params, like in following scenarios:
618 - SPL boot does not support reading of ONFI parameters. This is done to
619 keep SPL code foot-print small.
620 - In current U-Boot flow using nand_init(), driver initialization
621 happens in board_nand_init() which is called before any device probe
622 (nand_scan_ident + nand_scan_tail), thus device's ONFI parameters are
623 not available while configuring controller. So a static CONFIG_NAND_xx
624 is needed to know the device's bus-width in advance.
625
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200626if SPL
627
Tom Rini8e6d9c72021-09-22 14:50:33 -0400628config SYS_NAND_5_ADDR_CYCLE
629 bool "Wait 5 address cycles during NAND commands"
630 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_SIMPLE || \
631 (SPL_NAND_SUPPORT && NAND_ATMEL)
632 default y
633 help
634 Some controllers require waiting for 5 address cycles when issuing
635 some commands, on NAND chips larger than 128MiB.
636
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400637choice
Tom Rinifdae0072021-09-22 14:50:34 -0400638 prompt "NAND bad block marker/indicator position in the OOB"
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400639 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_DENALI || SPL_NAND_SIMPLE || \
640 SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC)
641 default HAS_NAND_LARGE_BADBLOCK_POS
642 help
643 In the OOB, which position contains the badblock information.
644
645config HAS_NAND_LARGE_BADBLOCK_POS
646 bool "Set the bad block marker/indicator to the 'large' position"
647
648config HAS_NAND_SMALL_BADBLOCK_POS
649 bool "Set the bad block marker/indicator to the 'small' position"
650
651endchoice
652
653config SYS_NAND_BAD_BLOCK_POS
654 int
655 default 0 if HAS_NAND_LARGE_BADBLOCK_POS
656 default 5 if HAS_NAND_SMALL_BADBLOCK_POS
657
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200658config SYS_NAND_U_BOOT_LOCATIONS
659 bool "Define U-boot binaries locations in NAND"
660 help
661 Enable CONFIG_SYS_NAND_U_BOOT_OFFS though Kconfig.
662 This option should not be enabled when compiling U-boot for boards
663 defining CONFIG_SYS_NAND_U_BOOT_OFFS in their include/configs/<board>.h
664 file.
665
666config SYS_NAND_U_BOOT_OFFS
667 hex "Location in NAND to read U-Boot from"
668 default 0x800000 if NAND_SUNXI
669 depends on SYS_NAND_U_BOOT_LOCATIONS
670 help
671 Set the offset from the start of the nand where u-boot should be
672 loaded from.
673
674config SYS_NAND_U_BOOT_OFFS_REDUND
675 hex "Location in NAND to read U-Boot from"
676 default SYS_NAND_U_BOOT_OFFS
677 depends on SYS_NAND_U_BOOT_LOCATIONS
678 help
679 Set the offset from the start of the nand where the redundant u-boot
680 should be loaded from.
681
682config SPL_NAND_AM33XX_BCH
683 bool "Enables SPL-NAND driver which supports ELM based"
Tom Rini0a83cc22022-06-10 23:03:09 -0400684 depends on SPL_NAND_SUPPORT && NAND_OMAP_GPMC && !OMAP34XX
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200685 default y
686 help
687 Hardware ECC correction. This is useful for platforms which have ELM
688 hardware engine and use NAND boot mode.
689 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
690 so those platforms should use CONFIG_SPL_NAND_SIMPLE for enabling
691 SPL-NAND driver with software ECC correction support.
692
693config SPL_NAND_DENALI
694 bool "Support Denali NAND controller for SPL"
Tom Rini0a83cc22022-06-10 23:03:09 -0400695 depends on SPL_NAND_SUPPORT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200696 help
697 This is a small implementation of the Denali NAND controller
698 for use on SPL.
699
Masahiro Yamada64648cb2020-04-17 16:51:42 +0900700config NAND_DENALI_SPARE_AREA_SKIP_BYTES
701 int "Number of bytes skipped in OOB area"
702 depends on SPL_NAND_DENALI
703 range 0 63
704 help
705 This option specifies the number of bytes to skip from the beginning
706 of OOB area before last ECC sector data starts. This is potentially
707 used to preserve the bad block marker in the OOB area.
708
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200709config SPL_NAND_SIMPLE
710 bool "Use simple SPL NAND driver"
Tom Rini0a83cc22022-06-10 23:03:09 -0400711 depends on !SPL_NAND_AM33XX_BCH && SPL_NAND_SUPPORT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200712 help
713 Support for NAND boot using simple NAND drivers that
714 expose the cmd_ctrl() interface.
Tom Rini4251f7d2022-11-12 17:36:44 -0500715
716config SYS_NAND_HW_ECC_OOBFIRST
717 bool "In SPL, read the OOB first and then the data from NAND"
718 depends on SPL_NAND_SIMPLE
719
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200720endif
721
722endif # if NAND