blob: 4129a33866bf492b3ef90063441e914e3e2483ed [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
Stefan Agnerbd186142018-12-06 14:57:09 +010029config SYS_NAND_DRIVER_ECC_LAYOUT
Tom Rinid03e14e2021-12-11 14:55:54 -050030 bool "Omit standard ECC layouts to save space"
Stefan Agnerbd186142018-12-06 14:57:09 +010031 help
Tom Rinid03e14e2021-12-11 14:55:54 -050032 Omit standard ECC layouts to save space. Select this if your driver
Stefan Agnerbd186142018-12-06 14:57:09 +010033 is known to provide its own ECC layout.
34
Stefan Roese23b37f92019-08-22 12:28:04 +020035config SYS_NAND_USE_FLASH_BBT
36 bool "Enable BBT (Bad Block Table) support"
37 help
38 Enable the BBT (Bad Block Table) usage.
39
Miquel Raynal1f1ae152018-08-16 17:30:07 +020040config NAND_ATMEL
41 bool "Support Atmel NAND controller"
Tom Rini98372452021-12-12 22:12:36 -050042 select SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +020043 imply SYS_NAND_USE_FLASH_BBT
44 help
45 Enable this driver for NAND flash platforms using an Atmel NAND
46 controller.
47
Derald D. Woods7830fc52018-12-15 01:36:46 -060048if NAND_ATMEL
49
50config ATMEL_NAND_HWECC
51 bool "Atmel Hardware ECC"
Derald D. Woods7830fc52018-12-15 01:36:46 -060052
53config ATMEL_NAND_HW_PMECC
54 bool "Atmel Programmable Multibit ECC (PMECC)"
55 select ATMEL_NAND_HWECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060056 help
57 The Programmable Multibit ECC (PMECC) controller is a programmable
58 binary BCH(Bose, Chaudhuri and Hocquenghem) encoder and decoder.
59
60config PMECC_CAP
61 int "PMECC Correctable ECC Bits"
62 depends on ATMEL_NAND_HW_PMECC
63 default 2
64 help
65 Correctable ECC bits, can be 2, 4, 8, 12, and 24.
66
67config PMECC_SECTOR_SIZE
68 int "PMECC Sector Size"
69 depends on ATMEL_NAND_HW_PMECC
70 default 512
71 help
72 Sector size, in bytes, can be 512 or 1024.
73
74config SPL_GENERATE_ATMEL_PMECC_HEADER
75 bool "Atmel PMECC Header Generation"
76 select ATMEL_NAND_HWECC
77 select ATMEL_NAND_HW_PMECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060078 help
79 Generate Programmable Multibit ECC (PMECC) header for SPL image.
80
81endif
82
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +010083config NAND_BRCMNAND
84 bool "Support Broadcom NAND controller"
Miquel Raynala903be42019-10-03 19:50:04 +020085 depends on OF_CONTROL && DM && DM_MTD
Tom Rini98372452021-12-12 22:12:36 -050086 select SYS_NAND_SELF_INIT
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +010087 help
88 Enable the driver for NAND flash on platforms using a Broadcom NAND
89 controller.
90
Álvaro Fernández Rojasd9f9bfc2019-08-28 19:12:15 +020091config NAND_BRCMNAND_6368
92 bool "Support Broadcom NAND controller on bcm6368"
93 depends on NAND_BRCMNAND && ARCH_BMIPS
94 help
95 Enable support for broadcom nand driver on bcm6368.
96
Philippe Reynese175c322022-02-11 19:18:36 +010097config NAND_BRCMNAND_6753
98 bool "Support Broadcom NAND controller on bcm6753"
99 depends on NAND_BRCMNAND && ARCH_BCM6753
100 help
101 Enable support for broadcom nand driver on bcm6753.
102
Philippe Reynes74ead742020-01-07 20:14:13 +0100103config NAND_BRCMNAND_68360
104 bool "Support Broadcom NAND controller on bcm68360"
105 depends on NAND_BRCMNAND && ARCH_BCM68360
106 help
107 Enable support for broadcom nand driver on bcm68360.
108
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100109config NAND_BRCMNAND_6838
110 bool "Support Broadcom NAND controller on bcm6838"
111 depends on NAND_BRCMNAND && ARCH_BMIPS && SOC_BMIPS_BCM6838
112 help
113 Enable support for broadcom nand driver on bcm6838.
114
115config NAND_BRCMNAND_6858
116 bool "Support Broadcom NAND controller on bcm6858"
117 depends on NAND_BRCMNAND && ARCH_BCM6858
118 help
119 Enable support for broadcom nand driver on bcm6858.
120
121config NAND_BRCMNAND_63158
122 bool "Support Broadcom NAND controller on bcm63158"
123 depends on NAND_BRCMNAND && ARCH_BCM63158
124 help
125 Enable support for broadcom nand driver on bcm63158.
126
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200127config NAND_DAVINCI
128 bool "Support TI Davinci NAND controller"
Tom Rini98372452021-12-12 22:12:36 -0500129 select SYS_NAND_SELF_INIT if TARGET_DA850EVM
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200130 help
131 Enable this driver for NAND flash controllers available in TI Davinci
132 and Keystone2 platforms
133
Tom Rinidada0e32021-09-12 20:32:24 -0400134config KEYSTONE_RBL_NAND
135 depends on ARCH_KEYSTONE
136 def_bool y
137
Tom Rinifae1dab2021-09-22 14:50:29 -0400138config SPL_NAND_LOAD
139 def_bool y
140 depends on NAND_DAVINCI && ARCH_DAVINCI && SPL_NAND_SUPPORT
141
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200142config NAND_DENALI
143 bool
144 select SYS_NAND_SELF_INIT
145 imply CMD_NAND
146
147config NAND_DENALI_DT
148 bool "Support Denali NAND controller as a DT device"
149 select NAND_DENALI
Masahiro Yamada8fc53822020-01-30 22:07:59 +0900150 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200151 help
152 Enable the driver for NAND flash on platforms using a Denali NAND
153 controller as a DT device.
154
Tom Rinia73788c2021-09-22 14:50:37 -0400155config NAND_FSL_ELBC
156 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500157 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
158 select SPL_SYS_NAND_SELF_INIT
159 select SYS_NAND_SELF_INIT
Tom Rinia73788c2021-09-22 14:50:37 -0400160 depends on FSL_ELBC
161 help
162 Enable the Freescale Enhanced Local Bus Controller FCM NAND driver.
163
Pali Rohárbb834db2022-04-04 18:17:19 +0200164config NAND_FSL_ELBC_DT
165 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver (DT mode)"
166 depends on NAND_FSL_ELBC
167
Tom Rinia73788c2021-09-22 14:50:37 -0400168config NAND_FSL_IFC
169 bool "Support Freescale Integrated Flash Controller NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500170 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
Tom Rini1a9f23d2022-05-26 14:31:57 -0400171 select TPL_NAND_INIT if TPL && !TPL_FRAMEWORK
Tom Rini98372452021-12-12 22:12:36 -0500172 select SPL_SYS_NAND_SELF_INIT
173 select SYS_NAND_SELF_INIT
Tom Rini05b419e2021-12-11 14:55:49 -0500174 select FSL_IFC
Tom Rinia73788c2021-09-22 14:50:37 -0400175 help
176 Enable the Freescale Integrated Flash Controller NAND driver.
177
Tom Rini08204272021-09-22 14:50:28 -0400178config NAND_LPC32XX_MLC
179 bool "Support LPC32XX_MLC controller"
Tom Rini98372452021-12-12 22:12:36 -0500180 select SYS_NAND_SELF_INIT
Tom Rini08204272021-09-22 14:50:28 -0400181 help
182 Enable the LPC32XX MLC NAND controller.
183
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200184config NAND_LPC32XX_SLC
185 bool "Support LPC32XX_SLC controller"
186 help
187 Enable the LPC32XX SLC NAND controller.
188
189config NAND_OMAP_GPMC
190 bool "Support OMAP GPMC NAND controller"
191 depends on ARCH_OMAP2PLUS
192 help
193 Enables omap_gpmc.c driver for OMAPx and AMxxxx platforms.
194 GPMC controller is used for parallel NAND flash devices, and can
195 do ECC calculation (not ECC error detection) for HAM1, BCH4, BCH8
196 and BCH16 ECC algorithms.
197
Tom Rinif6d26d82021-09-22 14:50:39 -0400198if NAND_OMAP_GPMC
199
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200200config NAND_OMAP_GPMC_PREFETCH
201 bool "Enable GPMC Prefetch"
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200202 default y
203 help
204 On OMAP platforms that use the GPMC controller
205 (CONFIG_NAND_OMAP_GPMC_PREFETCH), this options enables the code that
206 uses the prefetch mode to speed up read operations.
207
208config NAND_OMAP_ELM
209 bool "Enable ELM driver for OMAPxx and AMxx platforms."
Tom Rinif6d26d82021-09-22 14:50:39 -0400210 depends on !OMAP34XX
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200211 help
212 ELM controller is used for ECC error detection (not ECC calculation)
213 of BCH4, BCH8 and BCH16 ECC algorithms.
214 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
215 thus such SoC platforms need to depend on software library for ECC error
216 detection. However ECC calculation on such plaforms would still be
217 done by GPMC controller.
218
Tom Rinif6d26d82021-09-22 14:50:39 -0400219choice
220 prompt "ECC scheme"
221 default NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
222 help
223 On OMAP platforms, this CONFIG specifies NAND ECC scheme.
224 It can take following values:
225 OMAP_ECC_HAM1_CODE_SW
226 1-bit Hamming code using software lib.
227 (for legacy devices only)
228 OMAP_ECC_HAM1_CODE_HW
229 1-bit Hamming code using GPMC hardware.
230 (for legacy devices only)
231 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW
232 4-bit BCH code (unsupported)
233 OMAP_ECC_BCH4_CODE_HW
234 4-bit BCH code (unsupported)
235 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
236 8-bit BCH code with
237 - ecc calculation using GPMC hardware engine,
238 - error detection using software library.
239 - requires CONFIG_BCH to enable software BCH library
240 (For legacy device which do not have ELM h/w engine)
241 OMAP_ECC_BCH8_CODE_HW
242 8-bit BCH code with
243 - ecc calculation using GPMC hardware engine,
244 - error detection using ELM hardware engine.
245 OMAP_ECC_BCH16_CODE_HW
246 16-bit BCH code with
247 - ecc calculation using GPMC hardware engine,
248 - error detection using ELM hardware engine.
249
250 How to select ECC scheme on OMAP and AMxx platforms ?
251 -----------------------------------------------------
252 Though higher ECC schemes have more capability to detect and correct
253 bit-flips, but still selection of ECC scheme is dependent on following
254 - hardware engines present in SoC.
255 Some legacy OMAP SoC do not have ELM h/w engine thus such
256 SoC cannot support BCHx_HW ECC schemes.
257 - size of OOB/Spare region
258 With higher ECC schemes, more OOB/Spare area is required to
259 store ECC. So choice of ECC scheme is limited by NAND oobsize.
260
261 In general following expression can help:
262 NAND_OOBSIZE >= 2 + (NAND_PAGESIZE / 512) * ECC_BYTES
263 where
264 NAND_OOBSIZE = number of bytes available in
265 OOB/spare area per NAND page.
266 NAND_PAGESIZE = bytes in main-area of NAND page.
267 ECC_BYTES = number of ECC bytes generated to
268 protect 512 bytes of data, which is:
269 3 for HAM1_xx ecc schemes
270 7 for BCH4_xx ecc schemes
271 14 for BCH8_xx ecc schemes
272 26 for BCH16_xx ecc schemes
273
274 example to check for BCH16 on 2K page NAND
275 NAND_PAGESIZE = 2048
276 NAND_OOBSIZE = 64
277 2 + (2048 / 512) * 26 = 106 > NAND_OOBSIZE
278 Thus BCH16 cannot be supported on 2K page NAND.
279
280 However, for 4K pagesize NAND
281 NAND_PAGESIZE = 4096
282 NAND_OOBSIZE = 224
283 ECC_BYTES = 26
284 2 + (4096 / 512) * 26 = 210 < NAND_OOBSIZE
285 Thus BCH16 can be supported on 4K page NAND.
286
287config NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
288 bool "1-bit Hamming code using software lib"
289
290config NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
291 bool "1-bit Hamming code using GPMC hardware"
292
293config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
294 bool "8-bit BCH code with HW calculation SW error detection"
295
296config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
297 bool "8-bit BCH code with HW calculation and error detection"
298
299config NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
300 bool "16-bit BCH code with HW calculation and error detection"
301
302endchoice
303
304config NAND_OMAP_ECCSCHEME
305 int
306 default 1 if NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
307 default 2 if NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
308 default 5 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
309 default 6 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
310 default 7 if NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
311 help
312 This must be kept in sync with the enum in
313 include/linux/mtd/omap_gpmc.h
314
315endif
316
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200317config NAND_VF610_NFC
318 bool "Support for Freescale NFC for VF610"
319 select SYS_NAND_SELF_INIT
Stefan Agnerbd186142018-12-06 14:57:09 +0100320 select SYS_NAND_DRIVER_ECC_LAYOUT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200321 imply CMD_NAND
322 help
323 Enables support for NAND Flash Controller on some Freescale
324 processors like the VF610, MCF54418 or Kinetis K70.
325 The driver supports a maximum 2k page size. The driver
326 currently does not support hardware ECC.
327
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100328if NAND_VF610_NFC
329
330config NAND_VF610_NFC_DT
331 bool "Support Vybrid's vf610 NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200332 depends on OF_CONTROL && DM_MTD
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100333 help
334 Enable the driver for Vybrid's vf610 NAND flash on platforms
335 using device tree.
336
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200337choice
338 prompt "Hardware ECC strength"
339 depends on NAND_VF610_NFC
340 default SYS_NAND_VF610_NFC_45_ECC_BYTES
341 help
342 Select the ECC strength used in the hardware BCH ECC block.
343
344config SYS_NAND_VF610_NFC_45_ECC_BYTES
345 bool "24-error correction (45 ECC bytes)"
346
347config SYS_NAND_VF610_NFC_60_ECC_BYTES
348 bool "32-error correction (60 ECC bytes)"
349
350endchoice
351
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100352endif
353
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200354config NAND_PXA3XX
355 bool "Support for NAND on PXA3xx and Armada 370/XP/38x"
356 select SYS_NAND_SELF_INIT
Shmuel Hazan759349e2020-10-29 08:52:18 +0200357 select DM_MTD
Shmuel Hazan58983222020-10-29 08:52:20 +0200358 select REGMAP
359 select SYSCON
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200360 imply CMD_NAND
361 help
362 This enables the driver for the NAND flash device found on
363 PXA3xx processors (NFCv1) and also on Armada 370/XP (NFCv2).
364
365config NAND_SUNXI
366 bool "Support for NAND on Allwinner SoCs"
367 default ARCH_SUNXI
368 depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I
369 select SYS_NAND_SELF_INIT
370 select SYS_NAND_U_BOOT_LOCATIONS
371 select SPL_NAND_SUPPORT
Tom Rini98372452021-12-12 22:12:36 -0500372 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200373 imply CMD_NAND
374 ---help---
375 Enable support for NAND. This option enables the standard and
376 SPL drivers.
377 The SPL driver only supports reading from the NAND using DMA
378 transfers.
379
380if NAND_SUNXI
381
382config NAND_SUNXI_SPL_ECC_STRENGTH
383 int "Allwinner NAND SPL ECC Strength"
384 default 64
385
386config NAND_SUNXI_SPL_ECC_SIZE
387 int "Allwinner NAND SPL ECC Step Size"
388 default 1024
389
390config NAND_SUNXI_SPL_USABLE_PAGE_SIZE
391 int "Allwinner NAND SPL Usable Page Size"
392 default 1024
393
394endif
395
396config NAND_ARASAN
397 bool "Configure Arasan Nand"
398 select SYS_NAND_SELF_INIT
Michal Simekc5587832020-08-19 09:59:52 +0200399 depends on DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200400 imply CMD_NAND
401 help
402 This enables Nand driver support for Arasan nand flash
403 controller. This uses the hardware ECC for read and
404 write operations.
405
406config NAND_MXC
407 bool "MXC NAND support"
408 depends on CPU_ARM926EJS || CPU_ARM1136 || MX5
409 imply CMD_NAND
410 help
411 This enables the NAND driver for the NAND flash controller on the
Haolin Lie8df55b2021-07-18 10:13:39 +0800412 i.MX27 / i.MX31 / i.MX5 processors.
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200413
414config NAND_MXS
415 bool "MXS NAND support"
Peng Fan128abf42020-05-04 22:09:00 +0800416 depends on MX23 || MX28 || MX6 || MX7 || IMX8 || IMX8M
Tom Rini98372452021-12-12 22:12:36 -0500417 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200418 select SYS_NAND_SELF_INIT
419 imply CMD_NAND
420 select APBH_DMA
Peng Fan128abf42020-05-04 22:09:00 +0800421 select APBH_DMA_BURST if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
422 select APBH_DMA_BURST8 if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200423 help
424 This enables NAND driver for the NAND flash controller on the
425 MXS processors.
426
427if NAND_MXS
428
429config NAND_MXS_DT
430 bool "Support MXS NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200431 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200432 help
433 Enable the driver for MXS NAND flash on platforms using
434 device tree.
435
436config NAND_MXS_USE_MINIMUM_ECC
437 bool "Use minimum ECC strength supported by the controller"
438 default false
439
440endif
441
Zhengxun Li01551712021-09-14 13:43:51 +0800442config NAND_MXIC
443 bool "Macronix raw NAND controller"
444 select SYS_NAND_SELF_INIT
445 help
446 This selects the Macronix raw NAND controller driver.
447
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200448config NAND_ZYNQ
449 bool "Support for Zynq Nand controller"
Tom Rini98372452021-12-12 22:12:36 -0500450 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200451 select SYS_NAND_SELF_INIT
Ashok Reddy Somabb8448a2019-12-27 04:47:12 -0700452 select DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200453 imply CMD_NAND
454 help
455 This enables Nand driver support for Nand flash controller
456 found on Zynq SoC.
457
458config NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
459 bool "Enable use of 1st stage bootloader timing for NAND"
460 depends on NAND_ZYNQ
461 help
462 This flag prevent U-boot reconfigure NAND flash controller and reuse
463 the NAND timing from 1st stage bootloader.
464
Suneel Garapati9de7d2b2020-08-26 14:37:22 +0200465config NAND_OCTEONTX
466 bool "Support for OcteonTX NAND controller"
467 select SYS_NAND_SELF_INIT
468 imply CMD_NAND
469 help
470 This enables Nand flash controller hardware found on the OcteonTX
471 processors.
472
473config NAND_OCTEONTX_HW_ECC
474 bool "Support Hardware ECC for OcteonTX NAND controller"
475 depends on NAND_OCTEONTX
476 default y
477 help
478 This enables Hardware BCH engine found on the OcteonTX processors to
479 support ECC for NAND flash controller.
480
Christophe Kerelloda141682019-04-05 11:41:50 +0200481config NAND_STM32_FMC2
482 bool "Support for NAND controller on STM32MP SoCs"
483 depends on ARCH_STM32MP
484 select SYS_NAND_SELF_INIT
485 imply CMD_NAND
486 help
487 Enables support for NAND Flash chips on SoCs containing the FMC2
488 NAND controller. This controller is found on STM32MP SoCs.
489 The controller supports a maximum 8k page size and supports
490 a maximum 8-bit correction error per sector of 512 bytes.
491
Kate Liu41ccd2e2020-12-11 13:46:12 -0800492config CORTINA_NAND
493 bool "Support for NAND controller on Cortina-Access SoCs"
494 depends on CORTINA_PLATFORM
495 select SYS_NAND_SELF_INIT
496 select DM_MTD
497 imply CMD_NAND
498 help
499 Enables support for NAND Flash chips on Coartina-Access SoCs platform
500 This controller is found on Presidio/Venus SoCs.
501 The controller supports a maximum 8k page size and supports
502 a maximum 40-bit error correction per sector of 1024 bytes.
503
Yifeng Zhao9e9021e2021-06-07 16:40:29 +0800504config ROCKCHIP_NAND
505 bool "Support for NAND controller on Rockchip SoCs"
506 depends on ARCH_ROCKCHIP
507 select SYS_NAND_SELF_INIT
508 select DM_MTD
509 imply CMD_NAND
510 help
511 Enables support for NAND Flash chips on Rockchip SoCs platform.
512 This controller is found on Rockchip SoCs.
513 There are four different versions of NAND FLASH Controllers,
514 including:
515 NFC v600: RK2928, RK3066, RK3188
516 NFC v622: RK3036, RK3128
517 NFC v800: RK3308, RV1108
518 NFC v900: PX30, RK3326
519
Tom Rini8f37ac42021-12-12 22:12:35 -0500520config TEGRA_NAND
521 bool "Support for NAND controller on Tegra SoCs"
522 depends on ARCH_TEGRA
523 select SYS_NAND_SELF_INIT
524 imply CMD_NAND
525 help
526 Enables support for NAND Flash chips on Tegra SoCs platforms.
527
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200528comment "Generic NAND options"
529
530config SYS_NAND_BLOCK_SIZE
531 hex "NAND chip eraseblock size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400532 depends on ARCH_SUNXI || SPL_NAND_SUPPORT || TPL_NAND_SUPPORT
Tom Rinid24700f2021-10-30 23:03:56 -0400533 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && !NAND_FSL_IFC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200534 help
535 Number of data bytes in one eraseblock for the NAND chip on the
536 board. This is the multiple of NAND_PAGE_SIZE and the number of
537 pages.
538
Tom Rinifdae0072021-09-22 14:50:34 -0400539config SYS_NAND_ONFI_DETECTION
540 bool "Enable detection of ONFI compliant devices during probe"
541 help
542 Enables detection of ONFI compliant devices during probe.
543 And fetching device parameters flashed on device, by parsing
544 ONFI parameter page.
545
Tom Rini2510a812021-09-22 14:50:30 -0400546config SYS_NAND_PAGE_COUNT
547 hex "NAND chip page count"
548 depends on SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC || \
549 SPL_NAND_AM33XX_BCH || SPL_NAND_LOAD || SPL_NAND_SIMPLE)
550 help
551 Number of pages in the NAND chip.
552
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200553config SYS_NAND_PAGE_SIZE
554 hex "NAND chip page size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400555 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
556 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
557 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
Tom Rinid24700f2021-10-30 23:03:56 -0400558 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200559 help
560 Number of data bytes in one page for the NAND chip on the
561 board, not including the OOB area.
562
563config SYS_NAND_OOBSIZE
564 hex "NAND chip OOB size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400565 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
566 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
567 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
Tom Rinid24700f2021-10-30 23:03:56 -0400568 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200569 help
570 Number of bytes in the Out-Of-Band area for the NAND chip on
571 the board.
572
573# Enhance depends when converting drivers to Kconfig which use this config
574# option (mxc_nand, ndfc, omap_gpmc).
575config SYS_NAND_BUSWIDTH_16BIT
576 bool "Use 16-bit NAND interface"
577 depends on NAND_VF610_NFC || NAND_OMAP_GPMC || NAND_MXC || ARCH_DAVINCI
578 help
579 Indicates that NAND device has 16-bit wide data-bus. In absence of this
580 config, bus-width of NAND device is assumed to be either 8-bit and later
581 determined by reading ONFI params.
582 Above config is useful when NAND device's bus-width information cannot
583 be determined from on-chip ONFI params, like in following scenarios:
584 - SPL boot does not support reading of ONFI parameters. This is done to
585 keep SPL code foot-print small.
586 - In current U-Boot flow using nand_init(), driver initialization
587 happens in board_nand_init() which is called before any device probe
588 (nand_scan_ident + nand_scan_tail), thus device's ONFI parameters are
589 not available while configuring controller. So a static CONFIG_NAND_xx
590 is needed to know the device's bus-width in advance.
591
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200592if SPL
593
Tom Rini8e6d9c72021-09-22 14:50:33 -0400594config SYS_NAND_5_ADDR_CYCLE
595 bool "Wait 5 address cycles during NAND commands"
596 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_SIMPLE || \
597 (SPL_NAND_SUPPORT && NAND_ATMEL)
598 default y
599 help
600 Some controllers require waiting for 5 address cycles when issuing
601 some commands, on NAND chips larger than 128MiB.
602
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400603choice
Tom Rinifdae0072021-09-22 14:50:34 -0400604 prompt "NAND bad block marker/indicator position in the OOB"
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400605 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_DENALI || SPL_NAND_SIMPLE || \
606 SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC)
607 default HAS_NAND_LARGE_BADBLOCK_POS
608 help
609 In the OOB, which position contains the badblock information.
610
611config HAS_NAND_LARGE_BADBLOCK_POS
612 bool "Set the bad block marker/indicator to the 'large' position"
613
614config HAS_NAND_SMALL_BADBLOCK_POS
615 bool "Set the bad block marker/indicator to the 'small' position"
616
617endchoice
618
619config SYS_NAND_BAD_BLOCK_POS
620 int
621 default 0 if HAS_NAND_LARGE_BADBLOCK_POS
622 default 5 if HAS_NAND_SMALL_BADBLOCK_POS
623
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200624config SYS_NAND_U_BOOT_LOCATIONS
625 bool "Define U-boot binaries locations in NAND"
626 help
627 Enable CONFIG_SYS_NAND_U_BOOT_OFFS though Kconfig.
628 This option should not be enabled when compiling U-boot for boards
629 defining CONFIG_SYS_NAND_U_BOOT_OFFS in their include/configs/<board>.h
630 file.
631
632config SYS_NAND_U_BOOT_OFFS
633 hex "Location in NAND to read U-Boot from"
634 default 0x800000 if NAND_SUNXI
635 depends on SYS_NAND_U_BOOT_LOCATIONS
636 help
637 Set the offset from the start of the nand where u-boot should be
638 loaded from.
639
640config SYS_NAND_U_BOOT_OFFS_REDUND
641 hex "Location in NAND to read U-Boot from"
642 default SYS_NAND_U_BOOT_OFFS
643 depends on SYS_NAND_U_BOOT_LOCATIONS
644 help
645 Set the offset from the start of the nand where the redundant u-boot
646 should be loaded from.
647
648config SPL_NAND_AM33XX_BCH
649 bool "Enables SPL-NAND driver which supports ELM based"
650 depends on NAND_OMAP_GPMC && !OMAP34XX
651 default y
652 help
653 Hardware ECC correction. This is useful for platforms which have ELM
654 hardware engine and use NAND boot mode.
655 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
656 so those platforms should use CONFIG_SPL_NAND_SIMPLE for enabling
657 SPL-NAND driver with software ECC correction support.
658
659config SPL_NAND_DENALI
660 bool "Support Denali NAND controller for SPL"
661 help
662 This is a small implementation of the Denali NAND controller
663 for use on SPL.
664
Masahiro Yamada64648cb2020-04-17 16:51:42 +0900665config NAND_DENALI_SPARE_AREA_SKIP_BYTES
666 int "Number of bytes skipped in OOB area"
667 depends on SPL_NAND_DENALI
668 range 0 63
669 help
670 This option specifies the number of bytes to skip from the beginning
671 of OOB area before last ECC sector data starts. This is potentially
672 used to preserve the bad block marker in the OOB area.
673
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200674config SPL_NAND_SIMPLE
675 bool "Use simple SPL NAND driver"
676 depends on !SPL_NAND_AM33XX_BCH
677 help
678 Support for NAND boot using simple NAND drivers that
679 expose the cmd_ctrl() interface.
680endif
681
682endif # if NAND