From patchwork Wed Nov 25 19:24:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 11932085 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBDE0C56201 for ; Wed, 25 Nov 2020 19:26:18 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 450C4206D9 for ; Wed, 25 Nov 2020 19:26:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WePMRhxP"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="ahMRD9Zj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 450C4206D9 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:MIME-Version: Cc:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: References:In-Reply-To:Message-Id:Date:Subject: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=gvtc+pMXxNRVFPJ5/j4/A2zM2kqKKuaVAciNYAedP0E=; b=WePMRhxPansbB8pyaaheYe8Si V0dg2KFeOO9xyHYnwGbHD2mRD4eRrW75jXkC4bXUs6tH+FkmiI3K6P0lA3btXh4vjcChzaSzffCpd rTUtlTd4mZ/V9Ln0kezLfWROB9ChylV+MR/sci9Bk/Sr3w7oWwWsZ5Y8g0DzPdwBLRLxTXwWhL1Lz hjqAuAJ/uNbMNtXKVVRaQWnoZcaecuvOgykqmUzagXbmOTsohh+O9w403jIGY0uZsuGyBS8BEp1mK 0vJnUvZB09lSQfDm95z/mv09FYOhe+M3S6Rr8Lz66IBGvX6LGZ7ydMJyvyYHj2zbpqJUegGPu7Irw NhPe9IVfA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ki0PL-0007Yi-31; Wed, 25 Nov 2020 19:24:51 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ki0P5-0007Ra-Jq for linux-arm-kernel@lists.infradead.org; Wed, 25 Nov 2020 19:24:38 +0000 Received: by mail-pl1-x643.google.com with SMTP id x15so1604417pll.2 for ; Wed, 25 Nov 2020 11:24:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Cq6+CMm3pMneBAa2G2tuygJcPj54fILYBZ5yxHvHwAY=; b=ahMRD9Zjd3nvxgq5FQdT9JJrv9fMV8GIjXbpk3lIbfd4ZjW77Kp8UqmXAKEYx9LJGH pgfk5N2peuyqB877k5H4I3JgnY5+cvGz3TtXftd4Uci8MBVaESUrPcOkLlOiMWN+XJGh VvZxhJFXevWoahtUQlU/YUx+tHamQdeTEh2L4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Cq6+CMm3pMneBAa2G2tuygJcPj54fILYBZ5yxHvHwAY=; b=AU6m4a21Hys25YR1shqWtP1q6xiYS4MQAKRoHxDCYMe0dDXkgLa6vcv/pMz1sYWkjJ di5KVa4v9mR7dmHUhEL9e/wyH27nEZIAhzOSjDsjsK/eoUHbKnUz7t8MmIlnU/ex4fYE QRTa1iGWEwweiqyi3WSSMHp0vzYf/Ov+lbykO6u6rNvGJCCNX1mbcrrajalGGYKFCA/h QAb3jnlaqNP0GJLudu/F1/TC5GqMgk2keJDhf6F559Q22LciM3ouMiQfOkuaCFrJcdex qcij47Pui5OtFM/jBli9xxtum9Py+roU+eHvx7WtScCNQidvlf2IlHR+LLhT0qv1Jkw4 zJtg== X-Gm-Message-State: AOAM532VTraN9V7GXN2ulM52Vk368Wr8uU4KrrgEuMZREDEpaaQj91ze 7HZXtKpq8gQ9MI67wqRvsKJoTQ== X-Google-Smtp-Source: ABdhPJxPLxZb3s/ES5uemueP4EenbHb5P3Owo/n9t/o0K7PrsAAD+FMxSpKgJJODQecG/h9GSI7t7Q== X-Received: by 2002:a17:902:a608:b029:d6:a1fc:ab75 with SMTP id u8-20020a170902a608b02900d6a1fcab75mr4249463plq.18.1606332273173; Wed, 25 Nov 2020 11:24:33 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id j69sm2574885pfd.37.2020.11.25.11.24.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 11:24:32 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Subject: [PATCH v1 1/6] dt-bindings: PCI: Add bindings for Brcmstb EP voltage regulators Date: Wed, 25 Nov 2020 14:24:18 -0500 Message-Id: <20201125192424.14440-2-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201125192424.14440-1-james.quinlan@broadcom.com> References: <20201125192424.14440-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201125_142435_691098_8A019956 X-CRM114-Status: UNSURE ( 8.31 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Florian Fainelli , open list , Rob Herring , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , Bjorn Helgaas , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Quite similar to the regulator bindings found in "rockchip-pcie-host.txt", this allows optional regulators to be attached and controlled by the PCIe RC driver. Signed-off-by: Jim Quinlan --- .../devicetree/bindings/pci/brcm,stb-pcie.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 807694b4f41f..baacc3d7ec87 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -85,6 +85,18 @@ properties: minItems: 1 maxItems: 3 + vpcie12v-supply: + description: 12v regulator phandle for the endpoint device + + vpcie3v3-supply: + description: 3.3v regulator phandle for the endpoint device + + vpcie1v8-supply: + description: 1.8v regulator phandle for the endpoint device + + vpcie0v9-supply: + description: 0.9v regulator phandle for the endpoint device + required: - reg - ranges From patchwork Wed Nov 25 19:24:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 11932089 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E13BC56201 for ; Wed, 25 Nov 2020 19:26:26 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C02F206D9 for ; Wed, 25 Nov 2020 19:26:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QkpXwoLT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="GA0GHbIv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C02F206D9 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:MIME-Version: Cc:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: References:In-Reply-To:Message-Id:Date:Subject: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=yoZ6EXp9G0IrZBjAM4PZ+GoOJRYmW8i4+VnZKhlttAc=; b=QkpXwoLTH4eRkLUEkqAOpDedV D+Z/nt8xiJnyFGeTxqOxkiG0f28ML2aax/YkqxRfR4I7ceIqZQxRZRDOHo6HJGowjgFwJr/aQpm/f dljWkjYvaJQmqBYC+wMtZZ8PmH0AEZeQryUNIubeo7w35PLrmh+hzoVb6p9bOqAZSgtAsZvkLP4k8 91skngZPDFfxxGHpd6rywcM8fyl45swbzmyB499e/kFazfnLUT+aW47ZnvQnuuF8MXVHs81w0Frhl gjJ5GBtM/SckaLt+laH7tigWd4mbsyvrFoioi5Bj65Uh1e++y0BE1DGnuWzDaOGquqePm8jx4+Xyw dnir4koPw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ki0PP-0007ZT-1u; Wed, 25 Nov 2020 19:24:55 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ki0P8-0007TL-Qo for linux-arm-kernel@lists.infradead.org; Wed, 25 Nov 2020 19:24:41 +0000 Received: by mail-pg1-x544.google.com with SMTP id t21so3295291pgl.3 for ; Wed, 25 Nov 2020 11:24:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BRhwvbhkSPXP9BkP9r/Sb25L6PzAegctNZSd3iCYAnE=; b=GA0GHbIvNNepMw/FmeP17rHQLoYKvSarL2fHRQbywpDq7SVMUCiOwQbC2PK2cS5fS/ lTz57XIiZohcpY0KOXyYnUwNKfCRROpGJQncocIACGe9ZasPUF0ZAD1BJEl50bRyRCtV p37DQl356VvdIC1lpfZ3x3H6yjJx4z2Rixyjg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BRhwvbhkSPXP9BkP9r/Sb25L6PzAegctNZSd3iCYAnE=; b=dk/fqDE770YRjgJbpnU+1c9rh2OqAwcAWcfIvbiAaZMI72ro0hDOsrYN79KiZuPe7C YkR/5y/YfBO9MR6SEEWEhYVLo9JBwGt1ni4bzIrCIBTe76epkmB1MaO7WDuvvxkLNcOo bOPMCIxyg57pWiJsP+YGJ1rUC5y2r51aat4Y8+C++KXUuKQusiGfdEiFvkDwVSnFjWAv ajzDGxswYIGbxkUJjWW2sBdHH8iOQh5K4/cK+4x6RWbBG1zg1dKo5LuWMBR4aB1w+9jD P0/Wu/eaTNqXj4AeNhz2jcp8v5JymyW+Tnd8092cMW+nE6UeFphAWFJjn9SYTyutULf4 Wt+Q== X-Gm-Message-State: AOAM5320Oq8UaRv6VrVomesJI36LV3j8dRqoZYrrI+tTXG6jAbNtNMoG P1xtUIZGEqrTky34umGmeFf2jQ== X-Google-Smtp-Source: ABdhPJz6vVcoWrR8yqtqLYtufwlOsd1CczIE/cfJgEho7SPEEGDIbysVzY9piHcqK/7KbaAapHOebg== X-Received: by 2002:aa7:9e88:0:b029:18b:c1b7:a8cd with SMTP id p8-20020aa79e880000b029018bc1b7a8cdmr4480957pfq.21.1606332276224; Wed, 25 Nov 2020 11:24:36 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id j69sm2574885pfd.37.2020.11.25.11.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 11:24:35 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Subject: [PATCH v1 2/6] PCI: brcmstb: Add control of EP voltage regulator(s) Date: Wed, 25 Nov 2020 14:24:19 -0500 Message-Id: <20201125192424.14440-3-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201125192424.14440-1-james.quinlan@broadcom.com> References: <20201125192424.14440-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201125_142439_038974_16077294 X-CRM114-Status: GOOD ( 19.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Lorenzo Pieralisi , Liam Girdwood , open list , Mark Brown , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , Bjorn Helgaas , Florian Fainelli , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Control of EP regulators by the RC is needed because of the chicken-and-egg situation: although the regulator is "owned" by the EP and would be best handled on its driver, the EP cannot be discovered and probed unless its regulator is already turned on. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 66 +++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index bea86899bd5d..34d6bad07b66 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -210,6 +211,18 @@ enum pcie_type { BCM2711, }; +enum pcie_regulators { + VPCIE12V, + VPCIE3V3, + VPCIE1V8, + VPCIE0V9, + PCIE_REGULATORS_MAX, +}; + +static const char *ep_regulator_names[PCIE_REGULATORS_MAX] = { + "vpcie12v", "vpcie3v3", "vpcie1v8", "vpcie0v9", +}; + struct pcie_cfg_data { const int *offsets; const enum pcie_type type; @@ -287,8 +300,53 @@ struct brcm_pcie { u32 hw_rev; void (*perst_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); + struct regulator *regulators[PCIE_REGULATORS_MAX]; + int num_regulators; }; +static int brcm_parse_regulators(struct brcm_pcie *pcie) +{ + struct device *dev = pcie->dev; + struct regulator *ep_reg; + int i; + + for (i = 0; i < PCIE_REGULATORS_MAX; i++) { + ep_reg = devm_regulator_get_optional(dev, ep_regulator_names[i]); + if (IS_ERR(ep_reg)) { + if (PTR_ERR(ep_reg) == -ENODEV) + continue; + dev_err(dev, "failed to get regulator %s\n", ep_regulator_names[i]); + return PTR_ERR(ep_reg); + } + pcie->regulators[i] = ep_reg; + pcie->num_regulators++; + } + return 0; +} + +static void brcm_set_regulators(struct brcm_pcie *pcie, bool on) +{ + struct device *dev = pcie->dev; + int ret, i; + + if (pcie->num_regulators == 0) + return; + + for (i = 0; i < PCIE_REGULATORS_MAX; i++) { + if (!pcie->regulators[i]) + continue; + if (on) { + ret = regulator_enable(pcie->regulators[i]); + dev_dbg(dev, "enable regulator %s (%s)\n", + ep_regulator_names[i], ret ? "fail" : "pass"); + } else { + ret = regulator_disable(pcie->regulators[i]); + dev_dbg(dev, "disable regulator %s (%s)\n", + ep_regulator_names[i], ret ? "fail" : "pass"); + } + } +} + /* * This is to convert the size of the inbound "BAR" region to the * non-linear values of PCIE_X_MISC_RC_BAR[123]_CONFIG_LO.SIZE @@ -1139,6 +1197,7 @@ static int brcm_pcie_suspend(struct device *dev) brcm_pcie_turn_off(pcie); ret = brcm_phy_stop(pcie); clk_disable_unprepare(pcie->clk); + brcm_set_regulators(pcie, false); return ret; } @@ -1151,6 +1210,7 @@ static int brcm_pcie_resume(struct device *dev) int ret; base = pcie->base; + brcm_set_regulators(pcie, true); clk_prepare_enable(pcie->clk); ret = brcm_phy_start(pcie); @@ -1189,6 +1249,7 @@ static void __brcm_pcie_remove(struct brcm_pcie *pcie) brcm_phy_stop(pcie); reset_control_assert(pcie->rescal); clk_disable_unprepare(pcie->clk); + brcm_set_regulators(pcie, false); } static int brcm_pcie_remove(struct platform_device *pdev) @@ -1238,6 +1299,10 @@ static int brcm_pcie_probe(struct platform_device *pdev) pcie->perst_set = data->perst_set; pcie->bridge_sw_init_set = data->bridge_sw_init_set; + ret = brcm_parse_regulators(pcie); + if (ret) + return ret; + pcie->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pcie->base)) return PTR_ERR(pcie->base); @@ -1273,6 +1338,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) return ret; } + brcm_set_regulators(pcie, true); ret = brcm_pcie_setup(pcie); if (ret) goto fail; From patchwork Wed Nov 25 19:24:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 11932091 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EFDBC56201 for ; Wed, 25 Nov 2020 19:26:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E4A43206F9 for ; Wed, 25 Nov 2020 19:26:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iGoc6yrt"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="hwJRq73S" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E4A43206F9 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:MIME-Version: Cc:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: References:In-Reply-To:Message-Id:Date:Subject: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=p3r87chbi470uPW41VBaWRf6gjm2RVZimbPTv4moaBU=; b=iGoc6yrtbAnBd35MS6OeyP6Zn TJg8P2XepnyIwLs1/SGwv4Il8Y2uOKmdByTJToS8laUu1BSkdqI+NkwIeat+jO21dIXkKRnMZvwX/ rJjDamUfXytkLHLdWVqGCBcrAyVc9loGzeWu9LNdq9rTktwLZboptrCN/xnc2xsgVKMjhUGjF3ozc HmQeTRYPsXbF4oCZXaDXBpH530jtUKvND6RdH01893D6TbO/YZ5MSVOPd1K2GoW9qOdoTScNbhGAe ACASJuY45PyiD/+ULAMivtYsXdms1nexnWLRrE6QG1ETCJDG7Cj9Po1hlP4bNj8s4/rUWd2qhsFOR Qdynaoa2g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ki0PU-0007am-6M; Wed, 25 Nov 2020 19:25:00 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ki0PB-0007UJ-GW for linux-arm-kernel@lists.infradead.org; Wed, 25 Nov 2020 19:24:44 +0000 Received: by mail-pg1-x541.google.com with SMTP id t37so3277261pga.7 for ; Wed, 25 Nov 2020 11:24:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8Ker/cLUCvFcQTVqDal3ITxybAYy0DHGsKLfUGSB/pM=; b=hwJRq73SUmnZFGVySDJvGtJXQAMRPRKduDFWLzgcdCF+lKtGntFmeSi+ceaNVSIB7l l5lMuzUvW3Nv45/sGh/xdYfCyjEhGuQ3lZ0aR6cFjHN9u4O/l+3lM32GusK00wpbnCge Jm2ijq6K+6e+LnKAY/btCkD9xqIfjqsjjQ3i8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8Ker/cLUCvFcQTVqDal3ITxybAYy0DHGsKLfUGSB/pM=; b=P6SD8VtIMqOr8y4nxG+KtPRLiqiIq9+c0f9C58nIeGXymGiNvAwMevmseylhmeLFZI avSIDze/DC2enPplKkWnPkLjVn99mYdRDVb+KI/pezABaeD7ZHq2JUTE+53SHSgoLk0l XvP5w4PRooZLc4TX6u8zy3tEj/p9lleqBgfOi+qjXFYnq8pZi7rpDSBTbevJIMRi+pKt PsIfJh+aihSueKQ/1lRtJHISFyIlWXYidw+V6rkivdF5/Z/dhmPdQNIWPImLeiKCLVte s3c9f0NMHS+NA69zwx1hTfISfmu0+jqwVvwd9LqDovtukVnSzp3c/LHSmYdpMzaeJK2b +sQQ== X-Gm-Message-State: AOAM530KUk8l+f2I0ncnmo549XoEl7f59EOBbvmzxUhHRIpeCAsWSRR+ 01A0wDDRYjpp0DVBwGJGgHjMSw== X-Google-Smtp-Source: ABdhPJwposgK3ASJeROd0YtGbYiFsiVaMVGhH8Nra5JbCSHskmj72aQKwqEp1e3OKGMKsuVf8Y0gmg== X-Received: by 2002:a62:768b:0:b029:197:dea6:586e with SMTP id r133-20020a62768b0000b0290197dea6586emr1054436pfc.44.1606332279039; Wed, 25 Nov 2020 11:24:39 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id j69sm2574885pfd.37.2020.11.25.11.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 11:24:38 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Subject: [PATCH v1 3/6] PCI: brcmstb: Do not turn off regulators if EP can wake up Date: Wed, 25 Nov 2020 14:24:20 -0500 Message-Id: <20201125192424.14440-4-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201125192424.14440-1-james.quinlan@broadcom.com> References: <20201125192424.14440-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201125_142441_640057_728B2842 X-CRM114-Status: GOOD ( 16.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Lorenzo Pieralisi , open list , Florian Fainelli , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , Bjorn Helgaas , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If any downstream device may wake up during S2/S3 suspend, we do not want to turn off its power when suspending. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 56 ++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 34d6bad07b66..9b888846f0bc 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -193,6 +193,7 @@ static inline void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 static inline void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val); static inline void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val); static inline void brcm_pcie_perst_set_generic(struct brcm_pcie *pcie, u32 val); +static bool brcm_pcie_link_up(struct brcm_pcie *pcie); enum { RGR1_SW_INIT_1, @@ -302,6 +303,7 @@ struct brcm_pcie { void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); struct regulator *regulators[PCIE_REGULATORS_MAX]; int num_regulators; + bool ep_wakeup_capable; }; static int brcm_parse_regulators(struct brcm_pcie *pcie) @@ -324,18 +326,60 @@ static int brcm_parse_regulators(struct brcm_pcie *pcie) return 0; } -static void brcm_set_regulators(struct brcm_pcie *pcie, bool on) +static int pci_dev_may_wakeup(struct pci_dev *dev, void *data) { + bool *ret = data; + + if (device_may_wakeup(&dev->dev)) { + *ret = true; + dev_dbg(&dev->dev, "disable cancelled for wake-up device\n"); + } + return (int) *ret; +} + +enum { + TURN_OFF, /* Turn egulators off, unless an EP is wakeup-capable */ + TURN_OFF_ALWAYS, /* Turn Regulators off, no exceptions */ + TURN_ON, /* Turn regulators on, unless pcie->ep_wakeup_capable */ +}; + +static void brcm_set_regulators(struct brcm_pcie *pcie, int how) +{ + struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); struct device *dev = pcie->dev; int ret, i; if (pcie->num_regulators == 0) return; + if (how == TURN_ON) { + if (pcie->ep_wakeup_capable) { + /* + * We are resuming from a suspend. In the + * previous suspend we did not disable the power + * supplies, so there is no need to enable them + * (and falsely increase their usage count). + */ + pcie->ep_wakeup_capable = false; + return; + } + } else if (how == TURN_OFF) { + /* + * If at least one device on this bus is enabled as a + * wake-up source, do not turn off regulators. + */ + pcie->ep_wakeup_capable = false; + if (bridge->bus && brcm_pcie_link_up(pcie)) { + pci_walk_bus(bridge->bus, pci_dev_may_wakeup, &pcie->ep_wakeup_capable); + if (pcie->ep_wakeup_capable) + return; + } + } + for (i = 0; i < PCIE_REGULATORS_MAX; i++) { if (!pcie->regulators[i]) continue; - if (on) { + if (how == TURN_ON) { ret = regulator_enable(pcie->regulators[i]); dev_dbg(dev, "enable regulator %s (%s)\n", ep_regulator_names[i], ret ? "fail" : "pass"); @@ -1197,7 +1241,7 @@ static int brcm_pcie_suspend(struct device *dev) brcm_pcie_turn_off(pcie); ret = brcm_phy_stop(pcie); clk_disable_unprepare(pcie->clk); - brcm_set_regulators(pcie, false); + brcm_set_regulators(pcie, TURN_OFF); return ret; } @@ -1210,7 +1254,7 @@ static int brcm_pcie_resume(struct device *dev) int ret; base = pcie->base; - brcm_set_regulators(pcie, true); + brcm_set_regulators(pcie, TURN_ON); clk_prepare_enable(pcie->clk); ret = brcm_phy_start(pcie); @@ -1249,7 +1293,7 @@ static void __brcm_pcie_remove(struct brcm_pcie *pcie) brcm_phy_stop(pcie); reset_control_assert(pcie->rescal); clk_disable_unprepare(pcie->clk); - brcm_set_regulators(pcie, false); + brcm_set_regulators(pcie, TURN_OFF_ALWAYS); } static int brcm_pcie_remove(struct platform_device *pdev) @@ -1338,7 +1382,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) return ret; } - brcm_set_regulators(pcie, true); + brcm_set_regulators(pcie, TURN_ON); ret = brcm_pcie_setup(pcie); if (ret) goto fail; From patchwork Wed Nov 25 19:24:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 11932093 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C2A3C56201 for ; Wed, 25 Nov 2020 19:26:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AAE08206F9 for ; Wed, 25 Nov 2020 19:26:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JEGzZIOY"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="bboQPOK0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AAE08206F9 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:MIME-Version: Cc:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: References:In-Reply-To:Message-Id:Date:Subject: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=U+ekxBNH4IKCSDW+Vpni/UbopTFgxSucK+rt5TZU8f8=; b=JEGzZIOY6MSBOHgrjIwqc8gCz +4wThmpK9U9/PmqlagxfXgDkpTIi5BrJiAxStMVp4zIZdA//fPNkTYLn7pjuocZ5bIaMFb0N6nrSn Si00jlQ84IUk7Q6I0XlwNtcsmImv6K8fQxabOjfH+gRogT3t5THrr1lr2tTKoyzV0Wf72H5ed2G+J 3xCnKUKCldBMPCSE3yG3wVSqrNuNYWQ7dJh2/1LpvVA3zm6zYMf+Y11/rp74ANa4Hcp/fXnA9/7Rp 0aC5PfISByl6QMgXifD3ofdSISm3TrUlVNrSkjvu5T4FoR01XArhogk/ZAuLiAUN39aPYonWHGaKq k3WkFblbA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ki0Pe-0007fM-A7; Wed, 25 Nov 2020 19:25:10 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ki0PE-0007VK-8k for linux-arm-kernel@lists.infradead.org; Wed, 25 Nov 2020 19:24:46 +0000 Received: by mail-pf1-x444.google.com with SMTP id x24so3272956pfn.6 for ; Wed, 25 Nov 2020 11:24:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0r82+/4L79UhQ+PqH/cR19yIxMZLeXEsxYpNXRVD/LY=; b=bboQPOK0CTid/0dUFAwPYMzvMP8fg6kbLTnuIB1c6umXimvCH+V4IZP89CC1bnnzbO alB88CJbOwxrF7QGGq5RHWaF8qG1/uHnxEao6bPYpTtNFFMzHByQjyywXNAnedD/teFL tICAWsi5sqs/vEMMwDuH+Nas4+kv+edc6mqx8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0r82+/4L79UhQ+PqH/cR19yIxMZLeXEsxYpNXRVD/LY=; b=RYhATeBm57NtmOKzZI/N9i6p17FOHGbtqTRqKTkphlUP2Hk7uYuGfwm7CyP2DMox7r b2/y7CzRbTk05cUw0MS+b6PTY6otjjoYFjfswcKoKKrUEiIdpn3/riZGwyCABRnBnPhB t0Nr0BdCIzTEn7Q9E1ajuZh9B8NUYC+ijmJAuDZYUgaTwiWff2P8YwX/5VJI1lhTfXP/ ShB0r8R8eY+95KAE8O4evP3YbdkoUXnasiCuEjDw2L0rPcAvOeJJxHbMOK06ooH7Iuo1 jnXw7bIb0d+pMoSxSe85Oew0qKwzCIWqMLzqvGXqOr+Ab9p0l8VRpqm/AYB6D2PoFmab f4ig== X-Gm-Message-State: AOAM532CLHjb2FVRb4CWw+cq5DUBEiyC8GTjRxMAELAL53rsM5NHph/q rvqpt6Jdul6dUdIK+6CtKjilwA== X-Google-Smtp-Source: ABdhPJxmwsEH5Ovf3XcqoVcZ7u8ynG5VfIqXXe29N/D0KNNuLm418XkTPxyuYMw+tKAdJcn8nbUYhw== X-Received: by 2002:a63:7943:: with SMTP id u64mr4212799pgc.139.1606332281763; Wed, 25 Nov 2020 11:24:41 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id j69sm2574885pfd.37.2020.11.25.11.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 11:24:41 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Subject: [PATCH v1 4/6] PCI: brcmstb: Give 7216 SOCs their own config type Date: Wed, 25 Nov 2020 14:24:21 -0500 Message-Id: <20201125192424.14440-5-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201125192424.14440-1-james.quinlan@broadcom.com> References: <20201125192424.14440-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201125_142444_422738_96BA8D7A X-CRM114-Status: GOOD ( 12.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Lorenzo Pieralisi , open list , Florian Fainelli , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , Bjorn Helgaas , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This distinction is required for an imminent commit. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 9b888846f0bc..e39bd93790d0 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -264,6 +264,13 @@ static const struct pcie_cfg_data bcm2711_cfg = { .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, }; +static const struct pcie_cfg_data bcm7216_cfg = { + .offsets = pcie_offset_bcm7278, + .type = BCM7278, + .perst_set = brcm_pcie_perst_set_7278, + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, +}; + struct brcm_msi { struct device *dev; void __iomem *base; @@ -1312,7 +1319,7 @@ static const struct of_device_id brcm_pcie_match[] = { { .compatible = "brcm,bcm2711-pcie", .data = &bcm2711_cfg }, { .compatible = "brcm,bcm7211-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7278-pcie", .data = &bcm7278_cfg }, - { .compatible = "brcm,bcm7216-pcie", .data = &bcm7278_cfg }, + { .compatible = "brcm,bcm7216-pcie", .data = &bcm7216_cfg }, { .compatible = "brcm,bcm7445-pcie", .data = &generic_cfg }, {}, }; From patchwork Wed Nov 25 19:24:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 11932097 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 678B0C56202 for ; Wed, 25 Nov 2020 19:27:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C13C0206D9 for ; Wed, 25 Nov 2020 19:27:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="py6BSIIo"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="EdYHiQD6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C13C0206D9 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:MIME-Version: Cc:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: References:In-Reply-To:Message-Id:Date:Subject: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=3eQLTdZvcmCdu66xMlJYFNBEvdMDmzI5mQ3a3k0YxBQ=; b=py6BSIIoSxRgLRS50gOnk7Xsr Jr0nfQfx02zVOuux+DTGI0JGgF6KEi53bP70yR3DStRNnWBKhYKDuSkxVNe1Jnp5VqNMrU8WqLqkr k2/6Ur1rX/+tQF+i0shutHYNdsYNzfkdZgS9WItbpNJirvh/XqludpPOJRm6t4HHMgMGXHxmISFN1 3IM4vd4PejzAon1kJQJJhdGUTarIwdrN0bh14ZgJOIEARh7EBYdMVeo6237dvu59sFGEjmH3dzz03 EYvzPf9motdWOP2iAcaKlNacAQny7zuveR3k62tFXBdwIf7Kcct4sezFFwlgUjwqTqKWFlwIDbySO +YDB5Dh/A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ki0QD-0007qZ-Cb; Wed, 25 Nov 2020 19:25:45 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ki0PG-0007WV-Fj for linux-arm-kernel@lists.infradead.org; Wed, 25 Nov 2020 19:24:49 +0000 Received: by mail-pl1-x643.google.com with SMTP id l1so1597127pld.5 for ; Wed, 25 Nov 2020 11:24:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VCHENIV6LpW0D/O/clAQNb0ymY2e5RsE+QbIZTHsBng=; b=EdYHiQD64gzZBqalJL2IuZAs6VRULUS3U6PDcL3KUNcm0sM3QaXASdId9NZ1Hs5Zid nh1rE7Fql/w6kMhsDqQ0UWMWTYVjI6SB6OFwU0QgX4Ey7c9jEY17XFcifetbwMgwrUIv Lumn1/005wzIKR7P+sA4WpD7iK4ONY4EdIc78= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VCHENIV6LpW0D/O/clAQNb0ymY2e5RsE+QbIZTHsBng=; b=KPDPbfihf9OFJuF7VnEzq6Lczd3ANUpNAz6a16M7xWpqOx6/q+PWyXBNW5g2k2UTuJ EFxEmOYakSZfCQxAJilr4OlNza0d2QHKgJEVngiS1gQiUYupu9ZZdsdjMTYJQQpQ3SGl zG27w1Eqc5h9YOYZT4r7vBhL2Ryd9yKiQDI1QYe6hbikFZ3OsSqPk2Te6+0HM9wXvS+t uChxRofIlYA1iz2bk4N5qK4H8kKqcMLL+XpvgRKpZLRjFQZabG3TOKWPdOW8QPt/sEB+ HP5kGcJjfSmbZHMbowc2PEfCZOxMpWMlp+OzqZC3mH4uebcXbqTLomMK7bxIKWuvjgaB wPSw== X-Gm-Message-State: AOAM532UpjDP7y9Ma5du3BU+A1dHEGbqx+JvYQWLGznz7GTmmrMQkpWb 8YPfuBQsau//E0XJKB9r5Bz/pQ== X-Google-Smtp-Source: ABdhPJxo9K/qx7msVFV7THlgW/gfEmTUZfmFLkXYNI+TXH80W8eWDhvgMFuDqSLdJvL7nvnkVOSqFA== X-Received: by 2002:a17:902:a70a:b029:da:1911:4285 with SMTP id w10-20020a170902a70ab02900da19114285mr1006429plq.44.1606332284586; Wed, 25 Nov 2020 11:24:44 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id j69sm2574885pfd.37.2020.11.25.11.24.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 11:24:43 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Subject: [PATCH v1 5/6] PCI: brcmstb: Add panic/die handler to RC driver Date: Wed, 25 Nov 2020 14:24:22 -0500 Message-Id: <20201125192424.14440-6-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201125192424.14440-1-james.quinlan@broadcom.com> References: <20201125192424.14440-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201125_142446_760332_24A42EFD X-CRM114-Status: GOOD ( 18.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Lorenzo Pieralisi , open list , Florian Fainelli , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , Bjorn Helgaas , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Whereas most PCIe HW returns 0xffffffff on illegal accesses and the like, by default Broadcom's STB PCIe controller effects an abort. This simple handler determines if the PCIe controller was the cause of the abort and if so, prints out diagnostic info. Example output: brcm-pcie 8b20000.pcie: Error: Mem Acc: 32bit, Read, @0x38000000 brcm-pcie 8b20000.pcie: Type: TO=0 Abt=0 UnspReq=1 AccDsble=0 BadAddr=0 Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 124 ++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index e39bd93790d0..469bbb0ebdd9 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -12,11 +12,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -187,6 +189,39 @@ #define PCIE_DVT_PMU_PCIE_PHY_CTRL_DAST_PWRDN_MASK 0x1 #define PCIE_DVT_PMU_PCIE_PHY_CTRL_DAST_PWRDN_SHIFT 0x0 +/* Error report regiseters */ +#define PCIE_OUTB_ERR_TREAT 0x6000 +#define PCIE_OUTB_ERR_TREAT_CONFIG_MASK 0x1 +#define PCIE_OUTB_ERR_TREAT_MEM_MASK 0x2 +#define PCIE_OUTB_ERR_VALID 0x6004 +#define PCIE_OUTB_ERR_CLEAR 0x6008 +#define PCIE_OUTB_ERR_ACC_INFO 0x600c +#define PCIE_OUTB_ERR_ACC_INFO_CFG_ERR_MASK 0x01 +#define PCIE_OUTB_ERR_ACC_INFO_MEM_ERR_MASK 0x02 +#define PCIE_OUTB_ERR_ACC_INFO_TYPE_64_MASK 0x04 +#define PCIE_OUTB_ERR_ACC_INFO_DIR_WRITE_MASK 0x10 +#define PCIE_OUTB_ERR_ACC_INFO_BYTE_LANES_MASK 0xff00 +#define PCIE_OUTB_ERR_ACC_ADDR 0x6010 +#define PCIE_OUTB_ERR_ACC_ADDR_BUS_MASK 0xff00000 +#define PCIE_OUTB_ERR_ACC_ADDR_DEV_MASK 0xf8000 +#define PCIE_OUTB_ERR_ACC_ADDR_FUNC_MASK 0x7000 +#define PCIE_OUTB_ERR_ACC_ADDR_REG_MASK 0xfff +#define PCIE_OUTB_ERR_CFG_CAUSE 0x6014 +#define PCIE_OUTB_ERR_CFG_CAUSE_TIMEOUT_MASK 0x40 +#define PCIE_OUTB_ERR_CFG_CAUSE_ABORT_MASK 0x20 +#define PCIE_OUTB_ERR_CFG_CAUSE_UNSUPP_REQ_MASK 0x10 +#define PCIE_OUTB_ERR_CFG_CAUSE_ACC_TIMEOUT_MASK 0x4 +#define PCIE_OUTB_ERR_CFG_CAUSE_ACC_DISABLED_MASK 0x2 +#define PCIE_OUTB_ERR_CFG_CAUSE_ACC_64BIT__MASK 0x1 +#define PCIE_OUTB_ERR_MEM_ADDR_LO 0x6018 +#define PCIE_OUTB_ERR_MEM_ADDR_HI 0x601c +#define PCIE_OUTB_ERR_MEM_CAUSE 0x6020 +#define PCIE_OUTB_ERR_MEM_CAUSE_TIMEOUT_MASK 0x40 +#define PCIE_OUTB_ERR_MEM_CAUSE_ABORT_MASK 0x20 +#define PCIE_OUTB_ERR_MEM_CAUSE_UNSUPP_REQ_MASK 0x10 +#define PCIE_OUTB_ERR_MEM_CAUSE_ACC_DISABLED_MASK 0x2 +#define PCIE_OUTB_ERR_MEM_CAUSE_BAD_ADDR_MASK 0x1 + /* Forward declarations */ struct brcm_pcie; static inline void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val); @@ -229,6 +264,7 @@ struct pcie_cfg_data { const enum pcie_type type; void (*perst_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); + const bool has_err_report; }; static const int pcie_offsets[] = { @@ -269,6 +305,7 @@ static const struct pcie_cfg_data bcm7216_cfg = { .type = BCM7278, .perst_set = brcm_pcie_perst_set_7278, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, + .has_err_report = true, }; struct brcm_msi { @@ -311,8 +348,89 @@ struct brcm_pcie { struct regulator *regulators[PCIE_REGULATORS_MAX]; int num_regulators; bool ep_wakeup_capable; + bool has_err_report; + struct notifier_block die_notifier; }; +/* + * Dump out pcie errors on die or panic. + */ +static int dump_pcie_error(struct notifier_block *self, unsigned long v, void *p) +{ + const struct brcm_pcie *pcie = container_of(self, struct brcm_pcie, die_notifier); + void __iomem *base = pcie->base; + int i, is_cfg_err, is_mem_err, lanes; + char *width_str, *direction_str, lanes_str[9]; + u32 info; + + if (readl(base + PCIE_OUTB_ERR_VALID) == 0) + return NOTIFY_DONE; + info = readl(base + PCIE_OUTB_ERR_ACC_INFO); + + + is_cfg_err = !!(info & PCIE_OUTB_ERR_ACC_INFO_CFG_ERR_MASK); + is_mem_err = !!(info & PCIE_OUTB_ERR_ACC_INFO_MEM_ERR_MASK); + width_str = (info & PCIE_OUTB_ERR_ACC_INFO_TYPE_64_MASK) ? "64bit" : "32bit"; + direction_str = (info & PCIE_OUTB_ERR_ACC_INFO_DIR_WRITE_MASK) ? "Write" : "Read"; + lanes = FIELD_GET(PCIE_OUTB_ERR_ACC_INFO_BYTE_LANES_MASK, info); + for (i = 0, lanes_str[8] = 0; i < 8; i++) + lanes_str[i] = (lanes & (1 << i)) ? '1' : '0'; + + if (is_cfg_err) { + u32 cfg_addr = readl(base + PCIE_OUTB_ERR_ACC_ADDR); + u32 cause = readl(base + PCIE_OUTB_ERR_CFG_CAUSE); + int bus = FIELD_GET(PCIE_OUTB_ERR_ACC_ADDR_BUS_MASK, cfg_addr); + int dev = FIELD_GET(PCIE_OUTB_ERR_ACC_ADDR_DEV_MASK, cfg_addr); + int func = FIELD_GET(PCIE_OUTB_ERR_ACC_ADDR_FUNC_MASK, cfg_addr); + int reg = FIELD_GET(PCIE_OUTB_ERR_ACC_ADDR_REG_MASK, cfg_addr); + + dev_err(pcie->dev, "Error: CFG Acc, %s, %s, Bus=%d, Dev=%d, Fun=%d, Reg=0x%x, lanes=%s\n", + width_str, direction_str, bus, dev, func, reg, lanes_str); + dev_err(pcie->dev, " Type: TO=%d Abt=%d UnsupReq=%d AccTO=%d AccDsbld=%d Acc64bit=%d\n", + !!(cause & PCIE_OUTB_ERR_CFG_CAUSE_TIMEOUT_MASK), + !!(cause & PCIE_OUTB_ERR_CFG_CAUSE_ABORT_MASK), + !!(cause & PCIE_OUTB_ERR_CFG_CAUSE_UNSUPP_REQ_MASK), + !!(cause & PCIE_OUTB_ERR_CFG_CAUSE_ACC_TIMEOUT_MASK), + !!(cause & PCIE_OUTB_ERR_CFG_CAUSE_ACC_DISABLED_MASK), + !!(cause & PCIE_OUTB_ERR_CFG_CAUSE_ACC_64BIT__MASK)); + } + + if (is_mem_err) { + u32 cause = readl(base + PCIE_OUTB_ERR_MEM_CAUSE); + u32 lo = readl(base + PCIE_OUTB_ERR_MEM_ADDR_LO); + u32 hi = readl(base + PCIE_OUTB_ERR_MEM_ADDR_HI); + u64 addr = ((u64)hi << 32) | (u64)lo; + + dev_err(pcie->dev, "Error: Mem Acc, %s, %s, @0x%llx, lanes=%s\n", + width_str, direction_str, addr, lanes_str); + dev_err(pcie->dev, " Type: TO=%d Abt=%d UnsupReq=%d AccDsble=%d BadAddr=%d\n", + !!(cause & PCIE_OUTB_ERR_MEM_CAUSE_TIMEOUT_MASK), + !!(cause & PCIE_OUTB_ERR_MEM_CAUSE_ABORT_MASK), + !!(cause & PCIE_OUTB_ERR_MEM_CAUSE_UNSUPP_REQ_MASK), + !!(cause & PCIE_OUTB_ERR_MEM_CAUSE_ACC_DISABLED_MASK), + !!(cause & PCIE_OUTB_ERR_MEM_CAUSE_BAD_ADDR_MASK)); + } + + /* Clear the error */ + writel(1, base + PCIE_OUTB_ERR_CLEAR); + + return NOTIFY_DONE; +} + +static void brcm_register_die_notifiers(struct brcm_pcie *pcie) +{ + pcie->die_notifier.notifier_call = dump_pcie_error; + register_die_notifier(&pcie->die_notifier); + atomic_notifier_chain_register(&panic_notifier_list, &pcie->die_notifier); +} + +static void brcm_unregister_die_notifiers(struct brcm_pcie *pcie) +{ + unregister_die_notifier(&pcie->die_notifier); + atomic_notifier_chain_unregister(&panic_notifier_list, &pcie->die_notifier); + pcie->die_notifier.notifier_call = NULL; +} + static int brcm_parse_regulators(struct brcm_pcie *pcie) { struct device *dev = pcie->dev; @@ -1309,6 +1427,8 @@ static int brcm_pcie_remove(struct platform_device *pdev) struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); pci_stop_root_bus(bridge->bus); + if (pcie->has_err_report) + brcm_unregister_die_notifiers(pcie); pci_remove_root_bus(bridge->bus); __brcm_pcie_remove(pcie); @@ -1347,6 +1467,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) pcie->np = np; pcie->reg_offsets = data->offsets; pcie->type = data->type; + pcie->has_err_report = data->has_err_report; pcie->perst_set = data->perst_set; pcie->bridge_sw_init_set = data->bridge_sw_init_set; @@ -1410,6 +1531,9 @@ static int brcm_pcie_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pcie); + if (pcie->has_err_report) + brcm_register_die_notifiers(pcie); + return pci_host_probe(bridge); fail: __brcm_pcie_remove(pcie); From patchwork Wed Nov 25 19:24:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 11932095 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E57CC56201 for ; Wed, 25 Nov 2020 19:26:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A12E62075A for ; Wed, 25 Nov 2020 19:26:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rRE2dscL"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="R1aVelA7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A12E62075A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:MIME-Version: Cc:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: References:In-Reply-To:Message-Id:Date:Subject: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=LpsDW1aY+ztpWEBoC5oeO6r7uVKV1NGugxme/5KlC6I=; b=rRE2dscLZbPfTGC5GnWwP/Dx5 WUnqzDQbxSuupbRubO02qk4NTLNy2+LgxP7RdOgqdDdTrCWKM/pXVaMUCVTUYHE0mRjjH+XggBDaY p0rGfcCi2U1tFZh5ZCMG8BK0M4krbnIBDMsG/bfN0AwuQzv1q2cklO0b1LrXmlAHTpeh95M1HJg9s hyefvt9hx3axCAwiRji+q3dD78raoa0te/nld2O5TZXvC0JEg8PreXObUFrqI7/XoxCl73vi+UgvD xNQvT2hlgxTMvxL6ROk0rNoQDc5EZSSLIhQ1baKz1br7qJxwN9IJVoyczLCS//yn8gmP5kXr0NEs5 QqsJcpG1g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ki0Px-0007mB-U1; Wed, 25 Nov 2020 19:25:29 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ki0PJ-0007XZ-9f for linux-arm-kernel@lists.infradead.org; Wed, 25 Nov 2020 19:24:51 +0000 Received: by mail-pg1-x541.google.com with SMTP id k11so619476pgq.2 for ; Wed, 25 Nov 2020 11:24:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0nxY4iA+yXBWD5TvXuHojDkoiy4xC218NYJE6IGm+U0=; b=R1aVelA7+f7f/DBbBVIH54jFY6gfBxLd2shnDA+kEmm/5MFu26Hszt35SY0XR0u4nT JUuTZz20f8cxD1fvenuGdqGSQeyKyzier3p6JVyxBsb+2qM2N71SP1Uyl5MaXPjrHtnK wx1VhQTPW/2Up5WK8lhYgydsQtj8bpgwucjE8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0nxY4iA+yXBWD5TvXuHojDkoiy4xC218NYJE6IGm+U0=; b=REiqnKNRM+O7VL6sidtaobsxZ1DAZsRAr/iHuiD6yz6feqcQzbRj3roPn5TVhjwSdx bU0BZnpMAuvPMQP0Zd4QW/nPigSdaypDAincRz5mvx3IYD17xV5OOfsJyNCDNIpgrm8B GS9eNw/4zMEajQM4nEldEHDew2ryk+nFfYVKBWVhAVPOA/U32wXggtSvjYSDLbITRjTL eVaNwuavpaqFTauDKZv0dnW+jVTpWKGp9H5BA9erqlnuSpQxj020YvpmG3psK3LWaUAU 7C9T0lAR/2yuw8kSnWAPE0H54SakCo12YDe5nZrxIHLruZ9TWpk7tLfVqyyr6j8/5acq 1vpg== X-Gm-Message-State: AOAM5301I/pFfkdhS9Kw3vRCDtMm46LHhlT+hgm2EoJw+pfavYQpM7C2 4Lm55i2Sopz4aSlL8B1vHWAyOw== X-Google-Smtp-Source: ABdhPJzZB+z5HZ0U9Yq+r9Hs5Zij93+M5LaBi35+NENiriad4Dzsn20S54J8IQmFMiE+G0cuFg3aVw== X-Received: by 2002:a17:90a:ba84:: with SMTP id t4mr5062420pjr.110.1606332287495; Wed, 25 Nov 2020 11:24:47 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id j69sm2574885pfd.37.2020.11.25.11.24.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 11:24:46 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Subject: [PATCH v1 6/6] PCI: brcmstb: check return value of clk_prepare_enable() Date: Wed, 25 Nov 2020 14:24:23 -0500 Message-Id: <20201125192424.14440-7-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201125192424.14440-1-james.quinlan@broadcom.com> References: <20201125192424.14440-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201125_142449_506524_3806391F X-CRM114-Status: GOOD ( 11.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Lorenzo Pieralisi , open list , Florian Fainelli , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , Bjorn Helgaas , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The check was missing on PCIe resume. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 469bbb0ebdd9..56c88d2b4f87 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1380,7 +1380,9 @@ static int brcm_pcie_resume(struct device *dev) base = pcie->base; brcm_set_regulators(pcie, TURN_ON); - clk_prepare_enable(pcie->clk); + ret = clk_prepare_enable(pcie->clk); + if (ret) + return ret; ret = brcm_phy_start(pcie); if (ret)