Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp895351rwe; Wed, 24 Aug 2022 10:47:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR4r9vHoOETvTQBWviXnxf2FK9d1YlWc0moke2vD6JSMumruuZ0rpS7lxnNaAYFEdXxE35R2 X-Received: by 2002:a05:6402:d05:b0:425:b5c8:faeb with SMTP id eb5-20020a0564020d0500b00425b5c8faebmr116687edb.273.1661363254195; Wed, 24 Aug 2022 10:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661363254; cv=none; d=google.com; s=arc-20160816; b=Xs1FV2jHthneTWjSYoJafaK6KCVcmybfw5h2nu9CPgT9bNZxgRKvXUqILpyJ/vnH42 dyKSMzEAuHSm1xTBtFvbJa4ELpDLJyqeaG1URzav9Dby50wKQ0wsi7wALmZsHo6NR65Z qnh9zdqZwxtBxNnp8fu/Qh67cncOVb5KeVvlJnT3uPmP39Kczm0kkDh8osNA4QhotJZ/ 4zDjSwhkDXSKOd9kceU5M5sDEzKhwgKWmrAzrgsJMdYLwPJSQxGjTTz9Xnc6ozquIEPZ jucVs5hz2yTNib3kgtQxs3zkd+CQOYj6ik0Frw1RW9jDCg/xArZS2MS8K3ajGfzjMxDC ZV7Q== 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-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=4M1dZ9W6qnWpK/gLRjH6ZwgnZOcNYlmSqVmD0aGErYw=; b=zqWiVW8OylCrKFdtBaZAQETCV8sHWzX7PsD5dyOCmuo8FVyM2eVINVH3MMYGgoQpcw dfTYZ3ICm/HSxwPbHyfoYxY1OHTJ+guHscyMHQlIl7h6EEP0vGN9l5XZl/hMbM7znwUW OeJB8BC2Nq0vTh2w0rXAtVSPIehC9uni8ZBkwly9fck6HydZwq577bVUdLNvrgtKM0Zq 3Vd08qEaDOyg/lURifUgk2geL6Nv+x09DnJcEk0aPBwZB8psaBAZxoG6lqEJMOA+oFJn Z4x94zIzIA0+EFRnj/UWX2nNldbd9u8qKE/NZQ5DyFg057co20xMl5sULK3vPIUaAeIK eNFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XLxhRwee; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v14-20020a50d08e000000b00443e3fe60a0si4012484edd.622.2022.08.24.10.47.08; Wed, 24 Aug 2022 10:47:34 -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=@kernel.org header.s=k20201202 header.b=XLxhRwee; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237976AbiHXQvf (ORCPT + 99 others); Wed, 24 Aug 2022 12:51:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238223AbiHXQvW (ORCPT ); Wed, 24 Aug 2022 12:51:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47F475A80E; Wed, 24 Aug 2022 09:51:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6EEB61A34; Wed, 24 Aug 2022 16:51:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00FCFC433D6; Wed, 24 Aug 2022 16:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661359880; bh=cGAkc/rrARLF7e7NN9ARyeNoGB0+TSPpMWsWHg5rdfM=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=XLxhRweehd12ykVqcG+n39k19vj8yTvdFthMnpD1PkSFPIUVEHIpad5L6dhkUrhHt eevbhB7j8o/zO19pa8RrDcfBI1ZH0rhCJeDsqqRpv1hqAVr5FqxV01iz9AVKVB3L/8 NsVzAI1cCbvTeasbeeGA0XdLguCDTuKOYSR5uxxhV/NliMS/LMWHV4owCd7uGKcLa3 p6tFtsnLOxeRAFihWe4iHP8IN1h5AR9j8vKNvvYtl+4iz6sr8xoX9JmbnAooCTGQw1 jsnjWcjW+Ne+hEu8d7ZNdYcQVL/xeDcVUVxtAo4sOenWWq2LLtny2/g7WzH743OGqe 5Ib1hR3TRE5Aw== Date: Wed, 24 Aug 2022 11:51:18 -0500 From: Bjorn Helgaas To: Serge Semin Cc: Gustavo Pimentel , Vinod Koul , Rob Herring , Bjorn Helgaas , Lorenzo Pieralisi , Jingoo Han , Frank Li , Manivannan Sadhasivam , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Serge Semin , Alexey Malahov , Pavel Parkhomenko , linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RESEND v5 24/24] PCI: dwc: Add DW eDMA engine support Message-ID: <20220824165118.GA2785269@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220822185332.26149-25-Sergey.Semin@baikalelectronics.ru> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 22, 2022 at 09:53:32PM +0300, Serge Semin wrote: > Since the DW eDMA driver now supports eDMA controllers embedded into the > locally accessible DW PCIe Root Ports and Endpoints, we can use the > updated interface to register DW eDMA as DMA engine device if it's > available. In order to successfully do that the DW PCIe core driver need > to perform some preparations first. First of all it needs to find out the > eDMA controller CSRs base address, whether they are accessible over the > Port Logic or iATU unrolled space. Afterwards it can try to auto-detect > the eDMA controller availability and number of it's read/write channels. s/it's// > If none was found the procedure will just silently halt with no error > returned. Secondly the platform is supposed to provide either combined or > per-channel IRQ signals. If no valid IRQs set is found the procedure will > also halt with no error returned so to be backward compatible with the > platforms where DW PCIe controllers have eDMA embedded but lack of the > IRQs defined for them. Finally before actually probing the eDMA device we > need to allocate LLP items buffers. After that the DW eDMA can be > registered. If registration is successful the info-message regarding the > number of detected Read/Write eDMA channels will be printed to the system > log in the similar way as it's done for the iATU settings. s/in the similar way as it's done/as is done/ > +static int dw_pcie_edma_find_chip(struct dw_pcie *pci) > +{ > + u32 val; > + > + val = dw_pcie_readl_dbi(pci, PCIE_DMA_VIEWPORT_BASE + PCIE_DMA_CTRL); > + if (val == 0xFFFFFFFF && pci->edma.reg_base) { > + pci->edma.mf = EDMA_MF_EDMA_UNROLL; > + > + val = dw_pcie_readl_dma(pci, PCIE_DMA_CTRL); > + } else if (val != 0xFFFFFFFF) { Consider PCI_POSSIBLE_ERROR() as an annotation about the meaning of 0xFFFFFFFF and something to grep for. > + pci->edma.mf = EDMA_MF_EDMA_LEGACY; > + > + pci->edma.reg_base = pci->dbi_base + PCIE_DMA_VIEWPORT_BASE; > + } else { > + return -ENODEV; > + } > + * eDMA CSRs. DW PCIe IP-core v4.70a and older had the eDMA registers accessible > + * over the Port Logic registers space. Afterwords the unrolled mapping was s/Afterwords/Afterwards/ > + * introduced so eDMA and iATU could be accessed via a dedicated registers > + * space.