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 X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 657EEC10F11 for ; Wed, 24 Apr 2019 16:50:25 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 36320206A3 for ; Wed, 24 Apr 2019 16:50:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SDO8UCM4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36320206A3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject: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=FPW9NJXdpzTCYjq00OxV2npiydHfX/0a0JmrPU9tXcw=; b=SDO8UCM4HdG0D6 GLeqOxOdwteZ/Rp4Pnftpcq5d3iHVD6kqfbMD75QdJCH2gEB4EY2YuY1z3yH7E26PsgsJnKNSQWFg yQ/6MmWa3prdRObHph8jqQL7Vr4X9QrJWrNqQ/kHj9vDX5/DSJF0tFI5N8lQIi4u5PfDpnNmK6+xp 45LMEO7flxVDeK2s1xt3vcoUzOlPHAXpC+VmpjrUzf7Yfq4bVSWpS4MszJxzZ2yMrPoT2c7Qf8N5z BJQ7VhS6VBwipWH5kbRH1REburrlPJ3tKTXdi2WF1EdNo0CN9aZmydGO/iWaZ8iB5OvC6tMZS1A/U dVcu9xSYShbJtJZ+7YOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJL67-0004tY-Ff; Wed, 24 Apr 2019 16:50:15 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJL63-0004sN-LT for linux-arm-kernel@lists.infradead.org; Wed, 24 Apr 2019 16:50:13 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2289D374; Wed, 24 Apr 2019 09:50:09 -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 B15243F557; Wed, 24 Apr 2019 09:50:07 -0700 (PDT) Date: Wed, 24 Apr 2019 17:50:02 +0100 From: Lorenzo Pieralisi To: Remi Pommarel Subject: Re: [PATCH] pci: aardvark: Wait for endpoint to be ready before training link Message-ID: <20190424165002.GA26089@e121166-lin.cambridge.arm.com> References: <20190313213752.1246-1-repk@triplefau.lt> <20190423163215.GB26523@red-moon> <20190423222917.GN2754@voidbox.localdomain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190423222917.GN2754@voidbox.localdomain> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190424_095012_243917_A60C22CB X-CRM114-Status: GOOD ( 24.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Petazzoni , Miquel Raynal , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Apr 24, 2019 at 12:29:18AM +0200, Remi Pommarel wrote: > Hi, > > On Tue, Apr 23, 2019 at 05:32:15PM +0100, Lorenzo Pieralisi wrote: > > On Wed, Mar 13, 2019 at 10:37:52PM +0100, 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]). > > > > > > This makes sure that link is configured after at least 100ms from > > > beginning of probe() callback (shortly after the reset pin function > > > configuration switch through pinctrl subsytem). I am a bit lost, what's the connection between the probe() callback and the reset pin function configuration ? Please elaborate. > > > > > > [1] "PCI Express Base Specification", REV. 2.1 > > > PCI Express, March 4 2009, 6.6.1 Conventional Reset > > > > > > Signed-off-by: Remi Pommarel > > > --- > > > drivers/pci/controller/pci-aardvark.c | 17 ++++++++++++++--- > > > 1 file changed, 14 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c > > > index a30ae7cf8e7e..70a1023d0ef1 100644 > > > --- a/drivers/pci/controller/pci-aardvark.c > > > +++ b/drivers/pci/controller/pci-aardvark.c > > > @@ -177,6 +177,9 @@ > > > > > > #define PIO_TIMEOUT_MS 1 > > > > > > +/* Endpoint can take up to 100ms to be ready after a reset */ > > > +#define ENDPOINT_RST_MS 100 > > > + > > > #define LINK_WAIT_MAX_RETRIES 10 > > > #define LINK_WAIT_USLEEP_MIN 90000 > > > #define LINK_WAIT_USLEEP_MAX 100000 > > > @@ -242,8 +245,10 @@ static int advk_pcie_wait_for_link(struct advk_pcie *pcie) > > > return -ETIMEDOUT; > > > } > > > > > > -static void advk_pcie_setup_hw(struct advk_pcie *pcie) > > > +static void > > > +advk_pcie_setup_hw(struct advk_pcie *pcie, unsigned long ep_rdy_time) > > > > Nit: I prefer the prototype to be in one line, I wrap it for you. > > > > I am wondering why you need to pass in ep_rdy_time parameter when you > > can easily compute it in the function itself. > > > > The only reason for that is because the sooner I get the jiffies the > lower the delay has to be. I was trying to reduce the impact of this > delay to a minimum, but maybe the improvement is not worth it. That should just be (roughly) some microseconds unless there is something I am missing. Try to measure it :) More importantly, I would ask you to elaborate a bit more about the logic behind this patch, see above because I need to understand the logic behind pinctrl reset and the probe() hook execution ordering. Thanks, Lorenzo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel