aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu Xiang <liu.xiang6@zte.com.cn>2019-06-24 12:00:46 -0400
committerTudor Ambarus <tudor.ambarus@microchip.com>2019-06-27 10:13:22 -0400
commitcf580a92400584a48f59e07c372a635160340864 (patch)
tree1c285fbe68df56935a33648020834ab20de0be67
parent62de37da9f382455b983f2f92b10012109005278 (diff)
mtd: spi-nor: fix nor->addr_width when its value configured from SFDP does not match the actual width
IS25LP256 gets BFPT_DWORD1_ADDRESS_BYTES_3_ONLY from BFPT table for address width. But in actual fact the flash can support 4-byte address. Use a post bfpt fixup hook to overwrite the address width advertised by the BFPT. Signed-off-by: Liu Xiang <liu.xiang6@zte.com.cn> Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
-rw-r--r--drivers/mtd/spi-nor/spi-nor.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 9d03fe50533e..e3a28c0f22cb 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1687,6 +1687,28 @@ static int sr2_bit7_quad_enable(struct spi_nor *nor)
1687 .flags = SPI_NOR_NO_FR | SPI_S3AN, 1687 .flags = SPI_NOR_NO_FR | SPI_S3AN,
1688 1688
1689static int 1689static int
1690is25lp256_post_bfpt_fixups(struct spi_nor *nor,
1691 const struct sfdp_parameter_header *bfpt_header,
1692 const struct sfdp_bfpt *bfpt,
1693 struct spi_nor_flash_parameter *params)
1694{
1695 /*
1696 * IS25LP256 supports 4B opcodes, but the BFPT advertises a
1697 * BFPT_DWORD1_ADDRESS_BYTES_3_ONLY address width.
1698 * Overwrite the address width advertised by the BFPT.
1699 */
1700 if ((bfpt->dwords[BFPT_DWORD(1)] & BFPT_DWORD1_ADDRESS_BYTES_MASK) ==
1701 BFPT_DWORD1_ADDRESS_BYTES_3_ONLY)
1702 nor->addr_width = 4;
1703
1704 return 0;
1705}
1706
1707static struct spi_nor_fixups is25lp256_fixups = {
1708 .post_bfpt = is25lp256_post_bfpt_fixups,
1709};
1710
1711static int
1690mx25l25635_post_bfpt_fixups(struct spi_nor *nor, 1712mx25l25635_post_bfpt_fixups(struct spi_nor *nor,
1691 const struct sfdp_parameter_header *bfpt_header, 1713 const struct sfdp_parameter_header *bfpt_header,
1692 const struct sfdp_bfpt *bfpt, 1714 const struct sfdp_bfpt *bfpt,
@@ -1827,7 +1849,8 @@ static const struct flash_info spi_nor_ids[] = {
1827 SECT_4K | SPI_NOR_DUAL_READ) }, 1849 SECT_4K | SPI_NOR_DUAL_READ) },
1828 { "is25lp256", INFO(0x9d6019, 0, 64 * 1024, 512, 1850 { "is25lp256", INFO(0x9d6019, 0, 64 * 1024, 512,
1829 SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | 1851 SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
1830 SPI_NOR_4B_OPCODES) }, 1852 SPI_NOR_4B_OPCODES)
1853 .fixups = &is25lp256_fixups },
1831 { "is25wp032", INFO(0x9d7016, 0, 64 * 1024, 64, 1854 { "is25wp032", INFO(0x9d7016, 0, 64 * 1024, 64,
1832 SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, 1855 SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
1833 { "is25wp064", INFO(0x9d7017, 0, 64 * 1024, 128, 1856 { "is25wp064", INFO(0x9d7017, 0, 64 * 1024, 128,