aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-07-10 09:57:26 -0400
committerMark Brown <broonie@linaro.org>2013-07-15 06:34:51 -0400
commita2fd4f9fa3b9f051550b36c4dfa74bc32bda24ee (patch)
treeb317a65457403d0e3175cd3fa36a66b6b2627527 /drivers
parentad81f0545ef01ea651886dddac4bef6cec930092 (diff)
spi: Support transfer speed checking in the core
Allow drivers to avoid implementing their own checks for simple rates by specifying the limits in the master structure. Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/spi.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 978dda2c5239..a52f16685d6a 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1387,6 +1387,13 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message)
1387 BIT(xfer->bits_per_word - 1))) 1387 BIT(xfer->bits_per_word - 1)))
1388 return -EINVAL; 1388 return -EINVAL;
1389 } 1389 }
1390
1391 if (xfer->speed_hz && master->min_speed_hz &&
1392 xfer->speed_hz < master->min_speed_hz)
1393 return -EINVAL;
1394 if (xfer->speed_hz && master->max_speed_hz &&
1395 xfer->speed_hz > master->max_speed_hz)
1396 return -EINVAL;
1390 } 1397 }
1391 1398
1392 message->spi = spi; 1399 message->spi = spi;