blob: da618acd873b2fef86251939f8c651c68aea566c [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
Stefan Agnerbd186142018-12-06 14:57:09 +010012config SYS_NAND_DRIVER_ECC_LAYOUT
Tom Rinid03e14e2021-12-11 14:55:54 -050013 bool "Omit standard ECC layouts to save space"
Stefan Agnerbd186142018-12-06 14:57:09 +010014 help
Tom Rinid03e14e2021-12-11 14:55:54 -050015 Omit standard ECC layouts to save space. Select this if your driver
Stefan Agnerbd186142018-12-06 14:57:09 +010016 is known to provide its own ECC layout.
17
Stefan Roese23b37f92019-08-22 12:28:04 +020018config SYS_NAND_USE_FLASH_BBT
19 bool "Enable BBT (Bad Block Table) support"
20 help
21 Enable the BBT (Bad Block Table) usage.
22
Miquel Raynal1f1ae152018-08-16 17:30:07 +020023config NAND_ATMEL
24 bool "Support Atmel NAND controller"
25 imply SYS_NAND_USE_FLASH_BBT
26 help
27 Enable this driver for NAND flash platforms using an Atmel NAND
28 controller.
29
Derald D. Woods7830fc52018-12-15 01:36:46 -060030if NAND_ATMEL
31
32config ATMEL_NAND_HWECC
33 bool "Atmel Hardware ECC"
Derald D. Woods7830fc52018-12-15 01:36:46 -060034
35config ATMEL_NAND_HW_PMECC
36 bool "Atmel Programmable Multibit ECC (PMECC)"
37 select ATMEL_NAND_HWECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060038 help
39 The Programmable Multibit ECC (PMECC) controller is a programmable
40 binary BCH(Bose, Chaudhuri and Hocquenghem) encoder and decoder.
41
42config PMECC_CAP
43 int "PMECC Correctable ECC Bits"
44 depends on ATMEL_NAND_HW_PMECC
45 default 2
46 help
47 Correctable ECC bits, can be 2, 4, 8, 12, and 24.
48
49config PMECC_SECTOR_SIZE
50 int "PMECC Sector Size"
51 depends on ATMEL_NAND_HW_PMECC
52 default 512
53 help
54 Sector size, in bytes, can be 512 or 1024.
55
56config SPL_GENERATE_ATMEL_PMECC_HEADER
57 bool "Atmel PMECC Header Generation"
58 select ATMEL_NAND_HWECC
59 select ATMEL_NAND_HW_PMECC
Derald D. Woods7830fc52018-12-15 01:36:46 -060060 help
61 Generate Programmable Multibit ECC (PMECC) header for SPL image.
62
63endif
64
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +010065config NAND_BRCMNAND
66 bool "Support Broadcom NAND controller"
Miquel Raynala903be42019-10-03 19:50:04 +020067 depends on OF_CONTROL && DM && DM_MTD
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +010068 help
69 Enable the driver for NAND flash on platforms using a Broadcom NAND
70 controller.
71
Álvaro Fernández Rojasd9f9bfc2019-08-28 19:12:15 +020072config NAND_BRCMNAND_6368
73 bool "Support Broadcom NAND controller on bcm6368"
74 depends on NAND_BRCMNAND && ARCH_BMIPS
75 help
76 Enable support for broadcom nand driver on bcm6368.
77
Philippe Reynes74ead742020-01-07 20:14:13 +010078config NAND_BRCMNAND_68360
79 bool "Support Broadcom NAND controller on bcm68360"
80 depends on NAND_BRCMNAND && ARCH_BCM68360
81 help
82 Enable support for broadcom nand driver on bcm68360.
83
Philippe Reynes5aa6cfb2019-03-15 15:14:36 +010084config NAND_BRCMNAND_6838
85 bool "Support Broadcom NAND controller on bcm6838"
86 depends on NAND_BRCMNAND && ARCH_BMIPS && SOC_BMIPS_BCM6838
87 help
88 Enable support for broadcom nand driver on bcm6838.
89
90config NAND_BRCMNAND_6858
91 bool "Support Broadcom NAND controller on bcm6858"
92 depends on NAND_BRCMNAND && ARCH_BCM6858
93 help
94 Enable support for broadcom nand driver on bcm6858.
95
96config NAND_BRCMNAND_63158
97 bool "Support Broadcom NAND controller on bcm63158"
98 depends on NAND_BRCMNAND && ARCH_BCM63158
99 help
100 Enable support for broadcom nand driver on bcm63158.
101
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200102config NAND_DAVINCI
103 bool "Support TI Davinci NAND controller"
104 help
105 Enable this driver for NAND flash controllers available in TI Davinci
106 and Keystone2 platforms
107
Tom Rinidada0e32021-09-12 20:32:24 -0400108config KEYSTONE_RBL_NAND
109 depends on ARCH_KEYSTONE
110 def_bool y
111
Tom Rinifae1dab2021-09-22 14:50:29 -0400112config SPL_NAND_LOAD
113 def_bool y
114 depends on NAND_DAVINCI && ARCH_DAVINCI && SPL_NAND_SUPPORT
115
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200116config NAND_DENALI
117 bool
118 select SYS_NAND_SELF_INIT
119 imply CMD_NAND
120
121config NAND_DENALI_DT
122 bool "Support Denali NAND controller as a DT device"
123 select NAND_DENALI
Masahiro Yamada8fc53822020-01-30 22:07:59 +0900124 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200125 help
126 Enable the driver for NAND flash on platforms using a Denali NAND
127 controller as a DT device.
128
Tom Rinia73788c2021-09-22 14:50:37 -0400129config NAND_FSL_ELBC
130 bool "Support Freescale Enhanced Local Bus Controller FCM NAND driver"
131 depends on FSL_ELBC
132 help
133 Enable the Freescale Enhanced Local Bus Controller FCM NAND driver.
134
135config NAND_FSL_IFC
136 bool "Support Freescale Integrated Flash Controller NAND driver"
Tom Rini05b419e2021-12-11 14:55:49 -0500137 select FSL_IFC
Tom Rinia73788c2021-09-22 14:50:37 -0400138 help
139 Enable the Freescale Integrated Flash Controller NAND driver.
140
Tom Rini08204272021-09-22 14:50:28 -0400141config NAND_LPC32XX_MLC
142 bool "Support LPC32XX_MLC controller"
143 help
144 Enable the LPC32XX MLC NAND controller.
145
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200146config NAND_LPC32XX_SLC
147 bool "Support LPC32XX_SLC controller"
148 help
149 Enable the LPC32XX SLC NAND controller.
150
151config NAND_OMAP_GPMC
152 bool "Support OMAP GPMC NAND controller"
153 depends on ARCH_OMAP2PLUS
154 help
155 Enables omap_gpmc.c driver for OMAPx and AMxxxx platforms.
156 GPMC controller is used for parallel NAND flash devices, and can
157 do ECC calculation (not ECC error detection) for HAM1, BCH4, BCH8
158 and BCH16 ECC algorithms.
159
Tom Rinif6d26d82021-09-22 14:50:39 -0400160if NAND_OMAP_GPMC
161
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200162config NAND_OMAP_GPMC_PREFETCH
163 bool "Enable GPMC Prefetch"
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200164 default y
165 help
166 On OMAP platforms that use the GPMC controller
167 (CONFIG_NAND_OMAP_GPMC_PREFETCH), this options enables the code that
168 uses the prefetch mode to speed up read operations.
169
170config NAND_OMAP_ELM
171 bool "Enable ELM driver for OMAPxx and AMxx platforms."
Tom Rinif6d26d82021-09-22 14:50:39 -0400172 depends on !OMAP34XX
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200173 help
174 ELM controller is used for ECC error detection (not ECC calculation)
175 of BCH4, BCH8 and BCH16 ECC algorithms.
176 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
177 thus such SoC platforms need to depend on software library for ECC error
178 detection. However ECC calculation on such plaforms would still be
179 done by GPMC controller.
180
Tom Rinif6d26d82021-09-22 14:50:39 -0400181choice
182 prompt "ECC scheme"
183 default NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
184 help
185 On OMAP platforms, this CONFIG specifies NAND ECC scheme.
186 It can take following values:
187 OMAP_ECC_HAM1_CODE_SW
188 1-bit Hamming code using software lib.
189 (for legacy devices only)
190 OMAP_ECC_HAM1_CODE_HW
191 1-bit Hamming code using GPMC hardware.
192 (for legacy devices only)
193 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW
194 4-bit BCH code (unsupported)
195 OMAP_ECC_BCH4_CODE_HW
196 4-bit BCH code (unsupported)
197 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW
198 8-bit BCH code with
199 - ecc calculation using GPMC hardware engine,
200 - error detection using software library.
201 - requires CONFIG_BCH to enable software BCH library
202 (For legacy device which do not have ELM h/w engine)
203 OMAP_ECC_BCH8_CODE_HW
204 8-bit BCH code with
205 - ecc calculation using GPMC hardware engine,
206 - error detection using ELM hardware engine.
207 OMAP_ECC_BCH16_CODE_HW
208 16-bit BCH code with
209 - ecc calculation using GPMC hardware engine,
210 - error detection using ELM hardware engine.
211
212 How to select ECC scheme on OMAP and AMxx platforms ?
213 -----------------------------------------------------
214 Though higher ECC schemes have more capability to detect and correct
215 bit-flips, but still selection of ECC scheme is dependent on following
216 - hardware engines present in SoC.
217 Some legacy OMAP SoC do not have ELM h/w engine thus such
218 SoC cannot support BCHx_HW ECC schemes.
219 - size of OOB/Spare region
220 With higher ECC schemes, more OOB/Spare area is required to
221 store ECC. So choice of ECC scheme is limited by NAND oobsize.
222
223 In general following expression can help:
224 NAND_OOBSIZE >= 2 + (NAND_PAGESIZE / 512) * ECC_BYTES
225 where
226 NAND_OOBSIZE = number of bytes available in
227 OOB/spare area per NAND page.
228 NAND_PAGESIZE = bytes in main-area of NAND page.
229 ECC_BYTES = number of ECC bytes generated to
230 protect 512 bytes of data, which is:
231 3 for HAM1_xx ecc schemes
232 7 for BCH4_xx ecc schemes
233 14 for BCH8_xx ecc schemes
234 26 for BCH16_xx ecc schemes
235
236 example to check for BCH16 on 2K page NAND
237 NAND_PAGESIZE = 2048
238 NAND_OOBSIZE = 64
239 2 + (2048 / 512) * 26 = 106 > NAND_OOBSIZE
240 Thus BCH16 cannot be supported on 2K page NAND.
241
242 However, for 4K pagesize NAND
243 NAND_PAGESIZE = 4096
244 NAND_OOBSIZE = 224
245 ECC_BYTES = 26
246 2 + (4096 / 512) * 26 = 210 < NAND_OOBSIZE
247 Thus BCH16 can be supported on 4K page NAND.
248
249config NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
250 bool "1-bit Hamming code using software lib"
251
252config NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
253 bool "1-bit Hamming code using GPMC hardware"
254
255config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
256 bool "8-bit BCH code with HW calculation SW error detection"
257
258config NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
259 bool "8-bit BCH code with HW calculation and error detection"
260
261config NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
262 bool "16-bit BCH code with HW calculation and error detection"
263
264endchoice
265
266config NAND_OMAP_ECCSCHEME
267 int
268 default 1 if NAND_OMAP_ECCSCHEME_HAM1_CODE_SW
269 default 2 if NAND_OMAP_ECCSCHEME_HAM1_CODE_HW
270 default 5 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW_DETECTION_SW
271 default 6 if NAND_OMAP_ECCSCHEME_BCH8_CODE_HW
272 default 7 if NAND_OMAP_ECCSCHEME_BCH16_CODE_HW
273 help
274 This must be kept in sync with the enum in
275 include/linux/mtd/omap_gpmc.h
276
277endif
278
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200279config NAND_VF610_NFC
280 bool "Support for Freescale NFC for VF610"
281 select SYS_NAND_SELF_INIT
Stefan Agnerbd186142018-12-06 14:57:09 +0100282 select SYS_NAND_DRIVER_ECC_LAYOUT
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200283 imply CMD_NAND
284 help
285 Enables support for NAND Flash Controller on some Freescale
286 processors like the VF610, MCF54418 or Kinetis K70.
287 The driver supports a maximum 2k page size. The driver
288 currently does not support hardware ECC.
289
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100290if NAND_VF610_NFC
291
292config NAND_VF610_NFC_DT
293 bool "Support Vybrid's vf610 NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200294 depends on OF_CONTROL && DM_MTD
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100295 help
296 Enable the driver for Vybrid's vf610 NAND flash on platforms
297 using device tree.
298
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200299choice
300 prompt "Hardware ECC strength"
301 depends on NAND_VF610_NFC
302 default SYS_NAND_VF610_NFC_45_ECC_BYTES
303 help
304 Select the ECC strength used in the hardware BCH ECC block.
305
306config SYS_NAND_VF610_NFC_45_ECC_BYTES
307 bool "24-error correction (45 ECC bytes)"
308
309config SYS_NAND_VF610_NFC_60_ECC_BYTES
310 bool "32-error correction (60 ECC bytes)"
311
312endchoice
313
Lukasz Majewskif006cb32018-12-03 10:24:50 +0100314endif
315
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200316config NAND_PXA3XX
317 bool "Support for NAND on PXA3xx and Armada 370/XP/38x"
318 select SYS_NAND_SELF_INIT
Shmuel Hazan759349e2020-10-29 08:52:18 +0200319 select DM_MTD
Shmuel Hazan58983222020-10-29 08:52:20 +0200320 select REGMAP
321 select SYSCON
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200322 imply CMD_NAND
323 help
324 This enables the driver for the NAND flash device found on
325 PXA3xx processors (NFCv1) and also on Armada 370/XP (NFCv2).
326
327config NAND_SUNXI
328 bool "Support for NAND on Allwinner SoCs"
329 default ARCH_SUNXI
330 depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I
331 select SYS_NAND_SELF_INIT
332 select SYS_NAND_U_BOOT_LOCATIONS
333 select SPL_NAND_SUPPORT
334 imply CMD_NAND
335 ---help---
336 Enable support for NAND. This option enables the standard and
337 SPL drivers.
338 The SPL driver only supports reading from the NAND using DMA
339 transfers.
340
341if NAND_SUNXI
342
343config NAND_SUNXI_SPL_ECC_STRENGTH
344 int "Allwinner NAND SPL ECC Strength"
345 default 64
346
347config NAND_SUNXI_SPL_ECC_SIZE
348 int "Allwinner NAND SPL ECC Step Size"
349 default 1024
350
351config NAND_SUNXI_SPL_USABLE_PAGE_SIZE
352 int "Allwinner NAND SPL Usable Page Size"
353 default 1024
354
355endif
356
357config NAND_ARASAN
358 bool "Configure Arasan Nand"
359 select SYS_NAND_SELF_INIT
Michal Simekc5587832020-08-19 09:59:52 +0200360 depends on DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200361 imply CMD_NAND
362 help
363 This enables Nand driver support for Arasan nand flash
364 controller. This uses the hardware ECC for read and
365 write operations.
366
367config NAND_MXC
368 bool "MXC NAND support"
369 depends on CPU_ARM926EJS || CPU_ARM1136 || MX5
370 imply CMD_NAND
371 help
372 This enables the NAND driver for the NAND flash controller on the
Haolin Lie8df55b2021-07-18 10:13:39 +0800373 i.MX27 / i.MX31 / i.MX5 processors.
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200374
375config NAND_MXS
376 bool "MXS NAND support"
Peng Fan128abf42020-05-04 22:09:00 +0800377 depends on MX23 || MX28 || MX6 || MX7 || IMX8 || IMX8M
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200378 select SYS_NAND_SELF_INIT
379 imply CMD_NAND
380 select APBH_DMA
Peng Fan128abf42020-05-04 22:09:00 +0800381 select APBH_DMA_BURST if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
382 select APBH_DMA_BURST8 if ARCH_MX6 || ARCH_MX7 || ARCH_IMX8 || ARCH_IMX8M
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200383 help
384 This enables NAND driver for the NAND flash controller on the
385 MXS processors.
386
387if NAND_MXS
388
389config NAND_MXS_DT
390 bool "Support MXS NAND controller as a DT device"
Miquel Raynala903be42019-10-03 19:50:04 +0200391 depends on OF_CONTROL && DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200392 help
393 Enable the driver for MXS NAND flash on platforms using
394 device tree.
395
396config NAND_MXS_USE_MINIMUM_ECC
397 bool "Use minimum ECC strength supported by the controller"
398 default false
399
400endif
401
Zhengxun Li01551712021-09-14 13:43:51 +0800402config NAND_MXIC
403 bool "Macronix raw NAND controller"
404 select SYS_NAND_SELF_INIT
405 help
406 This selects the Macronix raw NAND controller driver.
407
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200408config NAND_ZYNQ
409 bool "Support for Zynq Nand controller"
410 select SYS_NAND_SELF_INIT
Ashok Reddy Somabb8448a2019-12-27 04:47:12 -0700411 select DM_MTD
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200412 imply CMD_NAND
413 help
414 This enables Nand driver support for Nand flash controller
415 found on Zynq SoC.
416
417config NAND_ZYNQ_USE_BOOTLOADER1_TIMINGS
418 bool "Enable use of 1st stage bootloader timing for NAND"
419 depends on NAND_ZYNQ
420 help
421 This flag prevent U-boot reconfigure NAND flash controller and reuse
422 the NAND timing from 1st stage bootloader.
423
Suneel Garapati9de7d2b2020-08-26 14:37:22 +0200424config NAND_OCTEONTX
425 bool "Support for OcteonTX NAND controller"
426 select SYS_NAND_SELF_INIT
427 imply CMD_NAND
428 help
429 This enables Nand flash controller hardware found on the OcteonTX
430 processors.
431
432config NAND_OCTEONTX_HW_ECC
433 bool "Support Hardware ECC for OcteonTX NAND controller"
434 depends on NAND_OCTEONTX
435 default y
436 help
437 This enables Hardware BCH engine found on the OcteonTX processors to
438 support ECC for NAND flash controller.
439
Christophe Kerelloda141682019-04-05 11:41:50 +0200440config NAND_STM32_FMC2
441 bool "Support for NAND controller on STM32MP SoCs"
442 depends on ARCH_STM32MP
443 select SYS_NAND_SELF_INIT
444 imply CMD_NAND
445 help
446 Enables support for NAND Flash chips on SoCs containing the FMC2
447 NAND controller. This controller is found on STM32MP SoCs.
448 The controller supports a maximum 8k page size and supports
449 a maximum 8-bit correction error per sector of 512 bytes.
450
Kate Liu41ccd2e2020-12-11 13:46:12 -0800451config CORTINA_NAND
452 bool "Support for NAND controller on Cortina-Access SoCs"
453 depends on CORTINA_PLATFORM
454 select SYS_NAND_SELF_INIT
455 select DM_MTD
456 imply CMD_NAND
457 help
458 Enables support for NAND Flash chips on Coartina-Access SoCs platform
459 This controller is found on Presidio/Venus SoCs.
460 The controller supports a maximum 8k page size and supports
461 a maximum 40-bit error correction per sector of 1024 bytes.
462
Yifeng Zhao9e9021e2021-06-07 16:40:29 +0800463config ROCKCHIP_NAND
464 bool "Support for NAND controller on Rockchip SoCs"
465 depends on ARCH_ROCKCHIP
466 select SYS_NAND_SELF_INIT
467 select DM_MTD
468 imply CMD_NAND
469 help
470 Enables support for NAND Flash chips on Rockchip SoCs platform.
471 This controller is found on Rockchip SoCs.
472 There are four different versions of NAND FLASH Controllers,
473 including:
474 NFC v600: RK2928, RK3066, RK3188
475 NFC v622: RK3036, RK3128
476 NFC v800: RK3308, RV1108
477 NFC v900: PX30, RK3326
478
Tom Rini8f37ac42021-12-12 22:12:35 -0500479config TEGRA_NAND
480 bool "Support for NAND controller on Tegra SoCs"
481 depends on ARCH_TEGRA
482 select SYS_NAND_SELF_INIT
483 imply CMD_NAND
484 help
485 Enables support for NAND Flash chips on Tegra SoCs platforms.
486
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200487comment "Generic NAND options"
488
489config SYS_NAND_BLOCK_SIZE
490 hex "NAND chip eraseblock size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400491 depends on ARCH_SUNXI || SPL_NAND_SUPPORT || TPL_NAND_SUPPORT
Tom Rinid24700f2021-10-30 23:03:56 -0400492 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC && !NAND_FSL_IFC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200493 help
494 Number of data bytes in one eraseblock for the NAND chip on the
495 board. This is the multiple of NAND_PAGE_SIZE and the number of
496 pages.
497
Tom Rinifdae0072021-09-22 14:50:34 -0400498config SYS_NAND_ONFI_DETECTION
499 bool "Enable detection of ONFI compliant devices during probe"
500 help
501 Enables detection of ONFI compliant devices during probe.
502 And fetching device parameters flashed on device, by parsing
503 ONFI parameter page.
504
Tom Rini2510a812021-09-22 14:50:30 -0400505config SYS_NAND_PAGE_COUNT
506 hex "NAND chip page count"
507 depends on SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC || \
508 SPL_NAND_AM33XX_BCH || SPL_NAND_LOAD || SPL_NAND_SIMPLE)
509 help
510 Number of pages in the NAND chip.
511
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200512config SYS_NAND_PAGE_SIZE
513 hex "NAND chip page size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400514 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
515 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
516 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
Tom Rinid24700f2021-10-30 23:03:56 -0400517 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200518 help
519 Number of data bytes in one page for the NAND chip on the
520 board, not including the OOB area.
521
522config SYS_NAND_OOBSIZE
523 hex "NAND chip OOB size"
Tom Rinifae1dab2021-09-22 14:50:29 -0400524 depends on ARCH_SUNXI || NAND_OMAP_GPMC || NAND_LPC32XX_SLC || \
525 SPL_NAND_SIMPLE || (NAND_MXC && SPL_NAND_SUPPORT) || \
526 (NAND_ATMEL && SPL_NAND_SUPPORT) || SPL_GENERATE_ATMEL_PMECC_HEADER
Tom Rinid24700f2021-10-30 23:03:56 -0400527 depends on !NAND_MXS && !NAND_DENALI_DT && !NAND_LPC32XX_MLC
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200528 help
529 Number of bytes in the Out-Of-Band area for the NAND chip on
530 the board.
531
532# Enhance depends when converting drivers to Kconfig which use this config
533# option (mxc_nand, ndfc, omap_gpmc).
534config SYS_NAND_BUSWIDTH_16BIT
535 bool "Use 16-bit NAND interface"
536 depends on NAND_VF610_NFC || NAND_OMAP_GPMC || NAND_MXC || ARCH_DAVINCI
537 help
538 Indicates that NAND device has 16-bit wide data-bus. In absence of this
539 config, bus-width of NAND device is assumed to be either 8-bit and later
540 determined by reading ONFI params.
541 Above config is useful when NAND device's bus-width information cannot
542 be determined from on-chip ONFI params, like in following scenarios:
543 - SPL boot does not support reading of ONFI parameters. This is done to
544 keep SPL code foot-print small.
545 - In current U-Boot flow using nand_init(), driver initialization
546 happens in board_nand_init() which is called before any device probe
547 (nand_scan_ident + nand_scan_tail), thus device's ONFI parameters are
548 not available while configuring controller. So a static CONFIG_NAND_xx
549 is needed to know the device's bus-width in advance.
550
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200551if SPL
552
Tom Rini8e6d9c72021-09-22 14:50:33 -0400553config SYS_NAND_5_ADDR_CYCLE
554 bool "Wait 5 address cycles during NAND commands"
555 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_SIMPLE || \
556 (SPL_NAND_SUPPORT && NAND_ATMEL)
557 default y
558 help
559 Some controllers require waiting for 5 address cycles when issuing
560 some commands, on NAND chips larger than 128MiB.
561
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400562choice
Tom Rinifdae0072021-09-22 14:50:34 -0400563 prompt "NAND bad block marker/indicator position in the OOB"
Tom Rinia2fbd4a2021-09-22 14:50:32 -0400564 depends on SPL_NAND_AM33XX_BCH || SPL_NAND_DENALI || SPL_NAND_SIMPLE || \
565 SPL_NAND_SUPPORT && (NAND_ATMEL || NAND_MXC)
566 default HAS_NAND_LARGE_BADBLOCK_POS
567 help
568 In the OOB, which position contains the badblock information.
569
570config HAS_NAND_LARGE_BADBLOCK_POS
571 bool "Set the bad block marker/indicator to the 'large' position"
572
573config HAS_NAND_SMALL_BADBLOCK_POS
574 bool "Set the bad block marker/indicator to the 'small' position"
575
576endchoice
577
578config SYS_NAND_BAD_BLOCK_POS
579 int
580 default 0 if HAS_NAND_LARGE_BADBLOCK_POS
581 default 5 if HAS_NAND_SMALL_BADBLOCK_POS
582
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200583config SYS_NAND_U_BOOT_LOCATIONS
584 bool "Define U-boot binaries locations in NAND"
585 help
586 Enable CONFIG_SYS_NAND_U_BOOT_OFFS though Kconfig.
587 This option should not be enabled when compiling U-boot for boards
588 defining CONFIG_SYS_NAND_U_BOOT_OFFS in their include/configs/<board>.h
589 file.
590
591config SYS_NAND_U_BOOT_OFFS
592 hex "Location in NAND to read U-Boot from"
593 default 0x800000 if NAND_SUNXI
594 depends on SYS_NAND_U_BOOT_LOCATIONS
595 help
596 Set the offset from the start of the nand where u-boot should be
597 loaded from.
598
599config SYS_NAND_U_BOOT_OFFS_REDUND
600 hex "Location in NAND to read U-Boot from"
601 default SYS_NAND_U_BOOT_OFFS
602 depends on SYS_NAND_U_BOOT_LOCATIONS
603 help
604 Set the offset from the start of the nand where the redundant u-boot
605 should be loaded from.
606
607config SPL_NAND_AM33XX_BCH
608 bool "Enables SPL-NAND driver which supports ELM based"
609 depends on NAND_OMAP_GPMC && !OMAP34XX
610 default y
611 help
612 Hardware ECC correction. This is useful for platforms which have ELM
613 hardware engine and use NAND boot mode.
614 Some legacy platforms like OMAP3xx do not have in-built ELM h/w engine,
615 so those platforms should use CONFIG_SPL_NAND_SIMPLE for enabling
616 SPL-NAND driver with software ECC correction support.
617
618config SPL_NAND_DENALI
619 bool "Support Denali NAND controller for SPL"
620 help
621 This is a small implementation of the Denali NAND controller
622 for use on SPL.
623
Masahiro Yamada64648cb2020-04-17 16:51:42 +0900624config NAND_DENALI_SPARE_AREA_SKIP_BYTES
625 int "Number of bytes skipped in OOB area"
626 depends on SPL_NAND_DENALI
627 range 0 63
628 help
629 This option specifies the number of bytes to skip from the beginning
630 of OOB area before last ECC sector data starts. This is potentially
631 used to preserve the bad block marker in the OOB area.
632
Miquel Raynal1f1ae152018-08-16 17:30:07 +0200633config SPL_NAND_SIMPLE
634 bool "Use simple SPL NAND driver"
635 depends on !SPL_NAND_AM33XX_BCH
636 help
637 Support for NAND boot using simple NAND drivers that
638 expose the cmd_ctrl() interface.
639endif
640
641endif # if NAND