Skip to content

Commit b206b82

Browse files
mwalleambarus
authored andcommitted
mtd: spi-nor: winbond: add OTP support to w25q32fw/jw
With all the helper functions in place, add OTP support for the Winbond W25Q32JW and W25Q32FW. Both were tested on a LS1028A SoC with a NXP FSPI controller. Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Link: https://lore.kernel.org/r/20210321235140.8308-4-michael@walle.cc
1 parent cad3193 commit b206b82

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

drivers/mtd/spi-nor/winbond.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,18 @@ static const struct flash_info winbond_parts[] = {
5454
{ "w25q32", INFO(0xef4016, 0, 64 * 1024, 64, SECT_4K) },
5555
{ "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64,
5656
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
57-
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) },
57+
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
58+
OTP_INFO(256, 3, 0x1000, 0x1000)
59+
},
60+
5861
{ "w25q32jv", INFO(0xef7016, 0, 64 * 1024, 64,
5962
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
6063
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
6164
},
6265
{ "w25q32jwm", INFO(0xef8016, 0, 64 * 1024, 64,
6366
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
64-
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) },
67+
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
68+
OTP_INFO(256, 3, 0x1000, 0x1000) },
6569
{ "w25q64jwm", INFO(0xef8017, 0, 64 * 1024, 128,
6670
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
6771
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) },
@@ -132,9 +136,18 @@ static int winbond_set_4byte_addr_mode(struct spi_nor *nor, bool enable)
132136
return spi_nor_write_disable(nor);
133137
}
134138

139+
static const struct spi_nor_otp_ops winbond_otp_ops = {
140+
.read = spi_nor_otp_read_secr,
141+
.write = spi_nor_otp_write_secr,
142+
.lock = spi_nor_otp_lock_sr2,
143+
.is_locked = spi_nor_otp_is_locked_sr2,
144+
};
145+
135146
static void winbond_default_init(struct spi_nor *nor)
136147
{
137148
nor->params->set_4byte_addr_mode = winbond_set_4byte_addr_mode;
149+
if (nor->params->otp.org->n_regions)
150+
nor->params->otp.ops = &winbond_otp_ops;
138151
}
139152

140153
static const struct spi_nor_fixups winbond_fixups = {

0 commit comments

Comments
 (0)