From patchwork Fri Oct 22 14:06:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12577907 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F9A4C433F5 for ; Fri, 22 Oct 2021 14:10:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2949D6120D for ; Fri, 22 Oct 2021 14:10:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2949D6120D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1bzHWUn1MuFAS0DqBqEt1G6QCAm2vvVsyWttF31TtGM=; b=aaB6cNNsO1H3ZL wY9T7MYxV2Ajqwpz1oXbMDhzROIVsvdujt3t/5nSnrUIzPWD//KY3enPmnNmeGfmH+BSqkWo4tpE1 4d0nHYCQhNQoSFMqoPVSmFe3Im+nL+ozWRKtUTyxKBErnbWgKFlHzArZX1GbQtPwLdwKSxXfNDLCN OmYlH2suKN/R638AafpWwaHYobx9NPuFmsZEzihxes8HaqNE7uD8YLZh4OhzTJDEPckn3ge73KEw1 V2VpDoLilnL8kFRA1RK8y1z4bdhtiTC8ppzHjSI5WddoSGvZm+XffhUHMXSPihKvdqwD+y/V+EGIz 8pc1e9oKJptQfVwuqGaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdvCq-00BBrT-A7; Fri, 22 Oct 2021 14:07:36 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdvCd-00BBp5-Ds; Fri, 22 Oct 2021 14:07:25 +0000 Received: by mail-pl1-x62b.google.com with SMTP id i5so2772811pla.5; Fri, 22 Oct 2021 07:07:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Bsq6iuwj06pXXhljM7U8duGAiebZpibGfx/z6iMK0J4=; b=C3oxmrJLdQJyvbXE2u/UmMh56GtIKnVFUbbbek+adMcBUXo2Jsx5Bp0OK86COwfYjl 6oNXF6MQkJdRLBop4PBpT74JWoeLF6CvL77w1AqwE/EqQGfbzF8AV1ER1KQhE7e4e8E4 9HQYVZiaFnsb9tiT/nFRte1xEudbuvXxGc1c/kp9PZhRParOR8Dm/H8kAIUZjNJtuqew wdnEvZHd7XGsJnPIwIBEV8huYFWG37tomRsnZaK3ZxLT0kSZ4UNa2xoAXUPh6JhGDWng B+KYfUxxO3eVcyrSQ7blsSqSMF+/YPpT5qZT7FQJDHcGEFi6m4Gr2jXvDiqkoRMQZ3C9 zrTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Bsq6iuwj06pXXhljM7U8duGAiebZpibGfx/z6iMK0J4=; b=Xgz8j0KKteOCAAWWHKFZrEg83B5I156jrJOJ9OeEv1ReE/OKwdYI6hiBbZNMhIAssE Q/UV81adbnpO0J3suOwnBwRB0xS5uChDzzawhpBDS7i6zlPXrQDDjSbPJNtCYFj/E7mg r1tkSUdM10FYxk8RjEH/MNj/kxfbyN6Zl033iIWM1Xdee6nMw+ek2W3dirtRdQ+FvLwk 7Lzd6Kn0fU9qes+yTUiLkS7p8OCXRYlYxaWM5iRWDVV/OWwv/JAWI4lOjNsmDtuVMKoo js68o69s6qGpD3/dewY5Ca9rZy4aEMtFbETXiZSs1rzJki05i3+Awrihxb2uuOwNQdpl 6Grg== X-Gm-Message-State: AOAM532e40kXyUJBCzOY1CrHAHqATugrdFkqpiPMo1/BwDJ2T/ZES4c3 tjMPaGVFa8vT3bzXOToqGyc= X-Google-Smtp-Source: ABdhPJxdUhmGq4ZRKzaK21X94AipnqDq19/Ap75RlGsTHAeeHI/6xlZ2h4zOKCpYrE7eNmTk8pBTBw== X-Received: by 2002:a17:902:7616:b0:13f:354a:114f with SMTP id k22-20020a170902761600b0013f354a114fmr52600pll.8.1634911642661; Fri, 22 Oct 2021 07:07:22 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id e12sm9482990pfl.67.2021.10.22.07.07.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 07:07:22 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Rob Herring , Mark Brown , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Bjorn Helgaas , Rob Herring , Saenz Julienne , linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE), linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v5 1/6] dt-bindings: PCI: Add bindings for Brcmstb EP voltage regulators Date: Fri, 22 Oct 2021 10:06:54 -0400 Message-Id: <20211022140714.28767-2-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211022140714.28767-1-jim2101024@gmail.com> References: <20211022140714.28767-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211022_070723_493751_EE05990E X-CRM114-Status: UNSURE ( 9.22 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. That being said, this driver searches in the DT subnode (the EP node, eg pci@0,0) for the regulator property. The use of a regulator property in the pcie EP subnode such as "vpcie12v-supply" depends on a pending pullreq to the pci-bus.yaml file at https://github.com/devicetree-org/dt-schema/pull/54 Signed-off-by: Jim Quinlan --- .../bindings/pci/brcm,stb-pcie.yaml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index b9589a0daa5c..fec13e4f6eda 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -154,5 +154,28 @@ examples: <0x42000000 0x1 0x80000000 0x3 0x00000000 0x0 0x80000000>; brcm,enable-ssc; brcm,scb-sizes = <0x0000000080000000 0x0000000080000000>; + + /* PCIe bridge */ + pci@0,0 { + #address-cells = <3>; + #size-cells = <2>; + reg = <0x0 0x0 0x0 0x0 0x0>; + device_type = "pci"; + ranges; + + /* PCIe endpoint */ + pci@0,0 { + device_type = "pci"; + assigned-addresses = <0x82010000 0x0 0xf8000000 0x6 0x00000000 0x0 0x2000>; + reg = <0x0 0x0 0x0 0x0 0x0>; + compatible = "pci14e4,1688"; + vpcie3v3-supply = <&vreg7>; + + #address-cells = <3>; + #size-cells = <2>; + + ranges; + }; + }; }; }; From patchwork Fri Oct 22 14:06:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12577913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C64AEC433F5 for ; Fri, 22 Oct 2021 14:10:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9238661213 for ; Fri, 22 Oct 2021 14:10:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9238661213 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VURrGp7KM+HVDJqZ9gI/nxULunTk+15yvHGtg4M50S8=; b=bgWJqc9S/bon0y V8j410jYLuVr5sKMT755p8/XJn5s4XGLkgqi0zU5ZXqcQQ5g3qCnJqGlOmyxNyzVoD11yZ/M/ONbL rgADdoTw3icU7/p/Sv7CnWfGYJT9Pqc9WBwWdsHFSTKd5qNR7ZmD8dZXGGjT/IHOOSTbSOEI1mz48 Xo3t2CyWw0LFLk12B7Bwo8dLmpH6Og8PoW05IzifugBE7RgtaHdLTdE4/WuvnwqRSHDHr+PYvrq39 xMfOCGMhN/XnOS5k52YkgSE69sGGUSooJh1gry0HQFaV0//hsxJQc4h39jQz/o2KJkGFNkO77w7Lw 9I9rvUVfO/2+pQf2EEog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdvD4-00BBx9-J8; Fri, 22 Oct 2021 14:07:50 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdvCm-00BBqR-4B; Fri, 22 Oct 2021 14:07:33 +0000 Received: by mail-pf1-x436.google.com with SMTP id v8so3710389pfu.11; Fri, 22 Oct 2021 07:07:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+KIUczUS/ZsYc2yKqmHED/7x17icKPInYDTolIdaty0=; b=R5SGZu++CgAI53CDoFpKRRq5pfPpbRWzsDQhASS7V4vht2a8aJA26iGAM6WMSY8/DI iwh/3R/FvCGNziPaSgeMjNtmqoG//S/ugGtHwv7FzwaV+D/6Ts9VQFQ9SMA5cRZPe6A6 7bCbyu8IPjO4jLXNpe59zANpZ3tLFdg9fMiVg5ihOdFiexyP78XUVsCEXGblSkPCcLgK 8IupRQ+hjlwQKGX2iZaduGm4oFG6mwBl0J6c4U6KoUjhDpo6Oys3yb8U3VhSIpD6M4w4 HuNrJg14LPzjgVOWapzHaZbCk0EagD12edxAhjgpGv43/Fl8N1tq0EcBccWfaU35pGGH TIAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+KIUczUS/ZsYc2yKqmHED/7x17icKPInYDTolIdaty0=; b=qq+7Ziemt+FyF0ggHaRjIIgk8U7eKez/MGNM8MVaxRDHczYzF9RciYIy00VMYipER/ w8E6a0GLS4ElR79CYsTQwOw23md/z0tXtQ4S6NfVHnPrn6Ucn1ewu3UyibYfxvnQmyZo EHzuzws8pDJCa9PME4MSvQF42OWY9WXbok2iihCyfM+GbQ1htTx5TjsFYiCywKEgxQxO xOwymMSRg5nzETDT07XPxPBmQsHoTqxJWvr16ED5uSDwVrT8UhevR6dVuLHL8gaZyg0a sNbijp9nJpzvdKYg4BV4O50DyvzxBe2Xo0/cyKzOmJ0ESxVo0kNLXrDkCKXEhG4m6x+5 eb6A== X-Gm-Message-State: AOAM532MvQ9BkZaIS7xE4RalLe/Fwnb8KSoT19SCtWA1LvBkHqODGZ2A CTalaGmcjEo0Ug0x+SMQMtA= X-Google-Smtp-Source: ABdhPJyEsS1l7Tar/HjbpqhXPB/7RZ8R0mvhJOIAjFQICeySHFB/Iw9Wd2lHo3yMnA7UWO/xk/F2AA== X-Received: by 2002:a05:6a00:1309:b0:44d:4d1e:c930 with SMTP id j9-20020a056a00130900b0044d4d1ec930mr12610806pfu.65.1634911649761; Fri, 22 Oct 2021 07:07:29 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id e12sm9482990pfl.67.2021.10.22.07.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 07:07:29 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Rob Herring , Mark Brown , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v5 3/6] PCI: brcmstb: split brcm_pcie_setup() into two funcs Date: Fri, 22 Oct 2021 10:06:56 -0400 Message-Id: <20211022140714.28767-4-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211022140714.28767-1-jim2101024@gmail.com> References: <20211022140714.28767-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211022_070732_196830_3F8D62C1 X-CRM114-Status: GOOD ( 14.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We need to split a function in two so that the driver can take advantage of the recently added function pci_subdev_prepare() which is a member of struct pci_host_bridge. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 30 +++++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index cc30215f5a43..ba4d6daf312c 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -863,17 +863,10 @@ static inline int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie, static int brcm_pcie_setup(struct brcm_pcie *pcie) { - struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); u64 rc_bar2_offset, rc_bar2_size; void __iomem *base = pcie->base; - struct device *dev = pcie->dev; - struct resource_entry *entry; - bool ssc_good = false; - struct resource *res; - int num_out_wins = 0; - u16 nlw, cls, lnksta; - int i, ret, memc; - u32 tmp, burst, aspm_support; + int ret, memc; + u32 tmp, burst; /* Reset the bridge */ pcie->bridge_sw_init_set(pcie, 1); @@ -956,6 +949,21 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) if (pcie->gen) brcm_pcie_set_gen(pcie, pcie->gen); + return 0; +} + +static int brcm_pcie_linkup(struct brcm_pcie *pcie) +{ + struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); + struct device *dev = pcie->dev; + void __iomem *base = pcie->base; + struct resource_entry *entry; + struct resource *res; + int num_out_wins = 0; + u16 nlw, cls, lnksta; + bool ssc_good = false; + u32 aspm_support, tmp; + int ret, i; /* Unassert the fundamental reset */ pcie->perst_set(pcie, 0); @@ -1186,6 +1194,10 @@ static int brcm_pcie_resume(struct device *dev) if (ret) goto err_reset; + ret = brcm_pcie_linkup(pcie); + if (ret) + goto err_reset; + if (pcie->msi) brcm_msi_set_regs(pcie->msi); From patchwork Fri Oct 22 14:06:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12577911 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9182C433FE for ; Fri, 22 Oct 2021 14:10:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AF6EB6120D for ; Fri, 22 Oct 2021 14:10:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AF6EB6120D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8oAYcWrgbrG1SoeIjyWRdh4tpdCxGlLpxol9gS7k8vQ=; b=XgulCi+RVnnLhu 88mMTxTMPlogGeHWtZlgeyoPbk3cDU28t7rxnoXxz1NQTtl2Lsj0KDXn3FG6XFHsdtbSJWPODOCq6 C2m45lASPX8z6Is5C1l5m7Ty8HeweV8AyBOAnXx7SNDHcyLJZDYeTgAFqt6m5qTOvBOYESTjTjAA6 18X7HpTmELNgF25FznAZVg1oNP/UfvboGzEgpDahf661WagKG6UM0vWxsFSJSCkK2UnOFmVxfol2R 0wUa/CDGdSzRs64XD4Hc86hxjJ9KNUXT1uKOwNs1BSxtuEJc5440kKc0utyA+0T/BNICLi/lqtJ7U 2XIYLGlKgCiUzCFkXRIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdvDK-00BC3C-5e; Fri, 22 Oct 2021 14:08:07 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdvCn-00BBqn-2T; Fri, 22 Oct 2021 14:07:34 +0000 Received: by mail-pg1-x52c.google.com with SMTP id t184so3416471pgd.8; Fri, 22 Oct 2021 07:07:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8+7GShJO/vFXregS3LjDBjs7+CHBjOeZ46IIUcz+82c=; b=aD3uV1d1rh3SsCQNd4/bjpuRFgXpnkRF1jXcLQqkp3tzCGhC6SHFtTkh3idy9iuakK 4By1yuPRVYMe9HZg/enPGNAXIF1vMCfuzhFRLKtZDC/+lM5OYQZcWflAHfJBQCmg4wMu PMQgpMXgnJeMVg58ymO2Jp7G0a1UNU8gq4uzADvyUJLRnWbJVVHn+kZE2Iusf3BhU6oT F460+zafzgY0kwlwnFqUNFg9MHFvns6aviYMmLHMIsnUetcDB79cXOX5hXHjhTgBpnlk 75rPhoO/aLsqLMIOyFjSxUOk7u3hQMtxuBqiGcVFPihB/Fs/RXv3e8hF0qveCIvjmmPd F1/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8+7GShJO/vFXregS3LjDBjs7+CHBjOeZ46IIUcz+82c=; b=Hx17mZaFMYcNzgGa2rCQSLEUeuLAYrasMVRVarScblMJGWm9/RO5QLwQvcpCnqnT1S rV7uqLUp/sZExkx8PnADkSbqAmpRA/8IJ2ArQOaV+mOJLSZpkNR34+OSbU7W4EAHCC9T LGRJtuNeih0ZfEbBPanAjUs0iCt8CYPAgNTW/MTu2mRra5eOxf0aRYn9SxzAoh6AuV4U tMonShbRpkpwiQL0eCRqB4SJZRo7J04G1l7qDqKBShUC35ceMad+PJMFaW3kdK3yJ1uL pUhQIC7Ri4SCHeINgYU4zDPCR/uOs3fE+G/oHSDQ3K5JfgffIO6AJ83EJGqXpKTB4+89 lV4A== X-Gm-Message-State: AOAM533f3PRrnjsu4a3HPnSerAJYQSlP+QjJJVtTYoc0FeljEtvnUjkW ByApE6wpfdXcRC61fP3oWg9xK6tW4OdjGw== X-Google-Smtp-Source: ABdhPJwQLhAuM9RJahLcrYBc+wH1UumKiFKoS2YMyYKRw9+SGSh7JIrnTm5XjsuFe2gT/b+99l7U0w== X-Received: by 2002:a63:2cd8:: with SMTP id s207mr9681631pgs.312.1634911652294; Fri, 22 Oct 2021 07:07:32 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id e12sm9482990pfl.67.2021.10.22.07.07.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 07:07:31 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Rob Herring , Mark Brown , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v5 4/6] PCI: brcmstb: Add control of subdevice voltage regulators Date: Fri, 22 Oct 2021 10:06:57 -0400 Message-Id: <20211022140714.28767-5-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211022140714.28767-1-jim2101024@gmail.com> References: <20211022140714.28767-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211022_070733_171195_8B25A399 X-CRM114-Status: GOOD ( 28.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This Broadcom STB PCIe RC driver has one port and connects directly to one device, be it a switch or an endpoint. We want to be able to turn on/off any regulators for that device. Control of regulators is needed because of the chicken-and-egg situation: although the regulator is "owned" by the device and would be best handled by its driver, the device cannot be discovered and probed unless its regulator is already turned on. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 148 +++++++++++++++++++++++++- 1 file changed, 146 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index ba4d6daf312c..35924af1c3aa 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -192,6 +193,13 @@ static inline void brcm_pcie_perst_set_4908(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 const char * const supplies[] = { + "vpcie3v3-supply", + "vpcie3v3aux-supply", + "brcm-ep-a-supply", + "brcm-ep-b-supply", +}; + enum { RGR1_SW_INIT_1, EXT_CFG_INDEX, @@ -295,8 +303,27 @@ 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(supplies)]; + unsigned int num_supplies; }; +static int brcm_set_regulators(struct brcm_pcie *pcie, bool on) +{ + struct device *dev = pcie->dev; + int ret; + + if (!pcie->num_supplies) + return 0; + if (on) + ret = regulator_bulk_enable(pcie->num_supplies, pcie->supplies); + else + ret = regulator_bulk_disable(pcie->num_supplies, pcie->supplies); + if (ret) + dev_err(dev, "failed to %s EP regulators\n", + on ? "enable" : "disable"); + return ret; +} + /* * 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 @@ -1148,6 +1175,55 @@ static void brcm_pcie_turn_off(struct brcm_pcie *pcie) pcie->bridge_sw_init_set(pcie, 1); } +static int brcm_pcie_get_regulators(struct brcm_pcie *pcie, struct pci_dev *dev) +{ + const unsigned int ns = ARRAY_SIZE(supplies); + struct device_node *dn; + struct property *pp; + unsigned int i; + int ret; + + /* This is for Broadcom STB/CM chips only */ + if (pcie->type == BCM2711) + return 0; + + pci_set_of_node(dev); + dn = dev->dev.of_node; + if (!dn) + return 0; + + for_each_property_of_node(dn, pp) { + for (i = 0; i < ns; i++) + if (strcmp(supplies[i], pp->name) == 0) + break; + if (i >= ns || pcie->num_supplies >= ARRAY_SIZE(supplies)) + continue; + + pcie->supplies[pcie->num_supplies++].supply = supplies[i]; + } + + if (pcie->num_supplies == 0) + return 0; + + /* + * We set the name ahead of time as the regulator core expects + * it to exist when regulator_bulk_get() is called. + */ + dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", + pci_domain_nr(dev->bus), + dev->bus->number, PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + /* + * We cannot use devm_regulator_bulk_get() because the + * downstream device may be removed w/o the regulator + * first being disabled by the host bridge. + */ + ret = regulator_bulk_get(&dev->dev, pcie->num_supplies, + pcie->supplies); + + return ret; +} + static int brcm_pcie_suspend(struct device *dev) { struct brcm_pcie *pcie = dev_get_drvdata(dev); @@ -1158,7 +1234,7 @@ static int brcm_pcie_suspend(struct device *dev) reset_control_rearm(pcie->rescal); clk_disable_unprepare(pcie->clk); - return ret; + return brcm_set_regulators(pcie, false); } static int brcm_pcie_resume(struct device *dev) @@ -1174,6 +1250,9 @@ static int brcm_pcie_resume(struct device *dev) ret = reset_control_reset(pcie->rescal); if (ret) goto err_disable_clk; + ret = brcm_set_regulators(pcie, true); + if (ret) + goto err_reset; ret = brcm_phy_start(pcie); if (ret) @@ -1217,6 +1296,10 @@ static void __brcm_pcie_remove(struct brcm_pcie *pcie) brcm_phy_stop(pcie); reset_control_rearm(pcie->rescal); clk_disable_unprepare(pcie->clk); + if (pcie->num_supplies) { + (void)brcm_set_regulators(pcie, false); + regulator_bulk_free(pcie->num_supplies, pcie->supplies); + } } static int brcm_pcie_remove(struct platform_device *pdev) @@ -1241,6 +1324,56 @@ static const struct of_device_id brcm_pcie_match[] = { {}, }; +static int brcm_pcie_pci_subdev_prepare(bool query, struct pci_bus *bus, int devfn, + struct pci_host_bridge *bridge, + struct pci_dev *pdev) +{ + struct brcm_pcie *pcie; + int ret = 0; + + /* + * We only care about a device that is directly connected + * to the root complex, ie bus == 1 and slot == 0. + */ + if (query) + return (bus->number == 1 && PCI_SLOT(devfn) == 0); + + + pcie = (struct brcm_pcie *) bridge->sysdata; + ret = brcm_pcie_get_regulators(pcie, pdev); + if (ret) { + pcie->num_supplies = 0; + if (ret != -EPROBE_DEFER) + dev_err(pcie->dev, "failed to get regulators (err=%d)\n", ret); + return ret; + } + + ret = brcm_set_regulators(pcie, true); + if (ret) + goto err_out0; + + ret = brcm_pcie_linkup(pcie); + if (ret) + goto err_out1; + + /* + * dev_set_name() was called in brcm_set_regulators(). Free the + * string it allocated as it will be called again when + * pci_setup_device() is invoked. + */ + kfree_const(pdev->dev.kobj.name); + pdev->dev.kobj.name = NULL; + + return 0; + +err_out1: + brcm_set_regulators(pcie, false); +err_out0: + regulator_bulk_free(pcie->num_supplies, pcie->supplies); + pcie->num_supplies = 0; + return ret; +} + static int brcm_pcie_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node, *msi_np; @@ -1327,12 +1460,23 @@ static int brcm_pcie_probe(struct platform_device *pdev) } } + bridge->pci_subdev_prepare = brcm_pcie_pci_subdev_prepare; bridge->ops = &brcm_pcie_ops; bridge->sysdata = pcie; platform_set_drvdata(pdev, pcie); - return pci_host_probe(bridge); + ret = pci_host_probe(bridge); + if (ret) + goto fail; + + if (!brcm_pcie_link_up(pcie)) { + brcm_pcie_remove(pdev); + return -ENODEV; + } + + return 0; + fail: __brcm_pcie_remove(pcie); return ret; From patchwork Fri Oct 22 14:06:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12577915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 818AFC433FE for ; Fri, 22 Oct 2021 14:11:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C4526124A for ; Fri, 22 Oct 2021 14:11:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4C4526124A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Cb1pWMaIp8kFIfLG16wx8citIKiANCfdOTaSNSClZxs=; b=AjuJtwK8nI44Cy nvlFbiOwlWqbbalvSwnlByLy5VQKUpWGsTlck4+X3yoLvF+J+qg+T5nV0npbxAjlonVKgZy5oDiWX ywdBWBldOHksWwFpyAE0g0wsVteRgzKqeydyYNMEFMDEbO1j/Bj8QyOKX4n/ylRksNbHdm4pBQS49 YwxkdSgMjv8ZMfr7QK4Tkxl/AYPT3HL2IOdxxxGE+H+gZLJljd7xqvdoV9vMl3whd+LQsCw55YpNx VJn+YXuMlO8DkWMaOdEQ30jrUPx/vWq5zO1PiItqbG0H82afKc8Danfoi3MZ3TETzYY8h6gAn9Krg YgRSvy+sM0dmV00xy81Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdvDa-00BC9I-84; Fri, 22 Oct 2021 14:08:22 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdvCp-00BBrc-DK; Fri, 22 Oct 2021 14:07:37 +0000 Received: by mail-pg1-x52b.google.com with SMTP id q5so3415864pgr.7; Fri, 22 Oct 2021 07:07:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1OFqIrT+18a19n7objTdvw3Haq7UJKXHt+0jk9CGrew=; b=NhSB2bAHDpM6mMF01d5U0eL/0XiFzhOfpiCYIEyHu+ctod2WCJ9m/yRZ4wVCwUmO08 0xqarR1YZzFPtvT3Xk7EkOJ4TEvsgOfcFuyWHiyVucvPmSkiL5ZHihtqLjmF+Yr7hWhf R5YSYZt28A6h6iiu+QvFR2wrIZfspQX+msQbm7JQUB2C29zyCtJSb+fPTMdwZbI5OIXd leWMTdvIUbW7+kWg7KVNEtpKewqWRh+NciaP8z5psOfS0h5/C5yOaU4ab7jlA8p6POqQ LJdFPtmYSFbUaIcq6gATySfTseWlujhUPLBxNKRDHt8d51FgyDPb1d8c+4DaeJU5y67o rIsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1OFqIrT+18a19n7objTdvw3Haq7UJKXHt+0jk9CGrew=; b=OrspByeYeBg+jGqgiYxtQ3g3GYqdJTjJ9yEapWB1+DIYCCax+97c3isV0ILsBOhUSd p0Q8tjCaCvCRO9QtB4t2akxZjy0eoTsw24MKJjCs3I0NFJzablWqYX1/DXXr+bPZ0Cif CG4ajYWIlTiqa4EfJqaLNesZwD5PIscJ4ZnofSCzZ26xkGAoWkwVh/40hLiQIoyaTSEE koOGtlY8QXNKuv/y89GEJ+/1HbCNQOBXUUs74AdJM7xEK8B0k3M0sVY56R/ZLaCvVysW 98Fya44rMANfkeOb4DV6iKdKjQSeBYfG+CPSFkbcxUBjuvhJUZM7bVZcEIGEwmPnCJIX ENhQ== X-Gm-Message-State: AOAM533VzeG19MLerOMnAnxfTFE787eg+Sp7itELMPPUzq2YhbZvD5HW Mlv3uStPs3BnsQby0AnCMN/kZ3UZgAwE8A== X-Google-Smtp-Source: ABdhPJxGxUjF1hom1kgQ2Wlvy0rCVgLkb5Yatk+nFFmu0vYBaqDoZMn4pg6f+ZsIfDDNpcsrdMSL2g== X-Received: by 2002:a05:6a00:2484:b0:44d:ce87:3627 with SMTP id c4-20020a056a00248400b0044dce873627mr258943pfv.48.1634911654640; Fri, 22 Oct 2021 07:07:34 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id e12sm9482990pfl.67.2021.10.22.07.07.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 07:07:34 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Rob Herring , Mark Brown , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v5 5/6] PCI: brcmstb: Do not turn off regulators if EP can wake up Date: Fri, 22 Oct 2021 10:06:58 -0400 Message-Id: <20211022140714.28767-6-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211022140714.28767-1-jim2101024@gmail.com> References: <20211022140714.28767-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211022_070735_497730_331E60D2 X-CRM114-Status: GOOD ( 18.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 | 59 +++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 35924af1c3aa..505f74bd1a51 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -192,6 +192,7 @@ static inline void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, static inline void brcm_pcie_perst_set_4908(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); static const char * const supplies[] = { "vpcie3v3-supply", @@ -305,22 +306,65 @@ struct brcm_pcie { void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); struct regulator_bulk_data supplies[ARRAY_SIZE(supplies)]; unsigned int num_supplies; + bool ep_wakeup_capable; }; -static int 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 regulators 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 int 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 (!pcie->num_supplies) return 0; - 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 0; + } + } 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 0; + } + } + + if (how == TURN_ON) ret = regulator_bulk_enable(pcie->num_supplies, pcie->supplies); else ret = regulator_bulk_disable(pcie->num_supplies, pcie->supplies); if (ret) dev_err(dev, "failed to %s EP regulators\n", - on ? "enable" : "disable"); + how == TURN_ON ? "enable" : "disable"); return ret; } @@ -1234,7 +1278,7 @@ static int brcm_pcie_suspend(struct device *dev) reset_control_rearm(pcie->rescal); clk_disable_unprepare(pcie->clk); - return brcm_set_regulators(pcie, false); + return brcm_set_regulators(pcie, TURN_OFF); } static int brcm_pcie_resume(struct device *dev) @@ -1250,7 +1294,8 @@ static int brcm_pcie_resume(struct device *dev) ret = reset_control_reset(pcie->rescal); if (ret) goto err_disable_clk; - ret = brcm_set_regulators(pcie, true); + + ret = brcm_set_regulators(pcie, TURN_ON); if (ret) goto err_reset; @@ -1297,7 +1342,7 @@ static void __brcm_pcie_remove(struct brcm_pcie *pcie) reset_control_rearm(pcie->rescal); clk_disable_unprepare(pcie->clk); if (pcie->num_supplies) { - (void)brcm_set_regulators(pcie, false); + (void)brcm_set_regulators(pcie, TURN_OFF_ALWAYS); regulator_bulk_free(pcie->num_supplies, pcie->supplies); } } @@ -1348,7 +1393,7 @@ static int brcm_pcie_pci_subdev_prepare(bool query, struct pci_bus *bus, int dev return ret; } - ret = brcm_set_regulators(pcie, true); + ret = brcm_set_regulators(pcie, TURN_ON); if (ret) goto err_out0; From patchwork Fri Oct 22 14:06:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12577917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE9C7C433EF for ; Fri, 22 Oct 2021 14:11:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A29160FC4 for ; Fri, 22 Oct 2021 14:11:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8A29160FC4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PJjB4wubrgbqhxT60fWdfSOUmiLypsznJOtA/6ecO6c=; b=0viSReaPk29+jQ FlllFo6Fn1QSxAcYAx8yZ4ht1FYR9iGVbUOKKla8VEY0sALMtMXb/87mrboRnsIUx+QSVTNo6mO8l hncF41K+fPVJQr2kA5JoBHrXmoZfYmei105oXWnp1/t9XGBhz1W6+zpfWMPVTVcwpPOSQTa40q/fn wlkoccvO4J7wXOhEivc7U5UYo6hBbkEDgeV2F69SzWYCtUIZNb4GxSI9/X6bMKnm4YaiIiJwyvBRp UWuo94+dfdV4saXBeMlDN/Dqd5pNTFJ0HJKBmnydDJPaBccGjO1PWXm3nmPmPSvo/8gACPwzkq7T8 l7l9SEEyrZOZVcURTL3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdvEC-00BCNV-8G; Fri, 22 Oct 2021 14:09:00 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdvCs-00BBss-TQ; Fri, 22 Oct 2021 14:07:40 +0000 Received: by mail-pj1-x1030.google.com with SMTP id na16-20020a17090b4c1000b0019f5bb661f9so3188967pjb.0; Fri, 22 Oct 2021 07:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kDRuxXTZJR6dlNhMjzpXR1CtF1FwgepiTBl4EHuvHhs=; b=HV8lT2/xwA8f8cEqJQw8e7GChJRSzrCwluVhEGLrpvqiNk8dpaLiC5YEE+AwjZQn68 NiVdi7dfPblxXo8m5KV/X5xi1CeQt7HqwDq4CdZPSISTms1+1ekp30q3M5wQKurgWD7c Ymt9644S+F4lTqRVNPwsVIplI4xD7WoEQBkGyrDw/cHT8L6U7tRxt5CG0BnjDc1LJhQt XXpKdXGzfUE+pBUoPaPO6CSDkCXqVSDSpdnufAvhmalozb0Ud457CLl/0SLWw10ys9+G 7gf/ek1aEbWxe8xSMIcCXYk+we+TsnOD72gOuCjIGGzSFnk37FqgN7A53csJIGxBZbn0 2Skw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kDRuxXTZJR6dlNhMjzpXR1CtF1FwgepiTBl4EHuvHhs=; b=xXTkKpphD3zYmf/s4Z5J5rg3PNZW3CS+802SstkUtXMq3eDzt0se1H8mrRjl7YXVuY yClUJ+ZifOMb+BJaiOmxaOUquFNciIiwvgVBVnRxlV1Q4dAyr7UuDbUjAHhUef8fe3UB 0VXiZp4FHEBC8sdYKcnAD4OuZ0GKuJUR0lNwtsY7syaUwICQur/x+BnDi/Qjlf2WKuw1 YKJvhdS+6h0BWWjv5e1edYm2oVYG78AoFuKG7dgddyL0S1aF2iBo/ylSgsn7tfPRup8I XnyrQyqsIscBP1CToKHFz1espfJB3g3FYkYgAUcEDYqqXKb9hYTL6GGTXhzM04BMiiIt m5ow== X-Gm-Message-State: AOAM532JTpZw/yp4eMDo+7r+hQFeGKYNkdDTuSWncEYDzc3U5U1T2n+b +jKrxsGuBxt32x7oc9YV8TU= X-Google-Smtp-Source: ABdhPJx6mGnQbFIcb5PCo3TZyUYO50WkwimEZ8VOnm7FVbb6DqmQFH5jPTkKOosBn+OsAibbFK8lZw== X-Received: by 2002:a17:903:120e:b0:138:d732:3b01 with SMTP id l14-20020a170903120e00b00138d7323b01mr11525395plh.21.1634911656887; Fri, 22 Oct 2021 07:07:36 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id e12sm9482990pfl.67.2021.10.22.07.07.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 07:07:36 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Rob Herring , Mark Brown , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v5 6/6] PCI: brcmstb: change brcm_phy_stop() to return void Date: Fri, 22 Oct 2021 10:06:59 -0400 Message-Id: <20211022140714.28767-7-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211022140714.28767-1-jim2101024@gmail.com> References: <20211022140714.28767-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211022_070738_974929_9673DD91 X-CRM114-Status: GOOD ( 12.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We do not use the result of this function so make it void. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 505f74bd1a51..d3e6d9df67b5 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1190,9 +1190,10 @@ static inline int brcm_phy_start(struct brcm_pcie *pcie) return pcie->rescal ? brcm_phy_cntl(pcie, 1) : 0; } -static inline int brcm_phy_stop(struct brcm_pcie *pcie) +static inline void brcm_phy_stop(struct brcm_pcie *pcie) { - return pcie->rescal ? brcm_phy_cntl(pcie, 0) : 0; + if (pcie->rescal) + brcm_phy_cntl(pcie, 0); } static void brcm_pcie_turn_off(struct brcm_pcie *pcie) @@ -1271,10 +1272,9 @@ static int brcm_pcie_get_regulators(struct brcm_pcie *pcie, struct pci_dev *dev) static int brcm_pcie_suspend(struct device *dev) { struct brcm_pcie *pcie = dev_get_drvdata(dev); - int ret; brcm_pcie_turn_off(pcie); - ret = brcm_phy_stop(pcie); + brcm_phy_stop(pcie); reset_control_rearm(pcie->rescal); clk_disable_unprepare(pcie->clk);