From patchwork Tue Apr 5 22:56:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 65145 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp730714lbc; Tue, 5 Apr 2016 15:57:28 -0700 (PDT) X-Received: by 10.66.174.134 with SMTP id bs6mr29080246pac.53.1459897047329; Tue, 05 Apr 2016 15:57:27 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si28709260pfk.202.2016.04.05.15.57.27; Tue, 05 Apr 2016 15:57:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760090AbcDEW5T (ORCPT + 29 others); Tue, 5 Apr 2016 18:57:19 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:32860 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759922AbcDEW5P (ORCPT ); Tue, 5 Apr 2016 18:57:15 -0400 Received: by mail-wm0-f49.google.com with SMTP id f198so50563423wme.0 for ; Tue, 05 Apr 2016 15:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IB6rO8KVd1ql67SrqpADNlO4Er9OXJhKG3E/Nqqwlpk=; b=GgBl3gRNqdFIV1ZXxdI+x91hncO+eF0otQZdimL+p+XliGDbi+tZaO47bTJZ8FwaX9 UWPLEKtUaBJzaTHTnJebuc2sCBVBDwCqprGFFPPDQ9KhgDvG4mwIjQnKiwoKmmJ2ATEq Oz1a/+MV/V+TnrR0oGNSies5NmO6dGA+wt174= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IB6rO8KVd1ql67SrqpADNlO4Er9OXJhKG3E/Nqqwlpk=; b=gKCCEVnJTO8bBoGvpg8ackTvAzk4c70XR8oLc1BjRo+PqSG2GThBhSkp0RC1Y3o9oP xeVnvyZzRoeSq4Ou0PKCzmZxfQDzYEKfbhp4c/9GaFA6JURcqj0PXYz4m6gKyGn7VgEb Rfi9dwckSjQOzNjnANOG2lohV/dM8Ryt6ImuArZLoFFKOb66huC8WBb6wjgfNwjrROxD 9S9qbF6Lae8IdQs98JlQ9NXYrkrk3/vpEfw97/0Qp8dGtVhw4A0z9ekhAOBIvTO6vaVn 0AWx+DLvZaCmUOTPdUb0Dpc0AX1UTMjXB1LX774D1gPuQz7vglB+Lw3khvoiWUvUXOe5 wBPA== X-Gm-Message-State: AD7BkJIagJ36/as+VL9ZNHz+GHK1e7a4062izweat3BXqrzBCqhx5IFSwihhK8Pg6T2+XqES X-Received: by 10.194.48.7 with SMTP id h7mr20608333wjn.81.1459897033312; Tue, 05 Apr 2016 15:57:13 -0700 (PDT) Received: from localhost.localdomain (hst-221-11.medicom.bg. [84.238.221.11]) by smtp.gmail.com with ESMTPSA id n3sm21914wja.6.2016.04.05.15.57.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Apr 2016 15:57:12 -0700 (PDT) From: Stanimir Varbanov To: Rob Herring , Mark Rutland , Vinod Koul , Andy Gross Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, dmaengine@vger.kernel.org, Sinan Kaya , Pramod Gurav , Stanimir Varbanov Subject: [PATCH v2 3/5] dmaengine: qcom: bam_dma: add controlled remotely dt property Date: Wed, 6 Apr 2016 01:56:20 +0300 Message-Id: <1459896982-30171-4-git-send-email-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459896982-30171-1-git-send-email-stanimir.varbanov@linaro.org> References: <1459896982-30171-1-git-send-email-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Andy Gross --- Documentation/devicetree/bindings/dma/qcom_bam_dma.txt | 2 ++ drivers/dma/qcom/bam_dma.c | 7 +++++++ 2 files changed, 9 insertions(+) -- 1.9.1 Acked-by: Rob Herring diff --git a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt index 1c9d48ea4914..9cbf5d9df8fd 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,controlled-remotely : optional, indicates that the bam is controlled by + remote proccessor i.e. execution environment. Example: 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 { /* execution environment ID, from DT */ u32 ee; + bool controlled_remotely; const struct reg_offset_data *layout; @@ -1042,6 +1043,9 @@ static int bam_init(struct bam_device *bdev) val = readl_relaxed(bam_addr(bdev, 0, BAM_NUM_PIPES)); bdev->num_channels = val & BAM_NUM_PIPES_MASK; + if (bdev->controlled_remotely) + return 0; + /* s/w reset bam */ /* after reset all pipes are disabled and idle */ val = readl_relaxed(bam_addr(bdev, 0, BAM_CTRL)); @@ -1129,6 +1133,9 @@ static int bam_dma_probe(struct platform_device *pdev) return ret; } + bdev->controlled_remotely = of_property_read_bool(pdev->dev.of_node, + "qcom,controlled-remotely"); + bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk"); if (IS_ERR(bdev->bamclk)) return PTR_ERR(bdev->bamclk);