From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D15EC433EF for ; Wed, 11 May 2022 15:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BuYnvr4SsiQKh63nocOCmOf/lexcTr7Hpgru8JkYMAA=; b=GwNN76lYUPfD3g ze2bN1V0lUXqZ5IVzMYxvVg8i4lADIH6LYdFTtt314M9LCeDu771KuvHDtY2jc2llKpV4ftdO+lXz HN17HfmeGdrgVtK0pMSdxIF47hYWfKLbzG2sEeUNzECFe1T0ewmks0hek+MMVkfmz/5iBZz4f+Ipb /9xIIirwf/Pxp4LNGzpa+HvyGxTc1JLZ219fcBsI+Lf8EnVrsauFp73OJn6+e11N+vB3akE96+hza A0sasadrHEQXWFSwxRodR/IA+/qx8LcPWOY/g8EN2xFdoEcatzgXyAudJ/YCUJG9upFegwI7D7hOU q5dJt879bKVQvndrwa2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nonsN-007OoY-P8; Wed, 11 May 2022 15:03:45 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nonoy-007NBL-SK; Wed, 11 May 2022 15:00:14 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 15FE5ED1; Wed, 11 May 2022 08:00:11 -0700 (PDT) Received: from lpieralisi (unknown [10.57.1.148]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 24F493F66F; Wed, 11 May 2022 08:00:09 -0700 (PDT) Date: Wed, 11 May 2022 16:00:05 +0100 From: Lorenzo Pieralisi To: Peter Geis Cc: "open list:ARM/Rockchip SoC..." , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , Heiko Stuebner , Philipp Zabel , Marc Zyngier , PCI , devicetree , arm-mail-list , Linux Kernel Mailing List , Nicolas Frattaroli Subject: Re: [PATCH v9 2/5] PCI: rockchip-dwc: Reset core at driver probe Message-ID: References: <20220429123832.2376381-1-pgwipeout@gmail.com> <20220429123832.2376381-3-pgwipeout@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220511_080013_076216_829E4EBA X-CRM114-Status: GOOD ( 31.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, May 11, 2022 at 10:26:20AM -0400, Peter Geis wrote: > On Wed, May 11, 2022 at 9:50 AM Lorenzo Pieralisi > wrote: > > > > On Fri, Apr 29, 2022 at 08:38:28AM -0400, Peter Geis wrote: > > > The PCIe controller is in an unknown state at driver probe. This can > > > lead to undesireable effects when the driver attempts to configure the > > > controller. > > > > > > Prevent issues in the future by resetting the core during probe. > > > > > > Signed-off-by: Peter Geis > > > Tested-by: Nicolas Frattaroli > > > --- > > > drivers/pci/controller/dwc/pcie-dw-rockchip.c | 23 ++++++++----------- > > > 1 file changed, 10 insertions(+), 13 deletions(-) > > > > I fear that the controller reset behaviour is bootloader/firmware > > dependent. > > > > Are we sure we are not triggering any regressions by resetting the > > controller in the middle of probe (aka is the driver implicitly > > relying on existing behaviour on systems that are not the ones > > you are testing on) ? > > > > Just asking, the rockchip maintainers should be able to answer this > > question. > > This is a new driver with no current users, this series enables the > first user. It does not support ACPI nor any sort of handoff at this > time. Ok. I will take patches [1-3], dts changes will have to go via platform trees, I hope that's fine. Thanks, Lorenzo > > Thanks, > > Lorenzo > > > > > diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c > > > index c9b341e55cbb..faedbd6ebc20 100644 > > > --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c > > > +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c > > > @@ -152,6 +152,11 @@ static int rockchip_pcie_resource_get(struct platform_device *pdev, > > > if (IS_ERR(rockchip->rst_gpio)) > > > return PTR_ERR(rockchip->rst_gpio); > > > > > > + rockchip->rst = devm_reset_control_array_get_exclusive(&pdev->dev); > > > + if (IS_ERR(rockchip->rst)) > > > + return dev_err_probe(&pdev->dev, PTR_ERR(rockchip->rst), > > > + "failed to get reset lines\n"); > > > + > > > return 0; > > > } > > > > > > @@ -182,18 +187,6 @@ static void rockchip_pcie_phy_deinit(struct rockchip_pcie *rockchip) > > > phy_power_off(rockchip->phy); > > > } > > > > > > -static int rockchip_pcie_reset_control_release(struct rockchip_pcie *rockchip) > > > -{ > > > - struct device *dev = rockchip->pci.dev; > > > - > > > - rockchip->rst = devm_reset_control_array_get_exclusive(dev); > > > - if (IS_ERR(rockchip->rst)) > > > - return dev_err_probe(dev, PTR_ERR(rockchip->rst), > > > - "failed to get reset lines\n"); > > > - > > > - return reset_control_deassert(rockchip->rst); > > > -} > > > - > > > static const struct dw_pcie_ops dw_pcie_ops = { > > > .link_up = rockchip_pcie_link_up, > > > .start_link = rockchip_pcie_start_link, > > > @@ -222,6 +215,10 @@ static int rockchip_pcie_probe(struct platform_device *pdev) > > > if (ret) > > > return ret; > > > > > > + ret = reset_control_assert(rockchip->rst); > > > + if (ret) > > > + return ret; > > > + > > > /* DON'T MOVE ME: must be enable before PHY init */ > > > rockchip->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3"); > > > if (IS_ERR(rockchip->vpcie3v3)) { > > > @@ -241,7 +238,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev) > > > if (ret) > > > goto disable_regulator; > > > > > > - ret = rockchip_pcie_reset_control_release(rockchip); > > > + ret = reset_control_deassert(rockchip->rst); > > > if (ret) > > > goto deinit_phy; > > > > > > -- > > > 2.25.1 > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel