162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_cimenu "RAM/ROM/Flash chip drivers"
362306a36Sopenharmony_ci	depends on MTD!=n
462306a36Sopenharmony_ci
562306a36Sopenharmony_ciconfig MTD_CFI
662306a36Sopenharmony_ci	tristate "Detect flash chips by Common Flash Interface (CFI) probe"
762306a36Sopenharmony_ci	select MTD_GEN_PROBE
862306a36Sopenharmony_ci	select MTD_CFI_UTIL
962306a36Sopenharmony_ci	help
1062306a36Sopenharmony_ci	  The Common Flash Interface specification was developed by Intel,
1162306a36Sopenharmony_ci	  AMD and other flash manufactures that provides a universal method
1262306a36Sopenharmony_ci	  for probing the capabilities of flash devices. If you wish to
1362306a36Sopenharmony_ci	  support any device that is CFI-compliant, you need to enable this
1462306a36Sopenharmony_ci	  option. Visit <https://www.amd.com/products/nvd/overview/cfi.html>
1562306a36Sopenharmony_ci	  for more information on CFI.
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ciconfig MTD_JEDECPROBE
1862306a36Sopenharmony_ci	tristate "Detect non-CFI AMD/JEDEC-compatible flash chips"
1962306a36Sopenharmony_ci	select MTD_GEN_PROBE
2062306a36Sopenharmony_ci	select MTD_CFI_UTIL
2162306a36Sopenharmony_ci	help
2262306a36Sopenharmony_ci	  This option enables JEDEC-style probing of flash chips which are not
2362306a36Sopenharmony_ci	  compatible with the Common Flash Interface, but will use the common
2462306a36Sopenharmony_ci	  CFI-targeted flash drivers for any chips which are identified which
2562306a36Sopenharmony_ci	  are in fact compatible in all but the probe method. This actually
2662306a36Sopenharmony_ci	  covers most AMD/Fujitsu-compatible chips and also non-CFI
2762306a36Sopenharmony_ci	  Intel chips.
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ciconfig MTD_GEN_PROBE
3062306a36Sopenharmony_ci	tristate
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciconfig MTD_CFI_ADV_OPTIONS
3362306a36Sopenharmony_ci	bool "Flash chip driver advanced configuration options"
3462306a36Sopenharmony_ci	depends on MTD_GEN_PROBE
3562306a36Sopenharmony_ci	help
3662306a36Sopenharmony_ci	  If you need to specify a specific endianness for access to flash
3762306a36Sopenharmony_ci	  chips, or if you wish to reduce the size of the kernel by including
3862306a36Sopenharmony_ci	  support for only specific arrangements of flash chips, say 'Y'. This
3962306a36Sopenharmony_ci	  option does not directly affect the code, but will enable other
4062306a36Sopenharmony_ci	  configuration options which allow you to do so.
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci	  If unsure, say 'N'.
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_cichoice
4562306a36Sopenharmony_ci	prompt "Flash cmd/query data swapping"
4662306a36Sopenharmony_ci	depends on MTD_CFI_ADV_OPTIONS
4762306a36Sopenharmony_ci	default MTD_CFI_NOSWAP
4862306a36Sopenharmony_ci	help
4962306a36Sopenharmony_ci	  This option defines the way in which the CPU attempts to arrange
5062306a36Sopenharmony_ci	  data bits when writing the 'magic' commands to the chips. Saying
5162306a36Sopenharmony_ci	  'NO', which is the default when CONFIG_MTD_CFI_ADV_OPTIONS isn't
5262306a36Sopenharmony_ci	  enabled, means that the CPU will not do any swapping; the chips
5362306a36Sopenharmony_ci	  are expected to be wired to the CPU in 'host-endian' form.
5462306a36Sopenharmony_ci	  Specific arrangements are possible with the BIG_ENDIAN_BYTE and
5562306a36Sopenharmony_ci	  LITTLE_ENDIAN_BYTE, if the bytes are reversed.
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ciconfig MTD_CFI_NOSWAP
5862306a36Sopenharmony_ci	depends on !ARCH_IXP4XX || CPU_BIG_ENDIAN
5962306a36Sopenharmony_ci	bool "NO"
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ciconfig MTD_CFI_BE_BYTE_SWAP
6262306a36Sopenharmony_ci	bool "BIG_ENDIAN_BYTE"
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciconfig MTD_CFI_LE_BYTE_SWAP
6562306a36Sopenharmony_ci	depends on !ARCH_IXP4XX
6662306a36Sopenharmony_ci	bool "LITTLE_ENDIAN_BYTE"
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ciendchoice
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ciconfig MTD_CFI_GEOMETRY
7162306a36Sopenharmony_ci	bool "Specific CFI Flash geometry selection"
7262306a36Sopenharmony_ci	depends on MTD_CFI_ADV_OPTIONS
7362306a36Sopenharmony_ci	select MTD_MAP_BANK_WIDTH_1 if  !(MTD_MAP_BANK_WIDTH_2 || \
7462306a36Sopenharmony_ci		 MTD_MAP_BANK_WIDTH_4  || MTD_MAP_BANK_WIDTH_8 || \
7562306a36Sopenharmony_ci		 MTD_MAP_BANK_WIDTH_16 || MTD_MAP_BANK_WIDTH_32)
7662306a36Sopenharmony_ci	select MTD_CFI_I1 if !(MTD_CFI_I2 || MTD_CFI_I4 || MTD_CFI_I8)
7762306a36Sopenharmony_ci	help
7862306a36Sopenharmony_ci	  This option does not affect the code directly, but will enable
7962306a36Sopenharmony_ci	  some other configuration options which would allow you to reduce
8062306a36Sopenharmony_ci	  the size of the kernel by including support for only certain
8162306a36Sopenharmony_ci	  arrangements of CFI chips. If unsure, say 'N' and all options
8262306a36Sopenharmony_ci	  which are supported by the current code will be enabled.
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ciconfig MTD_MAP_BANK_WIDTH_1
8562306a36Sopenharmony_ci	bool "Support  8-bit buswidth" if MTD_CFI_GEOMETRY
8662306a36Sopenharmony_ci	default y
8762306a36Sopenharmony_ci	help
8862306a36Sopenharmony_ci	  If you wish to support CFI devices on a physical bus which is
8962306a36Sopenharmony_ci	  8 bits wide, say 'Y'.
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ciconfig MTD_MAP_BANK_WIDTH_2
9262306a36Sopenharmony_ci	bool "Support 16-bit buswidth" if MTD_CFI_GEOMETRY
9362306a36Sopenharmony_ci	default y
9462306a36Sopenharmony_ci	help
9562306a36Sopenharmony_ci	  If you wish to support CFI devices on a physical bus which is
9662306a36Sopenharmony_ci	  16 bits wide, say 'Y'.
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ciconfig MTD_MAP_BANK_WIDTH_4
9962306a36Sopenharmony_ci	bool "Support 32-bit buswidth" if MTD_CFI_GEOMETRY
10062306a36Sopenharmony_ci	default y
10162306a36Sopenharmony_ci	help
10262306a36Sopenharmony_ci	  If you wish to support CFI devices on a physical bus which is
10362306a36Sopenharmony_ci	  32 bits wide, say 'Y'.
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ciconfig MTD_MAP_BANK_WIDTH_8
10662306a36Sopenharmony_ci	bool "Support 64-bit buswidth" if MTD_CFI_GEOMETRY
10762306a36Sopenharmony_ci	default n
10862306a36Sopenharmony_ci	help
10962306a36Sopenharmony_ci	  If you wish to support CFI devices on a physical bus which is
11062306a36Sopenharmony_ci	  64 bits wide, say 'Y'.
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ciconfig MTD_MAP_BANK_WIDTH_16
11362306a36Sopenharmony_ci	bool "Support 128-bit buswidth" if MTD_CFI_GEOMETRY
11462306a36Sopenharmony_ci	default n
11562306a36Sopenharmony_ci	help
11662306a36Sopenharmony_ci	  If you wish to support CFI devices on a physical bus which is
11762306a36Sopenharmony_ci	  128 bits wide, say 'Y'.
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ciconfig MTD_MAP_BANK_WIDTH_32
12062306a36Sopenharmony_ci	bool "Support 256-bit buswidth" if MTD_CFI_GEOMETRY
12162306a36Sopenharmony_ci	select MTD_COMPLEX_MAPPINGS if HAS_IOMEM
12262306a36Sopenharmony_ci	default n
12362306a36Sopenharmony_ci	help
12462306a36Sopenharmony_ci	  If you wish to support CFI devices on a physical bus which is
12562306a36Sopenharmony_ci	  256 bits wide, say 'Y'.
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ciconfig MTD_CFI_I1
12862306a36Sopenharmony_ci	bool "Support 1-chip flash interleave" if MTD_CFI_GEOMETRY
12962306a36Sopenharmony_ci	default y
13062306a36Sopenharmony_ci	help
13162306a36Sopenharmony_ci	  If your flash chips are not interleaved - i.e. you only have one
13262306a36Sopenharmony_ci	  flash chip addressed by each bus cycle, then say 'Y'.
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ciconfig MTD_CFI_I2
13562306a36Sopenharmony_ci	bool "Support 2-chip flash interleave" if MTD_CFI_GEOMETRY
13662306a36Sopenharmony_ci	default y
13762306a36Sopenharmony_ci	help
13862306a36Sopenharmony_ci	  If your flash chips are interleaved in pairs - i.e. you have two
13962306a36Sopenharmony_ci	  flash chips addressed by each bus cycle, then say 'Y'.
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ciconfig MTD_CFI_I4
14262306a36Sopenharmony_ci	bool "Support 4-chip flash interleave" if MTD_CFI_GEOMETRY
14362306a36Sopenharmony_ci	default n
14462306a36Sopenharmony_ci	help
14562306a36Sopenharmony_ci	  If your flash chips are interleaved in fours - i.e. you have four
14662306a36Sopenharmony_ci	  flash chips addressed by each bus cycle, then say 'Y'.
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ciconfig MTD_CFI_I8
14962306a36Sopenharmony_ci	bool "Support 8-chip flash interleave" if MTD_CFI_GEOMETRY
15062306a36Sopenharmony_ci	default n
15162306a36Sopenharmony_ci	help
15262306a36Sopenharmony_ci	  If your flash chips are interleaved in eights - i.e. you have eight
15362306a36Sopenharmony_ci	  flash chips addressed by each bus cycle, then say 'Y'.
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ciconfig MTD_OTP
15662306a36Sopenharmony_ci	bool "Protection Registers aka one-time programmable (OTP) bits"
15762306a36Sopenharmony_ci	depends on MTD_CFI_ADV_OPTIONS
15862306a36Sopenharmony_ci	default n
15962306a36Sopenharmony_ci	help
16062306a36Sopenharmony_ci	  This enables support for reading, writing and locking so called
16162306a36Sopenharmony_ci	  "Protection Registers" present on some flash chips.
16262306a36Sopenharmony_ci	  A subset of them are pre-programmed at the factory with a
16362306a36Sopenharmony_ci	  unique set of values. The rest is user-programmable.
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci	  The user-programmable Protection Registers contain one-time
16662306a36Sopenharmony_ci	  programmable (OTP) bits; when programmed, register bits cannot be
16762306a36Sopenharmony_ci	  erased. Each Protection Register can be accessed multiple times to
16862306a36Sopenharmony_ci	  program individual bits, as long as the register remains unlocked.
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci	  Each Protection Register has an associated Lock Register bit. When a
17162306a36Sopenharmony_ci	  Lock Register bit is programmed, the associated Protection Register
17262306a36Sopenharmony_ci	  can only be read; it can no longer be programmed. Additionally,
17362306a36Sopenharmony_ci	  because the Lock Register bits themselves are OTP, when programmed,
17462306a36Sopenharmony_ci	  Lock Register bits cannot be erased. Therefore, when a Protection
17562306a36Sopenharmony_ci	  Register is locked, it cannot be unlocked.
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci	  This feature should therefore be used with extreme care. Any mistake
17862306a36Sopenharmony_ci	  in the programming of OTP bits will waste them.
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ciconfig MTD_CFI_INTELEXT
18162306a36Sopenharmony_ci	tristate "Support for CFI command set 0001 (Intel/Sharp chips)"
18262306a36Sopenharmony_ci	depends on MTD_GEN_PROBE
18362306a36Sopenharmony_ci	select MTD_CFI_UTIL
18462306a36Sopenharmony_ci	help
18562306a36Sopenharmony_ci	  The Common Flash Interface defines a number of different command
18662306a36Sopenharmony_ci	  sets which a CFI-compliant chip may claim to implement. This code
18762306a36Sopenharmony_ci	  provides support for command set 0001, used on Intel StrataFlash
18862306a36Sopenharmony_ci	  and other parts.
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ciconfig MTD_CFI_AMDSTD
19162306a36Sopenharmony_ci	tristate "Support for CFI command set 0002 (AMD/Fujitsu/Spansion chips)"
19262306a36Sopenharmony_ci	depends on MTD_GEN_PROBE
19362306a36Sopenharmony_ci	select MTD_CFI_UTIL
19462306a36Sopenharmony_ci	help
19562306a36Sopenharmony_ci	  The Common Flash Interface defines a number of different command
19662306a36Sopenharmony_ci	  sets which a CFI-compliant chip may claim to implement. This code
19762306a36Sopenharmony_ci	  provides support for command set 0002, used on chips including
19862306a36Sopenharmony_ci	  the AMD Am29LV320.
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ciconfig MTD_CFI_STAA
20162306a36Sopenharmony_ci	tristate "Support for CFI command set 0020 (ST (Advanced Architecture) chips)"
20262306a36Sopenharmony_ci	depends on MTD_GEN_PROBE
20362306a36Sopenharmony_ci	select MTD_CFI_UTIL
20462306a36Sopenharmony_ci	help
20562306a36Sopenharmony_ci	  The Common Flash Interface defines a number of different command
20662306a36Sopenharmony_ci	  sets which a CFI-compliant chip may claim to implement. This code
20762306a36Sopenharmony_ci	  provides support for command set 0020.
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ciconfig MTD_CFI_UTIL
21062306a36Sopenharmony_ci	tristate
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ciconfig MTD_RAM
21362306a36Sopenharmony_ci	tristate "Support for RAM chips in bus mapping"
21462306a36Sopenharmony_ci	help
21562306a36Sopenharmony_ci	  This option enables basic support for RAM chips accessed through
21662306a36Sopenharmony_ci	  a bus mapping driver.
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ciconfig MTD_ROM
21962306a36Sopenharmony_ci	tristate "Support for ROM chips in bus mapping"
22062306a36Sopenharmony_ci	help
22162306a36Sopenharmony_ci	  This option enables basic support for ROM chips accessed through
22262306a36Sopenharmony_ci	  a bus mapping driver.
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ciconfig MTD_ABSENT
22562306a36Sopenharmony_ci	tristate "Support for absent chips in bus mapping"
22662306a36Sopenharmony_ci	help
22762306a36Sopenharmony_ci	  This option enables support for a dummy probing driver used to
22862306a36Sopenharmony_ci	  allocated placeholder MTD devices on systems that have socketed
22962306a36Sopenharmony_ci	  or removable media.  Use of this driver as a fallback chip probe
23062306a36Sopenharmony_ci	  preserves the expected registration order of MTD device nodes on
23162306a36Sopenharmony_ci	  the system regardless of media presence.  Device nodes created
23262306a36Sopenharmony_ci	  with this driver will return -ENODEV upon access.
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ciconfig MTD_XIP
23562306a36Sopenharmony_ci	bool "XIP aware MTD support"
23662306a36Sopenharmony_ci	depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && ARCH_MTD_XIP
23762306a36Sopenharmony_ci	default y if XIP_KERNEL
23862306a36Sopenharmony_ci	help
23962306a36Sopenharmony_ci	  This allows MTD support to work with flash memory which is also
24062306a36Sopenharmony_ci	  used for XIP purposes.  If you're not sure what this is all about
24162306a36Sopenharmony_ci	  then say N.
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ciendmenu
244