From patchwork Tue Mar 22 09:49:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pramod Gurav X-Patchwork-Id: 600513 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3qTnxl0tYXz9s5M for ; Tue, 22 Mar 2016 20:50:35 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758377AbcCVJu1 (ORCPT ); Tue, 22 Mar 2016 05:50:27 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:59461 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758550AbcCVJuP (ORCPT ); Tue, 22 Mar 2016 05:50:15 -0400 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 25992615C6; Tue, 22 Mar 2016 09:50:14 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 17205615C7; Tue, 22 Mar 2016 09:50:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from blr-ubuntu-56.ap.qualcomm.com (unknown [202.46.23.61]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: gpramod@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2ABE560277; Tue, 22 Mar 2016 09:50:09 +0000 (UTC) From: Pramod Gurav To: andy.gross@linaro.org, linux-kernel@vger.kernel.org Cc: dmaengine@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, dan.j.williams@intel.com, vinod.koul@intel.com, okaya@codeaurora.org, architt@codeaurora.org, Pramod Gurav Subject: [PATCH 2/2] dmaengine: qcom_bam_dma: Bypass BAM init if not managed locally Date: Tue, 22 Mar 2016 15:19:11 +0530 Message-Id: <1458640151-15150-3-git-send-email-gpramod@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1458640151-15150-1-git-send-email-gpramod@codeaurora.org> References: <1458640151-15150-1-git-send-email-gpramod@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On some QOCM platforms BAM control registers are managed remotely hence can not be accessed by application processor for writes. Pass a DT property qcom,bam_ctrl_remote to declare the same to skip bam_init. Move the pipe number initialisation from bam_init to probe functiom as it should be done for all platforms. Signed-off-by: Pramod Gurav --- Documentation/devicetree/bindings/dma/qcom_bam_dma.txt | 3 +++ drivers/dma/qcom/bam_dma.c | 18 +++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt index 1c9d48e..46e33ae 100644 --- a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt +++ b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt @@ -13,6 +13,8 @@ Required properties: - clock-names: must contain "bam_clk" entry - qcom,ee : indicates the active Execution Environment identifier (0-7) used in the secure world. +- qcom,bam_ctrl_remote: Use when BAM global device control is managed remotely + and not locally by the application processor. Example: @@ -24,6 +26,7 @@ Example: clock-names = "bam_clk"; #dma-cells = <1>; qcom,ee = <0>; + qcom,bam_ctrl_remote; }; DMA clients must use the format described in the dma.txt file, using a two cell diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index 0880345..04dd446 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -384,6 +384,7 @@ struct bam_device { struct device_dma_parameters dma_parms; struct bam_chan *channels; u32 num_channels; + bool bam_ctrl_remote; /* execution environment ID, from DT */ u32 ee; @@ -1036,9 +1037,6 @@ static int bam_init(struct bam_device *bdev) if (bdev->ee >= val) return -EINVAL; - val = readl_relaxed(bam_addr(bdev, 0, BAM_NUM_PIPES)); - bdev->num_channels = val & BAM_NUM_PIPES_MASK; - /* s/w reset bam */ /* after reset all pipes are disabled and idle */ val = readl_relaxed(bam_addr(bdev, 0, BAM_CTRL)); @@ -1095,7 +1093,7 @@ static int bam_dma_probe(struct platform_device *pdev) struct bam_device *bdev; const struct of_device_id *match; struct resource *iores; - int ret, i; + int ret, i, val; bdev = devm_kzalloc(&pdev->dev, sizeof(*bdev), GFP_KERNEL); if (!bdev) @@ -1136,9 +1134,15 @@ static int bam_dma_probe(struct platform_device *pdev) return ret; } - ret = bam_init(bdev); - if (ret) - goto err_disable_clk; + val = readl_relaxed(bam_addr(bdev, 0, BAM_NUM_PIPES)); + bdev->num_channels = val & BAM_NUM_PIPES_MASK; + + bdev->bam_ctrl_remote = of_property_read_bool(pdev->dev.of_node, + "qcom,bam_ctrl_remote"); + if (bdev->bam_ctrl_remote != true) + ret = bam_init(bdev); + if (ret) + goto err_disable_clk; tasklet_init(&bdev->task, dma_tasklet, (unsigned long)bdev);