Skip to content

Commit c0ba929

Browse files
committed
mtd: spinand: Decouple write enable and write disable operations
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>
1 parent 7a5cd76 commit c0ba929

4 files changed

Lines changed: 11 additions & 5 deletions

File tree

drivers/mtd/nand/spi/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ static void spinand_ondie_ecc_save_status(struct nand_device *nand, u8 status)
362362

363363
int spinand_write_enable_op(struct spinand_device *spinand)
364364
{
365-
struct spi_mem_op op = SPINAND_WR_EN_DIS_1S_0_0_OP(true);
365+
struct spi_mem_op op = SPINAND_WR_EN_1S_0_0_OP;
366366

367367
return spi_mem_exec_op(spinand->spimem, &op);
368368
}

drivers/mtd/nand/spi/esmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static int f50l1g41lb_user_otp_info(struct spinand_device *spinand, size_t len,
138138
static int f50l1g41lb_otp_lock(struct spinand_device *spinand, loff_t from,
139139
size_t len)
140140
{
141-
struct spi_mem_op write_op = SPINAND_WR_EN_DIS_1S_0_0_OP(true);
141+
struct spi_mem_op write_op = SPINAND_WR_EN_1S_0_0_OP;
142142
struct spi_mem_op exec_op = SPINAND_PROG_EXEC_1S_1S_0_OP(0);
143143
u8 status;
144144
int ret;

drivers/mtd/nand/spi/micron.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ static int mt29f2g01abagd_user_otp_info(struct spinand_device *spinand,
251251
static int mt29f2g01abagd_otp_lock(struct spinand_device *spinand, loff_t from,
252252
size_t len)
253253
{
254-
struct spi_mem_op write_op = SPINAND_WR_EN_DIS_1S_0_0_OP(true);
254+
struct spi_mem_op write_op = SPINAND_WR_EN_1S_0_0_OP;
255255
struct spi_mem_op exec_op = SPINAND_PROG_EXEC_1S_1S_0_OP(0);
256256
u8 status;
257257
int ret;

include/linux/mtd/spinand.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@
2626
SPI_MEM_OP_NO_DUMMY, \
2727
SPI_MEM_OP_NO_DATA)
2828

29-
#define SPINAND_WR_EN_DIS_1S_0_0_OP(enable) \
30-
SPI_MEM_OP(SPI_MEM_OP_CMD((enable) ? 0x06 : 0x04, 1), \
29+
#define SPINAND_WR_EN_1S_0_0_OP \
30+
SPI_MEM_OP(SPI_MEM_OP_CMD(0x06, 1), \
31+
SPI_MEM_OP_NO_ADDR, \
32+
SPI_MEM_OP_NO_DUMMY, \
33+
SPI_MEM_OP_NO_DATA)
34+
35+
#define SPINAND_WR_DIS_1S_0_0_OP \
36+
SPI_MEM_OP(SPI_MEM_OP_CMD(0x04, 1), \
3137
SPI_MEM_OP_NO_ADDR, \
3238
SPI_MEM_OP_NO_DUMMY, \
3339
SPI_MEM_OP_NO_DATA)

0 commit comments

Comments
 (0)