Skip to content

Commit a5bf527

Browse files
Félix Piédallubroonie
authored andcommitted
spi: omap2-mcspi: Disable multi mode when CS should be kept asserted after message
When the last transfer of a SPI message has the cs_change flag, the CS is kept asserted after the message. Multi-mode can't respect this as CS is deasserted by the hardware at the end of the message. Disable multi-mode when not applicable to the current message. Fixes: d153ff4 ("spi: omap2-mcspi: Add support for MULTI-mode") Signed-off-by: Félix Piédallu <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 19272b3 commit a5bf527

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/spi/spi-omap2-mcspi.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,9 +1287,15 @@ static int omap2_mcspi_prepare_message(struct spi_controller *ctlr,
12871287
mcspi->use_multi_mode = false;
12881288
}
12891289

1290-
/* Check if transfer asks to change the CS status after the transfer */
1291-
if (!tr->cs_change)
1292-
mcspi->use_multi_mode = false;
1290+
if (list_is_last(&tr->transfer_list, &msg->transfers)) {
1291+
/* Check if transfer asks to keep the CS status after the whole message */
1292+
if (tr->cs_change)
1293+
mcspi->use_multi_mode = false;
1294+
} else {
1295+
/* Check if transfer asks to change the CS status after the transfer */
1296+
if (!tr->cs_change)
1297+
mcspi->use_multi_mode = false;
1298+
}
12931299

12941300
/*
12951301
* If at least one message is not compatible, switch back to single mode

0 commit comments

Comments
 (0)