From patchwork Wed Jul 3 18:02:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722658 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 9F1BDC30653 for ; Wed, 3 Jul 2024 18:03:48 +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=E4saHPzxd5Ks0nbTtxRxIzvCaROHIVnT/8SHrMvbCsY=; b=zAIk7zW/Jl1/xsiJLDuo4RhlLg J+XwyXRGSvhE9rdKA6E1PFOXTZy8OBTD9afNybr8EOp9qPdackQZTaX6e07dOuT/Sn7x4OrukPvq+ 1ULZEFu+7YYgdgED8T8sNxBLQ0XQLVwpDqzASGYPsdaPeJO/7eftj3XWJUhnm61A7Y0KMMdbDk6fT n4Vom4HAjK9pUsFsFSkdUqzTjZWhIPQ8LuoSDJJ9EIS/c9QGV4IzQpvrXXMsdSLyLPT4WSeFciA6f LMxyAczosM05VuFuAScbNmSDPk7qh1XTokWmo8qRs/DjcC4lan3DHQey3FDeKcGZaJMI/da6Ckg5g +2nafXpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4KN-0000000B5E6-1nAM; Wed, 03 Jul 2024 18:03:35 +0000 Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4Jv-0000000B4wD-1fbz for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 18:03:10 +0000 Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-6ad8243dba8so29980826d6.3 for ; Wed, 03 Jul 2024 11:03:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029786; x=1720634586; 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=E4saHPzxd5Ks0nbTtxRxIzvCaROHIVnT/8SHrMvbCsY=; b=YjrQO0RBlnz/Dbt8f9vm7dnwwcnFWKnNZHesBz4YkNYE/99Cl2jEHGDvpr80UxYOTM Dn1Jsi1vHYmjJmpHc4BmxtugTKgtlkOfGbDqZ0ltBEC+NNDdbvZYI0ujc8dZUWBCawsr Uqym/ytcA6fRU2VtCmPoDGjtuQoK9Zu+6+Uis= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029786; x=1720634586; 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=E4saHPzxd5Ks0nbTtxRxIzvCaROHIVnT/8SHrMvbCsY=; b=HTa8vVFxwKez/jWaWQGmUKnX+c/qxXdiso2ExgVaFMSdu9uOuXikn8H5vqeldZLmeT EShtuuyvkoQOaSl9I64b45A/kH9aKe2yIYU7OKMdITjjXYiU8Wr1BRUNSaApT3hxrePA /W2Zylat1fNLD48eE8fCLEBfBwnVwgtYamAGVOl/EOzacBfjtOFTUt+IDCJa48JDZgxm IXPbXetCBNv6B/pf05lcXjwhtwjwfv8uoQ2K7eC0jzTBbzCiM7x5+/eW4QBWmywzAM/4 xQDFUt6N7eXNC7L12bC/PVwhJmosJAvc58Mfsg9xA/JXitcS1jmpTDGKeIH1uIAGyTFJ t0fA== X-Forwarded-Encrypted: i=1; AJvYcCUwk77N9KQRQwcCQpDDi6Ai8GxwvFxdEmLgS/SU5PreBDsE9FZsT4ozG2Z7kkiYHzfFL0AxkBcMMikt81fPv9ouYKcPnqeKFPC919rPdee6M1gxKBc= X-Gm-Message-State: AOJu0Yzt5TFH7B299gipTWqx0DPJyskF/Lz7d1Wt6E/gJxS91EbB1lnn UMkOPyDLQ0GzAbwpIf+Qk9QoEUKIHFuNMzre8yHjolDaG0eHxE7OoSxhyEADnQ== X-Google-Smtp-Source: AGHT+IH++y0W0znIk1Hi5gEZgLkMjB2ShRsmrwwCbtpcKXrMa9A7R4aXh6zLAAoOlNjDpiR5I9VVSA== X-Received: by 2002:a05:6214:3005:b0:6b5:42b7:122 with SMTP id 6a1803df08f44-6b5b717b58bmr147088576d6.60.1720029785897; Wed, 03 Jul 2024 11:03:05 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:05 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v2 01/12] dt-bindings: PCI: Add Broadcom STB 7712 SOC, update maintainer Date: Wed, 3 Jul 2024 14:02:45 -0400 Message-Id: <20240703180300.42959-2-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_110307_450538_0C5112D5 X-CRM114-Status: GOOD ( 12.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 - Update maintainer; Nicolas hasn't been active and it makes more sense to have a Broadcom maintainer - Add a driver compatible string for the new STB SOC 7712 - Add two new resets for the 7712: "bridge", for the the bridge between the PCIe core and the memory bus; "swinit", the PCIe core reset. - Order the compatible strings alphabetically - Restructure the reset controllers so that the definitions appear first before any rules that govern them. Signed-off-by: Jim Quinlan --- .../bindings/pci/brcm,stb-pcie.yaml | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 11f8ea33240c..a070f35d28d7 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,12 @@ properties: - brcm,bcm2711-pcie # The Raspberry Pi 4 - brcm,bcm4908-pcie - brcm,bcm7211-pcie # Broadcom STB version of RPi4 - - brcm,bcm7278-pcie # Broadcom 7278 Arm - brcm,bcm7216-pcie # Broadcom 7216 Arm - - brcm,bcm7445-pcie # Broadcom 7445 Arm + - brcm,bcm7278-pcie # Broadcom 7278 Arm - brcm,bcm7425-pcie # Broadcom 7425 MIPs - brcm,bcm7435-pcie # Broadcom 7435 MIPs + - brcm,bcm7445-pcie # Broadcom 7445 Arm + - brcm,bcm7712-pcie # STB sibling SOC of Raspberry Pi 5 reg: maxItems: 1 @@ -95,6 +96,20 @@ properties: minItems: 1 maxItems: 3 + resets: + items: + - description: reset for phy calibration + - description: reset for PCIe/CPU bus bridge + - description: reset for soft PCIe core reset + - description: reset for PERST# PCIe signal + + reset-names: + items: + - const: rescal + - const: bridge + - const: swinit + - const: perst + required: - compatible - reg @@ -118,13 +133,10 @@ allOf: then: properties: resets: - items: - - description: reset controller handling the PERST# signal - + minItems: 1 reset-names: items: - const: perst - required: - resets - reset-names @@ -136,12 +148,28 @@ allOf: then: properties: resets: + minItems: 1 + reset-names: items: - - description: phandle pointing to the RESCAL reset controller + - const: rescal + required: + - resets + - reset-names + - if: + properties: + compatible: + contains: + const: brcm,bcm7712-pcie + then: + properties: + resets: + minItems: 3 reset-names: items: - const: rescal + - const: bridge + - const: swinit required: - resets From patchwork Wed Jul 3 18:02:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722659 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 E3503C30653 for ; Wed, 3 Jul 2024 18:04:00 +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=g2FbvKney1QWp4c8ls7X1i1tvh9o9+TUWKKhDHwBL2U=; b=PlTD8fgx2jij/II/aHPVDTpnig T4JBmF462DD9CLdoBKrTlE+uT8rvLXnaJJC10YlWbfV1TUckGqhVmrMLDM+BJ8GFLJ8NnSnD3asUt mr/nqFwPy1HAkxlJF7LDJqZIceH7jbFKlOVlNhQHBQuDBKP8n98WMT1URL7h331zDro6FiviKde/K jcta9Uh3ydJq3tWL9yZVC6d7tIbov1nco2U0JbpWXYw7LH4Jo/fNp5gHcRn8QTF96OUyHjf2/+81q NCl8PC3h/BHC+6JrlrxJU4KyAt+4wnE5NDKwq9dnUdSULCQOK2EsO9N7TuYCiA8Z5W0piLb6Ym/PL uNczV+lA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4Kd-0000000B5Mp-2ieO; Wed, 03 Jul 2024 18:03:51 +0000 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4Jx-0000000B4xL-0Z6S for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 18:03:11 +0000 Received: by mail-qv1-xf2b.google.com with SMTP id 6a1803df08f44-6b553b1a159so28099786d6.0 for ; Wed, 03 Jul 2024 11:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029787; x=1720634587; 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=g2FbvKney1QWp4c8ls7X1i1tvh9o9+TUWKKhDHwBL2U=; b=gfiZ6MLJcUTpvdtuwsjtu6bi6yuLjDmlLYnsTSbHkftfEmEKWFn8n1yV92ekDuJ6Yg l51Ikc8rSS0tgxZd+xGdJPR+CcmGOfS3iqnQ/ExRRKfLpWS0QfLf7pyePA5cYYOLbXos AQ1q2w4bBX+lRmNy9JQYd/AHr4miZALiEskW8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029787; x=1720634587; 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=g2FbvKney1QWp4c8ls7X1i1tvh9o9+TUWKKhDHwBL2U=; b=kYQ7MydJVR+m9gtrm0J5ctLcOekvMIatbYLBPuWEhvrd+WZNGlEYbhPG9qaWH9waYT caj0mtqetZekdq2OcWqLOAljTFrVrEpBE4kVh/Tqtac9vyic3kBFKMaLQynZPLmtG9Sf clJQGUtjALwxnSpBAU3sbaQFy/SYwDREuO5xLBNev7recZxRSwjIh+BqnCN3nsLyBu1+ JjldDvO4KF9kO2ECH8fwSKckdSutqGT7Td6bYzHVz9S0touuhVMVHrlksVPKTTryQFAl uQVsQZe5UzowOJXOOhx2wQC7W4TL5Z+/MX8+JXG+cPYy1FCpotlXGJRgdhyd4hs8qLLL P1Sg== X-Forwarded-Encrypted: i=1; AJvYcCWLY+KLczAbpVzWkEFnCaC9hLpoRQ+EEDdwKcIwKndOB23zbHW0pb2ihvC+/6j4GqDFlk6xZe+BymYuKIr8UJH4qA0u9mp858ykksCnbETdNp96U6w= X-Gm-Message-State: AOJu0YysuF7GRARPjhdZMrkcwJtUOQS428Fr0kPZdbOxDvif3oJC0kmo klj2wklYZMlOV6c0NLwpyAC/JaHDSOKNSIwhNYMhV1z9Iq4qY0IPiA0y6+91HA== X-Google-Smtp-Source: AGHT+IFXuw7cmg0WWrIFF051lnnYU9WCOItnYRzRjveFDrXAg2LZ5dgJsm5yAu5w/YAdJlWx84hg3A== X-Received: by 2002:a05:6214:20a7:b0:6b0:8e1d:f720 with SMTP id 6a1803df08f44-6b5b71ad1f2mr141051136d6.59.1720029787375; Wed, 03 Jul 2024 11:03:07 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:06 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v2 02/12] PCI: brcmstb: Use "clk_out" error path label Date: Wed, 3 Jul 2024 14:02:46 -0400 Message-Id: <20240703180300.42959-3-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_110309_204628_8E42C74D X-CRM114-Status: GOOD ( 12.34 ) 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 Instead of invoking "clk_disable_unprepare(pcie->clk)" in a number of error paths, we can just use a "clk_out" label and goto the label after setting the return value. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c08683febdd4..c2eb29b886f7 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1620,24 +1620,25 @@ static int brcm_pcie_probe(struct platform_device *pdev) } pcie->rescal = devm_reset_control_get_optional_shared(&pdev->dev, "rescal"); if (IS_ERR(pcie->rescal)) { - clk_disable_unprepare(pcie->clk); - return PTR_ERR(pcie->rescal); + ret = PTR_ERR(pcie->rescal); + goto clk_out; } pcie->perst_reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "perst"); if (IS_ERR(pcie->perst_reset)) { - clk_disable_unprepare(pcie->clk); - return PTR_ERR(pcie->perst_reset); + ret = PTR_ERR(pcie->perst_reset); + goto clk_out; } 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 +1677,9 @@ static int brcm_pcie_probe(struct platform_device *pdev) return 0; +clk_out: + clk_disable_unprepare(pcie->clk); + return ret; fail: __brcm_pcie_remove(pcie); return ret; From patchwork Wed Jul 3 18:02:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722660 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 48796C2BD09 for ; Wed, 3 Jul 2024 18:04:16 +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=3G1UdWhXQLqPzqIU1YipRjDtctaGGn87odlGJQjPDDE=; b=fIhNYDqfwsccT/6CJ+6l5s4t/i JB+pUbbQXpSs7upMgA+kgIsU1gOmL4i9HZrsX6LnqUuSqo7sGwwBYpHeRQSdbJz7Q6y2KMHwnRu+e QuBTPN4FQ55ameepJ/eOyD3VMdfHfJqZM2sGUQOkie98BxFUxLvLQrwe5/0BvVN2cYRoi7gRdupWm b7HyXqamOa7y7OTSlA+IcYcSOZrupvQGaz164gggWHIRRRYKeq+UuMx+aqQsAV7ZbNPzI4Z/n8YwN +Wvoc1Uq2EqjAw0n4dN+Qhi8MQjp0Su36Vbw14PYm16HdeHL8eU8gVVekRZ6xP1fo4zUJ2Mb5KRc+ OkK5YkSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4Kr-0000000B5TZ-0dQO; Wed, 03 Jul 2024 18:04:05 +0000 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4Jy-0000000B4yU-2JE4 for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 18:03:13 +0000 Received: by mail-qv1-xf2e.google.com with SMTP id 6a1803df08f44-6b553b1a159so28100106d6.0 for ; Wed, 03 Jul 2024 11:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029790; x=1720634590; 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=3G1UdWhXQLqPzqIU1YipRjDtctaGGn87odlGJQjPDDE=; b=DbeDgyJ+9FJY7J2fXf/TzHRoPa7r3tOhoSyItuQAhUujPmLHzwuCapAUDhoPYVtnCU s+OW2EdSzm2apZFlcHaYV907ihsmZ2xOLSH3yHkDyMgzXpyQ3jBikzCue5ynEVx8e8cg xLbzs4u2mItkz0CjERCtMFGyltcix4jExvKMc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029790; x=1720634590; 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=3G1UdWhXQLqPzqIU1YipRjDtctaGGn87odlGJQjPDDE=; b=aybGtx3UtLv5IQ2kP1OGqiUfzQ6r/fLhzD9HsXBpAuqsNS/mlsZXlZdcNuOaTpmoEP +J7OroYglSwuBDtQfb7Oqvl2wW/qvODTeWk8gaCcM7evrJNi5Pwg+vS6q8kXq/QCygx2 Tgcd9z6YG28mVKy/hU0n2mV54818R4cZGjh3iU1WsvfWnf7uPjhMrwn3o19npRWsWp4w fGjezgwxwndd7VzUVQ66oxVYEh8blhCxH0XkkhCvFEgVLvpBbxtlE7cuozfIw+qLKw3n bZd4GQScTHXdEDv/gad4HAqhfXQf77JF1VNWHKJ4sK1GrETr3JnTVGWGZZt26d3uCHdT guvQ== X-Forwarded-Encrypted: i=1; AJvYcCXly63Fkep40fVaC4pHFz2bbj/GJhc206I12IRhCT9WS2Hz0EJqumC1fr9ExzAUg/Wkqh8xmZF/MKyah9sAohIDroO8W82rkJyEDteYDjkjjHeB0MQ= X-Gm-Message-State: AOJu0Ywq1Zb0kZ6uZOpBFzVhfCXi4DwEx26CaFOTmkwHSqyJKJQLCmeJ cIDPpHLdoc+a5y2L5BLinMqdeI8jxnlqXTgdCUr8NtEZnFTwLjnd4MkmDkL3Ow== X-Google-Smtp-Source: AGHT+IHrIodtULPxBVRNVIp6XlZEo4cm9rcmium+oajhbYxKHA+sJtGuN7oqp5wbg8H+RmYxWagMIg== X-Received: by 2002:a05:6214:ca3:b0:6b5:34b:8c02 with SMTP id 6a1803df08f44-6b5b70c2856mr146549116d6.27.1720029789499; Wed, 03 Jul 2024 11:03:09 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:08 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v2 03/12] PCI: brcmstb: Use bridge reset if available Date: Wed, 3 Jul 2024 14:02:47 -0400 Message-Id: <20240703180300.42959-4-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_110310_840853_1C72AB37 X-CRM114-Status: GOOD ( 16.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 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 --- drivers/pci/controller/pcie-brcmstb.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c2eb29b886f7..4104c3668fdb 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) @@ -1635,6 +1643,12 @@ static int brcm_pcie_probe(struct platform_device *pdev) goto clk_out; } + pcie->bridge = devm_reset_control_get_optional_exclusive(&pdev->dev, "bridge"); + if (IS_ERR(pcie->bridge)) { + ret = PTR_ERR(pcie->bridge); + goto clk_out; + } + ret = brcm_phy_start(pcie); if (ret) { reset_control_rearm(pcie->rescal); From patchwork Wed Jul 3 18:02:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722661 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 95EC1C2BD09 for ; Wed, 3 Jul 2024 18:04:28 +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=gmOF3C/tJRdC6RQ/w0/bkN//R/qMRJQWlkFWQpdmfOs=; b=wAyKG3cbXwP9+SmXngulhv9VPx YVWzWjon2fRutHY3qh8PWm1wlD2q5m0vAKVX2snwOrsno2kSAR6ZNg53uvXghX/BQ7W8IV8S7Vf3x Ml2boJLdL1xQuo5FlaHTeyzNRR20Wr62ZqY97YdtkEtjtidC+8BqtH+xibGifbObgrWq33Vda0PPN 7WGndmD6DMc9Zk5K7hreundZXMqIc5UOkX1o5Io0p3z9AC2Zof9LOPh+c/p6BKjZiXPNr5fg+P+3y Z3lB/HfkfJJ6M6HaA7gMbrdZAVnZG6cd2kgwJ2YvixHUdi8fTaGUIsxQ9UDKhij4vE5/iyV87cTdF kHRadlPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4L4-0000000B5bU-2ZJx; Wed, 03 Jul 2024 18:04:18 +0000 Received: from mail-qv1-xf30.google.com ([2607:f8b0:4864:20::f30]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4K1-0000000B4zU-0jD5 for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 18:03:16 +0000 Received: by mail-qv1-xf30.google.com with SMTP id 6a1803df08f44-6ad86f3cc34so25460806d6.1 for ; Wed, 03 Jul 2024 11:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029791; x=1720634591; 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=gmOF3C/tJRdC6RQ/w0/bkN//R/qMRJQWlkFWQpdmfOs=; b=E/xFivcEcIrSPKCzUlfLzunv2DPBzrr2PCL8q+uWE0zy40qrDL7QlA5rPjyBp+9QBr PeiP3Od1SwdD+rsqZK7PqfAGGArcsc51ZTXPkYQF5GRJRbt6q/QRy2oSQjD6wvI7BxQQ 7Eq95X3C1Vr2FhJNMxLes0u7/gRNSiXYI3bxo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029791; x=1720634591; 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=gmOF3C/tJRdC6RQ/w0/bkN//R/qMRJQWlkFWQpdmfOs=; b=QYGVy8KDXRm7OXsF5x/DLJHcpSWx9p0xuI7Wx9JOhJNqtV8cFDSy5Z9z/FD0pn6JIB JA4TOHfe+c3FmDqLhafZtR71IGUOEFLXcNYxdfNx0OZUmsTWdq4r7QcD4Gpd+ryu5Yfl HTQekRxT9qKLlyAkvYLXVAhYBIqJUZnSkQmse/8uWYMt+fZMgqgohws6VriLJKjyrK0n m3nXK/CP70KpSh8d6okhWJyHGeTMGGnSvTo6AJEcRNNRIpMk2NyXHf5l81BT9UhIFWyv UEaK3H7tQZly98lwRNo/mOYQWegFDpQ8vJ94M86vZWH3SOFRVKlTpP/1yrqt/kk1S4Tq uFOA== X-Forwarded-Encrypted: i=1; AJvYcCXGkdYl87H6dvFXKugN1A/Yxf28tqGBs2S41YxaHtySrE67YnTuDt2AhZgzTGcTdbeP2N40ZhBTS0ogI5uyVC+7KAg4mdNyeUgoZdKj/nShB6zExRM= X-Gm-Message-State: AOJu0Yw+r1RpFEh1dVuzpdKpufHvPDzIepFxEImUSSY+VIP5vRorg6Dt vlyaJV/yONIkbyG6Eluy17QtYG6e7WdNb23awKOA/IztqEsCT4iOE1mMnOUoUw== X-Google-Smtp-Source: AGHT+IGDIenXr4YjMW4GwoxRbUQJpTRRQmg2sDYstsvk38qnq4s2NTVKbFtCbvE+st+pQmHWAmeV/Q== X-Received: by 2002:a05:6214:2521:b0:6b5:238:2e42 with SMTP id 6a1803df08f44-6b5b719d2bbmr155619166d6.40.1720029791001; Wed, 03 Jul 2024 11:03:11 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:10 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v2 04/12] PCI: brcmstb: Use swinit reset if available Date: Wed, 3 Jul 2024 14:02:48 -0400 Message-Id: <20240703180300.42959-5-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_110313_281786_C8779398 X-CRM114-Status: GOOD ( 13.07 ) 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 --- drivers/pci/controller/pcie-brcmstb.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 4104c3668fdb..69926ee5c961 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; @@ -1626,6 +1627,13 @@ static int brcm_pcie_probe(struct platform_device *pdev) dev_err(&pdev->dev, "could not enable clock\n"); return ret; } + + pcie->swinit = devm_reset_control_get_optional_exclusive(&pdev->dev, "swinit"); + if (IS_ERR(pcie->swinit)) { + ret = dev_err_probe(&pdev->dev, PTR_ERR(pcie->swinit), + "failed to get 'swinit' reset\n"); + goto clk_out; + } pcie->rescal = devm_reset_control_get_optional_shared(&pdev->dev, "rescal"); if (IS_ERR(pcie->rescal)) { ret = PTR_ERR(pcie->rescal); @@ -1637,6 +1645,17 @@ static int brcm_pcie_probe(struct platform_device *pdev) goto clk_out; } + ret = reset_control_assert(pcie->swinit); + if (ret) { + dev_err_probe(&pdev->dev, ret, "could not assert reset 'swinit'\n"); + goto clk_out; + } + ret = reset_control_deassert(pcie->swinit); + if (ret) { + dev_err(&pdev->dev, "could not de-assert reset 'swinit' after asserting\n"); + goto clk_out; + } + ret = reset_control_reset(pcie->rescal); if (ret) { dev_err(&pdev->dev, "failed to deassert 'rescal'\n"); From patchwork Wed Jul 3 18:02:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722662 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 EB01CC30653 for ; Wed, 3 Jul 2024 18:04:48 +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=AuhuIrsgOqkZW3If8rwxeIX971dD10izklbCiwFuSEQ=; b=Uq02d3gOfF7+q+xAKxXdPx701X 1+sEh0USj3El7RPtpz7W4b1gID4x4AHbvTI9IfzLV+B3BzXYUTndXEB2++3bP43IQCQxQ3SwpNJNC SEjYNTn1hd9CG1e1PDTS6w7CzDTLQLsopWZPSkmkwh/Gc4yVQHBtE7thhdyDyJr4P8A8m101xyefZ z368EygxpTgzuXut+hsi8u5LZdUUdNoNLB/mbDlj1NdoeR6iQwzpo2AfiCMVjPDDar6UIQ0k7eLZs 8nTNBNVxdAnC9+wfXYkALukgSCeSbISZzjVBzbRICFdC8gJWCveQXjVuUHmqTBjIdOdxwC+MS2Yfb 3HKBiE9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4LF-0000000B5gV-4BUl; Wed, 03 Jul 2024 18:04:30 +0000 Received: from mail-qv1-xf2c.google.com ([2607:f8b0:4864:20::f2c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4K1-0000000B51B-49Zc for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 18:03:16 +0000 Received: by mail-qv1-xf2c.google.com with SMTP id 6a1803df08f44-6b5daf5ea91so9486536d6.1 for ; Wed, 03 Jul 2024 11:03:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029793; x=1720634593; 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=AuhuIrsgOqkZW3If8rwxeIX971dD10izklbCiwFuSEQ=; b=cXAlhl0qdl+fBjElXIV+GqCoPoSPNO6NVyV/QHyisO/hvqJ7XiFZhVyqsCLCAUy0lS AQl05oZuu4QZTWQRZfT92i4aQ8BmZfjz7bmrd0FSsgzXWfIzfGvwVPLVEHE1cH9CEClD M4S5kuPiDdKDAn3oYFE/FK5Ke7Ww06/zDsJmc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029793; x=1720634593; 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=AuhuIrsgOqkZW3If8rwxeIX971dD10izklbCiwFuSEQ=; b=CD4O9azg8TVy1nYORSZ5Ofzn8mcidYw9fDr0mivyANqortPumhqCTB0mYAfu5lBhy8 Kjs2rrradloFq1br51eYDwJpRy6DMfMTEjSSLhGvUq2ecdXVYhWB12gDTEbKkqy57MIG Zi8xGXwqmR6gqvy0vsvknUPZnG+4P93dl7fTi1Bjhj6XsQ4KBbGIDQPGfBq1NaZhDWN2 MzHSjrivP1/YGEpOtPUM7YhPSDarw4FAw63AqMh0jI/Qwo02Ep/SHHCUhH7Nppl0uiXh Ju47nvfsS79vdOlBdjfX+tvTFacj42RUW5iylCyB0Da8umNzr5NeuTib1J2eXu+/ucUP sjQg== X-Forwarded-Encrypted: i=1; AJvYcCVazAhaWk74GeEQM0hUSESxPuO95N6JtmEoitmzLZhwhxbvNt9qDdA7HSVWDSXz9HZEO8D8B3iV4W5eNvC8zqHbFMF+G5Bu5nM01vaigWck/h+4ivk= X-Gm-Message-State: AOJu0YwMgc2TFoYy6l3E8Qq5cKBVIiEGv0vctRZdkc69FXsBiGBPSpC4 mYm8dPvYxqaVM6eiiErD9pbxy4VJE+wv26yoR4Uchj2aLjT9AdqW+aMxdAYC4A== X-Google-Smtp-Source: AGHT+IFvyn19h6XGEm0wfTzwiOrNHdvorSM1l6w/oocJLdctEG+4frKOEE66qjj0sNM+aokLw7rXCg== X-Received: by 2002:ad4:5c6b:0:b0:6b5:a81b:b974 with SMTP id 6a1803df08f44-6b5b704f9c0mr156271586d6.7.1720029793079; Wed, 03 Jul 2024 11:03:13 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:12 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v2 05/12] PCI: brcmstb: Get resource before we start asserting reset controllers Date: Wed, 3 Jul 2024 14:02:49 -0400 Message-Id: <20240703180300.42959-6-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_110314_079697_27C82738 X-CRM114-Status: GOOD ( 11.87 ) 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 Place all of the devm_reset_contol_get*() calls above the calls that assert the reset controllers. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 69926ee5c961..59daa4b2e6c5 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1644,6 +1644,11 @@ static int brcm_pcie_probe(struct platform_device *pdev) ret = PTR_ERR(pcie->perst_reset); goto clk_out; } + pcie->bridge = devm_reset_control_get_optional_exclusive(&pdev->dev, "bridge"); + if (IS_ERR(pcie->bridge)) { + ret = PTR_ERR(pcie->bridge); + goto clk_out; + } ret = reset_control_assert(pcie->swinit); if (ret) { @@ -1662,12 +1667,6 @@ static int brcm_pcie_probe(struct platform_device *pdev) goto clk_out; } - pcie->bridge = devm_reset_control_get_optional_exclusive(&pdev->dev, "bridge"); - if (IS_ERR(pcie->bridge)) { - ret = PTR_ERR(pcie->bridge); - goto clk_out; - } - ret = brcm_phy_start(pcie); if (ret) { reset_control_rearm(pcie->rescal); From patchwork Wed Jul 3 18:02:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722663 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 23C96C2BD09 for ; Wed, 3 Jul 2024 18:05:01 +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=yQ/akpD05nWPE4moez8sTI2NdaqEuZNhdNopi4vJDDY=; b=uUPN67PUGond3iDt1YRl+5ilfE KcmS1COoQmNBQgaAd6KgAxbAcXBvAFZvzpLWUWG8xxe0VTZ9PRcA3Cf6p3CO0sttGzjMY/HZqD6At BMEzvZ7nG6MFZ6Mz9V2DAGbuduObs6XHecA78iMed/My4Z3Savi8/RKNBIjw7sPrvng21eZ/jlTt9 mbOMkqYGnRQaGqjJbjRf6R25gyqU17ov+uQtWh0QPi74iWF5GmWrH9BfhO/1uwpKkVuHjOZqxs4Dn NTKpU5SYbs46N8LSU0qOr74ulr6rugUcAIPdsnTqBjy3BbBw3Eiw5NMY/ZPLtwp+pzFX89jnpGopa WbhGeDaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4LW-0000000B5pi-1pJY; Wed, 03 Jul 2024 18:04:47 +0000 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4K4-0000000B52O-08ni for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 18:03:18 +0000 Received: by mail-qv1-xf2f.google.com with SMTP id 6a1803df08f44-6b5dee163d1so7917436d6.0 for ; Wed, 03 Jul 2024 11:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029795; x=1720634595; 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=yQ/akpD05nWPE4moez8sTI2NdaqEuZNhdNopi4vJDDY=; b=DVZw4y0Luf6kgKiZ0dztV84cpVA2qmDDMTXjbim6fuNsrTah7ousy0ywVdZ6osvByf 4Q5DgeASYbd2NACDhCIzmbzNs02XtEKWx9ARe1594jOtHzawQ1jT5SKQwkeBMjacgTPp JwhroaJAtoSH6KqTmg37sWAerw8ltonWazq1Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029795; x=1720634595; 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=yQ/akpD05nWPE4moez8sTI2NdaqEuZNhdNopi4vJDDY=; b=BznKXhjyve6lJ4sSkZkDL8lbhiqebmga2xdX2qtuiKoNPaBLRY+qBZcDDc5tsK0RoJ aabVUIVuYZ3f9W0PwKmG1vdWwzT0319P/dVeIM9OvnJBYhh3z6UgIuckBZmSd+Dt6Ky1 BL9jnw+54KDp3lOMvK50FxO+cOJ3jypq8J+HgRkv6kkbaXO1SgRDrsIc03sh7N3TCOE2 n0WP8/MSofRayhr8pzpqnLHhfGcNM7CbMy0qogjY2sIQAB6++j/pMNCnLR5lX+BBDjBT k7vMGaYyxoEk72WX7dJWE4m+Rjy/4apvW9kodBymlDC8w5BtYHOU3NwYaHT3xwZi7m35 b3nA== X-Forwarded-Encrypted: i=1; AJvYcCWv/89CPtw+UIqDfX43L1jtLx00OUYAB77GYcCzdDeW/3bCwWQ9D227RIqesFnLHP3A+uCCqCmlaCFSwp0zRzZKRL/Zh1h0RgNKJSJ2dQdjNHQtKFA= X-Gm-Message-State: AOJu0Yx+NkkPu2/mL5G64GNziieyVMMC+WfvHFOwLb46JuTazOlhQYp5 ySqDZD7DLIXFGwhe9a/oZvfUxkG2BRBcz7bUQmW4A+A3eWAA2ccQSD9tzqPf1Q== X-Google-Smtp-Source: AGHT+IFVkg5UeCybsdO7WWu4hT/GW38dRqFzzVEfzcG22MbePizXsOO4RJeJmKh4oI91Y7COhumL5w== X-Received: by 2002:a05:6214:48e:b0:6b5:1cea:649d with SMTP id 6a1803df08f44-6b5e18b1889mr40862876d6.11.1720029794888; Wed, 03 Jul 2024 11:03:14 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:14 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v2 06/12] PCI: brcmstb: PCI: brcmstb: Make HARD_DEBUG, INTR2_CPU_BASE offsets SoC-specific Date: Wed, 3 Jul 2024 14:02:50 -0400 Message-Id: <20240703180300.42959-7-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_110316_176920_2D40C1CF X-CRM114-Status: GOOD ( 14.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- drivers/pci/controller/pcie-brcmstb.c | 33 +++++++++++++++++---------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 59daa4b2e6c5..d8c0f1474369 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 @@ -187,6 +186,8 @@ #define IDX_ADDR(pcie) (pcie->reg_offsets[EXT_CFG_INDEX]) #define DATA_ADDR(pcie) (pcie->reg_offsets[EXT_CFG_DATA]) #define PCIE_RGR1_SW_INIT_1(pcie) (pcie->reg_offsets[RGR1_SW_INIT_1]) +#define HARD_DEBUG(pcie) (pcie->reg_offsets[PCIE_HARD_DEBUG]) +#define INTR2_CPU_BASE(pcie) (pcie->reg_offsets[PCIE_INTR2_CPU_BASE]) /* Rescal registers */ #define PCIE_DVT_PMU_PCIE_PHY_CTRL 0xc700 @@ -205,6 +206,8 @@ enum { RGR1_SW_INIT_1, EXT_CFG_INDEX, EXT_CFG_DATA, + PCIE_HARD_DEBUG, + PCIE_INTR2_CPU_BASE, }; enum { @@ -651,7 +654,7 @@ static int brcm_pcie_enable_msi(struct brcm_pcie *pcie) BUILD_BUG_ON(BRCM_INT_PCI_MSI_LEGACY_NR > BRCM_INT_PCI_MSI_NR); if (msi->legacy) { - msi->intr_base = msi->base + PCIE_INTR2_CPU_BASE; + msi->intr_base = msi->base + INTR2_CPU_BASE(pcie); msi->nr = BRCM_INT_PCI_MSI_LEGACY_NR; msi->legacy_shift = 24; } else { @@ -898,12 +901,12 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) /* Take the bridge out of reset */ pcie->bridge_sw_init_set(pcie, 0); - tmp = readl(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + tmp = readl(base + HARD_DEBUG(pcie)); if (is_bmips(pcie)) tmp &= ~PCIE_BMIPS_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK; else tmp &= ~PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK; - writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + writel(tmp, base + HARD_DEBUG(pcie)); /* Wait for SerDes to be stable */ usleep_range(100, 200); @@ -1072,7 +1075,7 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie) } /* Start out assuming safe mode (both mode bits cleared) */ - clkreq_cntl = readl(pcie->base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + clkreq_cntl = readl(pcie->base + HARD_DEBUG(pcie)); clkreq_cntl &= ~PCIE_CLKREQ_MASK; if (strcmp(mode, "no-l1ss") == 0) { @@ -1115,7 +1118,7 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie) dev_err(pcie->dev, err_msg); mode = "safe"; } - writel(clkreq_cntl, pcie->base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + writel(clkreq_cntl, pcie->base + HARD_DEBUG(pcie)); dev_info(pcie->dev, "clkreq-mode set to %s\n", mode); } @@ -1337,9 +1340,9 @@ static void brcm_pcie_turn_off(struct brcm_pcie *pcie) writel(tmp, base + PCIE_MISC_PCIE_CTRL); /* Turn off SerDes */ - tmp = readl(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + tmp = readl(base + HARD_DEBUG(pcie)); u32p_replace_bits(&tmp, 1, PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); - writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + writel(tmp, base + HARD_DEBUG(pcie)); /* Shutdown PCIe bridge */ pcie->bridge_sw_init_set(pcie, 1); @@ -1425,9 +1428,9 @@ static int brcm_pcie_resume_noirq(struct device *dev) pcie->bridge_sw_init_set(pcie, 0); /* SERDES_IDDQ = 0 */ - tmp = readl(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + tmp = readl(base + HARD_DEBUG(pcie)); u32p_replace_bits(&tmp, 0, PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); - writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + writel(tmp, base + HARD_DEBUG(pcie)); /* wait for serdes to be stable */ udelay(100); @@ -1499,12 +1502,16 @@ static const int pcie_offsets[] = { [RGR1_SW_INIT_1] = 0x9210, [EXT_CFG_INDEX] = 0x9000, [EXT_CFG_DATA] = 0x9004, + [PCIE_HARD_DEBUG] = 0x4204, + [PCIE_INTR2_CPU_BASE] = 0x4300, }; static const int pcie_offsets_bmips_7425[] = { [RGR1_SW_INIT_1] = 0x8010, [EXT_CFG_INDEX] = 0x8300, [EXT_CFG_DATA] = 0x8304, + [PCIE_HARD_DEBUG] = 0x4204, + [PCIE_INTR2_CPU_BASE] = 0x4300, }; static const struct pcie_cfg_data generic_cfg = { @@ -1539,6 +1546,8 @@ static const int pcie_offset_bcm7278[] = { [RGR1_SW_INIT_1] = 0xc010, [EXT_CFG_INDEX] = 0x9000, [EXT_CFG_DATA] = 0x9004, + [PCIE_HARD_DEBUG] = 0x4204, + [PCIE_INTR2_CPU_BASE] = 0x4300, }; static const struct pcie_cfg_data bcm7278_cfg = { From patchwork Wed Jul 3 18:02:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722664 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 A84A6C30653 for ; Wed, 3 Jul 2024 18:05:11 +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=DH75zQaW4tsGAjkSCLMLjrr9IecO7tm55Ns3iiMhxO4=; b=K3yjCDgLcbq1S/GWXGQjwJ71T5 HbnpeSv8V2NeW5cvNrG/T1mXZ36EpLF3+fI1AYoYGV6zR43GXn5vSqkNZM7tN5EpL+mqpNH6231ye SKXHRYRcpOvqIg/siHj36+yzZnj2JavpDKH1El1r9iN83+rD8sz+RlRYilyZ5Pm5QA1YwG7KbnXhb /WGcMPeMHdUqwH7SxhSM3nM8brrjUgCpK9u41xr+3DfznoQq8jfErynMxlEoBdsBV5m5Cn0iWt6BN OhcIxHz2o49/ye2x/yKL4ifWBZw3fLBKcVTRQB5uzj91+/L7TX1l9C+oaO+u2SalaYPgRfWh4Sv2Y Ua3JuBUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4Lk-0000000B5wd-48Ub; Wed, 03 Jul 2024 18:05:00 +0000 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4K6-0000000B53o-1raO for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 18:03:20 +0000 Received: by mail-qk1-x735.google.com with SMTP id af79cd13be357-79c0e7ec66dso459514185a.1 for ; Wed, 03 Jul 2024 11:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029797; x=1720634597; 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=DH75zQaW4tsGAjkSCLMLjrr9IecO7tm55Ns3iiMhxO4=; b=hjJu2U301iao9qLfX4LDp8vmZvY8mnXC2LIYnDeRhnTpWv0FZc4rlnZ1vHwfRZ9MML eeSlE6CMdPgbbsCR0MXcrhBuFweLEMF2I4dqqx/kknbNuBbB0wvWtygqoaVGhrlEmd9B 2nxTvGKuC2sLtCCvSX7GrMZFYlE6SYiHjOnGM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029797; x=1720634597; 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=DH75zQaW4tsGAjkSCLMLjrr9IecO7tm55Ns3iiMhxO4=; b=tcqvYjCy/xuLlmBpl5T7XjNyJTs/zaBYaeDvHneNMcuDDBrtQ0A9BmlR0IIgk+zyEX QMv7fQkFKs0DfXqIQEjHpST1ifyjVdB0niVvXPUBE4jBOFsfS5/qeSXOBsvPhmV49EN9 Isf4RdJP5mtAjm4znHKI4IYapEimfdBUCRxSvYrGhPOiPeFMTcfAu2bsPFCxlksOHid5 EHXcw/BoNiTgluDdiRXAsa4MRKAfEofOvprSl4UsOnL7wfCHLc93+KYYP7Qjyty6cuwO m/wiaEvNkAL/Hx3YtGi1MTYIBmu2METzD7WLaAYX2lMrUjdxH4dWkQYXS0gxPHWlH1lI nyKA== X-Forwarded-Encrypted: i=1; AJvYcCVup4bcXaXx2yWjt6VZpRMmG0XwBhLIsCumWtiLHtRQwbbrHbcVB93QLjP8r1XcQvfRW1SqKGhg90/JyRajSb8hbd1GmtYToGOKdbQTmJH90tPxuiE= X-Gm-Message-State: AOJu0YzxRbVv+ZctLBVm/Z2oNmrhKAJtl2J2qz3AAtf7dNMUGI9aCbk8 pgp0SIbCFx7L/1ymi9zcAe8rB8CVrvY1aHft6g8mAhZHfNb8c9p2QrzEzptLng== X-Google-Smtp-Source: AGHT+IE6uHoz4cTA72J7+htPr0lmBT1zu6ZB4m7wS0U1dIdazQBuFT5lKcvFqPATqX5GLBNTOGUr7Q== X-Received: by 2002:a05:6214:29e3:b0:6b5:3eb:6cf6 with SMTP id 6a1803df08f44-6b5b71a5d4amr165799996d6.40.1720029796681; Wed, 03 Jul 2024 11:03:16 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:15 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v2 07/12] PCI: brcmstb: Remove two unused constants from driver Date: Wed, 3 Jul 2024 14:02:51 -0400 Message-Id: <20240703180300.42959-8-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_110318_540329_A34BF3FA X-CRM114-Status: UNSURE ( 8.09 ) 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 --- 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 d8c0f1474369..3aa82871e9b3 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -210,11 +210,6 @@ enum { PCIE_INTR2_CPU_BASE, }; -enum { - RGR1_SW_INIT_1_INIT_MASK, - RGR1_SW_INIT_1_INIT_SHIFT, -}; - enum pcie_type { GENERIC, BCM7425, From patchwork Wed Jul 3 18:02:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722665 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 674E9C2BD09 for ; Wed, 3 Jul 2024 18:05: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=/yEDcW98oYn7ok2vgCi4TmYgoBpInm3hSqoujf4ztH0=; b=TjWJ7gc5hc1AdDvcOslCqC8Vas vjjqe16qL97LoY5bGxFWuILW+XXFDJUWm5Dvu5s/CAAmjhTZbJeoIOdmP0LYPXi3g/7ljnK7L+Qdu sDdxeQcK8uUtF+yrteU3CvvuMVEZxJJzVLWh5WLHHkYPMOOHoNP5EsK7BQxHlIVzljeMql64RsQZ1 U0CiJywA2nyT2gWTeS8r1rRE7g5a0mEh3urnizWOVacLvVQl7QWiMapYohvyoJRmPbKzNJQM0QJY/ hNjQFFnCElx7gp+Li7j0pMj/NEH7+a3BK65RffVKoarmVRf+j7cf89+NJ9cjP8LUAs7gWK5pM2bd0 RD49MoQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4Lw-0000000B62s-2sO8; Wed, 03 Jul 2024 18:05:12 +0000 Received: from mail-qv1-xf2c.google.com ([2607:f8b0:4864:20::f2c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4K6-0000000B54K-481L for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 18:03:22 +0000 Received: by mail-qv1-xf2c.google.com with SMTP id 6a1803df08f44-6b590e36a8dso25648876d6.1 for ; Wed, 03 Jul 2024 11:03:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029798; x=1720634598; 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=/yEDcW98oYn7ok2vgCi4TmYgoBpInm3hSqoujf4ztH0=; b=eTy2y9MUN1z6uVUWhpmzF9Or6AYelq3U81zx5O0C/cgpWWCKVm3KJM1bHLQ//5PRDJ kx6jaFliUfhdpCjOYsx1QMavq/D/3omfw946tfHx8AnE6rca609KoAAfrEv7sGYc0kGo W8OqB7Yo4fEWRcmeXYfBjovfqAOBvPdHfwwTE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029798; x=1720634598; 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=/yEDcW98oYn7ok2vgCi4TmYgoBpInm3hSqoujf4ztH0=; b=QvrC2BL+GWgI8z3+wdavrM1OdhWH8bWIFyfG25ZwK28r5pgMzPzGNrB+E5z6Rulq1e 5fXzHqgv3VmTtr4glK8rTPwYD7dCot2JOFx/JytRUPPWPyPJ+f/O0Pkh4/MvmgtQYpJF gcSxNch/j98hA01zBrg5sxUoRHOh3DbzRcVrOG7Gwa6BSLzH5kvi7ZDRpzdTgikwyhaC dmp3FICfKY7AaTk1qHVQIeKZDULhdjmEb3UeRw1cY6A05fw0c0KEPr/b7DPFIVUR6gWg 5LGJQHEBJxlKgr28giMskgsp0rs/vG69htqNaZe4c6d96kf36+EJIdFvNbQ3K80FpD4m pOIQ== X-Forwarded-Encrypted: i=1; AJvYcCUP1za4qAc/6CyYsAo6L07tJvxcT9bbsXpTbgLDYKQvyM3i7yPpKMUf8KFd/6a2OSfOM+PIufglY0aUmKw/NctEaVv/ImbfLzrLQp9PjMEVX+/t0S4= X-Gm-Message-State: AOJu0Yzc2YYZL2VzK2GjOnw+am+xNXaR3cijx/ajbaWps+bq9fIKLe2I BKA1rkBC8fsRsSjGjCHRjzgKG6yTAm9hzc9IWdR/XTlLIe3mMXiesMNxKbmjdg== X-Google-Smtp-Source: AGHT+IEjxUaTGLmO7EJMAa/TgB1qW7iqWFCD0RMo8l2bw7YFxx+GoQgQJT1u8o/uNPyZPEbzb8Mvww== X-Received: by 2002:ad4:5ae2:0:b0:6b5:db70:b980 with SMTP id 6a1803df08f44-6b5db70bf68mr58937496d6.4.1720029798171; Wed, 03 Jul 2024 11:03:18 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:17 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v2 08/12] PCI: brcmstb: Don't conflate the reset rescal with phy ctrl Date: Wed, 3 Jul 2024 14:02:52 -0400 Message-Id: <20240703180300.42959-9-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_110319_111082_0F9256B9 X-CRM114-Status: GOOD ( 13.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 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 --- 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 3aa82871e9b3..ffb3e8d8fb2a 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -222,6 +222,7 @@ enum pcie_type { struct pcie_cfg_data { const int *offsets; const enum pcie_type type; + const bool has_phy; void (*perst_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); }; @@ -272,6 +273,7 @@ struct brcm_pcie { void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); struct subdev_regulators *sr; bool ep_wakeup_capable; + bool has_phy; }; static inline bool is_bmips(const struct brcm_pcie *pcie) @@ -1311,12 +1313,12 @@ static int brcm_phy_cntl(struct brcm_pcie *pcie, const int start) static inline int brcm_phy_start(struct brcm_pcie *pcie) { - return pcie->rescal ? brcm_phy_cntl(pcie, 1) : 0; + return pcie->has_phy ? brcm_phy_cntl(pcie, 1) : 0; } static inline int brcm_phy_stop(struct brcm_pcie *pcie) { - return pcie->rescal ? brcm_phy_cntl(pcie, 0) : 0; + return pcie->has_phy ? brcm_phy_cntl(pcie, 0) : 0; } static void brcm_pcie_turn_off(struct brcm_pcie *pcie) @@ -1559,12 +1561,20 @@ static const struct pcie_cfg_data bcm2711_cfg = { .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, }; +static const struct pcie_cfg_data bcm7216_cfg = { + .offsets = pcie_offset_bcm7278, + .type = BCM7278, + .perst_set = brcm_pcie_perst_set_7278, + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, + .has_phy = true, +}; + static const struct of_device_id brcm_pcie_match[] = { { .compatible = "brcm,bcm2711-pcie", .data = &bcm2711_cfg }, { .compatible = "brcm,bcm4908-pcie", .data = &bcm4908_cfg }, { .compatible = "brcm,bcm7211-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7278-pcie", .data = &bcm7278_cfg }, - { .compatible = "brcm,bcm7216-pcie", .data = &bcm7278_cfg }, + { .compatible = "brcm,bcm7216-pcie", .data = &bcm7216_cfg }, { .compatible = "brcm,bcm7445-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7435-pcie", .data = &bcm7435_cfg }, { .compatible = "brcm,bcm7425-pcie", .data = &bcm7425_cfg }, @@ -1612,6 +1622,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) pcie->type = data->type; pcie->perst_set = data->perst_set; pcie->bridge_sw_init_set = data->bridge_sw_init_set; + pcie->has_phy = data->has_phy; pcie->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pcie->base)) From patchwork Wed Jul 3 18:02:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722666 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 C75D1C30653 for ; Wed, 3 Jul 2024 18:05:36 +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=OKyXo3JrjKIfi85k8a1M8czGvq4KbbofK5Cj7AATCKk=; b=nar1TeupD/T0Li6Kxv8nnFlffD LiAn2uLMgAP8kF/jDNVMBPaiK2MpkjyR/38SrvkPh4Ga1gZSsr7698ZIWa5tCl+vrsivNbQubyAFZ dN0/SyFF/MMs6cNFNtaU/mKpNAacpEZPVvaqIo8HKVBkyaVTdcOIFS/LU9xLlIuq9Y1ko+cLbywuo eHSG17w2GEHCQ2DfC2HBOOTizDuwBckps2hLlJZ/DXAby5AgwvlPQuGuXeXrkomw7EblHLu4+b/tX RBUlqGlvP84RGF0+9odkhGZMw/DnLaT01PQAMs5Xdi+vbGvPQ5B+OUO1kQ4h/SZDIbcsRY9hGkchk foRtu5BQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4M9-0000000B6Aa-3cxO; Wed, 03 Jul 2024 18:05:25 +0000 Received: from mail-qt1-x829.google.com ([2607:f8b0:4864:20::829]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4K9-0000000B56A-2k9Y for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 18:03:23 +0000 Received: by mail-qt1-x829.google.com with SMTP id d75a77b69052e-445ae4cfe5aso36549621cf.0 for ; Wed, 03 Jul 2024 11:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029800; x=1720634600; 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=OKyXo3JrjKIfi85k8a1M8czGvq4KbbofK5Cj7AATCKk=; b=HZSvsY7Etoel1rXS3H5JVuZnKFwFoPbky4abUj+dE1JpeWbibQFP6g+nqnqkKwocuX o2qvpTAJkvdj/ZZGnR3f0vF3+4CwBi3DQvD2gdiZRgZJ72j0zNKPSnFnDYloXemMVxYd /CqP3wM2Iq9QJYI3ABJ1RQb0vkTkrQckl9T9Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029800; x=1720634600; 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=OKyXo3JrjKIfi85k8a1M8czGvq4KbbofK5Cj7AATCKk=; b=hkopYHzV7DRek7fFAb08mR0r8SBuF0+ywK5eCdJhmf0lBgDzxft6/wHhaIEoY5oL2l FqCbAVNPVRCQIw6a+g4V3TiY7ha0bazUtE/dyGIxPkIrc/fQUm6Wr5B+plQHMEE4YMMS pSVwo4dW9FObhCCqUGwCSxw6opo0KNGHKoa0ZcAH0L3QDRNczDGhoI1rkT/NJSvKWk3c mvNMypcw6obxqXAfGd0gOGX9nVYVoqwv5EIboKFW6h+s9NuDlwiz6vr/eMhc5i4vutLm Brwndly8IQP9ShqZ5aM6iZNjfq6Rpx2MLDMlafREjfXR1Uw/v99uh9jCaN3XKPzHlqfQ bumg== X-Forwarded-Encrypted: i=1; AJvYcCV0jPOYvDJZ5IYeRRXt6kK9gISHa3D/A8o7So4VxbLtxONrGnFc/1INVynWLU7jLh2mno7Umvysn2+z6mDkbWOajyzTRMtW7u9iUrUEvI1hbREQsi0= X-Gm-Message-State: AOJu0YwFZDiaI7HYUtTWEXt4+UT54M3PXKc0Fj5CHP3/KiJKauYvPB2g 15o6eAbmu+KX7OYPAa2KMqPOtQEh1yZsCf+/et48g2YAUMYOg3LHjAmXs6jyjg== X-Google-Smtp-Source: AGHT+IHsbNay5kPebm98vOxzmUo/dTmM+j39+KivX9EytZmJgT+4/wjyOO54Yq1Fle5LEbwltouM2w== X-Received: by 2002:a05:6214:5094:b0:6b5:7c8:8336 with SMTP id 6a1803df08f44-6b5b71d2449mr137483576d6.56.1720029799737; Wed, 03 Jul 2024 11:03:19 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:19 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v2 09/12] PCI: brcmstb: Refactor for chips with many regular inbound BARs Date: Wed, 3 Jul 2024 14:02:53 -0400 Message-Id: <20240703180300.42959-10-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_110321_803856_DA4C507B X-CRM114-Status: GOOD ( 33.65 ) 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 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 --- drivers/pci/controller/pcie-brcmstb.c | 199 +++++++++++++++++++------- 1 file changed, 150 insertions(+), 49 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index ffb3e8d8fb2a..5f632fdc0052 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 0x1 +#define PCIE_MISC_UBUS_BAR4_CONFIG_REMAP 0x410c + #define PCIE_MSI_INTR2_BASE 0x4500 /* Offsets from INTR2_CPU and MSI_INTR2 BASE offsets */ @@ -217,6 +218,13 @@ enum pcie_type { BCM4908, BCM7278, BCM2711, + BCM7712, +}; + +struct rc_bar { + u64 size; + u64 pci_offset; + u64 cpu_addr; }; struct pcie_cfg_data { @@ -274,6 +282,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 +798,60 @@ 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_rc_bar_sizes_and_offsets(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 BAR1 by default. It is mapped not + * to system memory but to a regiion all of the SOC registers. No + * one uses this anymore. + */ + 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 = entry->res->end - entry->res->start + 1; + 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 +859,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 +881,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 +924,50 @@ 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 unsigned int brcm_calc_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 unsigned int brcm_calc_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 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 i, memc; /* Reset the bridge */ pcie->bridge_sw_init_set(pcie, 1); @@ -933,17 +1016,47 @@ 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_rc_bar_sizes_and_offsets(pcie, rc_bars); + if (num_rc_bars < 0) + return num_rc_bars; + + 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_calc_bar_reg_offset(i); + + 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_calc_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); + } + } - 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); + 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 +1078,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; @@ -1623,6 +1723,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 = (pcie->type == BCM7712) ? 10 : 3; pcie->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pcie->base)) From patchwork Wed Jul 3 18:02:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722667 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 E2CE7C30653 for ; Wed, 3 Jul 2024 18:05: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=VoCFrvsL/ZMMc2mlbXqqlmOXmNWUWh6pr9wpC3BNDRo=; b=aTL+Va5q1uFO/sXzFn6zntXVSC McxbyaxfRNucg8VE9c9HTKeV8KMCeEXrB5TmY4DLMH1ezG6p3X7ZeeZoyYmPsJpUrk6HSAGqwPtxm 8Khq1Udq5yHuBoWnQC4emmtUcVOSQG7PrhOxpWc7fobaOUXXnT/ocu0AYJl+RLzc+zMe0//+B7Axh FKyoxbq3x5zDoc4EEtYxckl4Uxa4rZ74PyGQx0td9rAbZac0piLyoBEvKrNDQrC7p7n6e8R49vBdw NW7u5Y/EAdyhL6VdGrDDPm0L5f5qUtHzGqCwkjxPYZFEmKrR/4vbWOyuFan1LItHvJUEuOHP2eSW4 k4R6FCfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4MM-0000000B6HM-0KOJ; Wed, 03 Jul 2024 18:05:38 +0000 Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4KB-0000000B57y-1vC3 for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 18:03:25 +0000 Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-6b5e4466931so3781856d6.0 for ; Wed, 03 Jul 2024 11:03:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029802; x=1720634602; 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=VoCFrvsL/ZMMc2mlbXqqlmOXmNWUWh6pr9wpC3BNDRo=; b=RcvXTmiFISani9/0fmHwEDkGSxUe5RLEuw36XxeOlFM1TMJAHbgw0OI2lEg99Gs7px cbdnZI3Uxq99gt7EK2Wue9a+iFH+ZED/G2FQqEKzf+seVbnUhpVktlL+YSWpecPZqO+3 ng6TJJrKhywBQZdIVoBHtDe/jd2kB3CwbDz0c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029802; x=1720634602; 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=VoCFrvsL/ZMMc2mlbXqqlmOXmNWUWh6pr9wpC3BNDRo=; b=bhTVuZa877Ip3loW5J8ByjgXkSgMAXWAuFzu6EdNGQVByv0jQGuQsSjXo+mIAOBqF1 X8Ug/h8HWgEsiIfr7/TzKNVth8x3Wj2+/31qY2Gi8b4bRmZHSg3rr/8ly4zxDPGWRHWy zTfT7LXJoKPesFWco1RDdvb2FXxgHWii8ufdbjO2628VSiuicR/Y6pfn5tq+ljU0VZGT W745RfT0Zsl1U4F71g6hmCscEz2bAtkg8bqN1G7NWTzTJJZFxHgP48AlzDMTHA6ViR6M Rro4IPfupqoLitefKkZY5eihEC1lE8bgSOTtuG+IVZZNWBjaMBP/EFwFpN7zpCjGpw/L jNiw== X-Forwarded-Encrypted: i=1; AJvYcCXls1ov+cOoWDo7NNMIAD6xvSCQQACpZik14v7DE/JA5qJdGxzGaOfJ5V4Zc4TwjKbKGxESLE6HqqU93PhTP9GjzanFQ2pB3KVLA9MEJ8fp30kzLko= X-Gm-Message-State: AOJu0YxbZQRhgTM8ik+sT2c72pN6ru1Bb01KcyAEB2nmMK2rbPYV6UlR iFYMuOoHV9bQ/qMp8n6rni1EuUmdhEVk75SInfynmuKGTQz18fZjsNiGm4iDfA== X-Google-Smtp-Source: AGHT+IGbJe5pkc2j7LdAc3NBpb3Lu+goP25Rbr3UThoc2CRUdNdd0GaOxU/sxrlkRDfdbHcsPnDlTw== X-Received: by 2002:a05:6214:4601:b0:6b5:9a89:35d9 with SMTP id 6a1803df08f44-6b5b71f4d19mr160016156d6.64.1720029801406; Wed, 03 Jul 2024 11:03:21 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:20 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v2 10/12] PCI: brcmstb: Check return value of all reset_control_xxx calls Date: Wed, 3 Jul 2024 14:02:54 -0400 Message-Id: <20240703180300.42959-11-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_110323_574788_0FE4AB0C X-CRM114-Status: GOOD ( 13.94 ) 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 at the least issue a dev_err(...) message if the return value is not zero. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 33 ++++++++++++++++++++------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 5f632fdc0052..1c3ce0c182d1 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -743,11 +743,16 @@ 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) { + int ret; + 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; @@ -770,13 +775,20 @@ static void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val) static void 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; 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); + } static void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val) @@ -1460,7 +1472,7 @@ 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; brcm_pcie_turn_off(pcie); /* @@ -1491,7 +1503,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; } } @@ -1506,7 +1521,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); @@ -1568,7 +1583,9 @@ static int brcm_pcie_resume_noirq(struct device *dev) if (pcie->sr) regulator_bulk_disable(pcie->sr->num_supplies, pcie->sr->supplies); err_reset: - reset_control_rearm(pcie->rescal); + rret = reset_control_rearm(pcie->rescal); + if (rret) + dev_err(pcie->dev, "failed to rearm 'rescal' reset, err=%d\n", rret); err_disable_clk: clk_disable_unprepare(pcie->clk); return ret; From patchwork Wed Jul 3 18:02:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722668 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 6CD42C2BD09 for ; Wed, 3 Jul 2024 18:06:02 +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=F1AnJJ+OdCX9b4yYoql8kQ+f1dgIsxleTBRmaDO9oKE=; b=BzJwI1m7Irdxx+SZr/LvRmsRdc jlI9chkIwLBbXLuL3ZaT2Jrh0kcrXAMAegCFl06fP+U97wVANPBcbdAj54jK+l+MpHscjKrtCAdsw tnEAVkUdcPcYXT/7eTgzEuo8lX15eI1ow497ygtjjQbjSG9uXAg+ffEgET9m5FdKyF4zXN4TjD2Qg 6XNidvTDjNWJJaDrTj0Z/Qpmed8utCmB53pCwKQI5PeCmQETGBMIH8UqvLkjf8WY3aGQLuZqYZyx0 zGaynkAZzCEffANyi+4DwRiJ02Ys3cM67hH4GBSbsz/z1M139z+cgui+ilYWg03tWA5/31+qMyK8o AsM1DKZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4Ma-0000000B6L3-08g4; Wed, 03 Jul 2024 18:05:52 +0000 Received: from mail-qv1-xf30.google.com ([2607:f8b0:4864:20::f30]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4KD-0000000B58y-1oMR for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 18:03:27 +0000 Received: by mail-qv1-xf30.google.com with SMTP id 6a1803df08f44-6b590e36a8dso25649486d6.1 for ; Wed, 03 Jul 2024 11:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029804; x=1720634604; 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=F1AnJJ+OdCX9b4yYoql8kQ+f1dgIsxleTBRmaDO9oKE=; b=gvMZrVTekwyGePrQzPYlh5VpD7YpD6w4mMjiiTuHykHgex9NzfqgVrfE1pmPnjcJnu DtK/SFM3352OwK4wOQdSy7Nu3/M76HFjw8lL0tf9jqTx6+JD7A6g5uSijN+1Pw0rYhsd i1egMUEFUlFb7eEK75yOX7R7Dav7t4R1vUOqU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029804; x=1720634604; 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=F1AnJJ+OdCX9b4yYoql8kQ+f1dgIsxleTBRmaDO9oKE=; b=FBJ+c7LzU/EbX81M1kUOxhqcFLkoY/3Ho3wH07n0Spl3XIWufLkCirDK3mVEC+SpJ2 5nWdrbnYUAM6/IEXTg1YJbHSABT5Ubam4mJZnY+j0LBVQA1v3ng9/tCfjRWL2VJ8/tnq QrEHSZ0an5Vwh5OepxV9HqrgIGN8rkfES+W/xqm4vJuaj+C/jKqFchjt41KhrwuJDb1e z/GZKpdKI9MnKDaVEZObO8ywiE/+7gbbuEVKm5q+GuNNLHke1LzM3VhbfBLvu7ibxMip Mrou42s9y600ivhxhYzNSDvV7WTSthspZ3Cm/vWZ2jNRUuXqnUwzHqtfODM/uwkPKYqi Bxig== X-Forwarded-Encrypted: i=1; AJvYcCVsP4xYDyXLFGUpjx/aNP6RzN75GEwqw0hQUwpqIV6ZbVJSwRH1yjQUk/m3Nwo7XKdIGT9GuCksPFGrEDEWr8sU5JcNV2+xzQwGkTGxkHw7M+N1p04= X-Gm-Message-State: AOJu0YzzrZAug5VQwclyVBKGrZ2USeBJxBhAIpZJe96PyHFpsXiq3pc3 QKVVgRBQ3A0adPeBnU7tdk8ZTT52vE9BXFHgu6MzFxiHaBdfTP+9n7K7kHd3jQ== X-Google-Smtp-Source: AGHT+IGcbdJR+kzkdQp9fuEs8Cq6Zz4UO5FZzDqjOmP16+1i6U0Wl0eZOq4U9Ekv/GBRdayvDQKkOg== X-Received: by 2002:a05:6214:ac7:b0:6b5:dcda:bae5 with SMTP id 6a1803df08f44-6b5dcdac1b6mr59876456d6.25.1720029804433; Wed, 03 Jul 2024 11:03:24 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:23 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v2 11/12] PCI: brcmstb: Enable 7712 SOCs Date: Wed, 3 Jul 2024 14:02:55 -0400 Message-Id: <20240703180300.42959-12-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_110325_499972_578BFD36 X-CRM114-Status: GOOD ( 12.80 ) 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 --- drivers/pci/controller/pcie-brcmstb.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 1c3ce0c182d1..39d7dea282ff 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1216,7 +1216,9 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie) * atypical and should happen only with older devices. */ clkreq_cntl |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK; - brcm_extend_rbus_timeout(pcie); + /* 7712 does not have this (RGR1) timer */ + if (pcie->type != BCM7712) + brcm_extend_rbus_timeout(pcie); } else { /* @@ -1628,6 +1630,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, .type = GENERIC, @@ -1686,6 +1695,13 @@ static const struct pcie_cfg_data bcm7216_cfg = { .has_phy = true, }; +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, + .type = BCM7712, +}; + static const struct of_device_id brcm_pcie_match[] = { { .compatible = "brcm,bcm2711-pcie", .data = &bcm2711_cfg }, { .compatible = "brcm,bcm4908-pcie", .data = &bcm4908_cfg }, @@ -1695,6 +1711,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 }, {}, }; From patchwork Wed Jul 3 18:02:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722669 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 AE5A5C30653 for ; Wed, 3 Jul 2024 18:06:19 +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=FFpNN7zGhEYYiMjjV534L74VBHm2XtxM6NyrsQwhuio=; b=bLdXr2fvZFwv+JN1txzAvfOl2/ v6mVCaPXa0LFaz9NSvSuUQrjvgxF/DHEp1096VoKYN6FQiQntjZQnJlBhfT1KHJfOqMT2LcZl30rY s4rHQBGgO6sXPeG7Lk7VhNvJ/Loq5wGx9kKm9lUT1Zc2Suhgi5YGYMZrULaTw0WQYFlDhfhLa577J FqYqUzCX8kolE7VfQSA5nIeyTBwcUWYJCwqyKEq06RaA1lF9saNQNnqgBW6uUpuCLx0WNH9NW8WXb yAiS+hu+kQkjQx2ZJ1nobe3PomfILFTRO1qsJKjF1QDjYv9+B9mRnp91M7FsfXLsZAQpWhZkKfamN RvLxAvTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4Mo-0000000B6U2-1mp5; Wed, 03 Jul 2024 18:06:06 +0000 Received: from mail-qv1-xf29.google.com ([2607:f8b0:4864:20::f29]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4KF-0000000B5AN-0kky for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 18:03:28 +0000 Received: by mail-qv1-xf29.google.com with SMTP id 6a1803df08f44-6a3652a732fso26179466d6.3 for ; Wed, 03 Jul 2024 11:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029806; x=1720634606; 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=FFpNN7zGhEYYiMjjV534L74VBHm2XtxM6NyrsQwhuio=; b=ZQKxCs+Tjd5qlOfDj4ay2PEZ8A5B7RjlORxm7yY9BgmDhstq2JASvU3bHJff5Vg/nN I6Iksuh6g5gi2MH0A3291f3mpdMP01LbbHZl+dza3bmyXbiE9bchEYNtIdgQhCg93dJv Audt8RpmOMDdJDutZwB3Is+u1VM5hIljwOAZU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029806; x=1720634606; 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=FFpNN7zGhEYYiMjjV534L74VBHm2XtxM6NyrsQwhuio=; b=nhswcohLG7Djis0SlU9mkIAp0zr2RrIpgdqjFmFaZPOJ8Rv+cffp7C5CBcqwmCpoCU h+fVyaBlLjX5hboqKHQyZay6l+kAaf2PO+wdApbG3fTHKXb2gMg6hRXIDnPkyrs/vKJl b3yy7N7jGxKfUkj/ktqgtSaXjoPIg7dUoDj6ICMfWr+bUozKWGNXayoiRnF2D5sHrXx2 1XdWL3lhRth1oiRpJFNzJnp3lba8+FC+7dshTPkLz0A+/zJvclXicjSSYycEc059Az1T cjCrNqWwe4ElJ7/HPKsAx4lSNXlYJaMnJct+GA2DAwlZApLAZRPDb+BVNLJSo3fT3GLq A0bw== X-Forwarded-Encrypted: i=1; AJvYcCW/oE+pKjKHdRxfvSA+B2oCHGOhrkDUZPuIVCvp6Loae4/B+B5PYL6vLtntIwNYzZm4F8VEwUeu8AvXDuqbHH9Lkz5gvAPpBKWdkHQ95Ik9AjoXgJo= X-Gm-Message-State: AOJu0Ywp44AbMishTOpGedGV+MEf70Nhiv03lgMDUuYfsf9oQCxQJ3UE +JJ8crvK5x5uL2UwoNpTrX6OyRYpfzCCvZpB7w1N1KCtbNXymNVPf62C8H3ADA== X-Google-Smtp-Source: AGHT+IHOqGCTjRLkEcd+6HhFKBD+yy0FViPSyxm6PVq6h/Kw1ScniT7xyeh2B7nDdfIeB9m31sepmg== X-Received: by 2002:a05:6214:ac5:b0:6b0:737f:534a with SMTP id 6a1803df08f44-6b5b70c2eb2mr210792386d6.27.1720029806290; Wed, 03 Jul 2024 11:03:26 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:25 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v2 12/12] PCI: brcmstb: Change field name from 'type' to 'model' Date: Wed, 3 Jul 2024 14:02:56 -0400 Message-Id: <20240703180300.42959-13-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_110327_296732_5FD4C3C1 X-CRM114-Status: GOOD ( 21.05 ) 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 --- drivers/pci/controller/pcie-brcmstb.c | 48 +++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 39d7dea282ff..3ab35d3dbe36 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; void (*perst_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); @@ -269,7 +269,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; @@ -287,7 +287,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; } /* @@ -842,7 +842,7 @@ static int brcm_pcie_get_rc_bar_sizes_and_offsets(struct brcm_pcie *pcie, * to system memory but to a regiion all of the SOC registers. No * one uses this anymore. */ - if (pcie->type != BCM7712) + if (pcie->model != BCM7712) set_bar(b++, &n, 0, 0, 0); resource_list_for_each_entry(entry, &bridge->dma_ranges) { @@ -859,7 +859,7 @@ static int brcm_pcie_get_rc_bar_sizes_and_offsets(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) @@ -876,7 +876,7 @@ static int brcm_pcie_get_rc_bar_sizes_and_offsets(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, @@ -985,7 +985,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) pcie->bridge_sw_init_set(pcie, 1); /* Ensure that PERST# is asserted; some bootloaders may deassert it. */ - if (pcie->type == BCM2711) + if (pcie->model == BCM2711) pcie->perst_set(pcie, 1); usleep_range(100, 200); @@ -1009,9 +1009,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 */ @@ -1054,7 +1054,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) * 7712: * All of their BARs need to be set. */ - if (pcie->type == BCM7712) { + if (pcie->model == BCM7712) { /* BUS remap register settings */ reg_offset = brcm_calc_ubus_reg_offset(i); tmp = lower_32_bits(cpu_addr) & ~0xfff; @@ -1217,7 +1217,7 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie) */ clkreq_cntl |= PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK; /* 7712 does not have this (RGR1) timer */ - if (pcie->type != BCM7712) + if (pcie->model != BCM7712) brcm_extend_rbus_timeout(pcie); } else { @@ -1639,28 +1639,28 @@ static const int pcie_offset_bcm7712[] = { 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, }; 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, }; 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, }; 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, }; @@ -1675,21 +1675,21 @@ 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, }; 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, }; 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, @@ -1699,7 +1699,7 @@ 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, - .type = BCM7712, + .model = BCM7712, }; static const struct of_device_id brcm_pcie_match[] = { @@ -1753,11 +1753,11 @@ 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; - pcie->num_inbound = (pcie->type == BCM7712) ? 10 : 3; + pcie->num_inbound = (pcie->model == BCM7712) ? 10 : 3; pcie->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pcie->base)) @@ -1828,7 +1828,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; @@ -1843,7 +1843,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);