]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: spi-nore-core: Fix 4KB erase opcode for s25fs-s
authorTakahiro Kuwano <Takahiro.Kuwano@infineon.com>
Fri, 27 Sep 2024 01:11:17 +0000 (10:11 +0900)
committerTom Rini <trini@konsulko.com>
Thu, 10 Oct 2024 14:12:12 +0000 (08:12 -0600)
The correct 4KB erase opcode should be selected based on the address width
currently used.

Fixes: 562d166a13 ("mtd: spi-nor-core: Add fixups for s25fs512s")
Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
drivers/mtd/spi/spi-nor-core.c

index aea611fef5239ae5cf311137a59ced20980947ba..b633f3092b1f48816d664493a19042d86eec708c 100644 (file)
@@ -3349,8 +3349,10 @@ static int s25fs_s_quad_enable(struct spi_nor *nor)
 
 static int s25fs_s_erase_non_uniform(struct spi_nor *nor, loff_t addr)
 {
+       u8 opcode = nor->addr_width == 4 ? SPINOR_OP_BE_4K_4B : SPINOR_OP_BE_4K;
+
        /* Support 8 x 4KB sectors at bottom */
-       return spansion_erase_non_uniform(nor, addr, SPINOR_OP_BE_4K_4B, 0, SZ_32K);
+       return spansion_erase_non_uniform(nor, addr, opcode, 0, SZ_32K);
 }
 
 static int s25fs_s_setup(struct spi_nor *nor, const struct flash_info *info,