Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4745610ybp; Mon, 14 Oct 2019 09:22:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqyf5WHAYSL5dEH608oPCS7jA1wzQp7O2oThQyxWFQ/JkBLPuvVc3bdwMbFFPHFivSauv2fq X-Received: by 2002:a17:906:470d:: with SMTP id y13mr29485521ejq.241.1571070120605; Mon, 14 Oct 2019 09:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571070120; cv=none; d=google.com; s=arc-20160816; b=GS+Yj4/cx397N0hXg+dEan/QF7pmCLJUO8i9iCqIMoI+BLCbKg3WOrdh9mPieq+mm/ UHWhqPcuBC8zW29QWJObBH4R5bR7iYk0JLayKU/TZMBBbXwh5Ea69Bs1gsNX6u/U3ta9 OP08160mFJ67hU4T3zd+aklOjP4ge4cGNQOEiYRRqgRvaAkn4WRQegPcWX2QXaoBEDDt Po2+L0SzNZ8HPcQW6uPPu0iDrXJ5v8hmvetl+Nk9MznjVoP2jOG856kdjNYRrOnfkC7W fTn3CGHIak6RaODgxWln1YXMwngDpvJnk6zRcgjZXbryl5dhft0hX3OFI1nUdtTbiqQd ANiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=hXAQh8fdGnoF9eNRKtA3687ulG/t5pMzmOUiexl7P/0=; b=KOssF1ol0q9/fnIoEIkbfZxzc3k4Ks416ZUBAuOuowmFOk7Ea4YckyWYFXhbPxFssj YRmeV8E9HCIUOUyWgrdniELH/58czHELQlyPfEUp3MAQn7exv5U+oJdg+WiYe3v+XABS /9HPlWxn09A7CwYu3U0Sj65Jc73g7U35NdGe9vlshvKL47ytIUHNdi5zDqbsakA6t8VI xLNViiTPgb2XE3RSTKz7C9x71R71NLiq4R3+oAIdZO0JhbOyR0MPM2QBArrZGB2p9Dsw cXXJusCKLZjBEEdkA9qZulsbcP3XaVKZqmQExXyiJQoM5UnMgK7GkLsXMfpJHVf+Sh2a NHXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w12si11798463ejb.303.2019.10.14.09.21.37; Mon, 14 Oct 2019 09:22:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387660AbfJNPjX (ORCPT + 99 others); Mon, 14 Oct 2019 11:39:23 -0400 Received: from foss.arm.com ([217.140.110.172]:47186 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730005AbfJNPjX (ORCPT ); Mon, 14 Oct 2019 11:39:23 -0400 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 7942B28; Mon, 14 Oct 2019 08:39:22 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 761AF3F68E; Mon, 14 Oct 2019 08:39:21 -0700 (PDT) Date: Mon, 14 Oct 2019 16:39:19 +0100 From: Lorenzo Pieralisi To: Remi Pommarel , Thomas Petazzoni Cc: Bjorn Helgaas , Ellie Reeves , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] PCI: aardvark: Wait for endpoint to be ready before training link Message-ID: <20191014153919.GB2928@e121166-lin.cambridge.arm.com> References: <20190522213351.21366-2-repk@triplefau.lt> <20190806184945.GU12859@voidbox.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190806184945.GU12859@voidbox.localdomain> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 06, 2019 at 08:49:46PM +0200, Remi Pommarel wrote: > On Wed, May 22, 2019 at 11:33:50PM +0200, Remi Pommarel wrote: > > When configuring pcie reset pin from gpio (e.g. initially set by > > u-boot) to pcie function this pin goes low for a brief moment > > asserting the PERST# signal. Thus connected device enters fundamental > > reset process and link configuration can only begin after a minimal > > 100ms delay (see [1]). > > > > Because the pin configuration comes from the "default" pinctrl it is > > implicitly configured before the probe callback is called: > > > > driver_probe_device() > > really_probe() > > ... > > pinctrl_bind_pins() /* Here pin goes from gpio to PCIE reset > > function and PERST# is asserted */ > > ... > > drv->probe() > > > > [1] "PCI Express Base Specification", REV. 4.0 > > PCI Express, February 19 2014, 6.6.1 Conventional Reset > > > > Signed-off-by: Remi Pommarel > > --- > > Changes since v1: > > - Add a comment about pinctrl implicit pin configuration > > - Use more legible msleep > > - Use PCI_PM_D3COLD_WAIT macro > > > > Please note that I will unlikely be able to answer any comments from May > > 24th to June 10th. > > --- > > drivers/pci/controller/pci-aardvark.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c > > index 134e0306ff00..d998c2b9cd04 100644 > > --- a/drivers/pci/controller/pci-aardvark.c > > +++ b/drivers/pci/controller/pci-aardvark.c > > @@ -324,6 +324,14 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) > > reg |= PIO_CTRL_ADDR_WIN_DISABLE; > > advk_writel(pcie, reg, PIO_CTRL); > > > > + /* > > + * PERST# signal could have been asserted by pinctrl subsystem before > > + * probe() callback has been called, making the endpoint going into > > + * fundamental reset. As required by PCI Express spec a delay for at > > + * least 100ms after such a reset before link training is needed. > > + */ > > + msleep(PCI_PM_D3COLD_WAIT); > > + > > /* Start link training */ > > reg = advk_readl(pcie, PCIE_CORE_LINK_CTRL_STAT_REG); > > reg |= PCIE_CORE_LINK_TRAINING; > > -- > > 2.20.1 > > Gentle ping. Thomas, sorry for the delay, unless you object I would merge this patch, I need your ACK to proceed though. Thanks, Lorenzo