summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDario Binacchi <[email protected]>2026-02-25 17:16:52 +0100
committerPatrice Chotard <[email protected]>2026-04-30 08:01:11 +0200
commit7b879ddbc5644fa7a03e16e773054f96819948e7 (patch)
treee3a32ee8274c5f386d814ea5f93940d87e2a36c4 /include
parent5ab39c8a669b5bda660c71e121cb65d508509b07 (diff)
spi: add support for bits-per-word setting
Allow dynamic configuration of the SPI word length. This is required for controllers and slaves that need to operate with non-standard word lengths, such as 9-bit wide transfers. Signed-off-by: Dario Binacchi <[email protected]> Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/spi.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/spi.h b/include/spi.h
index 95e7d5b1556..7eaf0aa69b8 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -77,11 +77,13 @@ struct dm_spi_bus {
* @cs: Chip select number (0..n-1)
* @max_hz: Maximum bus speed that this slave can tolerate
* @mode: SPI mode to use for this device (see SPI mode flags)
+ * @wordlen: Word length in bits to use for this device
*/
struct dm_spi_slave_plat {
unsigned int cs[SPI_CS_CNT_MAX];
uint max_hz;
uint mode;
+ unsigned int wordlen;
};
/**
@@ -719,6 +721,18 @@ int dm_spi_claim_bus(struct udevice *dev);
void dm_spi_release_bus(struct udevice *dev);
/**
+ * Set the word length for SPI transactions
+ *
+ * Set the word length (number of bits per word) for SPI transactions.
+ *
+ * @slave: The SPI slave
+ * @wordlen: The number of bits in a word
+ *
+ * Returns: 0 on success, -1 on failure.
+ */
+int dm_spi_set_wordlen(struct udevice *dev, unsigned int wordlen);
+
+/**
* SPI transfer
*
* This writes "bitlen" bits out the SPI MOSI port and simultaneously clocks