From patchwork Fri Jul 1 16:27:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12903588 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 78479C43334 for ; Fri, 1 Jul 2022 16:28:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id: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:In-Reply-To:References: List-Owner; bh=dF+8trLocyCH5eiI81QiBjhcSABO3BU3nzGUq7ekEGU=; b=gRDAJzbtSR/hZt RnUxWLPw/0bf/wKhLMlqkFtEyoejokyHENZwFzMs3xJuld0l97ghVogL7L1omGm4vhDP6ZsR36aAn kxDoyyXDAX6Zl4T9B7IPrFJGeo3i6gF1yaSgPv7VzESQMDIAxm9aCqYKnp/ZJt5aTTzGJz88g2F07 BOcGRjrFA51Np57cskmP9Y2DgTpg2orEQTWRqtk63sRRt0eGY0s+9Lc+pQH7rduiYbvvPMrbw7PS8 O59RvKW0ZvJEOifmaYXwW+mEw6LATSySaJWF1hEs7EB1CoB6RhQIxYETJAWzNaxp4eJzF33t7ZCrK CNZd3PxVP85LKaFtD1zQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7JUX-005y7O-O7; Fri, 01 Jul 2022 16:27:37 +0000 Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7JUR-005y4x-BT; Fri, 01 Jul 2022 16:27:35 +0000 Received: by mail-qk1-x72a.google.com with SMTP id n10so2174849qkn.10; Fri, 01 Jul 2022 09:27:29 -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; bh=JJ7doVRZNwpC70V4XQcn4y7lc0hc/wFbR+0jLkxn3As=; b=bd2+z6vZUICl18680/QipZAbBDdU3y+PmJKXBAXU2hDYUvn9+suNyVPOHRHqeNE/SE f45lcn031T4CgSDV4bNGnm8Va7kDiXTR/rDkGKin4toezdT9gymt2rJ/d/r2E8BbLrDa kbrU1q6qcyg3PSzd3kjohrltsRnqGqrsktkeExhrXxZOSOxtnRs+zQ1k9qzlipZy2T5w OSl80Pa0aNUpfzie0iLL1jd+O0ujhAF6okCv/UbUwMbe8Ay98faR71SRUwWm0dUOThAA 9fBMGKZCx5Wy59pEq1GORASdXpFPvRKA7oyiPx0rCootpgAF1GSC3AL9b6BSzNWYGCdf 8SAw== 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; bh=JJ7doVRZNwpC70V4XQcn4y7lc0hc/wFbR+0jLkxn3As=; b=vVcTwF+u1Sslgz6rce+6otMXIWyHoNqlGQKuTUemcs0gyOwwsuTpfrfw3qq9SiF6t9 55a6+sgfe0TvatYGrwFPFqHNdh9niKqyFfTCW0vDgrudjX2ENkiBj2NL2yAOGoY2MgzZ c2UZ73ZqprTYuCS0Jjz2+gBGzpgIYTt66id9IwCO478sTMLdKt++FVGtVBukkNS3F0uB H+IxoMkKo92h7EcEqTvT8H6sYHpWsrEbvA7LkapuwegDpVigyQ/CsISunBcchOrk7DJs NVGjpMjITx3eXVRo938t9ZZv2qVc6REqw2ClYZSh8VM1Mr9JeTb69I2FaZCvvSFgI0uJ anQQ== X-Gm-Message-State: AJIora9XWo1nhsjyg3krBO8yTxGlkwSWgUw+AXM1TKb4vOIjRMUQtvRN DpsRNI+FgxhwYL8rFJvSZi0= X-Google-Smtp-Source: AGRyM1uup+RcgIVrKSFw0ywkVopm8MkjHXuSYY9LS2DicIn1vTCvNwS22beAkHcxzxPGorQlwc88Mw== X-Received: by 2002:a05:620a:15d3:b0:6ae:ea81:76ec with SMTP id o19-20020a05620a15d300b006aeea8176ecmr10952926qkm.617.1656692848760; Fri, 01 Jul 2022 09:27:28 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id w4-20020a05620a424400b006af08c26774sm17316175qko.47.2022.07.01.09.27.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 09:27:28 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list), linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), Rob Herring Subject: [PATCH v1 0/4] PCI: brcmstb: Re-submit reverted patchset Date: Fri, 1 Jul 2022 12:27:21 -0400 Message-Id: <20220701162726.31346-1-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220701_092731_477146_250D8F04 X-CRM114-Status: GOOD ( 13.46 ) 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 A submission [1] was made to enable a PCIe root port to turn on regulators for downstream devices. It was accepted. Months later, a regression was discovered on an RPi CM4 [2]. The patchset was reverted [3] as the fix came too late in the release cycle. The regression in question is triggered only when the PCIe RC DT node has no root port subnode, which is a perfectly reasonsable configuration. The original commits are now being resubmitted with some modifications to fix the regression. The modifcations on the original commits are described below (the SHA is that of the original commit): [830aa6f29f07 PCI: brcmstb: Split brcm_pcie_setup() into two funcs] NOTE: In the originally submitted patchset, this commit introduced a regression that was corrected by a subsequent commit in the same patchset. Let's not do this again. @@ -1411,6 +1411,10 @@ static int brcm_pcie_probe(struct platform_device *pdev) if (ret) goto fail; + ret = brcm_pcie_linkup(pcie); + if (ret) + goto fail; [67211aadcb4b PCI: brcmstb: Add mechanism to turn on subdev regulators] NOTE: Not related to the regression, the regulators must be freed whenever the PCIe tree is dismantled: @@ -507,6 +507,7 @@ static void pci_subdev_regulators_remove_bus(struct pci_bus *bus) if (regulator_bulk_disable(sr->num_supplies, sr->supplies)) dev_err(dev, "failed to disable regulators for downstream device\n"); + regulator_bulk_free(sr->num_supplies, sr->supplies); dev->driver_data = NULL; [93e41f3fca3d PCI: brcmstb: Add control of subdevice voltage regulators] NOTE: If the PCIe RC DT node was missing a Root Port subnode, the PCIe link-up was skipped. This is the regression. Fix it by attempting link-up even if the Root Port DT subnode is missing. @@ -503,11 +503,10 @@ static int pci_subdev_regulators_add_bus(struct pci_bus *bus) static int brcm_pcie_add_bus(struct pci_bus *bus) { - struct device *dev = &bus->dev; struct brcm_pcie *pcie = (struct brcm_pcie *) bus->sysdata; int ret; - if (!dev->of_node || !bus->parent || !pci_is_root_bus(bus->parent)) + if (!bus->parent || !pci_is_root_bus(bus->parent)) return 0; ret = pci_subdev_regulators_add_bus(bus); [1] https://lore.kernel.org/r/20220106160332.2143-1-jim2101024@gmail.com [2] https://bugzilla.kernel.org/show_bug.cgi?id=215925 [3] https://lore.kernel.org/linux-pci/20220511201856.808690-1-helgaas@kernel.org/ Jim Quinlan (4): PCI: brcmstb: Split brcm_pcie_setup() into two funcs PCI: brcmstb: Add mechanism to turn on subdev regulators PCI: brcmstb: oAdd control of subdevice voltage regulators PCI: brcmstb: Do not turn off WOL regulators on suspend drivers/pci/controller/pcie-brcmstb.c | 257 +++++++++++++++++++++++--- 1 file changed, 227 insertions(+), 30 deletions(-) base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56 Tested-by: Florian Fainelli Tested-by: Cyril Brulebois