From patchwork Tue Oct 11 18:42:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13004256 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2D35CC433FE for ; Tue, 11 Oct 2022 18:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H+SVR/QG1/9lpx6FMdSA/qpOH1O0+fTcKXDwdAkWS/A=; b=zlsso9bXnlKBWz nRtRXZe7NLK7pPZl+Ia/opOtJb1RuEXCVzdITTpYufjDZ1UljKr1OD9qc/FYzCon6oz+wtfg4xePr q1/B+WK43BK+GFRpO4hlsC0uqYTQYpIV8P9nTgcVW4NVKhzmLargOHvdct1t8w0G2y0rJRkmqenYJ MwovTpTspMQNt9XtwBhUjqqSaQz+mlHOEscix3ouRuDj0DsKa4y/ok6dW1ve21qZuChMA0bPrjVRD uZqfiJW9ZRPZyzXWsmh59P8Y+P9EJc87zUR9mqIFBZIP2wbTc35zO4vE5zBfREEWnqGosK82vjyLo Dn26loX55XHfA+dM4DLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiKD9-005TIc-Oq; Tue, 11 Oct 2022 18:42:39 +0000 Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiKCq-005TAF-5v; Tue, 11 Oct 2022 18:42:22 +0000 Received: by mail-qk1-x732.google.com with SMTP id a5so4056151qkl.6; Tue, 11 Oct 2022 11:42:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=ZtG62yJbqIS8I6QUrG+przRY/17aM7QpmVb3R+LpRSg=; b=e2UxZkjdHT1/gH9KPu5K9mIPgqAyJ+P/9Q3AnM2oh7crO1Pgm4GlT8rINymylRbreu XAfbmh8brx1W5NZfau9uVaqUHOWAUEI8XR1etIHH+h23ZeEnjXXBc0xXhRXqF6AlNsGr 1+phwmIjU9gG0h/jwO1Y7RKIIoNzlga2sEKX87DdpkJle7dvQUcEqWuflF05fvWEvQot eWKVgv8toCT1Tz3qgwmQNj6wByo0Or7aw3jzCLcVqmxudf9D+SffB5XHWx2lOCpQ2ouU m1iYsrmOA+LnkkyGZiySuCzsgfGVmbcLYqCZ4gcFVPo14Pw6S+echD7eU9iLGs8ehoSo QUvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZtG62yJbqIS8I6QUrG+przRY/17aM7QpmVb3R+LpRSg=; b=KWRK0oawLOwC8rxPAIK5vUBO/ZlOyMlMzF/qXO4rVyDmxsZ3w5II+Zonm9SZt6AzIM bV66saXezSq2tojLmNRNLwBM3njfryLM/IFKex3vYoisCEeKfvl64r3D8IApWrGrpU4w TyScE20bQh4t8H/aysPUmUkA+vO4rtuzgcxJTIiWteEyhMW0Q4Oe8UFZ2hQ8hCP1MktV UHOdvvY8kOFDDGe1DBvcBizqBKXTCsde5v2tZoM3ICKP63yKmF99MUhZdLp+v+Z5u9mO OZlOHW0LzuGDzI5JJKy2tDgNDBMHSXlo/mR6VXLMhu0aZAy6zI5PZrP+7oUNX5l7xLnk kkLg== X-Gm-Message-State: ACrzQf0i/qvWxvvJiylLftGTe9mp1C9nYButCP3CnPIauU1F61Owha2S I9bLlbP5RNB3XelVc8EuIlo= X-Google-Smtp-Source: AMsMyM5O7zbQttUz+a7lUjKpe6+4O68+pvNdZSPYmodxGpzocDWp7GUPiIVxzDTOzwDMl5+XVATp0w== X-Received: by 2002:a05:620a:530a:b0:6df:b743:9671 with SMTP id oo10-20020a05620a530a00b006dfb7439671mr17009906qkn.762.1665513736435; Tue, 11 Oct 2022 11:42:16 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id fc8-20020a05622a488800b003938a65479bsm10961732qtb.10.2022.10.11.11.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 11:42:15 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 2/5] PCI: brcmstb: Wait for 100ms following PERST# deassert Date: Tue, 11 Oct 2022 14:42:07 -0400 Message-Id: <20221011184211.18128-3-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011184211.18128-1-jim2101024@gmail.com> References: <20221011184211.18128-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221011_114220_250541_E195FADA X-CRM114-Status: GOOD ( 11.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Be prudent and give some time for power and clocks to become stable. As described in the PCIe CEM specification sections 2.2 and 2.2.1; as well as PCIe r5.0, 6.6.1. Signed-off-by: Jim Quinlan Acked-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index a45ce7d61847..39b545713ba0 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1037,8 +1037,15 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie) pcie->perst_set(pcie, 0); /* - * Give the RC/EP time to wake up, before trying to configure RC. - * Intermittently check status for link-up, up to a total of 100ms. + * Wait for 100ms after PERST# deassertion; see PCIe CEM specification + * sections 2.2, PCIe r5.0, 6.6.1. + */ + msleep(100); + + /* + * Give the RC/EP even more time to wake up, before trying to + * configure RC. Intermittently check status for link-up, up to a + * total of 100ms. */ for (i = 0; i < 100 && !brcm_pcie_link_up(pcie); i += 5) msleep(5);