Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1755684rwd; Fri, 9 Jun 2023 01:26:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4S1VD/oi5iWNpqXYF0ZZxArJvwHAyV6BGkH6lXsYf/DmlyUsWFSRfs26cSOLz36lkfa4CB X-Received: by 2002:a05:6a20:432b:b0:100:efa1:eab0 with SMTP id h43-20020a056a20432b00b00100efa1eab0mr455299pzk.2.1686299211920; Fri, 09 Jun 2023 01:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686299211; cv=none; d=google.com; s=arc-20160816; b=WAP52khRj9u8tsrseGdKH9x9QX69gjoz1f016CVyKWDc0nfpDkANiAUqWsRB8t/fza hiIQCABIfpyV84DzFy1idNHQp2C6KPTzHtT9Gfa8zBt0bLIPBlIsc8K6coA/oHJ0kCQk O/VdWqdS8sJtpkgXVvVfdVzV/9INccpQJKcHM9fxc1ousBbSHmxErANYSyRE17n5h5mb AkAu/GN+5Lw9XjlCDHofJp/cUEwNfMaziDcX7w+5jMdkTZZfEn8rzI8lx4f+ozPXwqxL ned5YpoYw5ogn0vYqOeGneP3OSh26SVV/aOXgwiZRbgAXzqFTWPqXrMQJCsEWzA0YvEJ Z+KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=x8snxb+3C9fmkNIycrjOe2QGKhT9VxzlCpHRN3AtV6g=; b=GWwjk+VR3YgfMZhKa96nwmdGryYvoibzlvpQSZDSkZDd5yc5fn7XUwvFDuWR58QG6p YQXfkWPqbvRDRlkZGY/93WFSODB6qPsEy3pwZ7UmqBIWsTo7Jx2tAMzDd4OmZXfqeR0W 4HCmXr1N3i2cq+2leQsFW3gPaNGqwieqLY85MzjD53rWC2dDzclY1XUVGWZxPZ6Wa6AR K9WU2PIF+iMCkJZjK43xhwirttCxHnw9ePDKMEBNOGZ/jPDmfvS2QAXpvvDczNYRSlQ9 afl9dzjya69YzmfJqaTJqJDgtcTUFeMyqifbirRP8kWX/4A6AP4gw6p/Q3ziqDnA7BMF l3/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=YsfuWmYO; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a170902dac800b001afaa1f6a9fsi2378062plx.616.2023.06.09.01.26.37; Fri, 09 Jun 2023 01:26:51 -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=@bootlin.com header.s=gm1 header.b=YsfuWmYO; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240254AbjFIIRp (ORCPT + 99 others); Fri, 9 Jun 2023 04:17:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240165AbjFIIRf (ORCPT ); Fri, 9 Jun 2023 04:17:35 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EF1A35B6; Fri, 9 Jun 2023 01:16:59 -0700 (PDT) X-GND-Sasl: kory.maincent@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1686298617; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x8snxb+3C9fmkNIycrjOe2QGKhT9VxzlCpHRN3AtV6g=; b=YsfuWmYOXUDE83S/ScUKeT2bzH5eUfjurjL4aQoAj+pw1QQxrMPRhokkwln9xq6A2pFEY9 jzf9iXpyC/h1v/1Ny5ztGQ0Ma1RGWf9NBog3HQr3jckqC8IRKtyjs6S6zwZ1yLakYBwxyK v38XC6DPmcIkHw2e3fRmoYkHa3aKYpC86wI/Ka+FZAQEHXPyxFG5YLwAUoX1sbujXrSKZx BhogV3aG2InKR/F4mO1ZE4HGU4rDrTbGxAaaoTABRRfh6qJPS4Ze/DV14/utD+p3iFC2XA hUIP9Z9X08H9aMshuwbcgvzeAhLKuNa+q5C42FCau+uoNWE+Da1Hk2peEaT9iw== X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 0E0B3C0003; Fri, 9 Jun 2023 08:16:56 +0000 (UTC) From: =?UTF-8?q?K=C3=B6ry=20Maincent?= To: Cai Huoqing , Manivannan Sadhasivam , Serge Semin , Vinod Koul , Gustavo Pimentel , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Thomas Petazzoni , Gustavo Pimentel , Herve Codina , Kory Maincent Subject: [PATCH 1/9] dmaengine: dw-edma: Fix the ch_count hdma callback Date: Fri, 9 Jun 2023 10:16:46 +0200 Message-Id: <20230609081654.330857-2-kory.maincent@bootlin.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230609081654.330857-1-kory.maincent@bootlin.com> References: <20230609081654.330857-1-kory.maincent@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_NONE,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: X-Mailing-List: linux-kernel@vger.kernel.org From: Kory Maincent 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") Signed-off-by: Kory Maincent --- See the following thread mail that talk about this issue: https://lore.kernel.org/lkml/20230607095832.6d6b1a73@kmaincent-XPS-13-7390/ This patch is fixing a commit which is only in dmaengine tree and not merged mainline. --- drivers/dma/dw-edma/dw-hdma-v0-core.c | 13 +------------ 1 file changed, 1 insertion(+), 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..de87ce6b8585 100644 --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c @@ -65,18 +65,7 @@ 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; + return HDMA_V0_MAX_NR_CH; } static enum dma_status dw_hdma_v0_core_ch_status(struct dw_edma_chan *chan) -- 2.25.1