Skip to content

Commit 67184f3

Browse files
ConchuODgregkh
authored andcommitted
spi: microchip-core-qspi: don't attempt to transmit during emulated read-only dual/quad operations
commit eb56dea upstream. The core will deal with reads by creating clock cycles itself, there's no need to generate clock cycles by transmitting garbage data at the driver level. Further, transmitting garbage data just bricks the transfer since QSPI doesn't have a dedicated master-out line like MOSI in regular SPI. I'm not entirely sure if the transfer is bricked because of the garbage data being transmitted on the bus or because the core loses track of whether it is supposed to be sending or receiving data. Fixes: 8f9cf02 ("spi: microchip-core-qspi: Add regular transfers") CC: stable@vger.kernel.org Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Link: https://patch.msgid.link/20260430-freezing-saloon-95b1f3d9dad0@spud Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f1c78ed commit 67184f3

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

drivers/spi/spi-microchip-core-qspi.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,18 +662,28 @@ static int mchp_coreqspi_transfer_one(struct spi_controller *ctlr, struct spi_de
662662
struct spi_transfer *t)
663663
{
664664
struct mchp_coreqspi *qspi = spi_controller_get_devdata(ctlr);
665+
bool dual_quad = false;
665666

666667
qspi->tx_len = t->len;
667668

669+
if (t->tx_nbits == SPI_NBITS_QUAD || t->rx_nbits == SPI_NBITS_QUAD ||
670+
t->tx_nbits == SPI_NBITS_DUAL ||
671+
t->rx_nbits == SPI_NBITS_DUAL)
672+
dual_quad = true;
673+
668674
if (t->tx_buf)
669675
qspi->txbuf = (u8 *)t->tx_buf;
670676

671677
if (!t->rx_buf) {
672678
mchp_coreqspi_write_op(qspi);
673-
} else {
679+
} else if (!dual_quad) {
674680
qspi->rxbuf = (u8 *)t->rx_buf;
675681
qspi->rx_len = t->len;
676682
mchp_coreqspi_write_read_op(qspi);
683+
} else {
684+
qspi->rxbuf = (u8 *)t->rx_buf;
685+
qspi->rx_len = t->len;
686+
mchp_coreqspi_read_op(qspi);
677687
}
678688

679689
return 0;

0 commit comments

Comments
 (0)