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: Configure the IO mode after the dummy cycles

When we will change the bus interface, the action that actually performs
the transition is the IO mode register write. This means after the IO
mode register write, we should use the new bus interface. But the
->configure_chip() hook itself is not responsible of making this change
official, it is the caller that must act according to the return value.

Reorganize this helper to first configure the dummy cycles before
possibly switching to another bus interface.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

+15 -15
+15 -15
drivers/mtd/nand/spi/winbond.c
··· 381 381 382 382 op = spinand->op_templates->read_cache; 383 383 384 - single = (op->cmd.buswidth == 1 && op->addr.buswidth == 1 && op->data.buswidth == 1); 385 - dtr = (op->cmd.dtr || op->addr.dtr || op->data.dtr); 386 - if (single && !dtr) 387 - io_mode = W35N01JW_VCR_IO_MODE_SINGLE_SDR; 388 - else if (!single && !dtr) 389 - io_mode = W35N01JW_VCR_IO_MODE_OCTAL_SDR; 390 - else if (!single && dtr) 391 - io_mode = W35N01JW_VCR_IO_MODE_OCTAL_DDR; 392 - else 393 - return -EINVAL; 394 - 395 - ret = w35n0xjw_write_vcr(spinand, W35N01JW_VCR_IO_MODE_REG, io_mode); 396 - if (ret) 397 - return ret; 398 - 399 384 dummy_cycles = ((op->dummy.nbytes * 8) / op->dummy.buswidth) / (op->dummy.dtr ? 2 : 1); 400 385 switch (dummy_cycles) { 401 386 case 8: ··· 395 410 } 396 411 397 412 ret = w35n0xjw_write_vcr(spinand, W35N01JW_VCR_DUMMY_CLOCK_REG, dummy_cycles); 413 + if (ret) 414 + return ret; 415 + 416 + single = (op->cmd.buswidth == 1 && op->addr.buswidth == 1 && op->data.buswidth == 1); 417 + dtr = (op->cmd.dtr && op->addr.dtr && op->data.dtr); 418 + if (single && !dtr) 419 + io_mode = W35N01JW_VCR_IO_MODE_SINGLE_SDR; 420 + else if (!single && !dtr) 421 + io_mode = W35N01JW_VCR_IO_MODE_OCTAL_SDR; 422 + else if (!single && dtr) 423 + io_mode = W35N01JW_VCR_IO_MODE_OCTAL_DDR; 424 + else 425 + return -EINVAL; 426 + 427 + ret = w35n0xjw_write_vcr(spinand, W35N01JW_VCR_IO_MODE_REG, io_mode); 398 428 if (ret) 399 429 return ret; 400 430