Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp137751lqc; Thu, 7 Mar 2024 12:38:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW9ThYayXAJse9CCDKy1SVCv0dI9XoEBBhFqOZmlwEhCptyjquNheJOzDci98DJX/qFAxuyLSG8GXoAB5DrUbEQCxVdAuTGiZPbd9r22w== X-Google-Smtp-Source: AGHT+IER9kGGVgfjmJ9LeHp9IV+99KW1VBnezcTe0aYbsbOEO7mx4BK8SQFNt/50N5HMNO0m08to X-Received: by 2002:a17:903:22cf:b0:1db:9ff1:b59b with SMTP id y15-20020a17090322cf00b001db9ff1b59bmr3511681plg.23.1709843903801; Thu, 07 Mar 2024 12:38:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709843903; cv=pass; d=google.com; s=arc-20160816; b=QVLdKvTtCcyTHzcd+c7oAIAatb7nWQNf9JnadoW9JWow2tH7wbiuahVacltPa3FegI HybLJdznmrsLpM4081dBRejMiiSToDKUJSKBSPTksRHzsGwtEGfNUWYB/rcoTzb0El1B FG/NV/SnM/mwU7E7Ghsnea6iikT0+6yUnE2pY8r4NRkRNY1J4Y7JsVK4xtWMIGpICgAE UkQMjK78vNe7fxU5wSm/PAmnLLQM3tJrjh4+H1gL2lk/LOg/U3Hi2NOGIPyCyCurL6nt fShAMEj4UiwaenfTontY7w0VMue6FNmcGBhXpKSoHKYb+9car8JPP2N/oq+mLwUindnd Op1A== 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=mvkVP0xmp/bv3MCLP1rwgrN9UNGIX624VCt4wn46zQs=; fh=XkHq6sufsH3TObsvDFtbbMUFfmZcw+V2/ZGOtqSIh/c=; b=jAoFnbYXxebn42KG4ky4GQLqBRPunLB/lGI8sBjjt4hm8mnsciU4un8s5K4zqp1YgZ 0nTTvuxcm9Jjp3rTy+9S9FL/rAyBjUC1UGXkdgTAuF1UxqaDlfPto29ajdAdN5USm+lM 29OniP9lComVtdWw3F7PqidHsiBahSoU6MioFZEQaC1rxERu/SfH117ZQQ5if5CJOLHy 5F0uqIWSDm4+4x31mK795AM8Zqua8ZH85/1vRak3hzjg8zy/82JR98o2qsfvQWsOP2mA 6BzwPmJ5gyLcQgVwIH9CjSgLgouHsD0812eA3uwXodd2dJMikxheJQPlrXKeYWd1o5fe Vwug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZH712JAe; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-96206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n4-20020a170902d2c400b001dcb17a9ef9si5186076plc.208.2024.03.07.12.38.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 12:38:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96206-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=@kernel.org header.s=k20201202 header.b=ZH712JAe; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-96206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 6A95E28295C for ; Thu, 7 Mar 2024 20:37:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F15E41386B8; Thu, 7 Mar 2024 20:37:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZH712JAe" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D64281E865; Thu, 7 Mar 2024 20:37:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709843828; cv=none; b=eyoKX1RcufEMiP/EljlETKGKeTbdVLuPWoyjgX9r48oXduE+3x5K/BvXg/ZcEMeNRS901Ma/PH/ZQErWZckc9n8fcLeH+1HhFaEuhCglVbzTK9ckhmlF/S/Fjk2AijpVemfzaOLoNlIrqt4FJVV6jwEMfpDmmsaPvias7GMUZeA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709843828; c=relaxed/simple; bh=eGOAWjsud1Ck55pN1j35rMAJfavIagxkoPDo64qggSI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QcEBRoMSBiWf0gKScrvYEzBWXy1g9JU9TdzzWHPaGDqIVEWX00FAq+jvYfZ90AXd5LyWGCsKb2bpF8lL4D3Y8U4MjDla4HoI5yY/xj2MNTIAExH+iQwcoW03gro7Bz4pp8Ucmjn+gKmFex1EC26QTZXjB+2owg8U1VJ0YFIhY9Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZH712JAe; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3FCEC43399; Thu, 7 Mar 2024 20:36:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709843827; bh=eGOAWjsud1Ck55pN1j35rMAJfavIagxkoPDo64qggSI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZH712JAesiA+VYRacjgjemvYuwNC+u2uBeBcbpeuc4RDzFUcSpwBReDql9vSCIg6d F93jh07hklNqj8HKW/f5tnNUFOiEOiJ/tjtfy9Tc/Jrw1hNHT6lF/+Qz8pkj9yoQ8y +VtpiY/Yqxlrgz22AK+AXoXf8eI8bexciwarO3P1BFhzEOdWvA7fQ6eek7GRC9soYk oL8S1zToSuXAd//ke4hVGX1dVjhSu+c6TgIhTuFy1FI9xpJGJ+iKB6Ljmnc+QfevSC pRKNjOCUkQmB51EtN7aQQYHMVP7F4yYBqYg+jVI86Rb2bJrAmukaFXBeAhGileYxkF Jx7SWbo+p/8Ow== Date: Thu, 7 Mar 2024 21:36:56 +0100 From: Niklas Cassel 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 , Thierry Reding , Jonathan Hunter , Kishon Vijay Abraham I , Vidya Sagar , Vignesh Raghavendra , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Minghuan Lian , Mingkai Hu , Roy Zang , Kunihiko Hayashi , Masami Hiramatsu , Kishon Vijay Abraham I , Jesper Nilsson , Srikanth Thokala , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@axis.com Subject: Re: [PATCH v9 06/10] PCI: dwc: ep: Call dw_pcie_ep_init_registers() API directly from all glue drivers Message-ID: References: <20240304-pci-dbi-rework-v9-0-29d433d99cda@linaro.org> <20240304-pci-dbi-rework-v9-6-29d433d99cda@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: <20240304-pci-dbi-rework-v9-6-29d433d99cda@linaro.org> On Mon, Mar 04, 2024 at 02:52:18PM +0530, Manivannan Sadhasivam wrote: > Currently, dw_pcie_ep_init_registers() API is directly called by the glue > drivers requiring active refclk from host. But for the other drivers, it is > getting called implicitly by dw_pcie_ep_init(). This is due to the fact > that this API initializes DWC EP specific registers and that requires an > active refclk (either from host or generated locally by endpoint itsef). > > But, this causes a discrepancy among the glue drivers. So to avoid this > confusion, let's call this API directly from all glue drivers irrespective > of refclk dependency. Only difference here is that the drivers requiring > refclk from host will call this API only after the refclk is received and > other drivers without refclk dependency will call this API right after > dw_pcie_ep_init(). > > With this change, the check for 'core_init_notifier' flag can now be > dropped from dw_pcie_ep_init() API. This will also allow us to remove the > 'core_init_notifier' flag completely in the later commits. > > Signed-off-by: Manivannan Sadhasivam > --- > drivers/pci/controller/dwc/pci-dra7xx.c | 7 +++++++ > drivers/pci/controller/dwc/pci-imx6.c | 8 ++++++++ > drivers/pci/controller/dwc/pci-keystone.c | 9 +++++++++ > drivers/pci/controller/dwc/pci-layerscape-ep.c | 7 +++++++ > drivers/pci/controller/dwc/pcie-artpec6.c | 13 ++++++++++++- > drivers/pci/controller/dwc/pcie-designware-ep.c | 22 ---------------------- > drivers/pci/controller/dwc/pcie-designware-plat.c | 9 +++++++++ > drivers/pci/controller/dwc/pcie-keembay.c | 16 +++++++++++++++- > drivers/pci/controller/dwc/pcie-rcar-gen4.c | 12 +++++++++++- > drivers/pci/controller/dwc/pcie-uniphier-ep.c | 13 ++++++++++++- > 10 files changed, 90 insertions(+), 26 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c > index 0e406677060d..395042b29ffc 100644 > --- a/drivers/pci/controller/dwc/pci-dra7xx.c > +++ b/drivers/pci/controller/dwc/pci-dra7xx.c > @@ -467,6 +467,13 @@ static int dra7xx_add_pcie_ep(struct dra7xx_pcie *dra7xx, > return ret; > } > > + ret = dw_pcie_ep_init_registers(ep); > + if (ret) { Here you are using if (ret) to error check the return from dw_pcie_ep_init_registers(). > index c0c62533a3f1..8392894ed286 100644 > --- a/drivers/pci/controller/dwc/pci-keystone.c > +++ b/drivers/pci/controller/dwc/pci-keystone.c > @@ -1286,6 +1286,13 @@ static int ks_pcie_probe(struct platform_device *pdev) > ret = dw_pcie_ep_init(&pci->ep); > if (ret < 0) > goto err_get_sync; > + > + ret = dw_pcie_ep_init_registers(&pci->ep); > + if (ret < 0) { Here you are using if (ret < 0) to error check the return from dw_pcie_ep_init_registers(). Please be consistent. > diff --git a/drivers/pci/controller/dwc/pcie-artpec6.c b/drivers/pci/controller/dwc/pcie-artpec6.c > index 9ed0a9ba7619..0edd9ab3f139 100644 > --- a/drivers/pci/controller/dwc/pcie-artpec6.c > +++ b/drivers/pci/controller/dwc/pcie-artpec6.c > @@ -441,7 +441,18 @@ static int artpec6_pcie_probe(struct platform_device *pdev) > > pci->ep.ops = &pcie_ep_ops; > > - return dw_pcie_ep_init(&pci->ep); > + ret = dw_pcie_ep_init(&pci->ep); > + if (ret < 0) Here you are using if (ret < 0) to error check the return from dw_pcie_ep_init(). > index 778588b4be70..ca9b22e654cd 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-plat.c > +++ b/drivers/pci/controller/dwc/pcie-designware-plat.c > @@ -145,6 +145,15 @@ static int dw_plat_pcie_probe(struct platform_device *pdev) > > pci->ep.ops = &pcie_ep_ops; > ret = dw_pcie_ep_init(&pci->ep); > + if (ret) Here you are using if (ret) to error check the return from dw_pcie_ep_init(). Please be consistent.