From patchwork Fri Oct 29 20:03:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12593681 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 3D31DC433F5 for ; Fri, 29 Oct 2021 20:17:49 +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 018DC60F56 for ; Fri, 29 Oct 2021 20:17:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 018DC60F56 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=YBt0iVLW9x7RkUda30WkpHphrMIS31hnROvGRn5QAwA=; b=nJyOx4RjlNcbf4 oxmCcr3SOULlYU8E4jYZ1nQtGmkZvl7pYeAuVFt1Ahujdyk1M/1WO0AMbqrHKX2+K3YZI+SpXHl4v 1w4YZcoMLRlpqVFUPVYOBABYakmoStFaYnyGgGPgBtFlJvGNPD/4MOQBMsZWTsNYbjLuPGhL5Damm JWD1l+d9YSNjFfbgoCnTgN6m8U2nedT8gEEgjPQ+T3OqTz9rEGKX4JheKT+DY+PRetJvkQ55Tnb59 dkqoxPsfTvnjfCUzZbT73/Dzz+Y5NsTgoLTfplIAdygSQ8Ey5e6ulnjbK97VLV5wFmm/bMBvStdPq 5mE6JdcL9OzwG0Y8kMGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgYHv-00CCpt-IU; Fri, 29 Oct 2021 20:15:45 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgY63-00C9ZD-Ng; Fri, 29 Oct 2021 20:03:29 +0000 Received: by mail-pj1-x1035.google.com with SMTP id om14so7910423pjb.5; Fri, 29 Oct 2021 13:03:27 -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=bTzdKFlLFxjEYXsTCiwTs/u3WhqgR0accwfx+BQVxCI=; b=WXLrJc4CiRZzhTY/aUKgXzjL/YRIDCpia8+QRg5wgkZ+erdxhdGaP+zvm/9sIIZCAq WJbfnkFPMqvqYNWJe+RvA6SR1CvAWIsgYt1/0zIppVDUqIRfXfcpL5LRQzyWX3eEwIqT 3jVjGidOjJ3cg8vLd2OZwvg8Dy2vZ2zTiDLcQsQ68yikhhp3zU2ZGxEkAYYesyXloqBH CqooGtajNNxvdN+4urd9szc0hKrSQDOiExMtVc2as9pAaFKmh4OHsxwM5PsxZLxJLcrj +3/WP/G4xvESLKeyx4e7o50gJVB1LvbSTLW9kxfA/kL9JEIVUd97M0Hh1+tA3VAGBrVh xO4g== 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=bTzdKFlLFxjEYXsTCiwTs/u3WhqgR0accwfx+BQVxCI=; b=7Osy2m3qIC2JLXeEA1rLonZyGxUMIz69yHLPjhYtrP5JSlZzbw5O+9QceHXtNi/97/ rGGB6wQYu2zlYLkF1N0vWWrtZ3O24XIRYuAgabjNjNUUjj37+u20Mz/P6dFuW52oLl9J +m5rBj4oIQzE/lHGO5Lee8L5lcFJpB0DiamroItl9sWbu75hOmbTb7cZg5p0mS2jUgDL T2e4iTLjS+qgThnCBSOXGxTXZGf6SXzCe7R6G4H6uPHpuQaEdUjxCUH80XsmXHDppwM8 rLAnxx3dlxaremSyZVfmI/wKn+g+g8V56QTx+reEgfHIFI4WFcJ/1sVDPjZ9MYUi/Rty 0d/w== X-Gm-Message-State: AOAM533QOWbAKf6/4LDfWodLM9u8q0i5V8hpn31CVhGFwwqjMNg77UDt krxcgkpKN4ZqPzY8IVGj/5k= X-Google-Smtp-Source: ABdhPJxwNDSSmjNeJqV62003+UnO4NwEwDL1ymH1lO6taFm2VcGBtdhV0XI4gNiUZKyjtwz7IDhV0g== X-Received: by 2002:a17:902:6b83:b0:141:6368:3562 with SMTP id p3-20020a1709026b8300b0014163683562mr11401897plk.42.1635537806508; Fri, 29 Oct 2021 13:03:26 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id j16sm8775041pfj.16.2021.10.29.13.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Oct 2021 13:03:26 -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 v6 1/9] dt-bindings: PCI: correct brcmstb interrupts, interrupt-map. Date: Fri, 29 Oct 2021 16:03:09 -0400 Message-Id: <20211029200319.23475-2-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211029200319.23475-1-jim2101024@gmail.com> References: <20211029200319.23475-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211029_130327_844028_186D7E7C X-CRM114-Status: GOOD ( 10.03 ) 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 The "pcie" and "msi" interrupts were given the same interrupt when they are actually different. Interrupt-map only had the INTA entry; the INTB, INTC, and INTD entries are added. Signed-off-by: Jim Quinlan Acked-by: Florian Fainelli Acked-by: Rob Herring --- Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index b9589a0daa5c..508e5dce1282 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -142,11 +142,15 @@ examples: #address-cells = <3>; #size-cells = <2>; #interrupt-cells = <1>; - interrupts = , + interrupts = , ; interrupt-names = "pcie", "msi"; interrupt-map-mask = <0x0 0x0 0x0 0x7>; - interrupt-map = <0 0 0 1 &gicv2 GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>; + interrupt-map = <0 0 0 1 &gicv2 GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH + 0 0 0 2 &gicv2 GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH + 0 0 0 3 &gicv2 GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH + 0 0 0 4 &gicv2 GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>; + msi-parent = <&pcie0>; msi-controller; ranges = <0x02000000 0x0 0xf8000000 0x6 0x00000000 0x0 0x04000000>; From patchwork Fri Oct 29 20:03:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12593687 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 DC174C433EF for ; Fri, 29 Oct 2021 20:20:26 +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 A23456101E for ; Fri, 29 Oct 2021 20:20:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A23456101E 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=+ZxpeiMi5sd7TmeXFWwxdwYqhEQmJUIeIT9RCtfjBa8=; b=EYmaSOc6WbrZVT 8J90Dilka+4ZdoEdXlA1J/Ru0RKSZjO1G6QgHI1VMnwHlPkkFJUk8gy7DAIVkJUwpJS8EhwfsaNNn frzw8SoQyf/HDQ7jz7j3Y70fd+V6LkvT8Y/BtWXNfOENd82uOq2rjHapW6ZmVOemzOOd4UwADqKGq OlldDmv2DUO+mLzx2YCoNGFkk3trGNYafwqiYRcieApA5FHhjHmoocpfVGjWV19a8U3Wyojvymg6g eOHfumSLqB246F7i7Y36g0D5SFcdPVmz6PPANETKyBb81uKpbhs5accbewPxG3CrfpCx6tOJZheNg H9uj5LmIJJBVhDCwOtlg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgYKT-00CDS1-0N; Fri, 29 Oct 2021 20:18:22 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgY66-00C9Zj-3b; Fri, 29 Oct 2021 20:03:31 +0000 Received: by mail-pf1-x432.google.com with SMTP id l1so3765571pfu.5; Fri, 29 Oct 2021 13:03: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:in-reply-to:references; bh=i/xlFeFGzhcgynIWoi7Dy7maGf++a2Lj0CJo9lD52eo=; b=GepHwVrZxe/sGAtgAU8y/aOWlfk5bidJZKMNnGKBvVhd1O0yS5ZYRsSnZs5PEupDOD XFh/8vpZICKn/+OD5sx6PcsEwM5EtZMdAmFgLVXQIfIIIhLe2ht3JKiXYzTcXov15tDs 04O+okmaQnyLH8PY/fX8La0HKBwZD62f2HF+uCsCUifL3BNyYDPOqsojH1eJB3xniGA7 SYpp7Jr/sq+NP1YoXCG7I+/fSy0jhpbjYOALDDOqlzO8TPFTOojDFoiI00a6WzyWLDyT YKa6eyT6ypCyuDBG7ZzQ9JBZhs07SOMpMrw4L/XiweSpu1zZeSMCUsD98qsUZFPe/UiT qZzg== 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=i/xlFeFGzhcgynIWoi7Dy7maGf++a2Lj0CJo9lD52eo=; b=T6PgogTc5EYFzMAlHUgX36ZVF6na750D+MRkBbUduzXJl+AjWmVXxRdooI5zmfdR5C 1D8esXL41WD9q1EmhFBwhgBoR6O2J2ixrstgvf/q9JznlUlLIWN4NqpkFwAPkrr1KwzL FlhwQCi7EDdDpmM3SAD0KGxzVsT7YXs/iOuJk7PDs7GDJ1bRl7TN1RLLaaNmZ9T0hmhV 6Nop21hSu850aKcgBWU1SWDIyhUIOTqhW2Qbljgzc5cUPpyfAjCaY1snWVhIiYbQdyih Zw9VnpbEnct4AZPHZaPTrHNdClWv+lmjPOAgIll3YDs8NI0+AzfNMzoQZ00gvEbgIhCQ 4Uww== X-Gm-Message-State: AOAM53294FivBEFe809NGOY9iia5r1te7dh6Xvn6oEWpqJ5V9tZFCN0c Yv5aeaO1tFPJZ2Rb+XKEu0A= X-Google-Smtp-Source: ABdhPJwvZSqQE/QbehqXCsHdQjyZTJdGYntsE57MxjyPpWUTC+sJLUK5O246dAdal1NwP+lGT+k1Hw== X-Received: by 2002:a62:754a:0:b0:47c:36b0:652 with SMTP id q71-20020a62754a000000b0047c36b00652mr12805931pfc.1.1635537809046; Fri, 29 Oct 2021 13:03:29 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id j16sm8775041pfj.16.2021.10.29.13.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Oct 2021 13:03:28 -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-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), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v6 2/9] dt-bindings: PCI: Add bindings for Brcmstb EP voltage regulators Date: Fri, 29 Oct 2021 16:03:10 -0400 Message-Id: <20211029200319.23475-3-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211029200319.23475-1-jim2101024@gmail.com> References: <20211029200319.23475-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211029_130330_207805_01DC0232 X-CRM114-Status: GOOD ( 11.08 ) 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-ep@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/63 Signed-off-by: Jim Quinlan --- .../bindings/pci/brcm,stb-pcie.yaml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 508e5dce1282..d90d867deb5c 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -62,6 +62,10 @@ properties: aspm-no-l0s: true + vpcie12v-supply: true + vpcie3v3-supply: true + vpcie3v3aux-supply: true + brcm,scb-sizes: description: u64 giving the 64bit PCIe memory viewport size of a memory controller. There may be up to @@ -158,5 +162,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>; + compatible = "pciclass,0604"; + device_type = "pci"; + ranges; + + /* PCIe endpoint */ + pci-ep@0,0 { + 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 29 20:03:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12593689 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 9D497C433F5 for ; Fri, 29 Oct 2021 20:22:01 +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 5628860F56 for ; Fri, 29 Oct 2021 20:22:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5628860F56 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=wRQfj7wFbZJxOV vSq56tGcDNCeQA+zvu7palc3TPlzDqnw5GHiB+N7mUwObmWdkmBX2EmJH0rqp3Txo6Uny3L2wE2BX LQr9zLmKG/CNv+RxK44ORdvNtaF+rz3VekM9L/qjA2D1GpM7PDrUBLSmWavDffL9kR7/0XkXk3+TE dhRNcGdOQIBetkD4JF/mv1uuZr3JU8Z7LEUMrY17jpE5BJ3ensEZ4n8ne/XOfAUBqFpSEoK6nGy+f DBiABusY2w2eI3rD4ozjeuOsYN7na8ukIXsNZef9ke0x+6CUjyuSbmGJoTmbHp8Xm5Vl0ZPtJChZZ kS5mqHjc8m+XF1wUvGlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgYLr-00CDoQ-O4; Fri, 29 Oct 2021 20:19:49 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgY6E-00C9cS-Dj; Fri, 29 Oct 2021 20:03:41 +0000 Received: by mail-pj1-x102c.google.com with SMTP id nn3-20020a17090b38c300b001a03bb6c4ebso8101815pjb.1; Fri, 29 Oct 2021 13:03:37 -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=qjSLHUXCDQWygnVlyrtmeX80jN8aeq1XvoNqVZbcgz3pWBNXh2WUTbMxhMcqf6Dy6L Y4b+BpSNhZm3TwUwIyJpnh7f9gY/5lESKlhSZmdENaKYakRR4wWQ2GAh40GPdp7Z5csi S55V7NyXufyKihgew1e11sQGlAkkspyYiGOvhjDaiPCWkge568MSaSuoJFqrHiZF6flb D6lAmbmbfPM4jB1keRmDH6qOEwYbUo49nk5ujBzeKcAqYt1VML7em0zYZYwk1uravbYj f7fabu+/GOWr9aP30GdqxwFQHniV9QABhzWk5Jx24yBOhjV1dHSpHt3duL95ucNnVCX2 rM9w== 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=BYTeCDyKIllFVpQGeR8Gx/vFfBiTSiv2429gKyUnuOMw9NNMuqv/F3RuvMuORxCXK9 JXphh5iepquDfbHr469XKHR2MzvPRvbfNOpHc+PZo/OqxxXhIgFcReBtp9jV6U9fBexl wtZdPQS9lEiB11g4z/vlt5wyD5heEe7006PQFrk69pbFZoTkmw9RJQTrUBF0A5AQ+QfO McZfF5A5uH0W+wD3s08l538ijAm7/0qxLP/sQ9CAIMECQi0j5GcN1Tn7FjO+9fSZifML QiqmANdd+e3VycNy23GzYtxxg5sa4tG9ZXQVQuwO9YckRvX12mDiy1SxlxYJMCDGgF/g 0VkA== X-Gm-Message-State: AOAM533/giKzt1ciOPqWrdNGygBzJqSlysQaSmF0XcDCwGKtg18ltfEB JTtXCP87PzgL2pWfSk+amAg= X-Google-Smtp-Source: ABdhPJz8kWh0F8QgJktCkgyP+kh03917s5z8vxLV8DEMrXsbHm9kC89imHO+DLcCD6SsMQdbqPK9cQ== X-Received: by 2002:a17:902:64c2:b0:141:c171:b99b with SMTP id y2-20020a17090264c200b00141c171b99bmr351680pli.55.1635537816878; Fri, 29 Oct 2021 13:03:36 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id j16sm8775041pfj.16.2021.10.29.13.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Oct 2021 13:03: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 v6 6/9] PCI: brcmstb: split brcm_pcie_setup() into two funcs Date: Fri, 29 Oct 2021 16:03:14 -0400 Message-Id: <20211029200319.23475-7-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211029200319.23475-1-jim2101024@gmail.com> References: <20211029200319.23475-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211029_130338_530790_720E57DD X-CRM114-Status: GOOD ( 14.96 ) 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 29 20:03:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12593701 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 144E7C433EF for ; Fri, 29 Oct 2021 20:24: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 CD16761039 for ; Fri, 29 Oct 2021 20:24:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CD16761039 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=a4x8fs16DHcHqnwFbS4uJHhwzSaIAZmCtexcbFPMc+U=; b=GJyuYSZFZcpBjo NJ/u8fgW5iHyXV7eF0NATTW81+0e48cT8umdv1LDu8CmdvcGWCfWUMqI3XtuQQBwGUiy2nX3phmCX B7hCZwy0yYa5lkbCKeYSuLnBHCCMSh0Z3MXxsKvqSGJKRp68igDubxtOkW0tdJgh8Fjmll0mN0Bvp 0TkHCVbcKhpduh0BNQAsHGJqENvaf6oA9i7j2X4CWIRxgtgiIgz4+raKCgDVjYwp32QuJj70/qSOa wVcW9eNCVTlVw5WpMwlwOvTFJ2hoi6Po8p5IRx1pp83S+oXYZR5RBbceTfbknfcexvwCJCVJxKCba MHcQYmZ9E8M5Uof6wY4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgYOb-00CEXX-Ai; Fri, 29 Oct 2021 20:22:38 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgY6I-00C9d7-84; Fri, 29 Oct 2021 20:03:44 +0000 Received: by mail-pl1-x633.google.com with SMTP id i5so7518344pla.5; Fri, 29 Oct 2021 13:03:39 -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=fs1h0oEJpXq+0v9+ITH8gAhhMpG3tKFNm2Sg0Y1iFCA=; b=AdSBhCOASd+zHNLdwvAGJ7h02CtSExXSpYpNdBAd9rvXWezBLKLb7ggDC7PUvR9NlE V34k00QzPQEAJhWOHF+JlGE5Oj36XP6JzwAdRYM8oRGMkXv/khoeVe6Zzz+pDQyzMvQR UgCJGH9nJ5/A90Kr0XRSargmAxXCb4U3RV2GIkE37RM7RQI9RjAsFnhheLF+qbsDbHEn FMMgu87v8vQkZD1esC1hDURGJE7sTMBzNICSXb0yHWuq4Se6DG6caQhu+lYWUNG7c8XG dX4mMz8/houceeN576nKHo2lBQJZ0aJ+l8Aye24Sv6+B41xI6+lZ1qKanQZNVP/eXvDE ENhw== 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=fs1h0oEJpXq+0v9+ITH8gAhhMpG3tKFNm2Sg0Y1iFCA=; b=dGqPea5SZ4xpYbX3V7AshQspvYicxHOdMShSbT54g0H8gTyuFrL5qL5i1WS6utUyEj cHAQJNR32nC3M8p+6eOH6l90hPgDP2VQQpycHv7t4ca7oAS+C7IxXSh4SEgbEfSk0U/i rvgvxGVLWrh/a5JNCCykc8z0HF7IMIOqXdKACEGwV+M0HDmE3QGfVELUwEO8m0jMIrIn gdFezMZhLHex/HzCBicU8zrKaA1z44Yop4KlGwaSfYartznoEF9FcrDXT47fFXZknhPM 6BuT2v5xgLPPzoyohsgFFHYHBKW50P19pjSYzkpBy4038gfuW8Wg4cDQjzeIVag5n9J6 jZgw== X-Gm-Message-State: AOAM531p4o4hFw8UXEiEGe7gbZ2dEQoarG/WoTZ0JOrfNwginxSQDPpn /LHhv1xlJ217tUI3jS8skvU= X-Google-Smtp-Source: ABdhPJzUJR0JVVGnwuS2gERt1y/KK+57eHJfq2QYnEfBbNOGUl7HS2gfq8Em/+N7DoKVduEC6dWO8w== X-Received: by 2002:a17:902:bcc4:b0:141:bfc4:ada with SMTP id o4-20020a170902bcc400b00141bfc40adamr1112784pls.20.1635537819137; Fri, 29 Oct 2021 13:03:39 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id j16sm8775041pfj.16.2021.10.29.13.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Oct 2021 13:03:38 -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 v6 7/9] PCI: brcmstb: Add control of subdevice voltage regulators Date: Fri, 29 Oct 2021 16:03:15 -0400 Message-Id: <20211029200319.23475-8-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211029200319.23475-1-jim2101024@gmail.com> References: <20211029200319.23475-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211029_130342_376299_BBFF7417 X-CRM114-Status: GOOD ( 28.96 ) 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 | 164 +++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index ba4d6daf312c..6635e143cfcb 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,12 @@ 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", + "vpcie3v3aux", + "vpcie12v", +}; + enum { RGR1_SW_INIT_1, EXT_CFG_INDEX, @@ -295,8 +302,38 @@ 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_regulators_on(struct brcm_pcie *pcie) +{ + struct device *dev = pcie->dev; + int ret; + + if (!pcie->num_supplies) + return 0; + ret = regulator_bulk_enable(pcie->num_supplies, pcie->supplies); + if (ret) + dev_err(dev, "failed to enable EP regulators\n"); + + return ret; +} + +static int brcm_regulators_off(struct brcm_pcie *pcie) +{ + struct device *dev = pcie->dev; + int ret; + + if (!pcie->num_supplies) + return 0; + ret = regulator_bulk_disable(pcie->num_supplies, pcie->supplies); + if (ret) + dev_err(dev, "failed to disable EP regulators\n"); + + 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 +1185,59 @@ 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++) { + char prop_name[64]; /* 64 is max size of property name */ + + snprintf(prop_name, 64, "%s-supply", supplies[i]); + if (strcmp(prop_name, 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 +1248,7 @@ static int brcm_pcie_suspend(struct device *dev) reset_control_rearm(pcie->rescal); clk_disable_unprepare(pcie->clk); - return ret; + return brcm_regulators_off(pcie); } static int brcm_pcie_resume(struct device *dev) @@ -1174,6 +1264,9 @@ static int brcm_pcie_resume(struct device *dev) ret = reset_control_reset(pcie->rescal); if (ret) goto err_disable_clk; + ret = brcm_regulators_on(pcie); + if (ret) + goto err_reset; ret = brcm_phy_start(pcie); if (ret) @@ -1217,6 +1310,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) { + brcm_regulators_off(pcie); + regulator_bulk_free(pcie->num_supplies, pcie->supplies); + } } static int brcm_pcie_remove(struct platform_device *pdev) @@ -1241,6 +1338,57 @@ static const struct of_device_id brcm_pcie_match[] = { {}, }; +static bool brcm_pcie_pci_subdev_can_prepare(struct pci_bus *bus, int devfn) +{ + /* + * We only care about a device that is directly connected + * to the root complex, ie bus == 1 and slot == 0. + */ + return (bus->number == 1 && PCI_SLOT(devfn) == 0); +} + +static int brcm_pcie_pci_subdev_prepare(struct pci_bus *bus, int devfn, + struct pci_host_bridge *bridge, + struct pci_dev *pdev) +{ + struct brcm_pcie *pcie; + int ret = 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_regulators_on(pcie); + if (ret) + goto err_out0; + + ret = brcm_pcie_linkup(pcie); + if (ret) + goto err_out1; + + /* + * dev_set_name() was called in brcm_get_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_regulators_off(pcie); +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 +1475,24 @@ static int brcm_pcie_probe(struct platform_device *pdev) } } + bridge->pci_subdev_can_prepare = brcm_pcie_pci_subdev_can_prepare; + 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 && !brcm_pcie_link_up(pcie)) + ret = -ENODEV; + + if (ret) { + brcm_pcie_remove(pdev); + return ret; + } + + return 0; + fail: __brcm_pcie_remove(pcie); return ret; From patchwork Fri Oct 29 20:03:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12593699 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 1B7B9C433EF for ; Fri, 29 Oct 2021 20:23:21 +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 D7FF160E76 for ; Fri, 29 Oct 2021 20:23:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D7FF160E76 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=NgN4dTt2ZMK53WEvCwjivWOQuS/6b8rM3371gDntu/c=; b=sxCHpqtGJEufYX Tzfp6ZQ3oERLZO/Xi67+Vu51BI7v2dZNPmBc13kKZuvaKi452jbJYBnigPD9fPiQiYR+mDjFP5GgI ZVDX7V18rtDg3f+PsqBiyw+nSBSfvwnlNX7cqwM94xe5lkJtrhR0OyisdY2+6ONevoq7+s3fM/PrI TM+E7sPEvfnkOJ+C4R0z/DsSsOO2SV68fATc5zw7mJ7fDIUbWO9kB2z4C1WZtwIXb/vm6GbFt+Zug ISOK6nJ0VyMBSQdaRMRroGZcljbzCe0cCLVoEqlP7CAnJbTG7H0D6vH7f3oiQowX8FVfMfDVKzbIh Wtc1sP9auzlfOcUz16pg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgYN5-00CE9P-1C; Fri, 29 Oct 2021 20:21:04 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgY6J-00C9dt-1l; Fri, 29 Oct 2021 20:03:45 +0000 Received: by mail-pj1-x1029.google.com with SMTP id o6-20020a17090a0a0600b001a64b9a11aeso819037pjo.3; Fri, 29 Oct 2021 13:03:41 -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=xm4SxmqwuOzBa/eZu2FFd0i6Z3G+Vk7bausmQ5xw+Wk=; b=Ukpz40DOhJCbTS0qUysan/cT59elQe3QGvN3TqPOJ9ouYTGiABkDBzs0G1TJ2/++sy NZa+I1/MJ02SV0AyDQg+x4sIvcSelYgVP/IWVgX6WB69sY6bz1VDX2HELr47w3nzxFC6 jypWTJ9BUYStdK+qnKNDygx3BqwIE7Lw0XuWitHusQxOCE6QoqDMppBhQAIo18gc0g4q TgjhJNCa8R7+IDZFWfAWl73IkeIjGkoMHW/EMkWO+YjHKQaPerU35AftWjCs/dkofE9q eNh9WdNCqh0u15YoGMH2smxpI5r33H62uC0qGr8YeJxoxEJXuZQ04jJtcVIyMOzgMsnk EIvA== 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=xm4SxmqwuOzBa/eZu2FFd0i6Z3G+Vk7bausmQ5xw+Wk=; b=bD9q2hDFEADZAfG5hbG6BzjedDRhKQZCk2p7oLSlnaJCUbpjYNJpo8mLfe1/305bqj uxF16cX5iWKmI4n8rwEGel6blBsTM3b+7cD5frz12fttNqFNih0+KVNvjb4LBuir72+7 oMYX/vk8V9TdkfaZgpuAEyFO7yxevPDPm8t1wZ2VInH/hv1cFU4AXkxIGm4xmnAtDVQ3 ER5k/DdkPc0dRfL9VDicW3mlonuMfxYUquWN8rJ4tOfciLuCufBq0cDXcNIzr8xrn8FC kpNfitPfiJTNEkpUvxOgEWDzT1PwwQ0BblPonxsJDU+H3IJpPv/uDPnXzzpgiHVJbW/o sd7A== X-Gm-Message-State: AOAM533bGsXyk0IDV2R7BSWSEOzQhAU5IIYLAxRvU2yXiIMgB8hAmfbw TZ4q4QNqw+RIJiN18O2z56I= X-Google-Smtp-Source: ABdhPJyBfG5E+MF9U5ej9v+kNG6zjDbhbmOpAJsBRFAGkk7Xi3emFFxmGH3ASKOyUClSZjy3uUvTeQ== X-Received: by 2002:a17:90b:33c7:: with SMTP id lk7mr13790866pjb.172.1635537821370; Fri, 29 Oct 2021 13:03:41 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id j16sm8775041pfj.16.2021.10.29.13.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Oct 2021 13:03:41 -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 v6 8/9] PCI: brcmstb: Do not turn off regulators if EP can wake up Date: Fri, 29 Oct 2021 16:03:16 -0400 Message-Id: <20211029200319.23475-9-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211029200319.23475-1-jim2101024@gmail.com> References: <20211029200319.23475-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211029_130343_166430_8B055A61 X-CRM114-Status: GOOD ( 18.50 ) 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 | 49 ++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 6635e143cfcb..18b9f7c97864 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", @@ -304,8 +305,20 @@ 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 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; +} + static int brcm_regulators_on(struct brcm_pcie *pcie) { struct device *dev = pcie->dev; @@ -313,6 +326,18 @@ static int brcm_regulators_on(struct brcm_pcie *pcie) if (!pcie->num_supplies) return 0; + + 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; + } + ret = regulator_bulk_enable(pcie->num_supplies, pcie->supplies); if (ret) dev_err(dev, "failed to enable EP regulators\n"); @@ -320,13 +345,28 @@ static int brcm_regulators_on(struct brcm_pcie *pcie) return ret; } -static int brcm_regulators_off(struct brcm_pcie *pcie) +static int brcm_regulators_off(struct brcm_pcie *pcie, bool force) { + struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); struct device *dev = pcie->dev; int ret; if (!pcie->num_supplies) return 0; + + pcie->ep_wakeup_capable = false; + + if (!force && bridge->bus && brcm_pcie_link_up(pcie)) { + /* + * If at least one device on this bus is enabled as a + * wake-up source, do not turn off regulators. + */ + pci_walk_bus(bridge->bus, pci_dev_may_wakeup, + &pcie->ep_wakeup_capable); + if (pcie->ep_wakeup_capable) + return 0; + } + ret = regulator_bulk_disable(pcie->num_supplies, pcie->supplies); if (ret) dev_err(dev, "failed to disable EP regulators\n"); @@ -1248,7 +1288,7 @@ static int brcm_pcie_suspend(struct device *dev) reset_control_rearm(pcie->rescal); clk_disable_unprepare(pcie->clk); - return brcm_regulators_off(pcie); + return brcm_regulators_off(pcie, false); } static int brcm_pcie_resume(struct device *dev) @@ -1264,6 +1304,7 @@ static int brcm_pcie_resume(struct device *dev) ret = reset_control_reset(pcie->rescal); if (ret) goto err_disable_clk; + ret = brcm_regulators_on(pcie); if (ret) goto err_reset; @@ -1311,7 +1352,7 @@ static void __brcm_pcie_remove(struct brcm_pcie *pcie) reset_control_rearm(pcie->rescal); clk_disable_unprepare(pcie->clk); if (pcie->num_supplies) { - brcm_regulators_off(pcie); + brcm_regulators_off(pcie, true); regulator_bulk_free(pcie->num_supplies, pcie->supplies); } } @@ -1382,7 +1423,7 @@ static int brcm_pcie_pci_subdev_prepare(struct pci_bus *bus, int devfn, return 0; err_out1: - brcm_regulators_off(pcie); + brcm_regulators_off(pcie, true); err_out0: regulator_bulk_free(pcie->num_supplies, pcie->supplies); pcie->num_supplies = 0; From patchwork Fri Oct 29 20:03:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12593703 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 C7BF3C433F5 for ; Fri, 29 Oct 2021 20:26:16 +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 9079561038 for ; Fri, 29 Oct 2021 20:26:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9079561038 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=tgzqtu3Bn2eQ0+3s0uq1u9CrcdhiGKmkWoasdIRpjqY=; b=qzelutI4kcisPX Riw1M59kK/jidBToL2bf4N2QeIN0t7WBHeU5fgc6Bx46aGvSi1vRv+xcE8xvSE1Q/yfJ9yJSmtpCz J0Pz4TnDWufLzaA5xz5As/lELzYW0H/u4R8Vy/ComEa60e1HDP442tbfqrpM9qJT9m145gRhRcAaf tVO5M+L3jsCXPSejwUktMmvKCoDTAVrobkztr/WVAoDjn4e9iXbmymtrZQV0GtlNjsZiIZ9GYV7qh W/CfXgXgyE5ytW98hAK72PGAcL9Q2k0L5/CztX93cAtCTNitm4fhUM+LQ3+hI9LvL9T7h0o9+G32l ydjK4rn068WRF6kETzlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgYQ4-00CEuY-Tg; Fri, 29 Oct 2021 20:24:10 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgY6Q-00C9et-LU; Fri, 29 Oct 2021 20:03:52 +0000 Received: by mail-pj1-x1032.google.com with SMTP id x33-20020a17090a6c2400b001a63ef25836so1840987pjj.3; Fri, 29 Oct 2021 13:03:44 -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=dR5goGjRH+faRSi6+pkacTGlwe5Jw734C5Ek8o+kxiM=; b=EO5UYp4d9BPAHCW1iVC6CevixytvZOW1wSqpJwVRSt21Xo3bykzvIiwMLlmnORyFEB 3iE6CBm7HdlZmceoiKQ6PhLdfV8n99raNFrZuvhpnlMlHbngfcHHPTqjcvVKjqdXnkr0 hOSSMjttoN0fULRdSKM3wC54QGW0x16arz1I12bIZnFIYrtOPfl11dD3MKPj5u1k3Qs7 yiaElWlN2u85si9nIDIl7MMdE1bpI8A/RlT7kAkK2qS/RYAAy2dO8y8rhB+Q53kDwQ2J mDbml3aLhSdbF2/NIusE9vsh7pKje8XDQEZDXsmOBdj0S2dX397i8F2XtSLkg/+HNAgd jN3g== 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=dR5goGjRH+faRSi6+pkacTGlwe5Jw734C5Ek8o+kxiM=; b=QO73Mw4BvYO6ow0iIjHmXmW5nmNcoxpHedPoIb+PP0RJyPg4HNwGlNu6bgirbrLJTk dpmsA3QTD+U2o2ZJqaE7JYDRaV4WXqL/6S0vyfMmiHlikc4HFvr52RNJAify6fc7AcGi ZFikN4w75q43ojgkgKPfQG4T4Hqj1+CWNdBQdPBfSmWgAaWOsyszSlCJTjyNNeLewiRp OYRSHOoXeWtRRQVn/9JYMoEJEDVvVfcObsJz/+pOltnNLc42EOw5dJBOCEuN+GLfZeHB Ggcw+bBxGE9Me0YCFqGO39EunK4h7y8rRwGYlZQsImLXSflaWI0SxpOwPeQfoY0d/z+s MFqQ== X-Gm-Message-State: AOAM530eE41ib2ZQ3dtyTjTCJpI3BAKG7Kb4rq5dsIn1aHXp+08Rb6dZ lEOUA6B0rf4roqZScZ/y9rA= X-Google-Smtp-Source: ABdhPJxfHPZGaIHFIxsk4OqGM5oJw5NQuLdc00Tn5tag40VnL4M5tQXeStlEaSC90MV8JJb1Te1gcA== X-Received: by 2002:a17:90a:4e42:: with SMTP id t2mr13798887pjl.108.1635537823599; Fri, 29 Oct 2021 13:03:43 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id j16sm8775041pfj.16.2021.10.29.13.03.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Oct 2021 13:03:43 -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 v6 9/9] PCI: brcmstb: change brcm_phy_stop() to return void Date: Fri, 29 Oct 2021 16:03:17 -0400 Message-Id: <20211029200319.23475-10-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211029200319.23475-1-jim2101024@gmail.com> References: <20211029200319.23475-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211029_130350_737280_BA304308 X-CRM114-Status: GOOD ( 12.38 ) 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 18b9f7c97864..c1f8fdb89cec 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1196,9 +1196,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) @@ -1281,10 +1282,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);