summaryrefslogtreecommitdiff
path: root/nuttx/drivers/mtd/Kconfig
blob: 0f4d0ae0e11221d9a438bb7a72e4c8678ea190eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
#
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#

comment "MTD Configuration"

config MTD_PARTITION
	bool "Support MTD partitions"
	default n
	---help---
		MTD partitions are build as MTD drivers that manage a sub-region
		of the FLASH memory.  The contain the original FLASH MTD driver and
		simply manage all accesses to assure that (1) FLASH accesses are
		always offset to the beginning of the partition, and (2) that FLASH
		accesses do not extend outside of the partition.

		A FLASH device may be broken up into several partitions managed,
		each managed by a separate MTD driver.  The MTD parition interface
		is described in:

			include/nuttx/mtd/mtd.h
			FAR struct mtd_dev_s *mtd_partition(FAR struct mtd_dev_s *mtd, off_t offset, off_t nblocks);

		Each call to mtd_partition() will create a new MTD driver instance
		managing the sub-region of flash beginning at 'offset' (in blocks)
		and of size 'nblocks' on the device specified by 'mtd'.

config FTL_WRITEBUFFER
	bool "Enable write buffering in the FTL layer"
	default n
	depends on DRVR_WRITEBUFFER

config FTL_READAHEAD
	bool "Enable read-ahead buffering in the FTL layer"
	default n
	depends on DRVR_READAHEAD

config MTD_SECT512
	bool "512B sector conversion"
	default n
	---help---
		If enabled, a MTD driver will be created that will convert the
		sector size of any other MTD driver to a 512 byte "apparent" sector
		size.  The managed MTD driver in this case must have an erase block
		size that is greater than 512B and an event multiple of 512B.

if MTD_SECT512

config MTD_SECT512_ERASED_STATE
	hex "Erased state of the FLASH"
	default 0xff

config MTD_SECT512_READONLY
	bool "512B read-only"
	default n

endif # MTD_SECT512

config MTD_PARTITION_NAMES
	bool "Support MTD partition naming"
	depends on FS_PROCFS
	depends on MTD_PARTITION
	default n
	---help---
		MTD partitions can be assigned a name for reporting via the procfs
		file system interface.  This adds an API which must be called to
		specify the partition name.

config MTD_BYTE_WRITE
	bool "Byte write"
	default n
	---help---
		Some devices (such as the EON EN25F80) support writing an arbitrary
		number of bytes to FLASH. This setting enables MTD interfaces to
		support such writes.  The SMART file system can take advantage of
		this option if it is enabled.

config MTD_WRBUFFER
	bool "Enable MTD write buffering"
	default n
	depends on DRVR_WRITEBUFFER
	select DRVR_INVALIDATE
	select DRVR_READBYTES
	---help---
		Build the mtd_rwbuffer layer and enable support for write buffering.

if MTD_WRBUFFER

config MTD_NWRBLOCKS
	int "MTD write buffer size"
	default 4
	---help---
		The size of the MTD write buffer (in blocks)

endif # MTD_WRBUFFER

config MTD_READAHEAD
	bool "Enable MTD read-ahead buffering"
	default n
	depends on DRVR_READAHEAD
	select DRVR_INVALIDATE
	select DRVR_READBYTES
	---help---
		Build the mtd_rwbuffer layer and enable support for read-ahead buffering.

if MTD_READAHEAD

config MTD_NRDBLOCKS
	int "MTD read-head buffer size"
	default 4
	---help---
		The size of the MTD read-ahead buffer (in blocks)

endif # MTD_READAHEAD

config MTD_CONFIG
	bool "Enable Dev Config (MTD based) device"
	default n
	---help---
		Provides a /dev/config device for saving / restoring application
		configuration data to a standard MTD device or partition.

if MTD_CONFIG

config MTD_CONFIG_RAM_CONSOLIDATE
	bool "Always use RAM consolidation method (work in progress)"
	default n
	---help---
		When the MTD device used for /dev/config contains more than one
		erase block, the "unused entry" consolidation reserves one erase
		block by default for cleanup purposes.  This consumes the minimum
		amount of RAM, however it "wastes" one erase block on the device.
		(For configurations that have only a single erase block assigned
		to the config device, RAM consolidation is the ONLY option.)

		Another apporach is to allow the driver to use the entire MTD
		device (or partition) to save config data, and then allocate a
		RAM buffer (the size of one erase block) to perform the
		consolidation.  Enabling this feature basically trades off RAM
		usage for FLASH usage.  If the MTD device used for config data
		has small erase sizes (4K, etc.) and there is plenty of free RAM
		available, then this is probably a good option.

		Another benefit of this option is it reduces code space a bit
		since the "reserved block" consolidate routine is not needed.

