aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux/spi
diff options
context:
space:
mode:
authorDragos Bogdan <dragos.bogdan@analog.com>2020-12-21 17:29:35 +0200
committerMark Brown <broonie@kernel.org>2020-12-28 14:21:31 +0000
commitd962608ce2188a1d46ec9d356d6fad5cd6fc0341 (patch)
treee129ab2ad7f2227640351917584bbf0ebb65da6e /include/uapi/linux/spi
parentspi: uapi: unify SPI modes into a single spi.h header (diff)
downloadlinux-dev-d962608ce2188a1d46ec9d356d6fad5cd6fc0341.tar.xz
linux-dev-d962608ce2188a1d46ec9d356d6fad5cd6fc0341.zip
spi: Add SPI_NO_TX/RX support
Transmit/receive only is a valid SPI mode. For example, the MOSI/TX line might be missing from an ADC while for a DAC the MISO/RX line may be optional. This patch adds these two new modes: SPI_NO_TX and SPI_NO_RX. This way, the drivers will be able to identify if any of these two lines is missing and to adjust the transfers accordingly. Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20201221152936.53873-2-alexandru.ardelean@analog.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/uapi/linux/spi')
-rw-r--r--include/uapi/linux/spi/spi.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/uapi/linux/spi/spi.h b/include/uapi/linux/spi/spi.h
index 703b586f35df..236a85f08ded 100644
--- a/include/uapi/linux/spi/spi.h
+++ b/include/uapi/linux/spi/spi.h
@@ -28,4 +28,14 @@
#define SPI_RX_OCTAL _BITUL(14) /* receive with 8 wires */
#define SPI_3WIRE_HIZ _BITUL(15) /* high impedance turnaround */
+/*
+ * All the bits defined above should be covered by SPI_MODE_USER_MASK.
+ * The SPI_MODE_USER_MASK has the SPI_MODE_KERNEL_MASK counterpart in
+ * 'include/linux/spi/spi.h'. The bits defined here are from bit 0 upwards
+ * while in SPI_MODE_KERNEL_MASK they are from the other end downwards.
+ * These bits must not overlap. A static assert check should make sure of that.
+ * If adding extra bits, make sure to increase the bit index below as well.
+ */
+#define SPI_MODE_USER_MASK (_BITUL(16) - 1)
+
#endif /* _UAPI_SPI_H */