mtd: spi-nor: otp: fix access to security registers in 4 byte mode
authorMichael Walle <michael@walle.cc>
Mon, 7 Jun 2021 11:27:41 +0000 (13:27 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 15:07:38 +0000 (17:07 +0200)
[ Upstream commit b97b1a769849beb6b40b740817b06f1a50e1c589 ]

The security registers either take a 3 byte or a 4 byte address offset,
depending on the address mode of the flash. Thus just leave the
nor->addr_width as is.

Fixes: cad3193fe9d1 ("mtd: spi-nor: implement OTP support for Winbond and similar flashes")
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Acked-by: Pratyush Yadav <p.yadav@ti.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mtd/spi-nor/otp.c

index fcf38d26034500e6d3eb7b401d90ce1b74f3fa63..5c51a2c9be61cf8d216da18e8bcea47d69a768c1 100644 (file)
@@ -40,7 +40,6 @@ int spi_nor_otp_read_secr(struct spi_nor *nor, loff_t addr, size_t len, u8 *buf)
        rdesc = nor->dirmap.rdesc;
 
        nor->read_opcode = SPINOR_OP_RSECR;
-       nor->addr_width = 3;
        nor->read_dummy = 8;
        nor->read_proto = SNOR_PROTO_1_1_1;
        nor->dirmap.rdesc = NULL;
@@ -84,7 +83,6 @@ int spi_nor_otp_write_secr(struct spi_nor *nor, loff_t addr, size_t len,
        wdesc = nor->dirmap.wdesc;
 
        nor->program_opcode = SPINOR_OP_PSECR;
-       nor->addr_width = 3;
        nor->write_proto = SNOR_PROTO_1_1_1;
        nor->dirmap.wdesc = NULL;