Skip to content

Commit a602b7e

Browse files
miquelraynalgregkh
authored andcommitted
mtd: spinand: winbond: Configure the IO mode after the dummy cycles
[ Upstream commit ef1ed29 ] 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> Stable-dep-of: 25a915f ("mtd: spinand: winbond: Clarify when to enable the HS bit") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a5d27ef commit a602b7e

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

drivers/mtd/nand/spi/winbond.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -357,21 +357,6 @@ static int w35n0xjw_vcr_cfg(struct spinand_device *spinand)
357357

358358
op = spinand->op_templates->read_cache;
359359

360-
single = (op->cmd.buswidth == 1 && op->addr.buswidth == 1 && op->data.buswidth == 1);
361-
dtr = (op->cmd.dtr || op->addr.dtr || op->data.dtr);
362-
if (single && !dtr)
363-
io_mode = W35N01JW_VCR_IO_MODE_SINGLE_SDR;
364-
else if (!single && !dtr)
365-
io_mode = W35N01JW_VCR_IO_MODE_OCTAL_SDR;
366-
else if (!single && dtr)
367-
io_mode = W35N01JW_VCR_IO_MODE_OCTAL_DDR;
368-
else
369-
return -EINVAL;
370-
371-
ret = w35n0xjw_write_vcr(spinand, W35N01JW_VCR_IO_MODE_REG, io_mode);
372-
if (ret)
373-
return ret;
374-
375360
dummy_cycles = ((op->dummy.nbytes * 8) / op->dummy.buswidth) / (op->dummy.dtr ? 2 : 1);
376361
switch (dummy_cycles) {
377362
case 8:
@@ -388,6 +373,21 @@ static int w35n0xjw_vcr_cfg(struct spinand_device *spinand)
388373
if (ret)
389374
return ret;
390375

376+
single = (op->cmd.buswidth == 1 && op->addr.buswidth == 1 && op->data.buswidth == 1);
377+
dtr = (op->cmd.dtr && op->addr.dtr && op->data.dtr);
378+
if (single && !dtr)
379+
io_mode = W35N01JW_VCR_IO_MODE_SINGLE_SDR;
380+
else if (!single && !dtr)
381+
io_mode = W35N01JW_VCR_IO_MODE_OCTAL_SDR;
382+
else if (!single && dtr)
383+
io_mode = W35N01JW_VCR_IO_MODE_OCTAL_DDR;
384+
else
385+
return -EINVAL;
386+
387+
ret = w35n0xjw_write_vcr(spinand, W35N01JW_VCR_IO_MODE_REG, io_mode);
388+
if (ret)
389+
return ret;
390+
391391
return 0;
392392
}
393393

0 commit comments

Comments
 (0)