18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_cimenu "RAM/ROM/Flash chip drivers"
38c2ecf20Sopenharmony_ci	depends on MTD!=n
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciconfig MTD_CFI
68c2ecf20Sopenharmony_ci	tristate "Detect flash chips by Common Flash Interface (CFI) probe"
78c2ecf20Sopenharmony_ci	select MTD_GEN_PROBE
88c2ecf20Sopenharmony_ci	select MTD_CFI_UTIL
98c2ecf20Sopenharmony_ci	help
108c2ecf20Sopenharmony_ci	  The Common Flash Interface specification was developed by Intel,
118c2ecf20Sopenharmony_ci	  AMD and other flash manufactures that provides a universal method
128c2ecf20Sopenharmony_ci	  for probing the capabilities of flash devices. If you wish to
138c2ecf20Sopenharmony_ci	  support any device that is CFI-compliant, you need to enable this
148c2ecf20Sopenharmony_ci	  option. Visit <https://www.amd.com/products/nvd/overview/cfi.html>
158c2ecf20Sopenharmony_ci	  for more information on CFI.
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciconfig MTD_JEDECPROBE
188c2ecf20Sopenharmony_ci	tristate "Detect non-CFI AMD/JEDEC-compatible flash chips"
198c2ecf20Sopenharmony_ci	select MTD_GEN_PROBE
208c2ecf20Sopenharmony_ci	select MTD_CFI_UTIL
218c2ecf20Sopenharmony_ci	help
228c2ecf20Sopenharmony_ci	  This option enables JEDEC-style probing of flash chips which are not
238c2ecf20Sopenharmony_ci	  compatible with the Common Flash Interface, but will use the common
248c2ecf20Sopenharmony_ci	  CFI-targeted flash drivers for any chips which are identified which
258c2ecf20Sopenharmony_ci	  are in fact compatible in all but the probe method. This actually
268c2ecf20Sopenharmony_ci	  covers most AMD/Fujitsu-compatible chips and also non-CFI
278c2ecf20Sopenharmony_ci	  Intel chips.
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciconfig MTD_GEN_PROBE
308c2ecf20Sopenharmony_ci	tristate
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciconfig MTD_CFI_ADV_OPTIONS
338c2ecf20Sopenharmony_ci	bool "Flash chip driver advanced configuration options"
348c2ecf20Sopenharmony_ci	depends on MTD_GEN_PROBE
358c2ecf20Sopenharmony_ci	help
368c2ecf20Sopenharmony_ci	  If you need to specify a specific endianness for access to flash
378c2ecf20Sopenharmony_ci	  chips, or if you wish to reduce the size of the kernel by including
388c2ecf20Sopenharmony_ci	  support for only specific arrangements of flash chips, say 'Y'. This
398c2ecf20Sopenharmony_ci	  option does not directly affect the code, but will enable other
408c2ecf20Sopenharmony_ci	  configuration options which allow you to do so.
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci	  If unsure, say 'N'.
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cichoice
458c2ecf20Sopenharmony_ci	prompt "Flash cmd/query data swapping"
468c2ecf20Sopenharmony_ci	depends on MTD_CFI_ADV_OPTIONS
478c2ecf20Sopenharmony_ci	default MTD_CFI_NOSWAP
488c2ecf20Sopenharmony_ci	help
498c2ecf20Sopenharmony_ci	  This option defines the way in which the CPU attempts to arrange
508c2ecf20Sopenharmony_ci	  data bits when writing the 'magic' commands to the chips. Saying
518c2ecf20Sopenharmony_ci	  'NO', which is the default when CONFIG_MTD_CFI_ADV_OPTIONS isn't
528c2ecf20Sopenharmony_ci	  enabled, means that the CPU will not do any swapping; the chips
538c2ecf20Sopenharmony_ci	  are expected to be wired to the CPU in 'host-endian' form.
548c2ecf20Sopenharmony_ci	  Specific arrangements are possible with the BIG_ENDIAN_BYTE and
558c2ecf20Sopenharmony_ci	  LITTLE_ENDIAN_BYTE, if the bytes are reversed.
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciconfig MTD_CFI_NOSWAP
588c2ecf20Sopenharmony_ci	depends on !ARCH_IXP4XX || CPU_BIG_ENDIAN
598c2ecf20Sopenharmony_ci	bool "NO"
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciconfig MTD_CFI_BE_BYTE_SWAP
628c2ecf20Sopenharmony_ci	bool "BIG_ENDIAN_BYTE"
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ciconfig MTD_CFI_LE_BYTE_SWAP
658c2ecf20Sopenharmony_ci	depends on !ARCH_IXP4XX
668c2ecf20Sopenharmony_ci	bool "LITTLE_ENDIAN_BYTE"
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ciendchoice
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ciconfig MTD_CFI_GEOMETRY
718c2ecf20Sopenharmony_ci	bool "Specific CFI Flash geometry selection"
728c2ecf20Sopenharmony_ci	depends on MTD_CFI_ADV_OPTIONS
738c2ecf20Sopenharmony_ci	select MTD_MAP_BANK_WIDTH_1 if  !(MTD_MAP_BANK_WIDTH_2 || \
748c2ecf20Sopenharmony_ci		 MTD_MAP_BANK_WIDTH_4  || MTD_MAP_BANK_WIDTH_8 || \
758c2ecf20Sopenharmony_ci		 MTD_MAP_BANK_WIDTH_16 || MTD_MAP_BANK_WIDTH_32)
768c2ecf20Sopenharmony_ci	select MTD_CFI_I1 if !(MTD_CFI_I2 || MTD_CFI_I4 || MTD_CFI_I8)
778c2ecf20Sopenharmony_ci	help
788c2ecf20Sopenharmony_ci	  This option does not affect the code directly, but will enable
798c2ecf20Sopenharmony_ci	  some other configuration options which would allow you to reduce
808c2ecf20Sopenharmony_ci	  the size of the kernel by including support for only certain
818c2ecf20Sopenharmony_ci	  arrangements of CFI chips. If unsure, say 'N' and all options
828c2ecf20Sopenharmony_ci	  which are supported by the current code will be enabled.
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ciconfig MTD_MAP_BANK_WIDTH_1
858c2ecf20Sopenharmony_ci	bool "Support  8-bit buswidth" if MTD_CFI_GEOMETRY
868c2ecf20Sopenharmony_ci	default y
878c2ecf20Sopenharmony_ci	help
888c2ecf20Sopenharmony_ci	  If you wish to support CFI devices on a physical bus which is
898c2ecf20Sopenharmony_ci	  8 bits wide, say 'Y'.
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ciconfig MTD_MAP_BANK_WIDTH_2
928c2ecf20Sopenharmony_ci	bool "Support 16-bit buswidth" if MTD_CFI_GEOMETRY
938c2ecf20Sopenharmony_ci	default y
948c2ecf20Sopenharmony_ci	help
958c2ecf20Sopenharmony_ci	  If you wish to support CFI devices on a physical bus which is
968c2ecf20Sopenharmony_ci	  16 bits wide, say 'Y'.
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ciconfig MTD_MAP_BANK_WIDTH_4
998c2ecf20Sopenharmony_ci	bool "Support 32-bit buswidth" if MTD_CFI_GEOMETRY
1008c2ecf20Sopenharmony_ci	default y
1018c2ecf20Sopenharmony_ci	help
1028c2ecf20Sopenharmony_ci	  If you wish to support CFI devices on a physical bus which is
1038c2ecf20Sopenharmony_ci	  32 bits wide, say 'Y'.
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ciconfig MTD_MAP_BANK_WIDTH_8
1068c2ecf20Sopenharmony_ci	bool "Support 64-bit buswidth" if MTD_CFI_GEOMETRY
1078c2ecf20Sopenharmony_ci	default n
1088c2ecf20Sopenharmony_ci	help
1098c2ecf20Sopenharmony_ci	  If you wish to support CFI devices on a physical bus which is
1108c2ecf20Sopenharmony_ci	  64 bits wide, say 'Y'.
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ciconfig MTD_MAP_BANK_WIDTH_16
1138c2ecf20Sopenharmony_ci	bool "Support 128-bit buswidth" if MTD_CFI_GEOMETRY
1148c2ecf20Sopenharmony_ci	default n
1158c2ecf20Sopenharmony_ci	help
1168c2ecf20Sopenharmony_ci	  If you wish to support CFI devices on a physical bus which is
1178c2ecf20Sopenharmony_ci	  128 bits wide, say 'Y'.
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ciconfig MTD_MAP_BANK_WIDTH_32
1208c2ecf20Sopenharmony_ci	bool "Support 256-bit buswidth" if MTD_CFI_GEOMETRY
1218c2ecf20Sopenharmony_ci	select MTD_COMPLEX_MAPPINGS if HAS_IOMEM
1228c2ecf20Sopenharmony_ci	default n
1238c2ecf20Sopenharmony_ci	help
1248c2ecf20Sopenharmony_ci	  If you wish to support CFI devices on a physical bus which is
1258c2ecf20Sopenharmony_ci	  256 bits wide, say 'Y'.
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ciconfig MTD_CFI_I1
1288c2ecf20Sopenharmony_ci	bool "Support 1-chip flash interleave" if MTD_CFI_GEOMETRY
1298c2ecf20Sopenharmony_ci	default y
1308c2ecf20Sopenharmony_ci	help
1318c2ecf20Sopenharmony_ci	  If your flash chips are not interleaved - i.e. you only have one
1328c2ecf20Sopenharmony_ci	  flash chip addressed by each bus cycle, then say 'Y'.
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ciconfig MTD_CFI_I2
1358c2ecf20Sopenharmony_ci	bool "Support 2-chip flash interleave" if MTD_CFI_GEOMETRY
1368c2ecf20Sopenharmony_ci	default y
1378c2ecf20Sopenharmony_ci	help
1388c2ecf20Sopenharmony_ci	  If your flash chips are interleaved in pairs - i.e. you have two
1398c2ecf20Sopenharmony_ci	  flash chips addressed by each bus cycle, then say 'Y'.
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ciconfig MTD_CFI_I4
1428c2ecf20Sopenharmony_ci	bool "Support 4-chip flash interleave" if MTD_CFI_GEOMETRY
1438c2ecf20Sopenharmony_ci	default n
1448c2ecf20Sopenharmony_ci	help
1458c2ecf20Sopenharmony_ci	  If your flash chips are interleaved in fours - i.e. you have four
1468c2ecf20Sopenharmony_ci	  flash chips addressed by each bus cycle, then say 'Y'.
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ciconfig MTD_CFI_I8
1498c2ecf20Sopenharmony_ci	bool "Support 8-chip flash interleave" if MTD_CFI_GEOMETRY
1508c2ecf20Sopenharmony_ci	default n
1518c2ecf20Sopenharmony_ci	help
1528c2ecf20Sopenharmony_ci	  If your flash chips are interleaved in eights - i.e. you have eight
1538c2ecf20Sopenharmony_ci	  flash chips addressed by each bus cycle, then say 'Y'.
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ciconfig MTD_OTP
1568c2ecf20Sopenharmony_ci	bool "Protection Registers aka one-time programmable (OTP) bits"
1578c2ecf20Sopenharmony_ci	depends on MTD_CFI_ADV_OPTIONS
1588c2ecf20Sopenharmony_ci	default n
1598c2ecf20Sopenharmony_ci	help
1608c2ecf20Sopenharmony_ci	  This enables support for reading, writing and locking so called
1618c2ecf20Sopenharmony_ci	  "Protection Registers" present on some flash chips.
1628c2ecf20Sopenharmony_ci	  A subset of them are pre-programmed at the factory with a
1638c2ecf20Sopenharmony_ci	  unique set of values. The rest is user-programmable.
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci	  The user-programmable Protection Registers contain one-time
1668c2ecf20Sopenharmony_ci	  programmable (OTP) bits; when programmed, register bits cannot be
1678c2ecf20Sopenharmony_ci	  erased. Each Protection Register can be accessed multiple times to
1688c2ecf20Sopenharmony_ci	  program individual bits, as long as the register remains unlocked.
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci	  Each Protection Register has an associated Lock Register bit. When a
1718c2ecf20Sopenharmony_ci	  Lock Register bit is programmed, the associated Protection Register
1728c2ecf20Sopenharmony_ci	  can only be read; it can no longer be programmed. Additionally,
1738c2ecf20Sopenharmony_ci	  because the Lock Register bits themselves are OTP, when programmed,
1748c2ecf20Sopenharmony_ci	  Lock Register bits cannot be erased. Therefore, when a Protection
1758c2ecf20Sopenharmony_ci	  Register is locked, it cannot be unlocked.
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci	  This feature should therefore be used with extreme care. Any mistake
1788c2ecf20Sopenharmony_ci	  in the programming of OTP bits will waste them.
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ciconfig MTD_CFI_INTELEXT
1818c2ecf20Sopenharmony_ci	tristate "Support for CFI command set 0001 (Intel/Sharp chips)"
1828c2ecf20Sopenharmony_ci	depends on MTD_GEN_PROBE
1838c2ecf20Sopenharmony_ci	select MTD_CFI_UTIL
1848c2ecf20Sopenharmony_ci	help
1858c2ecf20Sopenharmony_ci	  The Common Flash Interface defines a number of different command
1868c2ecf20Sopenharmony_ci	  sets which a CFI-compliant chip may claim to implement. This code
1878c2ecf20Sopenharmony_ci	  provides support for command set 0001, used on Intel StrataFlash
1888c2ecf20Sopenharmony_ci	  and other parts.
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ciconfig MTD_CFI_AMDSTD
1918c2ecf20Sopenharmony_ci	tristate "Support for CFI command set 0002 (AMD/Fujitsu/Spansion chips)"
1928c2ecf20Sopenharmony_ci	depends on MTD_GEN_PROBE
1938c2ecf20Sopenharmony_ci	select MTD_CFI_UTIL
1948c2ecf20Sopenharmony_ci	help
1958c2ecf20Sopenharmony_ci	  The Common Flash Interface defines a number of different command
1968c2ecf20Sopenharmony_ci	  sets which a CFI-compliant chip may claim to implement. This code
1978c2ecf20Sopenharmony_ci	  provides support for command set 0002, used on chips including
1988c2ecf20Sopenharmony_ci	  the AMD Am29LV320.
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ciconfig MTD_CFI_STAA
2018c2ecf20Sopenharmony_ci	tristate "Support for CFI command set 0020 (ST (Advanced Architecture) chips)"
2028c2ecf20Sopenharmony_ci	depends on MTD_GEN_PROBE
2038c2ecf20Sopenharmony_ci	select MTD_CFI_UTIL
2048c2ecf20Sopenharmony_ci	help
2058c2ecf20Sopenharmony_ci	  The Common Flash Interface defines a number of different command
2068c2ecf20Sopenharmony_ci	  sets which a CFI-compliant chip may claim to implement. This code
2078c2ecf20Sopenharmony_ci	  provides support for command set 0020.
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ciconfig MTD_CFI_UTIL
2108c2ecf20Sopenharmony_ci	tristate
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ciconfig MTD_RAM
2138c2ecf20Sopenharmony_ci	tristate "Support for RAM chips in bus mapping"
2148c2ecf20Sopenharmony_ci	help
2158c2ecf20Sopenharmony_ci	  This option enables basic support for RAM chips accessed through
2168c2ecf20Sopenharmony_ci	  a bus mapping driver.
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ciconfig MTD_ROM
2198c2ecf20Sopenharmony_ci	tristate "Support for ROM chips in bus mapping"
2208c2ecf20Sopenharmony_ci	help
2218c2ecf20Sopenharmony_ci	  This option enables basic support for ROM chips accessed through
2228c2ecf20Sopenharmony_ci	  a bus mapping driver.
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ciconfig MTD_ABSENT
2258c2ecf20Sopenharmony_ci	tristate "Support for absent chips in bus mapping"
2268c2ecf20Sopenharmony_ci	help
2278c2ecf20Sopenharmony_ci	  This option enables support for a dummy probing driver used to
2288c2ecf20Sopenharmony_ci	  allocated placeholder MTD devices on systems that have socketed
2298c2ecf20Sopenharmony_ci	  or removable media.  Use of this driver as a fallback chip probe
2308c2ecf20Sopenharmony_ci	  preserves the expected registration order of MTD device nodes on
2318c2ecf20Sopenharmony_ci	  the system regardless of media presence.  Device nodes created
2328c2ecf20Sopenharmony_ci	  with this driver will return -ENODEV upon access.
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ciconfig MTD_XIP
2358c2ecf20Sopenharmony_ci	bool "XIP aware MTD support"
2368c2ecf20Sopenharmony_ci	depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && ARCH_MTD_XIP
2378c2ecf20Sopenharmony_ci	default y if XIP_KERNEL
2388c2ecf20Sopenharmony_ci	help
2398c2ecf20Sopenharmony_ci	  This allows MTD support to work with flash memory which is also
2408c2ecf20Sopenharmony_ci	  used for XIP purposes.  If you're not sure what this is all about
2418c2ecf20Sopenharmony_ci	  then say N.
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ciendmenu
244