aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-omap2-mcspi.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-02-18 09:02:47 -0500
committerMark Brown <broonie@linaro.org>2014-02-18 23:38:31 -0500
commitaca0924b4819e813bdae2c595bf736ec2b593585 (patch)
tree3f01ba3aead20b8a06cf544b929e9caff983aa49 /drivers/spi/spi-omap2-mcspi.c
parentcd60080fd6200bd2e5ca9bf5135d32c06a8e6f3b (diff)
spi: omap2-mcspi: Convert to let spi core validate transfer speed
Set master->max_speed_hz and master->min_speed_hz then spi core will handle checking transfer speed. So we can remove the same checking in this driver. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-omap2-mcspi.c')
-rw-r--r--drivers/spi/spi-omap2-mcspi.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index d90edaaa7f69..48d218e5fa01 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1213,8 +1213,7 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
1213 void *rx_buf = t->rx_buf; 1213 void *rx_buf = t->rx_buf;
1214 unsigned len = t->len; 1214 unsigned len = t->len;
1215 1215
1216 if (t->speed_hz > OMAP2_MCSPI_MAX_FREQ 1216 if ((len && !(rx_buf || tx_buf))) {
1217 || (len && !(rx_buf || tx_buf))) {
1218 dev_dbg(mcspi->dev, "transfer: %d Hz, %d %s%s, %d bpw\n", 1217 dev_dbg(mcspi->dev, "transfer: %d Hz, %d %s%s, %d bpw\n",
1219 t->speed_hz, 1218 t->speed_hz,
1220 len, 1219 len,
@@ -1223,12 +1222,6 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
1223 t->bits_per_word); 1222 t->bits_per_word);
1224 return -EINVAL; 1223 return -EINVAL;
1225 } 1224 }
1226 if (t->speed_hz && t->speed_hz < (OMAP2_MCSPI_MAX_FREQ >> 15)) {
1227 dev_dbg(mcspi->dev, "speed_hz %d below minimum %d Hz\n",
1228 t->speed_hz,
1229 OMAP2_MCSPI_MAX_FREQ >> 15);
1230 return -EINVAL;
1231 }
1232 1225
1233 if (m->is_dma_mapped || len < DMA_MIN_BYTES) 1226 if (m->is_dma_mapped || len < DMA_MIN_BYTES)
1234 continue; 1227 continue;
@@ -1340,6 +1333,8 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
1340 master->transfer_one_message = omap2_mcspi_transfer_one_message; 1333 master->transfer_one_message = omap2_mcspi_transfer_one_message;
1341 master->cleanup = omap2_mcspi_cleanup; 1334 master->cleanup = omap2_mcspi_cleanup;
1342 master->dev.of_node = node; 1335 master->dev.of_node = node;
1336 master->max_speed_hz = OMAP2_MCSPI_MAX_FREQ;
1337 master->min_speed_hz = OMAP2_MCSPI_MAX_FREQ >> 15;
1343 1338
1344 platform_set_drvdata(pdev, master); 1339 platform_set_drvdata(pdev, master);
1345 1340