mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
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 <dario.binacchi@amarulasolutions.com> Reviewed-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
committed by
Patrice Chotard
parent
5ab39c8a66
commit
7b879ddbc5
@@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -718,6 +720,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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user