[PATCH v2 09/12] spi: import spi_controller::flags

Marco Felsch m.felsch at pengutronix.de
Mon Dec 16 05:03:21 PST 2024


Import the flags supported by the Linux spi controller implementation to
make it easier to port driver from Linux.

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
Changelog:
v2:
 - no changes

 include/spi/spi.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/spi/spi.h b/include/spi/spi.h
index 8458d890f4e6..a8bbf55e0a5a 100644
--- a/include/spi/spi.h
+++ b/include/spi/spi.h
@@ -173,6 +173,7 @@ static inline void spi_set_ctldata(struct spi_device *spi, void *state)
  *	unsupported bits_per_word. If not set, this value is simply ignored,
  *	and it's up to the individual driver to perform any validation.
  * @max_speed_hz: Highest supported transfer speed
+ * @flags: other constraints relevant to this driver
  * @setup: updates the device mode and clocking records used by a
  *	device's SPI controller; protocol code may call this.  This
  *	must fail if an unrecognized or unsupported mode is requested.
@@ -235,6 +236,16 @@ struct spi_controller {
 	/* limits on transfer speed */
 	u32			max_speed_hz;
 
+	/* Other constraints relevant to this driver */
+	u16			flags;
+#define SPI_CONTROLLER_HALF_DUPLEX	BIT(0)	/* Can't do full duplex */
+#define SPI_CONTROLLER_NO_RX		BIT(1)	/* Can't do buffer read */
+#define SPI_CONTROLLER_NO_TX		BIT(2)	/* Can't do buffer write */
+#define SPI_CONTROLLER_MUST_RX		BIT(3)	/* Requires rx */
+#define SPI_CONTROLLER_MUST_TX		BIT(4)	/* Requires tx */
+#define SPI_CONTROLLER_GPIO_SS		BIT(5)	/* GPIO CS must select slave */
+#define SPI_CONTROLLER_SUSPENDED	BIT(6)	/* Currently suspended */
+
 	/* setup mode and clock, etc (spi driver may call many times) */
 	int			(*setup)(struct spi_device *spi);
 
-- 
2.39.5




More information about the barebox mailing list