config MTD_CONFIG_ERASEDVALUE
	hex "Erased value of bytes on the MTD device"
	default 0xff
	---help---
		Specifies the value of the erased state of the MTD FLASH.  For
		most FLASH parts, this is 0xff, but could also be zero depending
		on the device.

endif # MTD_CONFIG

comment "MTD Device Drivers"

menuconfig MTD_NAND
	bool "MTD NAND support"
	default n
	---help---
		Enable support for NAND FLASH devices.

if MTD_NAND

config MTD_NAND_MAXNUMBLOCKS
	int "Max blocks"
	default 1024
	---help---
		Maximum number of blocks in a device

config MTD_NAND_MAXNUMPAGESPERBLOCK
	int "Max pages per block"
	default 256
	---help---
		Maximum number of pages in one block

config MTD_NAND_MAXPAGEDATASIZE
	int "Max page size"
	default 4096
	---help---
		Maximum size of the data area of one page, in bytes.

config MTD_NAND_MAXPAGESPARESIZE
	int "Max size of spare area"
	default 256
	---help---
		Maximum size of the spare area of one page, in bytes.

config MTD_NAND_MAXSPAREECCBYTES
	int "Max number of ECC bytes"
	default 48
	---help---
		Maximum number of ECC bytes stored in the spare for one single page.

config MTD_NAND_BLOCKCHECK
	bool "Block check"
	default y
	---help---
		Enable support for ECC and bad block checking.

config MTD_NAND_SWECC
	bool "Sofware ECC support"
	default n if ARCH_NAND_HWECC
	default y if !ARCH_NAND_HWECC
	---help---
		Build in logic to support software calculation of ECC.

config MTD_NAND_HWECC
	bool "Hardware ECC support"
	default n
	depends on ARCH_NAND_HWECC
	---help---
		Build in logic to support hardware calculation of ECC.

config MTD_NAND_MAXSPAREEXTRABYTES
	int "Max extra free bytes"
	default 206
	---help---
		Maximum number of extra free bytes inside the spare area of a page.

config MTD_NAND_EMBEDDEDECC
	bool "Support devices with Embedded ECC"
	default n
	---help---
		Some NAND devices have internal, embedded ECC function.  One (the
		only one supported) is Micron, 4-bit ECC, device size = 1Gb or 2Gb
		or 4Gb.

endif # MTD_NAND

config RAMMTD
	bool "RAM-based MTD driver"
	default n
	---help---
		Build support for a RAM-based MTD driver.

if RAMMTD

config RAMMTD_BLOCKSIZE
	int "RAM MTD block size"
	default 512

config RAMMTD_ERASESIZE
	int "RAM MTD erase block size"
	default 4096

config RAMMTD_ERASESTATE
	hex "Simulated erase state"
	default 0xff

config RAMMTD_FLASHSIM
	bool "RAM MTD FLASH Simulation"
	default n
	---help---
		RAMMTD_FLASHSIM will add some extra logic to improve the level of
		FLASH simulation.

endif

config MTD_AT24XX
	bool "I2C-based AT24xx eeprom"
	default n
	select I2C
	---help---
		Build support for I2C-based AT24CXX EEPROM(at24c32, at24c64,
		at24c128, at24c256)

if MTD_AT24XX

config AT24XX_SIZE
	int "AT24xx size (kbit)"
	default 64
		---help---
		This is the XX in the AT24Cxx part number.  For example, if you have a
		AT 24C512, then the correct value is 512.  This value is also the capacity
		of the part in kilobits.  For example, the 24C512 supports 512 Kbits or
		512 /8 = 64 KiB.

config AT24XX_ADDR
	hex "AT24XX I2C address"
	default 0x50
	range 0x50 0x57

endif

config MTD_AT25
	bool "SPI-based AT25 FLASH"
	default n
	select SPI

if MTD_AT25

config AT25_SPIMODE
	int "AT25 SPI Mode"
	default 0

config AT25_SPIFREQUENCY
	int "AT25 SPI Frequency"
	default 20000000

endif

config MTD_AT45DB
	bool "SPI-based AT45DB flash"
	default n
	select SPI

if MTD_AT45DB

config AT45DB_FREQUENCY
	int "AT45DB frequency"
	default 1000000

config AT45DB_PREWAIT
	bool "Enable higher performance write logic"
	default y

config AT45DB_PWRSAVE
	bool "Enable power save"
	default n

endif

config MTD_M25P
	bool "SPI-based M25P FLASH"
	default n
	select SPI

if MTD_M25P

config M25P_SPIMODE
	int "M25P SPI mode"
	default 0

config M25P_MANUFACTURER
	hex "M25P manufacturers ID"
	default 0x20
	---help---
		Various manufacturers may have produced the parts.  0x20 is the manufacturer ID
		for the STMicro MP25x serial FLASH.  If, for example, you are using the a Macronix
		International MX25 serial FLASH, the correct manufacturer ID would be 0xc2.

