Message ID | 20231117-b4-feature_hdma_mainline-v6-1-ebf7aa0e40d7@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp419528vqn; Fri, 17 Nov 2023 02:04:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8nm/ExZnvCX/F44oj4b2DeJJWOCwaUq9g7UqC1AlePZRW7NbHBKf7RFpvdikcDanC4gkO X-Received: by 2002:a17:90b:3850:b0:27d:12e1:94e0 with SMTP id nl16-20020a17090b385000b0027d12e194e0mr15355548pjb.36.1700215466829; Fri, 17 Nov 2023 02:04:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700215466; cv=none; d=google.com; s=arc-20160816; b=uxotyDYauZGxx+O1GSy2QZlpMtqjbEFMSzNDzPjvhc6XBtjjglaDVlKGbQPiOuqzor Fhq1rYN7le7jXx6LFBz0l9uBO5xTWra1tvu0z7GOF0T99KshJLXPBZ8nkQKU8VdBnBPc XchGKouDJ6yPek86xM4cl0JRdW8nWOHhg/3lhagDS9KW1hma1/3AaEn6J/Owo2jmo/m7 j52LLvCfaGM/YXvaqStJXgLR07g/tzAIOr4/egoxS8ryL+0BaYTHAut05Oj46FuA5FJo zMK+oskCkZRqjtPANQy1cfHvHZj3oM9poUMJVAHpvpG0xrbc2ob9bsi/7aJvy6vza2CO cl3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=MG/EpR8bVcQceln2f1UmgAvAjO7ip8LLXAJEWchyMuQ=; fh=Fko32OqwGgI5WpcqYpp5KigXgtelsKMiigtnZERCGL8=; b=0iBFxDrppTLNH3muAGodqMV/uwJYN8zilgaJHpx4Xe0vX5GlaCpTK/QKuKGEIsayJz pKMIIvBB5cO0LTJwD1+K1KKFtoVsiWVd4yQP4C5+i0qAsns6wBO1Kj4NIzzXV0mRJY9J kFGyim/reKODo7Zw07Ows7zp4nbTD6GZa/jJNeSQ1+wuCaPNzPGoj7mVQjL1ZGyJ43T/ G9rucor8yHz/FxjAymVF/hkR4EtRUxXS4skeKTrUqWT2aNke55Y8/gtJXYftFdIkcC+W qLUgONXL8HqNEDz4hx51hB3SBdQRy3q2XQHpXZzEK8y9dGLjUzA/kCw01aJ+oqvuxgrf rHoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=p3UZahcB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id h24-20020a17090ac39800b0027ce5205f94si1573978pjt.150.2023.11.17.02.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 02:04:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=p3UZahcB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3007980BC502; Fri, 17 Nov 2023 02:04:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345827AbjKQKER (ORCPT <rfc822;jaysivo@gmail.com> + 30 others); Fri, 17 Nov 2023 05:04:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230383AbjKQKEM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 17 Nov 2023 05:04:12 -0500 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 188ECA9; Fri, 17 Nov 2023 02:04:07 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2DD6EFF81D; Fri, 17 Nov 2023 10:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700215446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MG/EpR8bVcQceln2f1UmgAvAjO7ip8LLXAJEWchyMuQ=; b=p3UZahcB5fPC27GIKBJabXO5yGHhpl+kOie0qlM7j1CpkzJyrQcOTgUyIeLo+dxwDCc8LJ wcIFqOwpqlsYXCZyC3le3j3IOn3+s3fBImDVtTnQ41iadU/8lxdtZZg4CnP8Mlg/8xvzIV gm9Ay9vzq98L1n6juEMCyLaOuGAe6XrCsCJ+b3llcTKwoyvmoeFRxxSQOZ/MoT8f3dtPVR 3zv1QPyoW0I/ySSr1IdJsaah5IkVDd5upVx/KnT7jijLnsi5M917oLCG8nefH7qc/R+JBt eWxxxA2FMtg4ejttruB5ZA8bpXRBqe4TgSxsKmm9N6PCNLxgQsvBQ11F6j7Ekw== From: Kory Maincent <kory.maincent@bootlin.com> Date: Fri, 17 Nov 2023 11:03:49 +0100 Subject: [PATCH v6 1/6] dmaengine: dw-edma: Fix the ch_count hdma callback MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231117-b4-feature_hdma_mainline-v6-1-ebf7aa0e40d7@bootlin.com> References: <20231117-b4-feature_hdma_mainline-v6-0-ebf7aa0e40d7@bootlin.com> In-Reply-To: <20231117-b4-feature_hdma_mainline-v6-0-ebf7aa0e40d7@bootlin.com> To: Manivannan Sadhasivam <mani@kernel.org>, Gustavo Pimentel <gustavo.pimentel@synopsys.com>, Serge Semin <fancer.lancer@gmail.com>, Vinod Koul <vkoul@kernel.org>, Cai Huoqing <cai.huoqing@linux.dev> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Herve Codina <herve.codina@bootlin.com>, Kory Maincent <kory.maincent@bootlin.com>, Manivannan Sadhasivam <mani@kernel.org> X-Mailer: b4 0.12.4 X-GND-Sasl: kory.maincent@bootlin.com X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 17 Nov 2023 02:04:25 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782805133428019523 X-GMAIL-MSGID: 1782805133428019523 |
Series |
Fix support of dw-edma HDMA NATIVE IP in remote setup
|
|
Commit Message
Köry Maincent
Nov. 17, 2023, 10:03 a.m. UTC
The current check of ch_en enabled to know the maximum number of available hardware channels is wrong as it check the number of ch_en register set but all of them are unset at probe. This register is set at the dw_hdma_v0_core_start function which is run lately before a DMA transfer. The HDMA IP have no way to know the number of hardware channels available like the eDMA IP, then let set it to maximum channels and let the platform set the right number of channels. Fixes: e74c39573d35 ("dmaengine: dw-edma: Add support for native HDMA") Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by: Serge Semin <fancer.lancer@gmail.com> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> --- See the following thread mail that talk about this issue: https://lore.kernel.org/lkml/20230607095832.6d6b1a73@kmaincent-XPS-13-7390/ Changes in v2: - Add comment Changes in v3: - Fix comment style. --- drivers/dma/dw-edma/dw-hdma-v0-core.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw-hdma-v0-core.c index 00b735a0202a..1f4cb7db5475 100644 --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c @@ -65,18 +65,12 @@ static void dw_hdma_v0_core_off(struct dw_edma *dw) static u16 dw_hdma_v0_core_ch_count(struct dw_edma *dw, enum dw_edma_dir dir) { - u32 num_ch = 0; - int id; - - for (id = 0; id < HDMA_V0_MAX_NR_CH; id++) { - if (GET_CH_32(dw, id, dir, ch_en) & BIT(0)) - num_ch++; - } - - if (num_ch > HDMA_V0_MAX_NR_CH) - num_ch = HDMA_V0_MAX_NR_CH; - - return (u16)num_ch; + /* + * The HDMA IP have no way to know the number of hardware channels + * available, we set it to maximum channels and let the platform + * set the right number of channels. + */ + return HDMA_V0_MAX_NR_CH; } static enum dma_status dw_hdma_v0_core_ch_status(struct dw_edma_chan *chan)