blob: 3585031ddfa88f9ff08191c40e5373cca3736fd3 [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
Miquel Raynal1f1ae152018-08-16 17:30:07 +020048config NAND_ATMEL
49 bool "Support Atmel NAND controller"
Tom Rini98372452021-12-12 22:12:36 -050050 select SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +020051 imply SYS_NAND_USE_FLASH_BBT
52 help
53 Enable this driver for NAND flash platforms using an Atmel NAND
54 controller.
55
Derald D. Woods7830fc52018-12-15 01:36:46 -060056if NAND_ATMEL
57
58config ATMEL_NAND_HWECC
59 bool "Atmel Hardware ECC"
Derald D. Woods7830fc52018-12-15 01:36:46 -060060
61config ATMEL_NAND_HW_PMECC
62 bool "Atmel Programmable Multibit ECC (PMECC)"
63 select ATMEL_NAND_HWECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060064 help
65 The Programmable Multibit ECC (PMECC) controller is a programmable
66 binary BCH(Bose, Chaudhuri and Hocquenghem) encoder and decoder.
67
68config PMECC_CAP
69 int "PMECC Correctable ECC Bits"
70 depends on ATMEL_NAND_HW_PMECC
71 default 2
72 help
73 Correctable ECC bits, can be 2, 4, 8, 12, and 24.
74
75config PMECC_SECTOR_SIZE
76 int "PMECC Sector Size"
77 depends on ATMEL_NAND_HW_PMECC
78 default 512
79 help
80 Sector size, in bytes, can be 512 or 1024.
81
82config SPL_GENERATE_ATMEL_PMECC_HEADER
83 bool "Atmel PMECC Header Generation"
Tom Rini0a83cc22022-06-10 23:03:09 -040084 depends on SPL
Derald D. Woods7830fc52018-12-15 01:36:46 -060085 select ATMEL_NAND_HWECC
86 select ATMEL_NAND_HW_PMECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060087 help
88 Generate Programmable Multibit ECC (PMECC) header for SPL image.
89
Tom Rini70aa87d2022-11-12 17:36:42 -050090choice
91 prompt "NAND bus width (bits)"
92 default SYS_NAND_DBW_8
93
94config SYS_NAND_DBW_8
95 bool "NAND bus width is 8 bits"
96
97config SYS_NAND_DBW_16
98 bool "NAND bus width is 16 bits"
99
100endchoice
101
Derald D. Woods7830fc52018-12-15 01:36:46 -0600102endif
103
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100104config NAND_BRCMNAND
105 bool "Support Broadcom NAND controller"
Miquel Raynala903be42019-10-03 19:50:04 +0200106 depends on OF_CONTROL && DM && DM_MTD
Tom Rini98372452021-12-12 22:12:36 -0500107 select SYS_NAND_SELF_INIT
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100108 help
109 Enable the driver for NAND flash on platforms using a Broadcom NAND
110 controller.
111
Álvaro Fernández Rojasd9f9bfc2019-08-28 19:12:15 +0200112config NAND_BRCMNAND_6368
113 bool "Support Broadcom NAND controller on bcm6368"
114 depends on NAND_BRCMNAND && ARCH_BMIPS
115 help
116 Enable support for broadcom nand driver on bcm6368.
117
Philippe Reynese175c322022-02-11 19:18:36 +0100118config NAND_BRCMNAND_6753
119 bool "Support Broadcom NAND controller on bcm6753"
William Zhang38921822022-08-22 11:49:08 -0700120 depends on NAND_BRCMNAND && BCM6855
Philippe Reynese175c322022-02-11 19:18:36 +0100121 help
122 Enable support for broadcom nand driver on bcm6753.
123
Philippe Reynes74ead742020-01-07 20:14:13 +0100124config NAND_BRCMNAND_68360
125 bool "Support Broadcom NAND controller on bcm68360"
William Zhangdf0b5bb2022-08-22 11:31:43 -0700126 depends on NAND_BRCMNAND && BCM6856
Philippe Reynes74ead742020-01-07 20:14:13 +0100127 help
128 Enable support for broadcom nand driver on bcm68360.
129
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100130config NAND_BRCMNAND_6838
131 bool "Support Broadcom NAND controller on bcm6838"
132 depends on NAND_BRCMNAND && ARCH_BMIPS && SOC_BMIPS_BCM6838
133 help
134 Enable support for broadcom nand driver on bcm6838.
135
136config NAND_BRCMNAND_6858
137 bool "Support Broadcom NAND controller on bcm6858"
William Zhang6b45fa62022-08-22 11:39:45 -0700138 depends on NAND_BRCMNAND && BCM6858
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100139 help
140 Enable support for broadcom nand driver on bcm6858.
141
142config NAND_BRCMNAND_63158
143 bool "Support Broadcom NAND controller on bcm63158"
William Zhang35a3ec1b2022-08-22 11:19:46 -0700144 depends on NAND_BRCMNAND && BCM63158
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100145 help
146 Enable support for broadcom nand driver on bcm63158.
147
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200148config NAND_DAVINCI
149 bool "Support TI Davinci NAND controller"
Tom Rini98372452021-12-12 22:12:36 -0500150 select SYS_NAND_SELF_INIT if TARGET_DA850EVM
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200151 help
152 Enable this driver for NAND flash controllers available in TI Davinci
153 and Keystone2 platforms
154
Tom Rinid1286e12022-11-12 17:36:45 -0500155choice
156 prompt "Type of ECC used on NAND"
157 default SYS_NAND_4BIT_HW_ECC_OOBFIRST
158 depends on NAND_DAVINCI
159
160config SYS_NAND_HW_ECC
161 bool "Use 1-bit HW ECC"
162
Tom Rini7f750f82022-10-28 20:27:11 -0400163config SYS_NAND_4BIT_HW_ECC_OOBFIRST
164 bool "Use 4-bit HW ECC with OOB at the front"
Tom Rinid1286e12022-11-12 17:36:45 -0500165
166config SYS_NAND_SOFT_ECC
167 bool "Use software ECC"
168
169endchoice
Tom Rini7f750f82022-10-28 20:27:11 -0400170
Tom Rinidada0e32021-09-12 20:32:24 -0400171config KEYSTONE_RBL_NAND
172 depends on ARCH_KEYSTONE
173 def_bool y
174
Tom Rinifae1dab2021-09-22 14:50:29 -0400175config SPL_NAND_LOAD
176 def_bool y
177 depends on NAND_DAVINCI && ARCH_DAVINCI && SPL_NAND_SUPPORT
178
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200179config NAND_DENALI
180 bool
181 select SYS_NAND_SELF_INIT
182 imply CMD_NAND
183
184config NAND_DENALI_DT
185 bool "Support Denali NAND controller as a DT device"
186 select NAND_DENALI
Masahiro Yamada8fc53822020-01-30 22:07:59 +0900187 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200188 help
189 Enable the driver for NAND flash on platforms using a Denali NAND
190 controller as a DT device.
191
Tom Rinia73788c2021-09-22 14:50:37 -0400192config NAND_FSL_ELBC
193 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500194 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
195 select SPL_SYS_NAND_SELF_INIT
196 select SYS_NAND_SELF_INIT
Tom Rinia73788c2021-09-22 14:50:37 -0400197 depends on FSL_ELBC
198 help
199 Enable the Freescale Enhanced Local Bus Controller FCM NAND driver.
200
Pali Rohárbb834db2022-04-04 18:17:19 +0200201config NAND_FSL_ELBC_DT
202 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver (DT mode)"
203 depends on NAND_FSL_ELBC
204
Tom Rinia73788c2021-09-22 14:50:37 -0400205config NAND_FSL_IFC
206 bool "Support Freescale Integrated Flash Controller NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500207 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
Tom Rini1a9f23d2022-05-26 14:31:57 -0400208 select TPL_NAND_INIT if TPL && !TPL_FRAMEWORK
Tom Rini98372452021-12-12 22:12:36 -0500209 select SPL_SYS_NAND_SELF_INIT
210 select SYS_NAND_SELF_INIT
Tom Rini05b419e2021-12-11 14:55:49 -0500211 select FSL_IFC
Tom Rinia73788c2021-09-22 14:50:37 -0400212 help
213 Enable the Freescale Integrated Flash Controller NAND driver.
214
Tom Rini08204272021-09-22 14:50:28 -0400215config NAND_LPC32XX_MLC
216 bool "Support LPC32XX_MLC controller"
Tom Rini98372452021-12-12 22:12:36 -0500217 select SYS_NAND_SELF_INIT
Tom Rini08204272021-09-22 14:50:28 -0400218 help
219 Enable the LPC32XX MLC NAND controller.
220
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200221config NAND_LPC32XX_SLC
222 bool "Support LPC32XX_SLC controller"
223 help
224 Enable the LPC32XX SLC NAND controller.
225
226config NAND_OMAP_GPMC
227 bool "Support OMAP GPMC NAND controller"
228 depends on ARCH_OMAP2PLUS
229 help
230 Enables omap_gpmc.c driver for OMAPx and AMxxxx platforms.
231 GPMC controller is used for parallel NAND flash devices, and can
232 do ECC calculation (not ECC error detection) for HAM1, BCH4, BCH8
233 and BCH16 ECC algorithms.
234
Tom Rinif6d26d82021-09-22 14:50:39 -0400235if NAND_OMAP_GPMC
236
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200237config NAND_OMAP_GPMC_PREFETCH
238 bool "Enable GPMC Prefetch"
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200239 default y
240 help
241 On OMAP platforms that use the GPMC controller
242 (CONFIG_NAND_OMAP_GPMC_PREFETCH), this options enables the code that
243 uses the prefetch mode to speed up read operations.
244
245config NAND_OMAP_ELM
246 bool "Enable ELM driver for OMAPxx and AMxx platforms."
Tom Rinif6d26d82021-09-22 14:50:39 -0400247 depends on !OMAP34XX
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200248 help
249 ELM controller is used for ECC error detection (not ECC calculation)
250 of BCH4, BCH8 and BCH16 ECC algorithms.
251 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
252 thus such SoC platforms need to depend on software library for ECC error
253 detection. However ECC calculation on such plaforms would still be
254 done by GPMC controller.
255
Tom Rinif6d26d82021-09-22 14:50:39 -0400256choice
257 prompt "ECC scheme"
258 default NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
259 help
260 On OMAP platforms, this CONFIG specifies NAND ECC scheme.
261 It can take following values:
262 OMAP_ECC_HAM1_CODE_SW
263 1-bit Hamming code using software lib.
264 (for legacy devices only)
265 OMAP_ECC_HAM1_CODE_HW
266 1-bit Hamming code using GPMC hardware.
267 (for legacy devices only)
268 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW
269 4-bit BCH code (unsupported)
270 OMAP_ECC_BCH4_CODE_HW
271 4-bit BCH code (unsupported)
272 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
273 8-bit BCH code with
274 - ecc calculation using GPMC hardware engine,
275 - error detection using software library.
276 - requires CONFIG_BCH to enable software BCH library
277 (For legacy device which do not have ELM h/w engine)
278 OMAP_ECC_BCH8_CODE_HW
279 8-bit BCH code with
280 - ecc calculation using GPMC hardware engine,
281 - error detection using ELM hardware engine.
282 OMAP_ECC_BCH16_CODE_HW
283 16-bit BCH code with
284 - ecc calculation using GPMC hardware engine,
285 - error detection using ELM hardware engine.
286
287 How to select ECC scheme on OMAP and AMxx platforms ?
288 -----------------------------------------------------
289 Though higher ECC schemes have more capability to detect and correct
290 bit-flips, but still selection of ECC scheme is dependent on following
291 - hardware engines present in SoC.
292 Some legacy OMAP SoC do not have ELM h/w engine thus such
293 SoC cannot support BCHx_HW ECC schemes.
294 - size of OOB/Spare region
295 With higher ECC schemes, more OOB/Spare area is required to
296 store ECC. So choice of ECC scheme is limited by NAND oobsize.
297
298 In general following expression can help:
299 NAND_OOBSIZE >= 2 + (NAND_PAGESIZE / 512) * ECC_BYTES
300 where
301 NAND_OOBSIZE = number of bytes available in
302 OOB/spare area per NAND page.
303 NAND_PAGESIZE = bytes in main-area of NAND page.
304 ECC_BYTES = number of ECC bytes generated to
305 protect 512 bytes of data, which is:
306 3 for HAM1_xx ecc schemes
307 7 for BCH4_xx ecc schemes
308 14 for BCH8_xx ecc schemes
309 26 for BCH16_xx ecc schemes
310
311 example to check for BCH16 on 2K page NAND
312 NAND_PAGESIZE = 2048
313 NAND_OOBSIZE = 64
314 2 + (2048 / 512) * 26 = 106 > NAND_OOBSIZE
315 Thus BCH16 cannot be supported on 2K page NAND.
316
317 However, for 4K pagesize NAND
318 NAND_PAGESIZE = 4096
319 NAND_OOBSIZE = 224
320 ECC_BYTES = 26
321 2 + (4096 / 512) * 26 = 210 < NAND_OOBSIZE
322 Thus BCH16 can be supported on 4K page NAND.
323
324config NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
325 bool "1-bit Hamming code using software lib"
326
327config NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
328 bool "1-bit Hamming code using GPMC hardware"
329
330config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
331 bool "8-bit BCH code with HW calculation SW error detection"
332
333config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
334 bool "8-bit BCH code with HW calculation and error detection"
335
336config NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
337 bool "16-bit BCH code with HW calculation and error detection"
338
339endchoice
340
341config NAND_OMAP_ECCSCHEME
342 int
343 default 1 if NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
344 default 2 if NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
345 default 5 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
346 default 6 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
347 default 7 if NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
348 help
349 This must be kept in sync with the enum in
350 include/linux/mtd/omap_gpmc.h
351
352endif
353
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200354config NAND_VF610_NFC
355 bool "Support for Freescale NFC for VF610"
356 select SYS_NAND_SELF_INIT
Stefan Agnerbd186142018-12-06 14:57:09 +0100357 select SYS_NAND_DRIVER_ECC_LAYOUT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200358 imply CMD_NAND
359 help
360 Enables support for NAND Flash Controller on some Freescale
361 processors like the VF610, MCF54418 or Kinetis K70.
362 The driver supports a maximum 2k page size. The driver
363 currently does not support hardware ECC.
364
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100365if NAND_VF610_NFC
366
367config NAND_VF610_NFC_DT
368 bool "Support Vybrid's vf610 NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200369 depends on OF_CONTROL && DM_MTD
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100370 help
371 Enable the driver for Vybrid's vf610 NAND flash on platforms
372 using device tree.
373
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200374choice
375 prompt "Hardware ECC strength"
376 depends on NAND_VF610_NFC
377 default SYS_NAND_VF610_NFC_45_ECC_BYTES
378 help
379 Select the ECC strength used in the hardware BCH ECC block.
380
381config SYS_NAND_VF610_NFC_45_ECC_BYTES
382 bool "24-error correction (45 ECC bytes)"
383
384config SYS_NAND_VF610_NFC_60_ECC_BYTES
385 bool "32-error correction (60 ECC bytes)"
386
387endchoice
388
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100389endif
390
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200391config NAND_PXA3XX
392 bool "Support for NAND on PXA3xx and Armada 370/XP/38x"
393 select SYS_NAND_SELF_INIT
Shmuel Hazan759349e2020-10-29 08:52:18 +0200394 select DM_MTD
Shmuel Hazan58983222020-10-29 08:52:20 +0200395 select REGMAP
396 select SYSCON
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200397 imply CMD_NAND
398 help
399 This enables the driver for the NAND flash device found on
400 PXA3xx processors (NFCv1) and also on Armada 370/XP (NFCv2).
401
402config NAND_SUNXI
403 bool "Support for NAND on Allwinner SoCs"
404 default ARCH_SUNXI
405 depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I
406 select SYS_NAND_SELF_INIT
407 select SYS_NAND_U_BOOT_LOCATIONS
408 select SPL_NAND_SUPPORT
Tom Rini98372452021-12-12 22:12:36 -0500409 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200410 imply CMD_NAND
411 ---help---
412 Enable support for NAND. This option enables the standard and
413 SPL drivers.
414 The SPL driver only supports reading from the NAND using DMA
415 transfers.
416
417if NAND_SUNXI
418
419config NAND_SUNXI_SPL_ECC_STRENGTH
420 int "Allwinner NAND SPL ECC Strength"
421 default 64
422
423config NAND_SUNXI_SPL_ECC_SIZE
424 int "Allwinner NAND SPL ECC Step Size"
425 default 1024
426
427config NAND_SUNXI_SPL_USABLE_PAGE_SIZE
428 int "Allwinner NAND SPL Usable Page Size"
429 default 1024
430
431endif
432
433config NAND_ARASAN
434 bool "Configure Arasan Nand"
435 select SYS_NAND_SELF_INIT
Michal Simekc5587832020-08-19 09:59:52 +0200436 depends on DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200437 imply CMD_NAND
438 help
439 This enables Nand driver support for Arasan nand flash
440 controller. This uses the hardware ECC for read and
441 write operations.
442
443config NAND_MXC
444 bool "MXC NAND support"
445 depends on CPU_ARM926EJS || CPU_ARM1136 || MX5
446 imply CMD_NAND
447 help
448 This enables the NAND driver for the NAND flash controller on the
Haolin Lie8df55b2021-07-18 10:13:39 +0800449 i.MX27 / i.MX31 / i.MX5 processors.
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200450
451config NAND_MXS
452 bool "MXS NAND support"
Peng Fan128abf42020-05-04 22:09:00 +0800453 depends on MX23 || MX28 || MX6 || MX7 || IMX8 || IMX8M
Tom Rini98372452021-12-12 22:12:36 -0500454 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200455 select SYS_NAND_SELF_INIT
456 imply CMD_NAND
457 select APBH_DMA
Peng Fan128abf42020-05-04 22:09:00 +0800458 select APBH_DMA_BURST if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
459 select APBH_DMA_BURST8 if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200460 help
461 This enables NAND driver for the NAND flash controller on the
462 MXS processors.
463
464if NAND_MXS
465
466config NAND_MXS_DT
467 bool "Support MXS NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200468 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200469 help
470 Enable the driver for MXS NAND flash on platforms using
471 device tree.
472
473config NAND_MXS_USE_MINIMUM_ECC
474 bool "Use minimum ECC strength supported by the controller"
475 default false
476
477endif
478
Zhengxun Li01551712021-09-14 13:43:51 +0800479config NAND_MXIC
480 bool "Macronix raw NAND controller"
481 select SYS_NAND_SELF_INIT
482 help
483 This selects the Macronix raw NAND controller driver.
484
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200485config NAND_ZYNQ
486 bool "Support for Zynq Nand controller"
Tom Rini98372452021-12-12 22:12:36 -0500487 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200488 select SYS_NAND_SELF_INIT
Ashok Reddy Somabb8448a2019-12-27 04:47:12 -0700489 select DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200490 imply CMD_NAND
491 help
492 This enables Nand driver support for Nand flash controller
493 found on Zynq SoC.
494
495config NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
496 bool "Enable use of 1st stage bootloader timing for NAND"
497 depends on NAND_ZYNQ
498 help
499 This flag prevent U-boot reconfigure NAND flash controller and reuse
500 the NAND timing from 1st stage bootloader.
501
Suneel Garapati9de7d2b2020-08-26 14:37:22 +0200502config NAND_OCTEONTX
503 bool "Support for OcteonTX NAND controller"
504 select SYS_NAND_SELF_INIT
505 imply CMD_NAND
506 help
507 This enables Nand flash controller hardware found on the OcteonTX
508 processors.
509
510config NAND_OCTEONTX_HW_ECC
511 bool "Support Hardware ECC for OcteonTX NAND controller"
512 depends on NAND_OCTEONTX
513 default y
514 help
515 This enables Hardware BCH engine found on the OcteonTX processors to
516 support ECC for NAND flash controller.
517
Christophe Kerelloda141682019-04-05 11:41:50 +0200518config NAND_STM32_FMC2
519 bool "Support for NAND controller on STM32MP SoCs"
520 depends on ARCH_STM32MP
521 select SYS_NAND_SELF_INIT
522 imply CMD_NAND
523 help
524 Enables support for NAND Flash chips on SoCs containing the FMC2
525 NAND controller. This controller is found on STM32MP SoCs.
526 The controller supports a maximum 8k page size and supports
527 a maximum 8-bit correction error per sector of 512 bytes.
528
Kate Liu41ccd2e2020-12-11 13:46:12 -0800529config CORTINA_NAND
530 bool "Support for NAND controller on Cortina-Access SoCs"
531 depends on CORTINA_PLATFORM
532 select SYS_NAND_SELF_INIT
533 select DM_MTD
534 imply CMD_NAND
535 help
536 Enables support for NAND Flash chips on Coartina-Access SoCs platform
537 This controller is found on Presidio/Venus SoCs.
538 The controller supports a maximum 8k page size and supports
539 a maximum 40-bit error correction per sector of 1024 bytes.
540
Yifeng Zhao9e9021e2021-06-07 16:40:29 +0800541config ROCKCHIP_NAND
542 bool "Support for NAND controller on Rockchip SoCs"
543 depends on ARCH_ROCKCHIP
544 select SYS_NAND_SELF_INIT
545 select DM_MTD
546 imply CMD_NAND
547 help
548 Enables support for NAND Flash chips on Rockchip SoCs platform.
549 This controller is found on Rockchip SoCs.
550 There are four different versions of NAND FLASH Controllers,
551 including:
552 NFC v600: RK2928, RK3066, RK3188
553 NFC v622: RK3036, RK3128
554 NFC v800: RK3308, RV1108
555 NFC v900: PX30, RK3326
556
Tom Rini8f37ac42021-12-12 22:12:35 -0500557config TEGRA_NAND
558 bool "Support for NAND controller on Tegra SoCs"
559 depends on ARCH_TEGRA
560 select SYS_NAND_SELF_INIT
561 imply CMD_NAND
562 help
563 Enables support for NAND Flash chips on Tegra SoCs platforms.
564
developer10a61df2022-05-20 11:23:47 +0800565config NAND_MT7621
566 bool "Support for MediaTek MT7621 NAND flash controller"
567 depends on SOC_MT7621
568 select SYS_NAND_SELF_INIT
569 select SPL_SYS_NAND_SELF_INIT
570 imply CMD_NAND
571 help
572 This enables NAND driver for the NAND flash controller on MediaTek
573 MT7621 platform.
574 The controller supports 4~12 bits correction per 512 bytes with a
575 maximum 4KB page size.
576
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200577comment "Generic NAND options"
578
579config SYS_NAND_BLOCK_SIZE
580 hex "NAND chip eraseblock size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400581 depends on ARCH_SUNXI || SPL_NAND_SUPPORT || TPL_NAND_SUPPORT
developer10a61df2022-05-20 11:23:47 +0800582 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && \
583 !NAND_FSL_IFC && !NAND_MT7621
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200584 help
585 Number of data bytes in one eraseblock for the NAND chip on the
586 board. This is the multiple of NAND_PAGE_SIZE and the number of
587 pages.
588
Tom Rinifdae0072021-09-22 14:50:34 -0400589config SYS_NAND_ONFI_DETECTION
590 bool "Enable detection of ONFI compliant devices during probe"
591 help
592 Enables detection of ONFI compliant devices during probe.
593 And fetching device parameters flashed on device, by parsing
594 ONFI parameter page.
595
Tom Rini2510a812021-09-22 14:50:30 -0400596config SYS_NAND_PAGE_COUNT
597 hex "NAND chip page count"
598 depends on SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC || \
599 SPL_NAND_AM33XX_BCH || SPL_NAND_LOAD || SPL_NAND_SIMPLE)
600 help
601 Number of pages in the NAND chip.
602
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200603config SYS_NAND_PAGE_SIZE
604 hex "NAND chip page size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400605 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
606 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
607 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
developer10a61df2022-05-20 11:23:47 +0800608 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && !NAND_MT7621
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200609 help
610 Number of data bytes in one page for the NAND chip on the
611 board, not including the OOB area.
612
613config SYS_NAND_OOBSIZE
614 hex "NAND chip OOB size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400615 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
616 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
617 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
Tom Rinid24700f2021-10-30 23:03:56 -0400618 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200619 help
620 Number of bytes in the Out-Of-Band area for the NAND chip on
621 the board.
622
623# Enhance depends when converting drivers to Kconfig which use this config
624# option (mxc_nand, ndfc, omap_gpmc).
625config SYS_NAND_BUSWIDTH_16BIT
626 bool "Use 16-bit NAND interface"
627 depends on NAND_VF610_NFC || NAND_OMAP_GPMC || NAND_MXC || ARCH_DAVINCI
628 help
629 Indicates that NAND device has 16-bit wide data-bus. In absence of this
630 config, bus-width of NAND device is assumed to be either 8-bit and later
631 determined by reading ONFI params.
632 Above config is useful when NAND device's bus-width information cannot
633 be determined from on-chip ONFI params, like in following scenarios:
634 - SPL boot does not support reading of ONFI parameters. This is done to
635 keep SPL code foot-print small.
636 - In current U-Boot flow using nand_init(), driver initialization
637 happens in board_nand_init() which is called before any device probe
638 (nand_scan_ident + nand_scan_tail), thus device's ONFI parameters are
639 not available while configuring controller. So a static CONFIG_NAND_xx
640 is needed to know the device's bus-width in advance.
641
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200642if SPL
643
Tom Rini8e6d9c72021-09-22 14:50:33 -0400644config SYS_NAND_5_ADDR_CYCLE
645 bool "Wait 5 address cycles during NAND commands"
646 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_SIMPLE || \
647 (SPL_NAND_SUPPORT && NAND_ATMEL)
648 default y
649 help
650 Some controllers require waiting for 5 address cycles when issuing
651 some commands, on NAND chips larger than 128MiB.
652
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400653choice
Tom Rinifdae0072021-09-22 14:50:34 -0400654 prompt "NAND bad block marker/indicator position in the OOB"
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400655 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_DENALI || SPL_NAND_SIMPLE || \
656 SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC)
657 default HAS_NAND_LARGE_BADBLOCK_POS
658 help
659 In the OOB, which position contains the badblock information.
660
661config HAS_NAND_LARGE_BADBLOCK_POS
662 bool "Set the bad block marker/indicator to the 'large' position"
663
664config HAS_NAND_SMALL_BADBLOCK_POS
665 bool "Set the bad block marker/indicator to the 'small' position"
666
667endchoice
668
669config SYS_NAND_BAD_BLOCK_POS
670 int
671 default 0 if HAS_NAND_LARGE_BADBLOCK_POS
672 default 5 if HAS_NAND_SMALL_BADBLOCK_POS
673
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200674config SYS_NAND_U_BOOT_LOCATIONS
675 bool "Define U-boot binaries locations in NAND"
676 help
677 Enable CONFIG_SYS_NAND_U_BOOT_OFFS though Kconfig.
678 This option should not be enabled when compiling U-boot for boards
679 defining CONFIG_SYS_NAND_U_BOOT_OFFS in their include/configs/<board>.h
680 file.
681
682config SYS_NAND_U_BOOT_OFFS
683 hex "Location in NAND to read U-Boot from"
684 default 0x800000 if NAND_SUNXI
685 depends on SYS_NAND_U_BOOT_LOCATIONS
686 help
687 Set the offset from the start of the nand where u-boot should be
688 loaded from.
689
690config SYS_NAND_U_BOOT_OFFS_REDUND
691 hex "Location in NAND to read U-Boot from"
692 default SYS_NAND_U_BOOT_OFFS
693 depends on SYS_NAND_U_BOOT_LOCATIONS
694 help
695 Set the offset from the start of the nand where the redundant u-boot
696 should be loaded from.
697
698config SPL_NAND_AM33XX_BCH
699 bool "Enables SPL-NAND driver which supports ELM based"
Tom Rini0a83cc22022-06-10 23:03:09 -0400700 depends on SPL_NAND_SUPPORT && NAND_OMAP_GPMC && !OMAP34XX
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200701 default y
702 help
703 Hardware ECC correction. This is useful for platforms which have ELM
704 hardware engine and use NAND boot mode.
705 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
706 so those platforms should use CONFIG_SPL_NAND_SIMPLE for enabling
707 SPL-NAND driver with software ECC correction support.
708
709config SPL_NAND_DENALI
710 bool "Support Denali NAND controller for SPL"
Tom Rini0a83cc22022-06-10 23:03:09 -0400711 depends on SPL_NAND_SUPPORT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200712 help
713 This is a small implementation of the Denali NAND controller
714 for use on SPL.
715
Masahiro Yamada64648cb2020-04-17 16:51:42 +0900716config NAND_DENALI_SPARE_AREA_SKIP_BYTES
717 int "Number of bytes skipped in OOB area"
718 depends on SPL_NAND_DENALI
719 range 0 63
720 help
721 This option specifies the number of bytes to skip from the beginning
722 of OOB area before last ECC sector data starts. This is potentially
723 used to preserve the bad block marker in the OOB area.
724
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200725config SPL_NAND_SIMPLE
726 bool "Use simple SPL NAND driver"
Tom Rini0a83cc22022-06-10 23:03:09 -0400727 depends on !SPL_NAND_AM33XX_BCH && SPL_NAND_SUPPORT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200728 help
729 Support for NAND boot using simple NAND drivers that
730 expose the cmd_ctrl() interface.
Tom Rini4251f7d2022-11-12 17:36:44 -0500731
732config SYS_NAND_HW_ECC_OOBFIRST
733 bool "In SPL, read the OOB first and then the data from NAND"
734 depends on SPL_NAND_SIMPLE
735
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200736endif
737
738endif # if NAND