aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi_s3c64xx.c
diff options
context:
space:
mode:
authorJassi Brar <jassi.brar@samsung.com>2010-09-29 04:31:31 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-09-29 04:31:31 -0400
commite02ddd442a532c73e547ae3735c8012e3bd719a5 (patch)
tree68343f5c171c15286c275d40dd2bc2577daa5845 /drivers/spi/spi_s3c64xx.c
parent4a4fd47155ac49b62de5177a780c245e967752f3 (diff)
spi/s3c64xx: Prevent unnecessary map-unmap
Since we use DMA mode only for xfers bigger than FIFO size, do not map/unmap buffers for polling mode transfers. Signed-off-by: Jassi Brar <jassi.brar@samsung.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi/spi_s3c64xx.c')
-rw-r--r--drivers/spi/spi_s3c64xx.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c
index c3038da2648a..e7b893f2a21b 100644
--- a/drivers/spi/spi_s3c64xx.c
+++ b/drivers/spi/spi_s3c64xx.c
@@ -499,6 +499,7 @@ static void s3c64xx_spi_dma_txcb(struct s3c2410_dma_chan *chan, void *buf_id,
499static int s3c64xx_spi_map_mssg(struct s3c64xx_spi_driver_data *sdd, 499static int s3c64xx_spi_map_mssg(struct s3c64xx_spi_driver_data *sdd,
500 struct spi_message *msg) 500 struct spi_message *msg)
501{ 501{
502 struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
502 struct device *dev = &sdd->pdev->dev; 503 struct device *dev = &sdd->pdev->dev;
503 struct spi_transfer *xfer; 504 struct spi_transfer *xfer;
504 505
@@ -514,6 +515,9 @@ static int s3c64xx_spi_map_mssg(struct s3c64xx_spi_driver_data *sdd,
514 /* Map until end or first fail */ 515 /* Map until end or first fail */
515 list_for_each_entry(xfer, &msg->transfers, transfer_list) { 516 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
516 517
518 if (xfer->len <= ((sci->fifo_lvl_mask >> 1) + 1))
519 continue;
520
517 if (xfer->tx_buf != NULL) { 521 if (xfer->tx_buf != NULL) {
518 xfer->tx_dma = dma_map_single(dev, 522 xfer->tx_dma = dma_map_single(dev,
519 (void *)xfer->tx_buf, xfer->len, 523 (void *)xfer->tx_buf, xfer->len,
@@ -545,6 +549,7 @@ static int s3c64xx_spi_map_mssg(struct s3c64xx_spi_driver_data *sdd,
545static void s3c64xx_spi_unmap_mssg(struct s3c64xx_spi_driver_data *sdd, 549static void s3c64xx_spi_unmap_mssg(struct s3c64xx_spi_driver_data *sdd,
546 struct spi_message *msg) 550 struct spi_message *msg)
547{ 551{
552 struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
548 struct device *dev = &sdd->pdev->dev; 553 struct device *dev = &sdd->pdev->dev;
549 struct spi_transfer *xfer; 554 struct spi_transfer *xfer;
550 555
@@ -553,6 +558,9 @@ static void s3c64xx_spi_unmap_mssg(struct s3c64xx_spi_driver_data *sdd,
553 558
554 list_for_each_entry(xfer, &msg->transfers, transfer_list) { 559 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
555 560
561 if (xfer->len <= ((sci->fifo_lvl_mask >> 1) + 1))
562 continue;
563
556 if (xfer->rx_buf != NULL 564 if (xfer->rx_buf != NULL
557 && xfer->rx_dma != XFER_DMAADDR_INVALID) 565 && xfer->rx_dma != XFER_DMAADDR_INVALID)
558 dma_unmap_single(dev, xfer->rx_dma, 566 dma_unmap_single(dev, xfer->rx_dma,