Message ID | 20230518-bamclk-dt-v1-1-82f738c897d9@gerhold.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp356672vqo; Thu, 18 May 2023 02:30:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4h8bCvxGcblHOhWrvTUqCw5hZwzWRS0/K0EkJrNhj3Z+QMO/GFNmcJGmxSXe8+PMRxhWhH X-Received: by 2002:a05:6a20:4420:b0:101:6908:2b03 with SMTP id ce32-20020a056a20442000b0010169082b03mr1090436pzb.25.1684402209299; Thu, 18 May 2023 02:30:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684402209; cv=pass; d=google.com; s=arc-20160816; b=tAyCI5RfxOpPeqOtOaf8pEW0RSqU5Mvx714o/o36mRoNfRoywkn9xulRvsQqrWq8rt lsei64JM8QeyofFSCd5xCkAv5YBMbqH3Z7q89uDwMhjneAB40lfjoGrytGjXnC4/4giv JgQsECIiWijessxJZmvB2DomFFzOmQ7DsCnuLYPO9urwcTuzIxGtBTvB4Z3w6xuKzk8h N4bnJghzzC96HZbRVjlWIl3d1iedmxstJsdlCRaFIjOQ0jjaQJa03Dz3pimKQLVqa44s +1CncD/TL7c0G845EZWZZqtek12gcKd2C2GgZRz74rSnwm0cY+v7zikr8jb9bUjyqXy+ 5iCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature:dkim-signature; bh=VQO5GZKsRP3ZSA1ItJkim0mWjRZa1duUQAzHk9XLuPY=; b=uiNBY/aodHkU9eN8WEuSla7NfCzelPoc2c+aP1K1b98x6Mk9WeGGzfsvl6+vEWSQtU 4X/QV/MM+Ga4NiLGon0v4LOVjN4R9YysUL+5jmusEskXnJD+HHWpvgugZxVBEwtuJ8/A DXOC/Rz41RTz5qMHVa2oVwGne1EVNc4o7RmLfWZO3w9tT89BMXUrgn8FYKgldtipnxVB vpcoCxvUlRz8muGC0j8Hdq4EWhr0lk25CCAav6NTiuTWK/QDMuV9p0KSVwt+lESkDeny fApUfoKFBiMYfldoZIu+VzQ7HQexZ7qTww3z5U0gqwQhgng7b7F6Jrjraqn4ksKM3YpN JU9Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=Aj4L2AS3; dkim=neutral (no key) header.i=@gerhold.net header.s=strato-dkim-0003; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020aa797a7000000b0063b8eec0832si1254058pfq.114.2023.05.18.02.29.56; Thu, 18 May 2023 02:30:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=Aj4L2AS3; dkim=neutral (no key) header.i=@gerhold.net header.s=strato-dkim-0003; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230153AbjERJ0R (ORCPT <rfc822;abdi.embedded@gmail.com> + 99 others); Thu, 18 May 2023 05:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229810AbjERJ0Q (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 18 May 2023 05:26:16 -0400 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0963211E; Thu, 18 May 2023 02:26:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684401972; cv=none; d=strato.com; s=strato-dkim-0002; b=Rl6R68C8H4FPS/jhpoG/Z31osMkn07jJyu2d79AfgLwKgfd294KNUbRsdLtXpyZGSw Ho2eSCCRy2J3Jk1LZMKL4KTAObInXkmhfg8cdx8VeHCwlStjIFHB9cmnUSqnaSEL6sb3 +2QE70nh5o4Hrsik/XYYueDYQ0GvamH0C47s6BZttfSjZGqUFErNas6/MIeIjODSDGqC GGt6JUPfd9yXmYwnQjOvq0TZPz/jf5mdXno8z4a4PXa5EVkOtnGeo4B4xw8f6E/I/dQN mFP0oYDABlnUYxsZMWsFoaaF4KNIiUwYWv99JeFa1AmjrHzXg4iiqQpNPdwbvQTzYdC9 C/Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1684401972; s=strato-dkim-0002; d=strato.com; h=Cc:To:Message-Id:Subject:Date:From:Cc:Date:From:Subject:Sender; bh=VQO5GZKsRP3ZSA1ItJkim0mWjRZa1duUQAzHk9XLuPY=; b=NIIo/VIFja0OfqtlM4e3RXLGSwMSF2BlN3ax5U95Y1Vq14CRZqicftsRm7MN5/MZjP lvgwQXc9Jo/PFn3fnfxzahTZY937ggcZbkJOGlAYbKd0YLWVECy5dWLtoQCCxTI7rXpE 4oUEc7fuaYxoa8KYsAtaUxEPsWu69s7+kh1fcijKL8HVVnVzQvUxOYOvbW2VBKNtDUn8 fBWx3BlgSKdm/bJ6ydFnBfs8svd1jHsS+JdjzQ45FKRkBVapSQG6psNWZUnvbZ3FX08s 9hiGw6QnttU374FQRqkoU7t1JFoklMKKgT+sQnibgsQXtd9G6pcFRbm2x8SO7o947m/9 WO3Q== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1684401972; s=strato-dkim-0002; d=gerhold.net; h=Cc:To:Message-Id:Subject:Date:From:Cc:Date:From:Subject:Sender; bh=VQO5GZKsRP3ZSA1ItJkim0mWjRZa1duUQAzHk9XLuPY=; b=Aj4L2AS39FtstuOcjpg1P1jT1Bkvw0beudtYK6j9LzznPKPhXBLiCBuXG898o9Cw00 4SjJBaCIUP40zcOUXy+SDa3OlO6BG9qa/B2G0hGSB9nidnpD8JHvHgV8UvcI5o7JtVRx Rw9aSMRITOuJOAGxtrOTW52DG9E+e7CXwznteFFpvxixtS+ilNu+E4oDQwVe0Edtw6Ih jVdvwOaNcnDgwNQYRFGosd+Ixcdy2GPxjW2DFTwTaiFO7724FgtHQEVdPU+O3ZXKZlY6 WNvf97fwjKAiwY9LLaF4apHbdZCKPOUrub1y8ONZu/qqnwnGuPrkae+JLm5QcB/al4d9 Kxtg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1684401972; s=strato-dkim-0003; d=gerhold.net; h=Cc:To:Message-Id:Subject:Date:From:Cc:Date:From:Subject:Sender; bh=VQO5GZKsRP3ZSA1ItJkim0mWjRZa1duUQAzHk9XLuPY=; b=lQcwfg74Koai6ozuU8fbsRd5/ddzfMLtsyABsfDZg/Wr8FRRCoDTcz2TIDv0jBb7JC wTwvBtwk0N7MEkjrhdCQ== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQjVd4CteZ/7jYgS+mLFY+H0JAn8u4p1/zY=" Received: from [192.168.244.3] by smtp.strato.de (RZmta 49.4.0 DYNA|AUTH) with ESMTPSA id j6420az4I9QBCGS (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 18 May 2023 11:26:11 +0200 (CEST) From: Stephan Gerhold <stephan@gerhold.net> Date: Thu, 18 May 2023 11:26:00 +0200 Subject: [PATCH] dmaengine: qcom: bam_dma: make channels/EEs optional in DT with clock MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230518-bamclk-dt-v1-1-82f738c897d9@gerhold.net> X-B4-Tracking: v=1; b=H4sIACfvZWQC/x2N0QqDMAxFf0XyvIDaDmW/MvaQtNkMq91odQzEf zf4eC7ncjaoUlQq3JoNivy06icbdJcGwkT5JajRGPq2d+21G5FpDumNccHoPZP4gZ0bwHymKsi FcpjskdeUbPwWeer/DNwf+34A1/ZNkXAAAAA= To: Vinod Koul <vkoul@kernel.org> Cc: Bjorn Andersson <andersson@kernel.org>, Andy Gross <agross@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Stephan Gerhold <stephan@gerhold.net> X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766223731344675325?= X-GMAIL-MSGID: =?utf-8?q?1766223731344675325?= |
Series |
dmaengine: qcom: bam_dma: make channels/EEs optional in DT with clock
|
|
Commit Message
Stephan Gerhold
May 18, 2023, 9:26 a.m. UTC
If we have a BAM clock in the DT we are able to turn on the BAM
controller while probing, so there is no need to read "num-channels"
and "qcom,num-ees" from the DT. It can be read more accurately directly
from the identification registers of the BAM.
This simplifies setting up typical controlled-remotely BAM DMAs in the
DT that can be turned on via a clock (e.g. the BLSP DMA).
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
drivers/dma/qcom/bam_dma.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
---
base-commit: 1c677f238f92ba0a329b7c13220f38b396872806
change-id: 20230518-bamclk-dt-d44bae47b337
Best regards,
Comments
Hi Stephan, On Thu, 18 May 2023 at 14:56, Stephan Gerhold <stephan@gerhold.net> wrote: > > If we have a BAM clock in the DT we are able to turn on the BAM > controller while probing, so there is no need to read "num-channels" > and "qcom,num-ees" from the DT. It can be read more accurately directly > from the identification registers of the BAM. > > This simplifies setting up typical controlled-remotely BAM DMAs in the > DT that can be turned on via a clock (e.g. the BLSP DMA). Can you please list which qcom board(s) you tested this patch on? Thanks, Bhupesh > Signed-off-by: Stephan Gerhold <stephan@gerhold.net> > --- > drivers/dma/qcom/bam_dma.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c > index 1e47d27e1f81..4c3eb972039d 100644 > --- a/drivers/dma/qcom/bam_dma.c > +++ b/drivers/dma/qcom/bam_dma.c > @@ -1272,7 +1272,15 @@ static int bam_dma_probe(struct platform_device *pdev) > bdev->powered_remotely = of_property_read_bool(pdev->dev.of_node, > "qcom,powered-remotely"); > > - if (bdev->controlled_remotely || bdev->powered_remotely) { > + if (bdev->controlled_remotely || bdev->powered_remotely) > + bdev->bamclk = devm_clk_get_optional(bdev->dev, "bam_clk"); > + else > + bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk"); > + > + if (IS_ERR(bdev->bamclk)) > + return PTR_ERR(bdev->bamclk); > + > + if (!bdev->bamclk) { > ret = of_property_read_u32(pdev->dev.of_node, "num-channels", > &bdev->num_channels); > if (ret) > @@ -1284,14 +1292,6 @@ static int bam_dma_probe(struct platform_device *pdev) > dev_err(bdev->dev, "num-ees unspecified in dt\n"); > } > > - if (bdev->controlled_remotely || bdev->powered_remotely) > - bdev->bamclk = devm_clk_get_optional(bdev->dev, "bam_clk"); > - else > - bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk"); > - > - if (IS_ERR(bdev->bamclk)) > - return PTR_ERR(bdev->bamclk); > - > ret = clk_prepare_enable(bdev->bamclk); > if (ret) { > dev_err(bdev->dev, "failed to prepare/enable clock\n"); > > --- > base-commit: 1c677f238f92ba0a329b7c13220f38b396872806 > change-id: 20230518-bamclk-dt-d44bae47b337 > > Best regards, > -- > Stephan Gerhold <stephan@gerhold.net> >
On Thu, May 18, 2023 at 04:43:57PM +0530, Bhupesh Sharma wrote: > On Thu, 18 May 2023 at 14:56, Stephan Gerhold <stephan@gerhold.net> wrote: > > > > If we have a BAM clock in the DT we are able to turn on the BAM > > controller while probing, so there is no need to read "num-channels" > > and "qcom,num-ees" from the DT. It can be read more accurately directly > > from the identification registers of the BAM. > > > > This simplifies setting up typical controlled-remotely BAM DMAs in the > > DT that can be turned on via a clock (e.g. the BLSP DMA). > > Can you please list which qcom board(s) you tested this patch on? > It works fine at least on MSM8916/DB410c (for blsp_dma) and MDM9607 (blsp_dma and qpic_dma (for NAND)). More testing would be much appreciated of course! Personally I don't see much of a risk: If enabling the clock doesn't actually enable the BAM controller, then the clock probably does not belong to the BAM in the first place... :) Thanks, Stephan
On Thu, 18 May 2023 at 16:51, Stephan Gerhold <stephan@gerhold.net> wrote: > > On Thu, May 18, 2023 at 04:43:57PM +0530, Bhupesh Sharma wrote: > > On Thu, 18 May 2023 at 14:56, Stephan Gerhold <stephan@gerhold.net> wrote: > > > > > > If we have a BAM clock in the DT we are able to turn on the BAM > > > controller while probing, so there is no need to read "num-channels" > > > and "qcom,num-ees" from the DT. It can be read more accurately directly > > > from the identification registers of the BAM. > > > > > > This simplifies setting up typical controlled-remotely BAM DMAs in the > > > DT that can be turned on via a clock (e.g. the BLSP DMA). > > > > Can you please list which qcom board(s) you tested this patch on? > > > > It works fine at least on MSM8916/DB410c (for blsp_dma) and MDM9607 > (blsp_dma and qpic_dma (for NAND)). More testing would be much > appreciated of course! I tested this yesterday on RB1/RB2, RB5 and saw no improvement, so was wondering why exactly is this needed and which platforms are impacted. > Personally I don't see much of a risk: If enabling the clock doesn't > actually enable the BAM controller, then the clock probably does not > belong to the BAM in the first place... :) Right, but I think the commit message needs a bit more clarity to reflect that it is now proposed to check for the bam_clk presence earlier in the _probe flow (as compared to earlier). Thanks.
On Fri, May 19, 2023 at 02:40:21PM +0530, Bhupesh Sharma wrote: > On Thu, 18 May 2023 at 16:51, Stephan Gerhold <stephan@gerhold.net> wrote: > > > > On Thu, May 18, 2023 at 04:43:57PM +0530, Bhupesh Sharma wrote: > > > On Thu, 18 May 2023 at 14:56, Stephan Gerhold <stephan@gerhold.net> wrote: > > > > > > > > If we have a BAM clock in the DT we are able to turn on the BAM > > > > controller while probing, so there is no need to read "num-channels" > > > > and "qcom,num-ees" from the DT. It can be read more accurately directly > > > > from the identification registers of the BAM. > > > > > > > > This simplifies setting up typical controlled-remotely BAM DMAs in the > > > > DT that can be turned on via a clock (e.g. the BLSP DMA). > > > > > > Can you please list which qcom board(s) you tested this patch on? > > > > > > > It works fine at least on MSM8916/DB410c (for blsp_dma) and MDM9607 > > (blsp_dma and qpic_dma (for NAND)). More testing would be much > > appreciated of course! > > I tested this yesterday on RB1/RB2, RB5 and saw no improvement, so was wondering > why exactly is this needed and which platforms are impacted. > RB1/RB2 should be able to benefit from this for the cryptobam if you add the rpmcc clock to it, see my reply in [1]. [1]: https://lore.kernel.org/linux-arm-msm/ZGdLCdSof027mk5u@gerhold.net/ > > Personally I don't see much of a risk: If enabling the clock doesn't > > actually enable the BAM controller, then the clock probably does not > > belong to the BAM in the first place... :) > > Right, but I think the commit message needs a bit more clarity to > reflect that it is now proposed to check for the bam_clk presence > earlier in the _probe flow (as compared to earlier). > Sure, I will try to clarify the commit message a bit in v2. Thanks, Stephan
diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index 1e47d27e1f81..4c3eb972039d 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -1272,7 +1272,15 @@ static int bam_dma_probe(struct platform_device *pdev) bdev->powered_remotely = of_property_read_bool(pdev->dev.of_node, "qcom,powered-remotely"); - if (bdev->controlled_remotely || bdev->powered_remotely) { + if (bdev->controlled_remotely || bdev->powered_remotely) + bdev->bamclk = devm_clk_get_optional(bdev->dev, "bam_clk"); + else + bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk"); + + if (IS_ERR(bdev->bamclk)) + return PTR_ERR(bdev->bamclk); + + if (!bdev->bamclk) { ret = of_property_read_u32(pdev->dev.of_node, "num-channels", &bdev->num_channels); if (ret) @@ -1284,14 +1292,6 @@ static int bam_dma_probe(struct platform_device *pdev) dev_err(bdev->dev, "num-ees unspecified in dt\n"); } - if (bdev->controlled_remotely || bdev->powered_remotely) - bdev->bamclk = devm_clk_get_optional(bdev->dev, "bam_clk"); - else - bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk"); - - if (IS_ERR(bdev->bamclk)) - return PTR_ERR(bdev->bamclk); - ret = clk_prepare_enable(bdev->bamclk); if (ret) { dev_err(bdev->dev, "failed to prepare/enable clock\n");