[PATCH] mtd: spinand: winbond: Clarify when to enable the HS bit
Miquel Raynal
miquel.raynal at bootlin.com
Wed Mar 18 03:47:50 PDT 2026
Above 104MHz when in fast dual or quad I/O reads, the delay between
address and data cycles is too short. It is possible to reach higher
frequencies, up to 166MHz, by adding a few more dummy cycles through the
setting of the HS bit. Improve the condition for enabling this bit, and
also make sure we set it at soon as we go over 104MHz.
Fixes: f1a91175faaa ("mtd: spinand: winbond: Enable high-speed modes on w25n0xjw")
Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
---
The boards I have which are mounted with W25N chips cannot go over
104MHz, so both the original commit and this one are mostly based on
speculation and datasheet reading. There are no designs allowing to test
this yet, so it is possible that some cases might still not be correctly
supported.
---
drivers/mtd/nand/spi/winbond.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
index 6dfd0dcc8ee7..e0138785e280 100644
--- a/drivers/mtd/nand/spi/winbond.c
+++ b/drivers/mtd/nand/spi/winbond.c
@@ -337,16 +337,19 @@ static int w25n0xjw_hs_cfg(struct spinand_device *spinand,
if (iface != SSDR)
return -EOPNOTSUPP;
+ /*
+ * SDR dual and quad I/O operations over 104MHz require the HS bit to
+ * enable a few more dummy cycles.
+ */
op = spinand->op_templates->read_cache;
if (op->cmd.dtr || op->addr.dtr || op->dummy.dtr || op->data.dtr)
hs = false;
- else if (op->cmd.buswidth == 1 && op->addr.buswidth == 1 &&
- op->dummy.buswidth == 1 && op->data.buswidth == 1)
+ else if (op->cmd.buswidth != 1 || op->addr.buswidth == 1)
+ hs = false;
+ else if (op->max_freq && op->max_freq <= 104 * HZ_PER_MHZ)
hs = false;
- else if (!op->max_freq)
- hs = true;
else
- hs = false;
+ hs = true;
ret = spinand_read_reg_op(spinand, W25N0XJW_SR4, &sr4);
if (ret)
--
2.51.1
More information about the linux-mtd
mailing list