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: 13722644 X-Patchwork-Delegate: kw@linux.com Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99AD2187332 for ; Wed, 3 Jul 2024 18:03:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029789; cv=none; b=PtPITAtaiGm2a3Y5HiOwpLmPsEtKj1KpdpHZNYCXzZDg4Z3QLkfyegb/jR0Dnr8llLLH0xn9roRcGkPWeS77OSiPKgh6npMYwgpHent9VSiz8Xscxm9N6iE7zvkmYxb0y/jEp9jaEjJV9bByjQVa9o78OjkpG9OFpzQ6nGb/axQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029789; c=relaxed/simple; bh=SxTWWnKZ3Jquv0yQqy5Cjmw2w6voQWMsqKoCLAYK7vY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=QgDHmuaLkY3iZNNvme0tCUvpuaB513zxpIe8e6Trm9rV82OKm5Vs23INM6YvvGBD3lJa6uklEvxf2nbWtxvjTCwEIK6tGCZ1KkMx8akkNcfWR1Eb2nUdxXByTb1z0K/AWKpzI5Ep+xMZUMy7jFB1JD6GUDsYffvejgE3P4o/8ik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=gRtiwjED; arc=none smtp.client-ip=209.85.219.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="gRtiwjED" Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-6b06e63d288so25899366d6.0 for ; Wed, 03 Jul 2024 11:03:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029786; x=1720634586; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=Y5/pT8UjT4qEj77dLwdu69QLEGTUCYR3T3aPoKm7b+o=; b=gRtiwjEDGSBgAqUmO8SS4lgHrjbAuorgnYGRBaoQJnTWJZTTn8WwvkRzUt/03ptbSC el+qnZiyiKZBjsXQuvSXQY5iwIrBWCtDibvzRK0vbs6QLpVbGyCOv3iNPfYwzaEp/Ifa pkiLez1BHNY1goQWrUZoFbkTVpSmxUac4+NnU= 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=Y5/pT8UjT4qEj77dLwdu69QLEGTUCYR3T3aPoKm7b+o=; b=B7+dMyF8qSEPnP3w8oQ4GW6OG6+nZs6wKvh/AlzhT2tJ4TJeZ5YMwLPlFh/GxHdOzU AeIqp1NBbkviwrTBXx08MwdoqeFwBGs8YYNQJXuhBt84Dk++1WjWd8bV9Gpv0xqBuW+W eKcHsLdzdbZ6xZ/IccBnyTlRj7CZFUudSDyjzUWZNcJS+H4NaKmvlKdyvSm3IRAMWyRn A6uQQivCWxbKZec+eBBln+DAwKW9hG99G9CW6lkjKfYoNKh9bWPk+qcaFOBSTX5BO/FZ M7qsQGaI8N6JliAYNRrlUgzwfSe+PEBit8xLt/bgee0eiP5IpqUBrldNbbmylxDQZw7X ug6w== X-Gm-Message-State: AOJu0Yxn642OiH9yJHX6RZanwlHZp89R+GRn8YqBFGDW7zRMnaJl8jlH Hkzrh/tS/tqIRXaAsGeudx6t9NBcq1Qw4Zy+74AZJxP7kIEYAw11Mx5GFiEzNOkIgKMJGTD+c1B z4d6hCzcu0Kp3fuR5e3O37x9/ugOXPXMVHooGJ/ElT10GEPIinJsX7U9IUmJaTps0ieFovAjNRC 8WqAF4/JmRbEWs+WBmPp45XzLCAC2FKsIrPwEHEqecWpcjxkfc 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> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: - 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: 13722645 X-Patchwork-Delegate: kw@linux.com Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7CDA188CD5 for ; Wed, 3 Jul 2024 18:03:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029792; cv=none; b=snGZwe/KrIzgktUB7spejsWhnu7hKmRED/HqxbtXYn1BdJvHzCKCCHiCmESdYKJH06p3d06emKrsHCzX+MtAEbSbK6rODoIqg403goKtw2bF7FxpzLI+OiPULneadHVS7aZ22s/WPh9neCkpcfu4J86RbSY+79jsTkVv6sop4Ws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029792; c=relaxed/simple; bh=91VsNn8yGFqW7AJ+iVGDqY5OlAsafWKE4psQizyGPAQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=srXTpHMGSomMUdWB0us8+YqwO36hZ/FSox1Edt9VEEvnlerRyfGX7KIT/JexFRuOFpd9wBDhbCDJX7miuxQGKDJtJBa3yEMgdGrR+QqkkGZNJBI7exfBellSlAgyhRHEVBeDogA+Z4O2Mr3smbMqeB8xaSz4U9SH8ubqQ3oicw8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=K2r7osZu; arc=none smtp.client-ip=209.85.222.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="K2r7osZu" Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-79c0bbff48aso435262585a.1 for ; Wed, 03 Jul 2024 11:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029787; x=1720634587; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=34ctz7tk8U3Z5yRNWcs893lUpA9UxWthq1Ny6SEdBgw=; b=K2r7osZutoKUTks6/WxTznsTmtK2oednKuh3RjZRMR07kFKtgYm1nS6/CWID1SpKwX 4e3p9FbptQLqz15Xpm1Gbvf76rnBmnjgtojkjsSuVvHGwFn4lKfWds66DNv50gWjjIPF 8pgJhgk96uyT+J41BVqFL1pwkkTYkdcfBf6to= 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=34ctz7tk8U3Z5yRNWcs893lUpA9UxWthq1Ny6SEdBgw=; b=LZxqyJXz5Xi2NjFFNfHlQKP43D0ItmArIIilNB7aPYAqGMRe49VsAPRvuuyga3vQtM 3yi5H/yA6s2dklyvEiQOQBx7yDE7k2NwzqjWCRiMLaGO9y7QPF2DO657Vzr7hU+wqnR1 4MwNDgBGSxCJ/HI+Ii90pz4p+1h79yNSCV3UdTjvgsX7+c041YEvzqTfZjWn1btLjGHs gqFP793uPPced2hJN/7rRRcDB5Us88caDHlPwwDsFbni3vUDmdOFofpTlFBX9CX8qwj2 wVoamnxmDS+c8DAIg6LCTW+OkAZK4RZcFqBog9Zx9qeD8asncFLYGXkV/DMPOZnsfgDa BnXA== X-Gm-Message-State: AOJu0YyActK1GOdF3lkwcn0gdXJHWS/iqblZUdRh0D9j3NthztOdJVpQ 2fMRp9uJ434l04nZ4mQONp5b5dy5r7437VOw2c+xEQV8a7VRgB1lzl1bseLtJoB1A5lsA0NZmxJ i7WzWVQobeNb9sVDJUSiHgKBro+ZbsavE63TT82nfJeJrd5WvHkBoZvj0wJRIzmAa3LStdpjKPq 2eW8To3xXfHIW8mEM6nCMcP/VqkOu6NAdspxYghz0lh24A0xGg 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> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 13722646 X-Patchwork-Delegate: kw@linux.com Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 506BB1891C6 for ; Wed, 3 Jul 2024 18:03:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029792; cv=none; b=sNcLo88396MKJNcDOu9ZMEth1kYBytQyHdS5/tCTd+IN2tSpsNWleymAu+FMi7/VkybpSy97D46PZQl47j2OZZqU5XRY+khgGytkMBuF/pLzJn4U+unHetAwmeEKgoAX/Kw/LpTV4Bq9u5q5iQHo6oYkL5wUk5OSfI66KWvAF4E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029792; c=relaxed/simple; bh=5buvZ/IIv1R+ME4azaN2Zd6D0bSorVFDmmygxiLLOhU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=mhX6zbAIdz3U3p7+VoDj1qYTTO1Ajyb0XKx99SbPbXgPF81lDJpQAiasveqgZ8G5e5fzYwbroavCqD3JrO/fW463Ml7woIpHAux602V3VDDvFkoGEScDyPod1xlNxGpSgA9eWulyeDN0p2Y6/7xGWdRYsDruvyh4G8XJHpsr1oM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=aYgYPt4U; arc=none smtp.client-ip=209.85.219.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="aYgYPt4U" Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-6b590e36a8dso25647936d6.1 for ; Wed, 03 Jul 2024 11:03:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029790; x=1720634590; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=R77LF2aYlhd/01h15H3mhK8pf6wp2iLP0dwJLnHochE=; b=aYgYPt4UZpv+YLFj+pD2jFt5CKtY38D1Z49lNkV5O7r17u2crF8527iAflPyEaDyME GmK9Y0AySFbYUQd5yQHa+s0DZGa7cQT1ankplPLA4u+jDXBb7kGL0cZCm8G/wDIjNbKh gz15FxNERmLP9OotleQ30N88C/SOJ1fZCuzSc= 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=R77LF2aYlhd/01h15H3mhK8pf6wp2iLP0dwJLnHochE=; b=DTKo0TU7eYJqX+n2nNV5+xwXt3o5HNulcFcqwAx0FrcNubN8EVgh3K00sp2h1V27GF EmyWPNACKcHDoVxvRrCDnhQGd308rNYEkYUZHz2kOteHJsLaf7MnAWo1mh31uOE3003y NPeJwM3NZKMi9HqXgWfjE1ItspJ9ayJbEO0vGez+okoIoEpS2FQ+4A8VbScWigSksQ2R vI2SxHVXeB5DlmN5gb654sGgr+LrI+/GEnVTc/6RnIqoAoSN1L4NTjgZNGIFrVE6HC1E usOwFE5yqyN8fBdPDqW3k6YLKvVT15CYJXTJsKvn2KdVjziNYYSw22nwimtUpYNL7KRa zEuQ== X-Gm-Message-State: AOJu0YwC/oxwJenzBqbj0rstitEB69y4hALgXhEPKzXPx+iqw9MzCuhX W/gVZsfiO7U9Jb0GxcXHYnKaaekQmZtViMn8tO07t2h9H0fsryETIUjYDGINKyKds2VAF27FmNv atG08yblDiUzoth+4B4xv+nReXGuPY4iDIVOATc54kmnyCsCIMc2ZgWooD19lKNJnN+LVysUHB+ Vr1IvMTg0GcqSo68YAZqmwH/0yZPW4YJOfQJ8eNNQBk3lDGyhJ 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> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 13722647 X-Patchwork-Delegate: kw@linux.com Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4092C18E74F for ; Wed, 3 Jul 2024 18:03:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029795; cv=none; b=VerN6KfQnEhdrtrLpFDPzeWB97asiD+rWhVJNUI0ktuYZOYo+TSxsQOSWwcEltTSbtFZ5csVaEZnsIQpjVOlBG8c8q1k1F1VmkEyQ9xyBvKQk3By1NyOa166ieA+dx2BTZfDwi9TVfJwewNFByHiMXWIcZ283anvjbjp4jlZx04= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029795; c=relaxed/simple; bh=EOBPDqQqQDFulKiEDsOnfn0KPzEZSlf9FosuyHy70c4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=q/Gex97A6rMIhYxCRYvJJKYLGB/Vsbt3pGvKku5dlbMzeO69TspJfv6Ad//AxKJcSU98gNe3JJJoy5B9m4ISsJOKQm8ALe2Vj+wMNjSFfeCxzQMFY3kVMJiLflFE7Exu+aJSvZokn+/7uFqxyccIRlMfU50FNc3GdKfRK2+76Ec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=O7E+qaDT; arc=none smtp.client-ip=209.85.219.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="O7E+qaDT" Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-6b4fec3a1a7so29245676d6.2 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=1720029791; x=1720634591; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=1VgxPgTdcfjix69wlc3tPzvP/XhSowoH2KTpY8LIcCI=; b=O7E+qaDTb5gavIVMSPF0lsUUZAByRiC6Wd8b5mX/mUt+rtDIdglG0JV2fMJaXVYkok VS2FDBh8tgwmy1EanuaLbmqVheqCPtqWxP2o0DwHoMgfzIYh5wYnj6ZcS2jaJyrodbO8 ULza5SX7ajAaVouhlgzxvmEYsr41/nhACvRvE= 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=1VgxPgTdcfjix69wlc3tPzvP/XhSowoH2KTpY8LIcCI=; b=WmE4rtwhPE6EnTQvJ2ItyA8W937f/U0XpE6e7iaUdq/B+8NZ0Q3RrZw69Bpb9cTR1b y2pdmBrnkqOnwFh2pU3k061wznOQMcn1i7qzkPAghxfGjdLr7z1axffpA72jyw3IuzzW lgQ94ny3DOzc7Z9U+OQ2BJ27E5aRH1ActWV0KxReMiUgbiENsVkjS3KLdSicHOfqGH8d C96IzafkM03NJh4u2O1D3WU3kMwTONCXDejh6daJSc7hx0sXFxZdyIIGjvINXiaziVMs TKoq09uaTrYoZ7y6xeKO4lSJ4Tqc0t4vP95pLk4MEiCFS7lxbQdzP4d4/lhhT9zpMfKm xYfQ== X-Gm-Message-State: AOJu0Ywu0J7QEN+NbRt8KqpuXKHYWqhZYZfrU0phhiSU4e2myiLpsvwc elTMZJlVwjuMAfrzObwQguBLKPJ/VqRNBRgKjv5Bb4ObeyUbbLAG8UPsq0g7p3h9Hmtk21909iP YTULPbd6uZ5+Z00r6upYOdM9pCe9wlY4rj5G/kX2eFDdDka/JMt4WvltjT4Oo6A9IbHvhCBs37S WxKBgv974LMQBcbku1mP0ZT4IINGtfiLfnHKsx1i3Qnla0vvmr 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> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 13722648 X-Patchwork-Delegate: kw@linux.com Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38CAF18754C for ; Wed, 3 Jul 2024 18:03:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029796; cv=none; b=slZNrt556GVKr6cn7yLC/FTux4M0CRylqzZFEeiO2FRiyOxNceEgv2oMRNWyKmCM7vU77eFyWAJIIM1xRtGtowFoafTeekW2S9NOxQPvuREUXFljJat4aF4s+IBoKk2AuYCAStgToFTuSYZ9M6he2loWTY5gYYfIRqBq89U+mak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029796; c=relaxed/simple; bh=40N0DREb5pP3gbc8QqHOhOuu2Dm16NudKUpztYOddqk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=hRsJYSDNMFtNesqeubmYpUIvnWhVS0DidbOmTReBBFbV/uD+itv4IDuDz762wvMzBS4Z5Df1qeCnHGQR7Dqqr6+nW7tO1G2D6QyDhNs5WcOyWN8XdafFfPt7nsp4HynEhXq6N8ibtNKjJEwPaLvQRw9dMQF5tFtxhQhcSNAnT+k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=J5IEABNY; arc=none smtp.client-ip=209.85.160.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="J5IEABNY" Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-445033fbc24so46273411cf.3 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=1720029793; x=1720634593; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=1MQZoniAISMMt5/DKGF/VWhkNRaVu+ugSxBxBjNXKSs=; b=J5IEABNYjk+PtBcnFLbL+uQPmYnC1HeTsBmmqwJedgev7Ep6+9HJ9znYMtguBL7r6r sbRbvwCMnzY0AdjV+sWr4nR26055gW5ONZdDSN/D/C1ckPVchNl9l08liv6ZL+Wker0t dPeeh0Ak6R+5eloCNW4Qsf/5FDC9kpsPnYX9g= 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=1MQZoniAISMMt5/DKGF/VWhkNRaVu+ugSxBxBjNXKSs=; b=nBDn25QzsdM+0kp26cf/lVcjlU4PLwor8Um/OUvDBPay+3LA3RCu9RitlXSq4RQW0T +ejtsIOplhiVOq3qym394SnmrBqkTIaWTeNWdZp7vaiP8+tydJQsvTQFlNZU0rOF6F8e NQDUJbjeM1YeuD012MTkzpwquhuDNDObbPn+GgeXXEjhr4iiD0RzM5CsgolkPPtzGT2V zxiAE+CK/4Bn2JX35qMqQPjLeGEvQnuh3m4STCJpQxQDpeasbNjDbEkOeEwetGRT06Fl sRzXPCQFjJQ2+jc40UEw3Zgs6oo4eDN5gKAAROxwdExKOvPxZPozF3cGRHup7HNVfoIR 2HFA== X-Gm-Message-State: AOJu0YzvRUUmD+zt+o4dNSRPGe1/xPwHYiOmnVRI7Jh2InO2k+U1PKtN /Pvf5QeTva0W1YV/cjfJmL+YTZkYzBZrpBCMQFJPxqhd1N7ZJDH3951mNuOo1FUsu0X1EC/R9IR NDZqNBmdaUVIc/KdKlozYV0vBSZYQ7fCTOuvvOM3X5Kx5GDtpS5e6Q0oQ/hXHVL8bW/QK+0Q/nP m9FmwYVyvtW+O/y2Lovx/LE1v1aetszFfgIombr1kFmtgXnMuQ 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> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 13722649 X-Patchwork-Delegate: kw@linux.com Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0CF518FDD6 for ; Wed, 3 Jul 2024 18:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029798; cv=none; b=MSckSu6XEjAt6EhhGFQrg6G1Saq0CwxwxXjOnxzSY5qsfyBu2m+czPN1Fnm9i8mHNg+Dse66++GV8a7xuYi/+MUaOgUSgz37kvPnNwVzXgskuEu4t5jFmJx9YiMBRDaNPp6PFGrJbYLRVjm/ZuX2UpzIhJP24WnmFQ/rqrv7s48= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029798; c=relaxed/simple; bh=1+PpZTaeR4dbbr1FBnvE02CzlVaKmKEcTjjLhQirRpU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=n+Gyq4FBju5r3HfOV+0Qc4nkf+7Tigs23jUUEvaKMQCAkY+d5mnM4JP502QH/5UXKp/WRO6yEDnQ+UTRX1YB/aIXm5870HFbXRZt3KNWnLLu5MGhgkgLNz0EEng+g6P7cIirhN0siAJE6jDwnosjDDQ4vkZlA4irHgz6qjri6Ro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=YqNB8HLz; arc=none smtp.client-ip=209.85.222.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="YqNB8HLz" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-79d5d14fa8bso88779285a.0 for ; Wed, 03 Jul 2024 11:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029795; x=1720634595; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=gffgdCUCyuwUz/h29M7PxxIyHGeTp7dhf27zdIO5hHo=; b=YqNB8HLzu6L+lYbyRozc2f9tMklZ8yuaGtKjA4gPX6VpOBmVy8CnEJUvXFsGx/1F89 z/UFCPQD86nVCBhK3dV5ZKr07KaqjHIl6tGsjTMFtiE6zHZu9510T5UJlqrCYouPSb5H fESL/nQaZy1vtYriAcK2+qC56rvRixPCu2j7g= 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=gffgdCUCyuwUz/h29M7PxxIyHGeTp7dhf27zdIO5hHo=; b=VXXz1Huhp4nzUFTnMSAp9g7pBl8usww1yUbCMgvIS1BtU/xIDM0ls/g0SyC0VSItqe 2OpsN3rGOlvpj1zDjiX4jZ5axTUcD9FimwjCNkA7EUyndVOO835dBI8vid0eekZgArmx 9EBBcg8cJEsvboQ7fajXb57p0kSP5Gtbx7EwYCowN2R59gTdYZHE6KI/rwILebXEbzcN Irq1ikGO06U7qXznhDaLmkW8+GuUCGjbNA2GCpASrW0owN2uC5eizrlXFqbgZ8l7n/7W 7RlN5D5nYJBHthr/epONtlwiWVVMwx/xITj5k/psdieCllWXHZL+HEEUuDhhrhkGTXRW Q6fA== X-Gm-Message-State: AOJu0YyLB+TjvwueE3vv0pxKBoJwNxNA0+5zPX2bOhuWSDYkkrMh0JiA sZXErzJQmd0i49tnc7t8v4g9glaWrWa2VdC4LMxh3zFlllLq89ofPISRL68njOo2F6w0F0OZqvA VNnZSVMk/hADTPRhLUL2NkYKtsaTYpJrtae7hhL/xpAG56wKy6RA+sE6JGCq5h5Jwf3oy8JdOVf kRdBjzMRNhBiOQXUYqSNiYvSgh8hAEYNzDcd7ajAWEwJwzFa4m 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> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 13722650 X-Patchwork-Delegate: kw@linux.com Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C542191F67 for ; Wed, 3 Jul 2024 18:03:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029799; cv=none; b=YNikbtBp57ji55RjLJI4CDN/UVLoR/0gRxQKjrLWtXiK5cGzc7hDzV1xIz4MBK+UZD+gflpXL3jEFwdg4wZe1ee+C15FLzG7VxenLaj83c1/FPwo2edbpyhSsJ72tp54x+iZafN0NBChy3TBbdIAiWfUu8tWeo9Gn7ZCVLafc9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029799; c=relaxed/simple; bh=Ff0a27+puh7HnxUIevRiLPE/aMeTna0JHN4wnRLqQL8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=pvfkcW8A94TrSffR7qhjLcBW8Ab0+fpZy491/+G7YVfBlKt4NXiD+zP2xMEGTYe+28GLQfmnx1pNDavn1paEpmC5QvvdFkDpNPsem6G1XMeTFGIEPVbRGEvRrJ1X00TVL+zgzlMBaovJmvGONrQw3RBQQK2ALseAcpslmagNxQA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=ahGITyy4; arc=none smtp.client-ip=209.85.219.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="ahGITyy4" Received: by mail-qv1-f50.google.com with SMTP id 6a1803df08f44-6b4fe2c79fdso31636956d6.0 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=1720029797; x=1720634597; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=DSVS2Zx2P+KDoipmVxBn4FPve5YaFUjVhWEcKXx1LDw=; b=ahGITyy49h3A+UU7bR24uTU3DnX6X9aVpDuyVX0cP6yJz7qqfzymlr3AbPy3d0yU3O BBHuJcYeWtlxd+TQsadxxMhI4+tTmzwpgvovCARbyUguX45UhhEZuei5lnVYXIB0AfKj hjbZQH8ZaDfuooUtb31MU5XRIEVQMowAS25HM= 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=DSVS2Zx2P+KDoipmVxBn4FPve5YaFUjVhWEcKXx1LDw=; b=K4ttmetiV3fxf0IuBeWOpWlf5Z493j+yaA3NqQ4xTshM5ax5be1a+tQHpc8k7JYBSV Gy/FzxbHphjsN5899Jz4MiXGVE3xvaPoc8NCn0MOVeYVpHDkaY0+YK6+mnU35oY7FtB0 V2YwIUZE7JIQsyQ0sDhx8GtatbHBIhU/IGgMuN1N1fE2qQHLCH6amaxQHyQOhURC24aU kutqggPfC4i4YdQUouKyv6GGGHFHnI1mTNWxogDOIn2/G7869Kyopt7/pGEE4ICZr9Oo RJUhKZ0LQkOKr+ILjNV8OEk1oKICDGorL/c+vZPEAmsBqqbdzs75/waI4mxFe/syyBGn ctOg== X-Gm-Message-State: AOJu0YyD6G8Uc2P8RBukxHmNR7/gJNY+9S5FlVFlj0sPpOx4a14EJNUr My5M8yB94Q1r3DjsqEIMz6hpeGkvn0bpec/fv+wGzXKEPZnBG3R/9emvYSaf/JgUqjbBJLGcWrc v0/8+rDnibpLs+6MRSqK+8Hc23woSV12ISXaqc5aSWtDobMYg20AlNVJeGc+Be6lnF3BuGJsqsZ APh5+p6mmmoJSPaaLQy8oRJEzhIwhrP9B1fO3JvjIVCa2RPm81 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> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 13722651 X-Patchwork-Delegate: kw@linux.com Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0B9A191F89 for ; Wed, 3 Jul 2024 18:03:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029802; cv=none; b=fTRPRUFoYzBxp8V/QAKC/8naBHtUr+BGLOg/NGOFA8hRPF+/lZ5o4ig6EsXSb2BU9SR01cM6rZuCLyy3DgdOUdg1EDkJR42+d/GAj9UDhROZp9Ay30qLZqzZBOeDElTeXsYe58RYa67mFGiHzuOhPy2u+ltmjRvg6CXhVvO5NhU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029802; c=relaxed/simple; bh=ZEZqK0yadLsLJ+8Qm58i6asWi9lWgaVjhKj22znbpL8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=l5wtwcD/MW3WKIDfA3kpezAKt2SmiVz9lOI/uAi+cq4lGWxQKZqDiwGA5pPF8eOVaOQvqRsoSLnERVwnuFYEAjjN8ItN9HaXQ+sK7SOI3Sz7tb8I4+cLHgy2b9Q/nudOOCYvQODSkuM/+LKk06EhV/MVXtKP/mTFWsCIRI6CRjc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=eG/9k3I3; arc=none smtp.client-ip=209.85.219.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="eG/9k3I3" Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-6b553b1a159so28101146d6.0 for ; Wed, 03 Jul 2024 11:03:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029798; x=1720634598; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=7Ny0X+KajsnegxHH9rAsKibVwAoCUf3WASQfGZNffBQ=; b=eG/9k3I3fsA/cMS0M0oV3lnidEePsWVe2E/JwXAEFeN8/aJTo3ed5omIDdA6OkRUpj 6a48qP+5wRlGZeLLHnaUJMhsUfJp+6NDp2zPvqae0liVWZZmQjI8SIQia8b7dCiLfs7h 0ik75z4f6wwRnzcXdABrVoGiQe/hmhAKV+/e4= 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=7Ny0X+KajsnegxHH9rAsKibVwAoCUf3WASQfGZNffBQ=; b=l8teesrNc2K4PRSu0VALRBkjB5QPf5IS3iyy7Y5/32Mu8vWtie8LwoNoEWSG2t0jvV XCCik47FuQ4ReQkfAUT90Me8pbEFDAbXmXuBakZPz5q8gCES2musBD1rnlkHoiwVbjfw 7Qp0uKNgOcn/oXSrEO6GkBTUXCK+CVvY3Lmbm4rHtrzTlz6Uz7CKHdd3Z5oa5tX4+rTP 9RCRWRtMGu31zyLUxiMsWgplMJ96vyzkpqmbMS86xclvitBLxImOOclMf3oeOJ3cze7V RO7B51F2eMf0kPxZyi/mQuy8BxmmMhRwTO03Kitdz3cSGNKw7ooWUtWbyfv96jnJYe9C 9a8Q== X-Gm-Message-State: AOJu0YxryNogbym0wd7WpvxBaGk6nRyKjss7gAevSAKG7EY0bJOjupVt 2nm/c/gQeWtfRwCr+8UntYyH7PwHLg2HTw1OJjp2JwfHV0kl5OEqSu2pxj5iCr5A3Y5yHZuw6nn 6RFG357/Z4MzGFlB0VazRrDJ7bEnj5eND1k7oGmcuOmsobPrdg620k7MBy4/aic6LafIR06XDzm fzTMkZLGfUhe1TXFuEm0TGzPPbQd71dfDBS/kCcBkBeSUGZqhp 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> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 13722652 X-Patchwork-Delegate: kw@linux.com Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4EEC194133 for ; Wed, 3 Jul 2024 18:03:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029803; cv=none; b=nhk+uHcuZHu2JvRPrWv/A++39NvuMEOIf9G+w6S/6YvCU5s7QBbmBvMoKLQAPkft6UkKjZcQwJV08TJIN1CWcBOMoo7LqoI/t4MMj5wbwjnf6zbeCFwj/33drcqJ8sZnWV8ZGzRmtQvQCdFrf48yNkpQOtdGPRmYu7dszjDypBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029803; c=relaxed/simple; bh=SldwzdQrFfHB2TY3lzZmp82WSTZH4h/jm0OmbzfohHg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=AuBdrOSmH7BeL3j/7ijCvV2WUe4Z5mDx4GCkGqfLT4XGySieM48Ntwlrl6k6zOIV4FxBPiwDKeNRzzwba8YpzxGBFJ38cVyA+0pFexe2R26PNVhfAk0218/ApZhgk7hX6oFRVLUj038ZUcyyE4/5JVf9cUtooTbj8lORxNrVQxk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=WpIMYcAk; arc=none smtp.client-ip=209.85.222.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="WpIMYcAk" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-79c0e7ec66dso459519285a.1 for ; Wed, 03 Jul 2024 11:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029800; x=1720634600; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=ogFgKr6cHDl4DNaRms1SxduqvHxfoRby36qQgV7b7OQ=; b=WpIMYcAkRfm961jAFAYtKAwK3mETUS7Zeauvg2S+9ysVOyS/gdsFSDaeo1fIw2r8/j z7ItHeva1A+5RHOvxE1TcZVz2pPBJf868k8Y/TpAkCo7gvbFgeCfBzlPVFpWL2XMi6Ga TcVsYANHAOpn93LV3tocalbI+62mwKDI4kH/k= 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=ogFgKr6cHDl4DNaRms1SxduqvHxfoRby36qQgV7b7OQ=; b=OGcIjtnDDFbSH5ToGAD3qD/rS8eTCv/or7dD/7aNhOSO3B44RPa359DDPL7OxuCt2z czDwk2Fzq82dO62MhLh6g9YjBSGbgw1gPyDDZl91oGCiLYpOz+FVRKrACDGzzFmD2ghG Tuo9qjFGw83o9kbweMjeGIcuJdZAT7cKfPYW9rkTE2EbbQlRB54uib2+vOpyRHUrb4Pa cZBkbDsxalvenPfTtgBxdPHUgXeSmAYa6O713okU1I2b0jGohxmq33sM2sz7tZKu5Hd0 Xb1Rukdl9psO4KwziAg6jqpMJZVI/x4vqiFblArpb3AJOrAREEqqSXpwdUgoGtVSfLmL 2Kww== X-Gm-Message-State: AOJu0Yw/AQtGTNOtAUlPL/w49jAEX5OPYF0ahTtcUCudS3ik7BlKE9dZ jzIGATcUx2Km4Q91+CIIh4lBZAGypvkLb4gG1Mw/XKK83NdyT5ow6Sx2GiMyJHNPM4jz99NEaa+ L9uJYMaOnw3/LRCNuy0Cbnj03b1YfnWsFctu6IXheI6qYyzZNrBwBT1IJGT7Iht+1xh/BwS6N8y MKYgYMnQaKZEeD0Y3QcD3+hACMnq39BOIGExF+6ZDBegoc/Z4B 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> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 13722653 X-Patchwork-Delegate: kw@linux.com Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B495A187349 for ; Wed, 3 Jul 2024 18:03:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029806; cv=none; b=IBZaa3FmYXUuWovYyt1UGBk6pVOp4WFuSsQIoYgqwaoyZe1xVsYaZofHGHMF3qdA0vvOz97fuY1f+WDjBZaFO+eqSVzqmGTmQIYy2aOg2ERqIvob8jvce0xSLTv0YwIvcn5yBQlliNy/p+mpIRgT6HFStx4V0HNlgznBAT97/1M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029806; c=relaxed/simple; bh=lpboFPYNGKHDeKT3paxfDikOo+RVK8miIjSXEwG1yCQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=hffSW6F1oYwHa6zKymWtLNEAxPm5srAWXwmbfdmDHZ0WGVcoKuX1B4zhvHyAZQ5HZtCVSK8dPv8w2p1dRSDE+C5778zgewfjFmpOoZ6lAobNxEmVCIn29BdV0i4bfw0Aw5NfE35L6Z6Z1tj3dLf7Jd1QaN+uZkR4WE5GttXoqUM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=DV3sv8j9; arc=none smtp.client-ip=209.85.219.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="DV3sv8j9" Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-6b5e4466931so3782026d6.0 for ; Wed, 03 Jul 2024 11:03:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029803; x=1720634603; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=RGurkoWoeECdUD1TfMD8b3mE+TrTCXJB2kN70RXwrl4=; b=DV3sv8j9q3mIbb19U6NoRRYDLS2v+sYSSG5NeHrU0ZpyWjrVFIC1HfQmLYLPDbAnfZ odusIiXOS38xyd3oxaL5RZESOFrphSj2XdFW2rfyZHY8yv0DCXxd7ZGhFmndYTt+24tl sWrXxDjf+MaKTMm1ItTzH+NGXBfmtn0X9HkGg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029803; x=1720634603; 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=RGurkoWoeECdUD1TfMD8b3mE+TrTCXJB2kN70RXwrl4=; b=okGhuXbmDfZ5HmQXU0CPoWkZubvqI3MQJ0LCbMWXfNbe83ABmMDBXqK7LRWBtK2qSK 7s27tgPJDCUwkOws2fcHB3e9O5jnXb4yTHF2wwzdwBQKkCip4VTdTKHt7nrl1EL3nrlQ 7EUTQMehNjm7eL+SG8fmuA7EDtYudARnZRX+KpbHGZz3hecHeB9WzReSZl9h9rWjblc1 pP9kspM+DOmREZIcMftAvIhCa1YaBdoIZhoz1vZAGoOAgfU5pu4CIYg+NzSKFmnxvMvi dieZG76XbVH7D8Jswh7RV+PacFuyaC6ycEO1YEXdXvf/tcAPT7lHyrAqThuoykgaF2OV YlTA== X-Gm-Message-State: AOJu0YwYYyXLqs+BcsJ7WDtuzIlOvsVI500IV57seT8U0P4OD+gqFxjq ZSXSl0hndVrCbUHGKRGtEeZ+boR9CS1mZO8s3hNKSFNgIOCZiT0dPQl8oFKiiO+A+hRNk0kPAfK G8HRtgiQCFBCLzpHmVjKGKdDxJAIaOX220FevtVhvzr+kylgQIkYTwwageIm/5VEmAo9h9n6ZrO DIVeRRbrSwng9xKkTQmaIewkey6LCZ0xv+GlFWXlcATFz1413e 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> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 13722654 X-Patchwork-Delegate: kw@linux.com Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C203B194AC2 for ; Wed, 3 Jul 2024 18:03:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029808; cv=none; b=DkoPY/0mcBdhTi3SdXy0sB5se7nEe9JVDbHQC2A904XPWAV3K9RlzwapCcFmsrbvgjNCgu+nB98Izn7+p5GS6Lcs2PgnyFNcZ8LcUTJnj62KdHZG9hw8f129FF4Wmroc1RZUd/stbEJEXoEEE2dYrTWZukKEcJI57IrR8L3fdnM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029808; c=relaxed/simple; bh=5lKGYPNuxA5W8bGwBXnOGNJfYFJaw3+60u9mClI2JXI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=rBIMQ452xVVO2r5BTqXm+x8hhvXXEOgUVtFZp9BYmGPIFehQH2v9JIiQ6Jc7WuCbLzMiBoXkLp7sqdg92dlqpSqMHsApnLdu1qvRVrzGidt9LwfUq1IZcYMl+Qj55DntI4YZ9F2AZuNoKT89koypxtJG/2etCFG+fRnH5qAumjc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=eeuDDMV3; arc=none smtp.client-ip=209.85.222.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="eeuDDMV3" Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-79c2c05638cso439150385a.3 for ; Wed, 03 Jul 2024 11:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029805; x=1720634605; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=Miff4ecyPjbLQFyuz/vWqleqQqWNhli2DL5hrreK03U=; b=eeuDDMV3lAGITUNDrDy7lbi4J8vxqtwjr+Q1R/xgTUN7SK2bE0e+a/3mPjw26RhZAU /AFE4WYMpAOLO5GJsjFvxwEbRaaX3I7uVOW8Ex8N7mvL2dDBrGslOloTJZVDT+nageOM Ot7KY2XkSwiIfazNfhQjunojZC5Dop1rtsjZ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029805; x=1720634605; 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=Miff4ecyPjbLQFyuz/vWqleqQqWNhli2DL5hrreK03U=; b=LaYYqGGTTVIb+dlOuJeNtQ5XHFvAWHhmQ+D+OvDpElEMbl2G4TYE/oLVqNIBbiDocv 9byNDEfJdwhdRGR8BUVV45V15TAMYG/MVMEXacE4QtUbeDztWeRHwWV4bye4ah2g1Vvu aXENYsDmgTmUhkDoBL8GuJS/0Zva0sXCWaCj6VX4hmE1Wef8MAeGStEUz0f0d42mjJ4K V6oUOftONtcka2Wyb2xQytf9MC6uuPWreD8dec776p2ogrPQfrNusi8kq2Txa1AyReZU jphALMjLqQyw5ZRv/5v2znJQ8tLjfOC+5D2DyJWoDbfam+w5Rb1C23nFHPOE4Wa4V5wx KA1Q== X-Gm-Message-State: AOJu0YwFrjIWQPZ9TYF8yVo1LraHMFcpI7Dw5JEDIWmVVwRr+MXsOj7y VuZqCB0AB2KtEpjU8FvmoD6Zmn5fcHmW7/MdsnpADSFBptJ6SwOAH+17eze9hKF4hA6Zfjgrj3M RNbGb1JpAGjx/S+o5PUZqwJJV6OKPBm5BTmtZToMKgZL2oc0B/kY+SAWJQMZGIl6NYGGmGNcSWB /WEhhVtkeP/BpnkTXjGtaad+mgFvqz0CBtwSaeLaIE/Utnt3FH 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> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: 13722655 X-Patchwork-Delegate: kw@linux.com Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CD8F194AE4 for ; Wed, 3 Jul 2024 18:03:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029810; cv=none; b=flDgoGTR4dkyOXGWILaakXk6LTBkKrTmYlA0KWtSb/vksAY4Ak1jJeYNwcPzAUqJ9yA0ikSxbSRENo9JY8r3/HVSAIxGl90sAg3rJOptbifgxvS4SUZDoMLvrBKky1HyuAC+x86VeWqj9FGQObOL/J70VZHs4BvWJzNeREhAWDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029810; c=relaxed/simple; bh=GZJY9iiWQpN/yPFWHIR2eYaqvMGQhuxatNcxbMxXIaY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=JmWlMJ1BF2MEaN1QRKsWY7Eye7/Q2KSYjt1HNDlKMeU/zFQ0uRL7Rh8Jmfb/eNq3ZpDNoSN2x38opOoNgppLRMGEWQWMaqJKF4+H9vKtRniJeqw+N2NchvW3yHs2Uhr2c4uQzbmSi8LVIKTG81UjYAS6Yr2138GzrbNs6em0kVo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=cN5EM7pA; arc=none smtp.client-ip=209.85.219.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="cN5EM7pA" Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-6b56000f663so27476446d6.1 for ; Wed, 03 Jul 2024 11:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029806; x=1720634606; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=bvCiK0BlPyfjWugEWZw9N5xcsjjFeFSbLSjcf6AY0ow=; b=cN5EM7pAjeI1/jAeYWj4Hw6EgGoZs7MD4BtMBWwQ1nOsk1Rbw1a40UW2hz6/IFVhLw gj3TFu7uDgwDbg4CCpjG4y0n8QUT8+6oHA0GjdO7nM32+fUDQKvswFLnxiaT50OpbFF/ fItYERXuNgNr2tjByhSkyAZE8r9ENi4++hlrg= 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=bvCiK0BlPyfjWugEWZw9N5xcsjjFeFSbLSjcf6AY0ow=; b=G6LvvbNYZJoogCSFnC82vA7S0Bg8A9b9RbSBTnnDZul8u9Pr+3sAl2NE0vZ502w4LR Yj9GxaAmGWIctYLYvn7HCehnoAJ8LMWEKZi8dGv1tcycHoTPE35XwYKl5QQc0RFMy2fa Lc+UMt5fhC1LGhVvMRI/BKq/U7Pldu8G9KNAEgdqDkcmleY6UldhL3cepSr+1Tpg4viH P919+msnEA6aicGvix05UZrj1L3lOo0UYfWHyL25tRQx3dI+Z/VoPMQfg1qIIwyeJdUD m1M13B3OQ5f1Yln/MJI0gMs/8Uf6AVagB5XBfjWsR/x3HY+Yxse2PcrxXHegWNteWrw/ CB/w== X-Gm-Message-State: AOJu0Yx03jo630i18EXdYAiGB3PBC5kkstSr+Bv2AV2ZYFHUsuVO0aGU yhqyoKFKXFAYXrEfy2tW5Zk2RFHtGww1X/mQ4K+Kq5E6bzjTu7BU1UQYiUJPdvpwjretyvasLMy unEqL8e+xfI8UVAKXGMuFJtxH8J3ST++jbRQ9V4JSo6Yj4g3l1eX3JWQL4508JZ4fx6l9/jysjd b0n+KGKJfyVcFIgejzFyMub4c01f48wkFiKftT950qnHHFV7Ax 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> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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);