From patchwork Tue Jul 16 21:31:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734956 X-Patchwork-Delegate: kw@linux.com Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (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 60A0413C9A2 for ; Tue, 16 Jul 2024 21:31:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165504; cv=none; b=UqMcVwL+E8/PF98U0kymmlUo09BdEqCKfgNzaD2hCXlSk5L9zJ+cJfWQ2DcuCiKlxv2U3VkbyNYxgG9RqjWU3LbcuUG4caUhNkb4BCzf8vbQthSEomd/Y/IUAS3UJQHObL26me4jMvV6rF7Z6q2VmL6AlnM7JZlawtfQqPynNvw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165504; c=relaxed/simple; bh=eCfswRme4YFKrZ7X+FnoOEwVQYvvJ6qv3ncxh4yn9h8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=hFzISQUc5pwkZS+Z9MPxv6kgb0heYW9LRMBVzjpNCpy2S1Vs7b+dVpc7XudgiVrWzc2RmCd5ayNxyjV6yFRopEP3LEWpFlq+M3fTf7dtwy87FRmFVLGKK+YVYB+wqmki3j1nX5btgRdYDCiCjNbsfRPuk6jbtGk/xe7gvrPKOYk= 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=FNdfj2c3; arc=none smtp.client-ip=209.85.210.174 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="FNdfj2c3" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-70af3d9169bso4188796b3a.1 for ; Tue, 16 Jul 2024 14:31:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165502; x=1721770302; 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=B9W7jsq9CVi9VkZ6BBau38YraAqgcBTY1Ln+N9XWruw=; b=FNdfj2c3T12wD8UDnjHyxXcdWHLmGPoAEgajT1HYqOp1p2i4fiuK5DS8x16i50byf2 7BGvRO00iAX5LIfR/vLkfUlnzkuLtCOV5TCx/9KJxErxqufLmJMH3t2GTpFRAV6zGRBh AjXdBqaIHnmZuMAa6FSRo7TYg6b7KnHLuQDJQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165502; x=1721770302; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=B9W7jsq9CVi9VkZ6BBau38YraAqgcBTY1Ln+N9XWruw=; b=G54JBIYYYCoM6CWRSD7yd7Coxtkv+BTs0aMp5GW5WTMic/K6B58Qc6TKaRfBp+AZ34 7tXxYDXoOrTnqJ/RXQVuppS06i2LqMuo7x4c/hCcfXAB4ZuLfP156o3dsquD2oUCAe0N VSlKMaV9jG8uFXDN3uPeUf/DOMWhZg7/cD9OUj8DVkdajYdbpsSmu9jlm9YRnFMqxBsF DSuLq2WYAtDK1Ea8QYAlWukCDPgd+rjjmrkF9ST1BRtN4yjY+LNTto5rNiNVVpQCRTgk uexPr01jOXAb3wdfguO648VaOd6NwY8KV6ZPnkNQqRaeza8s40bcQsyOA4AYX0q1hDzz GSyw== X-Gm-Message-State: AOJu0Yw5g0jcrpSi82rBsLSqhZrw6MnfC9UR8zkXWiy+TlupUqoRjOy2 gNPeaABIlNaxVAhlUo1rksExiYT4XAA56agASeeI1xI8De5ljN7g5AYrQmoUWW76V+K+dx6SGcY POAEKpQi1IGDaUmGKQAztKSnqEjPhqSoEtsDTCp3T8wvuy1NVhCEM8I1/4900wCpi+HY5GfDSdR 9QpSAAY+KFZGOGhv4mnwXwOWGWw4hUiMgSSh4YpD/RTHuj4g== X-Google-Smtp-Source: AGHT+IFAbgMBJWTR284rg5DQPqBL6wm6WpTqDyeiwCkGF68kwS0hpiUPe8UG3v0jBLjc2M1dUDLlHA== X-Received: by 2002:a05:6a00:845:b0:705:cade:1f40 with SMTP id d2e1a72fcca58-70c1fbd91b3mr3657546b3a.11.1721165501997; Tue, 16 Jul 2024 14:31:41 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31:41 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 01/12] dt-bindings: PCI: Cleanup of brcmstb YAML and add 7712 SoC Date: Tue, 16 Jul 2024 17:31:16 -0400 Message-Id: <20240716213131.6036-2-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: o Change order of the compatible strings to be alphabetical o Describe resets/reset-names before using them in rules o Add minItems/maxItems where needed. o Change maintainer: Nicolas has not been active for a while. It also makes sense for a Broadcom employee to be the maintainer as many of the details are privy to Broadcom. Signed-off-by: Jim Quinlan --- .../bindings/pci/brcm,stb-pcie.yaml | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 11f8ea33240c..692f7ed7c98e 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: Brcmstb PCIe Host Controller maintainers: - - Nicolas Saenz Julienne + - Jim Quinlan properties: compatible: @@ -16,11 +16,11 @@ properties: - brcm,bcm2711-pcie # The Raspberry Pi 4 - brcm,bcm4908-pcie - brcm,bcm7211-pcie # Broadcom STB version of RPi4 - - brcm,bcm7278-pcie # Broadcom 7278 Arm - brcm,bcm7216-pcie # Broadcom 7216 Arm - - brcm,bcm7445-pcie # Broadcom 7445 Arm + - brcm,bcm7278-pcie # Broadcom 7278 Arm - brcm,bcm7425-pcie # Broadcom 7425 MIPs - brcm,bcm7435-pcie # Broadcom 7435 MIPs + - brcm,bcm7445-pcie # Broadcom 7445 Arm reg: maxItems: 1 @@ -95,6 +95,18 @@ properties: minItems: 1 maxItems: 3 + resets: + minItems: 1 + items: + - description: reset for external PCIe PERST# signal # perst + - description: reset for phy reset calibration # rescal + + reset-names: + minItems: 1 + items: + - const: perst + - const: rescal + required: - compatible - reg @@ -118,8 +130,8 @@ allOf: then: properties: resets: - items: - - description: reset controller handling the PERST# signal + minItems: 1 + maxItems: 1 reset-names: items: @@ -136,8 +148,8 @@ allOf: then: properties: resets: - items: - - description: phandle pointing to the RESCAL reset controller + minItems: 1 + maxItems: 1 reset-names: items: From patchwork Tue Jul 16 21:31:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734957 X-Patchwork-Delegate: kw@linux.com Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (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 DA72313A896 for ; Tue, 16 Jul 2024 21:31:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165511; cv=none; b=hcpr+GngovdZCg5rJOprHOVLHVFmu5Yr8rBQuo0Nw/sX2+dL9YhW9eJ60FW5DgeLXVWg73afvPGqeU7PsOQUQ8hwE8fZHrRKu0+J4zXp6b1zbUIHh0JYy/lRZx1yUQFRxyiZ9tmlWP3Jd/wBcUwuG57ykla4HTbS0U1t3D6Cgko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165511; c=relaxed/simple; bh=kKnnUZJyXGqhuFr6BHVZYXoYtdRaDyLIxu2kH0xjoWM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=eBzkZaYfqMoZ9WvRoKtRhn9PDO4mfjL/U+GnXWhWH+P7VTjmiomwZP1MRX32GsCAG3uPRwRHwEqbBI9UlYgWCjX4h4Mne7RIbiJrz9NlZ3dcNRRJ7f3mCmtUtYuh7mKb8LLcRj/Vc10cn4OYnQxm/lWDiarcjCTU/2QHBGNoTIY= 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=Q9MoCqjD; arc=none smtp.client-ip=209.85.210.179 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="Q9MoCqjD" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-70b0bc1ef81so4049911b3a.1 for ; Tue, 16 Jul 2024 14:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165506; x=1721770306; 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=3iRTgQvgXi+06Xy+oFn4CK2G3uQzL4vLo5+4lrO0XRE=; b=Q9MoCqjDYRup5xMQpmvyKC297Z0JMFNF/F7Hh1HlsHI5dYa0NuK9az0MdBrv6gM8yl YDJOuTa7azZ/s1IjkIiukf3gXBY/8PLEc+Y8ZxVBy9NoGy2i8kItSv7cJGxhoSn+B9aT WtBr+1SGoFslHrDSA/1S4jqP/KfHa1MivibQw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165506; x=1721770306; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3iRTgQvgXi+06Xy+oFn4CK2G3uQzL4vLo5+4lrO0XRE=; b=mLv18iUc542DCQrWS0P7ReciZcYdT4zG8CjUxtay58bweVvoOSUYCksMMfM7YytYBc woSF2WuqHK4z8fkTMC2HBUdzDCEUOowRFZ/qLKan5gbC3pKKcOPo6KsSCSs+qLNK1dsJ QKumNuG2VmrYkTQ5VZL/Gr8Otz7IsVzvWdJkQjnOs+vMIkAyMblfOMqtH/F/qaBEKwkb W3r8gnPLxpoB+YoSdMyIj09AxmSXZVIik9sjDnvM1uITw0P/cmX5qdyhTwXqs0g6ht+5 aBFb9ZdCieAsjjDzhdDk2Q2U8bqJIuamvnnBKHsEPS8E02+LqkkiXEvESjaQ3fqWBvlc 8KUA== X-Gm-Message-State: AOJu0YwM+E4m3Ov7QhGQ+uEyE5wf5BcCCN42thYAhc349sAJl9P1oqjD qjjy3Zj9WBkaMwXZdxA+Vjy/oNsdOJuaxdKf0vfT3VLT166m5EGabyHA3x/QD1kuRUmhluXJqYk K2XXeTpzP0+ZLuwU05gVEsjJPCdXV2mO6u3ZJ7jAu5hym4iNqi8gBF1u4XsvdV6enRZg4ROusBE a585gyXoFnWyQf5Kwqr/Dya28SPSF8sPmdtisXLa7rnx2pJQ== X-Google-Smtp-Source: AGHT+IFp7RQJJbzSuTE9Pz+MItT0xs2DAkOXcGXQs7Wfd4o+xgod+xaAMTG16F2VHo2wsj6wTqDAgQ== X-Received: by 2002:a05:6a00:b4a:b0:706:7052:205 with SMTP id d2e1a72fcca58-70c1fbae7e4mr3947866b3a.18.1721165505966; Tue, 16 Jul 2024 14:31:45 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31:45 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 02/12] dt-bindings: PCI: brcmstb: Add 7712 SoC description Date: Tue, 16 Jul 2024 17:31:17 -0400 Message-Id: <20240716213131.6036-3-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: This adds the description for the 7712 SoC, a Broadcom STB sibling chip of the RPi 5. Two new reset controllers are described. Signed-off-by: Jim Quinlan --- .../bindings/pci/brcm,stb-pcie.yaml | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 692f7ed7c98e..90683a0df2c5 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -21,6 +21,7 @@ properties: - brcm,bcm7425-pcie # Broadcom 7425 MIPs - brcm,bcm7435-pcie # Broadcom 7435 MIPs - brcm,bcm7445-pcie # Broadcom 7445 Arm + - brcm,bcm7712-pcie # Broadcom STB sibling of Rpi 5 reg: maxItems: 1 @@ -100,12 +101,16 @@ properties: items: - description: reset for external PCIe PERST# signal # perst - description: reset for phy reset calibration # rescal + - description: reset for PCIe/CPU bus bridge # bridge + - description: reset for soft PCIe core reset # swinit reset-names: minItems: 1 items: - const: perst - const: rescal + - const: bridge + - const: swinit required: - compatible @@ -159,6 +164,27 @@ allOf: - resets - reset-names + - if: + properties: + compatible: + contains: + const: brcm,bcm7712-pcie + then: + properties: + resets: + minItems: 3 + maxItems: 3 + + reset-names: + items: + - const: rescal + - const: bridge + - const: swinit + + required: + - resets + - reset-names + unevaluatedProperties: false examples: From patchwork Tue Jul 16 21:31:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734958 X-Patchwork-Delegate: kw@linux.com Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 6403A143899 for ; Tue, 16 Jul 2024 21:31:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165512; cv=none; b=Mrv+ircAGhKpUVumG/XAVFRgJ+4Xdg+tJt7mSMz8CRxsKaQRrMVOIEQtePBEPHzUdYUQ55/qn+QtDekMwtFK25KcMWKYXBSLaRnK+VIbRG2Ib1AiA8RAmrkOUxp21oFhWbPLP3xLWsLxn7fkuckYHrOQaZXnRiSIu1dKUbhnt6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165512; c=relaxed/simple; bh=0dO0s/V4/6bj7Abxgc0ycBeFBC2aiP9ykYKxFMU3Joc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=Glv6SJyaqcEYLnz/F0Y7b583fKjjtRc8q17qFPHCePm5njewJ8FaHNA+cszO2Yevj5epHgfCVKLYmEWL214TFK5DrAWisvFV/WioMA1FyLl8mnBi+9YldAiFuprJ8juqBGgBeOp19S3jtIa4jZZIXPGBgVa38HPVmVCvHOGPSrs= 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=YZg80Y3X; arc=none smtp.client-ip=209.85.210.182 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="YZg80Y3X" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-70af4868d3dso4625006b3a.3 for ; Tue, 16 Jul 2024 14:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165510; x=1721770310; 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=hvtMInEmllyEMhRLrGuGnSRjnvC9TD2FUH6hIu5KfQg=; b=YZg80Y3XMhBB9Q2LrY80rLPOeVeTDtQz0v7ZZlyl1TkQ+znqomXUdbd2Dp5jFD4W5q UAtjC9ecBv8vEhuIDUkBFeXg1hnuzg94M+LRps+5XiLRejhMmV8LRyYa+ryJ3zmPeU6b TrLOndbCPd+eEjd9fqrwXahPD4ANEdbwMua00= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165510; x=1721770310; 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=hvtMInEmllyEMhRLrGuGnSRjnvC9TD2FUH6hIu5KfQg=; b=m8mwqL6Q7D/RMlJ0gnYjthWtAzO26CzaMkcZCxFDfgLIIZ+lzzYU5ZjecPpXXXl1CP d4FzjjBlEsOzsk6g88v1q6ClvxCv6kh7dQvradoBCvVMiwJGu3S0+KNGbkOlMuG5s7z6 kB8oc+1OrGFyNue0CqA8p7zLzJicrDEjlsnzrzMXePJhOPy2+PRNy1J5HOn2bk4Oz8sQ rOWj+L6jQiQDQiR3fqroKJCjU4+LJTQVXr5O4vyTnrmqZgK4pThsA4kntu2ADhyHI6v3 yz4msQ3uZviI6w5XoanSIFO9VMY4oR9vZzLxoKFlJMlWC91Ebm+4L4rQJLngb0iU4J11 h44g== X-Gm-Message-State: AOJu0YxWwe8bgF27VuTQqAmY3w4sKKWemDemODLrVNapJwxpD1kRg9Xc SJvtXhLgTZEDgZ4+iT/vDNCbPNI42ZTi2CeOeV/CHISX19ePGra1x9CLEQP0LUqDVEQo5bTPA9E 1GyUogaus0hBjRuHcR2IpUZ9AzaMfcPIKq7gX8/ofE68P/gSZonpFBPjAGUJSUt+pdo7s7WbvmQ rBsPd8IW6d/aXgsZXe2FWk/n2N0RGj2MFRlCeWFZ3CRyrGlA== X-Google-Smtp-Source: AGHT+IHrThhlnzd8LBxiCzySjP0CZq2MynpmgH95NB6gd2UaS1mI0VKjiYx4eqSInRNbvNUaupsgWg== X-Received: by 2002:a05:6a00:1992:b0:70a:efd7:ada1 with SMTP id d2e1a72fcca58-70c1fbdd47amr3995520b3a.17.1721165509480; Tue, 16 Jul 2024 14:31:49 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31:48 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 03/12] PCI: brcmstb: Use common error handling code in brcm_pcie_probe() Date: Tue, 16 Jul 2024 17:31:18 -0400 Message-Id: <20240716213131.6036-4-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: o Move the clk_prepare_enable() below the resource allocations. o Add a jump target (clk_out) so that a bit of exception handling can be better reused at the end of this function implementation. Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 29 +++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c08683febdd4..c257434edc08 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1613,31 +1613,30 @@ static int brcm_pcie_probe(struct platform_device *pdev) pcie->ssc = of_property_read_bool(np, "brcm,enable-ssc"); - ret = clk_prepare_enable(pcie->clk); - if (ret) { - dev_err(&pdev->dev, "could not enable clock\n"); - return ret; - } pcie->rescal = devm_reset_control_get_optional_shared(&pdev->dev, "rescal"); - if (IS_ERR(pcie->rescal)) { - clk_disable_unprepare(pcie->clk); + if (IS_ERR(pcie->rescal)) return PTR_ERR(pcie->rescal); - } + pcie->perst_reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "perst"); - if (IS_ERR(pcie->perst_reset)) { - clk_disable_unprepare(pcie->clk); + if (IS_ERR(pcie->perst_reset)) return PTR_ERR(pcie->perst_reset); + + ret = clk_prepare_enable(pcie->clk); + if (ret) { + dev_err(&pdev->dev, "could not enable clock\n"); + return ret; } ret = reset_control_reset(pcie->rescal); - if (ret) + if (ret) { dev_err(&pdev->dev, "failed to deassert 'rescal'\n"); + goto clk_out; + } ret = brcm_phy_start(pcie); if (ret) { reset_control_rearm(pcie->rescal); - clk_disable_unprepare(pcie->clk); - return ret; + goto clk_out; } ret = brcm_pcie_setup(pcie); @@ -1676,6 +1675,10 @@ static int brcm_pcie_probe(struct platform_device *pdev) return 0; +clk_out: + clk_disable_unprepare(pcie->clk); + return ret; + fail: __brcm_pcie_remove(pcie); return ret; From patchwork Tue Jul 16 21:31:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734959 X-Patchwork-Delegate: kw@linux.com Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (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 4A29C144300 for ; Tue, 16 Jul 2024 21:31:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165516; cv=none; b=G2QD/30beq/ORFhb+P2J6XzcGNFC1u8V6eb13JLuJ66CyBr55XOfIFSg8E9ypRPE5BeHLVsBEz0honZ9XzJsfAQCvtNYxRpsbV0IFVLmu21HFZ2jJGMI0Vqkv7oQaynHzmyt2OZq2ubcdZWP58cfQHxSb6HXzsVrTkpWFwG1H3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165516; c=relaxed/simple; bh=8+0WI5bdP02CXunsJ9/uM0VSRLg7WIJgVoSD8XrlkZw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=VK7Mu2vMIjFA5tIiuAdH0BGNP4Gcq3QJBDHsDagG6DKiWA1J0lSjhw5e4RUQh13Dr4ufq38J3vn8DB9TvfyB6adz9SkXidxoKghZaw8eKgzGiMyaMnVODL2KC6tJh7L/8JZ34/B34QjND4vPu2/PeKE0Xh7nkRUM9QcO9PvZWac= 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=DqivQQVy; arc=none smtp.client-ip=209.85.210.179 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="DqivQQVy" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-70b5117ae06so4361614b3a.2 for ; Tue, 16 Jul 2024 14:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165513; x=1721770313; 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=aU6d61u3g7i0xFUcV2E6dGZN+pyXVhWDJKsn2Ba9lj8=; b=DqivQQVyKz5cVfb5LKDgr/SjMEXycvDd8mj79Ar88enhJSS5ACeHxwNuxgTZyOosKT m1lLkaCVs2kT+Qvd0SeRpbZ1LzFF/23DCiA7KGaVsp3ctug+gLHDEGQ/iqn0G+xy54MU gBgwd8dPF9P7JpbdPsJH5pUqiSD+48uFKYZwM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165513; x=1721770313; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aU6d61u3g7i0xFUcV2E6dGZN+pyXVhWDJKsn2Ba9lj8=; b=c+if/OAR6IAI4HRlu7sNnlIBWH4U3+qxt7dDxHmR6/ipNPyVzoWZmF5W2I7Ze9eu+s 9uZmYihtyRyyFSfV1Xpf335EcClqco98LEkqU6saEXbWBaxEkswjDEzYVYcpQB/fv4G4 S6gDaUO0KK4d9MsGdplW1iFuojxoouzUrrPXrSS5hH39Fz9Uk7cI/Ztp/E3t6mL74HZ3 ljhN1clzaJlDe9YJPNXEuyTweEc5YBlTmwB8Lc5uLhrLeWcshVqw1lQdA/JU2vEMY5gK KI9kEg+cXzSed4ZP0KQHcHeCh1LjaevITE5/Oe7xjY3O9fKvYCfNulGpu/obvIY/jawe wKIw== X-Gm-Message-State: AOJu0Yy3MXzlpupHg3wTU855PKSBkf629o+9RjW2kQbLrakM52kdk+WI n+/743Xz52lTh7k8AeBujzZbSoaf33H/Ke/AHaHKM7uPsQhs5Z3ph8dWj7HNuSRZblQlWcRqRC6 2XJzU8Bzj2B1TjAVehYjqzdioH2DrdEm+V0qOSjzaKLSWPANPieWBN9EmVXHwi3Rxv7bm8c62hO DA9NZ19I2dpJSSVk4C2ZY+rruW3w9l4rfcIlc8ys71nHkU/g== X-Google-Smtp-Source: AGHT+IHCARefO9Q321jDvjEHJDSQPCVyz+1t2AKROGzfe5YcdNqEPgxb9TJaujSadqlPYWaeSwYl+A== X-Received: by 2002:a05:6a00:a1a:b0:704:23dc:6473 with SMTP id d2e1a72fcca58-70c2ea01f0cmr3716530b3a.30.1721165513082; Tue, 16 Jul 2024 14:31:53 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31:52 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Philipp Zabel , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 04/12] PCI: brcmstb: Use bridge reset if available Date: Tue, 16 Jul 2024 17:31:19 -0400 Message-Id: <20240716213131.6036-5-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> 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 Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c257434edc08..92816d8d215a 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -265,6 +265,7 @@ struct brcm_pcie { enum pcie_type type; struct reset_control *rescal; struct reset_control *perst_reset; + struct reset_control *bridge; int num_memc; u64 memc_size[PCIE_BRCM_MAX_MEMC]; u32 hw_rev; @@ -732,12 +733,19 @@ static void __iomem *brcm7425_pcie_map_bus(struct pci_bus *bus, static void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val) { - u32 tmp, mask = RGR1_SW_INIT_1_INIT_GENERIC_MASK; - u32 shift = RGR1_SW_INIT_1_INIT_GENERIC_SHIFT; + if (pcie->bridge) { + if (val) + reset_control_assert(pcie->bridge); + else + reset_control_deassert(pcie->bridge); + } else { + u32 tmp, mask = RGR1_SW_INIT_1_INIT_GENERIC_MASK; + u32 shift = RGR1_SW_INIT_1_INIT_GENERIC_SHIFT; - tmp = readl(pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); - tmp = (tmp & ~mask) | ((val << shift) & mask); - writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); + tmp = readl(pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); + tmp = (tmp & ~mask) | ((val << shift) & mask); + writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); + } } static void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val) @@ -1621,6 +1629,10 @@ static int brcm_pcie_probe(struct platform_device *pdev) if (IS_ERR(pcie->perst_reset)) return PTR_ERR(pcie->perst_reset); + pcie->bridge = devm_reset_control_get_optional_exclusive(&pdev->dev, "bridge"); + if (IS_ERR(pcie->bridge)) + return PTR_ERR(pcie->bridge); + ret = clk_prepare_enable(pcie->clk); if (ret) { dev_err(&pdev->dev, "could not enable clock\n"); From patchwork Tue Jul 16 21:31:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734960 X-Patchwork-Delegate: kw@linux.com Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (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 443771448F1 for ; Tue, 16 Jul 2024 21:31:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165519; cv=none; b=JOqiAsAuSxGrql4ZCVbW9YqdKY8dp/DYfhlYgF3vY0W5L+Bmz9MV5QdZTN8VYC6ZSOOOwWjK8iWJ9nx7Cgjwh5OTQ8IXavrzO/VkgmtGM+cMry8zDfRvKgICfuC7VU5PmWZrGN1nZ9c2W0Ca4//zywnm4ltCnTa+c+P7BeczoIc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165519; c=relaxed/simple; bh=+7ieHMcX+iIdqbT+JC+8LCENwbG4ctB/hzHZ4B22b9g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=k2Xuf1F19F/tYbhy7A+F/9wYT54k+Xyi2RJVbPzSmaKySlLLd44pup020e4z88bAnyYck21NZ/i3jJi5R0N5FprAh4olZ7qIcbQysSkLXoyy9cb3zMwLCNEehU5VkOMFUY1+QYaIrJaNa0YeKZmW7N3vdZP2iv5Ekp0I6F/V/zE= 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=EarFbL48; arc=none smtp.client-ip=209.85.167.172 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="EarFbL48" Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3d6301e7279so3884028b6e.3 for ; Tue, 16 Jul 2024 14:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165517; x=1721770317; darn=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=sTW6B8Xrqx+YAC0m+RwDbcjfQ0NaMyuJPXv+58jb8vI=; b=EarFbL48DlVUS/Z3804pJBk+Man+AuTcmLI4RiZ04lTd2m+tV+7agtU0fPKak37sSM UGkZMpYqEfABDaw/0hwVRiF6SSFNAUo343kB61RgzJXXDef+BKj4A6WR372Shf1qPwDY syYZxLvlboRK7/qG5wuid8czlxLx3ywx5WTG0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165517; x=1721770317; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sTW6B8Xrqx+YAC0m+RwDbcjfQ0NaMyuJPXv+58jb8vI=; b=m1NXpt2kB4fgZi5XnrU05dngd4q/0lgXSB3ulKS9HH7IQo/QsxIlg5gLJjebv8tVse 0+M3SaRhDGtVBG4C+CXZ2nWBFFXiHrdDS32DACAhsHM7RGfEPR0t53Zl7lSxUmK1d0kU /3nYcaAa/kqfATuPtUTaCGWUITk+DHx5YSdJImrmfCJmfOkeawzkQN91cNgmE3bK+3ne 7F52ZZ79HjvH7J1cZfxYusO8cWnyhTAD6Biy0XD++5Fcu9NssIJk+RUvEbqJw00i5Rgh 2CwgjuEoCI6vTWRBBkNJs7dzgDOo1AR/I7xwXqg5AUZw4JGKfxdjHPb9I5MeA7Ytl0g9 qbmg== X-Gm-Message-State: AOJu0YzfwthyNzd3OEZfZo3nMbgzDfa9J3zDvRQq8tYURXj1FjcQt4y8 gJDDX/ON5knzT7jVoOFvyy0AZVHV4iOKK9ZeUot4um5AGz8VttJd6eJLqKvvr0IUeJdldT3e7bG fHeOzDPeCRSB0/5Nb8ieUGnkIZ4NSWT2s9hSYvVUdY0p8SdbvD+1l1dBTgHMAwEMHOH5ShF4Abx nnQBPLd44h9HO9Lm3AiTEo+jxyl6btQb2v8y8VGbaE8DSb+w== X-Google-Smtp-Source: AGHT+IGyvYI3DfDEeXUXLaFD+3RzhfvFtKKmjP11NVlZDdaMFKZ7eqxSsGXCqSDwk+jvWaZ5X+QkeQ== X-Received: by 2002:a05:6870:c1d2:b0:25d:f8bb:c0b1 with SMTP id 586e51a60fabf-260bdd0b0b7mr2808568fac.2.1721165516721; Tue, 16 Jul 2024 14:31:56 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31:56 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Philipp Zabel , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 05/12] PCI: brcmstb: Use swinit reset if available Date: Tue, 16 Jul 2024 17:31:20 -0400 Message-Id: <20240716213131.6036-6-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> 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 Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 92816d8d215a..4dc2ff7f3167 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -266,6 +266,7 @@ struct brcm_pcie { struct reset_control *rescal; struct reset_control *perst_reset; struct reset_control *bridge; + struct reset_control *swinit; int num_memc; u64 memc_size[PCIE_BRCM_MAX_MEMC]; u32 hw_rev; @@ -1633,12 +1634,27 @@ static int brcm_pcie_probe(struct platform_device *pdev) if (IS_ERR(pcie->bridge)) return PTR_ERR(pcie->bridge); + pcie->swinit = devm_reset_control_get_optional_exclusive(&pdev->dev, "swinit"); + if (IS_ERR(pcie->swinit)) + return PTR_ERR(pcie->swinit); + ret = clk_prepare_enable(pcie->clk); if (ret) { dev_err(&pdev->dev, "could not enable clock\n"); return ret; } + ret = reset_control_assert(pcie->swinit); + if (ret) { + dev_err_probe(&pdev->dev, ret, "could not assert reset 'swinit'\n"); + goto clk_out; + } + ret = reset_control_deassert(pcie->swinit); + if (ret) { + dev_err(&pdev->dev, "could not de-assert reset 'swinit' after asserting\n"); + goto clk_out; + } + ret = reset_control_reset(pcie->rescal); if (ret) { dev_err(&pdev->dev, "failed to deassert 'rescal'\n"); From patchwork Tue Jul 16 21:31:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734961 X-Patchwork-Delegate: kw@linux.com Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.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 796A2144D21 for ; Tue, 16 Jul 2024 21:32:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165523; cv=none; b=KDnU1f32B+25J9/6froHUU6WQ57dQorOkM3opcXo7k2rqztqZ2IXnLaOHakF1fplfeOsAnJJjiDLCfikkIFIlANwKpQ/koT+jhTwDMrpKxn7rvL5iR0WcmIEw76YalJNr2QyltQxMcqbLOLb4v+pcX0Zerw8n157tK0kif6tzGQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165523; c=relaxed/simple; bh=mGZw0GnMIITmhN9sV017/Px1pHC3gfpN1Q17tjvNzi4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=D+mhULYMOLSFX1i25pex1Btb5R5y/P3qKHP7ytShdnnNziLCR/oNnSXWaNgJdnqt3xy3papVbuEDAFnkTRxROWqU56ayI03OfX+jhB4C3mg0bBYISyZiadsbYfSRjsvMnvLhnc7xjrAh8iGB9Wf8XPKYfyAA2Q5jGLbBRt6hb/Q= 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=NpfuGIVt; arc=none smtp.client-ip=209.85.210.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="NpfuGIVt" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-70b703eda27so2753909b3a.3 for ; Tue, 16 Jul 2024 14:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165520; x=1721770320; 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=+CT/8sh6Sx20eFyhLTxzwzht5rbY+Mj7TPohRSFW5t8=; b=NpfuGIVtyLGejzdwD1A0Q5BfXjlssaJNFlp+mHekC3mvI2NfSlcYGNCErJaXi/DR+i jS5F/mahp5RJezBwNRnRRv/OkX/x7hvdvA3wW53385f38+JQDORT1byeDILaMB7kMV9X nnb3f8HcdRSD46QsGUKkFjrjDUpcqZ9u9cDT8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165520; x=1721770320; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+CT/8sh6Sx20eFyhLTxzwzht5rbY+Mj7TPohRSFW5t8=; b=Xxbg/DEbmTn4bc/qyXvzaAHK6laOxH+UtZJcEaYZbr6LX1Dlsl+I1ceShrLY8EJthL 6X3Oa+Nav6vyJuGRGQEkxNAgdCX06qLwtB35JcYUxhP42V0ey7tu2Q1T+vgOeQifev1u TNu/GvyQ6cHx4Wa6ElSo0/LziBc7CtQlsYsbTkwjzUhL/yDPoWrlDF1RNrpB+8eef1kq 6w1rJXYAMSXho6/rhwjE8O9W6sDCv6idyPdyB7bvM/QE3uIWTLw///OW+8Rs9mVfJ6fZ fD1SC6tPqWHNorATAwHthbvUE/uX7VpQnxWp7QjolO94P+sS4QYRgmy5jS66P187I4xp KSjQ== X-Gm-Message-State: AOJu0YxZ3JeBP3cG67/OZf1VpntZNjpySvTWW3NYDfQDtsjXZNMjhzvS l18SsXOKS+UtZ0LeKJYkgldPy+2ImWNseiTsi8KwsGQO1IjTLGw0izS2c4WildjMI2rd8s5Xxpl gKcvKXl6G1z3rfiV9nCpRRBtJtRYNViY+2Q3HZiMUAjorz4ebSJ4U0zC4KCtE2AuaQOZ6AV1hUc cz1zqFSxNihmKNp2OYGo6eTZrcjeMaOoATcNEV+7WZRtsxpQ== X-Google-Smtp-Source: AGHT+IHSYiDtAOt6vkPiOmOGzoCjlK8JNJow6N9e9x7/paF1mesMY/nehkea9fDquwFmwcedQMkkSQ== X-Received: by 2002:a05:6a00:138b:b0:705:c0a1:61c9 with SMTP id d2e1a72fcca58-70c1fb9162bmr4131254b3a.9.1721165520137; Tue, 16 Jul 2024 14:32:00 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31:59 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 06/12] PCI: brcmstb: PCI: brcmstb: Make HARD_DEBUG, INTR2_CPU_BASE offsets SoC-specific Date: Tue, 16 Jul 2024 17:31:21 -0400 Message-Id: <20240716213131.6036-7-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> 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 Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli Reviewed-by: Manivannan Sadhasivam --- drivers/pci/controller/pcie-brcmstb.c | 39 ++++++++++++++++----------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 4dc2ff7f3167..073d790d97b7 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -122,7 +122,6 @@ #define PCIE_MEM_WIN0_LIMIT_HI(win) \ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI + ((win) * 8) -#define PCIE_MISC_HARD_PCIE_HARD_DEBUG 0x4204 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK 0x2 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK 0x200000 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000 @@ -131,9 +130,9 @@ (PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK | \ PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK) -#define PCIE_INTR2_CPU_BASE 0x4300 #define PCIE_MSI_INTR2_BASE 0x4500 -/* Offsets from PCIE_INTR2_CPU_BASE and PCIE_MSI_INTR2_BASE */ + +/* Offsets from INTR2_CPU and MSI_INTR2 BASE offsets */ #define MSI_INT_STATUS 0x0 #define MSI_INT_CLR 0x8 #define MSI_INT_MASK_SET 0x10 @@ -184,9 +183,11 @@ #define SSC_STATUS_PLL_LOCK_MASK 0x800 #define PCIE_BRCM_MAX_MEMC 3 -#define IDX_ADDR(pcie) (pcie->reg_offsets[EXT_CFG_INDEX]) -#define DATA_ADDR(pcie) (pcie->reg_offsets[EXT_CFG_DATA]) -#define PCIE_RGR1_SW_INIT_1(pcie) (pcie->reg_offsets[RGR1_SW_INIT_1]) +#define IDX_ADDR(pcie) ((pcie)->reg_offsets[EXT_CFG_INDEX]) +#define DATA_ADDR(pcie) ((pcie)->reg_offsets[EXT_CFG_DATA]) +#define PCIE_RGR1_SW_INIT_1(pcie) ((pcie)->reg_offsets[RGR1_SW_INIT_1]) +#define HARD_DEBUG(pcie) ((pcie)->reg_offsets[PCIE_HARD_DEBUG]) +#define INTR2_CPU_BASE(pcie) ((pcie)->reg_offsets[PCIE_INTR2_CPU_BASE]) /* Rescal registers */ #define PCIE_DVT_PMU_PCIE_PHY_CTRL 0xc700 @@ -205,6 +206,8 @@ enum { RGR1_SW_INIT_1, EXT_CFG_INDEX, EXT_CFG_DATA, + PCIE_HARD_DEBUG, + PCIE_INTR2_CPU_BASE, }; enum { @@ -651,7 +654,7 @@ static int brcm_pcie_enable_msi(struct brcm_pcie *pcie) BUILD_BUG_ON(BRCM_INT_PCI_MSI_LEGACY_NR > BRCM_INT_PCI_MSI_NR); if (msi->legacy) { - msi->intr_base = msi->base + PCIE_INTR2_CPU_BASE; + msi->intr_base = msi->base + INTR2_CPU_BASE(pcie); msi->nr = BRCM_INT_PCI_MSI_LEGACY_NR; msi->legacy_shift = 24; } else { @@ -898,12 +901,12 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) /* Take the bridge out of reset */ pcie->bridge_sw_init_set(pcie, 0); - tmp = readl(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + tmp = readl(base + HARD_DEBUG(pcie)); if (is_bmips(pcie)) tmp &= ~PCIE_BMIPS_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK; else tmp &= ~PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK; - writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + writel(tmp, base + HARD_DEBUG(pcie)); /* Wait for SerDes to be stable */ usleep_range(100, 200); @@ -1072,7 +1075,7 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie) } /* Start out assuming safe mode (both mode bits cleared) */ - clkreq_cntl = readl(pcie->base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + clkreq_cntl = readl(pcie->base + HARD_DEBUG(pcie)); clkreq_cntl &= ~PCIE_CLKREQ_MASK; if (strcmp(mode, "no-l1ss") == 0) { @@ -1115,7 +1118,7 @@ static void brcm_config_clkreq(struct brcm_pcie *pcie) dev_err(pcie->dev, err_msg); mode = "safe"; } - writel(clkreq_cntl, pcie->base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + writel(clkreq_cntl, pcie->base + HARD_DEBUG(pcie)); dev_info(pcie->dev, "clkreq-mode set to %s\n", mode); } @@ -1337,9 +1340,9 @@ static void brcm_pcie_turn_off(struct brcm_pcie *pcie) writel(tmp, base + PCIE_MISC_PCIE_CTRL); /* Turn off SerDes */ - tmp = readl(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + tmp = readl(base + HARD_DEBUG(pcie)); u32p_replace_bits(&tmp, 1, PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); - writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + writel(tmp, base + HARD_DEBUG(pcie)); /* Shutdown PCIe bridge */ pcie->bridge_sw_init_set(pcie, 1); @@ -1425,9 +1428,9 @@ static int brcm_pcie_resume_noirq(struct device *dev) pcie->bridge_sw_init_set(pcie, 0); /* SERDES_IDDQ = 0 */ - tmp = readl(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + tmp = readl(base + HARD_DEBUG(pcie)); u32p_replace_bits(&tmp, 0, PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); - writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); + writel(tmp, base + HARD_DEBUG(pcie)); /* wait for serdes to be stable */ udelay(100); @@ -1499,12 +1502,16 @@ static const int pcie_offsets[] = { [RGR1_SW_INIT_1] = 0x9210, [EXT_CFG_INDEX] = 0x9000, [EXT_CFG_DATA] = 0x9004, + [PCIE_HARD_DEBUG] = 0x4204, + [PCIE_INTR2_CPU_BASE] = 0x4300, }; static const int pcie_offsets_bmips_7425[] = { [RGR1_SW_INIT_1] = 0x8010, [EXT_CFG_INDEX] = 0x8300, [EXT_CFG_DATA] = 0x8304, + [PCIE_HARD_DEBUG] = 0x4204, + [PCIE_INTR2_CPU_BASE] = 0x4300, }; static const struct pcie_cfg_data generic_cfg = { @@ -1539,6 +1546,8 @@ static const int pcie_offset_bcm7278[] = { [RGR1_SW_INIT_1] = 0xc010, [EXT_CFG_INDEX] = 0x9000, [EXT_CFG_DATA] = 0x9004, + [PCIE_HARD_DEBUG] = 0x4204, + [PCIE_INTR2_CPU_BASE] = 0x4300, }; static const struct pcie_cfg_data bcm7278_cfg = { From patchwork Tue Jul 16 21:31:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734962 X-Patchwork-Delegate: kw@linux.com Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 ECB3113C9A2 for ; Tue, 16 Jul 2024 21:32:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165526; cv=none; b=tTJmCUyXPH1L3JF0G4YSMoAUqH/APhl1zgxr/E6qYLMg/oZzytSotIJ+J6pDwZ4ZRQEJGL8JVSqsyA7138sY3heqa0rvO0JYnBQr/Wrw//U99Pt/WC1zjIvvPyQPewjRvS2XvIsxY9/qiTMKbFx9t/5wqgElVBZ1gBga9XG/IBE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165526; c=relaxed/simple; bh=Z2tubBvOC6XbBFzJNdEyZ6x1k5un80vCEG1as9V5aMU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=cyEFgdVf3tr78nj5vF8zEdCzQS1tRw9hWnRlY/eDl9/vjF5fkfJcocSTQ45Y8cq4agHY7OuZGFxrlU9PhAVRNAwTIEfJt0hIsIbu7PTwnVIERwcsbSmXJbyrZFfd4ktkiqObMPpAMN3DSfSBRgOrZ8vX9cY2tkye//BbvC/3Mso= 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=Dmw/yglr; arc=none smtp.client-ip=209.85.210.175 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="Dmw/yglr" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-70b04cb28acso150520b3a.0 for ; Tue, 16 Jul 2024 14:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165524; x=1721770324; darn=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=OZM5Gb08x4X6Ok1HcGVSDF3SPXVakG4JJkYmvQ/rjO4=; b=Dmw/yglri2XLJrvlE7T3fySPIYBxMyeDAr062CXBUCLH86l4DGjVrAY09yOibJSh+F besj/VhQiphVaCeL8p14IUoAxWbkOCnrC0nP1Y3f603vwwCA74XRwjgIw+f+m6Py4Eu6 E6W/AOc2+2uiV/4rISGhZVZwPJ8mwuKVMkxiE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165524; x=1721770324; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OZM5Gb08x4X6Ok1HcGVSDF3SPXVakG4JJkYmvQ/rjO4=; b=fMtN9pcQ2CYXy7WQ4AJzdB9xmOWPpJKKm+kZfOKcGh5v6WtLn0ZHY1ThnpALdcuCEG idPU9ZI+1/2hgkN8eNnwj11LLkqeqRn9vGDduzNdQA3DM90DPkFCpoHrCJGYKBPH4HL9 na1f2Z8gUDrOX+lMO16BB6WcSHcY2Cum8CdD7Cauv2IPHhCmGZgjXNKbrnWxUp6+8FGz C7mNJ49Ub7kMlrmb9kL1tzAL2bBI/w/q8xAisSy459Bx1LIIZ8R2ataESxsGvp+2PWib VuAF0JAXd015VktEk3ksJASgen1TUVV4rBUWMJLBi5i8fQLud/9+Ip5Qpm15vn6jPCF6 RqQg== X-Gm-Message-State: AOJu0YwicLcm+dGxhDIuwiJNUIqvkCtT9DM9Fl/fAQo3FakIl9ZO1fky aBEZlCPrrGcBLJR76JBJB9XGo5X/jl8J8+T47Q4jeCQoFsS8aVndBoSpCNVi+QEkLQpiobAWJ0p quoZJyyd7TMoe1ag94UMDPTBsrsq+isVfeSpq99wrVLtDRTUj+LvTnjbsAZIRToSR+z2dpfOTtt 8jR8AR+Ksj2SzlkzGhImI9/pXEkdVvHgIVWUfpM5YanV5cpg== X-Google-Smtp-Source: AGHT+IEQ+y3xcUv5Dwl1btE2c6dnmPHXqa/DiHXMMkvzO4C3SKiBXeeShZrn4dIthVUtGZRGRZZ2AQ== X-Received: by 2002:a05:6a00:2da8:b0:706:2a38:94e2 with SMTP id d2e1a72fcca58-70cd83d64f6mr5132276b3a.12.1721165523615; Tue, 16 Jul 2024 14:32:03 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:32:03 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 07/12] PCI: brcmstb: Remove two unused constants from driver Date: Tue, 16 Jul 2024 17:31:22 -0400 Message-Id: <20240716213131.6036-8-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> 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 Reviewed-by: Florian Fainelli Reviewed-by: Manivannan Sadhasivam --- drivers/pci/controller/pcie-brcmstb.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 073d790d97b7..dfb404748ad8 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -210,11 +210,6 @@ enum { PCIE_INTR2_CPU_BASE, }; -enum { - RGR1_SW_INIT_1_INIT_MASK, - RGR1_SW_INIT_1_INIT_SHIFT, -}; - enum pcie_type { GENERIC, BCM7425, From patchwork Tue Jul 16 21:31:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734963 X-Patchwork-Delegate: kw@linux.com Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (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 E06E71411E6 for ; Tue, 16 Jul 2024 21:32:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165530; cv=none; b=jsDt5eGRevWxa0fT9qutUUg/1KSwkduAknasP0jN/uZ5PWTNGq3b8n5pGAL/OlM/bqvoDkoKxYztiURDRpBruVBduvAkGZ7ul7OR9v4DsicuHVk9Tm14zUAtdByOBEPgOkHp9CsgQGHFtNnOlAp9O9pqGfKZ43OwIafprj9NSIk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165530; c=relaxed/simple; bh=UCqbxCQdkx6VBRZexx0+Cn68RR4Zg17QY3Bc93dODxE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=F+DZ3xc+ZRoF0MTzcV4KNk7IcvdKzok7TlR8wP9siucmOI7sIsDdHbDw1Lj8qSkA4Kusui9FvpYRzsZEo/TTpjhVp5PHzAl8Fuoq/aZldY39eA0+LEqz4kf5pZtx8gHUQKwMv8idN3VcrVowdXTdj8tSn8X/M6np1ck6Db2KBz8= 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=HXWQxZgV; arc=none smtp.client-ip=209.85.215.172 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="HXWQxZgV" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-78c84837564so2409436a12.3 for ; Tue, 16 Jul 2024 14:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165528; x=1721770328; darn=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=+pyiUAb7p4STfXsJ/emlUrsA1NC1nfalZ2FHcpYfjAc=; b=HXWQxZgVoNjbu+0QA8n4ZX/M6sVogA87g1iPiNOPESRcc3XCGEN1ldvERb5/b/MVBe 0AOIgDw+7Jq12plew9UzQ76Jlz2N08NM2eqlTtg65pqIMdWEekbrdBnPaU1/Gg9btMLn D69U9fcJrEMNe8vGmkrvFaKgCaRX+7PoTXHlI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165528; x=1721770328; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+pyiUAb7p4STfXsJ/emlUrsA1NC1nfalZ2FHcpYfjAc=; b=pbA6dmtXnYElrfV3OaTWtyWCFSYKZZ78TpYaCID4fiT404OBi92HjN6bQ210O+LZ8v q61R2U/MqS3V5QRhgH/QC93dXduML9r3Bb5137lp9eQflo3Y9q6x8dYZPNWh3Bc8P6AB +K3d+PBgZEJw4CV5pxmwDFsNQnr8Q3YR5d/IkONXhe7hb/HdNM8j5/bJR79ufyG808kI aAE+mPK0qF1WgFLCf+T+G/cbfXH+3VUrFFH+jkIHlgUnkrEqWyl2QKzDrHUuvF17ryd5 CnkuoerQ5+BvpYtXkYruhAANUo84PoCkM/q9PXBO8tAmtVD9u7rOzJ+A5cXZ4sAGUQJM 4oog== X-Gm-Message-State: AOJu0YxUcElkj3RroPkjS5hz5kHmaOQldg75lZQlISnjhVrmVlFkDOWZ bP6tl1jAXkMIJ2mkfFTU3qpIj7u9rtVYKMhGsMpMS4KX52+jOLNtv3KzdwMOO1CWMJUTVuTEM1U nWGTVsCW7Icyw1xPbExRIZOPad8EYgY+of9/ggUa0I7bpc5kiBSwrMrM6FkQNIj7xIaScsygmyL YI7Kw6tYf5q9NSBeck5GVWxvXbR8FHdpVoaOQEfUxhY/Pq2lwI X-Google-Smtp-Source: AGHT+IHMq7sIS5fikUr98UkxmIBVwJilGApJCxfCRLVg1iE2jvb1wLcaHJgx2XWdM6RSZ2NA/mSTgg== X-Received: by 2002:a05:6a21:9985:b0:1be:c947:f17a with SMTP id adf61e73a8af0-1c3f122bb89mr4312395637.24.1721165527534; Tue, 16 Jul 2024 14:32:07 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:32:06 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 08/12] PCI: brcmstb: Don't conflate the reset rescal with phy ctrl Date: Tue, 16 Jul 2024 17:31:23 -0400 Message-Id: <20240716213131.6036-9-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> 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 Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index dfb404748ad8..8ab5a8ca05b4 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -222,6 +222,7 @@ enum pcie_type { struct pcie_cfg_data { const int *offsets; const enum pcie_type type; + const bool has_phy; void (*perst_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); }; @@ -272,6 +273,7 @@ struct brcm_pcie { void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); struct subdev_regulators *sr; bool ep_wakeup_capable; + bool has_phy; }; static inline bool is_bmips(const struct brcm_pcie *pcie) @@ -1311,12 +1313,12 @@ static int brcm_phy_cntl(struct brcm_pcie *pcie, const int start) static inline int brcm_phy_start(struct brcm_pcie *pcie) { - return pcie->rescal ? brcm_phy_cntl(pcie, 1) : 0; + return pcie->has_phy ? brcm_phy_cntl(pcie, 1) : 0; } static inline int brcm_phy_stop(struct brcm_pcie *pcie) { - return pcie->rescal ? brcm_phy_cntl(pcie, 0) : 0; + return pcie->has_phy ? brcm_phy_cntl(pcie, 0) : 0; } static void brcm_pcie_turn_off(struct brcm_pcie *pcie) @@ -1559,12 +1561,20 @@ static const struct pcie_cfg_data bcm2711_cfg = { .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, }; +static const struct pcie_cfg_data bcm7216_cfg = { + .offsets = pcie_offset_bcm7278, + .type = BCM7278, + .perst_set = brcm_pcie_perst_set_7278, + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, + .has_phy = true, +}; + static const struct of_device_id brcm_pcie_match[] = { { .compatible = "brcm,bcm2711-pcie", .data = &bcm2711_cfg }, { .compatible = "brcm,bcm4908-pcie", .data = &bcm4908_cfg }, { .compatible = "brcm,bcm7211-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7278-pcie", .data = &bcm7278_cfg }, - { .compatible = "brcm,bcm7216-pcie", .data = &bcm7278_cfg }, + { .compatible = "brcm,bcm7216-pcie", .data = &bcm7216_cfg }, { .compatible = "brcm,bcm7445-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7435-pcie", .data = &bcm7435_cfg }, { .compatible = "brcm,bcm7425-pcie", .data = &bcm7425_cfg }, @@ -1612,6 +1622,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) pcie->type = data->type; pcie->perst_set = data->perst_set; pcie->bridge_sw_init_set = data->bridge_sw_init_set; + pcie->has_phy = data->has_phy; pcie->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pcie->base)) From patchwork Tue Jul 16 21:31:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734964 X-Patchwork-Delegate: kw@linux.com Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.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 EE40D145A1E for ; Tue, 16 Jul 2024 21:32:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165535; cv=none; b=qRAaZCYuSm6Tg/Mwv2GtBeoI0E2xCC1149vWMYmkz+3bdaHW6legXBc5N/JINia+ZXM+9EhFnHsRtGR5IIV65Qs41CIHSpZMikCZiAeyC1rGt70pA+/UIfpUzzvETCcTYabxCkvne9Dk8NcOdbdkgdnnQmtJ76uJ1Uqgf+0yXFY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165535; c=relaxed/simple; bh=81tQh9eltRXnV7Pz9jyI0IPW+rjkKoh8QFKWj0GC8Ms=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=gVDyApvVorMi8FVBT87pHZXDS23JgSssmb0SMRaXJZluwN03EtIHe5X0M+Vbf6PeFEcsJA3QfPms1ozIiu9I5taNWmyay2becnG+zXO6XKrSL9j0u4gLFc55J91vlpZTY8BeXkRzy877ExcxHeh098mfVzyueKeSiJpF+wxfX20= 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=WDiMNzbr; arc=none smtp.client-ip=209.85.160.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="WDiMNzbr" Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-25e3d8db819so2677489fac.0 for ; Tue, 16 Jul 2024 14:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165532; x=1721770332; 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=K0amyeZJtNkXLKOKNm4oOUxE2ZOVOkC/XT32ul/pHnU=; b=WDiMNzbrwp6BsAUGQpFJeRRODMUBB3l17mDI2KBNuJSsxI2MWndA8wid5FH4gGq86H AvPA1UFT1dPd6zPZgZEA/Si7/pqK35G9GFU17OVk+IyArkGPhjxFfyDA+1BUXlOQW5Oc xxSeQKcpleRsaAx+bVwR2f1Sb4E8gDNGt0vFs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165532; x=1721770332; 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=K0amyeZJtNkXLKOKNm4oOUxE2ZOVOkC/XT32ul/pHnU=; b=I9dMNhE0+XOiM+w3k7NK+TucrAjlY1mLkU1eYuw0uXuW/SFHOZuPPK95KSR+GgXcrT nZWI5VhPtrGVtFjvOisJ9JCXL3Qy0qjrrnY+RexpJJZfapIFCdTymxGwXMFmgPSSRK/e cHcXezTTiN6mO/G5Bbvzl2+tFWbq+oChDM434hOMyvtAzVGFuI/Zg7daUVsL7XGo3XBI kHfv1lCwC4dKPaDHu0iJyUwOCD9J6N32xoMWap5Y4UNu1eew1aTapAloAbfc/+qb0hj6 gYEm8M+9R5g27gPCdF86m0S9Boph6/+BqTJk3IRJ5A3XMWtr+MD50l0HQn556hT3NyOY wRlg== X-Gm-Message-State: AOJu0Yw/5oRXCSeTCUXnxye3rh4FwdzSRf7bhdZdvuBzTyO7uDyRoow4 eaRxX03fyIi3zLLQtjZ28Zx3j7v1BvepmTtcHjPBijD9ndaMKNbXWwkCHm1u0NGNG8DCD9ndV1+ 7DV9kkcQzCnvg9k9nrLwAXufPogrjl4A0oCPtnMX1yyOx/xBY/YbiG/taEj4YmyEhvjhOuVtP79 1w5YqLBXKEG8OJMJr9kyMb1aykRN3foOAWtI8wdFRzc4cU/A== X-Google-Smtp-Source: AGHT+IHbgSUfXFLYlspZT3aVC2XG8O5cysTO0jt82F+Tc8MQXTEy/SYGIK5yWtj9CK206RhZGyx3pw== X-Received: by 2002:a05:6870:5493:b0:25e:ba6b:58f with SMTP id 586e51a60fabf-260bdd806femr2915076fac.10.1721165531465; Tue, 16 Jul 2024 14:32:11 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:32:10 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 09/12] PCI: brcmstb: Refactor for chips with many regular inbound BARs Date: Tue, 16 Jul 2024 17:31:24 -0400 Message-Id: <20240716213131.6036-10-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> 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 internal registers, the second was for memory, and the third was for memory but with the endian swapped. We typically only used one of these BARs. Complicating that BARs usage was the fact that the PCIe HW would do a baroque internal mapping of system memory, and concatenate the regions of multiple memory controllers. Newer chips such as the 7712 and Cable Modem SOCs have taken a step forward and now provide multiple inbound BARs. This works in concert with the dma-ranges property, where each provided range becomes an inbound BAR. This commit provides support for these new chips and their multiple inbound BARs but also keeps the legacy support for the older system. Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov --- drivers/pci/controller/pcie-brcmstb.c | 216 ++++++++++++++++++++------ 1 file changed, 167 insertions(+), 49 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 8ab5a8ca05b4..c44a92217855 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -75,15 +75,12 @@ #define PCIE_MEM_WIN0_HI(win) \ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI + ((win) * 8) +#define PCIE_BRCM_MAX_RC_BARS 16 #define PCIE_MISC_RC_BAR1_CONFIG_LO 0x402c #define PCIE_MISC_RC_BAR1_CONFIG_LO_SIZE_MASK 0x1f -#define PCIE_MISC_RC_BAR2_CONFIG_LO 0x4034 -#define PCIE_MISC_RC_BAR2_CONFIG_LO_SIZE_MASK 0x1f -#define PCIE_MISC_RC_BAR2_CONFIG_HI 0x4038 +#define PCIE_MISC_RC_BAR4_CONFIG_LO 0x40d4 -#define PCIE_MISC_RC_BAR3_CONFIG_LO 0x403c -#define PCIE_MISC_RC_BAR3_CONFIG_LO_SIZE_MASK 0x1f #define PCIE_MISC_MSI_BAR_CONFIG_LO 0x4044 #define PCIE_MISC_MSI_BAR_CONFIG_HI 0x4048 @@ -130,6 +127,10 @@ (PCIE_MISC_HARD_PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK | \ PCIE_MISC_HARD_PCIE_HARD_DEBUG_L1SS_ENABLE_MASK) +#define PCIE_MISC_UBUS_BAR1_CONFIG_REMAP 0x40ac +#define PCIE_MISC_UBUS_BAR1_CONFIG_REMAP_ACCESS_EN_MASK BIT(0) +#define PCIE_MISC_UBUS_BAR4_CONFIG_REMAP 0x410c + #define PCIE_MSI_INTR2_BASE 0x4500 /* Offsets from INTR2_CPU and MSI_INTR2 BASE offsets */ @@ -217,12 +218,20 @@ enum pcie_type { BCM4908, BCM7278, BCM2711, + BCM7712, +}; + +struct rc_bar { + u64 size; + u64 pci_offset; + u64 cpu_addr; }; struct pcie_cfg_data { const int *offsets; const enum pcie_type type; const bool has_phy; + unsigned int num_inbound; void (*perst_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); }; @@ -274,6 +283,7 @@ struct brcm_pcie { struct subdev_regulators *sr; bool ep_wakeup_capable; bool has_phy; + int num_inbound; }; static inline bool is_bmips(const struct brcm_pcie *pcie) @@ -789,23 +799,61 @@ static void brcm_pcie_perst_set_generic(struct brcm_pcie *pcie, u32 val) writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); } -static int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie, - u64 *rc_bar2_size, - u64 *rc_bar2_offset) +static inline void set_bar(struct rc_bar *b, int *count, u64 size, + u64 cpu_addr, u64 pci_offset) +{ + b->size = size; + b->cpu_addr = cpu_addr; + b->pci_offset = pci_offset; + (*count)++; +} + +static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie, + struct rc_bar rc_bars[]) { struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); + u64 pci_offset, cpu_addr, size = 0, tot_size = 0; struct resource_entry *entry; struct device *dev = pcie->dev; u64 lowest_pcie_addr = ~(u64)0; - int ret, i = 0; - u64 size = 0; + int ret, i = 0, n = 0; + + /* + * The HW registers (and PCIe) use order-1 numbering for BARs. As + * such, we have rc_bars[0] unused and BAR1 starts at rc_bars[1]. + */ + struct rc_bar *b_begin = &rc_bars[1]; + struct rc_bar *b = b_begin; + + /* + * STB chips beside 7712 disable the first inbound window default. + * Rather being mapped to system memory it is mapped to the + * internal registers of the SoC. This feature is deprecated, has + * security considerations, and is not implemented in our modern + * SoCs. + */ + if (pcie->type != BCM7712) + set_bar(b++, &n, 0, 0, 0); resource_list_for_each_entry(entry, &bridge->dma_ranges) { u64 pcie_beg = entry->res->start - entry->offset; + u64 cpu_beg = entry->res->start; - size += entry->res->end - entry->res->start + 1; + size = resource_size(entry->res); + tot_size += size; if (pcie_beg < lowest_pcie_addr) lowest_pcie_addr = pcie_beg; + /* + * 7712 and newer chips may have many BARs, with each + * offering a non-overlapping viewport to system memory. + * That being said, each BARs size must still be a power of + * two. + */ + if (pcie->type == BCM7712) + set_bar(b++, &n, size, cpu_beg, pcie_beg); + + if (n > pcie->num_inbound) + break; } if (lowest_pcie_addr == ~(u64)0) { @@ -813,13 +861,20 @@ static int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie, return -EINVAL; } + /* + * 7712 and newer chips do not have an internal memory mapping system + * that enables multiple memory controllers. As such, it can return + * now w/o doing special configuration. + */ + if (pcie->type == BCM7712) + return n; + ret = of_property_read_variable_u64_array(pcie->np, "brcm,scb-sizes", pcie->memc_size, 1, PCIE_BRCM_MAX_MEMC); - if (ret <= 0) { /* Make an educated guess */ pcie->num_memc = 1; - pcie->memc_size[0] = 1ULL << fls64(size - 1); + pcie->memc_size[0] = 1ULL << fls64(tot_size - 1); } else { pcie->num_memc = ret; } @@ -828,10 +883,15 @@ static int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie, for (i = 0, size = 0; i < pcie->num_memc; i++) size += pcie->memc_size[i]; - /* System memory starts at this address in PCIe-space */ - *rc_bar2_offset = lowest_pcie_addr; - /* The sum of all memc views must also be a power of 2 */ - *rc_bar2_size = 1ULL << fls64(size - 1); + /* Our HW mandates that the window size must be a power of 2 */ + size = 1ULL << fls64(size - 1); + + /* + * For STB chips, the BAR2 cpu_addr is hardwired to the start + * of system memory, so we set it to 0. + */ + cpu_addr = 0; + pci_offset = lowest_pcie_addr; /* * We validate the inbound memory view even though we should trust @@ -866,25 +926,89 @@ static int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie, * outbound memory @ 3GB). So instead it will start at the 1x * multiple of its size */ - if (!*rc_bar2_size || (*rc_bar2_offset & (*rc_bar2_size - 1)) || - (*rc_bar2_offset < SZ_4G && *rc_bar2_offset > SZ_2G)) { + if (!size || (pci_offset & (size - 1)) || + (pci_offset < SZ_4G && pci_offset > SZ_2G)) { dev_err(dev, "Invalid rc_bar2_offset/size: size 0x%llx, off 0x%llx\n", - *rc_bar2_size, *rc_bar2_offset); + size, pci_offset); return -EINVAL; } - return 0; + /* Enable BAR2, the inbound window for STB chips */ + set_bar(b++, &n, size, cpu_addr, pci_offset); + + /* + * Disable BAR3. On some chips presents the same window as BAR2 + * but the data appears in a settable endianness. + */ + set_bar(b++, &n, 0, 0, 0); + + return n; +} + +static u32 brcm_bar_reg_offset(int bar) +{ + if (bar <= 3) + return PCIE_MISC_RC_BAR1_CONFIG_LO + 8 * (bar - 1); + else + return PCIE_MISC_RC_BAR4_CONFIG_LO + 8 * (bar - 4); +} + +static u32 brcm_ubus_reg_offset(int bar) +{ + if (bar <= 3) + return PCIE_MISC_UBUS_BAR1_CONFIG_REMAP + 8 * (bar - 1); + else + return PCIE_MISC_UBUS_BAR4_CONFIG_REMAP + 8 * (bar - 4); +} + +static void set_inbound_win_registers(struct brcm_pcie *pcie, const struct rc_bar *rc_bars, + int num_rc_bars) +{ + void __iomem *base = pcie->base; + int i; + + for (i = 1; i <= num_rc_bars; i++) { + u64 pci_offset = rc_bars[i].pci_offset; + u64 cpu_addr = rc_bars[i].cpu_addr; + u64 size = rc_bars[i].size; + u32 reg_offset = brcm_bar_reg_offset(i); + u32 tmp = lower_32_bits(pci_offset); + + u32p_replace_bits(&tmp, brcm_pcie_encode_ibar_size(size), + PCIE_MISC_RC_BAR1_CONFIG_LO_SIZE_MASK); + + /* Write low */ + writel(tmp, base + reg_offset); + /* Write high */ + writel(upper_32_bits(pci_offset), base + reg_offset + 4); + + /* + * Most STB chips: + * Do nothing. + * 7712: + * All of their BARs need to be set. + */ + if (pcie->type == BCM7712) { + /* BUS remap register settings */ + reg_offset = brcm_ubus_reg_offset(i); + tmp = lower_32_bits(cpu_addr) & ~0xfff; + tmp |= PCIE_MISC_UBUS_BAR1_CONFIG_REMAP_ACCESS_EN_MASK; + writel(tmp, base + reg_offset); + tmp = upper_32_bits(cpu_addr); + writel(tmp, base + reg_offset + 4); + } + } } static int brcm_pcie_setup(struct brcm_pcie *pcie) { - u64 rc_bar2_offset, rc_bar2_size; + struct rc_bar rc_bars[PCIE_BRCM_MAX_RC_BARS]; void __iomem *base = pcie->base; struct pci_host_bridge *bridge; struct resource_entry *entry; u32 tmp, burst, aspm_support; - int num_out_wins = 0; - int ret, memc; + int num_out_wins = 0, num_rc_bars = 0; + int memc; /* Reset the bridge */ pcie->bridge_sw_init_set(pcie, 1); @@ -933,17 +1057,16 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) u32p_replace_bits(&tmp, 1, PCIE_MISC_MISC_CTRL_PCIE_RCB_64B_MODE_MASK); writel(tmp, base + PCIE_MISC_MISC_CTRL); - ret = brcm_pcie_get_rc_bar2_size_and_offset(pcie, &rc_bar2_size, - &rc_bar2_offset); - if (ret) - return ret; + num_rc_bars = brcm_pcie_get_inbound_wins(pcie, rc_bars); + if (num_rc_bars < 0) + return num_rc_bars; - tmp = lower_32_bits(rc_bar2_offset); - u32p_replace_bits(&tmp, brcm_pcie_encode_ibar_size(rc_bar2_size), - PCIE_MISC_RC_BAR2_CONFIG_LO_SIZE_MASK); - writel(tmp, base + PCIE_MISC_RC_BAR2_CONFIG_LO); - writel(upper_32_bits(rc_bar2_offset), - base + PCIE_MISC_RC_BAR2_CONFIG_HI); + set_inbound_win_registers(pcie, rc_bars, num_rc_bars); + + if (!brcm_pcie_rc_mode(pcie)) { + dev_err(pcie->dev, "PCIe RC controller misconfigured as Endpoint\n"); + return -EINVAL; + } tmp = readl(base + PCIE_MISC_MISC_CTRL); for (memc = 0; memc < pcie->num_memc; memc++) { @@ -965,25 +1088,12 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) * 4GB or when the inbound area is smaller than 4GB (taking into * account the rounding-up we're forced to perform). */ - if (rc_bar2_offset >= SZ_4G || (rc_bar2_size + rc_bar2_offset) < SZ_4G) + if (rc_bars[2].pci_offset >= SZ_4G || + (rc_bars[2].size + rc_bars[2].pci_offset) < SZ_4G) pcie->msi_target_addr = BRCM_MSI_TARGET_ADDR_LT_4GB; else pcie->msi_target_addr = BRCM_MSI_TARGET_ADDR_GT_4GB; - if (!brcm_pcie_rc_mode(pcie)) { - dev_err(pcie->dev, "PCIe RC controller misconfigured as Endpoint\n"); - return -EINVAL; - } - - /* disable the PCIe->GISB memory window (RC_BAR1) */ - tmp = readl(base + PCIE_MISC_RC_BAR1_CONFIG_LO); - tmp &= ~PCIE_MISC_RC_BAR1_CONFIG_LO_SIZE_MASK; - writel(tmp, base + PCIE_MISC_RC_BAR1_CONFIG_LO); - - /* disable the PCIe->SCB memory window (RC_BAR3) */ - tmp = readl(base + PCIE_MISC_RC_BAR3_CONFIG_LO); - tmp &= ~PCIE_MISC_RC_BAR3_CONFIG_LO_SIZE_MASK; - writel(tmp, base + PCIE_MISC_RC_BAR3_CONFIG_LO); /* Don't advertise L0s capability if 'aspm-no-l0s' */ aspm_support = PCIE_LINK_STATE_L1; @@ -1516,6 +1626,7 @@ static const struct pcie_cfg_data generic_cfg = { .type = GENERIC, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, + .num_inbound = 3, }; static const struct pcie_cfg_data bcm7425_cfg = { @@ -1523,6 +1634,7 @@ static const struct pcie_cfg_data bcm7425_cfg = { .type = BCM7425, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, + .num_inbound = 3, }; static const struct pcie_cfg_data bcm7435_cfg = { @@ -1530,6 +1642,7 @@ static const struct pcie_cfg_data bcm7435_cfg = { .type = BCM7435, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, + .num_inbound = 3, }; static const struct pcie_cfg_data bcm4908_cfg = { @@ -1537,6 +1650,7 @@ static const struct pcie_cfg_data bcm4908_cfg = { .type = BCM4908, .perst_set = brcm_pcie_perst_set_4908, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, + .num_inbound = 3, }; static const int pcie_offset_bcm7278[] = { @@ -1552,6 +1666,7 @@ static const struct pcie_cfg_data bcm7278_cfg = { .type = BCM7278, .perst_set = brcm_pcie_perst_set_7278, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, + .num_inbound = 3, }; static const struct pcie_cfg_data bcm2711_cfg = { @@ -1559,6 +1674,7 @@ static const struct pcie_cfg_data bcm2711_cfg = { .type = BCM2711, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, + .num_inbound = 3, }; static const struct pcie_cfg_data bcm7216_cfg = { @@ -1567,6 +1683,7 @@ static const struct pcie_cfg_data bcm7216_cfg = { .perst_set = brcm_pcie_perst_set_7278, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, .has_phy = true, + .num_inbound = 3, }; static const struct of_device_id brcm_pcie_match[] = { @@ -1623,6 +1740,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) pcie->perst_set = data->perst_set; pcie->bridge_sw_init_set = data->bridge_sw_init_set; pcie->has_phy = data->has_phy; + pcie->num_inbound = data->num_inbound; pcie->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pcie->base)) From patchwork Tue Jul 16 21:31:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734965 X-Patchwork-Delegate: kw@linux.com Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (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 8C55C145B0F for ; Tue, 16 Jul 2024 21:32:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165538; cv=none; b=HJ5t6KSLyxjARFwiMzt0Rdu0Sl86y+xKkjqv0FK7aN36EnHJ99fA+HkPKo/87jjjrdDcNfkpabqcSDZ2tNRe6tZAKAS92NakIsKFvbryI5Mn+VDCM8G2eKdU0WLXq4MWFhxqRmjI9cTHWD4Ny+sTdRtzbA51JREcQBLm3h7jrMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165538; c=relaxed/simple; bh=qsUzdUXInW0JKZ11RkqGoykS05aC7G/tgCtmAYBOzbw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=nbfDLh4ah/NwGsfirFyEeXD9/bC2dwR92Hx0bfbQk/9YgWj9/sBF5+tK2XJPl5LS4ObMUaJUL+PEbWSO65UEE2d0jAUQcQWpZx98PK7MpCVKV/io9h3rQaQVYRWeBJ5Bko3vXD745Nx9r5RgcKwDmEwmnIzy/HMKCrZ8kkhIe3A= 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=aCWDO1N3; arc=none smtp.client-ip=209.85.210.174 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="aCWDO1N3" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-70b07bdbfbcso147362b3a.0 for ; Tue, 16 Jul 2024 14:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165535; x=1721770335; 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=bks+n/VbRmef8IqU9r5ISiYowb16wscFOQwliTnXQxs=; b=aCWDO1N3LM+z9Svqr/qW3qAAVbaHW9jcVdhHxKFQlctToTEb6daOJ+98zEAaHus4yE dhZJSmbEE6aLezrAV1ZedHUpBVdb7DM2le7zh8czsugqeP/EA/Lhe524kO1dTMuZZKLH 7yQqvN3LX6V7CbaubLuq3iUX+NVc+ADDw1tQ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165535; x=1721770335; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bks+n/VbRmef8IqU9r5ISiYowb16wscFOQwliTnXQxs=; b=jmEbg/e5B+Wbd8v2L5DnVcJXlQ6KfOIeF5yCcANGJx00fu5e+7YEn3WHHpth0YCnJo Z/whqNBGqsKC7t6P6sl38e6ZPYgkRtjvA2t2DcdiyCeilUpNnLs6PynE1uqMso+Zc/WO 1Nm8yEOX/FHUdJyujTinsxW2ACSK/Cb6fNOSJW+c3A/UnOJTYrYdJPDuQh2jColk2aQr mfiJj3+iwr95YmxlY4Xvy8Qt5ztysPCEcZYP8AqqAcFZ/LlVFCJt1UTtDu/DAmw6xE6H 4m6h4Yt9+XU3ZDFFU19jyV7mXa5EzcC3VdBER/b4Xl0Ko1roIUSyBCrpUj7VT7krQs7q wl8g== X-Gm-Message-State: AOJu0YwfOAix7ZyO9HTLS0tSRfCkNFQxG2OZXvyW+TQUZ8VQMc3q/jzT RkP9PfhB5vE7atM9YEcGi0mgYu1Q69DF5CZukIbpiEx0fSZ6H05aY1gqIZydkF4LCyso3f0d8yJ vkeRYOJRCB/Iu12NHvI0Oi/gLbr4e45tMWrw4EHh7vdBZfBJdFwqCurPOYqH27IPcE76oI1FnNs GNJxCG5tiOC0RW26xciLD+JZ4+FAWPQ7s75grHdPiB09MwXVCv X-Google-Smtp-Source: AGHT+IF3n49suP6SQrP+H1Dav6+5O1Eqi3J47jRydAlZlGts/YPBCDlSNfaWtB5vekrWc2VnHs0GXg== X-Received: by 2002:a05:6a20:7487:b0:1c0:f630:97a5 with SMTP id adf61e73a8af0-1c3f1fb382amr5190061637.10.1721165535114; Tue, 16 Jul 2024 14:32:15 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:32:14 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Philipp Zabel , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 10/12] PCI: brcmstb: Check return value of all reset_control_xxx calls Date: Tue, 16 Jul 2024 17:31:25 -0400 Message-Id: <20240716213131.6036-11-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> 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 propagate the error to the next level. Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 101 ++++++++++++++++++-------- 1 file changed, 72 insertions(+), 29 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c44a92217855..2fe1f2a26697 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -232,8 +232,8 @@ struct pcie_cfg_data { const enum pcie_type type; const bool has_phy; unsigned int num_inbound; - void (*perst_set)(struct brcm_pcie *pcie, u32 val); - void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); + int (*perst_set)(struct brcm_pcie *pcie, u32 val); + int (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); }; struct subdev_regulators { @@ -278,8 +278,8 @@ struct brcm_pcie { int num_memc; u64 memc_size[PCIE_BRCM_MAX_MEMC]; u32 hw_rev; - void (*perst_set)(struct brcm_pcie *pcie, u32 val); - void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); + int (*perst_set)(struct brcm_pcie *pcie, u32 val); + int (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); struct subdev_regulators *sr; bool ep_wakeup_capable; bool has_phy; @@ -742,13 +742,18 @@ static void __iomem *brcm7425_pcie_map_bus(struct pci_bus *bus, return base + DATA_ADDR(pcie); } -static void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val) +static int brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val) { + int ret = 0; + if (pcie->bridge) { if (val) - reset_control_assert(pcie->bridge); + ret = reset_control_assert(pcie->bridge); else - reset_control_deassert(pcie->bridge); + ret = reset_control_deassert(pcie->bridge); + if (ret) + dev_err(pcie->dev, "failed to %s 'bridge' reset, err=%d\n", + val ? "assert" : "deassert", ret); } else { u32 tmp, mask = RGR1_SW_INIT_1_INIT_GENERIC_MASK; u32 shift = RGR1_SW_INIT_1_INIT_GENERIC_SHIFT; @@ -757,9 +762,11 @@ static void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val tmp = (tmp & ~mask) | ((val << shift) & mask); writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); } + + return ret; } -static void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val) +static int brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val) { u32 tmp, mask = RGR1_SW_INIT_1_INIT_7278_MASK; u32 shift = RGR1_SW_INIT_1_INIT_7278_SHIFT; @@ -767,20 +774,29 @@ static void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val) tmp = readl(pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); tmp = (tmp & ~mask) | ((val << shift) & mask); writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); + + return 0; } -static void brcm_pcie_perst_set_4908(struct brcm_pcie *pcie, u32 val) +static int brcm_pcie_perst_set_4908(struct brcm_pcie *pcie, u32 val) { + int ret; + if (WARN_ONCE(!pcie->perst_reset, "missing PERST# reset controller\n")) - return; + return -EINVAL; if (val) - reset_control_assert(pcie->perst_reset); + ret = reset_control_assert(pcie->perst_reset); else - reset_control_deassert(pcie->perst_reset); + ret = reset_control_deassert(pcie->perst_reset); + + if (ret) + dev_err(pcie->dev, "failed to %s 'perst' reset, err=%d\n", + val ? "assert" : "deassert", ret); + return ret; } -static void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val) +static int brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val) { u32 tmp; @@ -788,15 +804,19 @@ static void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val) tmp = readl(pcie->base + PCIE_MISC_PCIE_CTRL); u32p_replace_bits(&tmp, !val, PCIE_MISC_PCIE_CTRL_PCIE_PERSTB_MASK); writel(tmp, pcie->base + PCIE_MISC_PCIE_CTRL); + + return 0; } -static void brcm_pcie_perst_set_generic(struct brcm_pcie *pcie, u32 val) +static int brcm_pcie_perst_set_generic(struct brcm_pcie *pcie, u32 val) { u32 tmp; tmp = readl(pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); u32p_replace_bits(&tmp, val, PCIE_RGR1_SW_INIT_1_PERST_MASK); writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); + + return 0; } static inline void set_bar(struct rc_bar *b, int *count, u64 size, @@ -1008,19 +1028,28 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) struct resource_entry *entry; u32 tmp, burst, aspm_support; int num_out_wins = 0, num_rc_bars = 0; - int memc; + int memc, ret; /* Reset the bridge */ - pcie->bridge_sw_init_set(pcie, 1); + ret = pcie->bridge_sw_init_set(pcie, 1); + if (ret) + return ret; /* Ensure that PERST# is asserted; some bootloaders may deassert it. */ - if (pcie->type == BCM2711) - pcie->perst_set(pcie, 1); + if (pcie->type == BCM2711) { + ret = pcie->perst_set(pcie, 1); + if (ret) { + pcie->bridge_sw_init_set(pcie, 0); + return ret; + } + } usleep_range(100, 200); /* Take the bridge out of reset */ - pcie->bridge_sw_init_set(pcie, 0); + ret = pcie->bridge_sw_init_set(pcie, 0); + if (ret) + return ret; tmp = readl(base + HARD_DEBUG(pcie)); if (is_bmips(pcie)) @@ -1239,7 +1268,9 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie) int ret, i; /* Unassert the fundamental reset */ - pcie->perst_set(pcie, 0); + ret = pcie->perst_set(pcie, 0); + if (ret) + return ret; /* * Wait for 100ms after PERST# deassertion; see PCIe CEM specification @@ -1431,15 +1462,17 @@ static inline int brcm_phy_stop(struct brcm_pcie *pcie) return pcie->has_phy ? brcm_phy_cntl(pcie, 0) : 0; } -static void brcm_pcie_turn_off(struct brcm_pcie *pcie) +static int brcm_pcie_turn_off(struct brcm_pcie *pcie) { void __iomem *base = pcie->base; - int tmp; + int tmp, ret; if (brcm_pcie_link_up(pcie)) brcm_pcie_enter_l23(pcie); /* Assert fundamental reset */ - pcie->perst_set(pcie, 1); + ret = pcie->perst_set(pcie, 1); + if (ret) + return ret; /* Deassert request for L23 in case it was asserted */ tmp = readl(base + PCIE_MISC_PCIE_CTRL); @@ -1452,7 +1485,9 @@ static void brcm_pcie_turn_off(struct brcm_pcie *pcie) writel(tmp, base + HARD_DEBUG(pcie)); /* Shutdown PCIe bridge */ - pcie->bridge_sw_init_set(pcie, 1); + ret = pcie->bridge_sw_init_set(pcie, 1); + + return ret; } static int pci_dev_may_wakeup(struct pci_dev *dev, void *data) @@ -1470,9 +1505,12 @@ static int brcm_pcie_suspend_noirq(struct device *dev) { struct brcm_pcie *pcie = dev_get_drvdata(dev); struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); - int ret; + int ret, rret; + + ret = brcm_pcie_turn_off(pcie); + if (ret) + return ret; - brcm_pcie_turn_off(pcie); /* * If brcm_phy_stop() returns an error, just dev_err(). If we * return the error it will cause the suspend to fail and this is a @@ -1501,7 +1539,10 @@ static int brcm_pcie_suspend_noirq(struct device *dev) pcie->sr->supplies); if (ret) { dev_err(dev, "Could not turn off regulators\n"); - reset_control_reset(pcie->rescal); + rret = reset_control_reset(pcie->rescal); + if (rret) + dev_err(dev, "failed to reset 'rascal' controller ret=%d\n", + rret); return ret; } } @@ -1516,7 +1557,7 @@ static int brcm_pcie_resume_noirq(struct device *dev) struct brcm_pcie *pcie = dev_get_drvdata(dev); void __iomem *base; u32 tmp; - int ret; + int ret, rret; base = pcie->base; ret = clk_prepare_enable(pcie->clk); @@ -1578,7 +1619,9 @@ static int brcm_pcie_resume_noirq(struct device *dev) if (pcie->sr) regulator_bulk_disable(pcie->sr->num_supplies, pcie->sr->supplies); err_reset: - reset_control_rearm(pcie->rescal); + rret = reset_control_rearm(pcie->rescal); + if (rret) + dev_err(pcie->dev, "failed to rearm 'rescal' reset, err=%d\n", rret); err_disable_clk: clk_disable_unprepare(pcie->clk); return ret; From patchwork Tue Jul 16 21:31:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734966 X-Patchwork-Delegate: kw@linux.com Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 9C5BC143898 for ; Tue, 16 Jul 2024 21:32:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165543; cv=none; b=XP5H003OZiZ+B5lnXmfv/3D7Rqu5bDhXl+Obxgw+Wmsm2KVWGf6HDpmmfKfGXSutDCQguMYyKVrcvgD+rL4dwZ2D8sc7dQEBMSJWI0emFuB6l9pTa/SHiVlgoRm/g27cGO0bxT+RKIex4wq/R6sk/PTCZKKoVOV+eYhdpEYdt4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165543; c=relaxed/simple; bh=TC1U5tyTxGYt1MBH8C3oTkPwP9JnTgiG8hcH7kJgemo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=DHru51zNW0ObXqjwAC/bsr11t29/YohdDc3ii8WNZ7wCFuzVY1OnbD0aB35mO9b2g0yX8bwk6R7n+2M2av6l8PvnSNJI/NEzYgUTy4dfI0p0yKiXh3fnIcRU9CF5PqtzNJuWhTxHkPPx8uyG12I6LPEKyr3eTKK67H2bjfxzZHg= 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=R9h8gGFp; arc=none smtp.client-ip=209.85.210.173 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="R9h8gGFp" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-70b31272a04so122279b3a.1 for ; Tue, 16 Jul 2024 14:32:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165539; x=1721770339; 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=iyT2L2Twi325SiV+6njhsVpKWqQ/IDKq+ZlXdzosV1M=; b=R9h8gGFpqrncihhKN0fv/+6TtPHk73V/3hp9SnSmn3e/gTtFYgiGY44PFzXQuJtY0U 9llrJU6Y702L1wizNCeC5M/nE2kaZ2jZL0DNHDOcVd+zViljk59sOamUfVsa/49sEPI3 gMJrBhll+RAxKDuokBhj+GoXGiT1u4gUs/6tI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165539; x=1721770339; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iyT2L2Twi325SiV+6njhsVpKWqQ/IDKq+ZlXdzosV1M=; b=RXfPeYjlY81R19r627/p7+d2+VqgWZSETRRAfEGjZgCzbSVMNdcWztisHqECUJicao z1b5BZufOA9S6MgZsIJFtB0u6KZlbTn3Ui7wPkfv7xQT10ABCOOSg7DS0pQfX8VP3CAJ H6k5h7EkCpQ8xefkc/WkHm4idmCEUH2ckJ6Rq+63kZPRzxChZbxqVP28VgjXvNKfqYQh ciTGEFStUGheMGa2eUdXUeiL05gC3/LTa/r5kAnncROTosdmr+pbl9QnCGsEVd+nz1vx oUJh8qDTK+252HFtQ+2XEExa0ZlIpJZf26v0aLNnDUnLjMDZXVLNGkHbaLzZDKL1RNkS XxHg== X-Gm-Message-State: AOJu0Yw/136a9dT7n6uzcXd8brUZ4f2NGlh9HcjwmoPHSBsFKxHA+ygz jB/trrcX6koDU9SSoR7THJXXGVUCmPEX1r4TTLrhxyk9ehWHM2pCtWu4pPUJg1xUzvxjcfsMD4W l/HT/sNBpE1XXUAKkKeRvRUXzFcgxc9Xo6zbHTWcRale3ibiGkxNOsbJM/W4pJQ78jGxN2xdX39 aBgZiLnSlbkjWNUnBlsDIE/DcmIYYP06fdveiYxot5bip9LgUn X-Google-Smtp-Source: AGHT+IGx3fCh6S2QfTNtvLqxaswCxSc1oIJxvnMZ0D0dcPdjNSV74JcS7F3v925N9gUIHSu7fi3oxg== X-Received: by 2002:a05:6a20:7487:b0:1c0:f630:97a5 with SMTP id adf61e73a8af0-1c3f1fb382amr5190270637.10.1721165538637; Tue, 16 Jul 2024 14:32:18 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:32:18 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 11/12] PCI: brcmstb: Change field name from 'type' to 'model' Date: Tue, 16 Jul 2024 17:31:26 -0400 Message-Id: <20240716213131.6036-12-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> 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 Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 42 +++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 2fe1f2a26697..fa5616a56383 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -211,7 +211,7 @@ enum { PCIE_INTR2_CPU_BASE, }; -enum pcie_type { +enum pcie_model { GENERIC, BCM7425, BCM7435, @@ -229,7 +229,7 @@ struct rc_bar { struct pcie_cfg_data { const int *offsets; - const enum pcie_type type; + const enum pcie_model model; const bool has_phy; unsigned int num_inbound; int (*perst_set)(struct brcm_pcie *pcie, u32 val); @@ -270,7 +270,7 @@ struct brcm_pcie { u64 msi_target_addr; struct brcm_msi *msi; const int *reg_offsets; - enum pcie_type type; + enum pcie_model model; struct reset_control *rescal; struct reset_control *perst_reset; struct reset_control *bridge; @@ -288,7 +288,7 @@ struct brcm_pcie { static inline bool is_bmips(const struct brcm_pcie *pcie) { - return pcie->type == BCM7435 || pcie->type == BCM7425; + return pcie->model == BCM7435 || pcie->model == BCM7425; } /* @@ -852,7 +852,7 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie, * security considerations, and is not implemented in our modern * SoCs. */ - if (pcie->type != BCM7712) + if (pcie->model != BCM7712) set_bar(b++, &n, 0, 0, 0); resource_list_for_each_entry(entry, &bridge->dma_ranges) { @@ -869,7 +869,7 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie, * That being said, each BARs size must still be a power of * two. */ - if (pcie->type == BCM7712) + if (pcie->model == BCM7712) set_bar(b++, &n, size, cpu_beg, pcie_beg); if (n > pcie->num_inbound) @@ -886,7 +886,7 @@ static int brcm_pcie_get_inbound_wins(struct brcm_pcie *pcie, * that enables multiple memory controllers. As such, it can return * now w/o doing special configuration. */ - if (pcie->type == BCM7712) + if (pcie->model == BCM7712) return n; ret = of_property_read_variable_u64_array(pcie->np, "brcm,scb-sizes", pcie->memc_size, 1, @@ -1008,7 +1008,7 @@ static void set_inbound_win_registers(struct brcm_pcie *pcie, const struct rc_ba * 7712: * All of their BARs need to be set. */ - if (pcie->type == BCM7712) { + if (pcie->model == BCM7712) { /* BUS remap register settings */ reg_offset = brcm_ubus_reg_offset(i); tmp = lower_32_bits(cpu_addr) & ~0xfff; @@ -1036,7 +1036,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) return ret; /* Ensure that PERST# is asserted; some bootloaders may deassert it. */ - if (pcie->type == BCM2711) { + if (pcie->model == BCM2711) { ret = pcie->perst_set(pcie, 1); if (ret) { pcie->bridge_sw_init_set(pcie, 0); @@ -1067,9 +1067,9 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) */ if (is_bmips(pcie)) burst = 0x1; /* 256 bytes */ - else if (pcie->type == BCM2711) + else if (pcie->model == BCM2711) burst = 0x0; /* 128 bytes */ - else if (pcie->type == BCM7278) + else if (pcie->model == BCM7278) burst = 0x3; /* 512 bytes */ else burst = 0x2; /* 512 bytes */ @@ -1666,7 +1666,7 @@ static const int pcie_offsets_bmips_7425[] = { static const struct pcie_cfg_data generic_cfg = { .offsets = pcie_offsets, - .type = GENERIC, + .model = GENERIC, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound = 3, @@ -1674,7 +1674,7 @@ static const struct pcie_cfg_data generic_cfg = { static const struct pcie_cfg_data bcm7425_cfg = { .offsets = pcie_offsets_bmips_7425, - .type = BCM7425, + .model = BCM7425, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound = 3, @@ -1682,7 +1682,7 @@ static const struct pcie_cfg_data bcm7425_cfg = { static const struct pcie_cfg_data bcm7435_cfg = { .offsets = pcie_offsets, - .type = BCM7435, + .model = BCM7435, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound = 3, @@ -1690,7 +1690,7 @@ static const struct pcie_cfg_data bcm7435_cfg = { static const struct pcie_cfg_data bcm4908_cfg = { .offsets = pcie_offsets, - .type = BCM4908, + .model = BCM4908, .perst_set = brcm_pcie_perst_set_4908, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound = 3, @@ -1706,7 +1706,7 @@ static const int pcie_offset_bcm7278[] = { static const struct pcie_cfg_data bcm7278_cfg = { .offsets = pcie_offset_bcm7278, - .type = BCM7278, + .model = BCM7278, .perst_set = brcm_pcie_perst_set_7278, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, .num_inbound = 3, @@ -1714,7 +1714,7 @@ static const struct pcie_cfg_data bcm7278_cfg = { static const struct pcie_cfg_data bcm2711_cfg = { .offsets = pcie_offsets, - .type = BCM2711, + .model = BCM2711, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound = 3, @@ -1722,7 +1722,7 @@ static const struct pcie_cfg_data bcm2711_cfg = { static const struct pcie_cfg_data bcm7216_cfg = { .offsets = pcie_offset_bcm7278, - .type = BCM7278, + .model = BCM7278, .perst_set = brcm_pcie_perst_set_7278, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, .has_phy = true, @@ -1779,7 +1779,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) pcie->dev = &pdev->dev; pcie->np = np; pcie->reg_offsets = data->offsets; - pcie->type = data->type; + pcie->model = data->model; pcie->perst_set = data->perst_set; pcie->bridge_sw_init_set = data->bridge_sw_init_set; pcie->has_phy = data->has_phy; @@ -1848,7 +1848,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) goto fail; pcie->hw_rev = readl(pcie->base + PCIE_MISC_REVISION); - if (pcie->type == BCM4908 && pcie->hw_rev >= BRCM_PCIE_HW_REV_3_20) { + if (pcie->model == BCM4908 && pcie->hw_rev >= BRCM_PCIE_HW_REV_3_20) { dev_err(pcie->dev, "hardware revision with unsupported PERST# setup\n"); ret = -ENODEV; goto fail; @@ -1863,7 +1863,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) } } - bridge->ops = pcie->type == BCM7425 ? &brcm7425_pcie_ops : &brcm_pcie_ops; + bridge->ops = pcie->model == BCM7425 ? &brcm7425_pcie_ops : &brcm_pcie_ops; bridge->sysdata = pcie; platform_set_drvdata(pdev, pcie); From patchwork Tue Jul 16 21:31:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734967 X-Patchwork-Delegate: kw@linux.com Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 7F8A514600C for ; Tue, 16 Jul 2024 21:32:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165544; cv=none; b=fOB7tlokvsOWKvk1/ND5iGe+w+DPHZpc9/2UXxytkOjQL7peUevUTvC1Cm/wNJ4H9/94uGwz4sEUJa1Xnfiu6rY519LGS/ftKR0n+PrtViGrdTNhcbNfxw/MsGfvNsD7vagxMRUZdHjQTWp1hRn17XKrfj6hyYb866zZKdneVJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721165544; c=relaxed/simple; bh=C2p2QHrHO86v8QlhU3nQeNCgnFdoGliH8iSzjZ1qojw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=nKKKnVqsv1w3qQsmkT6g+iVhug9Yk6Z47hnYldyX77DeMIi/WdPUo1W6kCOYWjF5zeCT+1sjqGnQDNFGI93X5hx7yGzS8po1PdhV1qypYeQguK6ugDUTILlA4cBFMQfC4HTkHjuFsLOt/dWm+ynDelDgFBdSTnVSVlJNn3FTkTw= 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=ImptZRS8; arc=none smtp.client-ip=209.85.210.173 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="ImptZRS8" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-70b0d0a7a56so4590727b3a.0 for ; Tue, 16 Jul 2024 14:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165542; x=1721770342; 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=bDu58s/yu8k7/K65TlDoP49u82ZMCl/2qPk9wT4mQSk=; b=ImptZRS8HPC+ISjz3v9yw+zs0xyJmb87wjcCFWTZjppcYeNYzgxKTFLd+rEyOzpxZ9 e4biQ/bTsWhKJwdHBu+0DDXdfBwy7MScRMIWFxUr3sg2zTK8dr1f7WINppia7jDZadmN cGVsfBLjbcasRQW++zv9835Fp7bslqkCXJpPc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165542; x=1721770342; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bDu58s/yu8k7/K65TlDoP49u82ZMCl/2qPk9wT4mQSk=; b=uFa2V6uvgil9mssJbjFaGQ/DJRX9O9RlT/cB+0aRf8vRsORTbCyxathSlcs1VY12AW obYaUwIFqLo2aIcpnZZNS94fAHPCn1lGp2s8qF1RYN7MjglxdEVsGBb7S+NXFmw5EDuZ FtcghxixxW+X8tEETigkPnErXkO4DRIHCM446evZgUbV4DHJ8wHzWFPMU94yA3t4uYdF kIOrry43O+mFmggF0C6w41wQNe04IlyirVMbbkIH7DcM/XBktks7Zu/LE1EF6R2bdO8z XrPP4X9JoiQtlJndNFxhlYG8bSWryTgTPOo5dJriQYgPov6ZCB+KePwKWbPHMFdgvxqT Q1Xg== X-Gm-Message-State: AOJu0YyD1JY34NsnsOlBQqBxj5S9J9IOw/iDs3EQ+EXk++ga6gp1ntRO xzvenLc2xkd3Gyhzw6o4G1F6C+LL6hmYN2z/iZgDl1nnWbs3xsbiAVus/MxrIYYdFcdnVy0O85c pg3c+tCoQr8mxRWqB+ai7uOmojHLEzDZFrnCVTc30oGMqyvAM/JH+pfbDe6pVTjU4MqQkBsEdKa 7PORPvGhAqeK/OQBRJillTFuNESL8F9Q06Pp629bW06BQcvw== X-Google-Smtp-Source: AGHT+IH0Y9+x+k35oeCTVD3LE8/SAcgucMDAoq8oz6zUhM4uRLOH0VIwFmwWNPm22oM56uujdUQQpA== X-Received: by 2002:a05:6a00:2e15:b0:70a:fa4c:4b28 with SMTP id d2e1a72fcca58-70c1fbe1812mr4531776b3a.15.1721165542191; Tue, 16 Jul 2024 14:32:22 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:32:21 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 12/12] PCI: brcmstb: Enable 7712 SOCs Date: Tue, 16 Jul 2024 17:31:27 -0400 Message-Id: <20240716213131.6036-13-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> 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 Reviewed-by: Florian Fainelli Tested-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index fa5616a56383..7debb3599789 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1193,6 +1193,10 @@ static void brcm_extend_rbus_timeout(struct brcm_pcie *pcie) const unsigned int REG_OFFSET = PCIE_RGR1_SW_INIT_1(pcie) - 8; u32 timeout_us = 4000000; /* 4 seconds, our setting for L1SS */ + /* 7712 does not have this (RGR1) timer */ + if (pcie->model == BCM7712) + return; + /* Each unit in timeout register is 1/216,000,000 seconds */ writel(216 * timeout_us, pcie->base + REG_OFFSET); } @@ -1664,6 +1668,13 @@ static const int pcie_offsets_bmips_7425[] = { [PCIE_INTR2_CPU_BASE] = 0x4300, }; +static const int pcie_offset_bcm7712[] = { + [EXT_CFG_INDEX] = 0x9000, + [EXT_CFG_DATA] = 0x9004, + [PCIE_HARD_DEBUG] = 0x4304, + [PCIE_INTR2_CPU_BASE] = 0x4400, +}; + static const struct pcie_cfg_data generic_cfg = { .offsets = pcie_offsets, .model = GENERIC, @@ -1729,6 +1740,14 @@ static const struct pcie_cfg_data bcm7216_cfg = { .num_inbound = 3, }; +static const struct pcie_cfg_data bcm7712_cfg = { + .offsets = pcie_offset_bcm7712, + .perst_set = brcm_pcie_perst_set_7278, + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, + .model = BCM7712, + .num_inbound = 10, +}; + static const struct of_device_id brcm_pcie_match[] = { { .compatible = "brcm,bcm2711-pcie", .data = &bcm2711_cfg }, { .compatible = "brcm,bcm4908-pcie", .data = &bcm4908_cfg }, @@ -1738,6 +1757,7 @@ static const struct of_device_id brcm_pcie_match[] = { { .compatible = "brcm,bcm7445-pcie", .data = &generic_cfg }, { .compatible = "brcm,bcm7435-pcie", .data = &bcm7435_cfg }, { .compatible = "brcm,bcm7425-pcie", .data = &bcm7425_cfg }, + { .compatible = "brcm,bcm7712-pcie", .data = &bcm7712_cfg }, {}, };