aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-03-28 11:37:54 -0400
committerMark Brown <broonie@linaro.org>2014-03-29 06:15:53 -0400
commit5c5989ccd32c37890115a6dd5c03f39cba7f7beb (patch)
tree83ab8a511399d7bfd35772904acf25712de4ce50 /drivers/spi
parent354312f16e49add1da78f0cfb2bcb633709d0071 (diff)
spi: mpc52xx: Convert to use bits_per_word_mask
This controller only supports 8-bit word length. Set bits_per_word_mask so spi core will reject transfers that attempt to use an unsupported bits_per_word value. Also remove the duplicate code to test spi->mode, it is done by spi core. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-mpc52xx.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c
index e3d29a56d70a..95bd2ffb0572 100644
--- a/drivers/spi/spi-mpc52xx.c
+++ b/drivers/spi/spi-mpc52xx.c
@@ -357,17 +357,6 @@ static void mpc52xx_spi_wq(struct work_struct *work)
357 * spi_master ops 357 * spi_master ops
358 */ 358 */
359 359
360static int mpc52xx_spi_setup(struct spi_device *spi)
361{
362 if (spi->bits_per_word % 8)
363 return -EINVAL;
364
365 if (spi->mode & ~(SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST))
366 return -EINVAL;
367
368 return 0;
369}
370
371static int mpc52xx_spi_transfer(struct spi_device *spi, struct spi_message *m) 360static int mpc52xx_spi_transfer(struct spi_device *spi, struct spi_message *m)
372{ 361{
373 struct mpc52xx_spi *ms = spi_master_get_devdata(spi->master); 362 struct mpc52xx_spi *ms = spi_master_get_devdata(spi->master);
@@ -430,9 +419,9 @@ static int mpc52xx_spi_probe(struct platform_device *op)
430 goto err_alloc; 419 goto err_alloc;
431 } 420 }
432 421
433 master->setup = mpc52xx_spi_setup;
434 master->transfer = mpc52xx_spi_transfer; 422 master->transfer = mpc52xx_spi_transfer;
435 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST; 423 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
424 master->bits_per_word_mask = SPI_BPW_MASK(8);
436 master->dev.of_node = op->dev.of_node; 425 master->dev.of_node = op->dev.of_node;
437 426
438 platform_set_drvdata(op, master); 427 platform_set_drvdata(op, master);