aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanimir Varbanov <stanimir.varbanov@linaro.org>2016-04-11 04:38:41 -0400
committerVinod Koul <vinod.koul@intel.com>2016-04-19 11:41:31 -0400
commit5172c9eb89d4ea41f86ff91b15b2b0dc75ded869 (patch)
tree526284146909045c1f996f12134506f8ff6fb4fa
parentc778ed46e6d245186522d2ebe2d39b52bbc4432b (diff)
dmaengine: qcom: bam_dma: add controlled-remotely dt property
Some of the peripherals has bam which is controlled by remote processor, thus the bam dma driver must avoid register writes which initialise bam hw block. Those registers are protected from xPU block and any writes to them will lead to secure violation and system reboot. Adding the contolled_remotely flag in bam driver to avoid not permitted register writes in bam_init function. Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Reviewed-by: Andy Gross <andy.gross@linaro.org> Tested-by: Pramod Gurav <gpramod@codeaurora.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r--drivers/dma/qcom/bam_dma.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 789d5f836bf7..d0f878a78fae 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -387,6 +387,7 @@ struct bam_device {
387 387
388 /* execution environment ID, from DT */ 388 /* execution environment ID, from DT */
389 u32 ee; 389 u32 ee;
390 bool controlled_remotely;
390 391
391 const struct reg_offset_data *layout; 392 const struct reg_offset_data *layout;
392 393
@@ -1042,6 +1043,9 @@ static int bam_init(struct bam_device *bdev)
1042 val = readl_relaxed(bam_addr(bdev, 0, BAM_NUM_PIPES)); 1043 val = readl_relaxed(bam_addr(bdev, 0, BAM_NUM_PIPES));
1043 bdev->num_channels = val & BAM_NUM_PIPES_MASK; 1044 bdev->num_channels = val & BAM_NUM_PIPES_MASK;
1044 1045
1046 if (bdev->controlled_remotely)
1047 return 0;
1048
1045 /* s/w reset bam */ 1049 /* s/w reset bam */
1046 /* after reset all pipes are disabled and idle */ 1050 /* after reset all pipes are disabled and idle */
1047 val = readl_relaxed(bam_addr(bdev, 0, BAM_CTRL)); 1051 val = readl_relaxed(bam_addr(bdev, 0, BAM_CTRL));
@@ -1129,6 +1133,9 @@ static int bam_dma_probe(struct platform_device *pdev)
1129 return ret; 1133 return ret;
1130 } 1134 }
1131 1135
1136 bdev->controlled_remotely = of_property_read_bool(pdev->dev.of_node,
1137 "qcom,controlled-remotely");
1138
1132 bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk"); 1139 bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");
1133 if (IS_ERR(bdev->bamclk)) 1140 if (IS_ERR(bdev->bamclk))
1134 return PTR_ERR(bdev->bamclk); 1141 return PTR_ERR(bdev->bamclk);