From patchwork Wed Nov 3 18:49:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12601471 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 AB9ABC433EF for ; Wed, 3 Nov 2021 18:51:42 +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 773C760E78 for ; Wed, 3 Nov 2021 18:51:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 773C760E78 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=DqG4Ts71dwKXeKsnBK+o7XQn5EA6iRtYjSiTx6RSCw8=; b=CzSbxx66TOAuJt WQT2iaG2wxfm03q9Zlh7JfcfZw42dQV4dvtBgLU/RBmCjgSk4tZv1la+zD8SiDmuoeu6bTPa5jR9H S9KF15RHoxL6dBiv3Zdy1/isycouRwG7w8vZfo3uJDJdCaixzGbRvlY4I6Rwyefw5UpjFuzu+cOiA /g3l0wDbLlve6qpBryC/5v5FBqP9Nw7sEanpZLcfhzYVRwae1mqM1rPlPZT6loqZcp+TXqBfPB6/i 9beMuKn7gq0tU18qyYI2Tr5sNug3rXXpFHpallkPJADnAYs47dvlMSU1iurr0nQVrByIB7atfYscT VjojLRiJUXJABbbgcFWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1miLKm-006HJd-L2; Wed, 03 Nov 2021 18:50:04 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1miLKb-006HE7-3Z; Wed, 03 Nov 2021 18:49:54 +0000 Received: by mail-pl1-x634.google.com with SMTP id t11so3064304plq.11; Wed, 03 Nov 2021 11:49:48 -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=fkZ8oSbM149H4kVEdywu4YO/VDBT9raRSHF6PBOWSzY=; b=QPcXBNaGfBEelci/AS0Wcr0RcxzQXFao6D7dU4xdP8ITMYC6PES+VET4jqDflNtCYB hCKgbQnPc0929uMMXzwdO2+7lJV1Kq9bp0kjmQDNxhQ+0BYsEPjdEydMRAivLO5BD+Ag DlraZc6+N664tQKk502lx/7cNWjrhz75imYhNdgtDwr2nFlGxdflXUtOedOaUsczWGoq vKdR5HP0Ho6N2OZy1sIHBRwvyma9apE+u1D6H2r1Wj2mTDY4lvFh+RitaXqZZ8Q8lKXN 4ZMp7q0u7tI7CfD1U0bS8OkwlR9aSyeGxXBfjszTUNxaWyAwiK4eQp4lI1XvdxV5UZbd p3yw== 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=fkZ8oSbM149H4kVEdywu4YO/VDBT9raRSHF6PBOWSzY=; b=UEXQE4lpTGgIyQxCfqbj9F1+UzGSSMpitmXACgcqzN+OYbifxLL54d/yoAy3pisBDX 4hfaUiuJYbIFxmgHZb/Pw8mHkDnDH0NE2EqfNb/msFcEKc5xP3VLTvnLftys/ossKNsT FRygxScu6pZvSXWveDTcttZ98yWVdDqMGCNKkOYgW0LijliQFHAY2hS5YON6NAA9jv0o EYQbqnebujJ32Ehjn0zmHdyjVom0RX3I2I4wdlecc6RbqUkLg23C6NfvDZ7aGvE6kgLE XMgBWvtnfjIiMA7Fs71oyVjgSNUJSupggvzPx/6l6EarrNb9A/h3XybAaf0ruBPtaB7r B7Aw== X-Gm-Message-State: AOAM530r2adt2DQ8DENqxBTBG8kZDXjYS1VHgdoU9I+fQQc9/VdG84nH azTMyqR0Fk2k3iYj3eyMzhw= X-Google-Smtp-Source: ABdhPJxcijKpuPZtOgucEvRV6NRFccIYE07lEYWuGVuVxbWcFnVaelAhB7GpMip/bz0eb+SsA1xcXw== X-Received: by 2002:a17:902:e849:b0:142:c85:4d3d with SMTP id t9-20020a170902e84900b001420c854d3dmr11979537plg.75.1635965388447; Wed, 03 Nov 2021 11:49:48 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id j6sm2379065pgq.0.2021.11.03.11.49.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 11:49:47 -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 v7 1/7] dt-bindings: PCI: Correct brcmstb interrupts, interrupt-map. Date: Wed, 3 Nov 2021 14:49:31 -0400 Message-Id: <20211103184939.45263-2-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211103184939.45263-1-jim2101024@gmail.com> References: <20211103184939.45263-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211103_114953_171387_9F0CBEDD X-CRM114-Status: UNSURE ( 9.96 ) 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 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 Wed Nov 3 18:49:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12601475 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 3E438C433EF for ; Wed, 3 Nov 2021 18:51:48 +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 04A9860E78 for ; Wed, 3 Nov 2021 18:51:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 04A9860E78 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=CP0rmEG7wM7DJAtkxnSpjyHke+939KRmLCdNd8KNpXM=; b=GtHLZqw4PRWKwl bnLW3iE9obQ2b8ywzq+4RflOG2kun1I4D1ZrDMImJ3AyhzGw2XIuVD3PKj/SRlQvxr3y6uH523uJL 1wP6k16iAu/OkqzZKmHc0ukhm4cO9Y+GhQ+5b3fWBh8KzN1nqlX9yjsIYCSy9V2ZPW3oc9mjYn5xn RMSNJSmKENKfYX+MG3FcpbLd5lFwWr5nGo06+B40qWczRMVWDaZiVg146DIrNtli8g3Q7VOb4HJnE eDFVl1BMyz7Cc2kE8oKF0lWnDmzYbom8jbuibjrX/8VvtQoT29NjJLUtvRrwZLJ7zlWKjyal4d6xJ CoqdpEWvhKPMcrhIJJ5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1miLKx-006HOt-O9; Wed, 03 Nov 2021 18:50:15 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1miLKc-006HF0-0B; Wed, 03 Nov 2021 18:49:55 +0000 Received: by mail-pj1-x1033.google.com with SMTP id fv9-20020a17090b0e8900b001a6a5ab1392so2122560pjb.1; Wed, 03 Nov 2021 11:49:51 -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=XxDFU6zngH2MiSJPUrDOxFHmK942PXrD/2AGczC8Ul8=; b=pZG5T96zGfFKOpbOk4/fe7AakdF5UfixT2t71nwLmhH5Mx0X+IqI0nA1ljOfxTfLuH BplUo3adJ8WAG5PaZT5lVlKfHBk0oQzabZ/g4SUiOYrQPEN7Yo+c1jKM4MamKeiww10n DdHaN09TRhET2EMztgaY6Pc8BfS7jpN8wh8MZ7WckLx0UMiW4oSogYTIhpCvJTVR10GZ O5OPrMn8nbqKa8rQLbYP1PY+tlfSA4n1Y1ZplmD1zzEtQ1qvgVFHOQF0FOQe9KgyloG6 HKyl4g8GpreFi6bV8OGgBJbm8QLWoseN5CqHiAlRIuj7VE1tNcjciO2MJrP1cwxz7CxX 5SVw== 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=XxDFU6zngH2MiSJPUrDOxFHmK942PXrD/2AGczC8Ul8=; b=hzb302fRLWykybB+MkPUPOXnQn8ymsNxd13hQjf8WJWf2dCRTSiAasoaVlJMkFLNO3 We+i9m2YXYjPDq0Cw/OVMPsy9jEGkNG0F4Fq0m6hEPf8fLlR7G5gnud8A0JuWRSb1pno hl7GpTzF/TKAeiiPnvUNVuBs02BID0b7t7vgKfAzJbuUozl2Oe9WJo3xrhCIx/A+B04U 3vGx+cAdbs6a/wr8qE6aKhTwghNgdh+5mv+yNk7dI+T3Le1ouv9yLladvW2SpCSHxCMv Opxe7JhntO9YO8jF2lmAXM4RN4LBELlNeJc6qPzJWOo7E/IZWF1jzNIsKU+p/TDGK/K3 B1Hw== X-Gm-Message-State: AOAM533kTGtLJKk23OazqYARclnEUoH+CXwDdsbga1Okxly93uVmwNiI 13dTDJxQ1pm/yeLySRVTNUM= X-Google-Smtp-Source: ABdhPJwATqSP80m9Am/wm/Wa6I9Nc5RO2ocnh2+BqVcYLRdPASPmpaMTg8hrU7YBav6nVeR3Ynw2qg== X-Received: by 2002:a17:90b:3802:: with SMTP id mq2mr16547475pjb.213.1635965390969; Wed, 03 Nov 2021 11:49:50 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id j6sm2379065pgq.0.2021.11.03.11.49.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 11:49:50 -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 v7 2/7] dt-bindings: PCI: Add bindings for Brcmstb EP voltage regulators Date: Wed, 3 Nov 2021 14:49:32 -0400 Message-Id: <20211103184939.45263-3-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211103184939.45263-1-jim2101024@gmail.com> References: <20211103184939.45263-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211103_114954_071685_2807CC96 X-CRM114-Status: UNSURE ( 9.99 ) 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-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 | 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 508e5dce1282..ef2427320b7d 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -158,5 +158,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"; + vpcie3v3-supply = <&vreg7>; + 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"; + #address-cells = <3>; + #size-cells = <2>; + + ranges; + }; + }; }; }; From patchwork Wed Nov 3 18:49:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12601477 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 5DF4BC433EF for ; Wed, 3 Nov 2021 18:52:03 +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 2C90B610E7 for ; Wed, 3 Nov 2021 18:52:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2C90B610E7 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=lP+fG21dhG66dF w35VvCGEhfiATmJyxC18bpiu/B8b4r82swr52UgRGkFX0XINAlucLLLW/8a98CUC8ravZO0ko01aV kdi/rJDSDUr7VyImy/aVtKtQQSjaFv4QLl7Hs94edHfcIW5XDfYErlvxyqy75BfP5th4tflY7rU4d DMF0aFIpEocpe5qb+badA42qI882MQGSpjMKJ5l+rHT/ogkQSsr1vCLyjrmVKfqWWyWSpIvrTh88R 2xt3UCsYaDAp2XEU2iBVavhKcdw4U1V6VeKVTHQzszhknZO9GIyo8XSFaUPHlO9hwpLhzzItKfG65 duJhhlnTlW00s0JHtMSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1miLL8-006HRy-NC; Wed, 03 Nov 2021 18:50:26 +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 1miLKc-006HFg-SV; Wed, 03 Nov 2021 18:49:56 +0000 Received: by mail-pj1-x1035.google.com with SMTP id fv9-20020a17090b0e8900b001a6a5ab1392so2122691pjb.1; Wed, 03 Nov 2021 11:49:53 -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=VRwLrL82bnQDTaHfLIz36gShEC2CRz5Ssow3SBz2QkVVpRIUdqnJPNY9dr635rzky5 EI9H0iZ4vQpItvYSglTFAXJdafJdyAxGP8lMnqzwtgF8XF2lEWXA0unrjHV1BxF7Lokj zSn55qlG7xzZarOzCzpIPEGnb0Uffg/uH7Txm/909GRFSsj2fhjlTHkh/uY4YMufGM0y TdR1YwNjvGZmqne1FnPNOub3PPpZpaLcYqBgouh2g7U5eseNiK5HheQWMxuvDbulc+t7 6XIQyOQsgQRDNsTQvnOSwy85BcWiL0Gjtb3zB65Zzhf2kROaQ8Z/XprheMBHaPp1Ib7S vlcA== 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=Zlqsz8IazIB/UVozWt6YVgwuQtDtW+6d1k4CkmqwVSyzRRvOBSsW+3VO12MRnZoGqU CoSLq7pfBXs67u0UANTaPsgHp3/7A9Cuet+FKek8aF6Sy0ZbaDL5Od3hiKm1LswiTM34 e6w5a0tHFHjUkhW4ZX2noljV4bNYThAv260JPYS/HQ6E6zEq2lmOD/xkJ/hKNUl9D9UI SyUhiIAX1sFjoQGh+AWP2iwwqAGmfLSIvGsCs/5gK6d8pBRz1eGU6S1UfAPQZTleslk5 1TRljnSHRSt3up9N8hYYkuYjKqLga7Ozv+e645Ct0DhnLea8W+Yu7rku9plaMud1N9/+ cobA== X-Gm-Message-State: AOAM533jNdDnVoLIvvCUUi8TiyiwpHtZ2WXvug9XNStozk+J8pbeA2AI p99v12ZNf+6VSV5YPbXi7aEpPy5UCuuQUw== X-Google-Smtp-Source: ABdhPJz7p4koVRRiR5HdILl24gGZV0hYsk1W8hGHmXKRWDnY3dPh8DQfSUExvFTUANzPFJ75UZXuzQ== X-Received: by 2002:a17:902:bc8a:b0:141:eb43:81a1 with SMTP id bb10-20020a170902bc8a00b00141eb4381a1mr20280237plb.52.1635965393405; Wed, 03 Nov 2021 11:49:53 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id j6sm2379065pgq.0.2021.11.03.11.49.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 11:49:52 -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 v7 3/7] PCI: brcmstb: Split brcm_pcie_setup() into two funcs Date: Wed, 3 Nov 2021 14:49:33 -0400 Message-Id: <20211103184939.45263-4-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211103184939.45263-1-jim2101024@gmail.com> References: <20211103184939.45263-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211103_114954_950106_993CB528 X-CRM114-Status: GOOD ( 14.89 ) 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 Wed Nov 3 18:49:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12601479 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 561A8C433F5 for ; Wed, 3 Nov 2021 18:52:19 +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 1D3C860EBB for ; Wed, 3 Nov 2021 18:52:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1D3C860EBB 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=L1TBsWq4mAG5DDLWQpUOwEwwWTNSLESthJI5zyQ7nkQ=; b=xybvyIXOmo4cdP F3IkfhRL+luT1lfAj0ZfNDPe6k+3OdUjE3yaIrBB1ONj/rEtkJpFx9PE2CYe+9xtLOzBZBnShfMBa 7Phz7FgeNMUN9sq+1CoLjsprYdmTifJk94MHRASSEVbXJuJhyUd87Ck4ehpf/knOkU8hEKt0Qf0aV vjp31Mccv3xJEi9BQCIa08tXtXcpuiFmBQh5kxn9OuGvdNBNeuw4EwCDvkT/NZJhheLucNSTe9Gfo sX0Ze9ZTYI/dao4jGFV5COGJZ9XxGlmaZdOoYwbhD8WGD4UG8FEtAAIGZ/M1w/7hjo7bv55TOeNfZ oxvgr00z/EY7PvdZQJIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1miLLK-006HWs-2d; Wed, 03 Nov 2021 18:50:38 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1miLKh-006HH7-PD; Wed, 03 Nov 2021 18:50:01 +0000 Received: by mail-pj1-x102b.google.com with SMTP id gb13-20020a17090b060d00b001a674e2c4a8so2118916pjb.4; Wed, 03 Nov 2021 11:49:57 -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=3TSaUqFQ373KOcylCPvljRjsapR+eghqQwHcyVQXkYo=; b=ii33XPCm/NMGn3E3iCWe0wqAG/0f51JRs3YinU1BbTAxc5X5UCysala684ozI+XDXY R8mHIIv0bAlKXtBzSPCYPwj7im93EdPmt3jMRhgXv//BEYIq7B4R75JzFMhRkZ7cc3gG R7loLkP1C4vtm+tn1npDzmmwKPi0m19pa+7TceIlZ5Yhg8VKCF4jSzQg7OWT3jF0c5Fk DzIk7rad4VYcYqIMZ8c0KFrhJbcjvX17SsJTyabbXEo2nEq/ea6xpNWHZUfKkEEEuVaU G0ND+zB/0WDRNDQ69+BjZTaL4/TuhaGxuzWCrmQXtNHAvg5cwUwuSB+c/RUWRmZ1D+ye VNFQ== 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=3TSaUqFQ373KOcylCPvljRjsapR+eghqQwHcyVQXkYo=; b=LWoiz/h0cp+dZFA3MIn45895qv0UWcDyBGl1+IbemzzFOgPnXkMV7SkgYi4AYB6USe fxj6/tvhqG1doCjPWnnGfv1B+bH7NwC8DDDkNqnVmTwLa204K13f1UtkCbB4If+J67bB o+5+VGlKpswPRxn8Vqe2XLZblPFOWF//bpaAWtvb6mA/UWoeqc0OVqRw9LzEqKqER4w7 Uej0TCSpTwi52Uqy5TkLwSjtjngbPzc+pxfMTqoUoRhn7+jI85kWAKM0WVYywsYvJtf3 ZunkkOynnGxJj28doQQWDSfpL8Kf6ZNFzQbpmNr4S+PNQZTh6I9622I1XStEVVlX4FHP u2Jw== X-Gm-Message-State: AOAM5309eKCvVkKqZDBIvdJw7uqzjz7ExcDepJifMzWuWPWaoEN/OcHP Tf4Ka+IFsMrvt3PoWJ+iTMM= X-Google-Smtp-Source: ABdhPJzgbs8kLCJfJbnoJW1JqqKe9OKcGb5xUw327c8eClhY/MH+OcN0k+BFgN6+Je4t0EdmWDx9aA== X-Received: by 2002:a17:903:1207:b0:138:e2f9:6c98 with SMTP id l7-20020a170903120700b00138e2f96c98mr41428638plh.11.1635965397471; Wed, 03 Nov 2021 11:49:57 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id j6sm2379065pgq.0.2021.11.03.11.49.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 11:49:57 -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 v7 5/7] PCI: brcmstb: Add control of subdevice voltage regulators Date: Wed, 3 Nov 2021 14:49:35 -0400 Message-Id: <20211103184939.45263-6-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211103184939.45263-1-jim2101024@gmail.com> References: <20211103184939.45263-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211103_114959_870697_DD2133FE X-CRM114-Status: GOOD ( 27.62 ) 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 | 156 +++++++++++++++++++++++++- 1 file changed, 154 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index ba4d6daf312c..aaf6a4cbeb78 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 @@ -191,6 +192,15 @@ 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 int brcm_pcie_add_bus(struct pci_bus *bus); +static void brcm_pcie_remove_bus(struct pci_bus *bus); +static bool brcm_pcie_link_up(struct brcm_pcie *pcie); + +static const char * const supplies[] = { + "vpcie3v3", + "vpcie3v3aux", + "vpcie12v", +}; enum { RGR1_SW_INIT_1, @@ -295,8 +305,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 @@ -722,6 +762,8 @@ static struct pci_ops brcm_pcie_ops = { .map_bus = brcm_pcie_map_conf, .read = pci_generic_config_read, .write = pci_generic_config_write, + .add_bus = brcm_pcie_add_bus, + .remove_bus = brcm_pcie_remove_bus, }; static inline void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val) @@ -1148,6 +1190,47 @@ 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 device *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; + + dn = 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; + + ret = devm_regulator_bulk_get(dev, pcie->num_supplies, + pcie->supplies); + if (ret) + dev_err(dev, "failed to get EP regulators\n"); + + return ret; +} + static int brcm_pcie_suspend(struct device *dev) { struct brcm_pcie *pcie = dev_get_drvdata(dev); @@ -1158,7 +1241,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 +1257,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) @@ -1241,6 +1327,62 @@ static const struct of_device_id brcm_pcie_match[] = { {}, }; +static int brcm_pcie_add_bus(struct pci_bus *bus) +{ + struct pci_host_bridge *hb = pci_find_host_bridge(bus); + struct brcm_pcie *pcie = (struct brcm_pcie *) hb->sysdata; + struct device *dev = &bus->dev; + int ret; + + /* + * We only care about a device that is directly connected + * to the root complex, ie bus == 1 and slot == 0. + */ + if (bus->number != 1) + return 0; + + ret = brcm_pcie_get_regulators(pcie, dev); + if (ret) + goto err_out; + + ret = brcm_regulators_on(pcie); + if (ret) + goto err_out; + + ret = brcm_pcie_linkup(pcie); + if (ret) + goto err_out; + + return 0; + +err_out: + /* + * If we have failed there is no point to return the exact reason, + * as currently it will cause a WARNING() from + * pci_alloc_child_bus(). We return -ENOLINK to the caller, which + * unlike any other errors, will stop the PCIe tree exploration. + */ + return -ENOLINK; +} + +static void brcm_pcie_remove_bus(struct pci_bus *bus) +{ + struct pci_host_bridge *hb = pci_find_host_bridge(bus); + struct brcm_pcie *pcie = (struct brcm_pcie *) hb->sysdata; + struct device *dev = &bus->dev; + int ret; + + if (bus->number != 1) + return; + + if (pcie->num_supplies > 0) { + ret = brcm_regulators_off(pcie, true); + if (ret) + dev_err(dev, "Could not turn of regulators\n"); + pcie->num_supplies = 0; + } +} + static int brcm_pcie_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node, *msi_np; @@ -1332,7 +1474,17 @@ static int brcm_pcie_probe(struct platform_device *pdev) 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 Wed Nov 3 18:49:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12601483 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 5544AC433F5 for ; Wed, 3 Nov 2021 18:52:54 +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 198D660E78 for ; Wed, 3 Nov 2021 18:52:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 198D660E78 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=QeNBRuOTs0PdB2ULQpvkSQPOcwYYCaPhEM0jtWACevw=; b=eLFgJxYSzcal1T igBIcELuq8h8wH35BMveCtGhZUvL3XOWxWrLNR08264YiHyCBiLiz31JX4sp5GvkpHJEh1eS8m3gD b73gA/PwGFwB9AH1+cHUZdnCgZAJn0uR3gu3u+zJ+I7DhC/OidRwrt9k3oP9BqxB3Hcx7p9sl51rC nEh+wzOXse2XsfqibyfAigARmHnbyToOMt4pTJjU1Q411kdR5LAxt1LCTorG7n26LtJdJrngTEzoT FYA4n62ExqE5+U2TTE4QnmXSRXG/VjNeYHYWZH9Xlj/DZbe0sNr5WMWqSqDCIvBNptQ4cmlrODhXA uDwaP5QMpa90fQUIRT7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1miLM0-006HtG-1A; Wed, 03 Nov 2021 18:51:20 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1miLKm-006HI9-JF; Wed, 03 Nov 2021 18:50:06 +0000 Received: by mail-pj1-x102a.google.com with SMTP id gx15-20020a17090b124f00b001a695f3734aso2117873pjb.0; Wed, 03 Nov 2021 11:50:00 -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=wB1XTHRrUvGXuzH1iZwj1J6GyNltpPCGAayAWSa5LmQ=; b=Jj8wZVtWZX2avHtT6K3bSj2bMG40lbof6al+upIjE7v3prKL0Gs3UxNJozzt8u1SVn qiB3GwgJpsqaYVkk7UAyEGZ5cTHZQwl1Pa2eeY8LKW3uMnVIduLtjV9BsxcaC2Y5xA+N ohXJ0QybXPPWQg4ct6FDvRGTAqwl90ycMiPDNEUqZ4x5zo96VNRGlAVMnpkrdbHLHVmS PrtQiTySChOB2IYY9Eq/7sKmUm9+7mEmLtXjgFHbh4oorXVkDtTnp855HOh3rbg0TMsC OHaVuERpAmLFCLVliDJjGCkRQMM5ZJEWKmTUH9rYGdmuAOVbcSl9q8CPLiJEohehV8/K IPLw== 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=wB1XTHRrUvGXuzH1iZwj1J6GyNltpPCGAayAWSa5LmQ=; b=0zZcQo9c+na6rFRSbfgxA6WGxZ7MvldUwFnzMUy270qjZvpfntLy1/7yo8siRrgdL0 pMGI2//L/ulu5PeSlB/vIowZHJ0T8P9/10PCejnlQRtcSl70VOElojMaxzpXVj+u1oUH E7aXyAbItwfkXQpjCOSzv5rD4P8+XfEGAEif1JS6D4SCl7SiFU+e0cTbuiezsdY6Tnyr 3W3espTLPs0VGBPZ/RXmR5M7M7bjnsd7iduO0rCg8Vhmz+9yNQ5SFNgOFlPJoIWXASzJ YT08Hsfwpwvcn4mn8uwgc+q9vNB7wDpsBA6OOIqs99db41taO8s9YYeqpQ5vbmE8irVG Vl0Q== X-Gm-Message-State: AOAM531nx8deUMIt0RA8SBVOHG0pzqghRcnRL8+VhJgpnHCsWSTCng+7 09jSBEHXjb4TKNwkV32xoZY= X-Google-Smtp-Source: ABdhPJxysJWpo64eRsY6+bwdO1TrGhnH5TPuJXNlA8jir9+FpIYzLpJNg28HsV1AQ62Z5m6fK2zglA== X-Received: by 2002:a17:902:778a:b0:13f:672c:103a with SMTP id o10-20020a170902778a00b0013f672c103amr40891628pll.55.1635965399774; Wed, 03 Nov 2021 11:49:59 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id j6sm2379065pgq.0.2021.11.03.11.49.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 11:49:59 -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 v7 6/7] PCI: brcmstb: Do not turn off regulators if EP can wake up Date: Wed, 3 Nov 2021 14:49:36 -0400 Message-Id: <20211103184939.45263-7-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211103184939.45263-1-jim2101024@gmail.com> References: <20211103184939.45263-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211103_115004_669090_93393B51 X-CRM114-Status: GOOD ( 17.37 ) 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 Reviewed-by: Mark Brown --- drivers/pci/controller/pcie-brcmstb.c | 43 +++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index aaf6a4cbeb78..9aadb0eccfff 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -307,8 +307,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; @@ -316,6 +328,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"); @@ -323,13 +347,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"); @@ -1241,7 +1280,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) From patchwork Wed Nov 3 18:49:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12601481 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 298EBC433EF for ; Wed, 3 Nov 2021 18:52:29 +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 EE5A760041 for ; Wed, 3 Nov 2021 18:52:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EE5A760041 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=bjf7MOIBF6XyTq5iTm/PnZGehCI/vsXDzinnOFHpDEQ=; b=HUV84LU4qH/OMb ekctTW6FudfSyzDD9pqITC+FcTvWCk1S8ERnLI6fDzc6Pa8mDlJICupWKQSzSmlJS47m/qe3jBDgH NsEqRUtLwlVAViWxZG1pPLKFLRL8WEreaIdo1g/bkc2QkUngGZqEfJG/vJ0OQVqYSJMd2s8MBz1eU ApXKjWpJVU/8iw851MwQwmI+dgg6XQXY0gWs0S6aGaGsqgmWhpYaQ9W+IsKlk0OghV6uM2nCdxtQd dspaMZaic6ekioJ+Fb4OOb7VlwP/1X2L5UYJgPVO+FwX/jlhNz0H7+xSzjDbL4jwXwZOutNNnKO8p L1/xIAMQddTf0HB2pn6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1miLLc-006Hey-3s; Wed, 03 Nov 2021 18:50:56 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1miLKm-006HIv-DA; Wed, 03 Nov 2021 18:50:05 +0000 Received: by mail-pf1-x429.google.com with SMTP id t38so3296729pfg.12; Wed, 03 Nov 2021 11:50:02 -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=qT6D8z9EWM5nbqoODMsf6pYhfTqAM6D4oAkvj8nPzI4=; b=kT4+I28b80Hx+pwNuGDFDshF/1eR9612Hjb09D99u7P60J+2XEhPtO0SwamVqVk8qy mAiTjhfhFBsH2uf7SaucFkvYpHbA+Z3bMa51gajLIy7b27EZIU8av3Ymya58ye9Zfxg4 jSl2eACif4DN1bi/QVqpIGb3IbxRJ8cclPEk67g3RcpLHW0LOsjJyrfuCZUOvi9gRYAj lPcijjwKa/fl2PbmCJ7kdzOIAwouBXNVt6H7C6TgKD56oeXIpUrfsrzfpdcBCbOOZHz3 GnnFxfNEIr+BsIL6moW7Q0YKDAG2wjhdDknObRBgjnG//MTG9TKG4xRkxGq3gnSAi3vT Kmuw== 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=qT6D8z9EWM5nbqoODMsf6pYhfTqAM6D4oAkvj8nPzI4=; b=qNCIPNenADsj8tM/K+iyPGdryT2lqXq7FtSZrEfisAkcyWi9j6C/t/hM0FJFbUohkQ 9lkBk6RyzgYJ6pSzOtSRwOxlhm/bOqNd7ngWRhyF92SKwpXpTGCfWi9elt/0aAp4Ttq2 WS358jbfYU+AgQJbL8XersrDVzHUj06ldZtDamG8kKMzrFeFVNEtbJhYIuML8sKcgcYZ Wh/en62Tp5CDeNpldrgzGAJWZWObrAh0VwwatX/Zs+1PlRuml+eO9WsZ/4y+uGqLEGfe qyKco01aZeDWNvhHVLbObDuElR6mXmgc/bkpZGY71aPLU6SZd0pbGVYIQNkIPVEyKYys Jqdw== X-Gm-Message-State: AOAM531ckM6P2XnLXSMidrhDccRSeCUGR7o1AONwdQFoiKZPubF73O6z IcWqrCWZOWYzh3Sd2XY0WUHWeoWXRiNimQ== X-Google-Smtp-Source: ABdhPJy+7EOGlv8SCRA+dshz00FJ/GQ3infaDey2A4rnwN3sb7znxUN4xm8S3OhuxlKNlU27ryNIew== X-Received: by 2002:a05:6a00:21c2:b0:44c:fa0b:f72 with SMTP id t2-20020a056a0021c200b0044cfa0b0f72mr46346157pfj.13.1635965402040; Wed, 03 Nov 2021 11:50:02 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id j6sm2379065pgq.0.2021.11.03.11.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 11:50:01 -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 v7 7/7] PCI: brcmstb: Change brcm_phy_stop() to return void Date: Wed, 3 Nov 2021 14:49:37 -0400 Message-Id: <20211103184939.45263-8-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211103184939.45263-1-jim2101024@gmail.com> References: <20211103184939.45263-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211103_115004_474181_DD583E45 X-CRM114-Status: GOOD ( 12.64 ) 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 9aadb0eccfff..5eabbd72e5b8 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1200,9 +1200,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) @@ -1273,10 +1274,9 @@ static int brcm_pcie_get_regulators(struct brcm_pcie *pcie, struct device *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);