Skip to content

Commit 6f9026b

Browse files
Demon000broonie
authored andcommitted
spi: rzv2h-rspi: set MUST_RX/MUST_TX
In preparation for implementing DMA support, set MUST_RX and MUST_TX flags on the controller so that we always receive non-NULL buffers. The PIO mode already handles this manually by checking if rx_buf/tx_buf are set on the transfer, and doing a dummy read/write if not. DMA will not be able to implement this special handling, and although the SPI controller advertises support for transmit-only or receive-only transfers via SPCR's register TXMD bitfield, it does not seem to work. Remove the special handling for PIO and let the SPI controller core handle it. Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com> Link: https://patch.msgid.link/20251201134229.600817-7-cosmin-gabriel.tanislav.xa@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 28b590b commit 6f9026b

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

drivers/spi/spi-rzv2h-rspi.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,7 @@ struct rzv2h_rspi_priv {
113113
static inline void rzv2h_rspi_tx_##type(struct rzv2h_rspi_priv *rspi, \
114114
const void *txbuf, \
115115
unsigned int index) { \
116-
type buf = 0; \
117-
\
118-
if (txbuf) \
119-
buf = ((type *)txbuf)[index]; \
120-
\
116+
type buf = ((type *)txbuf)[index]; \
121117
func(buf, rspi->base + RSPI_SPDR); \
122118
}
123119

@@ -126,9 +122,7 @@ static inline void rzv2h_rspi_rx_##type(struct rzv2h_rspi_priv *rspi, \
126122
void *rxbuf, \
127123
unsigned int index) { \
128124
type buf = func(rspi->base + RSPI_SPDR); \
129-
\
130-
if (rxbuf) \
131-
((type *)rxbuf)[index] = buf; \
125+
((type *)rxbuf)[index] = buf; \
132126
}
133127

134128
RZV2H_RSPI_TX(writel, u32)
@@ -596,6 +590,7 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
596590

597591
controller->mode_bits = SPI_CPHA | SPI_CPOL | SPI_CS_HIGH |
598592
SPI_LSB_FIRST | SPI_LOOP;
593+
controller->flags = SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX;
599594
controller->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
600595
controller->prepare_message = rzv2h_rspi_prepare_message;
601596
controller->unprepare_message = rzv2h_rspi_unprepare_message;

0 commit comments

Comments
 (0)