mtd: spi-nor: spansion: Determine current address mode
authorTakahiro Kuwano <Takahiro.Kuwano@infineon.com>
Fri, 31 Mar 2023 07:46:06 +0000 (07:46 +0000)
committerTudor Ambarus <tudor.ambarus@linaro.org>
Tue, 4 Apr 2023 06:43:53 +0000 (09:43 +0300)
commitc87c9b11c53cecab8e8a93290fa3b488e6838dab
tree084e54a16b409c11916c7830d550594ebb40ecdc
parentb6094ac83dd4fb4fa2849b804cc9fc1c70054852
mtd: spi-nor: spansion: Determine current address mode

Internal address mode (3- or 4-byte) affects to the address length in
Read Any Reg op. Read Any Reg op is used in SMPT parse and other setup
functions. Current driver assumes that address mode is factory default
but users can change it via volatile and non-volatile registers.

Current address mode can be checked by CFR2V[7] but Read Any Reg op is
needed to read CFR2V (chicken-and-egg).

Introduce a way to determine current address mode by comparing status
register 1 values read by different address length.

Suggested-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Link: https://lore.kernel.org/r/20230331074606.3559258-11-tudor.ambarus@linaro.org
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
drivers/mtd/spi-nor/spansion.c