Skip to content

Commit b0873cd

Browse files
committed
Merge tag 'tags/fpga-spi-250313' into linux-6.6-mchp
FPGA spi updates for 250313 * spi: microchip-core-qspi: fix transfer_one() for reads (Conor Dooley 2025-02-24) Signed-off-by: Conor Dooley <[email protected]>
2 parents b0370e7 + 7fa9f44 commit b0873cd

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ static inline void mchp_coreqspi_write_read_op(struct mchp_coreqspi *qspi)
236236
while (readl_relaxed(qspi->regs + REG_STATUS) & STATUS_TXFIFOFULL)
237237
;
238238

239-
data = *(u32 *)qspi->txbuf;
240-
qspi->txbuf += 4;
239+
data = qspi->txbuf ? *((u32 *)qspi->txbuf) : 0xaa;
240+
if (qspi->txbuf)
241+
qspi->txbuf += 4;
241242
qspi->tx_len -= 4;
242243
writel_relaxed(data, qspi->regs + REG_X4_TX_DATA);
243244

@@ -289,7 +290,8 @@ static inline void mchp_coreqspi_write_read_op(struct mchp_coreqspi *qspi)
289290
while (qspi->tx_len--) {
290291
while (readl_relaxed(qspi->regs + REG_STATUS) & STATUS_TXFIFOFULL)
291292
;
292-
data = *qspi->txbuf++;
293+
data = qspi->txbuf ? *qspi->txbuf : 0xaa;
294+
qspi->txbuf++;
293295
writel_relaxed(data, qspi->regs + REG_TX_DATA);
294296
}
295297

@@ -654,19 +656,17 @@ static int mchp_coreqspi_transfer_one(struct spi_controller *ctlr, struct spi_de
654656
{
655657
struct mchp_coreqspi *qspi = spi_controller_get_devdata(ctlr);
656658

657-
if ((t->tx_buf) && (t->rx_buf)){
658-
qspi->txbuf = (u8 *)t->tx_buf;
659-
qspi->rxbuf = (u8 *)t->rx_buf;
660-
qspi->tx_len = t->len;
661-
mchp_coreqspi_write_read_op(qspi);
662-
} else if (t->tx_buf) {
659+
qspi->tx_len = t->len;
660+
661+
if (t->tx_buf)
663662
qspi->txbuf = (u8 *)t->tx_buf;
664-
qspi->tx_len = t->len;
663+
664+
if (!t->rx_buf) {
665665
mchp_coreqspi_write_op(qspi);
666666
} else {
667667
qspi->rxbuf = (u8 *)t->rx_buf;
668668
qspi->rx_len = t->len;
669-
mchp_coreqspi_read_op(qspi);
669+
mchp_coreqspi_write_read_op(qspi);
670670
}
671671

672672
return 0;

0 commit comments

Comments
 (0)