config M25P_MEMORY_TYPE
	hex "M25P memory type ID"
	default 0x20
	---help---
		The memory type for M25 "P" series is 0x20, but the driver also supports "F" series
		devices, such as the EON EN25F80 part which adds a 4K sector erase capability.  The
		memory type for "F" series parts from EON is 0x31.  The 4K sector erase size will
		automatically be enabled when filesytems that can use it are enabled, such as SMART.

config M25P_SUBSECTOR_ERASE
	bool "Sub-Sector Erase"
	default n
	---help---
		Some devices (such as the EON EN25F80) support a smaller erase block
		size (4K vs 64K).  This option enables support for sub-sector erase.
		The SMART file system can take advantage of this option if it is enabled.

endif

config MTD_SMART
	bool "Sector Mapped Allocation for Really Tiny (SMART) Flash support"
	default n
	---help---
		The MP25x series of Flash devices are typically very small and have a very large
		erase block size.  This causes issues with the standard Flash Translation Layer
		block driver since it tries to allocate a RAM block the size of a flash erase
		block, which is typically 64K.  This block driver uses a different approach
		to sacrifice performance for RAM memory footprint by saving data in sectors
		(typically 2K - 4K based on memory size) and relocating sectors as needed when
		an erase block needs to be erased.

if MTD_SMART

config MTD_SMART_SECTOR_SIZE
	int "SMART Device sector size"
	default 1024
	---help---
		Sets the size of a single allocation on the SMART device.  Larger sector sizes
		reduce overhead per sector, but cause more wasted space with a lot of smaller
		files.

config MTD_SMART_WRITEBUFFER
	bool "Enable SMART write buffering"
	default n
	depends on DRVR_WRITEBUFFER

config MTD_SMART_READAHEAD
	bool "Enable SMART read-ahead buffering"
	default n
	depends on DRVR_READAHEAD

config MTD_SMART_WEAR_LEVEL
	bool "Support FLASH wear leveling"
	depends on MTD_SMART
	default y
	---help---
		Adds extra logic and RAM to guarantee equal wear leveling of the FLASH
		device by recording and monitoring erase block operations and selecting
		sector allocations to ensure all erase blocks are worn evenly.  This will
		evenly wear both dynamic and static data on the device.

if MTD_SMART_WEAR_LEVEL && !SMART_CRC_16

config MTD_SMART_CONVERT_WEAR_FORMAT
	bool "Convert existing non wear leveling FLASH to wear leveling"
	default n
	---help---
		Adds a little extra code which detects an existing SMART format on a device
		that was created prior to the wear leveling implementation.  This conversion
		only works if either no CRC is being used or if CRC-8 is being used as other
		CRC versions use a different header format and require a mksmartfs on the
		device even if an existing format is there.

endif

config MTD_SMART_ENABLE_CRC
	bool "Enable Sector CRC error detection"
	depends on MTD_SMART
	default n
	---help---
		Enables logic to compute and validate a CRC for logical sectors.  The
		CRC is calculated for all bytes in the logical sector.  The CRC size is
		selectable (8-bit, 16-bit, 32-bit).  For added protection, larger CRCs should
		be used with larger (2K - 4K) sector sizes.  Enabling CRC protection will
		cause increased sector relocation and increased erase block erasures since
		directory and wear-level status updates can no longer be performed in-place
		and mandate re-writing the information to a new sector.

		An 8-bit CRC protection scheme can be added to an existing non-CRC formatted
		SMART volume without needing to reformat the drive.  As sectors are re-written
		or relocated, they will be converted to CRC protected sectors.

choice
	prompt "CRC level selection"
	depends on MTD_SMART_ENABLE_CRC
	default SMART_CRC_8
	---help---
		Select the level of CRC protection implemented in the SMART MTD layer.
		Smaller CRC selection uses less overhead per logical sectors, but also has
		a higher probability of not detecting multiple bit errors.  Devices with
		larger logical sector sizes should use a larger CRC.

config SMART_CRC_8
	bool "CRC-8"

config SMART_CRC_16
	bool "CRC-16"

endchoice

config MTD_SMART_MINIMIZE_RAM
	bool "Minimize SMART RAM usage using logical sector cache"
	depends on MTD_SMART
	default 0
	---help---
		Reduces RAM usage in the SMART MTD layer by replacing the 1-for-1 logical to
		physical sector map with a smaller cache-based structure.  This can save a
		considerable amount of RAM on devices with a large sector count, but at the
		expense of increased read/write times when a cache miss occurs.  If the
		requested logical sector has not been cached, then the device will need to be
		scanned to located it on the physical medium.

