From patchwork Fri Jun 23 14:40:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13290768 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 DE5F1EB64DD for ; Fri, 23 Jun 2023 14:42:01 +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=dD8TEzokmvPtHc6E+keIA6DEtZ3c+oF9fcxBFpUF3Qo=; b=S7PXtEsuLxW6E41XYx3L1RPvV9 WoAYDb99bajfYUuRNA0mOC2pxeBW8gC4Iy04PoldHWNJHXtyDSdOGDHOyzyWdTRLsWAx95RErlKho PJSExzjUM82MCEH8WPc6L27aT+ISCaHATTHe1zhc4mGe6tG2Sz4Joe5KRSTM3ymU6GJYUcNvSPGoA UYNMPjPLbAaZIiGY6bovihIBDApH/yu6xrD/vufemeSVHoGv6W3/6thFBFz+wkyQ79ZnCEm/UJfEX weARrJ2R1rYoR9EWnxwfnPFUPC1eKRF/MfW2EhK5H25qGWzNBvWOQ6MwK3POOVPy4JdkdXCmgArFC N+ZA+LXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qChyi-003oVN-2h; Fri, 23 Jun 2023 14:41:36 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qChyV-003oOJ-2v for linux-arm-kernel@bombadil.infradead.org; Fri, 23 Jun 2023 14:41:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description; bh=c7rKGn4/ee/mDhPOx85jTOAepK059364chiKbGoFwQM=; b=qphJsB3B3WY+zBeysNwXkIgkwa e4dCYwfdrbghw0hzuzLqG8i3JjUY7RcY6v1BB/6V4TvpstifFKYccvu3nNOVZY8B45nQtOKWSbpPQ ZAYFohMwPqMiP57QdNG1oIKSLRX/hZXcaI+6ZD/tKrwChvocYOWfbgOG5ssVV2dRHXwWAg9LDXWvz mDCr7MPwe+KeyaoQ0k5gs2tbNc56KU8mkIwHmCgZJrIu/pZZiqxUWSdgU8mnqKvHmQPlCkkD4vtn8 oCGuKgeVkZyhM59e1vWZHOSwJx+/SGuNPU1DwvFk7xiO7i3woZm5xvr8YtCAVWdoyJ4Izli95UWT9 oNkoG6kw==; Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qChyR-002Fjs-1u for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 14:41:22 +0000 Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-763e968b7feso59400485a.3 for ; Fri, 23 Jun 2023 07:41:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1687531271; x=1690123271; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=c7rKGn4/ee/mDhPOx85jTOAepK059364chiKbGoFwQM=; b=YuBXA8lxT1u969TgVHLS8U5a4jkQZcs5ODhKS6Wr4EKjX/QN4JHrEzSDtd57Bg8+HC tPScqwsMd9yDL7oyLG5bSSy6isAsv/iEqIGd8RKOrxY5fwPHHupPNXUEg59Cgzsp31nj x22QNUrKLlJufh+KOy7HGAAsDyB6n7kD6v+r0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687531271; x=1690123271; 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=c7rKGn4/ee/mDhPOx85jTOAepK059364chiKbGoFwQM=; b=RGrq9W6O/MXOgUE0kO0SmkVuaGJ6ZnSSmREaW+dOwoSN9e3Biz0UiOj3Z2Z6crnhiC 4JhQe6U04jaM/Jm4KRNxGvqav2OtnpF5D5cA7cHV1wEE3MTYL0oT3dPpO7+PfSmBquSo UuqhGkwFyv1QxR7CK0Ai682NBmRRNFYw30fzBBH1+qecjTwvRrRIGRve2mSDtdMWjaG7 4KJ0e81yjHrdO+D2v3jzipDLs9JKbtQT5jv90IPgnKbyYPhXrRUXJOYxXL15gG41FGwx PQ8kMHp80Zeyn3fkJ6Fz45PhOkx/Hp3d6+irInHW33vuKnYpaKbSk54iOA8jMB7+IyrZ niCw== X-Gm-Message-State: AC+VfDyHZZZeJzvIw823dO1QDLultwdPZZumoPf48XeJcR3+2CTHv/vH j5xdrtTUv25k0MT6FA+DT9NmdA== X-Google-Smtp-Source: ACHHUZ4VUTc2qoNcrsn8Qp7O9siw73GsqtGEpwTfEu0R/xUCLrc8O1bXbkl3FlCTdDU63D7TU7ARxg== X-Received: by 2002:a05:620a:8290:b0:763:98b4:e81f with SMTP id ox16-20020a05620a829000b0076398b4e81fmr14356285qkn.39.1687531270963; Fri, 23 Jun 2023 07:41:10 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id i18-20020a05620a145200b007625382f4ccsm4564613qkl.69.2023.06.23.07.41.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 07:41:10 -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, 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 v6 3/5] PCI: brcmstb: Set higher value for internal bus timeout Date: Fri, 23 Jun 2023 10:40:56 -0400 Message-Id: <20230623144100.34196-4-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230623144100.34196-1-james.quinlan@broadcom.com> References: <20230623144100.34196-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230623_154119_961626_56EF3DB5 X-CRM114-Status: GOOD ( 12.74 ) 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. So, when "brcm,enable-l1ss" is observed, we increase the timeout value to four seconds instead of using its HW default. Signed-off-by: Jim Quinlan Tested-by: Florian Fainelli --- 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 d30636a725d7..fe0415a98c63 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1034,6 +1034,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) { bool l1ss = of_property_read_bool(pcie->np, "brcm,enable-l1ss"); @@ -1059,6 +1074,7 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie) * of 400ns, as specified in 3.2.5.2.2 of the PCI Express * Mini CEM 2.0 specification. */ + brcm_extend_rbus_timeout(pcie); clkreq_set |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK; dev_info(pcie->dev, "bi-dir CLKREQ# for L1SS power savings"); } else {