From patchwork Thu Oct 6 22:03:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13000770 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 434AAC433F5 for ; Thu, 6 Oct 2022 22:04:59 +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=ZSzvhX7TXIVWXDa3XWXjaBbTyHYxPgyE8maX4SwLA8Q=; b=ClMgnoazmSazRh RkIQ1hHE/PQRKJzw2w1VIZqYquE0cs249g9iwP7t50LI0fqlCe6AdO9bmrbDiyETSSkQkeN9uvZs0 x5fp2/FWLvSxF2+0732WbaHib7nV6XN4nh5jzHBe5XgbjJwmXTTKY9TbLS01Y/6b5cdqSgob3mlj0 M5zbc/fvQXBja6zHocjCkAwOUYapMtbVIrWbV5SACl4DmPaaz6H1+zL0CrKiBMTA/dzw/uirwnjrU kBH+XO+lKQmy/Ug++dwf7gOIR+kOZcSwxO17IuVT+lHPcZ5zG1mlvG4paHS4JHFZpxiMlT2ddhktv 9e+SgSIKQyDG3qxv9XkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogYy9-005WZT-Js; Thu, 06 Oct 2022 22:03:53 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogYxt-005WLy-GT; Thu, 06 Oct 2022 22:03:38 +0000 Received: by mail-ed1-x533.google.com with SMTP id m15so4656971edb.13; Thu, 06 Oct 2022 15:03:36 -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=+F1i8mswqP1sOXLGE0a7iwcDafA7tYx629sD2VumcwM=; b=jwBoQvzQ/LxjK8kx7cK6AYwRfB/MWLeaTyoiyxCTogu2djnodPVti9tH75mNWdv8Wl RxeehYapXNgU4BocLjtIzM0z237x1gGRdkfNCrmMjTzkru3FAELYmvAddQCdH42XRd0+ MbFnFjlfPmvrrTi//XXWzKZjN2fdtSzOF6ZHsGwIaW/H7th+rWTqcA2fdvvD7TUfKGRf Y3swYaF0YXRTR92WGvEE/B8Lhaq366ram+7yQihSoyRN1W+jbqmWSCpe0xga3cOfpSr9 Su0JyQLzDK2vDhjFd/R2Thrzz1qRyz9/hZgSjhJmxg2kq6cICkRNaBimVXvlJvpKN2sX U5Sg== 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=+F1i8mswqP1sOXLGE0a7iwcDafA7tYx629sD2VumcwM=; b=go0F6aqSCOBOgXg+7CqhlQn4Es/ovpVkgttZ2ReM/l4X6n4iDTe270rH1guXTrFV5n R36XJReM11nB1Db+GCPrjaz2H5KK4g0WYzZ17bEI59XjUb2ECDp/J0TWP3k0KlOhSSM5 6xDUe4YGbIeK1RRIJr6bGMxpKe/BePPv3cP5jGCbFQ3lnL0oFY9Rzv6Ck5CnyoMGB0+x n3oUYDi7SrnC0CGw2yQ5kC3dF4r2qgeqBcavudbM/hPMti3WvPEtqMwafHb6P4o1musP +cCmuLrco2j+qLZm126KBc8qb+tw7mO1YXpffFW5ZDq/UotdcKd6gCAM2ctrvda8ZXxz j0pQ== X-Gm-Message-State: ACrzQf23zpaakrPG5mPG37Cu9uGFuSK4pXiFXWf2N30hHkcK1qyXXB7q cuOlV1oEqSiU/SCHfa1oJq8= X-Google-Smtp-Source: AMsMyM45Yyx4Aawv9K44B8BVX+nb7uc1JOiB7C0zFJxGLs97p4qwRQZ60HKSJLscxOirRlc77wpvvQ== X-Received: by 2002:aa7:db07:0:b0:458:f6e5:ab71 with SMTP id t7-20020aa7db07000000b00458f6e5ab71mr1855183eds.330.1665093815001; Thu, 06 Oct 2022 15:03:35 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id f14-20020a17090631ce00b0078246b1360fsm241484ejf.131.2022.10.06.15.03.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 15:03:34 -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 v1 2/5] PCI: brcmstb: Wait for 100ms following PERST# deassert Date: Thu, 6 Oct 2022 18:03:18 -0400 Message-Id: <20221006220322.33000-3-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221006220322.33000-1-jim2101024@gmail.com> References: <20221006220322.33000-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221006_150337_570776_642B9F49 X-CRM114-Status: GOOD ( 11.02 ) 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);