From 07a4e443dd21c021ab881228044a935689bb1dcf Mon Sep 17 00:00:00 2001 From: Aniket Randive Date: Fri, 22 Jan 2021 10:01:07 +0530 Subject: [PATCH] i2c: i2c-msm-geni: Selectively disable DMA and operate in FIFO mode Currently for SSC QUP, we are not supporting the DMA mode on SA8155 and SA8195 platform. so for some non-gsi transfer if the mode of SE is DMA then it will switch to the FIFO mode and complete the transfer. Change-Id: I4cbc2ed9ceff7d1c4fdfec3a1efeda80af2fc2bf Signed-off-by: Aniket Randive --- drivers/i2c/busses/i2c-msm-geni.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-msm-geni.c b/drivers/i2c/busses/i2c-msm-geni.c index 44a90e45c6b1..932ed17fc521 100644 --- a/drivers/i2c/busses/i2c-msm-geni.c +++ b/drivers/i2c/busses/i2c-msm-geni.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ #include @@ -132,6 +132,7 @@ struct geni_i2c_dev { bool req_chan; bool first_resume; bool gpi_reset; + bool disable_dma_mode; }; static struct geni_i2c_dev *gi2c_dev_dbg[MAX_SE]; @@ -1030,6 +1031,14 @@ static int geni_i2c_xfer(struct i2c_adapter *adap, qcom_geni_i2c_calc_timeout(gi2c); mode = msgs[i].len > 32 ? SE_DMA : FIFO_MODE; + /* Complete the transfer in FIFO mode if DMA mode + * is not supported for some Automotive platform. + */ + if (gi2c->disable_dma_mode) { + GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev, + "Disable DMA mode\n"); + mode = FIFO_MODE; + } ret = geni_se_select_mode(gi2c->base, mode); if (ret) { dev_err(gi2c->dev, "%s: Error mode init %d:%d:%d\n", @@ -1283,6 +1292,9 @@ static int geni_i2c_probe(struct platform_device *pdev) return ret; } + gi2c->disable_dma_mode = of_property_read_bool(pdev->dev.of_node, + "qcom,disable-dma"); + gi2c->irq = platform_get_irq(pdev, 0); if (gi2c->irq < 0) return gi2c->irq;