From f61d2a9a02ff10fca288aac31e0f12d878172d9f Mon Sep 17 00:00:00 2001 From: Girish Mahadevan Date: Tue, 27 Dec 2016 15:07:42 -0700 Subject: [PATCH] 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 --- drivers/spi/spi_qsd.c | 1 + drivers/spi/spi_qsd.h | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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, -- 2.11.0