blob: 1eab21e206481087b90e6e4899395e5a4e251f96 [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
Stefan Agnerbd186142018-12-06 14:57:09 +010026config SYS_NAND_DRIVER_ECC_LAYOUT
Tom Rinid03e14e2021-12-11 14:55:54 -050027 bool "Omit standard ECC layouts to save space"
Stefan Agnerbd186142018-12-06 14:57:09 +010028 help
Tom Rinid03e14e2021-12-11 14:55:54 -050029 Omit standard ECC layouts to save space. Select this if your driver
Stefan Agnerbd186142018-12-06 14:57:09 +010030 is known to provide its own ECC layout.
31
Stefan Roese23b37f92019-08-22 12:28:04 +020032config SYS_NAND_USE_FLASH_BBT
33 bool "Enable BBT (Bad Block Table) support"
34 help
35 Enable the BBT (Bad Block Table) usage.
36
Miquel Raynal1f1ae152018-08-16 17:30:07 +020037config NAND_ATMEL
38 bool "Support Atmel NAND controller"
Tom Rini98372452021-12-12 22:12:36 -050039 select SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +020040 imply SYS_NAND_USE_FLASH_BBT
41 help
42 Enable this driver for NAND flash platforms using an Atmel NAND
43 controller.
44
Derald D. Woods7830fc52018-12-15 01:36:46 -060045if NAND_ATMEL
46
47config ATMEL_NAND_HWECC
48 bool "Atmel Hardware ECC"
Derald D. Woods7830fc52018-12-15 01:36:46 -060049
50config ATMEL_NAND_HW_PMECC
51 bool "Atmel Programmable Multibit ECC (PMECC)"
52 select ATMEL_NAND_HWECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060053 help
54 The Programmable Multibit ECC (PMECC) controller is a programmable
55 binary BCH(Bose, Chaudhuri and Hocquenghem) encoder and decoder.
56
57config PMECC_CAP
58 int "PMECC Correctable ECC Bits"
59 depends on ATMEL_NAND_HW_PMECC
60 default 2
61 help
62 Correctable ECC bits, can be 2, 4, 8, 12, and 24.
63
64config PMECC_SECTOR_SIZE
65 int "PMECC Sector Size"
66 depends on ATMEL_NAND_HW_PMECC
67 default 512
68 help
69 Sector size, in bytes, can be 512 or 1024.
70
71config SPL_GENERATE_ATMEL_PMECC_HEADER
72 bool "Atmel PMECC Header Generation"
73 select ATMEL_NAND_HWECC
74 select ATMEL_NAND_HW_PMECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060075 help
76 Generate Programmable Multibit ECC (PMECC) header for SPL image.
77
78endif
79
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +010080config NAND_BRCMNAND
81 bool "Support Broadcom NAND controller"
Miquel Raynala903be42019-10-03 19:50:04 +020082 depends on OF_CONTROL && DM && DM_MTD
Tom Rini98372452021-12-12 22:12:36 -050083 select SYS_NAND_SELF_INIT
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +010084 help
85 Enable the driver for NAND flash on platforms using a Broadcom NAND
86 controller.
87
Álvaro Fernández Rojasd9f9bfc2019-08-28 19:12:15 +020088config NAND_BRCMNAND_6368
89 bool "Support Broadcom NAND controller on bcm6368"
90 depends on NAND_BRCMNAND && ARCH_BMIPS
91 help
92 Enable support for broadcom nand driver on bcm6368.
93
Philippe Reynese175c322022-02-11 19:18:36 +010094config NAND_BRCMNAND_6753
95 bool "Support Broadcom NAND controller on bcm6753"
96 depends on NAND_BRCMNAND && ARCH_BCM6753
97 help
98 Enable support for broadcom nand driver on bcm6753.
99
Philippe Reynes74ead742020-01-07 20:14:13 +0100100config NAND_BRCMNAND_68360
101 bool "Support Broadcom NAND controller on bcm68360"
102 depends on NAND_BRCMNAND && ARCH_BCM68360
103 help
104 Enable support for broadcom nand driver on bcm68360.
105
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +0100106config NAND_BRCMNAND_6838
107 bool "Support Broadcom NAND controller on bcm6838"
108 depends on NAND_BRCMNAND && ARCH_BMIPS && SOC_BMIPS_BCM6838
109 help
110 Enable support for broadcom nand driver on bcm6838.
111
112config NAND_BRCMNAND_6858
113 bool "Support Broadcom NAND controller on bcm6858"
114 depends on NAND_BRCMNAND && ARCH_BCM6858
115 help
116 Enable support for broadcom nand driver on bcm6858.
117
118config NAND_BRCMNAND_63158
119 bool "Support Broadcom NAND controller on bcm63158"
120 depends on NAND_BRCMNAND && ARCH_BCM63158
121 help
122 Enable support for broadcom nand driver on bcm63158.
123
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200124config NAND_DAVINCI
125 bool "Support TI Davinci NAND controller"
Tom Rini98372452021-12-12 22:12:36 -0500126 select SYS_NAND_SELF_INIT if TARGET_DA850EVM
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200127 help
128 Enable this driver for NAND flash controllers available in TI Davinci
129 and Keystone2 platforms
130
Tom Rinidada0e32021-09-12 20:32:24 -0400131config KEYSTONE_RBL_NAND
132 depends on ARCH_KEYSTONE
133 def_bool y
134
Tom Rinifae1dab2021-09-22 14:50:29 -0400135config SPL_NAND_LOAD
136 def_bool y
137 depends on NAND_DAVINCI && ARCH_DAVINCI && SPL_NAND_SUPPORT
138
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200139config NAND_DENALI
140 bool
141 select SYS_NAND_SELF_INIT
142 imply CMD_NAND
143
144config NAND_DENALI_DT
145 bool "Support Denali NAND controller as a DT device"
146 select NAND_DENALI
Masahiro Yamada8fc53822020-01-30 22:07:59 +0900147 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200148 help
149 Enable the driver for NAND flash on platforms using a Denali NAND
150 controller as a DT device.
151
Tom Rinia73788c2021-09-22 14:50:37 -0400152config NAND_FSL_ELBC
153 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500154 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
155 select SPL_SYS_NAND_SELF_INIT
156 select SYS_NAND_SELF_INIT
Tom Rinia73788c2021-09-22 14:50:37 -0400157 depends on FSL_ELBC
158 help
159 Enable the Freescale Enhanced Local Bus Controller FCM NAND driver.
160
161config NAND_FSL_IFC
162 bool "Support Freescale Integrated Flash Controller NAND driver"
Tom Rini98372452021-12-12 22:12:36 -0500163 select TPL_SYS_NAND_SELF_INIT if TPL_NAND_SUPPORT
164 select SPL_SYS_NAND_SELF_INIT
165 select SYS_NAND_SELF_INIT
Tom Rini05b419e2021-12-11 14:55:49 -0500166 select FSL_IFC
Tom Rinia73788c2021-09-22 14:50:37 -0400167 help
168 Enable the Freescale Integrated Flash Controller NAND driver.
169
Tom Rini08204272021-09-22 14:50:28 -0400170config NAND_LPC32XX_MLC
171 bool "Support LPC32XX_MLC controller"
Tom Rini98372452021-12-12 22:12:36 -0500172 select SYS_NAND_SELF_INIT
Tom Rini08204272021-09-22 14:50:28 -0400173 help
174 Enable the LPC32XX MLC NAND controller.
175
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200176config NAND_LPC32XX_SLC
177 bool "Support LPC32XX_SLC controller"
178 help
179 Enable the LPC32XX SLC NAND controller.
180
181config NAND_OMAP_GPMC
182 bool "Support OMAP GPMC NAND controller"
183 depends on ARCH_OMAP2PLUS
184 help
185 Enables omap_gpmc.c driver for OMAPx and AMxxxx platforms.
186 GPMC controller is used for parallel NAND flash devices, and can
187 do ECC calculation (not ECC error detection) for HAM1, BCH4, BCH8
188 and BCH16 ECC algorithms.
189
Tom Rinif6d26d82021-09-22 14:50:39 -0400190if NAND_OMAP_GPMC
191
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200192config NAND_OMAP_GPMC_PREFETCH
193 bool "Enable GPMC Prefetch"
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200194 default y
195 help
196 On OMAP platforms that use the GPMC controller
197 (CONFIG_NAND_OMAP_GPMC_PREFETCH), this options enables the code that
198 uses the prefetch mode to speed up read operations.
199
200config NAND_OMAP_ELM
201 bool "Enable ELM driver for OMAPxx and AMxx platforms."
Tom Rinif6d26d82021-09-22 14:50:39 -0400202 depends on !OMAP34XX
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200203 help
204 ELM controller is used for ECC error detection (not ECC calculation)
205 of BCH4, BCH8 and BCH16 ECC algorithms.
206 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
207 thus such SoC platforms need to depend on software library for ECC error
208 detection. However ECC calculation on such plaforms would still be
209 done by GPMC controller.
210
Tom Rinif6d26d82021-09-22 14:50:39 -0400211choice
212 prompt "ECC scheme"
213 default NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
214 help
215 On OMAP platforms, this CONFIG specifies NAND ECC scheme.
216 It can take following values:
217 OMAP_ECC_HAM1_CODE_SW
218 1-bit Hamming code using software lib.
219 (for legacy devices only)
220 OMAP_ECC_HAM1_CODE_HW
221 1-bit Hamming code using GPMC hardware.
222 (for legacy devices only)
223 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW
224 4-bit BCH code (unsupported)
225 OMAP_ECC_BCH4_CODE_HW
226 4-bit BCH code (unsupported)
227 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
228 8-bit BCH code with
229 - ecc calculation using GPMC hardware engine,
230 - error detection using software library.
231 - requires CONFIG_BCH to enable software BCH library
232 (For legacy device which do not have ELM h/w engine)
233 OMAP_ECC_BCH8_CODE_HW
234 8-bit BCH code with
235 - ecc calculation using GPMC hardware engine,
236 - error detection using ELM hardware engine.
237 OMAP_ECC_BCH16_CODE_HW
238 16-bit BCH code with
239 - ecc calculation using GPMC hardware engine,
240 - error detection using ELM hardware engine.
241
242 How to select ECC scheme on OMAP and AMxx platforms ?
243 -----------------------------------------------------
244 Though higher ECC schemes have more capability to detect and correct
245 bit-flips, but still selection of ECC scheme is dependent on following
246 - hardware engines present in SoC.
247 Some legacy OMAP SoC do not have ELM h/w engine thus such
248 SoC cannot support BCHx_HW ECC schemes.
249 - size of OOB/Spare region
250 With higher ECC schemes, more OOB/Spare area is required to
251 store ECC. So choice of ECC scheme is limited by NAND oobsize.
252
253 In general following expression can help:
254 NAND_OOBSIZE >= 2 + (NAND_PAGESIZE / 512) * ECC_BYTES
255 where
256 NAND_OOBSIZE = number of bytes available in
257 OOB/spare area per NAND page.
258 NAND_PAGESIZE = bytes in main-area of NAND page.
259 ECC_BYTES = number of ECC bytes generated to
260 protect 512 bytes of data, which is:
261 3 for HAM1_xx ecc schemes
262 7 for BCH4_xx ecc schemes
263 14 for BCH8_xx ecc schemes
264 26 for BCH16_xx ecc schemes
265
266 example to check for BCH16 on 2K page NAND
267 NAND_PAGESIZE = 2048
268 NAND_OOBSIZE = 64
269 2 + (2048 / 512) * 26 = 106 > NAND_OOBSIZE
270 Thus BCH16 cannot be supported on 2K page NAND.
271
272 However, for 4K pagesize NAND
273 NAND_PAGESIZE = 4096
274 NAND_OOBSIZE = 224
275 ECC_BYTES = 26
276 2 + (4096 / 512) * 26 = 210 < NAND_OOBSIZE
277 Thus BCH16 can be supported on 4K page NAND.
278
279config NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
280 bool "1-bit Hamming code using software lib"
281
282config NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
283 bool "1-bit Hamming code using GPMC hardware"
284
285config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
286 bool "8-bit BCH code with HW calculation SW error detection"
287
288config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
289 bool "8-bit BCH code with HW calculation and error detection"
290
291config NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
292 bool "16-bit BCH code with HW calculation and error detection"
293
294endchoice
295
296config NAND_OMAP_ECCSCHEME
297 int
298 default 1 if NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
299 default 2 if NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
300 default 5 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
301 default 6 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
302 default 7 if NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
303 help
304 This must be kept in sync with the enum in
305 include/linux/mtd/omap_gpmc.h
306
307endif
308
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200309config NAND_VF610_NFC
310 bool "Support for Freescale NFC for VF610"
311 select SYS_NAND_SELF_INIT
Stefan Agnerbd186142018-12-06 14:57:09 +0100312 select SYS_NAND_DRIVER_ECC_LAYOUT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200313 imply CMD_NAND
314 help
315 Enables support for NAND Flash Controller on some Freescale
316 processors like the VF610, MCF54418 or Kinetis K70.
317 The driver supports a maximum 2k page size. The driver
318 currently does not support hardware ECC.
319
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100320if NAND_VF610_NFC
321
322config NAND_VF610_NFC_DT
323 bool "Support Vybrid's vf610 NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200324 depends on OF_CONTROL && DM_MTD
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100325 help
326 Enable the driver for Vybrid's vf610 NAND flash on platforms
327 using device tree.
328
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200329choice
330 prompt "Hardware ECC strength"
331 depends on NAND_VF610_NFC
332 default SYS_NAND_VF610_NFC_45_ECC_BYTES
333 help
334 Select the ECC strength used in the hardware BCH ECC block.
335
336config SYS_NAND_VF610_NFC_45_ECC_BYTES
337 bool "24-error correction (45 ECC bytes)"
338
339config SYS_NAND_VF610_NFC_60_ECC_BYTES
340 bool "32-error correction (60 ECC bytes)"
341
342endchoice
343
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100344endif
345
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200346config NAND_PXA3XX
347 bool "Support for NAND on PXA3xx and Armada 370/XP/38x"
348 select SYS_NAND_SELF_INIT
Shmuel Hazan759349e2020-10-29 08:52:18 +0200349 select DM_MTD
Shmuel Hazan58983222020-10-29 08:52:20 +0200350 select REGMAP
351 select SYSCON
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200352 imply CMD_NAND
353 help
354 This enables the driver for the NAND flash device found on
355 PXA3xx processors (NFCv1) and also on Armada 370/XP (NFCv2).
356
357config NAND_SUNXI
358 bool "Support for NAND on Allwinner SoCs"
359 default ARCH_SUNXI
360 depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I
361 select SYS_NAND_SELF_INIT
362 select SYS_NAND_U_BOOT_LOCATIONS
363 select SPL_NAND_SUPPORT
Tom Rini98372452021-12-12 22:12:36 -0500364 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200365 imply CMD_NAND
366 ---help---
367 Enable support for NAND. This option enables the standard and
368 SPL drivers.
369 The SPL driver only supports reading from the NAND using DMA
370 transfers.
371
372if NAND_SUNXI
373
374config NAND_SUNXI_SPL_ECC_STRENGTH
375 int "Allwinner NAND SPL ECC Strength"
376 default 64
377
378config NAND_SUNXI_SPL_ECC_SIZE
379 int "Allwinner NAND SPL ECC Step Size"
380 default 1024
381
382config NAND_SUNXI_SPL_USABLE_PAGE_SIZE
383 int "Allwinner NAND SPL Usable Page Size"
384 default 1024
385
386endif
387
388config NAND_ARASAN
389 bool "Configure Arasan Nand"
390 select SYS_NAND_SELF_INIT
Michal Simekc5587832020-08-19 09:59:52 +0200391 depends on DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200392 imply CMD_NAND
393 help
394 This enables Nand driver support for Arasan nand flash
395 controller. This uses the hardware ECC for read and
396 write operations.
397
398config NAND_MXC
399 bool "MXC NAND support"
400 depends on CPU_ARM926EJS || CPU_ARM1136 || MX5
401 imply CMD_NAND
402 help
403 This enables the NAND driver for the NAND flash controller on the
Haolin Lie8df55b2021-07-18 10:13:39 +0800404 i.MX27 / i.MX31 / i.MX5 processors.
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200405
406config NAND_MXS
407 bool "MXS NAND support"
Peng Fan128abf42020-05-04 22:09:00 +0800408 depends on MX23 || MX28 || MX6 || MX7 || IMX8 || IMX8M
Tom Rini98372452021-12-12 22:12:36 -0500409 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200410 select SYS_NAND_SELF_INIT
411 imply CMD_NAND
412 select APBH_DMA
Peng Fan128abf42020-05-04 22:09:00 +0800413 select APBH_DMA_BURST if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
414 select APBH_DMA_BURST8 if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200415 help
416 This enables NAND driver for the NAND flash controller on the
417 MXS processors.
418
419if NAND_MXS
420
421config NAND_MXS_DT
422 bool "Support MXS NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200423 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200424 help
425 Enable the driver for MXS NAND flash on platforms using
426 device tree.
427
428config NAND_MXS_USE_MINIMUM_ECC
429 bool "Use minimum ECC strength supported by the controller"
430 default false
431
432endif
433
Zhengxun Li01551712021-09-14 13:43:51 +0800434config NAND_MXIC
435 bool "Macronix raw NAND controller"
436 select SYS_NAND_SELF_INIT
437 help
438 This selects the Macronix raw NAND controller driver.
439
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200440config NAND_ZYNQ
441 bool "Support for Zynq Nand controller"
Tom Rini98372452021-12-12 22:12:36 -0500442 select SPL_SYS_NAND_SELF_INIT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200443 select SYS_NAND_SELF_INIT
Ashok Reddy Somabb8448a2019-12-27 04:47:12 -0700444 select DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200445 imply CMD_NAND
446 help
447 This enables Nand driver support for Nand flash controller
448 found on Zynq SoC.
449
450config NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
451 bool "Enable use of 1st stage bootloader timing for NAND"
452 depends on NAND_ZYNQ
453 help
454 This flag prevent U-boot reconfigure NAND flash controller and reuse
455 the NAND timing from 1st stage bootloader.
456
Suneel Garapati9de7d2b2020-08-26 14:37:22 +0200457config NAND_OCTEONTX
458 bool "Support for OcteonTX NAND controller"
459 select SYS_NAND_SELF_INIT
460 imply CMD_NAND
461 help
462 This enables Nand flash controller hardware found on the OcteonTX
463 processors.
464
465config NAND_OCTEONTX_HW_ECC
466 bool "Support Hardware ECC for OcteonTX NAND controller"
467 depends on NAND_OCTEONTX
468 default y
469 help
470 This enables Hardware BCH engine found on the OcteonTX processors to
471 support ECC for NAND flash controller.
472
Christophe Kerelloda141682019-04-05 11:41:50 +0200473config NAND_STM32_FMC2
474 bool "Support for NAND controller on STM32MP SoCs"
475 depends on ARCH_STM32MP
476 select SYS_NAND_SELF_INIT
477 imply CMD_NAND
478 help
479 Enables support for NAND Flash chips on SoCs containing the FMC2
480 NAND controller. This controller is found on STM32MP SoCs.
481 The controller supports a maximum 8k page size and supports
482 a maximum 8-bit correction error per sector of 512 bytes.
483
Kate Liu41ccd2e2020-12-11 13:46:12 -0800484config CORTINA_NAND
485 bool "Support for NAND controller on Cortina-Access SoCs"
486 depends on CORTINA_PLATFORM
487 select SYS_NAND_SELF_INIT
488 select DM_MTD
489 imply CMD_NAND
490 help
491 Enables support for NAND Flash chips on Coartina-Access SoCs platform
492 This controller is found on Presidio/Venus SoCs.
493 The controller supports a maximum 8k page size and supports
494 a maximum 40-bit error correction per sector of 1024 bytes.
495
Yifeng Zhao9e9021e2021-06-07 16:40:29 +0800496config ROCKCHIP_NAND
497 bool "Support for NAND controller on Rockchip SoCs"
498 depends on ARCH_ROCKCHIP
499 select SYS_NAND_SELF_INIT
500 select DM_MTD
501 imply CMD_NAND
502 help
503 Enables support for NAND Flash chips on Rockchip SoCs platform.
504 This controller is found on Rockchip SoCs.
505 There are four different versions of NAND FLASH Controllers,
506 including:
507 NFC v600: RK2928, RK3066, RK3188
508 NFC v622: RK3036, RK3128
509 NFC v800: RK3308, RV1108
510 NFC v900: PX30, RK3326
511
Tom Rini8f37ac42021-12-12 22:12:35 -0500512config TEGRA_NAND
513 bool "Support for NAND controller on Tegra SoCs"
514 depends on ARCH_TEGRA
515 select SYS_NAND_SELF_INIT
516 imply CMD_NAND
517 help
518 Enables support for NAND Flash chips on Tegra SoCs platforms.
519
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200520comment "Generic NAND options"
521
522config SYS_NAND_BLOCK_SIZE
523 hex "NAND chip eraseblock size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400524 depends on ARCH_SUNXI || SPL_NAND_SUPPORT || TPL_NAND_SUPPORT
Tom Rinid24700f2021-10-30 23:03:56 -0400525 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && !NAND_FSL_IFC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200526 help
527 Number of data bytes in one eraseblock for the NAND chip on the
528 board. This is the multiple of NAND_PAGE_SIZE and the number of
529 pages.
530
Tom Rinifdae0072021-09-22 14:50:34 -0400531config SYS_NAND_ONFI_DETECTION
532 bool "Enable detection of ONFI compliant devices during probe"
533 help
534 Enables detection of ONFI compliant devices during probe.
535 And fetching device parameters flashed on device, by parsing
536 ONFI parameter page.
537
Tom Rini2510a812021-09-22 14:50:30 -0400538config SYS_NAND_PAGE_COUNT
539 hex "NAND chip page count"
540 depends on SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC || \
541 SPL_NAND_AM33XX_BCH || SPL_NAND_LOAD || SPL_NAND_SIMPLE)
542 help
543 Number of pages in the NAND chip.
544
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200545config SYS_NAND_PAGE_SIZE
546 hex "NAND chip page size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400547 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
548 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
549 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
Tom Rinid24700f2021-10-30 23:03:56 -0400550 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200551 help
552 Number of data bytes in one page for the NAND chip on the
553 board, not including the OOB area.
554
555config SYS_NAND_OOBSIZE
556 hex "NAND chip OOB size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400557 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
558 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
559 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
Tom Rinid24700f2021-10-30 23:03:56 -0400560 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200561 help
562 Number of bytes in the Out-Of-Band area for the NAND chip on
563 the board.
564
565# Enhance depends when converting drivers to Kconfig which use this config
566# option (mxc_nand, ndfc, omap_gpmc).
567config SYS_NAND_BUSWIDTH_16BIT
568 bool "Use 16-bit NAND interface"
569 depends on NAND_VF610_NFC || NAND_OMAP_GPMC || NAND_MXC || ARCH_DAVINCI
570 help
571 Indicates that NAND device has 16-bit wide data-bus. In absence of this
572 config, bus-width of NAND device is assumed to be either 8-bit and later
573 determined by reading ONFI params.
574 Above config is useful when NAND device's bus-width information cannot
575 be determined from on-chip ONFI params, like in following scenarios:
576 - SPL boot does not support reading of ONFI parameters. This is done to
577 keep SPL code foot-print small.
578 - In current U-Boot flow using nand_init(), driver initialization
579 happens in board_nand_init() which is called before any device probe
580 (nand_scan_ident + nand_scan_tail), thus device's ONFI parameters are
581 not available while configuring controller. So a static CONFIG_NAND_xx
582 is needed to know the device's bus-width in advance.
583
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200584if SPL
585
Tom Rini8e6d9c72021-09-22 14:50:33 -0400586config SYS_NAND_5_ADDR_CYCLE
587 bool "Wait 5 address cycles during NAND commands"
588 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_SIMPLE || \
589 (SPL_NAND_SUPPORT && NAND_ATMEL)
590 default y
591 help
592 Some controllers require waiting for 5 address cycles when issuing
593 some commands, on NAND chips larger than 128MiB.
594
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400595choice
Tom Rinifdae0072021-09-22 14:50:34 -0400596 prompt "NAND bad block marker/indicator position in the OOB"
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400597 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_DENALI || SPL_NAND_SIMPLE || \
598 SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC)
599 default HAS_NAND_LARGE_BADBLOCK_POS
600 help
601 In the OOB, which position contains the badblock information.
602
603config HAS_NAND_LARGE_BADBLOCK_POS
604 bool "Set the bad block marker/indicator to the 'large' position"
605
606config HAS_NAND_SMALL_BADBLOCK_POS
607 bool "Set the bad block marker/indicator to the 'small' position"
608
609endchoice
610
611config SYS_NAND_BAD_BLOCK_POS
612 int
613 default 0 if HAS_NAND_LARGE_BADBLOCK_POS
614 default 5 if HAS_NAND_SMALL_BADBLOCK_POS
615
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200616config SYS_NAND_U_BOOT_LOCATIONS
617 bool "Define U-boot binaries locations in NAND"
618 help
619 Enable CONFIG_SYS_NAND_U_BOOT_OFFS though Kconfig.
620 This option should not be enabled when compiling U-boot for boards
621 defining CONFIG_SYS_NAND_U_BOOT_OFFS in their include/configs/<board>.h
622 file.
623
624config SYS_NAND_U_BOOT_OFFS
625 hex "Location in NAND to read U-Boot from"
626 default 0x800000 if NAND_SUNXI
627 depends on SYS_NAND_U_BOOT_LOCATIONS
628 help
629 Set the offset from the start of the nand where u-boot should be
630 loaded from.
631
632config SYS_NAND_U_BOOT_OFFS_REDUND
633 hex "Location in NAND to read U-Boot from"
634 default SYS_NAND_U_BOOT_OFFS
635 depends on SYS_NAND_U_BOOT_LOCATIONS
636 help
637 Set the offset from the start of the nand where the redundant u-boot
638 should be loaded from.
639
640config SPL_NAND_AM33XX_BCH
641 bool "Enables SPL-NAND driver which supports ELM based"
642 depends on NAND_OMAP_GPMC && !OMAP34XX
643 default y
644 help
645 Hardware ECC correction. This is useful for platforms which have ELM
646 hardware engine and use NAND boot mode.
647 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
648 so those platforms should use CONFIG_SPL_NAND_SIMPLE for enabling
649 SPL-NAND driver with software ECC correction support.
650
651config SPL_NAND_DENALI
652 bool "Support Denali NAND controller for SPL"
653 help
654 This is a small implementation of the Denali NAND controller
655 for use on SPL.
656
Masahiro Yamada64648cb2020-04-17 16:51:42 +0900657config NAND_DENALI_SPARE_AREA_SKIP_BYTES
658 int "Number of bytes skipped in OOB area"
659 depends on SPL_NAND_DENALI
660 range 0 63
661 help
662 This option specifies the number of bytes to skip from the beginning
663 of OOB area before last ECC sector data starts. This is potentially
664 used to preserve the bad block marker in the OOB area.
665
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200666config SPL_NAND_SIMPLE
667 bool "Use simple SPL NAND driver"
668 depends on !SPL_NAND_AM33XX_BCH
669 help
670 Support for NAND boot using simple NAND drivers that
671 expose the cmd_ctrl() interface.
672endif
673
674endif # if NAND