From patchwork Wed Jul 10 22:16:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13729769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D088AC3DA41 for ; Wed, 10 Jul 2024 22:17:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=b6+ASPTDFA3DxrRYgx3GfT5NnPZdiT3QtaDFTDutrmo=; b=EFD9BONQH6Hr/iTzmlwQug4f8d wqjALQB8HayKEcYg3Hh87sTnz9aBWnDu9wKh+F7RioUPVfdR+gxkmNsC4nxIV8ORA5o1utjM1ZVVU 0KDdg8MTu3GqttvqVbSnSo8odWdhzyhab/qrn1zk2VuCkoFpprF81lWHYgzRFxoL9WRV1OD3zdlKv fb2adZxwjbbI5Jzn8ZZn2QyM4pjO8+CPpm99OKj/PJ7wTkjYC4FWc8N5wcbwIcXUofMxmzo51+rPX yU6aE8cBwKoSLLGmZ9uKFXpHBMi4aAczyAH0RVpFjQB+R8c/8xvj8xwpt5L2jbEYrQ92Lzsf904uP nQa6GGKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfcg-0000000BuBk-1xVx; Wed, 10 Jul 2024 22:17:14 +0000 Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfc4-0000000BtpA-3TDd for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 22:16:39 +0000 Received: by mail-qv1-xf34.google.com with SMTP id 6a1803df08f44-6b5f128b18bso1850696d6.0 for ; Wed, 10 Jul 2024 15:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720649796; x=1721254596; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=b6+ASPTDFA3DxrRYgx3GfT5NnPZdiT3QtaDFTDutrmo=; b=MCABs3RoNOCmesWzQlUm+6vvHpHrMhH1fR5wHuuiyK8qd6EieIUlr30tmwIE02CmTH VQHXQe1ZtX0/zeh1Jiyln4VxLbUM/taap8Aqt4AK1iJMHjaWeXvAKFZpl06nys9BeHXb dGMC/RJsiKs8g4kHsO8C0azKqOf/6DN093ozM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720649796; x=1721254596; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=b6+ASPTDFA3DxrRYgx3GfT5NnPZdiT3QtaDFTDutrmo=; b=SNpLM2VvDkoxELUxozcr0EIxqUTt5eikBoAdYlG0HpMsDSvj6Me+qDFfyvpsl+ZA/m roHQrXVVrCnSBG/lBXEJifxHxAblhS00HB++u/Ioim51ArcLLp/1afQFTp/yUoN8/Fsw qnH+xekvB/isJtgs4c01dcz/vSjv1HtWplHLAX2j2gCW1vluV7zeGmBrLyHAaMYrP05y mc4nqOGNLAAuDt+Mpi1u4JysYvkrkAUf0LgT91dLmrJb3OaAJGEJv7xhsYFd8pvSm5ln 1tISobvNvwa8JCchZjJu8dFVcKgAFPiBBnn/UVbZ+DCjUJ0uFSOwZrQvild+k3Q9x8vy roSw== X-Forwarded-Encrypted: i=1; AJvYcCUdwLtXeeh5qxONz/XsIHIWLzEVvIhSQnn0wHGhZTfMlw3JXJ101N6gTl4b3RGDjIXTQYsF7QGJis0iShhcbFKGP0YsXtH5dcMoyOSMlcsPr68FPAg= X-Gm-Message-State: AOJu0Yy8CoL0A8VV9VIeFkwM7MWbzRO6xJlM+pKWDOz/rFTEKPxueV1b 5fyaWwQxdU1qH/RMVxUGr898OU8l0PCFIfeOndKUnJvbhO2fOLld4dB7dwGCFA== X-Google-Smtp-Source: AGHT+IH0VKnbD5luyRuJzLKzu4f+WxueIorwellFt1gQIkpo9RP8ufmp8ePi1sR63758z/8uVJEfBg== X-Received: by 2002:a05:6214:ca9:b0:6b0:82cc:5e76 with SMTP id 6a1803df08f44-6b61c22f6f5mr86387206d6.62.1720649795662; Wed, 10 Jul 2024 15:16:35 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b61ba04c16sm20182326d6.60.2024.07.10.15.16.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 15:16:35 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , 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 v3 01/12] dt-bindings: PCI: Change brcmstb YAML maintainer Date: Wed, 10 Jul 2024 18:16:15 -0400 Message-Id: <20240710221630.29561-2-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240710221630.29561-1-james.quinlan@broadcom.com> References: <20240710221630.29561-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_151636_899579_F0E5EEC5 X-CRM114-Status: GOOD ( 11.19 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Nicolas has not been active for a while. It also makes sense for a Broadcom employee to be the maintainer as many of the details are privy to Broadcom. Signed-off-by: Jim Quinlan Acked-by: Rob Herring (Arm) Reviewed-by: Florian Fainelli --- Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 11f8ea33240c..558a18fd2e77 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Brcmstb PCIe Host Controller maintainers: - - Nicolas Saenz Julienne + - Jim Quinlan properties: compatible: From patchwork Wed Jul 10 22:16:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13729770 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62042C3DA42 for ; Wed, 10 Jul 2024 22:17:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Dj53pa62woG9teHY51aUsOX5X/OnSH0xQN53j9QYe9E=; b=0Py9dYUH4PE80bqYu4YR3kJCk7 9x4/ha0A849MisbY4i8NEvBVYGdH8NktICAcbPLWGNVWzbj33lOqnD9whBTf6mNPQiijCo+9kxdbE tBzrOFxsGibiD025AU0dJV8Cx0MgNMbyQLE4x5T+QO6lsO7LP7e6sJEaHZLhx76882cpQKcsuOTJd aM7W64lyLa9+pFutFB+St4WkmpS1wsqJUozOMKmOAptU1YgtVpOBXT1Zy5nJ7t2KPE1iNRQMZeUM3 CizIcDA28bBWZhzmsbzgDdNjzYBq0W/eWCDd5YPSjzIoHmyAf9iwFbKiKlsW/WTR/3id1aU1JqWrd Jjxx3zEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfcw-0000000BuHn-0Tqd; Wed, 10 Jul 2024 22:17:30 +0000 Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfc6-0000000BtqJ-2Swk for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 22:16:40 +0000 Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-6b61689d7c9so1650836d6.2 for ; Wed, 10 Jul 2024 15:16:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720649797; x=1721254597; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=Dj53pa62woG9teHY51aUsOX5X/OnSH0xQN53j9QYe9E=; b=QiEPwlT6nKebXdgHz5zfjQN+mno1QqGfzgTAeT4VqqI5LP5RrToiYozXK1JwADaUXP RMBAM50fyrbjsekPphaleW1HaasYlN+K0p2Uh1rwZxSYr76Vd4bfea4BxdzSpTz6cLJi o1Tj4msIh++Bh2e39ISOwxSwPMQw1WcQPvN4w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720649797; x=1721254597; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Dj53pa62woG9teHY51aUsOX5X/OnSH0xQN53j9QYe9E=; b=i05EpJfcN2tTlUHLQPCkj2mXDxb0POmFH7RRcjIjTrLtLQL7BXl8l+0PUfLRmLQB8J DsheI7NkWGr/YjiML1mhM56WIEBNd2cpTJJEgpyIGlhzOtW5TmNNdcUK51KtE037Kf1W YuM0jdjOYE8nMq2USa5ffOj+60Jo9cDdk1eH3uH19yZi3aBAEopyUu/GGqBEJJTR3jYi Ca+BrOTBf3W33QBjBjZCuZ2hre+h6Qn2et3bgCsYoeskjr/DJEEnovZjKb8VoRratbJc GLe7o5k/jvpRBhPEE8mtRovww1Qd9hktQTK99nJOrNaZiRxtGKF+ouDbtQ3vMRkMB6LO X6qA== X-Forwarded-Encrypted: i=1; AJvYcCVjJkO7qdc4TPXqtGiA1AHCZUErgbS1pS/JPSPZ4r90MD5YLIA64YaLsgLRmNwMpWIHlmoQ6M1DvlZRVL9q0cLkdItIXnygZjZ+avchVtcODn1Nw4E= X-Gm-Message-State: AOJu0Yzxy0NpitmHN0Tlg1uOmSM1/JFPw2fIFaL784OzJ00d6TKr2Jii R6yiTe4+ZFGa+Ftj8hVeiA5fi7ZVSUBmSwpgBK5GQ+yZ5HbmlGRtkxBIhyyTZw== X-Google-Smtp-Source: AGHT+IFzVGiiSLmMGDXbNCHIA1KeqD+W+twXnb8DN1H60OFrc0BAZkdMUwHWH9AyiPfpAuyTfdjgpg== X-Received: by 2002:a05:6214:e6d:b0:6b5:4249:7c5 with SMTP id 6a1803df08f44-6b61bf37662mr72990276d6.36.1720649797405; Wed, 10 Jul 2024 15:16:37 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b61ba04c16sm20182326d6.60.2024.07.10.15.16.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 15:16:36 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , 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 v3 02/12] dt-bindings: PCI: Cleanup of brcmstb YAML and add 7712 SoC Date: Wed, 10 Jul 2024 18:16:16 -0400 Message-Id: <20240710221630.29561-3-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240710221630.29561-1-james.quinlan@broadcom.com> References: <20240710221630.29561-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_151638_656879_C7D7A621 X-CRM114-Status: GOOD ( 11.18 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org o Change order of the compatible strings to be alphabetical o Describe resets/reset-names before using them in rules o Add in new resets for 7712 (swinit, bridge) o Add in changes for 7712 Signed-off-by: Jim Quinlan --- .../bindings/pci/brcm,stb-pcie.yaml | 46 +++++++++++++++++-- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 558a18fd2e77..dd7c76ec9ceb 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -16,11 +16,12 @@ properties: - brcm,bcm2711-pcie # The Raspberry Pi 4 - brcm,bcm4908-pcie - brcm,bcm7211-pcie # Broadcom STB version of RPi4 - - brcm,bcm7278-pcie # Broadcom 7278 Arm - brcm,bcm7216-pcie # Broadcom 7216 Arm - - brcm,bcm7445-pcie # Broadcom 7445 Arm + - brcm,bcm7278-pcie # Broadcom 7278 Arm - brcm,bcm7425-pcie # Broadcom 7425 MIPs - brcm,bcm7435-pcie # Broadcom 7435 MIPs + - brcm,bcm7445-pcie # Broadcom 7445 Arm + - brcm,bcm7712-pcie # STB sibling SOC of Raspberry Pi 5 reg: maxItems: 1 @@ -95,6 +96,20 @@ properties: minItems: 1 maxItems: 3 + resets: + items: + - description: reset for phy reset calibration + - description: reset for PCIe/CPU bus bridge + - description: reset for soft PCIe core reset + - description: reset for external PCIe PERST# signal + + reset-names: + items: + - const: rescal + - const: bridge + - const: swinit + - const: perst + required: - compatible - reg @@ -118,8 +133,8 @@ allOf: then: properties: resets: - items: - - description: reset controller handling the PERST# signal + minItems: 1 + maxItems: 1 reset-names: items: @@ -136,12 +151,33 @@ allOf: then: properties: resets: + minItems: 1 + maxItems: 1 + + reset-names: items: - - description: phandle pointing to the RESCAL reset controller + - const: rescal + + required: + - resets + - reset-names + + - if: + properties: + compatible: + contains: + const: brcm,bcm7712-pcie + then: + properties: + resets: + minItems: 3 + maxItems: 3 reset-names: items: - const: rescal + - const: bridge + - const: swinit required: - resets From patchwork Wed Jul 10 22:16:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13729771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D195CC3DA41 for ; Wed, 10 Jul 2024 22:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=i31BPpHnLaJ/rNDJ66yrZ8cgLwdnKqIGDV88VSFmL9M=; b=Ya7scIGD2dXHekUI4+Eiy4svvB +ITNcg8jM63fm+jNa0ZTK+mzPhJZOSfZg1TiA+5D49LfSNvw8PmWZoai1VfuEZErL30N3U8TP2sna JhYpFhubpGYZKZAitMgdfOrug19wd6mId8q2q/S6Ohh9G2zg3jVK+/O2qUYlebOc12z3q84lnlPoD OkZ+LPQurRGPOi00r0pL+xzMW/sHHCM3ovP7jJBg959IjraSZKikWXJvcPfityFPkUdPFe7iEl+SL lVHDYVM9eInYaSaQeO+rDnTzwMpuCYnXk7e0hmaHk2QGCaEH/6Q+qjh4z9JQYc41HlGY4N5FN1i+H PYix7UCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfdL-0000000BuTg-2d0g; Wed, 10 Jul 2024 22:17:55 +0000 Received: from mail-qv1-xf2c.google.com ([2607:f8b0:4864:20::f2c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfc8-0000000BtrU-0RvL for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 22:16:42 +0000 Received: by mail-qv1-xf2c.google.com with SMTP id 6a1803df08f44-6b73f7b855bso1608506d6.3 for ; Wed, 10 Jul 2024 15:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720649799; x=1721254599; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=i31BPpHnLaJ/rNDJ66yrZ8cgLwdnKqIGDV88VSFmL9M=; b=Cfx4YaQMPV9gAglCT70WHicqm5J4H4V3Um6IMHnEL9hUeDu3bBTX3N9e5pthdkDAo5 cE+AyXpvNN4Xp4lgS3vbkc9+D0P+hIfIf7rA+xfF334AJW8iU9+BEp7xs2i2rAiZHV/i qAz8TQCRHGmDgf7CFhWOgztMfP60Owfcvt7wU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720649799; x=1721254599; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=i31BPpHnLaJ/rNDJ66yrZ8cgLwdnKqIGDV88VSFmL9M=; b=ZSH36lWXdiwNpskzG+WTG7T98wGOJWTjgcCqYDK77nXRMp2Q6mweNU3hJsZ4divbo2 dPH1pMUsvir5kcRB+FlOqyKtYA7Dz6TRC3/n2XdaE80qaxYnaFEZwJ5Q81ukSoqgrKGT OgSqEkLE4vR642wsA2uKv0virGVSxPARvLPQBQHF18ujY68124DB3zR4IfaSvh434CV2 vQ8H01uEpGPDhG7hDnlEr1m2hCYj4YPbHl51r/Bw1XOQ0/J/FfUdDuegXox1D8XUFs2H yhapjlrdCvtLdPvOudJmIQHYUZuhfbYGdFyTVsKTkvPHdgsAacjZctfXAFjisDAbvxny WE7g== X-Forwarded-Encrypted: i=1; AJvYcCXpITdTRgrKmwVc69GZaQjHXNVKzO4CZzH6OMcyQEvVuFm/7BkXLhF11PUHz5QH3HQRFL3YZBAl6Ub61cl9U7gB4WaDp1qjK/HZ7dKA1LcLKVhHxR4= X-Gm-Message-State: AOJu0YxzhmFeWRWicM9m2vGdSdmNaO9iAQEA5XlcfxZgu2vuR8XZb4dw C/YADUZ/dq1vd/iY2IbS1UBB5X+Y1XDRAN57vyut9x5uUzCNPj6Rvf9k4mx7CA== X-Google-Smtp-Source: AGHT+IGbfaXkPyk4MDsNSx6d35fq97HqilT9H1mudUwc/uOzVRR+c/sXn3tlIfapfqJG9SCcL0HVUQ== X-Received: by 2002:a05:6214:246d:b0:6b2:c034:6aa3 with SMTP id 6a1803df08f44-6b61bf35eb5mr63873476d6.35.1720649798807; Wed, 10 Jul 2024 15:16:38 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b61ba04c16sm20182326d6.60.2024.07.10.15.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 15:16:38 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , 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 v3 03/12] PCI: brcmstb: Use common error handling code in brcm_pcie_probe() Date: Wed, 10 Jul 2024 18:16:17 -0400 Message-Id: <20240710221630.29561-4-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240710221630.29561-1-james.quinlan@broadcom.com> References: <20240710221630.29561-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_151640_190036_00313DE9 X-CRM114-Status: GOOD ( 13.17 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org o Move the clk_prepare_enable() below the resource allocations. o Add a jump target (clk_out) so that a bit of exception handling can be better reused at the end of this function implementation. Signed-off-by: Jim Quinlan Fixes: bb610757fcd7 ("PCI: brcmstb: Use reset/rearm instead of deassert/assert") Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 29 +++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c08683febdd4..c257434edc08 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1613,31 +1613,30 @@ static int brcm_pcie_probe(struct platform_device *pdev) pcie->ssc = of_property_read_bool(np, "brcm,enable-ssc"); - ret = clk_prepare_enable(pcie->clk); - if (ret) { - dev_err(&pdev->dev, "could not enable clock\n"); - return ret; - } pcie->rescal = devm_reset_control_get_optional_shared(&pdev->dev, "rescal"); - if (IS_ERR(pcie->rescal)) { - clk_disable_unprepare(pcie->clk); + if (IS_ERR(pcie->rescal)) return PTR_ERR(pcie->rescal); - } + pcie->perst_reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "perst"); - if (IS_ERR(pcie->perst_reset)) { - clk_disable_unprepare(pcie->clk); + if (IS_ERR(pcie->perst_reset)) return PTR_ERR(pcie->perst_reset); + + ret = clk_prepare_enable(pcie->clk); + if (ret) { + dev_err(&pdev->dev, "could not enable clock\n"); + return ret; } ret = reset_control_reset(pcie->rescal); - if (ret) + if (ret) { dev_err(&pdev->dev, "failed to deassert 'rescal'\n"); + goto clk_out; + } ret = brcm_phy_start(pcie); if (ret) { reset_control_rearm(pcie->rescal); - clk_disable_unprepare(pcie->clk); - return ret; + goto clk_out; } ret = brcm_pcie_setup(pcie); @@ -1676,6 +1675,10 @@ static int brcm_pcie_probe(struct platform_device *pdev) return 0; +clk_out: + clk_disable_unprepare(pcie->clk); + return ret; + fail: __brcm_pcie_remove(pcie); return ret; From patchwork Wed Jul 10 22:16:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13729772 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D507DC3DA42 for ; Wed, 10 Jul 2024 22:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VMQavjXRDGGsFib2hEcP7EEO/eQ2OugbTQ/0Bjwg9j4=; b=Yswvh81SzqbTucEdaGFYlOLyGU HyWDfi5kRCUwyNmyt37V1J3GmyUen9vWfab1Eqjddu2ukFyCZzOjJVUYTnev1Cm5uvjVs8nakymEC aNHAhSP5QOSb+yDBnENS5GnLBp2muPjBjDgVm6mIeqz7s482z2xduSmPNpRh0UTIV/zCr0Maev6hD iau5C89mBkB7a6iEn+VdUj8m4oFFoYDIk0pR383A+CmHfRkh0yu4FuzqyaF7SYtlFHkbuQZzuKkOq laUNN8ImpZ7KcBGCklyZirgXMJ1jrSlGFV510V7ztFDP1iop7wC51vRzryDODGRFqhD5A+W9OORzx qOwjnq1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfdf-0000000Bub7-2Leq; Wed, 10 Jul 2024 22:18:15 +0000 Received: from mail-qv1-xf29.google.com ([2607:f8b0:4864:20::f29]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfcA-0000000Btse-0orR for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 22:16:43 +0000 Received: by mail-qv1-xf29.google.com with SMTP id 6a1803df08f44-6b2c6291038so2606796d6.0 for ; Wed, 10 Jul 2024 15:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720649801; x=1721254601; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=VMQavjXRDGGsFib2hEcP7EEO/eQ2OugbTQ/0Bjwg9j4=; b=Vj2d/0WHEWAn2yGvp/B/3+De5eqdJMx637xPGUUmbblRKXksvHMMdf7PTSXq/KNDe+ XtGFlzKc0osU6tFbZXRf1A1bkZDEJPsXyC34NV035epFgN5mjCn3zTU7l/I+6iMN/I8S udIkm/+EBw0KRVTzXWFQ355G4zhaC8g563Mwk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720649801; x=1721254601; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VMQavjXRDGGsFib2hEcP7EEO/eQ2OugbTQ/0Bjwg9j4=; b=UZ6liCSqCf4SJyJxqRIr3SFU4zoTJSMnsnwwuL61epgJ5TTbXb+612WeKGfUkoeS7G qWXaOAIMKXJvma+byaO3vy93lr0ja6INgHHdFNJoRPrZ0PzEvNPi9gM5wffuXl6CLxu8 1AAspsP4ddhjL87bG2VzUyTa6vG/MMnvIJpP///RBUJDNjyyjJiAKKggMMAwssnn/7qW UXeDDfSWQGukECfwWGYXW1a6wWNywOGpjJpXclBkqp4jEku8mt0FPmZW19LMpxknzkNc i4SrpD+7n7V8w1QPOQXrkeSCjKY1qJD4kH4N+1dU1zB8iBANmyrho2z9dOTUJfX5sKLP QJ7g== X-Forwarded-Encrypted: i=1; AJvYcCWqStq7Vyo/Z9sh4IuoJxlhOrpWTwupe2vn8rwt0EsXW6hdcwGr8WG1zTxRP17/guz/J/vB+gW4z2TvvKl+E0EFfnEMYM/VJjsWX6yzV8hZLyLZ2tU= X-Gm-Message-State: AOJu0Yz9Y1jEcAakX1nK4ae//hOzGBd+ckFROIlDkn243m9tgHw9v2yU RbVrvH08B+kEzooh2IUT+VXfuD8+xHfGMtjdKrABpwfQ7GTTDxJh7n/jZFMVhg== X-Google-Smtp-Source: AGHT+IEFszqDYHgLTXOgHqniypXaVbCrQbk7+dn4z18FToqE6q68oLFQCznDBmnR9H0GvGwhBcSjWA== X-Received: by 2002:ad4:576d:0:b0:6b5:82e1:f89e with SMTP id 6a1803df08f44-6b74af4debbmr21921196d6.9.1720649800729; Wed, 10 Jul 2024 15:16:40 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b61ba04c16sm20182326d6.60.2024.07.10.15.16.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 15:16:39 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Philipp Zabel , 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 v3 04/12] PCI: brcmstb: Use bridge reset if available Date: Wed, 10 Jul 2024 18:16:18 -0400 Message-Id: <20240710221630.29561-5-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240710221630.29561-1-james.quinlan@broadcom.com> References: <20240710221630.29561-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_151642_340332_C1355C11 X-CRM114-Status: GOOD ( 16.57 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 7712 SOC has a bridge reset which can be described in the device tree. If it is present, use it. Otherwise, continue to use the legacy method to reset the bridge. Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c257434edc08..92816d8d215a 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -265,6 +265,7 @@ struct brcm_pcie { enum pcie_type type; struct reset_control *rescal; struct reset_control *perst_reset; + struct reset_control *bridge; int num_memc; u64 memc_size[PCIE_BRCM_MAX_MEMC]; u32 hw_rev; @@ -732,12 +733,19 @@ static void __iomem *brcm7425_pcie_map_bus(struct pci_bus *bus, static void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val) { - u32 tmp, mask = RGR1_SW_INIT_1_INIT_GENERIC_MASK; - u32 shift = RGR1_SW_INIT_1_INIT_GENERIC_SHIFT; + if (pcie->bridge) { + if (val) + reset_control_assert(pcie->bridge); + else + reset_control_deassert(pcie->bridge); + } else { + u32 tmp, mask = RGR1_SW_INIT_1_INIT_GENERIC_MASK; + u32 shift = RGR1_SW_INIT_1_INIT_GENERIC_SHIFT; - tmp = readl(pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); - tmp = (tmp & ~mask) | ((val << shift) & mask); - writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); + tmp = readl(pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); + tmp = (tmp & ~mask) | ((val << shift) & mask); + writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); + } } static void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val) @@ -1621,6 +1629,10 @@ static int brcm_pcie_probe(struct platform_device *pdev) if (IS_ERR(pcie->perst_reset)) return PTR_ERR(pcie->perst_reset); + pcie->bridge = devm_reset_control_get_optional_exclusive(&pdev->dev, "bridge"); + if (IS_ERR(pcie->bridge)) + return PTR_ERR(pcie->bridge); + ret = clk_prepare_enable(pcie->clk); if (ret) { dev_err(&pdev->dev, "could not enable clock\n"); From patchwork Wed Jul 10 22:16:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13729773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42B92C41513 for ; Wed, 10 Jul 2024 22:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vEe8nHTebX5ZmwOjn3M4MyvN16f8hKhe61eShs56lxU=; b=CC4l3LD+quL0M0+1Jb3upGwnez 2EzqkXsJTR3YKtLDiz3Qwr/PLKALrnQDGj66c0MtUhUNcp1xQEzG6wAxknUm6hHQCU0aFxD4t2rd9 r3a9G+I/iGIMzKR3+wLgfFL8jms2GCN2x1S1IkwtFQFuNZ6ThjDyt4QA+bqL7uFpduqMX5ArXomgT 838t4trtlVPqj+bQIN/f6z39c0JCJP25Jrc7ee0fjGDdmGBfQCPjFNvl59irjj/5Y6Y2FrZWVn3A8 uaH0uqmskyTMYJhfQw7TqSS3OA1CDYL0Mpc3PznwwxELTJSUA1JedLuG1VgBV1sZXVNHgAcrRE3Bh QLbyfOfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfdz-0000000Buk4-3c5i; Wed, 10 Jul 2024 22:18:35 +0000 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfcC-0000000Btu0-1Yao for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 22:16:46 +0000 Received: by mail-qv1-xf2f.google.com with SMTP id 6a1803df08f44-6b5f46191b5so1566876d6.3 for ; Wed, 10 Jul 2024 15:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720649802; x=1721254602; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=vEe8nHTebX5ZmwOjn3M4MyvN16f8hKhe61eShs56lxU=; b=fBhUbLDSVSmSQCORrYXbX+J8DEg5A99cwjT9BZMLp5LXnwLq9SiVjRtdnfLKDaqz88 Hj5GY8fSFeLCn3NGraybY+nSfvbyopYVhZQKBEbKs1J/CK8EGDY0nw5rdPnpId+6F/6y UE6gkWhDWMMlNTtyUEchDI07OpesNq0+RdARU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720649802; x=1721254602; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vEe8nHTebX5ZmwOjn3M4MyvN16f8hKhe61eShs56lxU=; b=q2zHxMqoVb2jVtPbbsEY6f18UbYbmvxUAdHvsNSWReSMqtRZ0nPIG6Mc2Gp9JcFrG0 unBpg6SWOKe03gf2bq+V9H6oIv3O259dUY3Fx3hNL2IXe/Q0eTtmaJJ4WisckSG6y0NS 2LnovYpXxbsrRDgb8a+7xyMfMeZysS5uBTLJNQRpdDI1bOLXY4UBYCgTTHtmA7tTPzCr 0MZRwLKHSlW0uwDWaxCIW0ftWWYE2vltMpiDBdsVuJbhabJzNvqMv30f8YV1Ct+9rcRv gNHOo4cUytSjF0K0qYTKQwZWqfa0JCwmjFTofOUMWAKz6naivYIvclXUq12B69XYfXeq wBGQ== X-Forwarded-Encrypted: i=1; AJvYcCV3zdMt5xxOZ1ix4oM3nB9C7Urj8zMP9mrF1aeiZr3o614/KOMuA9vZaNBFUTYwZ2uI2WzIkcx7kHx2nonfeWAMd0N1/G4/p/XwTZ2Nm1GaxKhedT4= X-Gm-Message-State: AOJu0Yw7/D8wuQ9wehOCLYZDOG/FufaT4F+ZfpSOE90Hti5tgaZERddG 7tmm9f2nHUggzb9EgOt26TWVoG86DszxyfNw7kOWesXOhKIUllFXqaKy8WEmug== X-Google-Smtp-Source: AGHT+IEeVUPlnNidAa9SALkkKZQJNT6/gbAlf1iNlCDge62/953JXBjPRy9yUAZ9n3SwyY9QXW6cSg== X-Received: by 2002:a05:6214:194c:b0:6b5:e190:437 with SMTP id 6a1803df08f44-6b61bc83574mr70828616d6.12.1720649802322; Wed, 10 Jul 2024 15:16:42 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b61ba04c16sm20182326d6.60.2024.07.10.15.16.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 15:16:41 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Philipp Zabel , 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 v3 05/12] PCI: brcmstb: Use swinit reset if available Date: Wed, 10 Jul 2024 18:16:19 -0400 Message-Id: <20240710221630.29561-6-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240710221630.29561-1-james.quinlan@broadcom.com> References: <20240710221630.29561-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_151644_473668_6C419B53 X-CRM114-Status: GOOD ( 13.43 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 7712 SOC adds a software init reset device for the PCIe HW. If found in the DT node, use it. Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 92816d8d215a..4dc2ff7f3167 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -266,6 +266,7 @@ struct brcm_pcie { struct reset_control *rescal; struct reset_control *perst_reset; struct reset_control *bridge; + struct reset_control *swinit; int num_memc; u64 memc_size[PCIE_BRCM_MAX_MEMC]; u32 hw_rev; @@ -1633,12 +1634,27 @@ static int brcm_pcie_probe(struct platform_device *pdev) if (IS_ERR(pcie->bridge)) return PTR_ERR(pcie->bridge); + pcie->swinit = devm_reset_control_get_optional_exclusive(&pdev->dev, "swinit"); + if (IS_ERR(pcie->swinit)) + return PTR_ERR(pcie->swinit); + ret = clk_prepare_enable(pcie->clk); if (ret) { dev_err(&pdev->dev, "could not enable clock\n"); return ret; } + ret = reset_control_assert(pcie->swinit); + if (ret) { + dev_err_probe(&pdev->dev, ret, "could not assert reset 'swinit'\n"); + goto clk_out; + } + ret = reset_control_deassert(pcie->swinit); + if (ret) { + dev_err(&pdev->dev, "could not de-assert reset 'swinit' after asserting\n"); + goto clk_out; + } + ret = reset_control_reset(pcie->rescal); if (ret) { dev_err(&pdev->dev, "failed to deassert 'rescal'\n"); From patchwork Wed Jul 10 22:16:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13729774 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4E423C3DA41 for ; Wed, 10 Jul 2024 22:19:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FTs4XDCa93wZwJzx7fbJCTwtiqOGrbXXM3/rORj8bHU=; b=fuHQ5MjIXDFySi64W1IXAexnKs zRs6A6OYS3oC9Os7O5B/gYfk7fmVJjC/6/sAuYraF08hgzDM53gVLn0r2G8QvucO0hk8FWhlRpFo/ mwXvGrI8cv7QQxm/RrO0Sq+fyMj4vpZlUYZYoqwzGLjMPDAa3oVfnpv8Y5C3QIfaqZ++ZmYFuoQJG ozyEjNsZtO5TC8fCag3XmKxUjXnFJ33SB/skJD3YUSwxenJRwjDsFDzN++5NxYuW7crkWakSO6GgC pDfj4hPQLDB+Pfzgf57hMxNUQz9sXkDsBdzPzaVVGDo6Ep+zzmQftWILJBuab/1X0uHU8gB875vdo qwnGv2XQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfeK-0000000Buu2-0TjM; Wed, 10 Jul 2024 22:18:56 +0000 Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfcD-0000000BtuV-1LxP for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 22:16:48 +0000 Received: by mail-qv1-xf2d.google.com with SMTP id 6a1803df08f44-6b61689d7c9so1651316d6.2 for ; Wed, 10 Jul 2024 15:16:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720649804; x=1721254604; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=FTs4XDCa93wZwJzx7fbJCTwtiqOGrbXXM3/rORj8bHU=; b=ZW3NNGHypj7CykbaGyXlSchB2g+sAxbvk3XO7e+fB+X/oQ4nmQny1Ff++i8Xur2KI7 FidvBTOlQNtmwMTgmkEeHZIhPHfOGmAdciaBLRHoHohKun30cgOB8fYqdR8lDWf8eSkz +jwxP/MmIPHSVfYryq/qLp00XQSnaZqMMRuuY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720649804; x=1721254604; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FTs4XDCa93wZwJzx7fbJCTwtiqOGrbXXM3/rORj8bHU=; b=iW3E5eZjGdmuY0leE6VouibUchZL5XTHjfhQqhGNY5gCJDU5MtyA/kd1HOczSahl4L +0af2orf/mTGObU7aNuWOatJluWVwDfR8FwNy50qSyi9B3xta3L5cPvDHB6UdHLIBqP0 ISV/ESryvQaYNXYmXcZ99+NhyAiGoT9zwkSQkhHr4mI17JEsk0+Le6FW4Y61LxgB/yqR 6NWSL0gGZ8VzggSvN6ufEDOiiW2qbSVyXCsG9FLVtc3ItJvXs4CI1WWxOVf3mVnUNkli PFWOB+2onY3ZNi/qzkXzYRZAlO3v/0/t1gR1nOdUjNmj7ynQqngVO2oqonBWXMGkopTa k7aA== X-Forwarded-Encrypted: i=1; AJvYcCVZ42cIEUM8t06BQ3md9i37Feq3wabtoK5/FfByV6WRKWAgByXLqgKL6xqSPS6hhhPe/88l+8rhNuGVhA9l879JqG1aswbfZoASECi4R/QeV7vbxR4= X-Gm-Message-State: AOJu0YxJAAQjEhXwuDsBXlvQuOF6c0JqLJ7YowWODUV9t8f0COkcTlGJ UhnEUsV4wZ76DdJxwTW584yCbbKSNdSPA6jf3nKqju1wMJ160h+gs5tpwHLp8Q== X-Google-Smtp-Source: AGHT+IG8ry48NqfLFCbYkREGZRQiZDjSrLmTy664Unix+U8/fujtjevJZRLEjPDNIKX0cyQAduJjhQ== X-Received: by 2002:a05:6214:c44:b0:6b5:dfc2:66b4 with SMTP id 6a1803df08f44-6b61c1fa4femr83308176d6.61.1720649803827; Wed, 10 Jul 2024 15:16:43 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b61ba04c16sm20182326d6.60.2024.07.10.15.16.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 15:16:43 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , 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 v3 06/12] PCI: brcmstb: PCI: brcmstb: Make HARD_DEBUG, INTR2_CPU_BASE offsets SoC-specific Date: Wed, 10 Jul 2024 18:16:20 -0400 Message-Id: <20240710221630.29561-7-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240710221630.29561-1-james.quinlan@broadcom.com> References: <20240710221630.29561-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_151645_395937_5C4F0E63 X-CRM114-Status: GOOD ( 15.00 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Our HW design has again changed a register offset which used to be standard for all Broadcom SOCs with PCIe cores. This difference is now reconciled for the registers HARD_DEBUG and INTR2_CPU_BASE. Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 39 ++++++++++++++++----------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 4dc2ff7f3167..073d790d97b7 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -122,7 +122,6 @@ #define PCIE_MEM_WIN0_LIMIT_HI(win) \ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI + ((win) * 8) -#define PCIE_MISC_HARD_PCIE_HARD_DEBUG 0x4204 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK 0x2 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK 0x200000 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000 @@ -131,9 +130,9 @@ (PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK | \ PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK) -#define PCIE_INTR2_CPU_BASE 0x4300 #define PCIE_MSI_INTR2_BASE 0x4500 -/* Offsets from PCIE_INTR2_CPU_BASE and PCIE_MSI_INTR2_BASE */ + +/* Offsets from INTR2_CPU and MSI_INTR2 BASE offsets */ #define MSI_INT_STATUS 0x0 #define MSI_INT_CLR 0x8 #define MSI_INT_MASK_SET 0x10 @@ -184,9 +183,11 @@ #define SSC_STATUS_PLL_LOCK_MASK 0x800 #define PCIE_BRCM_MAX_MEMC 3 -#define IDX_ADDR(pcie) (pcie->reg_offsets[EXT_CFG_INDEX]) -#define DATA_ADDR(pcie) (pcie->reg_offsets[EXT_CFG_DATA]) -#define PCIE_RGR1_SW_INIT_1(pcie) (pcie->reg_offsets[RGR1_SW_INIT_1]) +#define IDX_ADDR(pcie) ((pcie)->reg_offsets[EXT_CFG_INDEX]) +#define DATA_ADDR(pcie) ((pcie)->reg_offsets[EXT_CFG_DATA]) +#define PCIE_RGR1_SW_INIT_1(pcie) ((pcie)->reg_offsets[RGR1_SW_INIT_1]) +#define HARD_DEBUG(pcie) ((pcie)->reg_offsets[PCIE_HARD_DEBUG]) +#define INTR2_CPU_BASE(pcie) ((pcie)->reg_offsets[PCIE_INTR2_CPU_BASE]) /* Rescal registers */ #define PCIE_DVT_PMU_PCIE_PHY_CTRL 0xc700 @@ -205,6 +206,8 @@ enum { RGR1_SW_INIT_1, EXT_CFG_INDEX, EXT_CFG_DATA, + PCIE_HARD_DEBUG, + PCIE_INTR2_CPU_BASE, }; enum { @@ -651,7 +654,7 @@ static int brcm_pcie_enable_msi(struct brcm_pcie *pcie) BUILD_BUG_ON(BRCM_INT_PCI_MSI_LEGACY_NR > BRCM_INT_PCI_MSI_NR); if (msi->legacy) { - msi->intr_base = msi->base + PCIE_INTR2_CPU_BASE; + msi->intr_base = msi->base + INTR2_CPU_BASE(pcie); msi->nr = BRCM_INT_PCI_MSI_LEGACY_NR; msi->legacy_shift = 24; } else { @@ -898,12 +901,12 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) /* Take the bridge out of reset */ pcie->bridge_sw_init_set(pcie, 0); - tmp = readl(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + tmp = readl(base + HARD_DEBUG(pcie)); if (is_bmips(pcie)) tmp &= ~PCIE_BMIPS_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK; else tmp &= ~PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK; - writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + writel(tmp, base + HARD_DEBUG(pcie)); /* Wait for SerDes to be stable */ usleep_range(100, 200); @@ -1072,7 +1075,7 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie) } /* Start out assuming safe mode (both mode bits cleared) */ - clkreq_cntl = readl(pcie->base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + clkreq_cntl = readl(pcie->base + HARD_DEBUG(pcie)); clkreq_cntl &= ~PCIE_CLKREQ_MASK; if (strcmp(mode, "no-l1ss") == 0) { @@ -1115,7 +1118,7 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie) dev_err(pcie->dev, err_msg); mode = "safe"; } - writel(clkreq_cntl, pcie->base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + writel(clkreq_cntl, pcie->base + HARD_DEBUG(pcie)); dev_info(pcie->dev, "clkreq-mode set to %s\n", mode); } @@ -1337,9 +1340,9 @@ static void brcm_pcie_turn_off(struct brcm_pcie *pcie) writel(tmp, base + PCIE_MISC_PCIE_CTRL); /* Turn off SerDes */ - tmp = readl(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + tmp = readl(base + HARD_DEBUG(pcie)); u32p_replace_bits(&tmp, 1, PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); - writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + writel(tmp, base + HARD_DEBUG(pcie)); /* Shutdown PCIe bridge */ pcie->bridge_sw_init_set(pcie, 1); @@ -1425,9 +1428,9 @@ static int brcm_pcie_resume_noirq(struct device *dev) pcie->bridge_sw_init_set(pcie, 0); /* SERDES_IDDQ = 0 */ - tmp = readl(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + tmp = readl(base + HARD_DEBUG(pcie)); u32p_replace_bits(&tmp, 0, PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); - writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + writel(tmp, base + HARD_DEBUG(pcie)); /* wait for serdes to be stable */ udelay(100); @@ -1499,12 +1502,16 @@ static const int pcie_offsets[] = { [RGR1_SW_INIT_1] = 0x9210, [EXT_CFG_INDEX] = 0x9000, [EXT_CFG_DATA] = 0x9004, + [PCIE_HARD_DEBUG] = 0x4204, + [PCIE_INTR2_CPU_BASE] = 0x4300, }; static const int pcie_offsets_bmips_7425[] = { [RGR1_SW_INIT_1] = 0x8010, [EXT_CFG_INDEX] = 0x8300, [EXT_CFG_DATA] = 0x8304, + [PCIE_HARD_DEBUG] = 0x4204, + [PCIE_INTR2_CPU_BASE] = 0x4300, }; static const struct pcie_cfg_data generic_cfg = { @@ -1539,6 +1546,8 @@ static const int pcie_offset_bcm7278[] = { [RGR1_SW_INIT_1] = 0xc010, [EXT_CFG_INDEX] = 0x9000, [EXT_CFG_DATA] = 0x9004, + [PCIE_HARD_DEBUG] = 0x4204, + [PCIE_INTR2_CPU_BASE] = 0x4300, }; static const struct pcie_cfg_data bcm7278_cfg = { From patchwork Wed Jul 10 22:16:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13729775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD483C3DA41 for ; Wed, 10 Jul 2024 22:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qZHa5y3iCEkoPHLPqx5QBO6taNN7F4zwqHM0pwBYt6E=; b=ehgtgBLQyiMl+gwLd340MWdCRR pHHUvOX/mmMRIu9bzEd6Gt50jKfM2xTzXMKnGBaYzKoVcuQJGyasUPVOynFCE9zITr+zPhzoqXuhL FVjReNaRGquPRDfItfmJGT9boOavmSpfbRAz0QKSsr0q5UJwtqvEcCzk0kaA+Mf4gSrwtATVPOHKw uwSG0fO9Dz+afF+d/vAzQyaruChboo+F076xKgepKPV49HSkiYrXy0Ax9o7RCaNDd1AYo+w2XLjG3 9nvTtL/Y+Nw/ZfGZ1nHT50DKpEA2J6uv27cqlJ9zpH5xI5IaAnNPw4t3MMfyVtkWqyJt4fhiEfhsc 5GvuusPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfeZ-0000000Bv0B-3n4O; Wed, 10 Jul 2024 22:19:11 +0000 Received: from mail-vk1-xa29.google.com ([2607:f8b0:4864:20::a29]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfcE-0000000BtwV-4015 for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 22:16:49 +0000 Received: by mail-vk1-xa29.google.com with SMTP id 71dfb90a1353d-4f2e147ee98so91149e0c.0 for ; Wed, 10 Jul 2024 15:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720649805; x=1721254605; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=qZHa5y3iCEkoPHLPqx5QBO6taNN7F4zwqHM0pwBYt6E=; b=gR1TWVN3YZPxlBKI0CEzmh19s4tvOoTM1kn7Ga/hCMJVaq3XbKv54emTNZPN3do1HO xhEZc0ibpaPdstyxgHkmkbL8QMQw5SVEGXbNQEwHddSs8Ip5ec/ZKgHnGWsIPWGYzV9N PbDMnhS2+a/ualU9dEpHr7KeLPai30EsaI0jo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720649805; x=1721254605; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qZHa5y3iCEkoPHLPqx5QBO6taNN7F4zwqHM0pwBYt6E=; b=l2VGXFVoKMP635ld2TrGNsHgbZJ5QfVt6hYklcS21ObQgw1MIQKIr7djtWTazlYCAt YWh9hmLQeb0rT/fz/D7mFfIRDRno+Tl6bGNZvO6qCmyKoaTmAdwVl+q4/vSmmUboJ76/ Db2pgqdyDcUfzFfXR0nLAfS7xbwlacAp6loIbFOQhb2oFZVoLmuE05UMLq6KQ5wWQxp+ xNtZZJ3NxkF7qAxBcHVvIbn7cFbJ1JnyRU3DZk7TxQxB33OPa3EbXD4//0w6IZ4/2j2B /srRzv/p3c4DWaLd0NGAXN8svNVs2hD9s1vaXXXGxyEvaK3bhQPboUd/t83Br3N143X6 /yqQ== X-Forwarded-Encrypted: i=1; AJvYcCXoFHuXDZW8jh0wp1DtSz9hiZ3l6PbOA/Jkt+rGFLg4c07gYnkpF5BCO+RPOxwSNOWl74WLkhJ9e5OP1knwqZnHQQh7Sh6ICMKA+HPlrAa836XhumU= X-Gm-Message-State: AOJu0Yza0MsIuiMKg8UdtB/Namu8JFFog0fkO/nZKXUK8hmrn3U4t+KQ 2HxEDIuIz0J333mRnNrxmn/sZirfJkt9PvPhpU2TZqBb2mmhfhLtJdUI1jFUrg== X-Google-Smtp-Source: AGHT+IHHR3GEDuWBr8tsLvacoJWVNJ8Mau4MVmsVzLsr4wifpnRwtQZlc2vyNz9MRGdQKIS52iDzDw== X-Received: by 2002:a05:6122:1797:b0:4f2:f2e1:5f04 with SMTP id 71dfb90a1353d-4f33f1e3ea1mr8388856e0c.8.1720649805203; Wed, 10 Jul 2024 15:16:45 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b61ba04c16sm20182326d6.60.2024.07.10.15.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 15:16:44 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , 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 v3 07/12] PCI: brcmstb: Remove two unused constants from driver Date: Wed, 10 Jul 2024 18:16:21 -0400 Message-Id: <20240710221630.29561-8-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240710221630.29561-1-james.quinlan@broadcom.com> References: <20240710221630.29561-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_151647_121871_3100E5B1 X-CRM114-Status: UNSURE ( 8.62 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Two constants in the driver, RGR1_SW_INIT_1_INIT_MASK and RGR1_SW_INIT_1_INIT_SHIFT are no longer used and are removed. Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 073d790d97b7..dfb404748ad8 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -210,11 +210,6 @@ enum { PCIE_INTR2_CPU_BASE, }; -enum { - RGR1_SW_INIT_1_INIT_MASK, - RGR1_SW_INIT_1_INIT_SHIFT, -}; - enum pcie_type { GENERIC, BCM7425, From patchwork Wed Jul 10 22:16:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13729776 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7FA35C3DA41 for ; Wed, 10 Jul 2024 22:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mxdDgMk4y93q1F86z0CEDKDwAJyUz85Uw1Y3qUcb9N0=; b=yU1kEgxzNUNgexDgMYEkvNbl7B pp3tUtHXrNv08mwlvMTUYaZkTEcAlhxm8/SJt/VQbuD/bJK82UxVfvdzajM+Xj9Vg8c4qMJf1DuMn wnSVG5YA799CYoUEjxlqtMvl2li5iHpSQiLRUSrjT3+ZldU+mq/tpxjnyuETXdQDUIXGaTJniRsm2 ucg72FOcCaD1LgYDxhFClhXEwj4g9HRafLdM57knXRWkqq9EM6EY6ULBXvb1N3PjWy446J2fE6SoC IM/7sv+bcYYzy08yFSptpJTnw+Am6aRt2jTvvDVe/RC58QjdPz70O2lq5yDxOgkB4Gcf541gz48zo 3SHZh/7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfex-0000000BvAk-2aTo; Wed, 10 Jul 2024 22:19:35 +0000 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfcG-0000000Btxk-3VI1 for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 22:16:51 +0000 Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-7039e4a4a03so121143a34.3 for ; Wed, 10 Jul 2024 15:16:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720649807; x=1721254607; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=mxdDgMk4y93q1F86z0CEDKDwAJyUz85Uw1Y3qUcb9N0=; b=Bz9/x7U+QSxiaXnIfMlKGrn0s3GOoS8q65sO9ELEswlmqg3sdKcHQ8j/S8dx1vO0xy t24nSRflg6PQZEaBoi9vCPzD7jBhugh54q0Vr0GLswKhLpT1rGH75qM39e4Edd/N4zhM k+7yVwQTsFMOlSA7OJP9O/1eucQ4feCmnhywY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720649807; x=1721254607; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mxdDgMk4y93q1F86z0CEDKDwAJyUz85Uw1Y3qUcb9N0=; b=cKJ0/ttJMa1zalJKnzLx7OxghO0JWxtKMcOsZCC/3Z3hX8kF2nLRlsVTGos7XgNpxv 1KEqXcIPBqxZKG1fJ86k4PuYQbNY8vOKx3coEPKyr5+SycPU+7LIAHlbAL67NAQIR6th 8q1hX5GcsZToKGOhR8d0tKnm2iyE0iwXm2N3v6wl5T0Qi0SssjDzoKP6g84UE84cmb18 IiR0ZWu8XVoll+3A2hgaSI0YiyKyoaolkuwHq7tdEK1foFQN3N+uFwOkLkSXzagwePWh JiVL744vyOaZ6GD1ZMnazLnCaZ9msIrL1bwJX3yxXV37tODiAxKxEvvphLZLBNmWPVei bi0g== X-Forwarded-Encrypted: i=1; AJvYcCWxbTHZmZ5Nl4M2h7IUD4nnGeL/SDCY/EIi4uz8rwvh1X43hNfeZA/tfGspRpYUqWF94iCgGoiFcTNeXRAmUtOkcrmbMcZopkWwFjdIBy+5nMlun8I= X-Gm-Message-State: AOJu0YxvDlZ1m6XHnJnmzR6pr9XKryNmzzcEc+9QodCHPAF/jTgTv+Lq XOVJDi3fcf2wVOQ8yxYUzmi6WqDe3McfZwlyO6rRmk9TV9cFBRYA40ZCH6aD9g== X-Google-Smtp-Source: AGHT+IGfstohiQxH9qeYpEe8jT1Qz3dU6XY4QCpslF096AfkFrsBFGhdMK+hAk+7UZl/TOMgq+/yJQ== X-Received: by 2002:a9d:7cd6:0:b0:703:662a:4627 with SMTP id 46e09a7af769-70375b499e2mr6777671a34.35.1720649807258; Wed, 10 Jul 2024 15:16:47 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b61ba04c16sm20182326d6.60.2024.07.10.15.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 15:16:46 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , 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 v3 08/12] PCI: brcmstb: Don't conflate the reset rescal with phy ctrl Date: Wed, 10 Jul 2024 18:16:22 -0400 Message-Id: <20240710221630.29561-9-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240710221630.29561-1-james.quinlan@broadcom.com> References: <20240710221630.29561-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_151649_015348_1BFA4D48 X-CRM114-Status: GOOD ( 15.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We've been assuming that if an SOC has a "rescal" reset controller that we should automatically invoke brcm_phy_cntl(...). This will not be true in future SOCs, so we create a bool "has_phy" and adjust the cfg_data appropriately (we need to give 7216 its own cfg_data structure instead of sharing one). Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index dfb404748ad8..8ab5a8ca05b4 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -222,6 +222,7 @@ enum pcie_type { struct pcie_cfg_data { const int *offsets; const enum pcie_type type; + const bool has_phy; void (*perst_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); }; @@ -272,6 +273,7 @@ struct brcm_pcie { void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); struct subdev_regulators *sr; bool ep_wakeup_capable; + bool has_phy; }; static inline bool is_bmips(const struct brcm_pcie *pcie) @@ -1311,12 +1313,12 @@ static int brcm_phy_cntl(struct brcm_pcie *pcie, const int start) static inline int brcm_phy_start(struct brcm_pcie *pcie) { - return pcie->rescal ? brcm_phy_cntl(pcie, 1) : 0; + return pcie->has_phy ? brcm_phy_cntl(pcie, 1) : 0; } static inline int brcm_phy_stop(struct brcm_pcie *pcie) { - return pcie->rescal ? brcm_phy_cntl(pcie, 0) : 0; + return pcie->has_phy ? brcm_phy_cntl(pcie, 0) : 0; } static void brcm_pcie_turn_off(struct brcm_pcie *pcie) @@ -1559,12 +1561,20 @@ static const struct pcie_cfg_data bcm2711_cfg = { .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, }; +static const struct pcie_cfg_data bcm7216_cfg = { + .offsets = pcie_offset_bcm7278, + .type = BCM7278, + .perst_set = brcm_pcie_perst_set_7278, + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, + .has_phy = true, +}; + static const struct of_device_id brcm_pcie_match[] = { { .compatible = "brcm,bcm2711-pcie", .data = &bcm2711_cfg }, { .compatible = "brcm,bcm4908-pcie", .data = &bcm4908_cfg }, { .compatible = "brcm,bcm7211-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7278-pcie", .data = &bcm7278_cfg }, - { .compatible = "brcm,bcm7216-pcie", .data = &bcm7278_cfg }, + { .compatible = "brcm,bcm7216-pcie", .data = &bcm7216_cfg }, { .compatible = "brcm,bcm7445-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7435-pcie", .data = &bcm7435_cfg }, { .compatible = "brcm,bcm7425-pcie", .data = &bcm7425_cfg }, @@ -1612,6 +1622,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) pcie->type = data->type; pcie->perst_set = data->perst_set; pcie->bridge_sw_init_set = data->bridge_sw_init_set; + pcie->has_phy = data->has_phy; pcie->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pcie->base)) From patchwork Wed Jul 10 22:16:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13729777 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB390C3DA41 for ; Wed, 10 Jul 2024 22:20:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PiCROvLdZ+/BJpmbH+Wate0IXvHec5pulx+hvKe9m38=; b=FzBuKpCwgKJKeFXhYRjEXhDytt 96664we9qe68Qwm/1b1mp0z1YKmlxi4gpuzdQ9m3TfjFIHaOCv/7fQnxIbZ6JjFgmWtpVrSpOhWEf /JWgKTio9ZhHzSp6GA/hCuPTgoj9lrU27BDIyfWfOIGT8R1CgWSy6tKL5MOyNAvKw6umQjW/9c0fB auoR3soMKkwQVcuKlbBehTqEUhP+Teu7UrcYvDGXREZ/u7zOmksp7EcqWtttLscf5EOOJExmryCb/ YHFbp6fsygpKQDFBa0n+YM2aZ/nrTl3MNQu+OvEFnYSzHPybyPeonSuzkoRMb88G3BXrIObiu5FLn msEfkrIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRffI-0000000BvLn-0DeX; Wed, 10 Jul 2024 22:19:56 +0000 Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfcH-0000000BtzG-3dpP for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 22:16:52 +0000 Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-6b5dc36b895so1690946d6.1 for ; Wed, 10 Jul 2024 15:16:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720649809; x=1721254609; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=PiCROvLdZ+/BJpmbH+Wate0IXvHec5pulx+hvKe9m38=; b=b8DB+xiRcvoFufuNDursdsmnOgi8bhpRpe0DVjnKLZDSzaytGXQ5J7Hc4cvWOKZtpG hoOMNZSZKq01Z3WbZ4kWP+Pvq0fQ8DcnPMaVbq0bsyp+UkyEuEtw1Vz4/6QstZB1etHQ jEdxrrx/DcPrXHlOe55I6pja9v0n9HiCIE76k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720649809; x=1721254609; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PiCROvLdZ+/BJpmbH+Wate0IXvHec5pulx+hvKe9m38=; b=vuHdWkEBCfdahTHaH61OBIcqehg2511UxpiOZrpefBKm3BW88oOK4thcNKA/BVyHIC pILAugs43ivMdZO3d5RQIWeI2hxxNDKMXWWZIOGp7zPa7+0lBRIxw2aCFHLOjnqKQXyP ESV7STcIH9+w31ogASQMqCAdTvPbnczBU7xTUMwgM8m556lc+gZpOv0XA+x1SZNpohpI D4s6ZKecCdYykMm8d/pTXOWa/9V1ww31GMoyZOAdKSXron9447SxBbeiJaD28xt4dwLl bHeFEQchlWcZVJ3H4tGGqdmYidXAeXOrO7vflrSB+HiCThOFq9wEX3hdrOv4AfFyTXIu 1IKQ== X-Forwarded-Encrypted: i=1; AJvYcCW5VoZFIo20+EOd+JvwfxDZFotxLawDllSM3F6MBTIqu8vQLa+jJ4M6GthaSu7oTq/1zrozjn8uSV8i9+Cp51Biyb4hbW/3zKf/C8/SHP7lffU9tvg= X-Gm-Message-State: AOJu0YweX4bLX+6wTA219tRr4RiKjpFvUPqezn4hi11/komafTi3rui8 D1+Uus6ejSip9Sr5edyb6/N3XB/MlLCOgoUI7+AeoZVnzwtG8FYvz4TuBUrWyw== X-Google-Smtp-Source: AGHT+IHm4vU8woXclQb2wxNBOH+IUBSbtmQRuMXmtvOdnp/GGhFSMCv2GU2upGZFdVsNIEeWIrdzwQ== X-Received: by 2002:ad4:5d6c:0:b0:6b5:9576:a679 with SMTP id 6a1803df08f44-6b61bc7ef66mr72721536d6.12.1720649808872; Wed, 10 Jul 2024 15:16:48 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b61ba04c16sm20182326d6.60.2024.07.10.15.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 15:16:48 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , 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 v3 09/12] PCI: brcmstb: Refactor for chips with many regular inbound BARs Date: Wed, 10 Jul 2024 18:16:23 -0400 Message-Id: <20240710221630.29561-10-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240710221630.29561-1-james.quinlan@broadcom.com> References: <20240710221630.29561-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_151650_150002_EEE5BB42 X-CRM114-Status: GOOD ( 33.52 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Previously, our chips provided three inbound "BARS" with fixed purposes: the first was for mapping SoC internal registers, the second was for memory, and the third was for memory but with the endian swapped. We typically only used one of these BARs. Complicating that BARs usage was the fact that the PCIe HW would do a baroque internal mapping of system memory, and concatenate the regions of multiple memory controllers. Newer chips such as the 7712 and Cable Modem SOCs have taken a step forward and now provide multiple inbound BARs. This works in concert with the dma-ranges property, where each provided range becomes an inbound BAR. This commit provides support for these new chips and their multiple inbound BARs but also keeps the legacy support for the older system. Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov --- drivers/pci/controller/pcie-brcmstb.c | 216 ++++++++++++++++++++------ 1 file changed, 167 insertions(+), 49 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 8ab5a8ca05b4..c44a92217855 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -75,15 +75,12 @@ #define PCIE_MEM_WIN0_HI(win) \ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI + ((win) * 8) +#define PCIE_BRCM_MAX_RC_BARS 16 #define PCIE_MISC_RC_BAR1_CONFIG_LO 0x402c #define PCIE_MISC_RC_BAR1_CONFIG_LO_SIZE_MASK 0x1f -#define PCIE_MISC_RC_BAR2_CONFIG_LO 0x4034 -#define PCIE_MISC_RC_BAR2_CONFIG_LO_SIZE_MASK 0x1f -#define PCIE_MISC_RC_BAR2_CONFIG_HI 0x4038 +#define PCIE_MISC_RC_BAR4_CONFIG_LO 0x40d4 -#define PCIE_MISC_RC_BAR3_CONFIG_LO 0x403c -#define PCIE_MISC_RC_BAR3_CONFIG_LO_SIZE_MASK 0x1f #define PCIE_MISC_MSI_BAR_CONFIG_LO 0x4044 #define PCIE_MISC_MSI_BAR_CONFIG_HI 0x4048 @@ -130,6 +127,10 @@ (PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK | \ PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK) +#define PCIE_MISC_UBUS_BAR1_CONFIG_REMAP 0x40ac +#define PCIE_MISC_UBUS_BAR1_CONFIG_REMAP_ACCESS_EN_MASK BIT(0) +#define PCIE_MISC_UBUS_BAR4_CONFIG_REMAP 0x410c + #define PCIE_MSI_INTR2_BASE 0x4500 /* Offsets from INTR2_CPU and MSI_INTR2 BASE offsets */ @@ -217,12 +218,20 @@ enum pcie_type { BCM4908, BCM7278, BCM2711, + BCM7712, +}; + +struct rc_bar { + u64 size; + u64 pci_offset; + u64 cpu_addr; }; struct pcie_cfg_data { const int *offsets; const enum pcie_type type; const bool has_phy; + unsigned int num_inbound; void (*perst_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); }; @@ -274,6 +283,7 @@ struct brcm_pcie { struct subdev_regulators *sr; bool ep_wakeup_capable; bool has_phy; + int num_inbound; }; static inline bool is_bmips(const struct brcm_pcie *pcie) @@ -789,23 +799,61 @@ static void brcm_pcie_perst_set_generic(struct brcm_pcie *pcie, u32 val) writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); } -static int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie, - u64 *rc_bar2_size, - u64 *rc_bar2_offset) +static inline void set_bar(struct rc_bar *b, int *count, u64 size, + u64 cpu_addr, u64 pci_offset) +{ + b->size = size; + b->cpu_addr = cpu_addr; + b->pci_offset = pci_offset; + (*count)++; +} + +static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie, + struct rc_bar rc_bars[]) { struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); + u64 pci_offset, cpu_addr, size = 0, tot_size = 0; struct resource_entry *entry; struct device *dev = pcie->dev; u64 lowest_pcie_addr = ~(u64)0; - int ret, i = 0; - u64 size = 0; + int ret, i = 0, n = 0; + + /* + * The HW registers (and PCIe) use order-1 numbering for BARs. As + * such, we have rc_bars[0] unused and BAR1 starts at rc_bars[1]. + */ + struct rc_bar *b_begin = &rc_bars[1]; + struct rc_bar *b = b_begin; + + /* + * STB chips beside 7712 disable the first inbound window default. + * Rather being mapped to system memory it is mapped to the + * internal registers of the SoC. This feature is deprecated, has + * security considerations, and is not implemented in our modern + * SoCs. + */ + if (pcie->type != BCM7712) + set_bar(b++, &n, 0, 0, 0); resource_list_for_each_entry(entry, &bridge->dma_ranges) { u64 pcie_beg = entry->res->start - entry->offset; + u64 cpu_beg = entry->res->start; - size += entry->res->end - entry->res->start + 1; + size = resource_size(entry->res); + tot_size += size; if (pcie_beg < lowest_pcie_addr) lowest_pcie_addr = pcie_beg; + /* + * 7712 and newer chips may have many BARs, with each + * offering a non-overlapping viewport to system memory. + * That being said, each BARs size must still be a power of + * two. + */ + if (pcie->type == BCM7712) + set_bar(b++, &n, size, cpu_beg, pcie_beg); + + if (n > pcie->num_inbound) + break; } if (lowest_pcie_addr == ~(u64)0) { @@ -813,13 +861,20 @@ static int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie, return -EINVAL; } + /* + * 7712 and newer chips do not have an internal memory mapping system + * that enables multiple memory controllers. As such, it can return + * now w/o doing special configuration. + */ + if (pcie->type == BCM7712) + return n; + ret = of_property_read_variable_u64_array(pcie->np, "brcm,scb-sizes", pcie->memc_size, 1, PCIE_BRCM_MAX_MEMC); - if (ret <= 0) { /* Make an educated guess */ pcie->num_memc = 1; - pcie->memc_size[0] = 1ULL << fls64(size - 1); + pcie->memc_size[0] = 1ULL << fls64(tot_size - 1); } else { pcie->num_memc = ret; } @@ -828,10 +883,15 @@ static int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie, for (i = 0, size = 0; i < pcie->num_memc; i++) size += pcie->memc_size[i]; - /* System memory starts at this address in PCIe-space */ - *rc_bar2_offset = lowest_pcie_addr; - /* The sum of all memc views must also be a power of 2 */ - *rc_bar2_size = 1ULL << fls64(size - 1); + /* Our HW mandates that the window size must be a power of 2 */ + size = 1ULL << fls64(size - 1); + + /* + * For STB chips, the BAR2 cpu_addr is hardwired to the start + * of system memory, so we set it to 0. + */ + cpu_addr = 0; + pci_offset = lowest_pcie_addr; /* * We validate the inbound memory view even though we should trust @@ -866,25 +926,89 @@ static int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie, * outbound memory @ 3GB). So instead it will start at the 1x * multiple of its size */ - if (!*rc_bar2_size || (*rc_bar2_offset & (*rc_bar2_size - 1)) || - (*rc_bar2_offset < SZ_4G && *rc_bar2_offset > SZ_2G)) { + if (!size || (pci_offset & (size - 1)) || + (pci_offset < SZ_4G && pci_offset > SZ_2G)) { dev_err(dev, "Invalid rc_bar2_offset/size: size 0x%llx, off 0x%llx\n", - *rc_bar2_size, *rc_bar2_offset); + size, pci_offset); return -EINVAL; } - return 0; + /* Enable BAR2, the inbound window for STB chips */ + set_bar(b++, &n, size, cpu_addr, pci_offset); + + /* + * Disable BAR3. On some chips presents the same window as BAR2 + * but the data appears in a settable endianness. + */ + set_bar(b++, &n, 0, 0, 0); + + return n; +} + +static u32 brcm_bar_reg_offset(int bar) +{ + if (bar <= 3) + return PCIE_MISC_RC_BAR1_CONFIG_LO + 8 * (bar - 1); + else + return PCIE_MISC_RC_BAR4_CONFIG_LO + 8 * (bar - 4); +} + +static u32 brcm_ubus_reg_offset(int bar) +{ + if (bar <= 3) + return PCIE_MISC_UBUS_BAR1_CONFIG_REMAP + 8 * (bar - 1); + else + return PCIE_MISC_UBUS_BAR4_CONFIG_REMAP + 8 * (bar - 4); +} + +static void set_inbound_win_registers(struct brcm_pcie *pcie, const struct rc_bar *rc_bars, + int num_rc_bars) +{ + void __iomem *base = pcie->base; + int i; + + for (i = 1; i <= num_rc_bars; i++) { + u64 pci_offset = rc_bars[i].pci_offset; + u64 cpu_addr = rc_bars[i].cpu_addr; + u64 size = rc_bars[i].size; + u32 reg_offset = brcm_bar_reg_offset(i); + u32 tmp = lower_32_bits(pci_offset); + + u32p_replace_bits(&tmp, brcm_pcie_encode_ibar_size(size), + PCIE_MISC_RC_BAR1_CONFIG_LO_SIZE_MASK); + + /* Write low */ + writel(tmp, base + reg_offset); + /* Write high */ + writel(upper_32_bits(pci_offset), base + reg_offset + 4); + + /* + * Most STB chips: + * Do nothing. + * 7712: + * All of their BARs need to be set. + */ + if (pcie->type == BCM7712) { + /* BUS remap register settings */ + reg_offset = brcm_ubus_reg_offset(i); + tmp = lower_32_bits(cpu_addr) & ~0xfff; + tmp |= PCIE_MISC_UBUS_BAR1_CONFIG_REMAP_ACCESS_EN_MASK; + writel(tmp, base + reg_offset); + tmp = upper_32_bits(cpu_addr); + writel(tmp, base + reg_offset + 4); + } + } } static int brcm_pcie_setup(struct brcm_pcie *pcie) { - u64 rc_bar2_offset, rc_bar2_size; + struct rc_bar rc_bars[PCIE_BRCM_MAX_RC_BARS]; void __iomem *base = pcie->base; struct pci_host_bridge *bridge; struct resource_entry *entry; u32 tmp, burst, aspm_support; - int num_out_wins = 0; - int ret, memc; + int num_out_wins = 0, num_rc_bars = 0; + int memc; /* Reset the bridge */ pcie->bridge_sw_init_set(pcie, 1); @@ -933,17 +1057,16 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) u32p_replace_bits(&tmp, 1, PCIE_MISC_MISC_CTRL_PCIE_RCB_64B_MODE_MASK); writel(tmp, base + PCIE_MISC_MISC_CTRL); - ret = brcm_pcie_get_rc_bar2_size_and_offset(pcie, &rc_bar2_size, - &rc_bar2_offset); - if (ret) - return ret; + num_rc_bars = brcm_pcie_get_inbound_wins(pcie, rc_bars); + if (num_rc_bars < 0) + return num_rc_bars; - tmp = lower_32_bits(rc_bar2_offset); - u32p_replace_bits(&tmp, brcm_pcie_encode_ibar_size(rc_bar2_size), - PCIE_MISC_RC_BAR2_CONFIG_LO_SIZE_MASK); - writel(tmp, base + PCIE_MISC_RC_BAR2_CONFIG_LO); - writel(upper_32_bits(rc_bar2_offset), - base + PCIE_MISC_RC_BAR2_CONFIG_HI); + set_inbound_win_registers(pcie, rc_bars, num_rc_bars); + + if (!brcm_pcie_rc_mode(pcie)) { + dev_err(pcie->dev, "PCIe RC controller misconfigured as Endpoint\n"); + return -EINVAL; + } tmp = readl(base + PCIE_MISC_MISC_CTRL); for (memc = 0; memc < pcie->num_memc; memc++) { @@ -965,25 +1088,12 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) * 4GB or when the inbound area is smaller than 4GB (taking into * account the rounding-up we're forced to perform). */ - if (rc_bar2_offset >= SZ_4G || (rc_bar2_size + rc_bar2_offset) < SZ_4G) + if (rc_bars[2].pci_offset >= SZ_4G || + (rc_bars[2].size + rc_bars[2].pci_offset) < SZ_4G) pcie->msi_target_addr = BRCM_MSI_TARGET_ADDR_LT_4GB; else pcie->msi_target_addr = BRCM_MSI_TARGET_ADDR_GT_4GB; - if (!brcm_pcie_rc_mode(pcie)) { - dev_err(pcie->dev, "PCIe RC controller misconfigured as Endpoint\n"); - return -EINVAL; - } - - /* disable the PCIe->GISB memory window (RC_BAR1) */ - tmp = readl(base + PCIE_MISC_RC_BAR1_CONFIG_LO); - tmp &= ~PCIE_MISC_RC_BAR1_CONFIG_LO_SIZE_MASK; - writel(tmp, base + PCIE_MISC_RC_BAR1_CONFIG_LO); - - /* disable the PCIe->SCB memory window (RC_BAR3) */ - tmp = readl(base + PCIE_MISC_RC_BAR3_CONFIG_LO); - tmp &= ~PCIE_MISC_RC_BAR3_CONFIG_LO_SIZE_MASK; - writel(tmp, base + PCIE_MISC_RC_BAR3_CONFIG_LO); /* Don't advertise L0s capability if 'aspm-no-l0s' */ aspm_support = PCIE_LINK_STATE_L1; @@ -1516,6 +1626,7 @@ static const struct pcie_cfg_data generic_cfg = { .type = GENERIC, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, + .num_inbound = 3, }; static const struct pcie_cfg_data bcm7425_cfg = { @@ -1523,6 +1634,7 @@ static const struct pcie_cfg_data bcm7425_cfg = { .type = BCM7425, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, + .num_inbound = 3, }; static const struct pcie_cfg_data bcm7435_cfg = { @@ -1530,6 +1642,7 @@ static const struct pcie_cfg_data bcm7435_cfg = { .type = BCM7435, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, + .num_inbound = 3, }; static const struct pcie_cfg_data bcm4908_cfg = { @@ -1537,6 +1650,7 @@ static const struct pcie_cfg_data bcm4908_cfg = { .type = BCM4908, .perst_set = brcm_pcie_perst_set_4908, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, + .num_inbound = 3, }; static const int pcie_offset_bcm7278[] = { @@ -1552,6 +1666,7 @@ static const struct pcie_cfg_data bcm7278_cfg = { .type = BCM7278, .perst_set = brcm_pcie_perst_set_7278, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, + .num_inbound = 3, }; static const struct pcie_cfg_data bcm2711_cfg = { @@ -1559,6 +1674,7 @@ static const struct pcie_cfg_data bcm2711_cfg = { .type = BCM2711, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, + .num_inbound = 3, }; static const struct pcie_cfg_data bcm7216_cfg = { @@ -1567,6 +1683,7 @@ static const struct pcie_cfg_data bcm7216_cfg = { .perst_set = brcm_pcie_perst_set_7278, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, .has_phy = true, + .num_inbound = 3, }; static const struct of_device_id brcm_pcie_match[] = { @@ -1623,6 +1740,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) pcie->perst_set = data->perst_set; pcie->bridge_sw_init_set = data->bridge_sw_init_set; pcie->has_phy = data->has_phy; + pcie->num_inbound = data->num_inbound; pcie->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pcie->base)) From patchwork Wed Jul 10 22:16:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13729778 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 317CBC3DA42 for ; Wed, 10 Jul 2024 22:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2U0Q/DuePMfuappF/7cyFEkG0Gf1GlWZ8TN7FuR9Yx0=; b=yCimOgnRBnz5o05a58KD14nR8O pmuOXJOiF9zGYcnVklmU8ikfYUQQH+gDU1FHXS6UyxxKW6rnVW9MOSZlT9U1DHDTubYCI5EkQgONZ QRngjXaxeJAIy9pcBKG+xQ+IAP2Sm98q3tzlx3ITxKLMCciC2dR2nnPvsMXx4JSyGgyb2tTzeJssu dBzr/YV7WOAg2AaHFU9bNbJ58GYDAD4qertJ7OQjcQUh9b5mUhIQ+x28rxQ2bCf9j+yP8IKMqXJ0w i6VU8bVNdz2KukMKAufamXRFI7L5wx1Rq1At1kMvH9L3AnjxLce419Est/GDcW/ujbJ83zCLnpUt7 Hfo5qyTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRffX-0000000BvSm-2tkB; Wed, 10 Jul 2024 22:20:12 +0000 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfcJ-0000000Bu0R-370Q for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 22:16:53 +0000 Received: by mail-qv1-xf2e.google.com with SMTP id 6a1803df08f44-6b73dc6e7aaso2036806d6.0 for ; Wed, 10 Jul 2024 15:16:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720649811; x=1721254611; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=2U0Q/DuePMfuappF/7cyFEkG0Gf1GlWZ8TN7FuR9Yx0=; b=IKgiKyeTw68FQGJRo0UtRSrs8LZ4CjzN3vUnX2TQ0qlwn6fAFQ4MuaqZm5ycO2NEoc BZqPKKUrqY4JGJQip95HrBDtKRPYGbG7M0Y3tE5wlAiVYN0vZReClhdZGI5z9102newi CiE9xUxGMTZqHVQX5AO8EMgmWAFZcX88Ybf/U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720649811; x=1721254611; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2U0Q/DuePMfuappF/7cyFEkG0Gf1GlWZ8TN7FuR9Yx0=; b=UtfbDVDMZUHpHqr9nmfSQ0Xuct/vpCYPchYKZDbfWbF9u+8tRwBcqmiyYguB4weBqA V/U7kuUGRgumwQD7ssH4fJjbqcjsHByd2hjseTrOCD/CFmvgpHeIpmd/5X6UezNv1vf6 YV97xkUnAmnprvp7sRnhz7yRrGh408bhiTf+yXV0dKVObsy694knDIuZG5yGq6nyE97e a3/pViImyoXiX0RwwaDA+L+R+hrD83ECk+UctYb5isWLEHbJw7fcN0ft4BPXCVYLscrQ esWByU3R12tzheSh7Epudisi9og1r6pSKKH3aFVaWTFh6o2Avw2DoEWsRNFbEp3CDPvS Mr9A== X-Forwarded-Encrypted: i=1; AJvYcCViLFL9nLvPu1u8AK0UwAQgpOrdhv69Sgb8H5vYmJoydjSCdO7tAi1PvO57GcmrBgwY1ZWDtLFAQJrer0F+TIvK0nlXCkDvK0+rq7nmadR6A0ivWEU= X-Gm-Message-State: AOJu0YzpdoSidmZsfbkrLMYwAnAvMgzrrmlOHG90SAuRCP5QRZnGD1tU fj4lBBoO9Sf9FAqPA/w49OTepgUOgQjDnscYKRzRsKNKeHY3Fo+KWgD56deJNA== X-Google-Smtp-Source: AGHT+IGjqDlbc7rPT0RcV2yWFo57iS/g/5deckdUl2pQL1XghCw9XWDRFpz43erjIC/qo7nVqflxMg== X-Received: by 2002:a05:6214:20c3:b0:6b5:a4f6:daa2 with SMTP id 6a1803df08f44-6b61bca389cmr74737996d6.17.1720649810876; Wed, 10 Jul 2024 15:16:50 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b61ba04c16sm20182326d6.60.2024.07.10.15.16.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 15:16:49 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Philipp Zabel , 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 v3 10/12] PCI: brcmstb: Check return value of all reset_control_xxx calls Date: Wed, 10 Jul 2024 18:16:24 -0400 Message-Id: <20240710221630.29561-11-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240710221630.29561-1-james.quinlan@broadcom.com> References: <20240710221630.29561-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_151651_943975_F7E31382 X-CRM114-Status: GOOD ( 21.12 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In some cases the result of a reset_control_xxx() call have been ignored. Now we check all return values of such functions and propagate the error to the next level. Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 100 ++++++++++++++++++-------- 1 file changed, 71 insertions(+), 29 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c44a92217855..c334cc427fb7 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -232,8 +232,8 @@ struct pcie_cfg_data { const enum pcie_type type; const bool has_phy; unsigned int num_inbound; - void (*perst_set)(struct brcm_pcie *pcie, u32 val); - void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); + int (*perst_set)(struct brcm_pcie *pcie, u32 val); + int (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); }; struct subdev_regulators { @@ -278,8 +278,8 @@ struct brcm_pcie { int num_memc; u64 memc_size[PCIE_BRCM_MAX_MEMC]; u32 hw_rev; - void (*perst_set)(struct brcm_pcie *pcie, u32 val); - void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); + int (*perst_set)(struct brcm_pcie *pcie, u32 val); + int (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); struct subdev_regulators *sr; bool ep_wakeup_capable; bool has_phy; @@ -742,13 +742,18 @@ static void __iomem *brcm7425_pcie_map_bus(struct pci_bus *bus, return base + DATA_ADDR(pcie); } -static void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val) +static int brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val) { + int ret = 0; + if (pcie->bridge) { if (val) - reset_control_assert(pcie->bridge); + ret = reset_control_assert(pcie->bridge); else - reset_control_deassert(pcie->bridge); + ret = reset_control_deassert(pcie->bridge); + if (ret) + dev_err(pcie->dev, "failed to %s 'bridge' reset, err=%d\n", + val ? "assert" : "deassert", ret); } else { u32 tmp, mask = RGR1_SW_INIT_1_INIT_GENERIC_MASK; u32 shift = RGR1_SW_INIT_1_INIT_GENERIC_SHIFT; @@ -757,9 +762,10 @@ static void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val tmp = (tmp & ~mask) | ((val << shift) & mask); writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); } + return ret; } -static void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val) +static int brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val) { u32 tmp, mask = RGR1_SW_INIT_1_INIT_7278_MASK; u32 shift = RGR1_SW_INIT_1_INIT_7278_SHIFT; @@ -767,20 +773,29 @@ static void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val) tmp = readl(pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); tmp = (tmp & ~mask) | ((val << shift) & mask); writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); + + return 0; } -static void brcm_pcie_perst_set_4908(struct brcm_pcie *pcie, u32 val) +static int brcm_pcie_perst_set_4908(struct brcm_pcie *pcie, u32 val) { + int ret; + if (WARN_ONCE(!pcie->perst_reset, "missing PERST# reset controller\n")) - return; + return -EINVAL; if (val) - reset_control_assert(pcie->perst_reset); + ret = reset_control_assert(pcie->perst_reset); else - reset_control_deassert(pcie->perst_reset); + ret = reset_control_deassert(pcie->perst_reset); + + if (ret) + dev_err(pcie->dev, "failed to %s 'perst' reset, err=%d\n", + val ? "assert" : "deassert", ret); + return ret; } -static void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val) +static int brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val) { u32 tmp; @@ -788,15 +803,19 @@ static void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val) tmp = readl(pcie->base + PCIE_MISC_PCIE_CTRL); u32p_replace_bits(&tmp, !val, PCIE_MISC_PCIE_CTRL_PCIE_PERSTB_MASK); writel(tmp, pcie->base + PCIE_MISC_PCIE_CTRL); + + return 0; } -static void brcm_pcie_perst_set_generic(struct brcm_pcie *pcie, u32 val) +static int brcm_pcie_perst_set_generic(struct brcm_pcie *pcie, u32 val) { u32 tmp; tmp = readl(pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); u32p_replace_bits(&tmp, val, PCIE_RGR1_SW_INIT_1_PERST_MASK); writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); + + return 0; } static inline void set_bar(struct rc_bar *b, int *count, u64 size, @@ -1008,19 +1027,28 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) struct resource_entry *entry; u32 tmp, burst, aspm_support; int num_out_wins = 0, num_rc_bars = 0; - int memc; + int memc, ret; /* Reset the bridge */ - pcie->bridge_sw_init_set(pcie, 1); + ret = pcie->bridge_sw_init_set(pcie, 1); + if (ret) + return ret; /* Ensure that PERST# is asserted; some bootloaders may deassert it. */ - if (pcie->type == BCM2711) - pcie->perst_set(pcie, 1); + if (pcie->type == BCM2711) { + ret = pcie->perst_set(pcie, 1); + if (ret) { + pcie->bridge_sw_init_set(pcie, 0); + return ret; + } + } usleep_range(100, 200); /* Take the bridge out of reset */ - pcie->bridge_sw_init_set(pcie, 0); + ret = pcie->bridge_sw_init_set(pcie, 0); + if (ret) + return ret; tmp = readl(base + HARD_DEBUG(pcie)); if (is_bmips(pcie)) @@ -1239,7 +1267,9 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie) int ret, i; /* Unassert the fundamental reset */ - pcie->perst_set(pcie, 0); + ret = pcie->perst_set(pcie, 0); + if (ret) + return ret; /* * Wait for 100ms after PERST# deassertion; see PCIe CEM specification @@ -1431,15 +1461,17 @@ static inline int brcm_phy_stop(struct brcm_pcie *pcie) return pcie->has_phy ? brcm_phy_cntl(pcie, 0) : 0; } -static void brcm_pcie_turn_off(struct brcm_pcie *pcie) +static int brcm_pcie_turn_off(struct brcm_pcie *pcie) { void __iomem *base = pcie->base; - int tmp; + int tmp, ret; if (brcm_pcie_link_up(pcie)) brcm_pcie_enter_l23(pcie); /* Assert fundamental reset */ - pcie->perst_set(pcie, 1); + ret = pcie->perst_set(pcie, 1); + if (ret) + return ret; /* Deassert request for L23 in case it was asserted */ tmp = readl(base + PCIE_MISC_PCIE_CTRL); @@ -1452,7 +1484,9 @@ static void brcm_pcie_turn_off(struct brcm_pcie *pcie) writel(tmp, base + HARD_DEBUG(pcie)); /* Shutdown PCIe bridge */ - pcie->bridge_sw_init_set(pcie, 1); + ret = pcie->bridge_sw_init_set(pcie, 1); + + return ret; } static int pci_dev_may_wakeup(struct pci_dev *dev, void *data) @@ -1470,9 +1504,12 @@ static int brcm_pcie_suspend_noirq(struct device *dev) { struct brcm_pcie *pcie = dev_get_drvdata(dev); struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); - int ret; + int ret, rret; + + ret = brcm_pcie_turn_off(pcie); + if (ret) + return ret; - brcm_pcie_turn_off(pcie); /* * If brcm_phy_stop() returns an error, just dev_err(). If we * return the error it will cause the suspend to fail and this is a @@ -1501,7 +1538,10 @@ static int brcm_pcie_suspend_noirq(struct device *dev) pcie->sr->supplies); if (ret) { dev_err(dev, "Could not turn off regulators\n"); - reset_control_reset(pcie->rescal); + rret = reset_control_reset(pcie->rescal); + if (rret) + dev_err(dev, "failed to reset 'rascal' controller ret=%d\n", + rret); return ret; } } @@ -1516,7 +1556,7 @@ static int brcm_pcie_resume_noirq(struct device *dev) struct brcm_pcie *pcie = dev_get_drvdata(dev); void __iomem *base; u32 tmp; - int ret; + int ret, rret; base = pcie->base; ret = clk_prepare_enable(pcie->clk); @@ -1578,7 +1618,9 @@ static int brcm_pcie_resume_noirq(struct device *dev) if (pcie->sr) regulator_bulk_disable(pcie->sr->num_supplies, pcie->sr->supplies); err_reset: - reset_control_rearm(pcie->rescal); + rret = reset_control_rearm(pcie->rescal); + if (rret) + dev_err(pcie->dev, "failed to rearm 'rescal' reset, err=%d\n", rret); err_disable_clk: clk_disable_unprepare(pcie->clk); return ret; From patchwork Wed Jul 10 22:16:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13729779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5CFC5C3DA42 for ; Wed, 10 Jul 2024 22:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9STkE/nXLSa9GNLPreO/fiNAxJRnRMjsLIRLoy/pbq4=; b=wtITOMlmLxnrU5r+cdibnUKC9h STX0PHy7oDIILqCymPRTy/Guwq/Fk1TtBfQ7VN7uiYQxpBR2mMomCouKuntoivscop7RD0bxcYz0G uLo35ZHE6wDFbb+Y/8OWi7Ru7EWPEANP08mHgFRZTmEah/i/UmPep+LuGcDIUDYbDS5KWHkPoemrU L8P9DjciVMbGRTtqu67uF8JUTM5ddDqzDziNPjz2EjDc0ofFrEEIWJ0mlWMdzaIBSOpwJuSJLrY4S 3LvOPLurP1Bmz4k46Rp4+gof5/9hgbGy76JPpSN2K1SPybrIBBGebqJAfhh6Ryn4gvGHlrvxFUdfo X8urezQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfft-0000000Bvb2-35m7; Wed, 10 Jul 2024 22:20:33 +0000 Received: from mail-qv1-xf36.google.com ([2607:f8b0:4864:20::f36]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfcL-0000000Bu1n-1cyw for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 22:16:55 +0000 Received: by mail-qv1-xf36.google.com with SMTP id 6a1803df08f44-6b5ec93f113so1535726d6.3 for ; Wed, 10 Jul 2024 15:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720649812; x=1721254612; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=9STkE/nXLSa9GNLPreO/fiNAxJRnRMjsLIRLoy/pbq4=; b=TAQneNWcHGa2fPoSVULVrMjWFiuGSFEbNO2ml/bzPUBzXR7pGqDyi4xD6fzLR+TRkd huzgmJy8bL1K/IszgubcGH+2ADKAA27FvGx6xIku22R5GWT56rmc8+JgxQlH/E6B91ca rxNMeZrwfjdfc6ovRTkQKYk5fch4DvP7HgYis= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720649812; x=1721254612; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9STkE/nXLSa9GNLPreO/fiNAxJRnRMjsLIRLoy/pbq4=; b=dM0asvo8qRFOeMEfS7IY6HbQEphSZRx7IMbQLRmg3ZPCU+C3vUvrZZRkjkXdPswAmM EW0r0ti6DcPHTYPh4Q/sqva5Y0I7ih4mLmsbRfwhSLyFeBsezK0VMl6TvZ7JPU9PMj3f LG/SQRxZsWTOJz4tCmZh4KUSZRpy58fcf2SA2rLZeGvUnEo1CQ6AmEQ51cFL3NSrpl3d 32NfNL8JTDhBluBuNrzCl4G1Tcjmjzywexm+8Y4Ub5e5NCtCStIQR158XileOL3iuU3l vTrpUielCUBUlIwU2MO/QdYK4TxpPydpVGz1sW30LPi16Vup3qgcOFRTQwdZgRr0QGrh AeAQ== X-Forwarded-Encrypted: i=1; AJvYcCXCiyyPDdHwsOZp5iQDrfYs964dUqQ6cTZpSkWQt6pF7uUx71r/cqJyGOf8nwjkgP5jGXLIFuQVw6Ywnj9b5mgdFU6iiaOccHAjP8AP3DpGioMSaE0= X-Gm-Message-State: AOJu0YzDs2VKW9f5YqV1nIvzbFY+IVacyfJIiSUaQ8a1WaMAeh+nL9eE fKtJKYz2zJc1zWnUxEozlSBj7v4FuydbsMBes3+0xAf4w/WWTYKmeWbpauYndw== X-Google-Smtp-Source: AGHT+IEMb5nEAz7tzkCTjFEGV0o1p4WI3LHzasNhvhgrx5PZeTFAuauj/wfrj7OSOBKyVHxmHXl+nQ== X-Received: by 2002:ad4:5f45:0:b0:6b2:ba66:81e9 with SMTP id 6a1803df08f44-6b61c1fa6ccmr81451616d6.62.1720649812351; Wed, 10 Jul 2024 15:16:52 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b61ba04c16sm20182326d6.60.2024.07.10.15.16.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 15:16:51 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , 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 v3 11/12] PCI: brcmstb: Change field name from 'type' to 'model' Date: Wed, 10 Jul 2024 18:16:25 -0400 Message-Id: <20240710221630.29561-12-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240710221630.29561-1-james.quinlan@broadcom.com> References: <20240710221630.29561-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_151653_542849_5B4C5417 X-CRM114-Status: GOOD ( 20.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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 'type' field used in the driver to discern SoC differences is confusing so change it to the more apt 'model'. We considered using 'family' but this conflicts with Broadcom's conception of a family; for example, 7216a0 and 7216b0 chips are both considered separate families as each has multiple derivative product chips based on the original design. Signed-off-by: Jim Quinlan Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 42 +++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c334cc427fb7..b6b21e0a56a8 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -211,7 +211,7 @@ enum { PCIE_INTR2_CPU_BASE, }; -enum pcie_type { +enum pcie_model { GENERIC, BCM7425, BCM7435, @@ -229,7 +229,7 @@ struct rc_bar { struct pcie_cfg_data { const int *offsets; - const enum pcie_type type; + const enum pcie_model model; const bool has_phy; unsigned int num_inbound; int (*perst_set)(struct brcm_pcie *pcie, u32 val); @@ -270,7 +270,7 @@ struct brcm_pcie { u64 msi_target_addr; struct brcm_msi *msi; const int *reg_offsets; - enum pcie_type type; + enum pcie_model model; struct reset_control *rescal; struct reset_control *perst_reset; struct reset_control *bridge; @@ -288,7 +288,7 @@ struct brcm_pcie { static inline bool is_bmips(const struct brcm_pcie *pcie) { - return pcie->type == BCM7435 || pcie->type == BCM7425; + return pcie->model == BCM7435 || pcie->model == BCM7425; } /* @@ -851,7 +851,7 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie, * security considerations, and is not implemented in our modern * SoCs. */ - if (pcie->type != BCM7712) + if (pcie->model != BCM7712) set_bar(b++, &n, 0, 0, 0); resource_list_for_each_entry(entry, &bridge->dma_ranges) { @@ -868,7 +868,7 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie, * That being said, each BARs size must still be a power of * two. */ - if (pcie->type == BCM7712) + if (pcie->model == BCM7712) set_bar(b++, &n, size, cpu_beg, pcie_beg); if (n > pcie->num_inbound) @@ -885,7 +885,7 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie, * that enables multiple memory controllers. As such, it can return * now w/o doing special configuration. */ - if (pcie->type == BCM7712) + if (pcie->model == BCM7712) return n; ret = of_property_read_variable_u64_array(pcie->np, "brcm,scb-sizes", pcie->memc_size, 1, @@ -1007,7 +1007,7 @@ static void set_inbound_win_registers(struct brcm_pcie *pcie, const struct rc_ba * 7712: * All of their BARs need to be set. */ - if (pcie->type == BCM7712) { + if (pcie->model == BCM7712) { /* BUS remap register settings */ reg_offset = brcm_ubus_reg_offset(i); tmp = lower_32_bits(cpu_addr) & ~0xfff; @@ -1035,7 +1035,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) return ret; /* Ensure that PERST# is asserted; some bootloaders may deassert it. */ - if (pcie->type == BCM2711) { + if (pcie->model == BCM2711) { ret = pcie->perst_set(pcie, 1); if (ret) { pcie->bridge_sw_init_set(pcie, 0); @@ -1066,9 +1066,9 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) */ if (is_bmips(pcie)) burst = 0x1; /* 256 bytes */ - else if (pcie->type == BCM2711) + else if (pcie->model == BCM2711) burst = 0x0; /* 128 bytes */ - else if (pcie->type == BCM7278) + else if (pcie->model == BCM7278) burst = 0x3; /* 512 bytes */ else burst = 0x2; /* 512 bytes */ @@ -1665,7 +1665,7 @@ static const int pcie_offsets_bmips_7425[] = { static const struct pcie_cfg_data generic_cfg = { .offsets = pcie_offsets, - .type = GENERIC, + .model = GENERIC, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound = 3, @@ -1673,7 +1673,7 @@ static const struct pcie_cfg_data generic_cfg = { static const struct pcie_cfg_data bcm7425_cfg = { .offsets = pcie_offsets_bmips_7425, - .type = BCM7425, + .model = BCM7425, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound = 3, @@ -1681,7 +1681,7 @@ static const struct pcie_cfg_data bcm7425_cfg = { static const struct pcie_cfg_data bcm7435_cfg = { .offsets = pcie_offsets, - .type = BCM7435, + .model = BCM7435, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound = 3, @@ -1689,7 +1689,7 @@ static const struct pcie_cfg_data bcm7435_cfg = { static const struct pcie_cfg_data bcm4908_cfg = { .offsets = pcie_offsets, - .type = BCM4908, + .model = BCM4908, .perst_set = brcm_pcie_perst_set_4908, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound = 3, @@ -1705,7 +1705,7 @@ static const int pcie_offset_bcm7278[] = { static const struct pcie_cfg_data bcm7278_cfg = { .offsets = pcie_offset_bcm7278, - .type = BCM7278, + .model = BCM7278, .perst_set = brcm_pcie_perst_set_7278, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, .num_inbound = 3, @@ -1713,7 +1713,7 @@ static const struct pcie_cfg_data bcm7278_cfg = { static const struct pcie_cfg_data bcm2711_cfg = { .offsets = pcie_offsets, - .type = BCM2711, + .model = BCM2711, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound = 3, @@ -1721,7 +1721,7 @@ static const struct pcie_cfg_data bcm2711_cfg = { static const struct pcie_cfg_data bcm7216_cfg = { .offsets = pcie_offset_bcm7278, - .type = BCM7278, + .model = BCM7278, .perst_set = brcm_pcie_perst_set_7278, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, .has_phy = true, @@ -1778,7 +1778,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) pcie->dev = &pdev->dev; pcie->np = np; pcie->reg_offsets = data->offsets; - pcie->type = data->type; + pcie->model = data->model; pcie->perst_set = data->perst_set; pcie->bridge_sw_init_set = data->bridge_sw_init_set; pcie->has_phy = data->has_phy; @@ -1847,7 +1847,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) goto fail; pcie->hw_rev = readl(pcie->base + PCIE_MISC_REVISION); - if (pcie->type == BCM4908 && pcie->hw_rev >= BRCM_PCIE_HW_REV_3_20) { + if (pcie->model == BCM4908 && pcie->hw_rev >= BRCM_PCIE_HW_REV_3_20) { dev_err(pcie->dev, "hardware revision with unsupported PERST# setup\n"); ret = -ENODEV; goto fail; @@ -1862,7 +1862,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) } } - bridge->ops = pcie->type == BCM7425 ? &brcm7425_pcie_ops : &brcm_pcie_ops; + bridge->ops = pcie->model == BCM7425 ? &brcm7425_pcie_ops : &brcm_pcie_ops; bridge->sysdata = pcie; platform_set_drvdata(pdev, pcie); From patchwork Wed Jul 10 22:16:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13729780 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 59293C3DA42 for ; Wed, 10 Jul 2024 22:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qO2gJqfvqzGpRuVqmN6pskTDvNyWo2lOUU2fMPKmKpA=; b=sU/ayVsjr7jrc+qeGbXTZdsDdn UgKpFoxSkhOXN/nJYU4ivtypoJTxDHBS1fvuzmiRXuvsGoJ7M8wBNotYO7yihEEvwdDj+6IBsxFHF KTL2gaHCYPo7RJzW77npCbmSqvIawJeByHJlmWRtUZkqtGVah92nbBzwR7TJpc9q2xW5IQLpnY7JH NVdAiGJq0GRWsrEIZuJaf9hk3MaQ6/mqMyDORft2vpQOaXj4MOsEwUJTMe65rpwVXpYmHWK0WVFj5 juntNjnbhbPraccNYPjbXGstakIO007zenkv1YC7Eh9RX68zQgPDb+HkkFw7ii/HLPaRQtskt5Q6j O32y3SPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfgE-0000000Bvjx-0U9O; Wed, 10 Jul 2024 22:20:54 +0000 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRfcN-0000000Bu3V-2tOD for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 22:16:57 +0000 Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-7a05b7c8e38so16758885a.0 for ; Wed, 10 Jul 2024 15:16:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720649814; x=1721254614; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=qO2gJqfvqzGpRuVqmN6pskTDvNyWo2lOUU2fMPKmKpA=; b=hIakqOhcmbkRnNgueXDsBGdYOgk2aW3uV/GuQbTzXzNNZVS3uCkWWXGuyNNKiZcpLT Jj7ZvcBceZK5LoqFqo9/6aOOKkpbqyiDRdYhqE3nhm3QVRsMXlpE5imV42IB5aNUtkvj 0yIdy4b4QkkZTbJdsjrcBzOJCDx3nhfWEc8sU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720649814; x=1721254614; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qO2gJqfvqzGpRuVqmN6pskTDvNyWo2lOUU2fMPKmKpA=; b=aTNvUYFldqs8DOecDVBphvfLCfXqG+3axq4h/In6vw2crT1Z9t/kLpjmpnnrgpk6iS jSZtJaR5fcFa5P+opqPLhNEFoyuA3W23GcWORhdww7Ug0xNpqtQcI1T6uBWPM53ZFFMz CUCuGQj8DfQjzf0S0iAd6+Ax1d/suB7yixR9c69AlIzlknR02o0z3QVb7p1Ef6d8JyEe o6bHXKULF+eCejGtMMe9wZycvEBSVLvlbDW1SDDOxLUortTVnPRapXdwuUCHTJjgBgED yCP27qfTtmrWSiUu2mLnFNRXo1B3TNhCv56FjanJP41jB/vtr3aEuJcSj9fwi3O9LPjB 169w== X-Forwarded-Encrypted: i=1; AJvYcCVwxpg9nO++4wExoyaJYckExxS6+0v5lIAZpxaFiPNM4IafFEaec7q8DBWwYMsuw8ZJ2cmJPdK8pJsbVeZCpIM0nJTKr3000nZRd/Tz5MAcu/cO2ek= X-Gm-Message-State: AOJu0Yyda59PVtx41dK8Xgnfr6Y57Yj8c6obwTJ6z2wDxNMTntIIzc1h Jh9yYEZgX4kdFTo1JKdN3Yonhy1aT/0mInBX29+tnnYiNFN0XOiJZ9/fwFdfkw== X-Google-Smtp-Source: AGHT+IEtvfgftukcEuMP8g+teSoGXWxp4LtmlU5wcExPt32R4L59Qk3fQiOR4w8Ur6sm+YF1IKLsUQ== X-Received: by 2002:a05:6214:482:b0:6b0:76e8:921f with SMTP id 6a1803df08f44-6b61c21354dmr83964016d6.60.1720649814001; Wed, 10 Jul 2024 15:16:54 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b61ba04c16sm20182326d6.60.2024.07.10.15.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 15:16:53 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , 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 v3 12/12] PCI: brcmstb: Enable 7712 SOCs Date: Wed, 10 Jul 2024 18:16:26 -0400 Message-Id: <20240710221630.29561-13-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240710221630.29561-1-james.quinlan@broadcom.com> References: <20240710221630.29561-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_151655_792848_0C4D701F X-CRM114-Status: GOOD ( 12.22 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The Broadcom STB 7712 is the sibling chip of the RPi 5 (2712). Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index b6b21e0a56a8..3bc6b49227fe 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1192,6 +1192,10 @@ static void brcm_extend_rbus_timeout(struct brcm_pcie *pcie) const unsigned int REG_OFFSET = PCIE_RGR1_SW_INIT_1(pcie) - 8; u32 timeout_us = 4000000; /* 4 seconds, our setting for L1SS */ + /* 7712 does not have this (RGR1) timer */ + if (pcie->model == BCM7712) + return; + /* Each unit in timeout register is 1/216,000,000 seconds */ writel(216 * timeout_us, pcie->base + REG_OFFSET); } @@ -1663,6 +1667,13 @@ static const int pcie_offsets_bmips_7425[] = { [PCIE_INTR2_CPU_BASE] = 0x4300, }; +static const int pcie_offset_bcm7712[] = { + [EXT_CFG_INDEX] = 0x9000, + [EXT_CFG_DATA] = 0x9004, + [PCIE_HARD_DEBUG] = 0x4304, + [PCIE_INTR2_CPU_BASE] = 0x4400, +}; + static const struct pcie_cfg_data generic_cfg = { .offsets = pcie_offsets, .model = GENERIC, @@ -1728,6 +1739,14 @@ static const struct pcie_cfg_data bcm7216_cfg = { .num_inbound = 3, }; +static const struct pcie_cfg_data bcm7712_cfg = { + .offsets = pcie_offset_bcm7712, + .perst_set = brcm_pcie_perst_set_7278, + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, + .model = BCM7712, + .num_inbound = 10, +}; + static const struct of_device_id brcm_pcie_match[] = { { .compatible = "brcm,bcm2711-pcie", .data = &bcm2711_cfg }, { .compatible = "brcm,bcm4908-pcie", .data = &bcm4908_cfg }, @@ -1737,6 +1756,7 @@ static const struct of_device_id brcm_pcie_match[] = { { .compatible = "brcm,bcm7445-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7435-pcie", .data = &bcm7435_cfg }, { .compatible = "brcm,bcm7425-pcie", .data = &bcm7425_cfg }, + { .compatible = "brcm,bcm7712-pcie", .data = &bcm7712_cfg }, {}, };