From patchwork Mon Nov 30 21:11:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 11941309 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=-18.2 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 8D9F3C63777 for ; Mon, 30 Nov 2020 21:13:53 +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 04EE5206A5 for ; Mon, 30 Nov 2020 21:13:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2OZFZnIu"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="XSgmLkFo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04EE5206A5 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=N58H6BLNzuKOAVIxYddADjqfWU/dkrSpPCzkwgjI1oA=; b=2OZFZnIurTaeCP7BepWE1luIO IueFqWZtMBbvJ4IFxIjGrvoIWBUDE4ah7lQsIn6UH1Cek5wJgMPxGSjZjj27of0OCYsESvjh2s7w2 OUFEG/keYyuxA14beyE+VvRKmULTGOfDNixX/BOD66DDS5Dx+B28/aSRW2Z2ruTXWfxuvbviWg7al piRSP64dkZEYKdDDOwWjwZqQKu2Rql3oFiFye1S84qrpXR4YcVNPpO+c5MenWQ2uky+lCNlgFasMG NVyloK5whVl6vsS4kEssaPxeeAIkOUgnl/RzvJa0UtoKFOQ78BLG6NpZCwWmQT+u1BGni8Ny+//Im uh49X4KuA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjqSx-00033t-59; Mon, 30 Nov 2020 21:12:11 +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 1kjqSm-0002zr-1G for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2020 21:12:01 +0000 Received: by mail-pl1-x643.google.com with SMTP id x15so7204072pll.2 for ; Mon, 30 Nov 2020 13:11:59 -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=iMbDlaPhc+ZJiTHxAMNwUu9iym6W9OV5ALquFqinkag=; b=XSgmLkFojV1cLm2j7YwxPEx2QJPFEFOWwknoWw8sf+kpEsR0KxroEFw+fcuaUkCuLD ZV/j/aActW8y1lNZwP8v87oxM1l7Tt7HRJsq/Lnb9W5SwI06T1CODI9h++28XEcdkvtv iXNxDpeIGyvS5tlOQC41KvDYcZQnBbAiSlYN0= 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=iMbDlaPhc+ZJiTHxAMNwUu9iym6W9OV5ALquFqinkag=; b=HUO86Yk0FOBpvWvvh4S4TdAMtKGYp3r5p1CWejDxR96JXSGjB88gkJ+XPjpbJkRmW2 QaaJ/V3KKrMnb2Z9v6saCIMN5F2ujnpoqePyb2+mcsP/tpJokYrXd0WqNTIGxEnJKC4C mB9o7saGrcZpsgixuqQCNVKK299KCWqQUEziXudVdORhBNMIrPxvXa4yRS9U8xnNdGyS TOCD6MCobM0fAPHMKogfExN9SCt9iCndu4Hvej1e74/725bUbhPlPnx/yXizZ/sq6BJf MmfEmyAohkzJQyjAP0ZvG7rGJZwQ7V2FYCnbUkZFH6p13utiZ65f5nOmwl8Esp7a+tZJ bGBw== X-Gm-Message-State: AOAM532Qmn8HLzMn+NOCI1//fuLawjYP2np+nPElaS3cE9jqfCAhlQhf AortCEmbi2mD2ThNlAY8FQjA1Q== X-Google-Smtp-Source: ABdhPJzRQke6uT7FovaEx+L4etK8b5fM8BziYQXO1XKG3Rq6oGVl74ZIKhf5C1mhETLiozT8J0TfnQ== X-Received: by 2002:a17:902:a9cb:b029:d8:fae5:9e9a with SMTP id b11-20020a170902a9cbb02900d8fae59e9amr20836663plr.32.1606770717848; Mon, 30 Nov 2020 13:11:57 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id m7sm18320441pfh.72.2020.11.30.13.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 13:11:57 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , broonie@kernel.org, bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Subject: [PATCH v2 1/6] dt-bindings: PCI: Add bindings for Brcmstb EP voltage regulators Date: Mon, 30 Nov 2020 16:11:38 -0500 Message-Id: <20201130211145.3012-2-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201130211145.3012-1-james.quinlan@broadcom.com> References: <20201130211145.3012-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201130_161200_134462_20E3F525 X-CRM114-Status: UNSURE ( 9.05 ) 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 Mon Nov 30 21:11:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 11941311 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=-18.2 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 9E2B1C64E7B for ; Mon, 30 Nov 2020 21:13:55 +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 2359F206A5 for ; Mon, 30 Nov 2020 21:13:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="z/sx7j1+"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="huWSdInE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2359F206A5 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=3ONOHxn2x7Mq2BfW9IE9K2FCyEinBFN3E1WLXSaL8dE=; b=z/sx7j1+I0BcfKSME9xrNyg1L 2wCj5pHRMSMiGw6vVfU+RddEGSEgtZ0WeX2POa3BtI+9fABh8E6JKJvDqIfJNHlEt5eHz54vI97fT IYgrvLVdY0jM622fhQo7EFPY7g95xRTZ8o/GsG6Oj+Aaxr6PahM/XipzpDeCsR2grrQIk8G3qx/+T Zag/+pL3NUo5f/dAP4zc2s/6NOS9BuvbyMRjDrjPg0UKx5OnW19ScrI7IRB4TZr0/6cbDcW+E8rbV c9zrYhsj7zc1zE4RYPj068QH7oODIbTLYVjAItbSQsRCSKxrvavwZzy9GisLzzkLmSns9gAfOySuk 92ALibItw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjqT4-00036H-U7; Mon, 30 Nov 2020 21:12:19 +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 1kjqSo-00030j-Vn for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2020 21:12:04 +0000 Received: by mail-pg1-x544.google.com with SMTP id w4so10834307pgg.13 for ; Mon, 30 Nov 2020 13:12:02 -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=3VJjLa38ZI0rgPu3uhSRdR5Mh/QW3d4o9OdCq9IPY7U=; b=huWSdInESiGzjYgjqPlJXI8P1LTazuO9gZ0E4HJRxCQDuFVo/yL3qEp/RagfmvOTMR 3sCWs25jNPvoKE0ad4bBZp5gsXwVaK74S8jkACjbryeqNlUyjgMWM8ISVhA25yCTfavR UNWDd/V8ev3nXG3odCXhM5i7zeba1rcOrlMVI= 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=3VJjLa38ZI0rgPu3uhSRdR5Mh/QW3d4o9OdCq9IPY7U=; b=FmcAxraZ/5GcC8UukG/CZ/FvuFQ2enlUNd594XV8XFQekHPuD26BXs1MlkZ2h3nKbU TOXhpDXJMaqpTIxD4gWeSmRVx8BdKrz78ZfxCaekoStz3xwrCh9ok5XS30XgGcP+tnZE xkl6ONnNWl84hFuQOI0SEoOGU6J2H2kEcrUGnibr/Eu0H1ROQZe1CbthPIs6GAN+ebix 10Ha8CTSGPG5V7aJcgD+OtQJc5WEj6QZIErk1gIMsjXkHj9atg1jIpI48gRrVyV0f58t onrFCohbkD8cjGdo600xC34Q+drymWTWHO8pTqNDqvbSP1YYg1WQqf6v9aRbv2GyLHaU UHvQ== X-Gm-Message-State: AOAM533rISgsfSNFvqvPpnWVBVFCw6eqtX1mkMO6SKOM3Ot3edduMlXe xYs2sh3cc1FXG4h7AJwj5V9S4g== X-Google-Smtp-Source: ABdhPJyHBCo7iM248BtvpqWTbsJ0GkYgf/jABwj6sSm8Vv9BQUDHDXCYGUikE3aZ3W10dMjC8J8+ZQ== X-Received: by 2002:a63:1d55:: with SMTP id d21mr19699914pgm.324.1606770720817; Mon, 30 Nov 2020 13:12:00 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id m7sm18320441pfh.72.2020.11.30.13.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 13:12:00 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , broonie@kernel.org, bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Subject: [PATCH v2 2/6] PCI: brcmstb: Add control of EP voltage regulator(s) Date: Mon, 30 Nov 2020 16:11:39 -0500 Message-Id: <20201130211145.3012-3-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201130211145.3012-1-james.quinlan@broadcom.com> References: <20201130211145.3012-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201130_161203_112012_43310EB3 X-CRM114-Status: GOOD ( 17.65 ) 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 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 | 38 ++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index bea86899bd5d..9d4ac42b3bee 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,10 @@ enum pcie_type { BCM2711, }; +static const char * const ep_regulator_names[] = { + "vpcie12v", "vpcie3v3", "vpcie1v8", "vpcie0v9", +}; + struct pcie_cfg_data { const int *offsets; const enum pcie_type type; @@ -287,8 +292,25 @@ 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_bulk_data supplies[ARRAY_SIZE(ep_regulator_names)]; }; +static void brcm_set_regulators(struct brcm_pcie *pcie, bool on) +{ + struct device *dev = pcie->dev; + int ret; + + if (on) + ret = regulator_bulk_enable(ARRAY_SIZE(ep_regulator_names), + pcie->supplies); + else + ret = regulator_bulk_disable(ARRAY_SIZE(ep_regulator_names), + pcie->supplies); + if (ret) + dev_err(dev, "failed to %s EP regulators\n", + on ? "enable" : "disable"); +} + /* * 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 +1161,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 +1174,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 +1213,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) @@ -1218,7 +1243,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) struct pci_host_bridge *bridge; const struct pcie_cfg_data *data; struct brcm_pcie *pcie; - int ret; + int ret, i; bridge = devm_pci_alloc_host_bridge(&pdev->dev, sizeof(*pcie)); if (!bridge) @@ -1246,6 +1271,16 @@ static int brcm_pcie_probe(struct platform_device *pdev) if (IS_ERR(pcie->clk)) return PTR_ERR(pcie->clk); + for (i = 0; i < ARRAY_SIZE(ep_regulator_names); i++) + pcie->supplies[i].supply = ep_regulator_names[i]; + + ret = devm_regulator_bulk_get(pcie->dev, ARRAY_SIZE(ep_regulator_names), + pcie->supplies); + if (ret) { + dev_err(pcie->dev, "failed to get regulators\n"); + return ret; + } + ret = of_pci_get_max_link_speed(np); pcie->gen = (ret < 0) ? 0 : ret; @@ -1273,6 +1308,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 Mon Nov 30 21:11:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 11941313 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=-18.2 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 5F5A4C63777 for ; Mon, 30 Nov 2020 21:14: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 E54802073C for ; Mon, 30 Nov 2020 21:14:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="O0M7tkuz"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="UaTLtG5P" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E54802073C 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=EKKHW2I80BFbL6i7qy23LHl0JSoWxOSNYANRfAROggA=; b=O0M7tkuzP8qK3BWVg6rtrfe9U hxek+/cCmQjwjnB+ySiwHxj1kIKLeaXKAklQ1WtbTcAAB3TgBz/+fHWExlDKxxAMDPmZxcQ1I38JF F3Shkor6qmvbZYdnk3piU8qvGL7E1dnMcQYNzqyUfpPO7sZo31Bgwns6rSfjmvsSvsvVAMvpJBwuu atcti4STOCV5MerpmDp9TYJPABwZFJJOczX5tKgz8bYN7eNWxVCUCUzYceJwfARo1REPTi0aQNH4J lmDiIGQN84u3dkBrzyeBnEy3fgqCq//FOnfvA8hm02U40B3AyqymVQxITB7LofirciDTZn7dO4aum w7dBvDJRQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjqTN-0003BG-QR; Mon, 30 Nov 2020 21:12:37 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjqSs-00031j-0l for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2020 21:12:07 +0000 Received: by mail-pf1-x442.google.com with SMTP id w202so11229170pff.10 for ; Mon, 30 Nov 2020 13:12:05 -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=lRE6nXlSTX/JDIik5RYL7aM0Sq2Cl6+aagZWppbZQ4g=; b=UaTLtG5PnQg/k8Z4297aUG9bKRIW07Glj12KMan6CKpY17KWcwOHvola/AQ5Ivywk4 WfHT14jagjUxAUJ80Oa/A2htiRrnvzJJYzIHxWqJMEyy6UPRpD5B3LX4DZtuqDa7SNFV 2B9Otj8VkMB0qOI/BzH2ABxk4aBceBuEWeHQU= 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=lRE6nXlSTX/JDIik5RYL7aM0Sq2Cl6+aagZWppbZQ4g=; b=WBwbaD3LdFoewMy47oLCmzIjyTBmDOMiBG7d00Q4vxkw3H+bNkNkQgE8yZqfO9EkW0 4/WfUKzBJmzGa3HGcFqn6e+N0s56B3bMW5iW/7fcacezZTcNZ56A/NVvEaTHcDGXCODr 1U8gb9l5/uSu+6Tt0kDCRHOonCrDaTW2UbnREhEqXSNLxSgmF9QZRoTjMGM+kA6JpuC8 Xbv5n+ZtABiOo+01Sdq03pYIXx1Yfo07gzXLixZxQ6y5nPKB7FqV/5s6vJBsJp/CnnJ2 WvBZT5FPW5joZT8ve9MNjoqHLWS383CewWJAws6Hv9mRZbHRaOz4k/ibD9JOXdEO84pz TFxQ== X-Gm-Message-State: AOAM530SlPDGceQRqxJ04XWOUIXJ/PXspnAs9Xh65lWIKMlHV68h93xy W4djp5F1BSb/K8rlqAf+tDahpA== X-Google-Smtp-Source: ABdhPJwMd1CCQvBOAMbqF/0wJd5EeppOZWpk+YTnQgPqG8KZtSB3jjVuH2ZDtwVcb814gD9On3a0lw== X-Received: by 2002:a62:4e15:0:b029:197:98e1:15c4 with SMTP id c21-20020a624e150000b029019798e115c4mr20817960pfb.39.1606770723827; Mon, 30 Nov 2020 13:12:03 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id m7sm18320441pfh.72.2020.11.30.13.12.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 13:12:03 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , broonie@kernel.org, bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Subject: [PATCH v2 3/6] PCI: brcmstb: Do not turn off regulators if EP can wake up Date: Mon, 30 Nov 2020 16:11:40 -0500 Message-Id: <20201130211145.3012-4-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201130211145.3012-1-james.quinlan@broadcom.com> References: <20201130211145.3012-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201130_161206_121172_CCBA5C0D X-CRM114-Status: GOOD ( 17.43 ) 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 | 58 +++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 9d4ac42b3bee..cbdb315d4b2f 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, @@ -293,14 +294,57 @@ struct brcm_pcie { void (*perst_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); struct regulator_bulk_data supplies[ARRAY_SIZE(ep_regulator_names)]; + bool ep_wakeup_capable; }; -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; - if (on) + 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; + } + } + + if (how == TURN_ON) ret = regulator_bulk_enable(ARRAY_SIZE(ep_regulator_names), pcie->supplies); else @@ -308,7 +352,7 @@ static void brcm_set_regulators(struct brcm_pcie *pcie, bool on) pcie->supplies); if (ret) dev_err(dev, "failed to %s EP regulators\n", - on ? "enable" : "disable"); + how == TURN_ON ? "enable" : "disable"); } /* @@ -1161,7 +1205,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; } @@ -1174,7 +1218,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); @@ -1213,7 +1257,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) @@ -1308,7 +1352,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 Mon Nov 30 21:11:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 11941315 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=-18.2 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 5D2CCC64E7B for ; Mon, 30 Nov 2020 21:14:32 +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 E9DE2206A5 for ; Mon, 30 Nov 2020 21:14:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ab8/pUxQ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="SY+7XNLb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E9DE2206A5 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=0gYOelEvNdpUOWJ8xhk2WoDMih3q54MEID3sOJwIQ8o=; b=Ab8/pUxQZq/03Uv8ZHzzzfn7M 06/vtS/dvNh6aXlKDtvtg/RGfOLX8A2+xAfRzXIJKhU5p+p1ZvyiB75x4s9hJ7/0URdX1+ATNI59B csBiGrDRhDRImuSNF4ozG3AuDqVfFdCCVeC6xh8z3/tHBdBk02P2AlWhHi3c2mM1oulKIWyjuxHG1 DyGPD/BcpP4S/OtmbvEWTKxnOU6S4kfubgSVLWO2rZZaCsiJ4vAV9CdguzHfUTbPoiYvBP0PbwuSq 4LpwYpiBr4gxp1oQutJ6dXGhckD1rhee/Hmw3kXwLahmcZCWtVk3rosoTmJk6Zd3d5S4ozEMU7b6e 4Lr3xGruQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjqTa-0003FY-45; Mon, 30 Nov 2020 21:12:50 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjqSu-00032o-Qx for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2020 21:12:09 +0000 Received: by mail-pf1-x441.google.com with SMTP id s21so11214396pfu.13 for ; Mon, 30 Nov 2020 13:12:08 -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=kYEfXBmWaU4ioHHox/z1UnFyfiFOQMIZPl/cH4mtoOI=; b=SY+7XNLbuuuDzkBfMb/rS0Xkq3hjYmI7ZIr+qmtjVO7ym12qfPFTJi65sG0o0+S91g 2BWHYCLLsmJsKfmkrtbTmhS01M6XFsZ8hwu6Er5+EQtqLlAFj41RX6TKvX8iXubzBnrN 3PkpAU5ZFZbIQr4t8QUMDDexmV5iTuXUo/ryg= 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=kYEfXBmWaU4ioHHox/z1UnFyfiFOQMIZPl/cH4mtoOI=; b=FbgWf0bEMtRl1feXsKbYD0WeIhqtjLEFwWcFFq6B2AaDkLAtjdNBpwqRN9njuAc7Cy g7Z63KVZcFlYwEHKXsMo6DQxiBfcLhy3yziXBq11C+XDBsY+WskzXsysQ4+7pDoibY2t zaFVERn5XKJRG87xBqzf3JSF0i7ZIUjyU/ikqSOIFPdFkgOyKNBYTRwfW83/RQV6y2hJ b+V+M1w89VsQJxcLOL8pOZpAFQajHUV3Ss6PQxD0DbTSZ1WfFI17J2z8wOgO1HrT+fRr /WAzUEYJbPHHbfXsTRUjoY4Qpb1mooeA66jYNNk9+DgUiTFawMWQomW4j4wd5rJ7bE5j 2qLw== X-Gm-Message-State: AOAM533IucvbpnXjPxKOUYd2TFD+KPkkTtYU5etKK3DqpN/zgl5SrxHC BQny/T6eg6m5ZHy9AFQFrqW2oQ== X-Google-Smtp-Source: ABdhPJwEtL+25XAnoY7taX1u8+WwMDXA28Roz3MngZVR6qloQjm2YdLePCYz0EAvVgPTRkYE7t0eOg== X-Received: by 2002:a65:679a:: with SMTP id e26mr19025326pgr.394.1606770726690; Mon, 30 Nov 2020 13:12:06 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id m7sm18320441pfh.72.2020.11.30.13.12.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 13:12:06 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , broonie@kernel.org, bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Subject: [PATCH v2 4/6] PCI: brcmstb: Give 7216 SOCs their own config type Date: Mon, 30 Nov 2020 16:11:41 -0500 Message-Id: <20201130211145.3012-5-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201130211145.3012-1-james.quinlan@broadcom.com> References: <20201130211145.3012-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201130_161208_911110_A090A258 X-CRM114-Status: GOOD ( 11.32 ) 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 Acked-by: Florian Fainelli --- 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 cbdb315d4b2f..989e4231d136 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -256,6 +256,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; @@ -1276,7 +1283,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 Mon Nov 30 21:11:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 11941317 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=-18.2 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 795BDC63777 for ; Mon, 30 Nov 2020 21:14:42 +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 EFC1B206A5 for ; Mon, 30 Nov 2020 21:14:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Kb4jkiy8"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="YGggXXeD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EFC1B206A5 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=9Fwz4uGql48KpBfd9JWZhU9ovcG5hfKxXay0sssJPXo=; b=Kb4jkiy8WR2ZSuhnt/z+e/zV6 jpvbCVPYzo2EQNUXr+uit6lw4EIuL5pQCYYSfsWYaHmRLzxFL/khYxiuAgr99vVnKsgOOL4bqU1kr NqwQr65dkZtJF/XA10o/4P+ORVdGxXTbWMaGx33r4NbmS0x1eSVBpouK4UNTeIifWIBFHamTxZyYe hzma+IOMYwwdmv8Bh/EEHtLeyJLXKngsDA1PVw7nIuqDvY7y3ehgCjj6WOb844lYNvAW5DwBpxssP NWZO9RB4cRzdUK6fugRWtwj1CxzOJr876iJ0Yq10BBzZPSykrarMhb+qFkpfCkmOQLnbguaDVY1ga kYLJ2QarA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjqTl-0003Jm-BB; Mon, 30 Nov 2020 21:13:01 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjqSx-00033p-Oz for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2020 21:12:14 +0000 Received: by mail-pg1-x543.google.com with SMTP id e23so5991592pgk.12 for ; Mon, 30 Nov 2020 13:12:11 -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=Y9FXKmqyesmiQqWT1Pfd+FqM5Z7D+OH329eg/fLNhB4=; b=YGggXXeDeYJVv1VTQWW56HUsdFRiajN31KVMieWIiNW07l9Qy7CQWIhnfmzxsV9+Zf R15fOS/82US+BnEZyZSGIKHa4cJeR49VjFBF9Cjecbd/b5Ebl16DyYRtxPUWzjnR6cLY HFjum4FJVeRj3F8q8gZLh4dcqo8JVVIwe27pc= 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=Y9FXKmqyesmiQqWT1Pfd+FqM5Z7D+OH329eg/fLNhB4=; b=sqtdYCi/uh95jnecTYlEt6XDB51PjdgWFTcy+vBgjNzBJ7ekxp03U9SeUin/bZgLZE 2RjcMJBOje3m5T25jAmfX+Jl4Q8+37YpHBUxZ/afw9ojyXosKvmKd+dqnj4rHaYAMw7D fJ4gbsfCs6Ok41Egp2QUwPMFpFUHs0+l/s3cLyC6/vXBfB2x4U8w6wVCiFKfzCpIVlPI pttdas2jKe4omNSPMHEY1qvVeKXJ3+2nGgB+v30mUVnfPTorjVoFDL+ANwsibXcNoYYx HJ0acawQ7bWU0vTPBobpHKw3wXcfnrDP2hqKUqu/Q0Ec1BpDdmiuW9ODGC8dB39KiIRj Vtjg== X-Gm-Message-State: AOAM531goZhJI5nhOM0RdNFsyY5s2HK3yQwQtqIVUALj/Zfm8eqXPWLJ Ws4KjrAel+Qugp4Qiq8E23Dqmw== X-Google-Smtp-Source: ABdhPJzI+S6ukmQQ+R/ravYO3K1ZogEokzd2Ho+ltsG1vwtSKBXC2VvVnG/BUHQ8ssrGYRILJropCw== X-Received: by 2002:a63:ed0b:: with SMTP id d11mr19559963pgi.261.1606770729561; Mon, 30 Nov 2020 13:12:09 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id m7sm18320441pfh.72.2020.11.30.13.12.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 13:12:08 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , broonie@kernel.org, bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Subject: [PATCH v2 5/6] PCI: brcmstb: Add panic/die handler to RC driver Date: Mon, 30 Nov 2020 16:11:42 -0500 Message-Id: <20201130211145.3012-6-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201130211145.3012-1-james.quinlan@broadcom.com> References: <20201130211145.3012-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201130_161211_897591_DF66A296 X-CRM114-Status: GOOD ( 18.91 ) 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 Acked-by: Florian Fainelli --- 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 989e4231d136..3983d6c80769 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); @@ -221,6 +256,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[] = { @@ -261,6 +297,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 { @@ -302,8 +339,89 @@ struct brcm_pcie { void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); struct regulator_bulk_data supplies[ARRAY_SIZE(ep_regulator_names)]; 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 pci_dev_may_wakeup(struct pci_dev *dev, void *data) { bool *ret = data; @@ -1273,6 +1391,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); @@ -1311,6 +1431,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; @@ -1380,6 +1501,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 Mon Nov 30 21:11:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 11941319 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=-18.2 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 03455C64E7B for ; Mon, 30 Nov 2020 21:14:43 +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 91381206A5 for ; Mon, 30 Nov 2020 21:14:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="zvMlEzGg"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="NtIezV3X" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 91381206A5 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=m8yR7nlns9KNKtpJwl5fKU73YrHkTWeirKZrPrGutBM=; b=zvMlEzGgZ1r41fhkNcipuWSOV o4bFSHIOp8uJasMGu251JLgIhvIfLYXU/FSPLVCzCzNdOHYkN6c1bGEV/GuUZOdy09hG1QS9sWNSW /mOIYB1mT7KY+hkCu7VByg5Kg6ket7hreWJa8f+C7s7RJs7C6Tsc7jp0vCC7IU7dLVUEbIPKAOwiE 1gXMpfI0DslAcKg1AEIpQMLT2aWfjPbxzgEbmiGcQf7EUNjHf8iZ4eRpDoFRLCG/KyNLtA+93lRiH SeukcTuQEOo+1nFgSaj3imISjlULLYp9CjXlSbYivMcHf6lqHIKFQDExQwyp3TYaTOBgxOY0ZGJHq EGsoqg+/Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjqTu-0003MT-3t; Mon, 30 Nov 2020 21:13: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 1kjqT0-00034n-R9 for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2020 21:12:16 +0000 Received: by mail-pf1-x444.google.com with SMTP id q10so11267968pfn.0 for ; Mon, 30 Nov 2020 13:12:14 -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=OlG+Ax0WajbFRZsSRshOO0gU0atXG14h4sybs64AuH4=; b=NtIezV3XK+db8Nr82xt7b1U3zH0etQwNaJ6VVuQ0Op+YHKKXOxGkXMNL6qDyVNe1QT 15JsGhKe5hWvHSBiLX/3Ix8Jv5NU50IMH4jUYDyu3Bl9C715mHU1EBzobe9rYlcRY4EB BotrGpg112IZ3ATS3Z3mcaD5eUksfnILEV1K0= 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=OlG+Ax0WajbFRZsSRshOO0gU0atXG14h4sybs64AuH4=; b=EQPCq328IVnSZE72m4aoJp2oAza3CNXnPUP9cqXOzLjBw/Tyuh/76GkZW2CZtDgFNZ z+hkBXt3fu57TZG6sR7UiZivJJD8ZwPLBJYX5Ranrs52s2lPjHEdTblSVgsgQRV54J9j EEi97I5m8vsAbSTMYbh31NG4aheMgKJOLr8ojbsm6ArQEEz4ehaKFJ/daI8mRZmvCwxR eWg5dbBffrDndvUFsf/mw4/grRZkrc0e1XWMwJYoihu8Wa613qEIpGew2OVaxCHzvEGB JGpEhTgOe9z3opy3kv8+pvZWnC0QefFolGxZWsu+/mUyv1caXJPUAB/A4wwMIzuqB8QR ZxHg== X-Gm-Message-State: AOAM531WAd9rTPX+qAFN4FJdX0xULyVVTJecjCHyZYWBcnDJnKHGKIRg 9mGccA8/pnwi0kj4D+8B6YUSzA== X-Google-Smtp-Source: ABdhPJwnZhJZPf1dQz/a2JUEap4CRZ2bjRrjB7x9Fvg3sOSBstb1+LUHlYAkvj2a9XGY/mKZYYyMOw== X-Received: by 2002:a63:6dca:: with SMTP id i193mr13821834pgc.89.1606770732570; Mon, 30 Nov 2020 13:12:12 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id m7sm18320441pfh.72.2020.11.30.13.12.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 13:12:11 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , broonie@kernel.org, bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Subject: [PATCH v2 6/6] PCI: brcmstb: check return value of clk_prepare_enable() Date: Mon, 30 Nov 2020 16:11:43 -0500 Message-Id: <20201130211145.3012-7-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201130211145.3012-1-james.quinlan@broadcom.com> References: <20201130211145.3012-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201130_161214_982995_ABC9F02F X-CRM114-Status: GOOD ( 11.31 ) 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 Acked-by: Florian Fainelli --- 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 3983d6c80769..64cf534e44d0 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1344,7 +1344,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)