From patchwork Thu Nov 9 19:13:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13451656 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 A9223C4167B for ; Thu, 9 Nov 2023 19:14:39 +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-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-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pknit9+vrwZ+JHHBEghsR/8ttWMmYEDlbd0GSNw5PgU=; b=GHmAFP3kwvFjLWs9Q/B7yqpp4w KHaT42LLElfOr8xiwE0MMT+UBH8YNbZDu4PrmcU6qhA/OFAySKyNhE8YCLJ0PYqNeb9wYdNylo4jy WDi9D3xTSFvUAfpfEf0j8vW14V0w7CvjUIfz1GFIgeAmLxUh51wj7IKPYVVaEdZjtQUfA9tkPm4ns r2UDM6VcuQC1RprWunEQZ3PfZBYxn34u1M3N73VPuxYy6O5faHBGH8HO2AZZFC32BPtoJ9QKy/hp+ zpKbebQZdHqAiVm3GC1fVHvOtMf23D0zhoL5N9Mivuz8TOVSGhF2znC4I24jVeooNnTLXy6Xv+19o olMrzy3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r1ATj-0075Mm-2Y; Thu, 09 Nov 2023 19:14:11 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r1ATg-0075Jh-0R for linux-arm-kernel@lists.infradead.org; Thu, 09 Nov 2023 19:14:09 +0000 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-5a9bf4fbd3fso1014050a12.1 for ; Thu, 09 Nov 2023 11:14:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1699557245; x=1700162045; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=ch8mrQrI0dgq+6F3kU1rBaVhFUPE19Alo6ui06R+8So=; b=GVxq3btzHiDu1rq52y/6MuqnXyNstXJ2axLo5lGsA0BVgohXbqSumtzqTdJwRueEc8 sh0av0JHvtynv05yYnyX9Fe9Fdbqb4pSnaYWGRdiZzMk6tegLPaT0t8Uf+GdDO8FkG6T YLYNxQXkPrSHUM5F8A7bOfcBERvjYPLp5JLFA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699557245; x=1700162045; 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=ch8mrQrI0dgq+6F3kU1rBaVhFUPE19Alo6ui06R+8So=; b=M03+Eo3jM+kpwtLqAqR89RCpN1D2EivrL5BdVUCuofnCrL0djzL8MGG9ADZ2gXXyWC VK0NdcLTSsssxkBBIFLY8Fq56WRedYY/0a5kKlBA1xWvB40c/1+h4ySYnljDfAtlpuXL lrd63gofehq+LYAD7GjCpzvuTJt2b1A6iiNikVV9r6H0X5yKf5FV/eRBwd294Mk7X4US fPvHbdvUbtKmgAC5S0RvPhkYNoMSkBCUNAOnRTJQ068oJJcxoZK5CDX305lypZkZ7Hxd Jxtqjm1kfgjUzi0bP8P+tDmG+r0x0kt64xpv+xReCmTgqntrIyTNYsNz86UZhM99tCFp 8g/w== X-Gm-Message-State: AOJu0YwICYHvMZ5wj+SVZd7+R2kqMFDREtBJgtZ2tOdouZjwnF/D5p9u j3ZCFS6hJFCJXebFd8l9+ADY9A== X-Google-Smtp-Source: AGHT+IEeKu000QUnOY8ufASRQnlK20TPw6yuERVkwYldxGsl22CFd1ano6SoYr6eisX00tuZkdW9tw== X-Received: by 2002:a17:90b:4c91:b0:27f:df1e:199e with SMTP id my17-20020a17090b4c9100b0027fdf1e199emr3039866pjb.28.1699557245028; Thu, 09 Nov 2023 11:14:05 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id pj9-20020a17090b4f4900b00282ecb631a9sm124069pjb.25.2023.11.09.11.14.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 11:14:04 -0800 (PST) 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, james.quinlan@broadcom.com Cc: Jim Quinlan , Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE), linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v7 1/3] dt-bindings: PCI: brcmstb: Add property "brcm,clkreq-mode" Date: Thu, 9 Nov 2023 14:13:52 -0500 Message-Id: <20231109191355.27738-2-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231109191355.27738-1-james.quinlan@broadcom.com> References: <20231109191355.27738-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231109_111408_204812_5F3B7937 X-CRM114-Status: GOOD ( 13.45 ) 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 Broadcom STB/CM PCIe HW -- a core that is also used by RPi SOCs -- requires the driver to deliberately place the RC HW one of three CLKREQ# modes. The "brcm,clkreq-mode" property allows the user to override the default setting. If this property is omitted, the default mode shall be "default". Signed-off-by: Jim Quinlan --- .../bindings/pci/brcm,stb-pcie.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 7e15aae7d69e..992b35e915a5 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -64,6 +64,27 @@ properties: aspm-no-l0s: true + brcm,clkreq-mode: + description: A string that determines the operating + clkreq mode of the PCIe RC HW WRT controlling the refclk signal. + There are three different modes -- + "safe", which drives the + refclk signal unconditionally and will work for all devices but does + not provide any power savings; + "no-l1ss" -- which provides Clock Power Management, L0s, and + L1, but cannot provide L1 substate (L1SS) power + savings. If the downstream device connected to the RC is + L1SS capable AND the OS enables L1SS, all PCIe traffic + may abruptly halt, potentially hanging the system; + "default" -- which provides L0s, L1, and L1SS, but not + compliant to provide Clock Power Management; + specifically, may not be able to meet the Tclron max + timing of 400ns as specified in "Dynamic Clock Control", + section 3.2.5.2.2 of the PCIe spec. This situation is + atypical and should happen only with older devices. + $ref: /schemas/types.yaml#/definitions/string + enum: [ safe, no-l1ss, default ] + brcm,scb-sizes: description: u64 giving the 64bit PCIe memory viewport size of a memory controller. There may be up to From patchwork Thu Nov 9 19:13:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13451658 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 C3333C4332F for ; Thu, 9 Nov 2023 19:14:43 +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-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-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MD6HPGBafNCRPrMqR0KWQAaJBpR3aK/r0UW5P3Z46hg=; b=EQ4qEDxyb3Y4BKxmMDiyyEVQXj 05f3BXXNRhRyLgEBixTFZUaICNwH7+ew5RbOE9EpTmbXGUNoKYb96HjkiMNh7/2TXPk1j+Vv1jsWD K5mepnPbhxZohtXyJ6CnneGxvzl7q2AZuy3sc6QxKxZZzjxfRYQvfdPSC0NT6qpeS4EBoWvbUuQvn mi0+/8Up3v3RPjjAPwpNSjW+zORBKoNvYo6EHQtd9J5P7c8a5Ddcjq2pz101oL2BpjLQh/RrOgXFo GShUugBF5l3thjXJ1e8BTBqsQpqn5AFf5GZFI+F/S6VY5ghEJd4wXZ23na+qj3bIVHpDUtsq7vo+1 MZcEvWrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r1ATn-0075P0-1Z; Thu, 09 Nov 2023 19:14:15 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r1ATj-0075L6-0Q for linux-arm-kernel@lists.infradead.org; Thu, 09 Nov 2023 19:14:13 +0000 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5bd85b1939aso929583a12.2 for ; Thu, 09 Nov 2023 11:14:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1699557248; x=1700162048; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=XUtzuwyVljGDpZGSU1PBjcnBvAkRbCp5x7yW8wDGyJ4=; b=OWdeYLPHCBQi7lw2pu5v4pzZjHwscBijq54PMqx9Sv+I1JKHOSmej5ZD6Wlnk3tRuv uR6+cS6jQQQwjrANHaNPgZ0n1XqzPjEje/5/8KBFUxu3u6/G2ie9YJ6bIL0qL6J4/2ps 3O5pGWemPdIDZnAVkB5vhehEpRXWL4TIouOsM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699557248; x=1700162048; 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=XUtzuwyVljGDpZGSU1PBjcnBvAkRbCp5x7yW8wDGyJ4=; b=YlkcKm0W1QCs/tXxacDfHw5bI61BYiE3/G+TM6112GtKzP45F6MKnwI694Tzcidxqp UXY5bARBad6P0scGSItc38mz2kGSbjVFI/uD9ruIFUUKgD722kDHEGj3kePZdcHfmvPZ oNBXfosR6+tRUf1f55ZzJi2mrx71NpXfTjuwZCg9YzlFL5hBrxc/lzqX48y5Jzp6iSxM +3WW/ixfdSpvzJs9yK+iP/B/PzlwrZaf/C1J9Oe2GUZMqrcaTpeTe4unC6qWvLGGXr3P 09wxTN1AW6dGbFrOBWxiURZA/o5OuCorkol7DWj16NBr85oV0CUpraBhp7hmmoGFZPkr 50Vw== X-Gm-Message-State: AOJu0YyxMLM9j/l1Nd7FeLxgnaZNCEBLyKmGCd7Xa/iX5xfXWvSwa52v DI2Lw4yrE5nC5U4wnIpyh6KRvg== X-Google-Smtp-Source: AGHT+IFbDMN3XcDP+WCQ+MCqwQDFoK+t2VBXmAyPT88GE+vPDmT6ZyG5Ec6Dx8qq3L5NTlqh6duAFg== X-Received: by 2002:a17:90a:eb0a:b0:280:509:30c6 with SMTP id j10-20020a17090aeb0a00b00280050930c6mr2484093pjz.46.1699557248151; Thu, 09 Nov 2023 11:14:08 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id pj9-20020a17090b4f4900b00282ecb631a9sm124069pjb.25.2023.11.09.11.14.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 11:14:07 -0800 (PST) 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, james.quinlan@broadcom.com Cc: Jim Quinlan , 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 v7 2/3] PCI: brcmstb: Configure HW CLKREQ# mode appropriate for downstream device Date: Thu, 9 Nov 2023 14:13:53 -0500 Message-Id: <20231109191355.27738-3-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231109191355.27738-1-james.quinlan@broadcom.com> References: <20231109191355.27738-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231109_111411_174952_49231EA6 X-CRM114-Status: GOOD ( 20.94 ) 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 Broadcom STB/CM PCIe HW core, which is also used in RPi SOCs, must be deliberately set by the PCIe RC HW into one of three mutually exclusive modes: "safe" -- No CLKREQ# expected or required, refclk is always provided. This mode should work for all devices but is not be capable of any refclk power savings. "no-l1ss" -- CLKREQ# is expected to be driven by the downstream device for CPM and ASPM L0s and L1. Provides Clock Power Management, L0s, and L1, but cannot provide L1 substate (L1SS) power savings. If the downstream device connected to the RC is L1SS capable AND the OS enables L1SS, all PCIe traffic may abruptly halt, potentially hanging the system. "default" -- Bidirectional CLKREQ# between the RC and downstream device. Provides ASPM L0s, L1, and L1SS, but not compliant to provide Clock Power Management; specifically, may not be able to meet the Tclron max timing of 400ns as specified in "Dynamic Clock Control", section 3.2.5.2.2 of the PCIe spec. This situation is atypical and should happen only with older devices. Previously, this driver always set the mode to "no-l1ss", as almost all STB/CM boards operate in this mode. But now there is interest in activating L1SS power savings from STB/CM customers, which requires "aspm" mode. In addition, a bug was filed for RPi4 CM platform because most devices did not work in "no-l1ss" mode. Note that the mode is specified by the DT property "brcm,clkreq-mode". If this property is omitted, then "default" mode is chosen. Link: https://bugzilla.kernel.org/show_bug.cgi?id=217276 Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 65 ++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index f9dd6622fe10..f45c5d0168d3 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -121,9 +121,12 @@ #define PCIE_MISC_HARD_PCIE_HARD_DEBUG 0x4204 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK 0x2 +#define PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK 0x200000 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000 #define PCIE_BMIPS_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x00800000 - +#define PCIE_CLKREQ_MASK \ + (PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK | \ + PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK) #define PCIE_INTR2_CPU_BASE 0x4300 #define PCIE_MSI_INTR2_BASE 0x4500 @@ -1028,13 +1031,61 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) return 0; } +static void brcm_config_clkreq(struct brcm_pcie *pcie) +{ + static const char err_msg[] = "invalid 'brcm,clkreq-mode' DT string\n"; + const char *mode = "default"; + u32 clkreq_cntl; + int ret; + + ret = of_property_read_string(pcie->np, "brcm,clkreq-mode", &mode); + if (ret && ret != -EINVAL) { + dev_err(pcie->dev, err_msg); + mode = "safe"; + } + + /* Start out assuming safe mode (both mode bits cleared) */ + clkreq_cntl = readl(pcie->base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + clkreq_cntl &= ~PCIE_CLKREQ_MASK; + + if (strcmp(mode, "no-l1ss") == 0) { + /* + * "no-l1ss" -- Provides Clock Power Management, L0s, and + * L1, but cannot provide L1 substate (L1SS) power + * savings. If the downstream device connected to the RC is + * L1SS capable AND the OS enables L1SS, all PCIe traffic + * may abruptly halt, potentially hanging the system. + */ + clkreq_cntl |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK; + } else if (strcmp(mode, "default") == 0) { + /* + * "default" -- Provides L0s, L1, and L1SS, but not + * compliant to provide Clock Power Management; + * specifically, may not be able to meet the Tclron max + * timing of 400ns as specified in "Dynamic Clock Control", + * section 3.2.5.2.2 of the PCIe spec. This situation is + * atypical and should happen only with older devices. + */ + clkreq_cntl |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK; + } else { + /* + * "safe" -- No power savings; refclk is driven by RC + * unconditionally. + */ + if (strcmp(mode, "safe") != 0) + dev_err(pcie->dev, err_msg); + mode = "safe"; + } + writel(clkreq_cntl, pcie->base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + dev_info(pcie->dev, "clkreq-mode set to %s\n", mode); +} + static int brcm_pcie_start_link(struct brcm_pcie *pcie) { struct device *dev = pcie->dev; void __iomem *base = pcie->base; u16 nlw, cls, lnksta; bool ssc_good = false; - u32 tmp; int ret, i; /* Unassert the fundamental reset */ @@ -1059,6 +1110,8 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie) return -ENODEV; } + brcm_config_clkreq(pcie); + if (pcie->gen) brcm_pcie_set_gen(pcie, pcie->gen); @@ -1077,14 +1130,6 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie) pci_speed_string(pcie_link_speed[cls]), nlw, ssc_good ? "(SSC)" : "(!SSC)"); - /* - * Refclk from RC should be gated with CLKREQ# input when ASPM L0s,L1 - * is enabled => setting the CLKREQ_DEBUG_ENABLE field to 1. - */ - tmp = readl(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); - tmp |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK; - writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); - return 0; } From patchwork Thu Nov 9 19:13:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13451657 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 1F03AC4332F for ; Thu, 9 Nov 2023 19:14:41 +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-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-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=a2jMj+7QbqLweYqVn9VIPx1pWN04Za55rnMagVqIqiQ=; b=dWfpHOznnE+kyYTXacx249v/3b SdZYl42GxBLQK5gLzLzs4ViQhN6apMJGfsHZKnJGSO/PsspzWkMCtbVkKBmtG78W2ppnjoc5toD2S XJnWqoVZOrqeo6KHo8LQFuYeU2TI1zO7IQpD7L/6L4IDYgdh3qMNr4RIoqwfmRUuQycgVvVOkpQa9 C6tjJw8n2ZlBlPXf7lJ88b+0JbcLKcGALL2yCFgxa0EvbjUCxEnaBKPqegmXe9jN2Tolv191fw8n8 vbdXUKiWi7DpdXrrGu2O7mRFXUD05YrneJhv3gtVVlNjmyVSJ0VVEPYlyUdUSZx3coNe5JSD/vM1c 62Jt/9cA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r1ATo-0075PV-03; Thu, 09 Nov 2023 19:14:16 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r1ATj-0075Ml-2d for linux-arm-kernel@lists.infradead.org; Thu, 09 Nov 2023 19:14:13 +0000 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-280165bba25so1068661a91.2 for ; Thu, 09 Nov 2023 11:14:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1699557251; x=1700162051; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=pMNAO7vt9vtEHBoS4fHgAyEwo1I6+TQe+Fed6p/pNkQ=; b=CtqBJuWhyfjzgmI3Z1NpLjxYO/hqouSuDJyJiJfyV7EQpcSZt5JdvEVsDigxPSucTZ PXBUM6xnjPlSTrVb9A6dIRnDrK4PDtb2V62jab3sjMPmCKqzf0//jld0KoBk7qdC4cy3 OFEL2KSMnMOu1J9qqsT+/Y73qdTACZLx2cPl8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699557251; x=1700162051; 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=pMNAO7vt9vtEHBoS4fHgAyEwo1I6+TQe+Fed6p/pNkQ=; b=m/hKTngHtKvqVmcZMJTzAhspD9SLXlpjIyQ2Kv8Ua1Miwme0N1uBvd2/pmXESpTii6 3Ay3j5rVbOCIK+E/n+5MiVqEQvVN+fZRLExYRKorrKKxy2XeWb602u9ORxh3VFh5VnWl QZg/OhjR/mKpXwglrBlrE4HVquCvkBC390wQHDy1de7+G2G7ctHpg8sMPys4Z50ii2Aq tloAaxs3jziJ1NnfUasO4YfUtSFgORI/eDTMxVFuJf8dpTB1wyz8loI6H7uB8s868wp0 WWyB6HQZ9j3c1lo60JeQuOiEaXtkfPj4jRhdAUhtXUqPklCwfEchsJ5BkP4BCNFmvRwt +lYA== X-Gm-Message-State: AOJu0YzgCMUDe2lqwD7HZXMvlNYt9+3nVs0K8HJxK0+ubwfzZYnZkWxA A/prsqvdjXDNETYkbD/2RiiuAg== X-Google-Smtp-Source: AGHT+IGr9VprmPbSO0Bq6pzvM7OCgl/VP1LuUfAbpUcm/xZIOExx4XrMUzb881hGGMqiWsezzj6W9w== X-Received: by 2002:a17:90a:d913:b0:280:3a0c:bf73 with SMTP id c19-20020a17090ad91300b002803a0cbf73mr2678933pjv.26.1699557251275; Thu, 09 Nov 2023 11:14:11 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id pj9-20020a17090b4f4900b00282ecb631a9sm124069pjb.25.2023.11.09.11.14.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 11:14:10 -0800 (PST) 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, james.quinlan@broadcom.com Cc: Florian Fainelli , Jim Quinlan , 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 v7 3/3] PCI: brcmstb: Set higher value for internal bus timeout Date: Thu, 9 Nov 2023 14:13:54 -0500 Message-Id: <20231109191355.27738-4-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231109191355.27738-1-james.quinlan@broadcom.com> References: <20231109191355.27738-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231109_111411_875271_84F94930 X-CRM114-Status: GOOD ( 12.82 ) 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 During long periods of the PCIe RC HW being in an L1SS sleep state, there may be a timeout on an internal bus access, even though there may not be any PCIe access involved. Such a timeout will cause a subsequent CPU abort. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index f45c5d0168d3..f82a3e1a843a 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1031,6 +1031,21 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) return 0; } +/* + * This extends the timeout period for an access to an internal bus. This + * access timeout may occur during L1SS sleep periods, even without the + * presence of a PCIe access. + */ +static void brcm_extend_rbus_timeout(struct brcm_pcie *pcie) +{ + /* TIMEOUT register is two registers before RGR1_SW_INIT_1 */ + const unsigned int REG_OFFSET = PCIE_RGR1_SW_INIT_1(pcie) - 8; + u32 timeout_us = 4000000; /* 4 seconds, our setting for L1SS */ + + /* Each unit in timeout register is 1/216,000,000 seconds */ + writel(216 * timeout_us, pcie->base + REG_OFFSET); +} + static void brcm_config_clkreq(struct brcm_pcie *pcie) { static const char err_msg[] = "invalid 'brcm,clkreq-mode' DT string\n"; @@ -1067,6 +1082,7 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie) * atypical and should happen only with older devices. */ clkreq_cntl |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK; + brcm_extend_rbus_timeout(pcie); } else { /* * "safe" -- No power savings; refclk is driven by RC