]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mtd: spinand: Use more specific naming for the get/set feature ops
authorMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 3 Apr 2025 09:19:14 +0000 (11:19 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 29 Apr 2025 09:05:03 +0000 (11:05 +0200)
SPI operations have been initially described through macros implicitly
implying the use of a single SPI SDR bus. Macros for supporting dual and
quad I/O transfers have been added on top, generally inspired by vendor
naming, followed by DTR operations. Soon we might see octal
and even octal DTR operations as well (including the opcode byte).

Let's clarify what the macro really mean by describing the expected bus
topology in the get/set feature macro names.

Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
[Miquel: Fixed conflicts with -next by updating macronix driver]
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/spi/core.c
drivers/mtd/nand/spi/gigadevice.c
drivers/mtd/nand/spi/macronix.c
drivers/mtd/nand/spi/micron.c
drivers/mtd/nand/spi/toshiba.c
drivers/mtd/nand/spi/winbond.c
include/linux/mtd/spinand.h

index 40bd4fe996f26ca24d83ae54bb695b9b86bef5a7..28a539188c3feb6aaf84f0e2104f76580d7cbef9 100644 (file)
@@ -22,7 +22,7 @@
 
 static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val)
 {
-       struct spi_mem_op op = SPINAND_GET_FEATURE_OP(reg,
+       struct spi_mem_op op = SPINAND_GET_FEATURE_1S_1S_1S_OP(reg,
                                                      spinand->scratchbuf);
        int ret;
 
@@ -36,7 +36,7 @@ static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val)
 
 int spinand_write_reg_op(struct spinand_device *spinand, u8 reg, u8 val)
 {
-       struct spi_mem_op op = SPINAND_SET_FEATURE_OP(reg,
+       struct spi_mem_op op = SPINAND_SET_FEATURE_1S_1S_1S_OP(reg,
                                                      spinand->scratchbuf);
 
        *spinand->scratchbuf = val;
@@ -549,8 +549,8 @@ static int spinand_erase_op(struct spinand_device *spinand,
 int spinand_wait(struct spinand_device *spinand, unsigned long initial_delay_us,
                 unsigned long poll_delay_us, u8 *s)
 {
-       struct spi_mem_op op = SPINAND_GET_FEATURE_OP(REG_STATUS,
-                                                     spinand->scratchbuf);
+       struct spi_mem_op op = SPINAND_GET_FEATURE_1S_1S_1S_OP(REG_STATUS,
+                                                              spinand->scratchbuf);
        u8 status;
        int ret;
 
index d620bb02a20a0df04e8d0af187ee277d6ef430f2..73a483227831518a480dc34de17efdaa398b5627 100644 (file)
@@ -185,7 +185,7 @@ static int gd5fxgq4uexxg_ecc_get_status(struct spinand_device *spinand,
                                        u8 status)
 {
        u8 status2;
-       struct spi_mem_op op = SPINAND_GET_FEATURE_OP(GD5FXGQXXEXXG_REG_STATUS2,
+       struct spi_mem_op op = SPINAND_GET_FEATURE_1S_1S_1S_OP(GD5FXGQXXEXXG_REG_STATUS2,
                                                      spinand->scratchbuf);
        int ret;
 
@@ -228,7 +228,7 @@ static int gd5fxgq5xexxg_ecc_get_status(struct spinand_device *spinand,
                                        u8 status)
 {
        u8 status2;
-       struct spi_mem_op op = SPINAND_GET_FEATURE_OP(GD5FXGQXXEXXG_REG_STATUS2,
+       struct spi_mem_op op = SPINAND_GET_FEATURE_1S_1S_1S_OP(GD5FXGQXXEXXG_REG_STATUS2,
                                                      spinand->scratchbuf);
        int ret;
 
index 1ef08ad850a2fe04bea3560bbf859b572089335a..9e0406852ee15dde9213aaeaa673a7b14b6023ef 100644 (file)
@@ -148,8 +148,8 @@ static int macronix_set_cont_read(struct spinand_device *spinand, bool enable)
 static int macronix_set_read_retry(struct spinand_device *spinand,
                                             unsigned int retry_mode)
 {
-       struct spi_mem_op op = SPINAND_SET_FEATURE_OP(MACRONIX_FEATURE_ADDR_READ_RETRY,
-                                                     spinand->scratchbuf);
+       struct spi_mem_op op = SPINAND_SET_FEATURE_1S_1S_1S_OP(MACRONIX_FEATURE_ADDR_READ_RETRY,
+                                                              spinand->scratchbuf);
 
        *spinand->scratchbuf = retry_mode;
        return spi_mem_exec_op(spinand->spimem, &op);
index e25f769adc5438fdd1cec3760220800117becbd9..8e03bd9719ec2060f77f8c809c44acc889411af3 100644 (file)
@@ -137,7 +137,7 @@ static const struct mtd_ooblayout_ops micron_4_ooblayout = {
 static int micron_select_target(struct spinand_device *spinand,
                                unsigned int target)
 {
-       struct spi_mem_op op = SPINAND_SET_FEATURE_OP(MICRON_DIE_SELECT_REG,
+       struct spi_mem_op op = SPINAND_SET_FEATURE_1S_1S_1S_OP(MICRON_DIE_SELECT_REG,
                                                      spinand->scratchbuf);
 
        if (target > 1)
index 2e2106b2705f0852aa5b13263d29d8916c1a6e7d..a600aa771519fa04a1caafb8c8e636eab10359c4 100644 (file)
@@ -73,7 +73,7 @@ static int tx58cxgxsxraix_ecc_get_status(struct spinand_device *spinand,
 {
        struct nand_device *nand = spinand_to_nand(spinand);
        u8 mbf = 0;
-       struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, spinand->scratchbuf);
+       struct spi_mem_op op = SPINAND_GET_FEATURE_1S_1S_1S_OP(0x30, spinand->scratchbuf);
 
        switch (status & STATUS_ECC_MASK) {
        case STATUS_ECC_NO_BITFLIPS:
index 8394a1b1fb0c125ddb614269069d107463e905a3..5816b489b57b0070ddeda745cf17c04efc5080cd 100644 (file)
@@ -146,7 +146,7 @@ static int w25n02kv_ecc_get_status(struct spinand_device *spinand,
 {
        struct nand_device *nand = spinand_to_nand(spinand);
        u8 mbf = 0;
-       struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, spinand->scratchbuf);
+       struct spi_mem_op op = SPINAND_GET_FEATURE_1S_1S_1S_OP(0x30, spinand->scratchbuf);
 
        switch (status & STATUS_ECC_MASK) {
        case STATUS_ECC_NO_BITFLIPS:
index dfb5c74cad6dbe991620d0331c7fc63c725ff6b4..8ea40d838dc247cab83452e8f0c33762d159150f 100644 (file)
                   SPI_MEM_OP_DUMMY(ndummy, 1),                         \
                   SPI_MEM_OP_DATA_IN(len, buf, 1))
 
-#define SPINAND_SET_FEATURE_OP(reg, valptr)                            \
+#define SPINAND_SET_FEATURE_1S_1S_1S_OP(reg, valptr)                   \
        SPI_MEM_OP(SPI_MEM_OP_CMD(0x1f, 1),                             \
                   SPI_MEM_OP_ADDR(1, reg, 1),                          \
                   SPI_MEM_OP_NO_DUMMY,                                 \
                   SPI_MEM_OP_DATA_OUT(1, valptr, 1))
 
-#define SPINAND_GET_FEATURE_OP(reg, valptr)                            \
+#define SPINAND_GET_FEATURE_1S_1S_1S_OP(reg, valptr)                   \
        SPI_MEM_OP(SPI_MEM_OP_CMD(0x0f, 1),                             \
                   SPI_MEM_OP_ADDR(1, reg, 1),                          \
                   SPI_MEM_OP_NO_DUMMY,                                 \