diff options
author | Andreas Larsson <andreas@gaisler.com> | 2013-02-15 10:52:25 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2013-04-07 05:07:56 -0400 |
commit | 8922a366ddd20964e3542e12f0315a8a88b3a638 (patch) | |
tree | f002ba035438fe7586259f24c757b99cff0d6e92 /drivers/spi/spi-fsl-spi.c | |
parent | c3f3e7717f1cf01d9117a98ed89decc41d7cb5db (diff) |
spi/spi-fsl-spi: Add support for setting a maximum number of bits per word
Acked-by: Anton Vorontsov <anton@enomsg.org>
Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi/spi-fsl-spi.c')
-rw-r--r-- | drivers/spi/spi-fsl-spi.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index b9064434e0f7..7eff63a284ff 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c | |||
@@ -213,7 +213,8 @@ static int fsl_spi_setup_transfer(struct spi_device *spi, | |||
213 | 213 | ||
214 | /* Make sure its a bit width we support [4..16, 32] */ | 214 | /* Make sure its a bit width we support [4..16, 32] */ |
215 | if ((bits_per_word < 4) | 215 | if ((bits_per_word < 4) |
216 | || ((bits_per_word > 16) && (bits_per_word != 32))) | 216 | || ((bits_per_word > 16) && (bits_per_word != 32)) |
217 | || (bits_per_word > mpc8xxx_spi->max_bits_per_word)) | ||
217 | return -EINVAL; | 218 | return -EINVAL; |
218 | 219 | ||
219 | if (!hz) | 220 | if (!hz) |
@@ -520,6 +521,7 @@ static struct spi_master * fsl_spi_probe(struct device *dev, | |||
520 | mpc8xxx_spi = spi_master_get_devdata(master); | 521 | mpc8xxx_spi = spi_master_get_devdata(master); |
521 | mpc8xxx_spi->spi_do_one_msg = fsl_spi_do_one_msg; | 522 | mpc8xxx_spi->spi_do_one_msg = fsl_spi_do_one_msg; |
522 | mpc8xxx_spi->spi_remove = fsl_spi_remove; | 523 | mpc8xxx_spi->spi_remove = fsl_spi_remove; |
524 | mpc8xxx_spi->max_bits_per_word = 32; | ||
523 | mpc8xxx_spi->type = fsl_spi_get_type(dev); | 525 | mpc8xxx_spi->type = fsl_spi_get_type(dev); |
524 | 526 | ||
525 | ret = fsl_spi_cpm_init(mpc8xxx_spi); | 527 | ret = fsl_spi_cpm_init(mpc8xxx_spi); |
@@ -557,6 +559,10 @@ static struct spi_master * fsl_spi_probe(struct device *dev, | |||
557 | 559 | ||
558 | /* Enable SPI interface */ | 560 | /* Enable SPI interface */ |
559 | regval = pdata->initial_spmode | SPMODE_INIT_VAL | SPMODE_ENABLE; | 561 | regval = pdata->initial_spmode | SPMODE_INIT_VAL | SPMODE_ENABLE; |
562 | if (mpc8xxx_spi->max_bits_per_word < 8) { | ||
563 | regval &= ~SPMODE_LEN(0xF); | ||
564 | regval |= SPMODE_LEN(mpc8xxx_spi->max_bits_per_word - 1); | ||
565 | } | ||
560 | if (mpc8xxx_spi->flags & SPI_QE_CPU_MODE) | 566 | if (mpc8xxx_spi->flags & SPI_QE_CPU_MODE) |
561 | regval |= SPMODE_OP; | 567 | regval |= SPMODE_OP; |
562 | 568 | ||