Skip to content

Commit 8618271

Browse files
miquelraynalbroonie
authored andcommitted
spi: spi-mem: Limit octal DTR constraints to octal DTR situations
In this helper, any operation with a single DTR cycle (like 1S-1S-8D) is considered requiring a duplicated command opcode. This is wrong as this constraint only applies to octal DTR operations (8D-8D-8D). Narrow the application of this constraint to the concerned bus interface. Note: none of the possible XD-XD-XD pattern, with X being one of {1, 2, 4} would benefit from this check either as there is only in octal DTR mode that a single clock edge would be enough to transmit the full opcode. Make sure the constraint of expecting two bytes for the command is applied to the relevant bus interface. Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://patch.msgid.link/20260109-winbond-v6-17-rc1-oddr-v2-3-1fff6a2ddb80@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent af4b2dc commit 8618271

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

drivers/spi/spi-mem.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,19 @@ bool spi_mem_default_supports_op(struct spi_mem *mem,
178178
if (op->data.swap16 && !spi_mem_controller_is_capable(ctlr, swap16))
179179
return false;
180180

181-
if (op->cmd.nbytes != 2)
182-
return false;
181+
/* Extra 8D-8D-8D limitations */
182+
if (op->cmd.dtr && op->cmd.buswidth == 8) {
183+
if (op->cmd.nbytes != 2)
184+
return false;
185+
186+
if ((op->addr.nbytes % 2) ||
187+
(op->dummy.nbytes % 2) ||
188+
(op->data.nbytes % 2)) {
189+
dev_err(&ctlr->dev,
190+
"Even byte numbers not allowed in octal DTR operations\n");
191+
return false;
192+
}
193+
}
183194
} else {
184195
if (op->cmd.nbytes != 1)
185196
return false;

0 commit comments

Comments
 (0)