Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4440951ybh; Tue, 6 Aug 2019 11:42:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqx5YEhzXBjGfegqqSyXdWM0fJ+AUpEjuUFcie/+KZnBoUOXyNYC4SUgucHm+6Lu/3njokor X-Received: by 2002:aa7:8804:: with SMTP id c4mr5083462pfo.65.1565116964421; Tue, 06 Aug 2019 11:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565116964; cv=none; d=google.com; s=arc-20160816; b=QdxStvwcvntuljJhd/BjsqFSW331zCQmBogCM567CwM4kSfRasR8cjbCaEcHP9DZhr OHge70XIVS7s949zeiwcToomynbfDI0t78TwvmTXu5V4XvAKHx7R54cc4d6q78ulxURd IcJgdyXkaT7radJWISlzfDXiJIWxWkjJYjQzNlpaz2je28ht6K1Ugyl8Mvdj3T0D1cPo /x16jAB59mR4gPlRkPXoBrqFMV8kCWCXHr1g1PRRWaofGxKuSb5TiFQ2YpVszSWyZsyJ 5RhNMNcSLSTks0yWSUGxcQVEgVXioABFOr1U1RODkwPLrEAl8kvWAnbDkQBRI6rIPL91 v1aA== 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=4Mi1YLCSR8Ny3cwo8CDBJtqpXos3Nx9GR6KrV+nqfWY=; b=xTGrKcMTXz3KwtcFkkyRRkTDRh0AaYOyFhOwWc1S1fr3ysVZg3NrsE+nMeSyIqTzJb ohYMGYYFqoWVRkcE8TE2DHk6IOZtR0ZJ/Mkoxg21ISLE9gUmZMlIGrbTm+7P5gbL6gY4 GdprO/z9YwMfKLU8PazE5KaWd5Op0SsmfHQ4185lKjZG+fLK97D8jG/CvLUhGUfrgBYB A5TgI+0VvXH8YbkJDP9m5awtIDGTv0zFydgW+51l4l0DpY4YIGb4ekRFYN3TpcBkBeOr XPzRFD5uow4zLRJf0C5PYTOFsvkI9XhFPrZd1g5f5yp+ZHzIBElL/Xfzrdx9KY5KDH6H ealg== 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 u12si16407254pgb.595.2019.08.06.11.42.29; Tue, 06 Aug 2019 11:42:44 -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 S1726446AbfHFSla (ORCPT + 99 others); Tue, 6 Aug 2019 14:41:30 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:51215 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbfHFSlR (ORCPT ); Tue, 6 Aug 2019 14:41:17 -0400 X-Originating-IP: 88.190.179.123 Received: from localhost (unknown [88.190.179.123]) (Authenticated sender: repk@triplefau.lt) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 5DF3D6000E; Tue, 6 Aug 2019 18:41:13 +0000 (UTC) Date: Tue, 6 Aug 2019 20:49:46 +0200 From: Remi Pommarel To: Thomas Petazzoni , Lorenzo Pieralisi , Bjorn Helgaas Cc: 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: <20190806184945.GU12859@voidbox.localdomain> References: <20190522213351.21366-2-repk@triplefau.lt> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190522213351.21366-2-repk@triplefau.lt> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Remi