diff options
author | Nikita Kiryanov <nikita@compulab.co.il> | 2013-10-16 17:23:25 +0300 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2013-11-12 10:02:44 +0100 |
commit | 5753d09b1064a669e3be8f27e0f1fd008b96934a (patch) | |
tree | 03eb9c4427faed627d41802960f0c7c516e35203 /drivers/spi/spi.c | |
parent | 54a759c880a11a6dd93704f0adba40139b595e87 (diff) | |
download | u-boot-imx-5753d09b1064a669e3be8f27e0f1fd008b96934a.zip u-boot-imx-5753d09b1064a669e3be8f27e0f1fd008b96934a.tar.gz u-boot-imx-5753d09b1064a669e3be8f27e0f1fd008b96934a.tar.bz2 |
spi: omap3: add support for more word lengths
Current implementation only supports 8 bit word lengths, even though
omap3 can handle anything between 4 and 32.
Update the spi interface to support changing the SPI word length,
and implement it in omap3_spi driver to support the full range of
possible word lengths.
This implementation is backwards compatible by defaulting to the old
behavior of 8 bit word lengths.
Also, it required a change to the omap3_spi non static I/O functions,
but since they are not used anywhere else, no collateral changes are required.
Cc: Tom Rini <trini@ti.com>
Cc: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index ea39d1a..b76a26c 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -8,6 +8,18 @@ #include <malloc.h> #include <spi.h> +int spi_set_wordlen(struct spi_slave *slave, unsigned int wordlen) +{ + if (wordlen == 0 || wordlen > 32) { + printf("spi: invalid wordlen %d\n", wordlen); + return -1; + } + + slave->wordlen = wordlen; + + return 0; +} + void *spi_do_alloc_slave(int offset, int size, unsigned int bus, unsigned int cs) { @@ -20,6 +32,7 @@ void *spi_do_alloc_slave(int offset, int size, unsigned int bus, slave = (struct spi_slave *)(ptr + offset); slave->bus = bus; slave->cs = cs; + slave->wordlen = SPI_DEFAULT_WORDLEN; } return ptr; |