xref: /linux/drivers/mtd/spi-nor/Kconfig (revision a6470e2162e9c3779a4bd6ff3bed1b81d796e46e)
1# SPDX-License-Identifier: GPL-2.0-only
2menuconfig MTD_SPI_NOR
3	tristate "SPI NOR device support"
4	depends on MTD && SPI_MASTER
5	select SPI_MEM
6	help
7	  This is the framework for the SPI NOR which can be used by the SPI
8	  device drivers and the SPI NOR device driver.
9
10if MTD_SPI_NOR
11
12config MTD_SPI_NOR_USE_4K_SECTORS
13	bool "Use small 4096 B erase sectors"
14	default y
15	help
16	  Many flash memories support erasing small (4096 B) sectors. Depending
17	  on the usage this feature may provide performance gain in comparison
18	  to erasing whole blocks (32/64 KiB).
19	  Changing a small part of the flash's contents is usually faster with
20	  small sectors. On the other hand erasing should be faster when using
21	  64 KiB block instead of 16 × 4 KiB sectors.
22
23	  Please note that some tools/drivers/filesystems may not work with
24	  4096 B erase size (e.g. UBIFS requires 15 KiB as a minimum).
25
26choice
27	prompt "Software write protection at boot"
28	default MTD_SPI_NOR_SWP_DISABLE_ON_VOLATILE
29
30config MTD_SPI_NOR_SWP_DISABLE
31	bool "Disable SWP on any flashes (legacy behavior)"
32	help
33	  This option disables the software write protection on any SPI
34	  flashes at boot-up.
35
36	  Depending on the flash chip this either clears the block protection
37	  bits or does a "Global Unprotect" command.
38
39	  Don't use this if you intent to use the software write protection
40	  of your SPI flash. This is only to keep backwards compatibility.
41
42config MTD_SPI_NOR_SWP_DISABLE_ON_VOLATILE
43	bool "Disable SWP on flashes w/ volatile protection bits"
44	help
45	  Some SPI flashes have volatile block protection bits, ie. after a
46	  power-up or a reset the flash is software write protected by
47	  default.
48
49	  This option disables the software write protection for these kind
50	  of flashes while keeping it enabled for any other SPI flashes
51	  which have non-volatile write protection bits.
52
53	  If the software write protection will be disabled depending on
54	  the flash either the block protection bits are cleared or a
55	  "Global Unprotect" command is issued.
56
57	  If you are unsure, select this option.
58
59config MTD_SPI_NOR_SWP_KEEP
60	bool "Keep software write protection as is"
61	help
62	  If you select this option the software write protection of any
63	  SPI flashes will not be changed. If your flash is software write
64	  protected or will be automatically software write protected after
65	  power-up you have to manually unlock it before you are able to
66	  write to it.
67
68endchoice
69
70source "drivers/mtd/spi-nor/controllers/Kconfig"
71
72endif # MTD_SPI_NOR
73