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: 10167969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9CFE5603B5 for ; Tue, 16 Jan 2018 19:07:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87D1F2094F for ; Tue, 16 Jan 2018 19:07:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BFAE21BED; Tue, 16 Jan 2018 19:07:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 233D620950 for ; Tue, 16 Jan 2018 19:07:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751621AbeAPTHL (ORCPT ); Tue, 16 Jan 2018 14:07:11 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:41969 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751695AbeAPTHE (ORCPT ); Tue, 16 Jan 2018 14:07:04 -0500 Received: by mail-wm0-f65.google.com with SMTP id f71so10478052wmf.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=jbYGsR0/V8Z2v6RKQHU08srJQSwmiJzo5IwkYSk8U24+ZGY/lkqXcJSmmY1x8/MXpz qKPkZkc1eBTgnb/zI7hZmd6xJk600b/7qPVoS1tHrICb/RrvVk/ATFci3/VeTPq0thwH XSj+Xef7jZ0l+kuNbsETS4E/m70aNMII/n6q9hUf0QBn1KTkOzcjntMW42qq/amLvXKV 3jxF7pWo7h4ir653kmc1gvZwUOpWiyT00x5gWUyzvLm5u2MZdgO0wXddI2Z+BAKwSpEK 9VUZkMDIWksgls03XSFoGf983AX9RfiEoIu+Pp4sGrsVzcRyK4GMi+OwzIUoJfbKzqez HE9w== X-Gm-Message-State: AKwxytfyrj6iBQfsI5DYoDFFfA9SXJEnw7QrHmOIkQBPJd8Oh/s9eOxD ybfLy1ORrLZ6ApRDAyfNa+1cLQ== 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: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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");