Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp689979rwd; Wed, 7 Jun 2023 05:47:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4SF3GRfAHerAKrfURACJF4MrNgJyGHI+cfimTHP3t6r3yEJ6t8ph/Q8CmiWGZX8ob4c+ty X-Received: by 2002:a05:6a20:431e:b0:100:c3fe:a653 with SMTP id h30-20020a056a20431e00b00100c3fea653mr3402575pzk.29.1686142061594; Wed, 07 Jun 2023 05:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686142061; cv=none; d=google.com; s=arc-20160816; b=XP1iNRgjS0/ZfA6u/LX+thIsZy2i513OP0KlzfA7fVSbWuliXg0hVBTkEFTeu/Non3 AJ/aFiFdWyViQm5d4OvfKcjwtT4B2IXVdDVEdLrRGn34jnIW+1XOLtj8uv3QaOek/Fyn vyNWpRGuX8VqeydYKxFTeElxWTsD/rmKrvNB0lxkrGi+yljv9KwZ1DFIduJjnCUp/NnG yJin2hmZ/kpKSUYxcA5Ksm+5wstoYN/SJIuRA83lAR1z0f7RFEVK/VSlJa8S8nNncz+l c18rnTbWc2GF7UQLcJN5eVUQKHdKGXSeOo9xJOeelzLKJlgonPIhRbVsXAKD4b6j3nJw SXQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=VbSUneRrpRRxgvHrGM+5p7hzn6yFPde2yVURyvjw+yM=; b=fSQbQx81IkryECb0Wi/35v4kUhiMZsfp0cT4Dx2H4+bMvvwBk1PBpjlmQEyl6fMKV9 eT0Aq7m8gdu7MlTD86bOgVVP7VWlfLjxMsyrvKSvimW1v1E5XPVhjBsLgZ2+tTaCBACw gibVQiSrBNTcyBQ36IyEqf7r2eQLYkRl6KS6p/LMw28qRsfReeYJwXkZjL0mwnK6EvIo Znsl5IxIUgIvS2W+12N5e9wL8m7X7fEbVP6+Pk0SmmrnxFBbyjuIhblgFZ1iWgUpN/6S E9i0ouj0PYJ2FrrorQbORaq5DW7Nsa+Sk6eVoYZPm4XNoAepNxnuJFMszWhMfKnz2oQ7 NNzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=gpwpYYtQ; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v128-20020a626186000000b0064d32440768si7335864pfb.138.2023.06.07.05.47.27; Wed, 07 Jun 2023 05:47:41 -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=@linux.dev header.s=key1 header.b=gpwpYYtQ; 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=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241027AbjFGMil (ORCPT + 99 others); Wed, 7 Jun 2023 08:38:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241031AbjFGMiV (ORCPT ); Wed, 7 Jun 2023 08:38:21 -0400 Received: from out-9.mta0.migadu.com (out-9.mta0.migadu.com [IPv6:2001:41d0:1004:224b::9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00C292107 for ; Wed, 7 Jun 2023 05:37:42 -0700 (PDT) Date: Wed, 7 Jun 2023 20:37:34 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1686141460; 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=VbSUneRrpRRxgvHrGM+5p7hzn6yFPde2yVURyvjw+yM=; b=gpwpYYtQYX4mfxfajxMwBtmUfqXQinKqcnf4WX92FlEVVz/4anG+rYBf5QiI4T5lmblvd0 Qc/KHUvmIPJMrF9+bUYvFZF+dV+T7GnsiUwN50df1B/FgxeWv/2vF+YyB0wCNmEVauwHst 4WqvCzCzG2nzUw9IxEZEzkBl/3P/7M0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Cai Huoqing To: =?utf-8?B?S8O2cnk=?= Maincent Cc: vkoul@kernel.org, Serge Semin , Manivannan Sadhasivam , Manivannan Sadhasivam , Gustavo Pimentel , Jingoo Han , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-pci@vger.kernel.org, Thomas Petazzoni Subject: Re: [PATCH v11 3/4] dmaengine: dw-edma: Add support for native HDMA Message-ID: References: <20230520050854.73160-1-cai.huoqing@linux.dev> <20230520050854.73160-4-cai.huoqing@linux.dev> <20230607095832.6d6b1a73@kmaincent-XPS-13-7390> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230607095832.6d6b1a73@kmaincent-XPS-13-7390> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 On 07 6月 23 09:58:32, Köry Maincent wrote: > On Sat, 20 May 2023 13:08:51 +0800 > Cai Huoqing wrote: > > > Add support for HDMA NATIVE, as long the IP design has set > > the compatible register map parameter-HDMA_NATIVE, > > which allows compatibility for native HDMA register configuration. > > I know the patch has been merged in dmaengine tree but something seems weird on > my side. > > The akida_dw_edma_probe function is selecting the minimum read and write > channels by doing the minimum between ll_wr_cnt and the ch_count callback. > The hdma ch_count callback is counting the number of channels enabled by reading > the number of ch_en registers set. At probe time there is no channels registers > that has been set as it is done later in the dw_hdma_v0_core_start function. > Then the dw_hdma_v0_core_ch_count will always return 0 at probe time and the > number of channels will be set to 0 which is not what we want. will check it Thanks, Cai- > Could I miss something? > > See the functions bellow: > > > int akida_dw_edma_probe(struct dw_edma_chip *chip) > > { > ... > > dw->wr_ch_cnt = min_t(u16, chip->ll_wr_cnt, > > dw_edma_core_ch_count(dw, EDMA_DIR_WRITE)); > > dw->wr_ch_cnt = min_t(u16, dw->wr_ch_cnt, EDMA_MAX_WR_CH); > > > > dw->rd_ch_cnt = min_t(u16, chip->ll_rd_cnt, > > dw_edma_core_ch_count(dw, EDMA_DIR_READ)); > > dw->rd_ch_cnt = min_t(u16, dw->rd_ch_cnt, EDMA_MAX_RD_CH); > > > > if (!dw->wr_ch_cnt && !dw->rd_ch_cnt) > > return -EINVAL; > ... > } > > > > +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; > > +} > > > > > +static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first) > > +{ > > + struct dw_edma_chan *chan = chunk->chan; > > + struct dw_edma *dw = chan->dw; > > + u32 tmp; > > + > > + dw_hdma_v0_core_write_chunk(chunk); > > + > > + if (first) { > > + /* Enable engine */ > > + SET_CH_32(dw, chan->dir, chan->id, ch_en, BIT(0)); > ... > > +} >