From patchwork Fri Apr 28 22:34:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13226879 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 6ED58C77B61 for ; Fri, 28 Apr 2023 22:36:25 +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=ycJ/W8jySJXKKo6Yt2ILch8/JjB57WvQjSOXIjxafiA=; b=bXbgsiJHNEoKYM u+403Ij62QzgUddTD0wki1x2HWe4HAwMgMGo27gfhSkWMQvJ7K1wnkY92kG0VFApwXGIDOLB8M0AJ aqp87dEnEYFmDz/WageoDUmhpwfRHWzMDt6G8IrJMFanxvis+Hp75qLHcXurTex5B62uK9vgesAbG bJFe3ZIQ2tFKVO0Bej2MCl2H8Jbl87u1vyj/1wRcC7ep+qBaCHbBg1PA1Z0h+GooH6mSrB7p9cs0s bfuLlJkqZ+GZ73BunSikTYIk/katp5CsYVMcA+85oPu9ah8IC0hTtC1/lL1QIRFUrTp+cVLVGprIM FPzeXpTgKSbLdlCRmXSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1psWgo-00Bsgg-1o; Fri, 28 Apr 2023 22:35:42 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1psWgS-00BsZ0-1i; Fri, 28 Apr 2023 22:35:21 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1a6c5acf6ccso3892805ad.3; Fri, 28 Apr 2023 15:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682721319; x=1685313319; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=soSZ2SRcxkgwO6bRCgJ7t3tsyaulOFN/8ZMK9B68Z4o=; b=cqMzvh19jnoipsC+X8oNLX6h03W5oevo5LyC8x31tSxe1fyOjrADCqD4XhPQ9ytN2m WwikptL1oi9hYiGuOr10dTeODrfI7HlcwagUq2kxUxZ+i1k2A6/qP8e9uulYY7RH6tBd O4d0maGA3SyB5Gm+E0DhRGGqCCi+GcoEZItiZpgvc1aRxpYLkHrhNMMINYWUSWIfgYol XSzWAiQb8MsGLB6WkljcwlmXuAhAafk69stum9UkuebsAKaeh3kbgPKKGbgAlYrcK/dN xo961KahNe9Fb2IeWfROSEg/TmNQ7wEylOoSHObHeYsr9kvjThoRcUPg4wzTny4k1E6x h5mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682721319; x=1685313319; 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=soSZ2SRcxkgwO6bRCgJ7t3tsyaulOFN/8ZMK9B68Z4o=; b=PSy56GlzhM2wqsdwNvyWIt/BtTrbY5gbLnKTkSFfPwcjoaMmOnTCFxYUgAJHLLPY47 rowjL3v5hBiMV0MAdY61CexlAt5ma8svNMRRsUaCCeYdD+clyjm6eJScWVW8XNb2UZeg 5jeCvnIKe0cHNy3OaxVdsSXQSHWXYWZY93/k9dKQVl6BZbbJVQkRznH796pyZdPN8c3B KlaJLFiYaDkFlRSUsPcISyOYRa0ML+kXFdQyNp0/I6CK2UMxFjN3fT6VNK6SQyL5KcRY WpFc0tY1cjVKlcMYh2ttSZABjJFBKB/qO8aLDd8vwsVNHoAl5f6T8vXkhdlpBFYvEwsl uWoA== X-Gm-Message-State: AC+VfDziG/swuLjRhtPlvb8DSbEtattkaQkTCDzWSzD8DDwEpBDuRWeA 6cRtZ4uUwGAc+BZy8Q6AHWk= X-Google-Smtp-Source: ACHHUZ4PiExedhiiNp0qLo/UOua0tCni9cce60v18358xqFHAGRhITwr+7v6IRsdRkdk0+e5MUialg== X-Received: by 2002:a17:902:b20e:b0:1a1:d366:b085 with SMTP id t14-20020a170902b20e00b001a1d366b085mr6517084plr.21.1682721318911; Fri, 28 Apr 2023 15:35:18 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id j8-20020a170902690800b001a1b66af22fsm13657847plk.62.2023.04.28.15.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 15:35:18 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Phil Elwell , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , 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 v4 4/5] PCI: brcmstb: Don't assume 2711 bootloader leaves PERST# asserted Date: Fri, 28 Apr 2023 18:34:58 -0400 Message-Id: <20230428223500.23337-5-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230428223500.23337-1-jim2101024@gmail.com> References: <20230428223500.23337-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230428_153520_567612_D7544319 X-CRM114-Status: GOOD ( 14.41 ) 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 The current PCIe driver assumes PERST# is asserted when probe() is invoked. The reasons are as follows: (1) One Broadcom SOC (7278) causes a panic if the PERST# register is written during this time window. (2) If PERST# is deasserted at Linux probe() time, experience and QA suspend/resume tests have shown that some endpoint devices fail if the PERST# is pulsed (deasserted => asserted => deasserted) quickly in this fashion, even though the timing is in accordance with their datasheets. (3) Keeping things in reset tends to save power, if for some reason the PCIe driver is not yet present. Broadcom STB and CM SOCs bootloaders always have PERST# asserted at probe() time. This is not necessarily the case for the 2711/RPi bootloader. In addition, there is a failing test case [1] that may be caused by a deasserted PERST#. Finally, Raspian version of Linux does assert PERST# at probe() time. So, for 2711/RPi SOCs, do what Raspian does and assert PERST#. [1] https://lore.kernel.org/linux-pci/20230411165919.23955-1-jim2101024@gmail.com/T/#m39ebab8bc2827b2304aeeff470a6c6a58f46f987 Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c2cb683447ac..c486f4b979cc 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -884,6 +884,11 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) /* Reset the bridge */ pcie->bridge_sw_init_set(pcie, 1); + + /* Ensure that PERST# is asserted; some bootloaders may deassert it. */ + if (pcie->type == BCM2711) + pcie->perst_set(pcie, 1); + usleep_range(100, 200); /* Take the bridge out of reset */