Skip to content

Commit a84d452

Browse files
mwallePratyush Yadav
authored andcommitted
mtd: spi-nor: winbond: add Zetta ZD25Q128C support
Zetta normally uses BAh as its vendor ID. But for the ZD25Q128C they took the one from Winbond and messed up the size parameters in SFDP. Most functions seem compatible with the W25Q128, we just have to fix up the size. Link: http://www.zettadevice.com/upload/file/20150821/DS_Zetta_25Q128_RevA.pdf Link: https://www.lcsc.com/datasheet/lcsc_datasheet_2312081757_Zetta-ZD25Q128CSIGT_C19626875.pdf Signed-off-by: Michael Walle <[email protected]> Reviewed-by: Pratyush Yadav <[email protected]> Signed-off-by: Pratyush Yadav <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 86fd0e6 commit a84d452

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/mtd/spi-nor/winbond.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,31 @@
1717
SPI_MEM_OP_NO_DUMMY, \
1818
SPI_MEM_OP_DATA_OUT(1, buf, 0))
1919

20+
static int
21+
w25q128_post_bfpt_fixups(struct spi_nor *nor,
22+
const struct sfdp_parameter_header *bfpt_header,
23+
const struct sfdp_bfpt *bfpt)
24+
{
25+
/*
26+
* Zetta ZD25Q128C is a clone of the Winbond device. But the encoded
27+
* size is really wrong. It seems that they confused Mbit with MiB.
28+
* Thus the flash is discovered as a 2MiB device.
29+
*/
30+
if (bfpt_header->major == SFDP_JESD216_MAJOR &&
31+
bfpt_header->minor == SFDP_JESD216_MINOR &&
32+
nor->params->size == SZ_2M &&
33+
nor->params->erase_map.regions[0].size == SZ_2M) {
34+
nor->params->size = SZ_16M;
35+
nor->params->erase_map.regions[0].size = SZ_16M;
36+
}
37+
38+
return 0;
39+
}
40+
41+
static const struct spi_nor_fixups w25q128_fixups = {
42+
.post_bfpt = w25q128_post_bfpt_fixups,
43+
};
44+
2045
static int
2146
w25q256_post_bfpt_fixups(struct spi_nor *nor,
2247
const struct sfdp_parameter_header *bfpt_header,
@@ -108,6 +133,7 @@ static const struct flash_info winbond_nor_parts[] = {
108133
.size = SZ_16M,
109134
.flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB,
110135
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
136+
.fixups = &w25q128_fixups,
111137
}, {
112138
.id = SNOR_ID(0xef, 0x40, 0x19),
113139
.name = "w25q256",

0 commit comments

Comments
 (0)