Skip to content

Commit 9df15d8

Browse files
Alain Volmatbroonie
authored andcommitted
spi: stm32: make SPI_MASTER_MUST_TX flags only specific to STM32F4
Commit 61367d0 ("spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4") allowed to properly communicate with the st-gyro-spi even when there is no tx_buf provided by setting the flag SPI_MASTER_MUST_TX and thus forcing a dummy TX buffer to work in Full Duplex. This behavior should kept only for the STM32F4 and not for other compatible since the STM32H7 do support SIMPLEX_RX and SIMPLEX_TX. Add the flags variable within the struct stm32_spi_cfg so that flags used at master registration time are compatible specific. Fixes: 61367d0 ("spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4") Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/20220119093245.624878-3-alain.volmat@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 3cefddb commit 9df15d8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/spi/spi-stm32.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ struct stm32_spi;
231231
* @baud_rate_div_min: minimum baud rate divisor
232232
* @baud_rate_div_max: maximum baud rate divisor
233233
* @has_fifo: boolean to know if fifo is used for driver
234+
* @flags: compatible specific SPI controller flags used at registration time
234235
*/
235236
struct stm32_spi_cfg {
236237
const struct stm32_spi_regspec *regs;
@@ -251,6 +252,7 @@ struct stm32_spi_cfg {
251252
unsigned int baud_rate_div_min;
252253
unsigned int baud_rate_div_max;
253254
bool has_fifo;
255+
u16 flags;
254256
};
255257

256258
/**
@@ -1720,6 +1722,7 @@ static const struct stm32_spi_cfg stm32f4_spi_cfg = {
17201722
.baud_rate_div_min = STM32F4_SPI_BR_DIV_MIN,
17211723
.baud_rate_div_max = STM32F4_SPI_BR_DIV_MAX,
17221724
.has_fifo = false,
1725+
.flags = SPI_MASTER_MUST_TX,
17231726
};
17241727

17251728
static const struct stm32_spi_cfg stm32h7_spi_cfg = {
@@ -1852,7 +1855,7 @@ static int stm32_spi_probe(struct platform_device *pdev)
18521855
master->prepare_message = stm32_spi_prepare_msg;
18531856
master->transfer_one = stm32_spi_transfer_one;
18541857
master->unprepare_message = stm32_spi_unprepare_msg;
1855-
master->flags = SPI_MASTER_MUST_TX;
1858+
master->flags = spi->cfg->flags;
18561859

18571860
spi->dma_tx = dma_request_chan(spi->dev, "tx");
18581861
if (IS_ERR(spi->dma_tx)) {

0 commit comments

Comments
 (0)