Merge "asoc: wcd-spi: Set the dma_mask for spi_device"

This commit is contained in:
qctecmdr authored and Gerrit - the friendly Code Review server committed 2020-10-22 11:22:04 -07:00
commit c876cd8c7d
1 file changed
+16 -2
+16 -2
View File
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
@@ -1531,6 +1531,17 @@ static const struct component_ops wcd_spi_component_ops = {
.unbind = wcd_spi_component_unbind,
};
#ifdef CONFIG_WCD_SPI_DMA_MASKING
static void arch_setup_spi_archdata(struct spi_device *spi)
{
if (spi->dev.coherent_dma_mask == DMA_MASK_NONE &&
spi->dev.dma_mask == NULL) {
spi->dev.coherent_dma_mask = DMA_BIT_MASK(sizeof(dma_addr_t) * 8);
spi->dev.dma_mask = &spi->dev.coherent_dma_mask;
}
}
#endif
static int wcd_spi_probe(struct spi_device *spi)
{
struct wcd_spi_priv *wcd_spi;
@@ -1557,8 +1568,11 @@ static int wcd_spi_probe(struct spi_device *spi)
mutex_init(&wcd_spi->xfer_mutex);
INIT_DELAYED_WORK(&wcd_spi->clk_dwork, wcd_spi_clk_work);
init_completion(&wcd_spi->resume_comp);
arch_setup_dma_ops(&spi->dev, 0, 0, NULL, true);
#ifdef CONFIG_WCD_SPI_DMA_MASKING
arch_setup_spi_archdata(spi);
#endif
arch_setup_dma_ops(&spi->dev, 0, 0, NULL, true);
wcd_spi->spi = spi;
spi_set_drvdata(spi, wcd_spi);