Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1686711rdb; Tue, 20 Feb 2024 04:12:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXOGLg950rJdTOnfXbzF3oOtzVmfBvPrdplL+WD6wb4YyYYA86LwhEPT476PcpK1j+pT14kDXcJmiNdm0cuXBmSCwqVszj/t4I6TgRDoA== X-Google-Smtp-Source: AGHT+IFaxLQIhQMYLJTS3WD0ONkS3Ajec9EaJ2q4HuRplsFSNcNg3uTw2jUVY3TBUtxHKqZbeyFr X-Received: by 2002:a17:90b:1957:b0:299:3b7a:24ba with SMTP id nk23-20020a17090b195700b002993b7a24bamr7698873pjb.47.1708431131005; Tue, 20 Feb 2024 04:12:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708431130; cv=pass; d=google.com; s=arc-20160816; b=YMMVDlIIzVIyaLQd1uAZ3rip5lEh7hxKgdgf9I+fXcd5NGpL7LSMUYpNPrWJrN3cQL RUZr4mSW4dkY9Spjw8bNnsjMK7l11k+xI7mhfXPUvl4E4yW2nR0gauc46NTjjUHYCRKj nN9LeTxnWgT3aeEB9u5oSxzW67jDxi7hdhspxNvBr4dwlpJaEcxhbsQDV1ZqDzega0Vr 2FKBLcJivoOfty796Qk6+peJgqdKS3W5GxjKbT2wsRrB9QV4X8qYrTY6MA3khlZ/uEac qcrPL4pFh48wYRvCzkNipu0fHfxAPnSWsYFtkVsYQlpg6GiyFZmtHO7hkv0ZN4R2vC4b qDEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=A1Wnhtv/mj8FTbw6kpoNXtyq830Vf6qti0CsRifKZCM=; fh=83KLdB8erCI9iH5W+nzbdFVAV5008SJOKhAMYJM3aPk=; b=Gbugj9sBXBD8CmtL6JyrkBBN8TOjI29agHqzhqQZPCw6J1iT2tiVX/RQbCmfJ1yQ8m 8HYsmZJQOrjuP6olh5GF1GDAzuio3TxPfWA+oBUvU9kTTtIBpp3ZkbSMGMaQ7nd9q/OO RZU5ZzONjNjSrlt7Gn/KESYhHBRMeGsLlGx6Qc/Zt+ViHmSDKedSttaSSXYIZ2GwOWbH Jys1/RQbQFdzweRZIHgeRm8y0Jkv3zpCipKGiDOteYDsGl3D0r2R9p2mqLsPSQQJhF2y 8Ke8fnFvqep3xOWZd36ow4X4MVreqcLxIMQ/8++0WxxWfHGCRgBDiHdDp/r8QFc89QZd aouA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Tgk4Nf+y; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-72987-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72987-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w89-20020a17090a6be200b00298cdde79dbsi6097726pjj.154.2024.02.20.04.12.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 04:12:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72987-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Tgk4Nf+y; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-72987-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72987-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B38E9281D52 for ; Tue, 20 Feb 2024 12:12:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 12D2467E65; Tue, 20 Feb 2024 12:12:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="Tgk4Nf+y" Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 678EB67C6A; Tue, 20 Feb 2024 12:12:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.142 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708431122; cv=none; b=kJfv2WiZcZ0pm1ENuluuMD8krDZlNOT5lmLjvubcVqVf0IbE/wjFUP27slH3cVO8zxLkIu5+tDrW69yUEwrAG29NI2iTzZrUxlNEed+aAnI8WKCcrPKx9VId0M9d+j9AuLTNRDriSeUlP8B0HSQs/6XPDJuTcWMhEhXjSew7R1I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708431122; c=relaxed/simple; bh=VQwdwkiqF7atE4ZGt/XQ1+JYNrmZCk8qg42wHIdGyEA=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IYws9AJl6aVz+hTeDfH268mtaPG1iyin241lnYsTGoZkjniqOpvtC9YdynF0X1wfoBCErE0rznHGIoqNg1Z8bEpvebBz1yki6aNM83Y0S3/MBQmIWU9IS57OgLAs7zXbosyB+TyY6hULXlVSKX2C0FbrIV0r/pwcWDQSR+vWTt4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=Tgk4Nf+y; arc=none smtp.client-ip=198.47.19.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41KCBgP8088721; Tue, 20 Feb 2024 06:11:42 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1708431102; bh=A1Wnhtv/mj8FTbw6kpoNXtyq830Vf6qti0CsRifKZCM=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=Tgk4Nf+ywcowy+vjLIs8yyUUYlDeNgBzmIYjyHODprN4yxMW60DRZUpYZTAVszA4x ySv6zp5dWUNYFpAYafdIHIYKOm+55czngq/QDKqmW0DQq1JPbKG0vHUhoPEMG19eLo AZJXSBuBDNleq526lvOXsStT7ThwdQn1oDZqcpRw= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41KCBgDI005500 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 20 Feb 2024 06:11:42 -0600 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 20 Feb 2024 06:11:42 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 20 Feb 2024 06:11:42 -0600 Received: from localhost (uda0492258.dhcp.ti.com [172.24.227.9]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 41KCBfOj072811; Tue, 20 Feb 2024 06:11:42 -0600 Date: Tue, 20 Feb 2024 17:41:41 +0530 From: Siddharth Vadapalli To: Manivannan Sadhasivam CC: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Marek Vasut , Yoshihiro Shimoda , Kishon Vijay Abraham I , Serge Semin , , , , , , Subject: Re: [PATCH v2 1/5] PCI: dwc: Refactor dw_pcie_edma_find_chip() API Message-ID: <70a2f29f-301d-40c6-bc37-abab35286caa@ti.com> References: <20240216-dw-hdma-v2-0-b42329003f43@linaro.org> <20240216-dw-hdma-v2-1-b42329003f43@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20240216-dw-hdma-v2-1-b42329003f43@linaro.org> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 On 24/02/16 11:04PM, Manivannan Sadhasivam wrote: > In order to add support for Hyper DMA (HDMA), let's refactor the existing > dw_pcie_edma_find_chip() API by moving the common code to separate > functions. > > No functional change. > > Suggested-by: Serge Semin > Signed-off-by: Manivannan Sadhasivam > --- > drivers/pci/controller/dwc/pcie-designware.c | 40 +++++++++++++++++++++++----- > 1 file changed, 33 insertions(+), 7 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c > index 250cf7f40b85..3a26dfc5368f 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.c > +++ b/drivers/pci/controller/dwc/pcie-designware.c > @@ -880,7 +880,17 @@ static struct dw_edma_plat_ops dw_pcie_edma_ops = { > .irq_vector = dw_pcie_edma_irq_vector, > }; > > -static int dw_pcie_edma_find_chip(struct dw_pcie *pci) > +static void dw_pcie_edma_init_data(struct dw_pcie *pci) > +{ > + pci->edma.dev = pci->dev; > + > + if (!pci->edma.ops) > + pci->edma.ops = &dw_pcie_edma_ops; > + > + pci->edma.flags |= DW_EDMA_CHIP_LOCAL; > +} > + > +static int dw_pcie_edma_find_mf(struct dw_pcie *pci) > { > u32 val; > > @@ -902,8 +912,6 @@ static int dw_pcie_edma_find_chip(struct dw_pcie *pci) > > 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) { > pci->edma.mf = EDMA_MF_EDMA_LEGACY; Minor suggestion: The above section prior to this patch was: 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) { pci->edma.mf = EDMA_MF_EDMA_LEGACY; pci->edma.reg_base = pci->dbi_base + PCIE_DMA_VIEWPORT_BASE; } else { return -ENODEV; } And this patch is removing the call to dw_pcie_readl_dma() in the "if" condition above. So the curly braces after this patch will only be present because of the "else if" statement. So is the following change a good idea? /* Assume it is EDMA_LEGACY by default but update it later if needed */ pci->edma.mf = EDMA_MF_EDMA_LEGACY; if (val == 0xFFFFFFFF && pci->edma.reg_base) pci->edma.mf = EDMA_MF_EDMA_UNROLL; else if (val != 0xFFFFFFFF) pci->edma.reg_base = pci->dbi_base + PCIE_DMA_VIEWPORT_BASE; else return -ENODEV; Regards, Siddharth.