config MTD_SMART_SECTOR_CACHE_SIZE
	int "Number of entries in the SMART logical sector cache"
	depends on MTD_SMART_MINIMIZE_RAM
	default 512
	---help---
		Sets the size of the cache used for logical to physical sector mapping.  A
		larger number allows larger files to be "seek"ed randomly without encountering
		cache misses.  Any files larger than CACH_SIZE * SECTOR_SIZE that are seeked
		start to end will cause the cache to flush forcing manual scanning of the
		MTD device to find the logical to physical mappings.

config MTD_SMART_SECTOR_PACK_COUNTS
	bool "Pack free and release counts when possible"
	depends on MTD_SMART_MINIMIZE_RAM
	default y
	---help---
		For volumes with 16 sectors per erase block or less, this option causes the
		free sector and released sector counts used for allocation and garbage
		collection to be packed such that two values are stored per byte.  For
		volumes with 16 sectors per erase block, the 4 LSBs are packed and all of
		the high-order bits are packed separately (8 per byte).  This squeezes even
		more RAM out.

config MTD_SMART_SECTOR_ERASE_DEBUG
	bool "Track Erase Block erasure counts"
	depends on MTD_SMART
	default n
	---help---
		Allocates an Erase Block erase count array and keeps track of the number
		of erases per erase block.  This data is then presented on the procfs
		interface.

config MTD_SMART_ALLOC_DEBUG
	bool "RAM Allocation Debug"
	depends on MTD_SMART
	default n
	---help---
		Records all SMART MTD layer allocations for debug purposes and makes them
		accessible from the ProcFS interface if it is enabled.

endif # MTD_SMART

config MTD_RAMTRON
	bool "SPI-based RAMTRON NVRAM Devices FM25V10"
	default n
	select SPI
	---help---
		SPI-based RAMTRON NVRAM Devices FM25V10

config MTD_SST25
	bool "SPI-based SST25 FLASH"
	default n
	select SPI

if MTD_SST25

config SST25_SPIMODE
	int "SST25 SPI Mode"
	default 0

config SST25_SPIFREQUENCY
	int "SST25 SPI Frequency"
	default 20000000

config SST25_READONLY
	bool "SST25 Read-Only FLASH"
	default n

config SST25_SECTOR512
	bool "Simulate 512 byte Erase Blocks"
	default n

config SST25_SLOWWRITE
	bool
	default n
	---help---
		There used to be a bug in the current code when using the higher speed AAI
		write sequence. The nature of the bug is that the WRDI instruction is not
		working. At the end of the AAI sequence, the status register continues to
		report that the SST25 is write enabled (WEL bit) and in AAI mode (AAI
		bit).  This has been fixed by David Sidrane!

config SST25_SLOWREAD
	bool
	default n

endif

config MTD_SST25XX
	bool "SPI-based SST25XX FLASH (64-MBit and larger)"
	default n
	select SPI
	---help---
		With the 64 MBit and larger parts, SST changed the write mechanism to
		support page write instead of byte/word write like the smaller parts.
		As a result, the SST25 driver is not compatible with the larger density
		parts, and the SST25XX driver must be used instead.

if MTD_SST25XX

config SST25XX_SPIMODE
	int "SST25 SPI Mode"
	default 0

config SST25XX_SPIFREQUENCY
	int "SST25 SPI Frequency"
	default 20000000

config SST25XX_MANUFACTURER
	hex "Manufacturers ID"
	default 0xBF
	---help---
		Various manufacturers may have produced the parts.  0xBF is the manufacturer ID
		for the parts manufactured by SST.

config SST25XX_MEMORY_TYPE
	hex "Memory type ID"
	default 0x25
	---help---
		The memory type for SST25VF065 series is 0x25, but this can be modified if needed
		to support compatible devices from different manufacturers.

endif

config MTD_SST39FV
	bool "SST39FV NOR FLASH"
	default n
	---help---
		Selects 16-bit SST NOR FLASH.  This includes support for:

		SST39FV1601/SST39FV1602:  2Mb
		SST39FV3201/SST39FV3202:  4Mb

if MTD_SST39FV

config SST39VF_BASE_ADDRESS
	hex "SST39FV bass address"
	default 0x00000000
	---help---
		This is the address where the SST29VF FLASH can be found in memory.

endif

config MTD_W25
	bool "SPI-based W25 FLASH"
	default n
	select SPI

if MTD_W25

config W25_SPIMODE
	int "W25 SPI Mode"
	default 0

config W25_SPIFREQUENCY
	int "W25 SPI Frequency"
	default 20000000

config W25_READONLY
	bool "W25 Read-Only FLASH"
	default n

config W25_SECTOR512
	bool "Simulate 512 byte Erase Blocks"
	default n

config W25_SLOWREAD
	bool
	default n

endif