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: 10167971 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 D38F6603B5 for ; Tue, 16 Jan 2018 19:07:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF48B2094F for ; Tue, 16 Jan 2018 19:07:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3DAC21BED; Tue, 16 Jan 2018 19:07:16 +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=ham 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 5242A2094F for ; Tue, 16 Jan 2018 19:07:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751687AbeAPTHE (ORCPT ); Tue, 16 Jan 2018 14:07:04 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:43506 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751550AbeAPTHB (ORCPT ); Tue, 16 Jan 2018 14:07:01 -0500 Received: by mail-wr0-f194.google.com with SMTP id t16so2720910wrc.10 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=G2bmdKMVBgnw2HQhl8M0795+5H5KIiWFJfr1T8Vm9utXJN/X8p3BqZj7gstaXTsLP4 v9DE1zF4ajwQOJo2ZYcTgw5J6/cb51vUCBazcp7EIMP5nqu2u3NOcHBhu9g/dSlIE7Ng ASNBVweXo8qf9HagtnwOFC+5WSJ5nC/hAoGpr9bCDwpEHI2WfqMprt77aUBkYNpW+b4v 2XJp5/XsA3k7oL7lMsKdWwLJP1oiI2AMvzgQoVcoCJrFhZ386UXU6ne/CW36MBAGqCXT awgoqV76Db1Lye5mbW6DDK81X91vmQQTnhgJa21X4roObd62J8K8Jgvv0XFDdtQNLlj+ B03g== X-Gm-Message-State: AKwxytc1L5+Yu3JiWdflYYaZc7idgp8i0X4gE6MBtqJJa12vlpFxXZsO nudmgcDtLfdlErtyb4iPV5EaEQ== 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: 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 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;