Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5736947ybp; Tue, 15 Oct 2019 04:23:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzf0js9kt9eUatTYt7yPKRwFwhfY+xBBH6bGvit1tHehNcq6UAgjD0SSBjn0H6DbE9SqgPH X-Received: by 2002:a05:6402:1519:: with SMTP id f25mr33346563edw.65.1571138619925; Tue, 15 Oct 2019 04:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571138619; cv=none; d=google.com; s=arc-20160816; b=WhlXDcmSM57vo8Bf1iILUjJTTniHGJ5DOPhQE8rVWQDAnnC+9PInVXFgeBqOzNYDVL XXk1ChmNFQnHpihoMiqsP+u5G7cbsPOVvgx8jMrt3aa0yZ10AmnPIVGgjo6fgfye24Il JR4jPrKAwHi1kCK7OJX801+z2HDWHm4EPq9urM1SwbKyCJjUEHuT8R+mpPKBJ6zmXi7X P4nqv2h3NqpLIeufg09uu4h4V3q/lcZKhngROKfTPas9RjPJitqWKRgl4wqLVcCpWyki aDuWiLiS5ewatShzv096iU2/QF0dKkh5kN+EDZiHFmXzP43IJwI6ZFjAiDxcd8oJY1My H3GQ== 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=pbFinezgLKQOyHYUjdVa8Jx2rbnc6nj2X6FPuJ+cCqY=; b=RVw2MH7FnNuTSyRqqCB4ps0OfvlhJStZadGejsm+hfKluplw8k8bxtv1zxqmd5SXNU 8uZJcVwENfdEQCNnSgGQUX2FilqdGFhpKCAeSWmLqvmZjhU6t8NZMZhaTyZWf3DcNKA1 ZF5ek3tLIJKDU2AeH8NZZQppCDZ+OGNyc+DhNKUCY3ViTtM4vXCx0utSi3sDDVVTy1lw 5Ib0drCNtBnxZod9qW7pWpUgy9cv8r38fiz7tuV/HDvGijBnQ/SDL3dcRVWwWAlrd52Q ZJmrzQ/PwMsyI+6B0F2JgpakN4iUuw63zHLNmhG4FP+Ph1xlheds8ZZmrIyD12NG56uU Ibpw== 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 a3si16324414edc.75.2019.10.15.04.23.16; Tue, 15 Oct 2019 04:23:39 -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 S1726981AbfJOJyF (ORCPT + 99 others); Tue, 15 Oct 2019 05:54:05 -0400 Received: from foss.arm.com ([217.140.110.172]:34004 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725890AbfJOJyF (ORCPT ); Tue, 15 Oct 2019 05:54:05 -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 8074C28; Tue, 15 Oct 2019 02:54:04 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (unknown [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7C2BD3F68E; Tue, 15 Oct 2019 02:54:03 -0700 (PDT) Date: Tue, 15 Oct 2019 10:53:58 +0100 From: Lorenzo Pieralisi To: Remi Pommarel Cc: Thomas Petazzoni , 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: <20191015095358.GA32431@e121166-lin.cambridge.arm.com> 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.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 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(+) Applied to pci/aardvark, thanks. Lorenzo > 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 >