[PATCH RFC 16/16] mtd: spi-nor: Express the dummy phase in cycles
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Wed Nov 25 10:08:38 PST 2026
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] mtd: spi-nor: spansion: s25fs256t_late_init() passes 1 dummy
cycle instead of 8
--
commit a9d3a1e024f3a4306e5fb27cb054e3ab383f7673
Author: Miquel Raynal <miquel.raynal at bootlin.com>
mtd: spi-nor: Express the dummy phase in cycles
This commit updates the SPI NOR core and manufacturer drivers to populate
spi_mem_op dummy phases in clock cycles rather than converting them to
bytes.
> diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c
> index b1b14ed0fd467..72cc11d3f1d35 100644
> --- a/drivers/mtd/spi-nor/spansion.c
> +++ b/drivers/mtd/spi-nor/spansion.c
> @@ -53,10 +53,10 @@
> SPI_MEM_OP_NO_DUMMY, \
> SPI_MEM_OP_DATA_OUT(ndata, buf, 0))
>
> -#define CYPRESS_NOR_RD_ANY_REG_OP(naddr, addr, ndummy, buf) \
> +#define CYPRESS_NOR_RD_ANY_REG_OP(naddr, addr, ncycles, buf) \
> SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_RD_ANY_REG, 0), \
> SPI_MEM_OP_ADDR(naddr, addr, 0), \
> - SPI_MEM_OP_DUMMY(ndummy, 0), \
> + SPI_MEM_OP_DUMMY_CYCLES(ncycles, 0), \
> SPI_MEM_OP_DATA_IN(1, buf, 0))
[Severity: High]
Does changing CYPRESS_NOR_RD_ANY_REG_OP() to take dummy clock cycles
break s25fs256t_late_init()?
drivers/mtd/spi-nor/spansion.c:s25fs256t_late_init() {
...
/* Read Architecture Configuration Register (ARCFN) */
op = (struct spi_mem_op)
CYPRESS_NOR_RD_ANY_REG_OP(nor->params->addr_mode_nbytes,
SPINOR_REG_CYPRESS_ARCFN, 1,
nor->bouncebuf);
ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto);
...
}
Reading SPINOR_REG_CYPRESS_ARCFN in 1S-1S-1S mode requires 8 dummy clock
cycles (previously 1 dummy byte). With ncycles set to 1 at 1-bit buswidth,
spi_mem_dummy_cycles_to_bytes() fails with -EOPNOTSUPP on byte-granular
controllers, or cycle-capable controllers clock only 1 dummy cycle instead
of 8, causing S25FS256T probe to fail.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-macronix-upstreaming-spi-mem-cycles-v1-0-fd036402fd37@bootlin.com?part=16
More information about the linux-mtd
mailing list