dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [3/4] dmaengine: qcom: bam_dma: do not write to global regs in remote mode
@ 2018-01-16 19:02 Srinivas Kandagatla
  0 siblings, 0 replies; only message in thread
From: Srinivas Kandagatla @ 2018-01-16 19:02 UTC (permalink / raw)
  To: Vinod Koul, Andy Gross, dmaengine
  Cc: Rob Herring, Mark Rutland, David Brown, Dan Williams, devicetree,
	linux-kernel, linux-arm-msm, linux-soc, yanhe, ramkri, sdharia,
	Srinivas Kandagatla

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

BAM_DESC_CNT_TRSHLD register is global register, which can only be written
when BAM is in master mode, So check the mode of operation before writing it.

Without this check SOC's xPU would catch such access and crash the system.
First noticed on DB820c while testing SLIMBus BAM.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/dma/qcom/bam_dma.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 523bd178047a..bbbb755d7549 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -905,12 +905,15 @@ static void bam_apply_new_config(struct bam_chan *bchan,
 	struct bam_device *bdev = bchan->bdev;
 	u32 maxburst;
 
-	if (dir == DMA_DEV_TO_MEM)
-		maxburst = bchan->slave.src_maxburst;
-	else
-		maxburst = bchan->slave.dst_maxburst;
-
-	writel_relaxed(maxburst, bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
+	if (!bdev->controlled_remotely) {
+		if (dir == DMA_DEV_TO_MEM)
+			maxburst = bchan->slave.src_maxburst;
+		else
+			maxburst = bchan->slave.dst_maxburst;
+
+		writel_relaxed(maxburst,
+			       bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
+	}
 
 	bchan->reconfigure = 0;
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-01-16 19:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-16 19:02 [3/4] dmaengine: qcom: bam_dma: do not write to global regs in remote mode Srinivas Kandagatla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).