Skip to content

Commit 0edfa4d

Browse files
committed
spi: microchip-core-qspi: don't attempt to transmit during emulated read-only dual/quad operations
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, if the hardware actually does it (tbh, I'm not sure if it does or if it ignores what's in the Tx FIFO after reaching the designated number of "command bytes") would just brick the transfer since QSPI doesn't have a dedicated master-out line like MOSI in regular SPI. Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
1 parent c96487c commit 0edfa4d

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
@@ -692,18 +692,28 @@ static int mchp_coreqspi_transfer_one(struct spi_controller *ctlr, struct spi_de
692692
struct spi_transfer *t)
693693
{
694694
struct mchp_coreqspi *qspi = spi_controller_get_devdata(ctlr);
695+
bool dual_quad = false;
695696

696697
qspi->tx_len = t->len;
697698

699+
if (t->tx_nbits == SPI_NBITS_QUAD || t->rx_nbits == SPI_NBITS_QUAD ||
700+
t->tx_nbits == SPI_NBITS_DUAL ||
701+
t->rx_nbits == SPI_NBITS_DUAL)
702+
dual_quad = true;
703+
698704
if (t->tx_buf)
699705
qspi->txbuf = (u8 *)t->tx_buf;
700706

701707
if (!t->rx_buf) {
702708
mchp_coreqspi_write_op(qspi);
703-
} else {
709+
} else if (!dual_quad) {
704710
qspi->rxbuf = (u8 *)t->rx_buf;
705711
qspi->rx_len = t->len;
706712
mchp_coreqspi_write_read_op(qspi);
713+
} else {
714+
qspi->rxbuf = (u8 *)t->rx_buf;
715+
qspi->rx_len = t->len;
716+
mchp_coreqspi_read_op(qspi);
707717
}
708718

709719
return 0;

0 commit comments

Comments
 (0)