Skip to content

Commit 4956bf4

Browse files
clegofficbroonie
authored andcommitted
spi: stm32: deprecate st,spi-midi-ns property
The `st,spi-midi-ns` property, which was used to set a nanosecond delay between transferred words, is now deprecated. This functionality is now supported by the SPI framework through the `spi_transfer` struct's `word_delay` variable. Therefore, the private `st,spi-midi-ns` property is no longer needed and has been deprecated in favor of the generic solution. Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com> Link: https://patch.msgid.link/20250616-spi-upstream-v1-5-7e8593f3f75d@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent d17dd2f commit 4956bf4

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

drivers/spi/spi-stm32.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ struct stm32_spi_cfg {
283283
int (*config)(struct stm32_spi *spi);
284284
void (*set_bpw)(struct stm32_spi *spi);
285285
int (*set_mode)(struct stm32_spi *spi, unsigned int comm_type);
286-
void (*set_data_idleness)(struct stm32_spi *spi, u32 length);
286+
void (*set_data_idleness)(struct stm32_spi *spi, struct spi_transfer *xfer);
287287
int (*set_number_of_data)(struct stm32_spi *spi, u32 length);
288288
void (*write_tx)(struct stm32_spi *spi);
289289
void (*read_rx)(struct stm32_spi *spi);
@@ -1880,11 +1880,26 @@ static int stm32h7_spi_set_mode(struct stm32_spi *spi, unsigned int comm_type)
18801880
* stm32h7_spi_data_idleness - configure minimum time delay inserted between two
18811881
* consecutive data frames in host mode
18821882
* @spi: pointer to the spi controller data structure
1883-
* @len: transfer len
1883+
* @xfer: pointer to spi transfer
18841884
*/
1885-
static void stm32h7_spi_data_idleness(struct stm32_spi *spi, u32 len)
1885+
static void stm32h7_spi_data_idleness(struct stm32_spi *spi, struct spi_transfer *xfer)
18861886
{
18871887
u32 cfg2_clrb = 0, cfg2_setb = 0;
1888+
u32 len = xfer->len;
1889+
u32 spi_delay_ns;
1890+
1891+
spi_delay_ns = spi_delay_to_ns(&xfer->word_delay, xfer);
1892+
1893+
if (spi->cur_midi != 0) {
1894+
dev_warn(spi->dev, "st,spi-midi-ns DT property is deprecated\n");
1895+
if (spi_delay_ns) {
1896+
dev_warn(spi->dev, "Overriding st,spi-midi-ns with word_delay_ns %d\n",
1897+
spi_delay_ns);
1898+
spi->cur_midi = spi_delay_ns;
1899+
}
1900+
} else {
1901+
spi->cur_midi = spi_delay_ns;
1902+
}
18881903

18891904
cfg2_clrb |= STM32H7_SPI_CFG2_MIDI;
18901905
if ((len > 1) && (spi->cur_midi > 0)) {
@@ -1975,7 +1990,7 @@ static int stm32_spi_transfer_one_setup(struct stm32_spi *spi,
19751990
spi->cur_comm = comm_type;
19761991

19771992
if (STM32_SPI_HOST_MODE(spi) && spi->cfg->set_data_idleness)
1978-
spi->cfg->set_data_idleness(spi, transfer->len);
1993+
spi->cfg->set_data_idleness(spi, transfer);
19791994

19801995
if (spi->cur_bpw <= 8)
19811996
nb_words = transfer->len;

0 commit comments

Comments
 (0)