RE: [PATCH v1 1/3] mtd: spi-nor: Support mixed 1S-xD-xD DTR protocols in spi_nor_spimem_setup_op()

From: Takahiro.Kuwano

Date: Wed Nov 11 2026 - 19:16:27 EST


> Currently spi_nor_spimem_setup_op() sets all four phases (cmd, addr,
> dummy, data) to DTR whenever spi_nor_protocol_is_dtr(proto) is true.
> This is too coarse: the 1S-xD-xD DTR protocols (1_1_1_DTR, 1_2_2_DTR,
> 1_4_4_DTR, 1_8_8_DTR) send the command phase in STR on a single line,
> and only the address, dummy and data phases in DTR. SPIMEM supports
> such mixed DTR modes.
>
> Split the handling:
>
> - For SNOR_PROTO_8_8_8_DTR, keep the existing behavior: set all
> phases to DTR and use a 2-byte opcode (opcode + extension).
>
> - For the other DTR protocols, set the command phase to STR and only
> the address, dummy and data phases to DTR. Double op->dummy.nbytes
> since DTR transfers 2 bytes per clock cycle, matching how the dummy
> cycle count is specified for these protocols.
>
> - Move the SWAP16 handling into the 8D-8D-8D branch as well, since
> it only applies there.
>
> No in-tree flash currently declares SNOR_HWCAPS_READ_1_x_x_DTR, so
> this is not a bug fix but preparation for enabling these protocols.
> A follow-up patch will enable 1S-4D-4D for the MX66L1G45G. The
> 8D-8D-8D path is unchanged.
>
> Signed-off-by: Changhuang Liang <changhuang.liang@xxxxxxxxxxxxxxxx>
> ---

Reviewed-by: Takahiro Kuwano <takahiro.kuwano@xxxxxxxxxxxx>