Message ID | 20230703112914.68806-1-a-verma1@ti.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp459188vqx; Mon, 3 Jul 2023 04:50:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ZQwrdf0XnpOVnBYyWHxbNbR4E8xo95Vco0qSe3YZOCJnvMKxYtVAr4bitbZaIKXyZVPAj X-Received: by 2002:a05:6a20:4413:b0:11b:3e33:d2ce with SMTP id ce19-20020a056a20441300b0011b3e33d2cemr15840569pzb.1.1688385026003; Mon, 03 Jul 2023 04:50:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688385025; cv=none; d=google.com; s=arc-20160816; b=sPqzcVlm7ObMi72aOfphvH2kHFhwXq0AJlUucpA6raJVY5D8HnwvggrVyd46NZbHyC Leg2pN8Jq4c81CrW1Mv7x9NY2ksnqyhfvoUVkjuL8+aD6fcwshp9+PmZoOy4WWgKdAJU MG/0AmpAFyrBMFbGaHhC1zno4Q/rzpses4W5KeJ4q6R8twtTdrB3OkkqrvLlU+MUBcET wvtT02bF07e6Lw+7LgAYL2DQuHhj7W+CPcL8Q/AtWEf3nLNaRrpeZEvHYfzH3GkKBrJG /UKcAuN+8K5531s3bbgqM68vtpB3wZUEisHHzdKllZUAu3DOc9m9JvMMsvI2TJ1VFMgo J+HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=xDtP2HJQgfk6AN7TtOP/ryebO14+ERJGMm36HhtgU2Q=; fh=IwZB0JzsjP0CKtkWzkLtom90CPGiOVOkY7P05aHuQ2c=; b=moocOck8x97a/ZZPAKlAnM9QNMTU6xWYLjqiEorkZYPmndCSXZFxxIo/vepKQcXAKn DBq++RxdgJgdTqs3MVh1EPm8LTkNRKg9ZzLCnWcl8nmeVz6fakug/ba+JJf1ib7Z0R5x qh6z47SpYMhymlajWEXJT/MbhIgv8IF9tv5mu03Xal3B3ZYEe8vrEcOmU3gkdUaMLBSa QMQ9clqcvLj5GVEDPyM+cQZf3VeuGYodU7iCk9IGfpyZw6aVTaTXKdEJ7Ak6CQf14tUr Ll5ph9vB04QRC1BwyxIxy9OPTZsHa1g3f4yINO3aPol3W1XgdacyTWkR3F0Ha1oG/116 /aFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=klnc0xG8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u7-20020a656707000000b0055ac5fed59fsi16605826pgf.665.2023.07.03.04.50.10; Mon, 03 Jul 2023 04:50:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=klnc0xG8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230442AbjGCL3j (ORCPT <rfc822;ivan.orlov0322@gmail.com> + 99 others); Mon, 3 Jul 2023 07:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbjGCL3i (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 3 Jul 2023 07:29:38 -0400 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2421EC; Mon, 3 Jul 2023 04:29:36 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 363BTG9b095606; Mon, 3 Jul 2023 06:29:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1688383756; bh=xDtP2HJQgfk6AN7TtOP/ryebO14+ERJGMm36HhtgU2Q=; h=From:To:CC:Subject:Date; b=klnc0xG8vrmpvDuVqdSlRNoClaR9Dz3fUQpMr+kcL1fTWNRJ0RBeESehAs6qKwC1h hau/3fOOAe/kAeT51HIRpJylQFRzIE1HfevMGUlqDZ3lVOUv5tU1pPesFuDJMKPlcW e8QnIkiz2UIkGMLep8PiaMEXigBmr1mweeQIuv90= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 363BTFx7048757 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 3 Jul 2023 06:29:15 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 3 Jul 2023 06:29:15 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 3 Jul 2023 06:29:15 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 363BTERL001690; Mon, 3 Jul 2023 06:29:15 -0500 From: Achal Verma <a-verma1@ti.com> To: Vignesh Raghavendra <vigneshr@ti.com>, Tom Joseph <tjoseph@cadence.com>, Lorenzo Pieralisi <lpieralisi@kernel.org>, Krzysztof Wilczy_ski <kw@linux.com>, Rob Herring <robh@kernel.org>, Bjorn Helgaas <bhelgaas@google.com> CC: <linux-omap@vger.kernel.org>, <linux-pci@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, Achal Verma <a-verma1@ti.com> Subject: [PATCH] PCI: j721e: Fix delay before PERST# deassert Date: Mon, 3 Jul 2023 16:59:14 +0530 Message-ID: <20230703112914.68806-1-a-verma1@ti.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770400016906919798?= X-GMAIL-MSGID: =?utf-8?q?1770400016906919798?= |
Series |
PCI: j721e: Fix delay before PERST# deassert
|
|
Commit Message
Achal Verma
July 3, 2023, 11:29 a.m. UTC
As per the PCIe Card Electromechanical specification REV. 3.0, PERST#
signal should be de-asserted after minimum 100ms from the time power-rails
become stable. Current delay of 100us is observed to be not enough on some
custom platform implemented using TI's K3 SOCs.
So, to ensure 100ms delay to give sufficient time for power-rails and
refclk to become stable, change delay from 100us to 100ms.
From PCIe Card Electromechanical specification REV. 3.0 section 2.6.2:
TPVPERL: Power stable to PERST# inactive - 100ms
T-PERST-CLK: REFCLK stable before PERST# inactive - 100 usec.
Fixes: f3e25911a430 ("PCI: j721e: Add TI J721E PCIe driver")
Signed-off-by: Achal Verma <a-verma1@ti.com>
---
drivers/pci/controller/cadence/pci-j721e.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
Comments
Hi Achal, ---- On Mon, 03 Jul 2023 19:29:14 +0800 Achal Verma wrote --- > As per the PCIe Card Electromechanical specification REV. 3.0, PERST# > signal should be de-asserted after minimum 100ms from the time power-rails > become stable. Current delay of 100us is observed to be not enough on some > custom platform implemented using TI's K3 SOCs. > > So, to ensure 100ms delay to give sufficient time for power-rails and > refclk to become stable, change delay from 100us to 100ms. What problems could arise if the delay is too small? Would some endpoints not be able to detect it? Regards, Li
On 7/3/2023 7:19 PM, Li Chen wrote: > Hi Achal, > ---- On Mon, 03 Jul 2023 19:29:14 +0800 Achal Verma wrote --- > > As per the PCIe Card Electromechanical specification REV. 3.0, PERST# > > signal should be de-asserted after minimum 100ms from the time power-rails > > become stable. Current delay of 100us is observed to be not enough on some > > custom platform implemented using TI's K3 SOCs. > > > > So, to ensure 100ms delay to give sufficient time for power-rails and > > refclk to become stable, change delay from 100us to 100ms. > > What problems could arise if the delay is too small? Would some endpoints not be able to detect it? If delay is small, cpu stall is reported during probe() while accessing PCIe registers in some cases. > > Regards, > Li
In subject, "Fix" doesn't convey much information. Does it increase? Decrease? How much time are we talking about? PERST# deassert is at one end of the delay; what event is at the other end? Some of these useful bits of information could appear in the subject line. On Mon, Jul 03, 2023 at 04:59:14PM +0530, Achal Verma wrote: > As per the PCIe Card Electromechanical specification REV. 3.0, PERST# I think the current rev of this spec is r5.0. Can you cite that instead? I think the relevant section is r5.0, sec 2.9.2. > signal should be de-asserted after minimum 100ms from the time power-rails > become stable. Current delay of 100us is observed to be not enough on some > custom platform implemented using TI's K3 SOCs. Is this delay for the benefit of the Root Port or for the attached Endpoint? If the latter, my guess is that some Endpoints might tolerate the current shorter delay, while others might require more, and it doesn't sound like "TI's K3 SoC" would be relevant here. > So, to ensure 100ms delay to give sufficient time for power-rails and > refclk to become stable, change delay from 100us to 100ms. > > From PCIe Card Electromechanical specification REV. 3.0 section 2.6.2: > TPVPERL: Power stable to PERST# inactive - 100ms > T-PERST-CLK: REFCLK stable before PERST# inactive - 100 usec. Numbers like 100ms that come from the PCIe specs should have #defines for them. If we don't have one already, can you add one, please? > Fixes: f3e25911a430 ("PCI: j721e: Add TI J721E PCIe driver") > Signed-off-by: Achal Verma <a-verma1@ti.com> > --- > drivers/pci/controller/cadence/pci-j721e.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c > index e70213c9060a..fa2b4c11d2c4 100644 > --- a/drivers/pci/controller/cadence/pci-j721e.c > +++ b/drivers/pci/controller/cadence/pci-j721e.c > @@ -499,13 +499,12 @@ static int j721e_pcie_probe(struct platform_device *pdev) > /* > * "Power Sequencing and Reset Signal Timings" table in > * PCI EXPRESS CARD ELECTROMECHANICAL SPECIFICATION, REV. 3.0 > - * indicates PERST# should be deasserted after minimum of 100us > - * once REFCLK is stable. The REFCLK to the connector in RC > - * mode is selected while enabling the PHY. So deassert PERST# > - * after 100 us. > + * indicates PERST# should be deasserted after minimum of 100ms > + * after power rails achieve specified operating limits and > + * within this period reference clock should also become stable. > */ > if (gpiod) { > - usleep_range(100, 200); > + msleep(100); > gpiod_set_value_cansleep(gpiod, 1); > } > > -- > 2.25.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On 7/3/2023 9:51 PM, Bjorn Helgaas wrote: > In subject, "Fix" doesn't convey much information. Does it increase? > Decrease? How much time are we talking about? PERST# deassert is at > one end of the delay; what event is at the other end? Hi Bjorn, How about "Increase delay to 100ms for PERST# deassert from moment power-rails achieve operating limits" > > Some of these useful bits of information could appear in the subject > line. > > On Mon, Jul 03, 2023 at 04:59:14PM +0530, Achal Verma wrote: >> As per the PCIe Card Electromechanical specification REV. 3.0, PERST# > > I think the current rev of this spec is r5.0. Can you cite that > instead? I think the relevant section is r5.0, sec 2.9.2. REV 5.0 also quote same TPVPERL=100ms delay. I refer REV. 3.0 as pci-j721e controller follows REV. 3.0 > >> signal should be de-asserted after minimum 100ms from the time power-rails >> become stable. Current delay of 100us is observed to be not enough on some >> custom platform implemented using TI's K3 SOCs. > > Is this delay for the benefit of the Root Port or for the attached > Endpoint? If the latter, my guess is that some Endpoints might > tolerate the current shorter delay, while others might require more, > and it doesn't sound like "TI's K3 SoC" would be relevant here. Its for the endpoints, TI's EVB doesn't exhibit any issues with 100us delay but some customer reported the issue with shorter delay. I have been working to refactor this driver to build as a module, I too observed the issue on re-probe after remove when delay is lesser. > >> So, to ensure 100ms delay to give sufficient time for power-rails and >> refclk to become stable, change delay from 100us to 100ms. >> >> From PCIe Card Electromechanical specification REV. 3.0 section 2.6.2: >> TPVPERL: Power stable to PERST# inactive - 100ms >> T-PERST-CLK: REFCLK stable before PERST# inactive - 100 usec. > > Numbers like 100ms that come from the PCIe specs should have #defines > for them. If we don't have one already, can you add one, please? Sure, will do it in next revision but should this go in some generic PCI header file or just pci-j721e.c > >> Fixes: f3e25911a430 ("PCI: j721e: Add TI J721E PCIe driver") >> Signed-off-by: Achal Verma <a-verma1@ti.com> >> --- >> drivers/pci/controller/cadence/pci-j721e.c | 9 ++++----- >> 1 file changed, 4 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c >> index e70213c9060a..fa2b4c11d2c4 100644 >> --- a/drivers/pci/controller/cadence/pci-j721e.c >> +++ b/drivers/pci/controller/cadence/pci-j721e.c >> @@ -499,13 +499,12 @@ static int j721e_pcie_probe(struct platform_device *pdev) >> /* >> * "Power Sequencing and Reset Signal Timings" table in >> * PCI EXPRESS CARD ELECTROMECHANICAL SPECIFICATION, REV. 3.0 >> - * indicates PERST# should be deasserted after minimum of 100us >> - * once REFCLK is stable. The REFCLK to the connector in RC >> - * mode is selected while enabling the PHY. So deassert PERST# >> - * after 100 us. >> + * indicates PERST# should be deasserted after minimum of 100ms >> + * after power rails achieve specified operating limits and >> + * within this period reference clock should also become stable. >> */ >> if (gpiod) { >> - usleep_range(100, 200); >> + msleep(100); >> gpiod_set_value_cansleep(gpiod, 1); >> } >> >> -- >> 2.25.1 >> >> >> _______________________________________________ >> linux-arm-kernel mailing list >> linux-arm-kernel@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On Tue, Jul 04, 2023 at 09:36:43PM +0530, Verma, Achal wrote: > On 7/3/2023 9:51 PM, Bjorn Helgaas wrote: > > In subject, "Fix" doesn't convey much information. Does it increase? > > Decrease? How much time are we talking about? PERST# deassert is at > > one end of the delay; what event is at the other end? > > How about "Increase delay to 100ms for PERST# deassert from moment > power-rails achieve operating limits" Maybe something like "Delay 100ms T_PVPERL from power stable to PERST# inactive" to match the language in the spec? > > Is this delay for the benefit of the Root Port or for the attached > > Endpoint? If the latter, my guess is that some Endpoints might > > tolerate the current shorter delay, while others might require > > more, and it doesn't sound like "TI's K3 SoC" would be relevant > > here. > > Its for the endpoints, TI's EVB doesn't exhibit any issues with > 100us delay but some customer reported the issue with shorter delay. I wouldn't bother mentioning "some custom platform implemented using TI's K3 SOCs" then, because the problem is that the driver didn't observe T_PVPERL, so the problem will happen with some endpoints but not others. > > Numbers like 100ms that come from the PCIe specs should have #defines > > for them. If we don't have one already, can you add one, please? > > Sure, will do it in next revision but should this go in some generic PCI > header file or just pci-j721e.c I think it should be in drivers/pci/pci.h so all the controller drivers can use the same thing. Obviously none of them *currently* use it, although there are a bunch of "msleep(100)" and a few comments that mention T_PVPERL. Bjorn
diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c index e70213c9060a..fa2b4c11d2c4 100644 --- a/drivers/pci/controller/cadence/pci-j721e.c +++ b/drivers/pci/controller/cadence/pci-j721e.c @@ -499,13 +499,12 @@ static int j721e_pcie_probe(struct platform_device *pdev) /* * "Power Sequencing and Reset Signal Timings" table in * PCI EXPRESS CARD ELECTROMECHANICAL SPECIFICATION, REV. 3.0 - * indicates PERST# should be deasserted after minimum of 100us - * once REFCLK is stable. The REFCLK to the connector in RC - * mode is selected while enabling the PHY. So deassert PERST# - * after 100 us. + * indicates PERST# should be deasserted after minimum of 100ms + * after power rails achieve specified operating limits and + * within this period reference clock should also become stable. */ if (gpiod) { - usleep_range(100, 200); + msleep(100); gpiod_set_value_cansleep(gpiod, 1); }