summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGirish Mahadevan <girishm@codeaurora.org>2016-12-27 15:07:42 -0700
committerGirish Mahadevan <girishm@codeaurora.org>2017-02-14 10:34:47 -0700
commitf61d2a9a02ff10fca288aac31e0f12d878172d9f (patch)
tree5c002d4d1b27d16f662084c01c83c7e5caa1f1ff
parentefaccb4adb35009386634bd7eb7ccd861e2825a8 (diff)
spi: spi_qsd: Set DMA mask for SPI device
Set the DMA mask for the SPI device appropriately. This will alleviate usage of bounce buffers by the dma kernel library and prevent some of the crashes due to the kernel running out of bounce buffers. Change-Id: I7b0b123be6e7bb1e30d0755ca8b1b72ea4e2b5f6 Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
-rw-r--r--drivers/spi/spi_qsd.c1
-rw-r--r--drivers/spi/spi_qsd.h9
2 files changed, 9 insertions, 1 deletions
diff --git a/drivers/spi/spi_qsd.c b/drivers/spi/spi_qsd.c
index 7aa04a4fa156..fa6493326e8a 100644
--- a/drivers/spi/spi_qsd.c
+++ b/drivers/spi/spi_qsd.c
@@ -2535,6 +2535,7 @@ static int msm_spi_probe(struct platform_device *pdev)
dd->use_dma = 1;
}
+ spi_dma_mask(&pdev->dev);
skip_dma_resources:
spin_lock_init(&dd->queue_lock);
diff --git a/drivers/spi/spi_qsd.h b/drivers/spi/spi_qsd.h
index e8e6cdce1a02..47d69965f18a 100644
--- a/drivers/spi/spi_qsd.h
+++ b/drivers/spi/spi_qsd.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -167,6 +167,13 @@ enum msm_spi_state {
/* Data Mover commands should be aligned to 64 bit(8 bytes) */
#define DM_BYTE_ALIGN 8
+#if defined(CONFIG_ARM64) || defined(CONFIG_LPAE)
+#define spi_dma_mask(dev) (dma_set_mask((dev), DMA_BIT_MASK(36)))
+#else
+#define spi_dma_mask(dev) (dma_set_mask((dev), DMA_BIT_MASK(32)))
+#endif
+
+
enum msm_spi_qup_version {
SPI_QUP_VERSION_NONE = 0x0,
SPI_QUP_VERSION_BFAM = 0x2,