From patchwork Tue Jan 16 19:02:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 861866 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="iPb3yO4v"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zLfq945qSz9t2c for ; Wed, 17 Jan 2018 06:07:17 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751735AbeAPTHE (ORCPT ); Tue, 16 Jan 2018 14:07:04 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:42531 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751513AbeAPTHB (ORCPT ); Tue, 16 Jan 2018 14:07:01 -0500 Received: by mail-wr0-f193.google.com with SMTP id e41so16030180wre.9 for ; Tue, 16 Jan 2018 11:07:00 -0800 (PST) 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=9exoFLXv76/XOmvcUmeJ2Kd4ZNMMhHxQY5n6fYdw5GY=; b=iPb3yO4vDJ7YwvhFw5BI5XctIMnePHUlVigxhU6Eb8FSAtzkVT3sNtyijVz8hIuNq+ JSdxU7AAMlfCu+wQVCPofK2SNPSLHHCpLdvkI4hIm2mvy6zIA5AhCLVh5M96iBQ3env3 E3p1a+RJeRtzDOxGSoB4P9xlnKfaf/fVc/9rA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9exoFLXv76/XOmvcUmeJ2Kd4ZNMMhHxQY5n6fYdw5GY=; b=XNG8BmVcKhIIAcsOP6gbToePMTMxkvOzMQSBDr4waZG+LQe+beNWm/iOkrK63Xxn6K UroThjcIWE4B95rjhd3l8oNFy/le94TcCiJfuj83/Ho8YZMDoQHUrBZgVcGDg94S0vjN yDXeXZFwucSDrcAThH1zsY9uZC4XG6y1bDDSPCPnc+AYs1Wd1/EnlRAfIiD19D4ezn2n X0JE9zr+DO2Z+prXwAxce5broUQJIPbvTmIZevn/JbC00mIEr6aM/10VBrpMkgKAtXtU w7P3F0gy90V9D9w8zNWdanH96tR91KyeM2gqHNnT5DAwUH+xJuFiK8Zr/OczfR5UinCI E6DQ== X-Gm-Message-State: AKwxytdQvyevSX48oUropd6qTl0WVrzc3AZ4TYDyhalUxIKyF4Dpga6P 1dDYzHGJIDVf088d3YXpjyeQig== X-Google-Smtp-Source: ACJfBouAXcKJIctRLTybSKuWOV5Z5pSjnN3WIoetPR2XnOVkq7QrlvSjPkvoUJ5YJpoJM/p5cxqX6w== X-Received: by 10.223.132.166 with SMTP id 35mr190354wrg.131.1516129620286; Tue, 16 Jan 2018 11:07:00 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id 198sm3257074wmo.21.2018.01.16.11.06.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Jan 2018 11:06:59 -0800 (PST) From: srinivas.kandagatla@linaro.org To: Vinod Koul , Andy Gross , dmaengine@vger.kernel.org Cc: Rob Herring , Mark Rutland , David Brown , Dan Williams , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, yanhe@quicinc.com, ramkri@qti.qualcomm.com, sdharia@quicinc.com, Srinivas Kandagatla Subject: [PATCH 2/4] dmaengine: qcom: bam_dma: add num-channels binding for remotely controlled Date: Tue, 16 Jan 2018 19:02:34 +0000 Message-Id: <20180116190236.14558-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180116190236.14558-1-srinivas.kandagatla@linaro.org> References: <20180116190236.14558-1-srinivas.kandagatla@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Srinivas Kandagatla When Linux is master of BAM, it can directly read registers to know number of supported channels, however when its remotely controlled reading these registers would trigger a crash if the BAM is not yet intialized/powered up on the remote side. This patch adds num-channels binding to specify number of supported dma channels on remotely controlled BAM. Signed-off-by: Srinivas Kandagatla Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/dma/qcom_bam_dma.txt | 2 ++ drivers/dma/qcom/bam_dma.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt index 9cbf5d9df8fd..aa6822cbb230 100644 --- a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt +++ b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt @@ -15,6 +15,8 @@ Required properties: the secure world. - qcom,controlled-remotely : optional, indicates that the bam is controlled by remote proccessor i.e. execution environment. +- num-channels : optional, indicates supported number of DMA channels in a + remotely controlled bam. Example: diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index 78e488e8f96d..523bd178047a 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -1083,8 +1083,10 @@ 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; + if (!bdev->num_channels) { + val = readl_relaxed(bam_addr(bdev, 0, BAM_NUM_PIPES)); + bdev->num_channels = val & BAM_NUM_PIPES_MASK; + } if (bdev->controlled_remotely) return 0; @@ -1179,6 +1181,13 @@ static int bam_dma_probe(struct platform_device *pdev) bdev->controlled_remotely = of_property_read_bool(pdev->dev.of_node, "qcom,controlled-remotely"); + if (bdev->controlled_remotely) { + ret = of_property_read_u32(pdev->dev.of_node, "num-channels", + &bdev->num_channels); + if (ret) + dev_err(bdev->dev, "num-channels unspecified in dt\n"); + } + bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk"); if (IS_ERR(bdev->bamclk)) { bdev->bamclk = NULL; From patchwork Tue Jan 16 19:02:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 861865 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="axIfcy5P"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zLfq81pxKz9t20 for ; Wed, 17 Jan 2018 06:07:16 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751801AbeAPTHL (ORCPT ); Tue, 16 Jan 2018 14:07:11 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35097 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751434AbeAPTHE (ORCPT ); Tue, 16 Jan 2018 14:07:04 -0500 Received: by mail-wm0-f65.google.com with SMTP id r78so10844992wme.0 for ; Tue, 16 Jan 2018 11:07:03 -0800 (PST) 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=oF6+dRw4nfaawgP/82Squ5eqFxopV2zfT91f1nTBebI=; b=axIfcy5PWLmEpHZb0HQn4FnLq3P+Dmxu79TN9SAxN07L8KvLcNgwA8BWPptdO/QHgA YFW6MW87cOfqPM7fG1CNSROccoZzmIbO+96PJYXICoYxNAY61CVAeOrS7mpvYZWNQ/nN zCMeAgXCet2k/coUwkfA/gGm5TXY7NB1yGVPY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oF6+dRw4nfaawgP/82Squ5eqFxopV2zfT91f1nTBebI=; b=NMg8JnYM5fOZZi8uOVA5RK1gxcq1IHiGQYw5q/24h2YsKAAwgUNTK+vvTiL/duKy+Y fzyI75PU24KRrTnfVLnvqxmP8bZDqGnjJK0wUWVM7oUtZMFx+VUgHjwdr1Z+cFW43ZG3 DS2SqRk1UQojKrlXTMmmNwUOdwQk8bZImPJJaMbp1xliCs6XiyaViYEVQAs7gkR5+WAO 9mLIBL0NnDbtJXAypP1b7i8EWd5vwstZzuU4uxWnQmIsYICgRePHeEU7vu27Nc4K7k8/ 70FDEYOQrxVIpKVgP/irgPdSu6QwpD8L7nzGRVkCb83cPZA0skVIdiLoPnKMh9UnJZBs EYYg== X-Gm-Message-State: AKwxyteiiizp3qHofIn7Mqrm9kIyNNegKJMVKdZBNOL7i8trnCn7O2qC mTI3FdIi5uwVD2JSrjc8Vpfm+Q== X-Google-Smtp-Source: ACJfBoty8oA6sc4CaYyc4bmLolvoPJ4b74sR62H0JFacqyN5B8GUyCsJLL0HAKCm7JpPcRmjJx/eZA== X-Received: by 10.28.125.19 with SMTP id y19mr84964wmc.101.1516129622564; Tue, 16 Jan 2018 11:07:02 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id 198sm3257074wmo.21.2018.01.16.11.07.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Jan 2018 11:07:02 -0800 (PST) From: srinivas.kandagatla@linaro.org To: Vinod Koul , Andy Gross , dmaengine@vger.kernel.org Cc: Rob Herring , Mark Rutland , David Brown , Dan Williams , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, yanhe@quicinc.com, ramkri@qti.qualcomm.com, sdharia@quicinc.com, Srinivas Kandagatla Subject: [PATCH 4/4] dmaengine: qcom: bam_dma: Add num-ees dt binding for remotely controlled Date: Tue, 16 Jan 2018 19:02:36 +0000 Message-Id: <20180116190236.14558-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180116190236.14558-1-srinivas.kandagatla@linaro.org> References: <20180116190236.14558-1-srinivas.kandagatla@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Srinivas Kandagatla When Linux is master of BAM, it can directly read registers to know number of supported execution enviroments, however when its remotely controlled reading these registers would trigger a crash if the BAM is not yet intialized/powered up on the remote side. This patch adds new binding num-ees to specify supported number of Execution Environments when BAM is remotely controlled. Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/dma/qcom_bam_dma.txt | 2 ++ drivers/dma/qcom/bam_dma.c | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt index aa6822cbb230..f0d10c2b393e 100644 --- a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt +++ b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt @@ -17,6 +17,8 @@ Required properties: remote proccessor i.e. execution environment. - num-channels : optional, indicates supported number of DMA channels in a remotely controlled bam. +- num-ees : optional, indicates supported number of Execution Environments in a + remotely controlled bam. Example: diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index bbbb755d7549..7a8727271d60 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -387,6 +387,7 @@ struct bam_device { struct device_dma_parameters dma_parms; struct bam_chan *channels; u32 num_channels; + u32 num_ees; /* execution environment ID, from DT */ u32 ee; @@ -1079,11 +1080,14 @@ static int bam_init(struct bam_device *bdev) u32 val; /* read revision and configuration information */ - val = readl_relaxed(bam_addr(bdev, 0, BAM_REVISION)) >> NUM_EES_SHIFT; - val &= NUM_EES_MASK; + if (!bdev->num_ees) { + val = readl_relaxed(bam_addr(bdev, 0, BAM_REVISION)) >> NUM_EES_SHIFT; + val &= NUM_EES_MASK; + bdev->num_ees = val; + } /* check that configured EE is within range */ - if (bdev->ee >= val) + if (bdev->ee >= bdev->num_ees) return -EINVAL; if (!bdev->num_channels) { @@ -1189,6 +1193,11 @@ static int bam_dma_probe(struct platform_device *pdev) &bdev->num_channels); if (ret) dev_err(bdev->dev, "num-channels unspecified in dt\n"); + + ret = of_property_read_u32(pdev->dev.of_node, "num-ees", + &bdev->num_ees); + if (ret) + dev_err(bdev->dev, "num-ees unspecified in dt\n"); } bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");