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 W35N specific operation to SPINAND_OP()

Winbond W35N* chips require a vendor specific operation to write their
VCR register (a configuration register, typically used for tuning the
number of dummy cycles and switching to a different bus
interface). 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 -5
+14 -5
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_WRITE_VCR_1S_1S_1S(reg, buf) \ 91 + SPI_MEM_OP(SPI_MEM_OP_CMD(0x81, 1), \ 92 + SPI_MEM_OP_ADDR(3, reg, 1), \ 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_write_vcr_op(struct spinand_device *spinand, u8 reg, void *valptr) 98 + { 99 + return (struct spi_mem_op)SPINAND_WINBOND_WRITE_VCR_1S_1S_1S(reg, valptr); 100 + } 101 + 90 102 #define SPINAND_WINBOND_SELECT_TARGET_1S_0_1S(buf) \ 91 103 SPI_MEM_OP(SPI_MEM_OP_CMD(0xc2, 1), \ 92 104 SPI_MEM_OP_NO_ADDR, \ ··· 341 329 342 330 static int w35n0xjw_write_vcr(struct spinand_device *spinand, u8 reg, u8 val) 343 331 { 344 - struct spi_mem_op op = 345 - SPI_MEM_OP(SPI_MEM_OP_CMD(0x81, 1), 346 - SPI_MEM_OP_ADDR(3, reg, 1), 347 - SPI_MEM_OP_NO_DUMMY, 348 - SPI_MEM_OP_DATA_OUT(1, spinand->scratchbuf, 1)); 332 + struct spi_mem_op op = SPINAND_OP(spinand, winbond_write_vcr, 333 + reg, spinand->scratchbuf); 349 334 int ret; 350 335 351 336 *spinand->scratchbuf = val;