[PATCH 10/12] spi: add support for spi_controller::set_cs_timing

Marco Felsch m.felsch at pengutronix.de
Fri Nov 15 11:57:45 PST 2024


Import the spi_controller set_cs_timing() hook to make it easier to port
code from the Linux.

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
 include/spi/spi.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/spi/spi.h b/include/spi/spi.h
index 8354b7d8baa6..092eacd4a8e1 100644
--- a/include/spi/spi.h
+++ b/include/spi/spi.h
@@ -179,6 +179,9 @@ static inline void spi_set_ctldata(struct spi_device *spi, void *state)
  *	must fail if an unrecognized or unsupported mode is requested.
  *	It's always safe to call this unless transfers are pending on
  *	the device whose settings are being modified.
+ * @set_cs_timing: optional hook for SPI devices to request SPI master
+ * controller for configuring specific CS setup time, hold time and inactive
+ * delay interms of clock counts
  * @transfer: adds a message to the controller's transfer queue.
  * @cleanup: frees controller-specific state
  * @cs_gpiods: Array of GPIO descriptors to use as chip select lines; one per CS
@@ -246,6 +249,16 @@ struct spi_controller {
 	/* setup mode and clock, etc (spi driver may call many times) */
 	int			(*setup)(struct spi_device *spi);
 
+	/*
+	 * set_cs_timing() method is for SPI controllers that supports
+	 * configuring CS timing.
+	 *
+	 * This hook allows SPI client drivers to request SPI controllers
+	 * to configure specific CS timing through spi_set_cs_timing() after
+	 * spi_setup().
+	 */
+	int (*set_cs_timing)(struct spi_device *spi);
+
 	/* bidirectional bulk transfers
 	 *
 	 * + The transfer() method may not sleep; its main role is
-- 
2.39.5




More information about the barebox mailing list