From patchwork Tue Jul 16 21:31: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: 13734971 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 9FC07C3DA49 for ; Tue, 16 Jul 2024 21:32:37 +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=RYLh2kS0Hk6kVODI+QdFOthNg8ep3JeSyGyaPKf773Q=; b=ezzbCyjHSmcfnqgzZ6iUBgXilq ueP/k4Cmq9elPQ3KzJ6lgZ4SpS9HKTms/NVTLQ+6Jr1VUf3SPsQqXA8ps0ROn2DLSxi8qeFWxavoa dAna6sE2vCExRsDHjfvJPBqWpXsKc+rUL+arvDgPHdQ2pIN3vwMV9/Y13JwtTU642hY0eQpPajX4D u8BddrHBVNFpALqBz0SjaXhHrKCbIdy0E9MHvaBcXt9SC1synEBa2+04cD14YjcAcEqdH8bos/lNI mjTizcDHA17UifCKTuLqPo23btmBwM+snEK3zROl5G+yQ62EYAOpAaRixp6iIzn6z4OFNym00gToa 9JiaCe8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpma-0000000BpUR-15OY; Tue, 16 Jul 2024 21:32:24 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTplv-0000000Bp73-1V1v for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 21:31:45 +0000 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-70b0ebd1ef9so3990271b3a.2 for ; Tue, 16 Jul 2024 14:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165502; x=1721770302; 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=RYLh2kS0Hk6kVODI+QdFOthNg8ep3JeSyGyaPKf773Q=; b=G7L7JWcfmerNYCgMMIszr0TDkH+II4S7FaIHka9kWYEfJH4KcCunAdsHDvXhzC6QVO 6F5WbOUCk6u7ODhYMNkopNA1U3psazDC/tvCe7VgA2seguX/Cd6+z++OJZZV3N56wAGi nPAaZVC4qy81dQ1pKzrEEmQBZdI240/EnLcl4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165502; x=1721770302; 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=RYLh2kS0Hk6kVODI+QdFOthNg8ep3JeSyGyaPKf773Q=; b=IzEMP/k39RvweYXl7uDDO/2T2FL9tvoraqI+HhfadQtgO7+vtX2gPuqq2W8sOsbJDI TGj48dzdgbs+8CerhuO0l2azvyyhHnaxsabbA2CuCfW3d1dUAtme0UMWFZh1jSm1MQIH 7uQinC/8cu2UI3TcNSkVhdR6ychcrhsih0Z3ihpNLaPLKBvN8h9LveQbUTHelAIx0LLX 4GFk5SpeQAJGHkdHSp6FlloJu13tYUmgt/AIDCMbHxgWth2QCpzY00Wxe7j2nmsc1kLV EsluGXWYPygDKZIYVb7RP3nE5+c86VFkI38eZObCCeN3KIwg974M3Ni6tczIDTix16gY K9mA== X-Forwarded-Encrypted: i=1; AJvYcCXnKt8CWnrrIYHnjZqWAFVrzqozGWt4HFuzY1loXkxxaHeuSHIS5IcCXYXYs70XGvZjEyOaSI5CprcXls0c9nl9BxAE0LNe9phtE7kbD+XPTI3fScI= X-Gm-Message-State: AOJu0Yw/eDrDAPQv4TjTDu+We4Wp/l24hhOJ5L9M/Xp3blVnzhq3vbLv zoNQELoBRGghHNDowwjb9SMWLW8sykBwMNMZEQQT9LM3qYfP37yPqpCakE4mWg== X-Google-Smtp-Source: AGHT+IFAbgMBJWTR284rg5DQPqBL6wm6WpTqDyeiwCkGF68kwS0hpiUPe8UG3v0jBLjc2M1dUDLlHA== X-Received: by 2002:a05:6a00:845:b0:705:cade:1f40 with SMTP id d2e1a72fcca58-70c1fbd91b3mr3657546b3a.11.1721165501997; Tue, 16 Jul 2024 14:31:41 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31: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 , 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 v4 01/12] dt-bindings: PCI: Cleanup of brcmstb YAML and add 7712 SoC Date: Tue, 16 Jul 2024 17:31:16 -0400 Message-Id: <20240716213131.6036-2-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_143143_442353_BC76C79C X-CRM114-Status: GOOD ( 11.76 ) 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 minItems/maxItems where needed. o Change maintainer: 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 --- .../bindings/pci/brcm,stb-pcie.yaml | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 11f8ea33240c..692f7ed7c98e 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: @@ -16,11 +16,11 @@ 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 reg: maxItems: 1 @@ -95,6 +95,18 @@ properties: minItems: 1 maxItems: 3 + resets: + minItems: 1 + items: + - description: reset for external PCIe PERST# signal # perst + - description: reset for phy reset calibration # rescal + + reset-names: + minItems: 1 + items: + - const: perst + - const: rescal + required: - compatible - reg @@ -118,8 +130,8 @@ allOf: then: properties: resets: - items: - - description: reset controller handling the PERST# signal + minItems: 1 + maxItems: 1 reset-names: items: @@ -136,8 +148,8 @@ allOf: then: properties: resets: - items: - - description: phandle pointing to the RESCAL reset controller + minItems: 1 + maxItems: 1 reset-names: items: From patchwork Tue Jul 16 21:31: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: 13734972 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 435D4C3DA49 for ; Tue, 16 Jul 2024 21:33:05 +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=OYSsCAz7S+yXbZBqWYadSkWG35XvlE7VZo7zKuSLnEA=; b=p4/HtOvsl+ieI46HsSz8XnvnG7 Gz53RUGQXEY3nmJ3SJMdM++QMMQa1jAXGwQmnx5qIz/b9DsGh6At2ffxOvGI3kMAowcs24fxe9z39 FtuZRdyh87PV1DVgIbtYsGMx0p/+7WtqhQwHIzKLUsrsbg9tKIE+M5ZFUV33FVZ2MGYInVju3L/sZ VA39sqatTLtwG1HX8wo4c7OfdLe3rzyralotAV44am+xcM+fIjHqivgCQ56L2aZPc/Zyfo7ua6lN2 8jAYE1peaG+4MBFvxAdfLCdhP5gzW2aAvCiQyJgjrTET7O0NDWngYzoxTm3a4f39ozz1bK6TORRYZ ELP37+Eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpn2-0000000Bpgu-3im5; Tue, 16 Jul 2024 21:32:52 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTplz-0000000Bp8Z-2CXk for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 21:31:49 +0000 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-70b12572bd8so4179824b3a.2 for ; Tue, 16 Jul 2024 14:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165506; x=1721770306; 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=OYSsCAz7S+yXbZBqWYadSkWG35XvlE7VZo7zKuSLnEA=; b=LZTVCsCyR0trWVbL7IUsOasAZKYjRKhvcnv26XG0HfB5Aw0EntCjqXbgFo+bVQSDd7 hIePoTeqzTUOPz/3iCTsNBloBCCwKM07NXq0iyGeKsVWwzSQ1PIwFlEPIrnwh6rsJqqc OaexR/EunTuUNK05tP8PFBSocLxtu/uQiAsNs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165506; x=1721770306; 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=OYSsCAz7S+yXbZBqWYadSkWG35XvlE7VZo7zKuSLnEA=; b=LNqkJbMC7b92eIduh8FlRCShIiiU40pohDAF3RGdY9a4wda1aWTNAM2ojGSwJRr00N RWjbf5PfWuGqXr4rkPyz6glmZHOTqzn51zQRniSrHmBVOLgA7UH5ioz+08ZetvrBe8W6 UouKFbM/CmlFAJnR6sHNXcZ2lg3Qv5JWyMGTUVyJiTR5Ye6rcg8LycATYt4aQbRJaBWc H41f4zhpRbdLPV+cdmbb2gIbc4R2K9/GrDBtw5pUWszSvHETs5ReF7LI2orAEwDy2vtQ Hb7FASOOfLFmwCwz3oF5WJCiEoTqshFT+I/H5tCjkJsVFX68ag6j+r4vmW7Mj8LKDt4O p79w== X-Forwarded-Encrypted: i=1; AJvYcCUgWTosno/7LN+n6/tYOOTBGpXc0WaOXyLJ6M5VTJAxyuRmYPRfLsmdbsgIvcicTUxMv4cnvZCz0T7D/KaxusqWB0MCCq1A9opT9sXFyMyBGvc/XCY= X-Gm-Message-State: AOJu0YxjzWTTbQknh/dP/w060/0iBG9HIlFqHssQdo9a6omNEdcOzcbc mhtoV2PQa9oc6UsGMB/YdbK6iKoIz65QQSKrd5YOq3BYBQiOg79QgFMK4t30eA== X-Google-Smtp-Source: AGHT+IFp7RQJJbzSuTE9Pz+MItT0xs2DAkOXcGXQs7Wfd4o+xgod+xaAMTG16F2VHo2wsj6wTqDAgQ== X-Received: by 2002:a05:6a00:b4a:b0:706:7052:205 with SMTP id d2e1a72fcca58-70c1fbae7e4mr3947866b3a.18.1721165505966; Tue, 16 Jul 2024 14:31:45 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31:45 -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 v4 02/12] dt-bindings: PCI: brcmstb: Add 7712 SoC description Date: Tue, 16 Jul 2024 17:31:17 -0400 Message-Id: <20240716213131.6036-3-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_143147_572895_D846BADF X-CRM114-Status: UNSURE ( 8.94 ) 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 This adds the description for the 7712 SoC, a Broadcom STB sibling chip of the RPi 5. Two new reset controllers are described. Signed-off-by: Jim Quinlan --- .../bindings/pci/brcm,stb-pcie.yaml | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 692f7ed7c98e..90683a0df2c5 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -21,6 +21,7 @@ properties: - brcm,bcm7425-pcie # Broadcom 7425 MIPs - brcm,bcm7435-pcie # Broadcom 7435 MIPs - brcm,bcm7445-pcie # Broadcom 7445 Arm + - brcm,bcm7712-pcie # Broadcom STB sibling of Rpi 5 reg: maxItems: 1 @@ -100,12 +101,16 @@ properties: items: - description: reset for external PCIe PERST# signal # perst - description: reset for phy reset calibration # rescal + - description: reset for PCIe/CPU bus bridge # bridge + - description: reset for soft PCIe core reset # swinit reset-names: minItems: 1 items: - const: perst - const: rescal + - const: bridge + - const: swinit required: - compatible @@ -159,6 +164,27 @@ allOf: - 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 + - reset-names + unevaluatedProperties: false examples: From patchwork Tue Jul 16 21:31: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: 13734973 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 7B9B8C3DA59 for ; Tue, 16 Jul 2024 21:33:24 +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=8uvqDu2yfCIfsC/szHd8VLSTht0LJn4T/cgWnh+3KBc=; b=DkSt200JvjA3gnoSUc2jxzPEAe 4NlsSFYvDtKcXY9Sw4TwpRlREz+ITyeJtKm7GiuMwxGPX15crJyXeEOwtZi7eEDX0/ERkUIfYN2Ng DGqnvEsvtQgtgw+z9/LzXK8wQmgV8OQ5euI3th3XQ/XBR+bD7DNIHKBb1PjwFIzr20kTmr/eMss6X 6E6m5UXab/uCbnQr0SF8wwxG0bL8UDqHMH5it8FSxJsrMMj0eOMWMRSlXUnrH3wCHf83mfXyuHrc5 ECWQ0yGWHcC+q7YptXxIswz9PLVzt1gk0MVnLRXCPBXoY+FIHtvYv4oAxSmmHqJfBGHGM/Lg5JNDg HMGkIm1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpnM-0000000BpqT-1jF2; Tue, 16 Jul 2024 21:33:12 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpm2-0000000BpAQ-0lmO for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 21:31:52 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-70af8128081so4108154b3a.1 for ; Tue, 16 Jul 2024 14:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165509; x=1721770309; 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=8uvqDu2yfCIfsC/szHd8VLSTht0LJn4T/cgWnh+3KBc=; b=IRMf2yfAmH6OO96cb3uXY+MentbEd3qIQs3zXYmDBPXV1wg/ImqUkxSWQmrmJKVJCo ydL3Oa1ctYlwah/KZUrvFktw2/fL806JznYlwnvWGShL4+gpcfB32DcCDjeEwWfVqlcE Vd4OE7AIjQevj8rZZ9DaFF2/zvqPaNSY/7f/E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165509; x=1721770309; 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=8uvqDu2yfCIfsC/szHd8VLSTht0LJn4T/cgWnh+3KBc=; b=LRzQ3lHzNkBaSqtZq6WMdHEo6xzzpXIjpRFwcNVcRJZIpvLdMQCbrb6nQzg9kh1lqP UpWUNFoMndpjbySujM3lutAr2YqghvEf1YKXP8DEZbcN6zM5K3wxzM6RUZ+A65UK9O+Y w9/484C5v7hlJjFAwkUXDspKB4jtFmV3BbLs30Q+3gqnKSsCIk2paiHGcPPa2sqmmK9z 45XWSKN3/On0ZZbrjyM3/rYDODh6nDMB80TpCCsC6tARRPQ+P8npnG+vEzY9L8Ev93N0 UaVR8iMY2o/Q4JKLblkfJTseEU3vCAfZv3DUWp2GVGXXwXTkl+zkn29vCYo5gHarfDY6 3pUw== X-Forwarded-Encrypted: i=1; AJvYcCUKqxwPj/lbVquse8xOJsUaTQOGobULCQT7ieOugLIYxYRAZpovhbWUs1vDHInvXAgBeeUGgLC9n70YG60Qna1KgorEAJGLpNORDo03qsXbUmgC2wA= X-Gm-Message-State: AOJu0YyQfn56xaLxaYt2/hDTvFZFgws3EhHkkfZAIlNxU8OgsjFBJWqN 1oqakS4tncDy/0GxHd8SzYvIIBjbAEZYEzBWwe3RpspzoNIEINt6aKAM/yMxMw== X-Google-Smtp-Source: AGHT+IHrThhlnzd8LBxiCzySjP0CZq2MynpmgH95NB6gd2UaS1mI0VKjiYx4eqSInRNbvNUaupsgWg== X-Received: by 2002:a05:6a00:1992:b0:70a:efd7:ada1 with SMTP id d2e1a72fcca58-70c1fbdd47amr3995520b3a.17.1721165509480; Tue, 16 Jul 2024 14:31:49 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31: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 v4 03/12] PCI: brcmstb: Use common error handling code in brcm_pcie_probe() Date: Tue, 16 Jul 2024 17:31:18 -0400 Message-Id: <20240716213131.6036-4-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_143150_272997_E3E9ABC7 X-CRM114-Status: GOOD ( 14.40 ) 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 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 Tue Jul 16 21:31: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: 13734974 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 994B5C3DA49 for ; Tue, 16 Jul 2024 21:33:51 +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=QC2rxwEhSLtqYa48S8M5bAmpLSgNv4FnZ49VrasTClc=; b=JRWi4cPVn2kVRfiGdsP6vr4N+3 APfhnUFUsSPApof/bOQBiXejvqEYxQ7P0dzqQ0y45DsfcjIHQde1QdvAZdHg8TxY04uCEwA7YEtv7 FbOSmxbWElraEO9EfAyKe+nstrySO0EGIXIrjJwdqmJhf2CiENsFlfTU4IRI2bWyxRRNQRqUeRzHu 4p77QzyU6tdJB+OuFKbEOXuBH629w6WHRVMYfnXyg3vMEZTGTB1BxUOtf8GIV/Iqbv5a2Tt+LlwMv yYkRkQy/WqbZ/IpcAmB3arKE/ggQSpBCOE9I3Osmk4HA+7tvAJirby622B3BnpJOLa/BC6yTXsvyh v5MElCfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpnp-0000000Bq3J-20vP; Tue, 16 Jul 2024 21:33:41 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpm5-0000000BpCW-3KhQ for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 21:31:55 +0000 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-70ce3d66a8bso7082b3a.0 for ; Tue, 16 Jul 2024 14:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165513; x=1721770313; 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=QC2rxwEhSLtqYa48S8M5bAmpLSgNv4FnZ49VrasTClc=; b=UisxRWYuYAKxZjreIX3l+l5frWRNzQHZzdBQS73qI4xQ9obDUUD9Dc++Y322ppWPWw ncdMCBS69aiypEcziX4ZJQ4dcAks7dFy1EtnEL/pE1ShNMLFF5xc+lo3pKaDMRIAI5oG Loc4AV7/F9SHhuOF707OV2kY/eh2FzNg7ftT8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165513; x=1721770313; 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=QC2rxwEhSLtqYa48S8M5bAmpLSgNv4FnZ49VrasTClc=; b=wkCMYNqqYhYbmpjyzafjrIv7t8PYCfztY405OPGixur0KigoCJgPsiJ9k3uL4TIK9u RUvLdi8cufeAbzGUwqNGlfjoMkUxZC2UWgDh9ifHJSnRawZMBm1zPxcStJ9Jdx+nHac7 Xs3/DjvmyTZPIMBLELf/DqLBRD80woKRw8dYQ7uvXmOsY+SuMu65cd7ubVzUWyIX/Z0T EfCbTVyU9uAZJ0Qyyn9Zvdag3f0jjjmzrXVr3FELiHwN6cJ6NNd0bM1cZEKNByuOTKnh mJ3ZYtKTAvzkOcSgll12SV00C6hdODbJldrHNzlEZCb9fzbugQWh4E+flHBBYCMPSjI9 uZcg== X-Forwarded-Encrypted: i=1; AJvYcCVjWP6FMQd5jUmE/9LWbkicMyDt08X4g53U+wbKy5HItaVmAaRpFQDGnB57gdPIrR0i62lpHvS1QCJIcWSVfBTqXxZ26O4WB4PDr4YEoKgVvXEMISo= X-Gm-Message-State: AOJu0Yyv7v1evrFP/QhA7f2lKXj2kkQrh0IDce9ozJvSTC/olKrn29Km 37X279HmCWfR1spABct3YwiQ9lvRm2zHjz30UMvLqgBaWNkBXs8SxrQGYHWj0w== X-Google-Smtp-Source: AGHT+IHCARefO9Q321jDvjEHJDSQPCVyz+1t2AKROGzfe5YcdNqEPgxb9TJaujSadqlPYWaeSwYl+A== X-Received: by 2002:a05:6a00:a1a:b0:704:23dc:6473 with SMTP id d2e1a72fcca58-70c2ea01f0cmr3716530b3a.30.1721165513082; Tue, 16 Jul 2024 14:31:53 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31:52 -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 v4 04/12] PCI: brcmstb: Use bridge reset if available Date: Tue, 16 Jul 2024 17:31:19 -0400 Message-Id: <20240716213131.6036-5-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_143153_901081_20914A01 X-CRM114-Status: GOOD ( 15.59 ) 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 Tue Jul 16 21:31: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: 13734975 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 38E2FC3DA59 for ; Tue, 16 Jul 2024 21:34:17 +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=pyhhOODC/8sUUbxWirdXml2txfy4nRmAniqkd0+qhxY=; b=URCjqFLUnip2CvdeuQDEa0jNfe La6K1LGeH87P56JwTKYU8uWEwlm7aJd7WGnwrUR640Fn0yhZQHOLfYuH9QlGh23uDqNn1XXNRojkq R1GP/YhNoADcfsj5jbVw43HplJzyxsX8rXz7DFVKBXRjnnGFx7GRo26MEbMoC0Om7KnjTrP9PgSTa //I3rVoXdwJ/ReMhTiW4KifJbpF0W3kasBueZPtEIJ64rxkdtg0P2BitIMIiDOG4xlz/Bs9vGLfdO 5ARav5dhwo2u585tTaJopbCPXL0d91PaB7N7ibjwOxSsrf85cl3K/6P10aoKhT+O53oHGY/fRmVu4 bUFqpOxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpoE-0000000BqEh-28pe; Tue, 16 Jul 2024 21:34:06 +0000 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpmA-0000000BpFf-16Io for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 21:31:59 +0000 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-70362cb061aso3305990a34.1 for ; Tue, 16 Jul 2024 14:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165517; x=1721770317; 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=pyhhOODC/8sUUbxWirdXml2txfy4nRmAniqkd0+qhxY=; b=QgFOnLyRmOuX+OUi9IOnbgOOnemOLY57EXrGyljPgKoqJJf0pxJbVZe/7ULhRWZJvo Lctyv4cKoZphFz0AuqcbsleVOG6P3tmP0K0DWsbSS0zppFi1X5aATrX2skK/6hLrjp3o ZCOhI3Mm6ucGd5RSn7cVycmPtDfr6ou8WpcD8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165517; x=1721770317; 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=pyhhOODC/8sUUbxWirdXml2txfy4nRmAniqkd0+qhxY=; b=hID7mz5ce7lOziQ8/sWABztg5IONC14LIzaU0I3dAoJKF734Oh1sJhdULsb0RTRk9+ FgY5l9PgL1+julCgY9Gzk56rptBPAGlZvZaBm049NXvLzPsR1/bxsOvFSocWo6+l9ADz 3O9BziwuoTGNh5KSg4Vc5kMsPEom9bSh1kKBUhXeIK8JFOW3hhTRYZivqiYp4iPnI72l HszFPurYhyhhBC0gUMKI+bZss0SsfF/NTjYYJgeud1GKOFyLb2vK03yzprYe2IuRGH/B GS4Ut8ZsUqcylhzBgxENCIuM68bkhWvVge1iNXooFgrbR9T9qqj07CZyVbtr+4j7UfQE AEbw== X-Forwarded-Encrypted: i=1; AJvYcCW+alE3WVQjhKuvyHgDZib67dJiMBSJP58c8+m2rF8Py4m0cpseRwJLT9iAz5ZIrm9zdJ+xaJAAIzRhBVJ4Lcxz2VzQFmkZ09jbRLy18tu8/s0g+Hw= X-Gm-Message-State: AOJu0YzCSvpeRGstUPjPgacC/M2QoXxAfWQ2Q2q19rgdDB7PqNlb698s 92JeDKcnTmAVVCwFKtdSfufsuxj4qCRPj6l6JjF+/sElnGskZBvjQVQJusxKKQ== X-Google-Smtp-Source: AGHT+IGyvYI3DfDEeXUXLaFD+3RzhfvFtKKmjP11NVlZDdaMFKZ7eqxSsGXCqSDwk+jvWaZ5X+QkeQ== X-Received: by 2002:a05:6870:c1d2:b0:25d:f8bb:c0b1 with SMTP id 586e51a60fabf-260bdd0b0b7mr2808568fac.2.1721165516721; Tue, 16 Jul 2024 14:31:56 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31:56 -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 v4 05/12] PCI: brcmstb: Use swinit reset if available Date: Tue, 16 Jul 2024 17:31:20 -0400 Message-Id: <20240716213131.6036-6-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_143158_316718_405F33A8 X-CRM114-Status: GOOD ( 12.56 ) 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 Tue Jul 16 21:31: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: 13734978 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 340ACC3DA49 for ; Tue, 16 Jul 2024 21:34:44 +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=qr+QHf0YcvsuEaozqEcRwnu4eRsc2NXCal+sBbyNa6Q=; b=u0KLIF70FoPvnzT4yygY+QykS7 zn/qqqlk7oxukHY2kiyrXvaq7t7nVSHJFqVL9Gc3oFQTee8vr46T19UkHe4Nt6bdIbhTbNWw/rnO7 8Q9CfsfA1NPPKRCPJpVjiuw/iDxT9v2m93hXzPu294rsdfDlML/2mcvOciGfuYJ6v9hCe8mltFwRk Xa4pW/fPO/wdP4KvCp6EAf51rSEh6jxTYWXZUvqeHLPEvnijFFPUuR2sG6glfa8drMP8c8zHm9gkj GBTk6vAZhm6Kevls8zMExdKSCcQRihpnbKIHvX6gZCYccv389M2EKkj6O2SXHFezV35VV5SN5+J+4 rLqygx4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpof-0000000BqRt-0sep; Tue, 16 Jul 2024 21:34:33 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpmD-0000000BpGo-2TgE for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 21:32:05 +0000 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-70b703eda27so2753901b3a.3 for ; Tue, 16 Jul 2024 14:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165520; x=1721770320; 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=qr+QHf0YcvsuEaozqEcRwnu4eRsc2NXCal+sBbyNa6Q=; b=AVtlOtlHhAWxUIHcbhE/ss/9kMVhw3fvZ5RVqaCJBlbvJa1oUzvCdY4f1PBQebobk2 VanFbJ9oQPfSq56kFN1uMqxUE7bwhOE2jbFRwZPSm7wXHTj7RlI0RX4p3rTs43NBJcI0 4Or0cQbcAwoBTCf5m/gNJlKpB92fF36AUqMOs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165520; x=1721770320; 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=qr+QHf0YcvsuEaozqEcRwnu4eRsc2NXCal+sBbyNa6Q=; b=BzhkWq2AYdsDv5OrOg172LmZsbJycQ2aRk0nCY4IzJqqxbR0Khh2k+7TQSnvo/H/UR iobCTyKs6UonFRxHUOtIfbsq52QjunFwDU8QEY3cOKeZWlKxGkMWSj8EME0W5aulEN4X CXwspxUQzshnY2xGygv+NixVPUO8rZk3OLoRC65M3DhSFD01zfijgNG0+oV01zKCgYws AChqhhRkqUPFB9kZfjUZ5vWuj0z4yRaCbm7eya5jn4phBTbtKwxxaZ/96QCCImAUPZz4 FbZhO/+tdhW0plv5YlR/UWlXWimYF7RFDv2xmXzbhGDO7lLN5ypmRfkDcjucmfz/xbCE EHJw== X-Forwarded-Encrypted: i=1; AJvYcCUoWGrlP6WDq9DhjvOWN9dYclh7j3/xQVSs+yekOoEXsShAEZCXkRtaGx/mGBMx6F40f/bZYQbXz3yZ+xWFp5m6VH4gGiutdgfuYh7XQ+o/3H5nvV4= X-Gm-Message-State: AOJu0Yw32XkRkgoAe011cwwRKKoWdeL0iKvJmwnQpFU83MgXXdkWRZUl pqRKwmjJ5IVNf1RnDmFc098aw/yzMEK60vhEDe1BiMdYCuZUXcv1KxYAKdCh0A== X-Google-Smtp-Source: AGHT+IHSYiDtAOt6vkPiOmOGzoCjlK8JNJow6N9e9x7/paF1mesMY/nehkea9fDquwFmwcedQMkkSQ== X-Received: by 2002:a05:6a00:138b:b0:705:c0a1:61c9 with SMTP id d2e1a72fcca58-70c1fb9162bmr4131254b3a.9.1721165520137; Tue, 16 Jul 2024 14:32:00 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31:59 -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 v4 06/12] PCI: brcmstb: PCI: brcmstb: Make HARD_DEBUG, INTR2_CPU_BASE offsets SoC-specific Date: Tue, 16 Jul 2024 17:31:21 -0400 Message-Id: <20240716213131.6036-7-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_143201_650373_0A3DBCE5 X-CRM114-Status: GOOD ( 15.39 ) 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 Reviewed-by: Manivannan Sadhasivam --- 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 Tue Jul 16 21:31: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: 13734979 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 6F4BFC3DA49 for ; Tue, 16 Jul 2024 21:35: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=fpyrnyxi0sSjYVYOgHyxED4OEzPHcHs9d473hYbcmOo=; b=lomdVYbGlPHsCb62tp9+/8ree1 oZvNCZ3DdnXkgXwi6Tz6oQDnrJ70YRVtz/8rGgXsa47IVlLVLf3cDjdFyqoso08g+4mztKJ8zJACq jmnRLH1oc5VeFLfLLwBkcT+ozD+ozt+9mh9oZ7gTLVwuFq+99styIUREsKdJCO8ZNna3E/SCvVgjC GU8Ly5ZnLip+6DpNo4GMQXkSXKn8AyDOgl9E2fLrmbHjNWmjNxjP4ilCqKdh5gVphbrmTS9cr/iz/ /+DN4w3Mw7r5EosIkkLJWZcItdj5yjK498Md7IZJcYVIkYgCxcr5jOfwQMYNNEPypOEiFaVmJouor mV4OprFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpp4-0000000Bqci-1NRl; Tue, 16 Jul 2024 21:34:58 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpmG-0000000BpIt-1QHM for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 21:32:06 +0000 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-70b04cb28acso150504b3a.0 for ; Tue, 16 Jul 2024 14:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165524; x=1721770324; 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=fpyrnyxi0sSjYVYOgHyxED4OEzPHcHs9d473hYbcmOo=; b=Vs1WUgxdJC1WBRerY+irr0hQ81AChMiVHRTMoM4f99qOStAHdEIhn3UBwhkKG42Xfv Zh69QU94DYBBoJrVd/M0n+X8mVEoSnecUrA0cbbllavqA2PwgAD9Sf5REe94n6MIUe8U BxuI/5sAWNT61xW6Dq3x+8xKrJ6SsDlFwT6Q8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165524; x=1721770324; 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=fpyrnyxi0sSjYVYOgHyxED4OEzPHcHs9d473hYbcmOo=; b=ErAOwnG3UPEH+iDT6+fLqMM33u+gZwgc/zWj958BHGAmrRC9WDtuhTtJjlHgbBif0L fPkOTD/tKOYr6xTyRA1gBN3bcRWVrUNh+rioBp32q2HBtW1/Z35jpvX5eVJuvk9u07Aa ohvUtgI1pQjcUiQ5N6ffH8dUDue6ETeyZ9iB6pLn9p0UgNbe5zfnVyUYKcI8IaY9utlu OMTjSYS5zDms/03A97i3iz2osefAn2fUTbAmHAmRfU19Y6BX1AIjPqeHdW+9RlEuUJcb LnXTsXmOvRYZzDvI9y8PJ/wtu4qNWzYzfoveLUbTUmeBH4MN3PcDQFG3VvImaOCy/xOn vlXQ== X-Forwarded-Encrypted: i=1; AJvYcCUbc+YXtaXzA69icLmKEMtz7mp4XvBZefCuy8BUdS3/hyH8fPbnmFkIdQbxwyFTskgzK8vExwF4ft6/AR4V7Ef+TZDHQiDfDFb+lWkT441Xtg4PiYg= X-Gm-Message-State: AOJu0YzY1EV6UwQkUstKYUTAJO83FtugMWlEvhI8at+Kxq5pyV004exl Ikq3jprpDWCD76JsWTntUvMgjDB1+AiLRMHZ/chKx9Me1LEs6N91aCEF3ifdHg== X-Google-Smtp-Source: AGHT+IEQ+y3xcUv5Dwl1btE2c6dnmPHXqa/DiHXMMkvzO4C3SKiBXeeShZrn4dIthVUtGZRGRZZ2AQ== X-Received: by 2002:a05:6a00:2da8:b0:706:2a38:94e2 with SMTP id d2e1a72fcca58-70cd83d64f6mr5132276b3a.12.1721165523615; Tue, 16 Jul 2024 14:32:03 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:32:03 -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 v4 07/12] PCI: brcmstb: Remove two unused constants from driver Date: Tue, 16 Jul 2024 17:31:22 -0400 Message-Id: <20240716213131.6036-8-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_143204_564935_122C8706 X-CRM114-Status: UNSURE ( 7.95 ) 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 Reviewed-by: Manivannan Sadhasivam --- 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 Tue Jul 16 21:31: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: 13734980 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 AA721C3DA49 for ; Tue, 16 Jul 2024 21:35: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=s4kASXYeu1hLSx3lE0MVV3qzd8mYBWhPkWtORo7cgFc=; b=1OQxi/BvVc6Fibky7nUirgPtr5 hQphtXBJ+ziE5hdh1wI/KXjSNDyex/HNlNzHIx/aVqm9MVxShW0JgwxuWOFdAPX3K4YcsuTaAHqg9 K++XhTqOy2O6tSPXuR/Osu66Nipvd73aRvJbgYgADGsCXjfl8dTHo0OCfE2FiOrbGETdGJ81qJg/d 9ITv97hcs+0F19Sxe6DDlMh+2JDhBAFdtdV4SKqPxciat4lELFwjUszpbE9ZbSmeF5Jgb3AK0kRk2 7Ipc1auKKp6tgWG4emfZ7xlnDE3N9tvcHqlHJFujJwxS49gRqtZSz7TNrv9eC4y65xBe4mVD1Rnku VENpvXKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTppN-0000000Bqjj-3iV5; Tue, 16 Jul 2024 21:35:17 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpmK-0000000BpLJ-40yW for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 21:32:10 +0000 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-75c5bdab7faso3234403a12.1 for ; Tue, 16 Jul 2024 14:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165528; x=1721770328; 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=s4kASXYeu1hLSx3lE0MVV3qzd8mYBWhPkWtORo7cgFc=; b=UcRFSeMGQAbBLT69zMQkXbiITGNbtekmG3ukJY3ixS9v/fUzvtNDNVIv3vqnbUQsdo gdp/BqyUq2vH9yHq9G084kqLayl9jiAlEuQ0cUPvdNv1vw4eal+CL1S82fnLyrrJCXha 00EF1ZPlq/MIqOXNZFV8xN8LcP3l6mCfcyYQs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165528; x=1721770328; 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=s4kASXYeu1hLSx3lE0MVV3qzd8mYBWhPkWtORo7cgFc=; b=FsBQ/0V6nbhq3QPwMh15KpXyvYzFKeNAEKb32oaT2TwxRoVgYVKa5ObHP4R4hIXmTN 7jYNa6VFgJe7N6ByKW2wRUouk8kfUecOf+Xar7ZhE5VKTfeWuVDTzOzUV5pnrlRc85s+ sK4I94Xe5Aj5+0T2xug5oFw2ZiCwObtWuwvao7Cd+ASyc/qwPqPIXpTHu3hpxCz4tZO1 hI4R7dR/bgD8hEHfhnOhshmkEQnUwwA871MDQ0EEUvK9bE8xGg7JecUmMIiiYBk+Qltz bO4wk8xxmReCJMyan11jGysYpJIcVjr2wscZ2E+4zUYUNaA6xrvPZLiRnR2AU6QauZLQ /cpg== X-Forwarded-Encrypted: i=1; AJvYcCUjTbC2+QEYeqNT0lkotN39+PxiA6imaELAlwOO6g37Q9SuYbfEEcZ0EU4GMauRP1w9I8LRrdLCjqMwsDbFm41ai9vAyIBVIcvW6JpUqDe6seHKyNo= X-Gm-Message-State: AOJu0Yyu7nFmTQjWI+3BYs8R+vcTL/I5nodijGqmmGkFzGUFH2snP0Fp rlrMPrbnOd1Z+A5sYjB31NI33ZHzFnhFYyGTUM39qH5fUYjflYWu9XTuW2G36w== X-Google-Smtp-Source: AGHT+IHMq7sIS5fikUr98UkxmIBVwJilGApJCxfCRLVg1iE2jvb1wLcaHJgx2XWdM6RSZ2NA/mSTgg== X-Received: by 2002:a05:6a21:9985:b0:1be:c947:f17a with SMTP id adf61e73a8af0-1c3f122bb89mr4312395637.24.1721165527534; Tue, 16 Jul 2024 14:32:07 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:32:06 -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 v4 08/12] PCI: brcmstb: Don't conflate the reset rescal with phy ctrl Date: Tue, 16 Jul 2024 17:31:23 -0400 Message-Id: <20240716213131.6036-9-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_143209_026589_A4B8F1F5 X-CRM114-Status: GOOD ( 13.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Tue Jul 16 21:31: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: 13734981 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 CE700C3DA49 for ; Tue, 16 Jul 2024 21:35:56 +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=l3bESY9UjiohbDuKiwBrmG0QIC3XBWpx3ASNRvMqeCI=; b=MRJii+u0+BYKO7HMcffIg+Ujqx Vhw2zF2u2QfTuJJPPhqizcuhOQOPL7GV7I27ETqYQ8Ej65FM8hZY3cRyR0DKzH1AUMlQK6JeWEqbl f1Y4P4DtBaoqFEx1v59Qz9ZXJLq9lVP4RU1c27yaxdzUz+M3JysMaC1DdXExz9LCRPHnuM07Vwji8 ZLpbRvJiSJjxhtkWdN6etTCLS6nqHwjwIGKXlI9w+26R43HxreghdmZvzwbaETtmVyDXNWbLbGtGB RvcBVJdrIvkvhJQj09HBg1SaFxG2ZTN+RC6Ay5KpQBDHlz0I/gCfe+4k6b4JVAVHPaIgiHJ7QKjSq JpnCU++g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTppp-0000000BqqK-2AUT; Tue, 16 Jul 2024 21:35:45 +0000 Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpmP-0000000BpNM-1Mkm for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 21:32:15 +0000 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-2598001aae7so3122158fac.2 for ; Tue, 16 Jul 2024 14:32:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165531; x=1721770331; 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=l3bESY9UjiohbDuKiwBrmG0QIC3XBWpx3ASNRvMqeCI=; b=DAQagsu6nqkGfoF4h3fdXuc9rcCEYC3n7KLmkhSW9nduE/rFEk9KlVJWBYJm/fxpjK mYna636ovuNcX8GtEZMGGqHopF2poeMcKOH+/XYu6FIu9dFYrmbnndc3J3nim8Lo6hxY ucUacTju6skvBovTXtovaCf8fbyDLyrNLPvIY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165531; x=1721770331; 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=l3bESY9UjiohbDuKiwBrmG0QIC3XBWpx3ASNRvMqeCI=; b=OL4QIvwy611U7zTVDibzbcw/haxFVLZihM+z2Kg1wg8nvlIRuS/DNDE1d91cwuQWKA 9n21r1sMj69QAuwzliRXgntha+Ruo+nvT0mOSVALyqoqV7DkVE3Uz8tQz0ZcXSlu3+cx YdN9EMUTyr7xpRw6wfJnK1uzeE5opnVZaP0vJsHyBBb8uHb6HphdNGqmwcpaFj+CZ476 Ipm7d/GHb7A9dFokw4HkW0WRFeGakyI7tTYvpUjbLsM+uJ/8iC090Ly77iOwLWJobBX4 czUmZBJ1+Y4lo5ccaCf9qN9y3B+Geta2f+NM34FfI+/03wRfFj4Zmtbtgspibm0TBXE+ ivew== X-Forwarded-Encrypted: i=1; AJvYcCUKv7hZ/d9JiZ5chI0uvK77IFBuLt5bZ0lgze+QdLQ7zZ4POjZ/wJhZ0jjOotACjS1rL9pzHNawLkY0d+LPtt+BkBP/vw0aYwrOkBcjKBCg3BKVr54= X-Gm-Message-State: AOJu0YwompX8lf72Har0FuZ2HhWTwpIAMp+tjhOhahVfhcJuKoR/iUce UPaumA5X8szOKilQ2u+B+1KLb8fa0Gt+mes8Zxss4H+bVrRmOqSdzxbs7PCdCw== X-Google-Smtp-Source: AGHT+IHbgSUfXFLYlspZT3aVC2XG8O5cysTO0jt82F+Tc8MQXTEy/SYGIK5yWtj9CK206RhZGyx3pw== X-Received: by 2002:a05:6870:5493:b0:25e:ba6b:58f with SMTP id 586e51a60fabf-260bdd806femr2915076fac.10.1721165531465; Tue, 16 Jul 2024 14:32:11 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:32:10 -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 v4 09/12] PCI: brcmstb: Refactor for chips with many regular inbound BARs Date: Tue, 16 Jul 2024 17:31:24 -0400 Message-Id: <20240716213131.6036-10-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_143213_421704_692C5E18 X-CRM114-Status: GOOD ( 33.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Tue Jul 16 21:31: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: 13734982 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 48148C3DA59 for ; Tue, 16 Jul 2024 21:36:17 +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=9cXPC9ZjUsN7gh9GfCwt9N4zeqD6VtiYnKyn2cOl2Rk=; b=AHb04XWcNy7JpgL115fvDSrkq+ SU4bq4ctbaTPeT74ClJGkVHVw1J5ZcLMRy4Ik9atldC2Hekx9+SlU8jCHttASd75B5GM+uPdV/rDx nngoawWhuL0damdWgQIqfboeuKW1BcILi+4Ms5GuT8NYeKATKZC6mqFcqrDkDWypZrIJ0MvJcRmXu hIhGdQ6juYKTq6myqOUp4XAokAaJw3iAEv/LOAHmoRUOT0GWe2iAykIqaNdv/Zvns765WkFTu5ZdA txpahNhjL1mUvt/YCpHAU8Ewv/KLEyUQcMYu1qgmJ8+kXAGZU85Ynz1esbbxoBoRk5Sdd/XeFfQ6D PGPsnE+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpq7-0000000Bqum-3vbP; Tue, 16 Jul 2024 21:36:03 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpmR-0000000BpP3-3lkV for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 21:32:18 +0000 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-70af5fbf0d5so134326b3a.1 for ; Tue, 16 Jul 2024 14:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165535; x=1721770335; 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=9cXPC9ZjUsN7gh9GfCwt9N4zeqD6VtiYnKyn2cOl2Rk=; b=MqhDSagOL/8b1KEzc+bfFnHu6ldiPX+PhdmQdbtTGi0XFFq572Ki0Qwn8A+rtgqOHA NRYiElI53zx1OOWxE/p5KnU7iI2aYoik8orJC+um3znMQ5AMfzl51gPE8Hm+K/fMS0Cq a9Pf5SjymhovsSiu9BJMYrTCeCzbaV0hEtJ0A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165535; x=1721770335; 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=9cXPC9ZjUsN7gh9GfCwt9N4zeqD6VtiYnKyn2cOl2Rk=; b=ttJJg+j4npu8w8PGMBnKFB3Yfi2XgVcQi1tGF81V4pbA3I3GC0ALXYSSPYoJqWrRet yr84x2O4g39/5NxzLOnHhaCJPkQeRxAZv7MzdLPmkhwMG5eN37Ps67bIp8OhKCM9VTPk yTlErs6Mry84ue+e1pyT9AvKWlXOT8+H52C/y2k06DPr8LOyiv2udgSkAhZEm4KxWNOY t7u51aI4wWUJbEMNIKvkypacaQ3yzYGlT9+b2LHxWBafylJErKorx0ScnV6JAZLcKQo3 3dnRUnh+0MkMLsR0sYi4TUAMHbs6BD8OM5LvkU6ckLb8eehZW8WVcpqXNGwTXy9n41uB vsOA== X-Forwarded-Encrypted: i=1; AJvYcCWRfmkdQPHqBL2542lhez68PprpAJQzYRclXX7N2zOAjKJKBXg1Aew2EzXBvFNcy++DCngJS/fGiPyF9WZ+YthFWo9CZwlQ5nVcfbu+Tlx4mQD46Zg= X-Gm-Message-State: AOJu0Yyp/oiYJvN19m2cixUY5Wc4Ux4dfsGmBMDSZAsbf9W+IepflXcb MEcyb29zoGE3o6c4JpdFZDRtGlzz3F/lWfmNHZI+a0FImuTj6sNE0QVhwWEE8A== X-Google-Smtp-Source: AGHT+IF3n49suP6SQrP+H1Dav6+5O1Eqi3J47jRydAlZlGts/YPBCDlSNfaWtB5vekrWc2VnHs0GXg== X-Received: by 2002:a05:6a20:7487:b0:1c0:f630:97a5 with SMTP id adf61e73a8af0-1c3f1fb382amr5190061637.10.1721165535114; Tue, 16 Jul 2024 14:32:15 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:32:14 -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 v4 10/12] PCI: brcmstb: Check return value of all reset_control_xxx calls Date: Tue, 16 Jul 2024 17:31:25 -0400 Message-Id: <20240716213131.6036-11-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_143216_005425_0C5A9688 X-CRM114-Status: GOOD ( 21.09 ) 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 | 101 ++++++++++++++++++-------- 1 file changed, 72 insertions(+), 29 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c44a92217855..2fe1f2a26697 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,11 @@ 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 +774,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 +804,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 +1028,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 +1268,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 +1462,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 +1485,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 +1505,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 +1539,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 +1557,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 +1619,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 Tue Jul 16 21:31: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: 13734983 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 DC53DC3DA59 for ; Tue, 16 Jul 2024 21:36:38 +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=ktkT5o05Sva3VF6fWbFtV+mlgIYa87bgVekt+2kgd+s=; b=JZ1qnHLjx8yFEXkLU3uBlRIa+e K2QbrU1355rumDtCWmlsuJCRgGUfWXkf7s9oY72pn5RKz8cC4fQ8JXbvArVRrTP4Idl+GbV+xb3yf WRXGUMATdBFefvl1GC1XU0vTFfIXiKssHDFZ8r0zcEJ+q66Qq3Bh9Hcr3rTfQlPeHGrdoY5azlkWA dJpmuFwJWcmPfpbMFoQwsknCzp+ueRxLiNxBN2XgjRgfEksxK0ojx9G9noxogAv9ZgWuSwdiRyov2 nD5Sianar01crrbit4idxJeEPNib4zocmYsVMLcaDqut8ZOxAz7e1lB8r3UozHdpNYIsWcQRdbL1R 6P2XM1eQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpqX-0000000Br0m-2Nx1; Tue, 16 Jul 2024 21:36:29 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpmV-0000000BpQP-1ya0 for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 21:32:22 +0000 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-70b07bdbfbcso147408b3a.0 for ; Tue, 16 Jul 2024 14:32:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165539; x=1721770339; 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=ktkT5o05Sva3VF6fWbFtV+mlgIYa87bgVekt+2kgd+s=; b=aJMqkBIiwkMpWSJD7amFV+qJ8V0fRuNDkyoadhYop6XyA+GCS9BNlK8PWLaO2wNHhI svR8S3n/ZjQ4YPUzF07pbRNZlYC6gA8tmZoURj055pv+/w+Yr6AUiGHXZ7OVtTZABF5P +Z3k0lUtyVNsRkgSX+0nrGDAt7RIGhwwXsTnQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165539; x=1721770339; 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=ktkT5o05Sva3VF6fWbFtV+mlgIYa87bgVekt+2kgd+s=; b=AWYtIcM9MS5B95U5O/EyRBD6WjtZaJv6P14+Vzx87HlDKxpyJda72W97lONfAP0aVO aCUoa+60O6d/uzCrsLnZNWzSMXmkK/J/iWO7gbPjoKhmyW3UlOM0V0w1n3dLcA+zpIvY TywYRpNMIWlwwfCb6jwpcaY+T0Y6EN1gfFyUqR+Ti6bK8YBN9EwqZuPSRK1Q37JJUeN0 CJuEcbzvLGFU1cywgDRM26XUreY7lg1AzOg6wYJP8Z/0qS7e7FrcZ957+/ZHbPaiyn6B N3JWLP9mGlZXDG7ZVz6RTg33JGSnv//JMbmkWvgvvQWC9ZuStEPYKfb+B7h2s6AN3Lcw t4sw== X-Forwarded-Encrypted: i=1; AJvYcCUl5szREmCm9cVjBMYJR9SKKUhsZ6NBwHu1nyWJeyYw4uTo+ln92EnMamWGR55Hz/V9wVXROT4RgsrW4tE8BP8BXlopiEfJvLkC6GnIt7JKm2L0T0E= X-Gm-Message-State: AOJu0YyPPtiQ1rZfMVYxpiNC6Js1uAGgdtpyPDWyQ9M6XN+vguToVFdS 0Gn1MjlhvzdFtmFCjK0BUNla1oGWSxdfOcHhSg/eGaxce0F8yCAQB/6MnEXtpg== X-Google-Smtp-Source: AGHT+IGx3fCh6S2QfTNtvLqxaswCxSc1oIJxvnMZ0D0dcPdjNSV74JcS7F3v925N9gUIHSu7fi3oxg== X-Received: by 2002:a05:6a20:7487:b0:1c0:f630:97a5 with SMTP id adf61e73a8af0-1c3f1fb382amr5190270637.10.1721165538637; Tue, 16 Jul 2024 14:32:18 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:32:18 -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 v4 11/12] PCI: brcmstb: Change field name from 'type' to 'model' Date: Tue, 16 Jul 2024 17:31:26 -0400 Message-Id: <20240716213131.6036-12-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_143219_685947_D5F732A8 X-CRM114-Status: GOOD ( 20.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 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 2fe1f2a26697..fa5616a56383 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; } /* @@ -852,7 +852,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) { @@ -869,7 +869,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) @@ -886,7 +886,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, @@ -1008,7 +1008,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; @@ -1036,7 +1036,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); @@ -1067,9 +1067,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 */ @@ -1666,7 +1666,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, @@ -1674,7 +1674,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, @@ -1682,7 +1682,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, @@ -1690,7 +1690,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, @@ -1706,7 +1706,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, @@ -1714,7 +1714,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, @@ -1722,7 +1722,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, @@ -1779,7 +1779,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; @@ -1848,7 +1848,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; @@ -1863,7 +1863,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 Tue Jul 16 21:31:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734984 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 BBBFAC3DA59 for ; Tue, 16 Jul 2024 21:37:03 +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=V2u620+dzTFTeBGRAe4DWF2vSC/TRr+wMM00sSfbqO8=; b=UJpMvbtDMK3EkTsqxu4h9g9SD6 Kn4PAsrRfkYMIZTsiS3MX6VMHvZMzxWICDzc6yhbI3+KuLtm9KLd37lNgZygPCRAv+M/kbBBlCsoD WggOZ7WfgsQTR0XjjcyD1af7p8yeer9ljw3qMWt65vtGOC+nYcC4R3MijFbNhWW2yYLl8WNRbcYRz UUp/LpuHTNalkk3Vc3ZmTyafw0HL/atTmf2tCHeuTBe5tBq9w2BYTf56yBs/OekUwcGNKFvQ58LRa e4i5yjkrm9wvl+SiH7m8ltdWZjWN7u8JCmcA8Jd9agAu58ImW2NSSAaLi9fIXrmQ+YXsHOooyqL++ 3B6/L2Xw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpqu-0000000Br6M-2oCs; Tue, 16 Jul 2024 21:36:52 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpmY-0000000BpT9-3qVB for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 21:32:25 +0000 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-70b7a528331so2370419b3a.1 for ; Tue, 16 Jul 2024 14:32:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165542; x=1721770342; 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=V2u620+dzTFTeBGRAe4DWF2vSC/TRr+wMM00sSfbqO8=; b=AzfgEBlq5gvlzNLfVF75OTZx5SjqTwAi2ddmZu8wf/fOt4IbZmT8b4xg/EmAp8RbSD kWqY1TNT2CP3ZmItho66eY31w1VKKmCykV1wLchd/Bj9WCZg3egwBtMMdZpS3nbb4kEe ng2/B7Msz1TliUO0sGreEEJ2pNO76r2BmOEu0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165542; x=1721770342; 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=V2u620+dzTFTeBGRAe4DWF2vSC/TRr+wMM00sSfbqO8=; b=IGM6pSY6+6X4pjoBOnAhcmdtdurLpXmkvqL26GTES3aKpyfTuPUYsPMMWrJiz9oWsf +CIJdEl9tUWS4NazSHBMQ0vaLwyGXNgu5xt62rheYIpKVqupvlaQF1RaVUtAri0FHEFS kWsGAkc69DlgPPNp4rWfzZt4gvYs+uj4UPDUqti8G/RLzJelQMV3FwtZ9TbUtL1dUEjP LCQYNNgqF1z4MLXORMbqgYn8PFe2cBLmrbtIFeBNYoqwnWo9MY69obC+xAB6MRhJKyQr wOPHj/BUjE6qyU+ScH+K+aznw8cPyQyMooJMSmlOnwt6IdZVzl31prGlrMAFsOElHzw7 7QNA== X-Forwarded-Encrypted: i=1; AJvYcCUhJmSTONjsxYjnG7ww2MLT/qMseMBBWP3MIiU9MVNV3JuLzp0EQ2jW2G3IvVfsBbxuPcbbyTQ5XvuqRBQSxUUQsGSxW2kEKDiK9CL+fdKMO1JPDs0= X-Gm-Message-State: AOJu0YzfJgM2awypGDam26IbvKdGrhMqDm3KMvuafuo8pDMLgBkzkSWb 46Z+JO0mefcxFxTd1aTZqetrsna02ahLUQ7IS8MVnwG08BPeaJjITpMHacetmQ== X-Google-Smtp-Source: AGHT+IH0Y9+x+k35oeCTVD3LE8/SAcgucMDAoq8oz6zUhM4uRLOH0VIwFmwWNPm22oM56uujdUQQpA== X-Received: by 2002:a05:6a00:2e15:b0:70a:fa4c:4b28 with SMTP id d2e1a72fcca58-70c1fbe1812mr4531776b3a.15.1721165542191; Tue, 16 Jul 2024 14:32:22 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:32:21 -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 v4 12/12] PCI: brcmstb: Enable 7712 SOCs Date: Tue, 16 Jul 2024 17:31:27 -0400 Message-Id: <20240716213131.6036-13-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_143223_046055_7ECD85C7 X-CRM114-Status: GOOD ( 12.49 ) 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 Tested-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 fa5616a56383..7debb3599789 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1193,6 +1193,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); } @@ -1664,6 +1668,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, @@ -1729,6 +1740,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 }, @@ -1738,6 +1757,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 }, {}, };