Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Clément Le Goffic and committed by
Mark Brown
4956bf44 d17dd2f1

+19 -4
+19 -4
drivers/spi/spi-stm32.c
··· 283 283 int (*config)(struct stm32_spi *spi); 284 284 void (*set_bpw)(struct stm32_spi *spi); 285 285 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); 287 287 int (*set_number_of_data)(struct stm32_spi *spi, u32 length); 288 288 void (*write_tx)(struct stm32_spi *spi); 289 289 void (*read_rx)(struct stm32_spi *spi); ··· 1880 1880 * stm32h7_spi_data_idleness - configure minimum time delay inserted between two 1881 1881 * consecutive data frames in host mode 1882 1882 * @spi: pointer to the spi controller data structure 1883 - * @len: transfer len 1883 + * @xfer: pointer to spi transfer 1884 1884 */ 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) 1886 1886 { 1887 1887 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 + } 1888 1903 1889 1904 cfg2_clrb |= STM32H7_SPI_CFG2_MIDI; 1890 1905 if ((len > 1) && (spi->cur_midi > 0)) { ··· 1990 1975 spi->cur_comm = comm_type; 1991 1976 1992 1977 if (STM32_SPI_HOST_MODE(spi) && spi->cfg->set_data_idleness) 1993 - spi->cfg->set_data_idleness(spi, transfer->len); 1978 + spi->cfg->set_data_idleness(spi, transfer); 1994 1979 1995 1980 if (spi->cur_bpw <= 8) 1996 1981 nb_words = transfer->len;