]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mtd: spinand: Decouple write enable and write disable operations
authorMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 9 Jan 2026 17:18:06 +0000 (18:18 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 29 Jan 2026 19:21:40 +0000 (20:21 +0100)
In order to introduce templates for all operations and not only for page
helpers (in order to introduce octal DDR support), decouple the WR_EN
and WR_DIS operations into two separate macros.

Adapt the callers accordingly.

There is no functional change.

Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/spi/core.c
drivers/mtd/nand/spi/esmt.c
drivers/mtd/nand/spi/micron.c
include/linux/mtd/spinand.h

index 2c587685e02adab66c63edce38fccb821c3b1ec4..30a8f2894d0244c6cd709732a24293fef727695a 100644 (file)
@@ -362,7 +362,7 @@ static void spinand_ondie_ecc_save_status(struct nand_device *nand, u8 status)
 
 int spinand_write_enable_op(struct spinand_device *spinand)
 {
-       struct spi_mem_op op = SPINAND_WR_EN_DIS_1S_0_0_OP(true);
+       struct spi_mem_op op = SPINAND_WR_EN_1S_0_0_OP;
 
        return spi_mem_exec_op(spinand->spimem, &op);
 }
index e60e4ac1fd6fb1c08460926bb4e4c5c3b879a617..adadc01e8f2fdd4ec8edf055acc3404c88050037 100644 (file)
@@ -138,7 +138,7 @@ static int f50l1g41lb_user_otp_info(struct spinand_device *spinand, size_t len,
 static int f50l1g41lb_otp_lock(struct spinand_device *spinand, loff_t from,
                               size_t len)
 {
-       struct spi_mem_op write_op = SPINAND_WR_EN_DIS_1S_0_0_OP(true);
+       struct spi_mem_op write_op = SPINAND_WR_EN_1S_0_0_OP;
        struct spi_mem_op exec_op = SPINAND_PROG_EXEC_1S_1S_0_OP(0);
        u8 status;
        int ret;
index a49d7cb6a96da701ee981e677f414c57eabb2cec..b8130e04e8e798519ad38c58b5569935c1a447a2 100644 (file)
@@ -251,7 +251,7 @@ static int mt29f2g01abagd_user_otp_info(struct spinand_device *spinand,
 static int mt29f2g01abagd_otp_lock(struct spinand_device *spinand, loff_t from,
                                   size_t len)
 {
-       struct spi_mem_op write_op = SPINAND_WR_EN_DIS_1S_0_0_OP(true);
+       struct spi_mem_op write_op = SPINAND_WR_EN_1S_0_0_OP;
        struct spi_mem_op exec_op = SPINAND_PROG_EXEC_1S_1S_0_OP(0);
        u8 status;
        int ret;
index cafbd0fa8db0dc6f473b9127fe1e1c06cce68b86..4715083aa8e581f7497c102a930bf70985fbaeae 100644 (file)
                   SPI_MEM_OP_NO_DUMMY,                                 \
                   SPI_MEM_OP_NO_DATA)
 
-#define SPINAND_WR_EN_DIS_1S_0_0_OP(enable)                                    \
-       SPI_MEM_OP(SPI_MEM_OP_CMD((enable) ? 0x06 : 0x04, 1),           \
+#define SPINAND_WR_EN_1S_0_0_OP                                                \
+       SPI_MEM_OP(SPI_MEM_OP_CMD(0x06, 1),                             \
+                  SPI_MEM_OP_NO_ADDR,                                  \
+                  SPI_MEM_OP_NO_DUMMY,                                 \
+                  SPI_MEM_OP_NO_DATA)
+
+#define SPINAND_WR_DIS_1S_0_0_OP                                       \
+       SPI_MEM_OP(SPI_MEM_OP_CMD(0x04, 1),                             \
                   SPI_MEM_OP_NO_ADDR,                                  \
                   SPI_MEM_OP_NO_DUMMY,                                 \
                   SPI_MEM_OP_NO_DATA)