1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only 21da177e4SLinus Torvaldsmenu "RAM/ROM/Flash chip drivers" 31da177e4SLinus Torvalds depends on MTD!=n 41da177e4SLinus Torvalds 51da177e4SLinus Torvaldsconfig MTD_CFI 61da177e4SLinus Torvalds tristate "Detect flash chips by Common Flash Interface (CFI) probe" 71da177e4SLinus Torvalds select MTD_GEN_PROBE 85e706469SDavid Woodhouse select MTD_CFI_UTIL 91da177e4SLinus Torvalds help 101da177e4SLinus Torvalds The Common Flash Interface specification was developed by Intel, 111da177e4SLinus Torvalds AMD and other flash manufactures that provides a universal method 121da177e4SLinus Torvalds for probing the capabilities of flash devices. If you wish to 131da177e4SLinus Torvalds support any device that is CFI-compliant, you need to enable this 14c13ac555SAlexander A. Klimov option. Visit <https://www.amd.com/products/nvd/overview/cfi.html> 151da177e4SLinus Torvalds for more information on CFI. 161da177e4SLinus Torvalds 171da177e4SLinus Torvaldsconfig MTD_JEDECPROBE 181da177e4SLinus Torvalds tristate "Detect non-CFI AMD/JEDEC-compatible flash chips" 191da177e4SLinus Torvalds select MTD_GEN_PROBE 20bde90062SBrian Norris select MTD_CFI_UTIL 211da177e4SLinus Torvalds help 221da177e4SLinus Torvalds This option enables JEDEC-style probing of flash chips which are not 231da177e4SLinus Torvalds compatible with the Common Flash Interface, but will use the common 2425985edcSLucas De Marchi CFI-targeted flash drivers for any chips which are identified which 251da177e4SLinus Torvalds are in fact compatible in all but the probe method. This actually 268917f6f7SAdrian Bunk covers most AMD/Fujitsu-compatible chips and also non-CFI 278917f6f7SAdrian Bunk Intel chips. 281da177e4SLinus Torvalds 291da177e4SLinus Torvaldsconfig MTD_GEN_PROBE 301da177e4SLinus Torvalds tristate 311da177e4SLinus Torvalds 321da177e4SLinus Torvaldsconfig MTD_CFI_ADV_OPTIONS 331da177e4SLinus Torvalds bool "Flash chip driver advanced configuration options" 341da177e4SLinus Torvalds depends on MTD_GEN_PROBE 351da177e4SLinus Torvalds help 361da177e4SLinus Torvalds If you need to specify a specific endianness for access to flash 371da177e4SLinus Torvalds chips, or if you wish to reduce the size of the kernel by including 381da177e4SLinus Torvalds support for only specific arrangements of flash chips, say 'Y'. This 391da177e4SLinus Torvalds option does not directly affect the code, but will enable other 401da177e4SLinus Torvalds configuration options which allow you to do so. 411da177e4SLinus Torvalds 421da177e4SLinus Torvalds If unsure, say 'N'. 431da177e4SLinus Torvalds 441da177e4SLinus Torvaldschoice 451da177e4SLinus Torvalds prompt "Flash cmd/query data swapping" 461da177e4SLinus Torvalds depends on MTD_CFI_ADV_OPTIONS 471da177e4SLinus Torvalds default MTD_CFI_NOSWAP 48a8222a84SBoris Brezillon help 491da177e4SLinus Torvalds This option defines the way in which the CPU attempts to arrange 501da177e4SLinus Torvalds data bits when writing the 'magic' commands to the chips. Saying 511da177e4SLinus Torvalds 'NO', which is the default when CONFIG_MTD_CFI_ADV_OPTIONS isn't 521da177e4SLinus Torvalds enabled, means that the CPU will not do any swapping; the chips 531da177e4SLinus Torvalds are expected to be wired to the CPU in 'host-endian' form. 541da177e4SLinus Torvalds Specific arrangements are possible with the BIG_ENDIAN_BYTE and 551da177e4SLinus Torvalds LITTLE_ENDIAN_BYTE, if the bytes are reversed. 561da177e4SLinus Torvalds 572e61c3a5SPaul Bolleconfig MTD_CFI_NOSWAP 58*603362b4SArnd Bergmann depends on !ARCH_IXP4XX || CPU_BIG_ENDIAN 592e61c3a5SPaul Bolle bool "NO" 601da177e4SLinus Torvalds 611da177e4SLinus Torvaldsconfig MTD_CFI_BE_BYTE_SWAP 621da177e4SLinus Torvalds bool "BIG_ENDIAN_BYTE" 631da177e4SLinus Torvalds 641da177e4SLinus Torvaldsconfig MTD_CFI_LE_BYTE_SWAP 65*603362b4SArnd Bergmann depends on !ARCH_IXP4XX 661da177e4SLinus Torvalds bool "LITTLE_ENDIAN_BYTE" 671da177e4SLinus Torvalds 681da177e4SLinus Torvaldsendchoice 691da177e4SLinus Torvalds 701da177e4SLinus Torvaldsconfig MTD_CFI_GEOMETRY 711da177e4SLinus Torvalds bool "Specific CFI Flash geometry selection" 721da177e4SLinus Torvalds depends on MTD_CFI_ADV_OPTIONS 73f5f92b36SArnd Bergmann select MTD_MAP_BANK_WIDTH_1 if !(MTD_MAP_BANK_WIDTH_2 || \ 74f5f92b36SArnd Bergmann MTD_MAP_BANK_WIDTH_4 || MTD_MAP_BANK_WIDTH_8 || \ 75f5f92b36SArnd Bergmann MTD_MAP_BANK_WIDTH_16 || MTD_MAP_BANK_WIDTH_32) 76f5f92b36SArnd Bergmann select MTD_CFI_I1 if !(MTD_CFI_I2 || MTD_CFI_I4 || MTD_CFI_I8) 771da177e4SLinus Torvalds help 781da177e4SLinus Torvalds This option does not affect the code directly, but will enable 791da177e4SLinus Torvalds some other configuration options which would allow you to reduce 801da177e4SLinus Torvalds the size of the kernel by including support for only certain 811da177e4SLinus Torvalds arrangements of CFI chips. If unsure, say 'N' and all options 821da177e4SLinus Torvalds which are supported by the current code will be enabled. 831da177e4SLinus Torvalds 841da177e4SLinus Torvaldsconfig MTD_MAP_BANK_WIDTH_1 851da177e4SLinus Torvalds bool "Support 8-bit buswidth" if MTD_CFI_GEOMETRY 861da177e4SLinus Torvalds default y 871da177e4SLinus Torvalds help 881da177e4SLinus Torvalds If you wish to support CFI devices on a physical bus which is 891da177e4SLinus Torvalds 8 bits wide, say 'Y'. 901da177e4SLinus Torvalds 911da177e4SLinus Torvaldsconfig MTD_MAP_BANK_WIDTH_2 921da177e4SLinus Torvalds bool "Support 16-bit buswidth" if MTD_CFI_GEOMETRY 931da177e4SLinus Torvalds default y 941da177e4SLinus Torvalds help 951da177e4SLinus Torvalds If you wish to support CFI devices on a physical bus which is 961da177e4SLinus Torvalds 16 bits wide, say 'Y'. 971da177e4SLinus Torvalds 981da177e4SLinus Torvaldsconfig MTD_MAP_BANK_WIDTH_4 991da177e4SLinus Torvalds bool "Support 32-bit buswidth" if MTD_CFI_GEOMETRY 1001da177e4SLinus Torvalds default y 1011da177e4SLinus Torvalds help 1021da177e4SLinus Torvalds If you wish to support CFI devices on a physical bus which is 1031da177e4SLinus Torvalds 32 bits wide, say 'Y'. 1041da177e4SLinus Torvalds 1051da177e4SLinus Torvaldsconfig MTD_MAP_BANK_WIDTH_8 1061da177e4SLinus Torvalds bool "Support 64-bit buswidth" if MTD_CFI_GEOMETRY 1071da177e4SLinus Torvalds default n 1081da177e4SLinus Torvalds help 1091da177e4SLinus Torvalds If you wish to support CFI devices on a physical bus which is 1101da177e4SLinus Torvalds 64 bits wide, say 'Y'. 1111da177e4SLinus Torvalds 1121da177e4SLinus Torvaldsconfig MTD_MAP_BANK_WIDTH_16 1131da177e4SLinus Torvalds bool "Support 128-bit buswidth" if MTD_CFI_GEOMETRY 1141da177e4SLinus Torvalds default n 1151da177e4SLinus Torvalds help 1161da177e4SLinus Torvalds If you wish to support CFI devices on a physical bus which is 1171da177e4SLinus Torvalds 128 bits wide, say 'Y'. 1181da177e4SLinus Torvalds 1191da177e4SLinus Torvaldsconfig MTD_MAP_BANK_WIDTH_32 1201da177e4SLinus Torvalds bool "Support 256-bit buswidth" if MTD_CFI_GEOMETRY 121fddcca51SArnd Bergmann select MTD_COMPLEX_MAPPINGS if HAS_IOMEM 1221da177e4SLinus Torvalds default n 1231da177e4SLinus Torvalds help 1241da177e4SLinus Torvalds If you wish to support CFI devices on a physical bus which is 1251da177e4SLinus Torvalds 256 bits wide, say 'Y'. 1261da177e4SLinus Torvalds 1271da177e4SLinus Torvaldsconfig MTD_CFI_I1 1281da177e4SLinus Torvalds bool "Support 1-chip flash interleave" if MTD_CFI_GEOMETRY 1291da177e4SLinus Torvalds default y 1301da177e4SLinus Torvalds help 1311da177e4SLinus Torvalds If your flash chips are not interleaved - i.e. you only have one 1321da177e4SLinus Torvalds flash chip addressed by each bus cycle, then say 'Y'. 1331da177e4SLinus Torvalds 1341da177e4SLinus Torvaldsconfig MTD_CFI_I2 1351da177e4SLinus Torvalds bool "Support 2-chip flash interleave" if MTD_CFI_GEOMETRY 1361da177e4SLinus Torvalds default y 1371da177e4SLinus Torvalds help 1381da177e4SLinus Torvalds If your flash chips are interleaved in pairs - i.e. you have two 1391da177e4SLinus Torvalds flash chips addressed by each bus cycle, then say 'Y'. 1401da177e4SLinus Torvalds 1411da177e4SLinus Torvaldsconfig MTD_CFI_I4 1421da177e4SLinus Torvalds bool "Support 4-chip flash interleave" if MTD_CFI_GEOMETRY 1431da177e4SLinus Torvalds default n 1441da177e4SLinus Torvalds help 1451da177e4SLinus Torvalds If your flash chips are interleaved in fours - i.e. you have four 1461da177e4SLinus Torvalds flash chips addressed by each bus cycle, then say 'Y'. 1471da177e4SLinus Torvalds 1481da177e4SLinus Torvaldsconfig MTD_CFI_I8 1491da177e4SLinus Torvalds bool "Support 8-chip flash interleave" if MTD_CFI_GEOMETRY 1501da177e4SLinus Torvalds default n 1511da177e4SLinus Torvalds help 1521da177e4SLinus Torvalds If your flash chips are interleaved in eights - i.e. you have eight 1531da177e4SLinus Torvalds flash chips addressed by each bus cycle, then say 'Y'. 1541da177e4SLinus Torvalds 155f77814ddSNicolas Pitreconfig MTD_OTP 156f77814ddSNicolas Pitre bool "Protection Registers aka one-time programmable (OTP) bits" 157f77814ddSNicolas Pitre depends on MTD_CFI_ADV_OPTIONS 158f77814ddSNicolas Pitre default n 159f77814ddSNicolas Pitre help 160f77814ddSNicolas Pitre This enables support for reading, writing and locking so called 161f77814ddSNicolas Pitre "Protection Registers" present on some flash chips. 162f77814ddSNicolas Pitre A subset of them are pre-programmed at the factory with a 163f77814ddSNicolas Pitre unique set of values. The rest is user-programmable. 164f77814ddSNicolas Pitre 165f77814ddSNicolas Pitre The user-programmable Protection Registers contain one-time 166f77814ddSNicolas Pitre programmable (OTP) bits; when programmed, register bits cannot be 167f77814ddSNicolas Pitre erased. Each Protection Register can be accessed multiple times to 168f77814ddSNicolas Pitre program individual bits, as long as the register remains unlocked. 169f77814ddSNicolas Pitre 170f77814ddSNicolas Pitre Each Protection Register has an associated Lock Register bit. When a 171f77814ddSNicolas Pitre Lock Register bit is programmed, the associated Protection Register 172f77814ddSNicolas Pitre can only be read; it can no longer be programmed. Additionally, 173f77814ddSNicolas Pitre because the Lock Register bits themselves are OTP, when programmed, 174f77814ddSNicolas Pitre Lock Register bits cannot be erased. Therefore, when a Protection 175f77814ddSNicolas Pitre Register is locked, it cannot be unlocked. 176f77814ddSNicolas Pitre 177f77814ddSNicolas Pitre This feature should therefore be used with extreme care. Any mistake 178f77814ddSNicolas Pitre in the programming of OTP bits will waste them. 179f77814ddSNicolas Pitre 1801da177e4SLinus Torvaldsconfig MTD_CFI_INTELEXT 1815a4c4c5eSPhilippe De Muyter tristate "Support for CFI command set 0001 (Intel/Sharp chips)" 1821da177e4SLinus Torvalds depends on MTD_GEN_PROBE 1831da177e4SLinus Torvalds select MTD_CFI_UTIL 1841da177e4SLinus Torvalds help 1851da177e4SLinus Torvalds The Common Flash Interface defines a number of different command 1861da177e4SLinus Torvalds sets which a CFI-compliant chip may claim to implement. This code 1875a4c4c5eSPhilippe De Muyter provides support for command set 0001, used on Intel StrataFlash 1885a4c4c5eSPhilippe De Muyter and other parts. 1891da177e4SLinus Torvalds 1901da177e4SLinus Torvaldsconfig MTD_CFI_AMDSTD 1915a4c4c5eSPhilippe De Muyter tristate "Support for CFI command set 0002 (AMD/Fujitsu/Spansion chips)" 1921da177e4SLinus Torvalds depends on MTD_GEN_PROBE 1931da177e4SLinus Torvalds select MTD_CFI_UTIL 1941da177e4SLinus Torvalds help 1951da177e4SLinus Torvalds The Common Flash Interface defines a number of different command 1961da177e4SLinus Torvalds sets which a CFI-compliant chip may claim to implement. This code 1975a4c4c5eSPhilippe De Muyter provides support for command set 0002, used on chips including 1985a4c4c5eSPhilippe De Muyter the AMD Am29LV320. 1991da177e4SLinus Torvalds 2001da177e4SLinus Torvaldsconfig MTD_CFI_STAA 2015a4c4c5eSPhilippe De Muyter tristate "Support for CFI command set 0020 (ST (Advanced Architecture) chips)" 2021da177e4SLinus Torvalds depends on MTD_GEN_PROBE 2031da177e4SLinus Torvalds select MTD_CFI_UTIL 2041da177e4SLinus Torvalds help 2051da177e4SLinus Torvalds The Common Flash Interface defines a number of different command 2061da177e4SLinus Torvalds sets which a CFI-compliant chip may claim to implement. This code 2075a4c4c5eSPhilippe De Muyter provides support for command set 0020. 2081da177e4SLinus Torvalds 2091da177e4SLinus Torvaldsconfig MTD_CFI_UTIL 2101da177e4SLinus Torvalds tristate 2111da177e4SLinus Torvalds 2121da177e4SLinus Torvaldsconfig MTD_RAM 2131da177e4SLinus Torvalds tristate "Support for RAM chips in bus mapping" 2141da177e4SLinus Torvalds help 2151da177e4SLinus Torvalds This option enables basic support for RAM chips accessed through 2161da177e4SLinus Torvalds a bus mapping driver. 2171da177e4SLinus Torvalds 2181da177e4SLinus Torvaldsconfig MTD_ROM 2191da177e4SLinus Torvalds tristate "Support for ROM chips in bus mapping" 2201da177e4SLinus Torvalds help 2211da177e4SLinus Torvalds This option enables basic support for ROM chips accessed through 2221da177e4SLinus Torvalds a bus mapping driver. 2231da177e4SLinus Torvalds 2241da177e4SLinus Torvaldsconfig MTD_ABSENT 2251da177e4SLinus Torvalds tristate "Support for absent chips in bus mapping" 2261da177e4SLinus Torvalds help 2271da177e4SLinus Torvalds This option enables support for a dummy probing driver used to 2281da177e4SLinus Torvalds allocated placeholder MTD devices on systems that have socketed 2291da177e4SLinus Torvalds or removable media. Use of this driver as a fallback chip probe 2301da177e4SLinus Torvalds preserves the expected registration order of MTD device nodes on 2311da177e4SLinus Torvalds the system regardless of media presence. Device nodes created 2321da177e4SLinus Torvalds with this driver will return -ENODEV upon access. 2331da177e4SLinus Torvalds 2341da177e4SLinus Torvaldsconfig MTD_XIP 2351da177e4SLinus Torvalds bool "XIP aware MTD support" 2367b4dd55bSKees Cook depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && ARCH_MTD_XIP 2371da177e4SLinus Torvalds default y if XIP_KERNEL 2381da177e4SLinus Torvalds help 2391da177e4SLinus Torvalds This allows MTD support to work with flash memory which is also 2401da177e4SLinus Torvalds used for XIP purposes. If you're not sure what this is all about 2411da177e4SLinus Torvalds then say N. 2421da177e4SLinus Torvalds 2431da177e4SLinus Torvaldsendmenu 244