Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mtd: spinand: macronix: Convert vendor specific operation to SPINAND_OP()

Macronix chips require a vendor specific operation to read the ECC
status register. Instead of defining this op only in the function that
needs it, hiding it from the core, make it a proper define like all
other spi-mem operations, and implement the necessary
spinand_fill_*_op() helper to make the SPINAND_OP() macro work. This way
we can use it from any function without any extra handling outside of
this helper when we will convert the core to support octal DDR busses.

Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

+15 -5
+15 -5
drivers/mtd/nand/spi/macronix.c
··· 41 41 SPINAND_PROG_LOAD_1S_1S_4S_OP(false, 0, NULL, 0), 42 42 SPINAND_PROG_LOAD_1S_1S_1S_OP(false, 0, NULL, 0)); 43 43 44 + #define SPINAND_MACRONIX_READ_ECCSR_1S_0_1S(buf) \ 45 + SPI_MEM_OP(SPI_MEM_OP_CMD(0x7c, 1), \ 46 + SPI_MEM_OP_NO_ADDR, \ 47 + SPI_MEM_OP_DUMMY(1, 1), \ 48 + SPI_MEM_OP_DATA_IN(1, buf, 1)) 49 + 50 + static struct spi_mem_op 51 + spinand_fill_macronix_read_eccsr_op(struct spinand_device *spinand, void *valptr) 52 + { 53 + return (struct spi_mem_op)SPINAND_MACRONIX_READ_ECCSR_1S_0_1S(valptr); 54 + } 55 + 44 56 static int mx35lfxge4ab_ooblayout_ecc(struct mtd_info *mtd, int section, 45 57 struct mtd_oob_region *region) 46 58 { ··· 79 67 static int macronix_get_eccsr(struct spinand_device *spinand, u8 *eccsr) 80 68 { 81 69 struct macronix_priv *priv = spinand->priv; 82 - struct spi_mem_op op = SPI_MEM_OP(SPI_MEM_OP_CMD(0x7c, 1), 83 - SPI_MEM_OP_NO_ADDR, 84 - SPI_MEM_OP_DUMMY(1, 1), 85 - SPI_MEM_OP_DATA_IN(1, eccsr, 1)); 70 + struct spi_mem_op op = SPINAND_OP(spinand, macronix_read_eccsr, eccsr); 71 + int ret; 86 72 87 - int ret = spi_mem_exec_op(spinand->spimem, &op); 73 + ret = spi_mem_exec_op(spinand->spimem, &op); 88 74 if (ret) 89 75 return ret; 90 76