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: winbond: Convert W25N specific operation to SPINAND_OP()

Winbond W25N* chips require a vendor specific operation to select the
target. 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>

+14 -6
+14 -6
drivers/mtd/nand/spi/winbond.c
··· 87 87 SPINAND_PROG_LOAD_1S_1S_4S_OP(false, 0, NULL, 0), 88 88 SPINAND_PROG_LOAD_1S_1S_1S_OP(false, 0, NULL, 0)); 89 89 90 + #define SPINAND_WINBOND_SELECT_TARGET_1S_0_1S(buf) \ 91 + SPI_MEM_OP(SPI_MEM_OP_CMD(0xc2, 1), \ 92 + SPI_MEM_OP_NO_ADDR, \ 93 + SPI_MEM_OP_NO_DUMMY, \ 94 + SPI_MEM_OP_DATA_OUT(1, buf, 1)) 95 + 96 + static struct spi_mem_op 97 + spinand_fill_winbond_select_target_op(struct spinand_device *spinand, void *valptr) 98 + { 99 + return (struct spi_mem_op)SPINAND_WINBOND_SELECT_TARGET_1S_0_1S(valptr); 100 + } 101 + 90 102 static int w25m02gv_ooblayout_ecc(struct mtd_info *mtd, int section, 91 103 struct mtd_oob_region *region) 92 104 { ··· 131 119 static int w25m02gv_select_target(struct spinand_device *spinand, 132 120 unsigned int target) 133 121 { 134 - struct spi_mem_op op = SPI_MEM_OP(SPI_MEM_OP_CMD(0xc2, 1), 135 - SPI_MEM_OP_NO_ADDR, 136 - SPI_MEM_OP_NO_DUMMY, 137 - SPI_MEM_OP_DATA_OUT(1, 138 - spinand->scratchbuf, 139 - 1)); 122 + struct spi_mem_op op = SPINAND_OP(spinand, winbond_select_target, 123 + spinand->scratchbuf); 140 124 141 125 *spinand->scratchbuf = target; 142 126 return spi_mem_exec_op(spinand->spimem, &op);