From patchwork Thu Aug 15 22:57:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13765260 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61367C531DE for ; Thu, 15 Aug 2024 22:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CRQkGsiqV7c3oa7/BSip4AQK8e/kbD1gffw1TrJCVrE=; b=RnfRYiZYsvXUNYW6WmkLzNAnEF 3tT7zSbZm6GDL0eEGwuhJFRQX1kIYwiM1Hh0Lq54/fMci+c1/DHAMiZ6uRjzj7IT0QB8C3ir0O9x+ rcP8BujeNfgwYSv+8pbsnMCrdT+UQB5qMhEepv+tSP4HMlo20lyDX7gy+5R5FP7A3omz2iV1n7aCt 0dH/Oy+YgM2RucOHsv0cmLWBJpL1E7jKfzwTxJ5yjI8HUr5GpMgRdan9jEoB4ufEGrDTAj+zViAjx lSJMHMlY4xaT2syFi1HoCCUAj9Sfj7sTKXbNuBTsEV4+jNmojsCtatHrw6j1daTfranDY3sZaVQK0 yd1bybkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejR1-0000000BEVM-173L; Thu, 15 Aug 2024 22:59:11 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejPc-0000000BDyD-40eV for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:57:46 +0000 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2d3e46ba5bcso185324a91.0 for ; Thu, 15 Aug 2024 15:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762664; x=1724367464; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=CRQkGsiqV7c3oa7/BSip4AQK8e/kbD1gffw1TrJCVrE=; b=fN73LPDGDAEfEdwvYPc6n7JjdfHWg/RMfgjuEThcrMazOmqO6LrfvJQ65X6Ae5OVaG 54N4qKtlYBdT2gaEFOV+YnTa2ijMkKzBiXHtvt+jg6tPHa+Tiw+3blCgaujcwqCISg9x vrsaBkJmbA45WUJUguK0e0klvjLSdDjY6K+4U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762664; x=1724367464; 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=CRQkGsiqV7c3oa7/BSip4AQK8e/kbD1gffw1TrJCVrE=; b=wa876zfFf6cbZWZm4HL0G/np7y3dsue9XZzm6G/asSAE3Xc41a/5YBJkb5JzQkF3As LxVttPGvL2qn+v5htSnzglZafXt4lLVV255iWYqIuFkW7EsCxqlbQJYVXhLaQpFp6sSj S3Ji9NX/fdOmoJYXYc/qnKSNoInzZpt/nAUHeMTUNzbwN/YTBhIdnpzsxkjcpBVezhJo 3AlMbW4K77I+nFDvjg2ZjRweL5wx1UUi1zntZu6AEB3i7jVWgKnTsSIHh4j1sJUycwWS z/4LUX0gre9Y6/eHE+vbtrISN0gIG4hBse/v9diB+t3jQATgMewiv0Bc/c+4CSQGZWsm DAxA== X-Forwarded-Encrypted: i=1; AJvYcCWnMA/lsQIObXD9v+CmLd1FfYHEzWgBeCiqbkLrUpkF6AxVd8yAOPtC8XClShHP5j5rPQcVvMAMII3oq/DWcRgSbzPj/J9e7stCtKp0DX8sLt0k6AY= X-Gm-Message-State: AOJu0YzKrSoHfLO/ABfdVgd7ApAZPC0fKa607JJm0HDPEfMVE8gZGdk0 6529NPz8mKelT7EIxsNbVIJt4P375wAPHJepGXpgi7lCCqJ1LIrXkyZx1X5lVQ== X-Google-Smtp-Source: AGHT+IGsU40PJngMIcYStf9Y9iTSE0jy+3YSJCHPXuJiJMQETsILw9S6JXDYzZrXRLDatiqnRms03g== X-Received: by 2002:a17:90b:950:b0:2cf:c9ab:e727 with SMTP id 98e67ed59e1d1-2d3e00ef66emr1270794a91.31.1723762663566; Thu, 15 Aug 2024 15:57:43 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:57:43 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , 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 v6 01/13] dt-bindings: PCI: Change brcmstb maintainer and cleanup Date: Thu, 15 Aug 2024 18:57:14 -0400 Message-Id: <20240815225731.40276-2-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155745_009204_53668438 X-CRM114-Status: GOOD ( 10.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. Also, alphabetize the compatible strings. Signed-off-by: Jim Quinlan Reviewed-by: Krzysztof Kozlowski Reviewed-by: Florian Fainelli --- Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 11f8ea33240c..a95760357335 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 From patchwork Thu Aug 15 22:57:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13765261 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45360C52D7F for ; Thu, 15 Aug 2024 23:00:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rVX8RgTSHm6Ud+EOy6KQv9jtPehvGxMYRqmnhzhp8AI=; b=bD2Te/nC1jME/0rZaMREjzUDkr 2gvY/y3zUMTkSRlob4xlW+C/vt++fEGqTnaAn/Vtxz86lbHttA53+B/7jE/r/CLuikJadUdXn2T8r CP8+9fZwOzwvvnDSiJPdt1SD83wzmccc6lttQZP9ShUYx0LmYQwzMcWwIv92GE2CdYZ8mnQSv19r8 oHpiPEhm+BAZ2UnxXAXmsBw6XWu3FF5xn4Y2Kaxun8Q53/x8a0lIpSO5/6+xLLLD0rnAl5utN+wAy Vz31ZA6dVo6TaZb4mx+plQ/TqBGIjnEIqr0lvhmH6gRCSQqfbzbQ2p1/+RqpZ2rF6L/SZQwGGhCkK IyzgrQrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejRd-0000000BEiP-1Dd5; Thu, 15 Aug 2024 22:59:49 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejPg-0000000BDz8-1098 for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:57:49 +0000 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-2d3bd8784d3so1036057a91.3 for ; Thu, 15 Aug 2024 15:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762668; x=1724367468; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=rVX8RgTSHm6Ud+EOy6KQv9jtPehvGxMYRqmnhzhp8AI=; b=GVRF5PjddQgbzG24SS8WibyhtC900+2GCB9dE2M8Tzdo2v8oTomk7hcyfdHGthsDwh srlGaBNWzNLWdD3sj6tH2qU0QKJup2REYECoRkpAAOpAw2YMiNVF3+b8zYlF+f++2gSw qK6DcXipQoxLkjgBv3Ik3Zu2qP5ygtVyYLcZQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762668; x=1724367468; 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=rVX8RgTSHm6Ud+EOy6KQv9jtPehvGxMYRqmnhzhp8AI=; b=H2G2l5h4DwtApl00AU2kEdND9yrJPVmCl2To1KfE0VCjJ5Ld9fJP6lBMj/0aQPxA6D F7uE0YYONOPyVc71DzzaNUdYbQO4SqCfb0a9EqGUj4mm2W1RTRe0+D23S5VxMD/MyOVV XjCYpYNdOdrAgz4rtvfbmvw+H9t8SidU8/FbhMcZXy0SmRe6i1/sHgU2hC5ahIwesu+q WV5GzDFrvs9QDIEFuKzynmDp+hTL9ABPWDTvfj6lDcmCsZEPSgXpUN5JnDiw9wO930lg /fL2IO9e1L4SE/6h/8NN55Bdwz1p6eNd4TJN7jdYysTQDBitsVZtAkFU6y8jiUutHtNP aEvA== X-Forwarded-Encrypted: i=1; AJvYcCUHqV0fAV9oUjSm0UhznE/fQF0brINejpuZ45NnghRXWDwNjzZsTCjZN7eOc3d70lBgtlR9fyRDrwiV3wiMH2pw@lists.infradead.org X-Gm-Message-State: AOJu0YwwcLYA8MLRt4Is+a07penH4WPMpaI+YlrrCIzNZ2jJkoser4aj t7fY7j6J4k8kGom4GG3y62JEpGjL9onkDhwldVmuq2yR0K9s3X8JIqL0gQz5pw== X-Google-Smtp-Source: AGHT+IHSw9iGIF7jSQYmCh7ib0/magiimviqCOLAhlU6p/vcHiPwZp1T83vzp8QlMpOVHkAjvKbGiQ== X-Received: by 2002:a17:90a:bd0c:b0:2d3:b83f:75a with SMTP id 98e67ed59e1d1-2d3dfc7d307mr1357300a91.21.1723762667484; Thu, 15 Aug 2024 15:57:47 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.57.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:57:47 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE), linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v6 02/13] dt-bindings: PCI: Use maxItems for reset controllers Date: Thu, 15 Aug 2024 18:57:15 -0400 Message-Id: <20240815225731.40276-3-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155748_299415_6B3EAA06 X-CRM114-Status: GOOD ( 10.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Provide the maxItem property for the reset controllers and drop their superfluous descriptions. Signed-off-by: Jim Quinlan Reviewed-by: Krzysztof Kozlowski Reviewed-by: Florian Fainelli --- .../devicetree/bindings/pci/brcm,stb-pcie.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index a95760357335..7d2552192153 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -95,6 +95,12 @@ properties: minItems: 1 maxItems: 3 + resets: + maxItems: 1 + + reset-names: + maxItems: 1 + required: - compatible - reg @@ -118,8 +124,7 @@ allOf: then: properties: resets: - items: - - description: reset controller handling the PERST# signal + maxItems: 1 reset-names: items: @@ -136,8 +141,7 @@ allOf: then: properties: resets: - items: - - description: phandle pointing to the RESCAL reset controller + maxItems: 1 reset-names: items: From patchwork Thu Aug 15 22:57: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: 13765262 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7BA27C52D7F for ; Thu, 15 Aug 2024 23:00:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WH+rdrTcxkg59J1njd2uJ3iEEueSc8kUH0E7SDV6ulc=; b=pGd0gieIBJxy1BH5TemKo0sHbe OvXIEqjzPnpUR3OtC5A658wy2j3wEmaaCoPq9+zGyljGv7BLGNRpFtB04du1WMw1Quuns6sSxgM5J Yu98kXhyv+a2vGt5EkbBDq+y5tzeXuuakeUTwUumknpPw23JI13RTeFfV4KjPANkL04kx+cOwv/uh +rZiYJD3nNRzyVWSANF2Xh/yF3KLZ0N21c27hpyujiUdQTduhBEFDfp8GhdyjQaY6frWzlohedq+z mmguEvRuXJmub9xzN9MlpqPtOUiw1AcAMziP/YxqYvWxwxPQCKHt9tPlN39QJ+tt384FkAqEWVL2T N5QNq2Rg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejSJ-0000000BExE-2NTt; Thu, 15 Aug 2024 23:00:31 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejPk-0000000BE0R-2lDZ for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:57:54 +0000 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-2d3ec4bacc5so8930a91.1 for ; Thu, 15 Aug 2024 15:57:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762671; x=1724367471; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=WH+rdrTcxkg59J1njd2uJ3iEEueSc8kUH0E7SDV6ulc=; b=DaWrmjmxcQgyz6vJmGKNXKrXJPSHAYkHko5TmZO33xK8EUB86mpwyqsLQ2Tgv1nu4z /uJCNKmVo66dIWgVf8k4nHY31VWlpGtJFwn7N4M90/hg4tVkElBZwyly1kUA67P0MpXB M24xcerYPMOjRqXcxotwutec924yS3MRxS9aQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762671; x=1724367471; 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=WH+rdrTcxkg59J1njd2uJ3iEEueSc8kUH0E7SDV6ulc=; b=al1D866hf1wZRAzrV7xTNDFkkFp7vHPjWaTQxFdMRlMI1waxST3cnLEqlwwgMTQjRI 58CeygufFweTWgD3iYUT8lIAEIXDOgzso2D0CXCkXgv0awnQ6fVIhj4Y1TgBPSLujuAy OprgGcgXbyX/B+colPWCva6TcbQtD4JqVkHqC/WUTF7Vp3MENLgsvTXzPqrBIFMYcjIN teVhBjp1dsI19JpwHdN6cvXcAfPie7iY5XuNDH57gabnPMpVUr6hPqhU767d3RsMMAvC RuSixMl98QuqFBsoCZVRqgjWKismvocl8krrBgTyW0cWDyTuZtsRPGe1DtFM14tgp6AI e8dQ== X-Forwarded-Encrypted: i=1; AJvYcCUYl9QqFk0nqVaUskCx06HckFcnqLGfw7Cp2wwpzlgLq2Aylsi3kkGhUD4QQXSEBqFCCg4aeoumfe28uRPG6YID@lists.infradead.org X-Gm-Message-State: AOJu0YzRQD/5zRfH/tQvXfzHY7YBkmAp1GBtpU0oWxaS8z3jtd5Rc9bN RXT7IIc5IA1MdaGRlryXQcoaX9SHZ/GkzlTEdHWlc4BVgY6aUX7VEg/BTANl1w== X-Google-Smtp-Source: AGHT+IG376HhZUZrhW7Ph9mF+C01Bg0t7yn8TgdDnPPnyffSrZWUI6fa4Ar3i5RUImonP2U2TFaBsQ== X-Received: by 2002:a17:90a:b114:b0:2cf:f860:f13b with SMTP id 98e67ed59e1d1-2d3e45d598bmr1129974a91.17.1723762671402; Thu, 15 Aug 2024 15:57:51 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:57:51 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , 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 v6 03/13] dt-bindings: PCI: brcmstb: Add 7712 SoC description Date: Thu, 15 Aug 2024 18:57:16 -0400 Message-Id: <20240815225731.40276-4-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155752_713440_9BA01AF0 X-CRM114-Status: GOOD ( 10.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add description for the 7712 SoC, a Broadcom STB sibling chip of the RPi 5. The 7712 uses three reset controllers: rescal, for phy reset calibration; bridge, for the bridge between the PCIe bus and the memory bus; and swinit, which is a "soft" initialization of the PCIe HW. Signed-off-by: Jim Quinlan Reviewed-by: Florian Fainelli Reviewed-by: Krzysztof Kozlowski --- .../bindings/pci/brcm,stb-pcie.yaml | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 7d2552192153..0925c520195a 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 @@ -96,10 +97,12 @@ properties: maxItems: 3 resets: - maxItems: 1 + minItems: 1 + maxItems: 3 reset-names: - maxItems: 1 + minItems: 1 + maxItems: 3 required: - compatible @@ -151,6 +154,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 Thu Aug 15 22:57: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: 13765263 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF344C531DE for ; Thu, 15 Aug 2024 23:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oFI8arKdNkGnCtRjmqMHmug8W/dZT+YtS9MCra9oudk=; b=HNzt2+myYY0dyixhB8Dwl5KRlg XQQbdQ70G36xVaBHhBwLwX8KM2uRgM8BCrU3UO9S4TSnOM8Ai+345zxMff05jJnMKnkm2zW0iFGxT yj2mDSAqmTO46LAQzOt0s3OeUnyaO3bBf46l+azE3NI+BZTiGQmbCyseXP/R6GDQ0gTCWvq9wFHy4 mKhisvcAh6F7oFnSC4FArqzam2H1H9KXkh0PDNKOaFY8Pxt3RNpNFCDxS0OBYb74LUxPfLBHWRjzR sLThEjtKVBjIwR4vzniRLwCi/5/jop0HsZAod8DeG40qDnxA3mFkPt7o8Li7KVfPG32WjgYNc5iem KnCVpNig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejSv-0000000BF9a-2Sp4; Thu, 15 Aug 2024 23:01:09 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejPp-0000000BE2g-0gUt for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:57:58 +0000 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-2d3c098792bso1104230a91.1 for ; Thu, 15 Aug 2024 15:57:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762675; x=1724367475; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=oFI8arKdNkGnCtRjmqMHmug8W/dZT+YtS9MCra9oudk=; b=B+qjiBS92topSOloV1I+BTEe2yC6pZkOBgYbXPbDe/y33y8ZjejX5XgVOcEFQzwRSq tOzttBHpdjtg6jQomnMzubmTC4CjxeZ0d9M/0SrNYL6gWD09e9rACJb2FSwU+Dw/x00d IojpPeOVt7oBfYFcn9+YCvN2d+k6kBZP5iz5M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762675; x=1724367475; 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=oFI8arKdNkGnCtRjmqMHmug8W/dZT+YtS9MCra9oudk=; b=OFMcNJBpgChbBjQMZWUtV0IXGJf2xxFPPrK82MlHc5kOPOFFpno/MZA/nh5pk9ZWFj RYM0fsD4mJbw338cPMFQwdsl60H02dCzLmTb7pHUJwBpufAJhBHDAdbjZYQVI3qj/6to 6cmNzTsFFomy/fMyLGSwfmoD0rv7TGFs6qaU4vmUQjDtu3Lf2kUSTkL4zT+H91bgsMB7 4P0b07ZRYSkNYfwOJiE5FSwiaONV9o6ZubXi6vuQxs1/jN5BSOa3R05tkbbfDdU3CUHA Tx+j3QqeUYfI8VWzRlDjOe/gXYUQ4FlnKwq83OmlqMkxGylzQKvBFBQMZK7gt6Eg1BTX oDQA== X-Forwarded-Encrypted: i=1; AJvYcCW4iFU5wxY/K7X5Qrkc9NiooqKblRnV1vx/itzDUg9zOPbOJEZRMoxe3xA21z4FuVpnFsdkfhZvzKXn4o7RZnKmAU+D9TQ3/cyIPOa2hzOxkukkOzk= X-Gm-Message-State: AOJu0YwjXHah3oQw7ajj2yNpAng1E5FnwmJQO9p6xDTrkSPtwXKgPa8+ t8CCaTpnXzY4rzbskRfpd2QUKuui8oZkbKBCeG02VLjdjpr9DtCdbmKlNIy3NQ== X-Google-Smtp-Source: AGHT+IEUS/2XIAaK/sG/bTFILt7iLNTiWV/caijt7nP5Wuvf8TQyR8eT31jxKpyY6JZ2oBbAi6rwug== X-Received: by 2002:a17:90a:bc81:b0:2c8:3f5:37d2 with SMTP id 98e67ed59e1d1-2d3dfc75e41mr1338644a91.20.1723762675007; Thu, 15 Aug 2024 15:57:55 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:57:54 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , 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 v6 04/13] PCI: brcmstb: Use common error handling code in brcm_pcie_probe() Date: Thu, 15 Aug 2024 18:57:17 -0400 Message-Id: <20240815225731.40276-5-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155757_229281_43531B75 X-CRM114-Status: GOOD ( 12.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refactor the error handling in the bottom half of the probe function for readability. The invocation of clk_prepare_enable() is moved lower in the function and this simplifies a couple of return paths. dev_err_probe() is also used when it is apt. Signed-off-by: Jim Quinlan Reviewed-by: Manivannan Sadhasivam Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c08683febdd4..790a149f6581 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1613,25 +1613,23 @@ 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 = reset_control_reset(pcie->rescal); + ret = clk_prepare_enable(pcie->clk); if (ret) - dev_err(&pdev->dev, "failed to deassert 'rescal'\n"); + return dev_err_probe(&pdev->dev, ret, "could not enable clock\n"); + + ret = reset_control_reset(pcie->rescal); + if (ret) { + clk_disable_unprepare(pcie->clk); + return dev_err_probe(&pdev->dev, ret, "failed to deassert 'rescal'\n"); + } ret = brcm_phy_start(pcie); if (ret) { @@ -1678,6 +1676,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) fail: __brcm_pcie_remove(pcie); + return ret; } From patchwork Thu Aug 15 22:57: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: 13765270 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3ED1C52D7D for ; Thu, 15 Aug 2024 23:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yepWRpPrn7HuVRjGcYCbpeID1UICJE17S+GyZCTYTS8=; b=BqjQuIT6qLgn48eJKe/6mGZ8IL Q0D3xQ9R7NypC7HhF+GskBnHWtEn5H1BoKNiT070R5AKlkuBJHD+/I/0bA4EKxpX+zQCJzMZfpTbp XOhZhNsIU+vvLV8VBs1II8ntJnrDXjYCHr0IxNgl2tPf+7BVCFoKbF5kP86J9U7044GRvjLnoZ7Vt 68ndib8didQPJsUU2bqBvX+lKiq6Bw9YNRs3jZsuWaGpkz+K0RmDNJGku2h9a+ujJaTaJwxh8OQnq auuAKb8x2QfTvKb5lL4crFNHvG3lTyoaYp7Vk2x5XNYOE6HLmCZ9aaK/let3ljO1/GgEIUJVsv7Nx scSY1JPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejXp-0000000BG7S-1srp; Thu, 15 Aug 2024 23:06:13 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejPr-0000000BE3g-3NJ4 for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:58:01 +0000 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-7a10b293432so1013957a12.0 for ; Thu, 15 Aug 2024 15:57:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762679; x=1724367479; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=yepWRpPrn7HuVRjGcYCbpeID1UICJE17S+GyZCTYTS8=; b=EgeX2fzmrvamafXB7NSSZWFOMBZOkKWWxpjNkpsHfg5t9A0zP/t04lmKfY2ajDVYBq EjTM7aZCDkOwoabQie4D39qbijZjVRhftvu0Xy9bTPEYeJ+DgqNrVzffMIukbcrkgj37 kCj/08OldPjVrdbx5vBxxE6aezgG99mKqusb8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762679; x=1724367479; 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=yepWRpPrn7HuVRjGcYCbpeID1UICJE17S+GyZCTYTS8=; b=l3g600fT32yn/Jj5WNLNTroHnIXBSOd/EYmAwKf3naP4k5xQkPolttt8kD/2MgRwwn kgbl8oL+4HoePGRqHFzR1hLRpu/8Px/3Hl2qwwMBBvETnb98LI7+jJx49X1xWBep5+5v LdfM/itn70aAIkK0xY8eANbXxbhWqOIfE8QRUSermINvRRBXd3oGq7H7177Q3yJFn/p1 9XgBH7Sg2fMyZptH6bK7ZpCnvsyKoRtggbmAxBBKrrwEWgnXSO/ls0G3e5ymR4xDfPGs yj/1rbqK4kiImpX1wSBfEZWMcXzvjfGc97sbDRMrmmJRNNjIfOFBqdKBy0DUBcCA6Tyt 7KDA== X-Forwarded-Encrypted: i=1; AJvYcCVUgGBrqRAv7MBqfHQayuIYjhpR772i3ikCqNIFenxGG1Iha1pXCorPxuv24iOMEzzuBn30eS6atnUjPBBXsuwTLQQtXSaJN+pNxPpvc3zVqn5NcH4= X-Gm-Message-State: AOJu0YwP3Qkkl7cD7yAgxvAZlNO0AWKoD/H5gad9A9/PLHrR52XuA3Lt CfLWCGpzBQahYxnTGwXUlE6zOrX/JzzO9JcVmPpUtbnfANwCGrde8ZTbQ5138w== X-Google-Smtp-Source: AGHT+IGxbnG/uJ/U4/fycutE6POjlc+iPF9Zv5jiqIHVnaRSgcMsZaJbzzeuyxOqvw3zYCkzgINdcA== X-Received: by 2002:a17:90a:1307:b0:2bf:8824:c043 with SMTP id 98e67ed59e1d1-2d3dfc66d3cmr1387247a91.18.1723762678545; Thu, 15 Aug 2024 15:57:58 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.57.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:57:58 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , 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 v6 05/13] PCI: brcmstb: Use bridge reset if available Date: Thu, 15 Aug 2024 18:57:18 -0400 Message-Id: <20240815225731.40276-6-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155759_916247_0D6417FC X-CRM114-Status: GOOD ( 16.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 7712 SOC has a bridge reset which can be described in the device tree. Use it if present. Otherwise, continue to use the legacy method to reset the bridge. Signed-off-by: Jim Quinlan Reviewed-by: Manivannan Sadhasivam Reviewed-by: Florian Fainelli Reviewed-by: Stanimir Varbanov --- drivers/pci/controller/pcie-brcmstb.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 790a149f6581..af14debd81d0 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_reset; 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 (val) + reset_control_assert(pcie->bridge_reset); + else + reset_control_deassert(pcie->bridge_reset); - 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)); + if (!pcie->bridge_reset) { + 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)); + } } static void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val) @@ -1621,10 +1629,16 @@ static int brcm_pcie_probe(struct platform_device *pdev) if (IS_ERR(pcie->perst_reset)) return PTR_ERR(pcie->perst_reset); + pcie->bridge_reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "bridge"); + if (IS_ERR(pcie->bridge_reset)) + return PTR_ERR(pcie->bridge_reset); + ret = clk_prepare_enable(pcie->clk); if (ret) return dev_err_probe(&pdev->dev, ret, "could not enable clock\n"); + pcie->bridge_sw_init_set(pcie, 0); + ret = reset_control_reset(pcie->rescal); if (ret) { clk_disable_unprepare(pcie->clk); From patchwork Thu Aug 15 22:57: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: 13765264 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6314C52D7F for ; Thu, 15 Aug 2024 23:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cQNUR4eo2grqHmWzloaYQ1piFbFOSyvLprH/Wsr2BKQ=; b=zGTa79lxvImk1lNiphcfI/VFb5 //OKE3WDobSFV5tjMggcQU0rGpYezCIfsEcG5DtFj58h+UKNq7a6PxCuy2H2irpbM7DcBSIYrDyqJ HxjNSWCO/AtVFV/rOfy8HGmqOzdAE93l2gDdkXbgiinP3TmznqiHdpr5V8pZRzzmo6F1CC4CCrk7K 1l/P5du90nmgh6O8KzGRs2D9R4xn+WAcT0Hu6Iuj9vKFpQJNH+FMfHHBoL27Jv37gKiVz9SuuGAYP scAwUOxrTV6bgguypG6DW826R1c8ZGTjWcIbRC3Utwb1lh4ot6LPZon+02vsw4sRE4mzM+EEEPtmA 9+G9gn8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejTs-0000000BFQR-3FDi; Thu, 15 Aug 2024 23:02:08 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejPv-0000000BE5C-13Cq for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:58:04 +0000 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-7c6b03c414fso530939a12.2 for ; Thu, 15 Aug 2024 15:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762682; x=1724367482; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=cQNUR4eo2grqHmWzloaYQ1piFbFOSyvLprH/Wsr2BKQ=; b=CntQe9ULKhe7c6K9EE1bn3Ap7Mw8ciZDaSS6ASmzaUeEjLsU7L+PxF9rJcBi/PVXt+ VqC0URvDoyfCGEKP9MUaLNbn/dtu+s9d00xPiCRIe5qx/wTsk6R+myB+G6VQ5f0VVvlX dTEwoAuPF9q1XU86p6LIEOaHRgXdKl9WIg+70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762682; x=1724367482; 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=cQNUR4eo2grqHmWzloaYQ1piFbFOSyvLprH/Wsr2BKQ=; b=iIsLe4i5iDBcQC9jB4UhX5JaQ9HLcXQlLPa6FSO7yA0klYS6rDH2GHvlb0A097BUmA 5IfAT0UsbqFJchLvDsJPFMsFGeP7E2IbbFrWiUFzSVUEv4o6ZfCs8bxh8bZbrkN69xRX xyTkgQsdq5qvp+dglP5CpT5ki8/0/ynOHYPc5KFWIu0YHij2vgRFHZDaLMSklgesMDHp g4noq+JcciTE/7ocHLQfwRfIcgBGxcZdHhneKO+vyZ91nb+LDxuDaGTILOwE9HiUX0MM 5kyISfNYp0eyQZoInySO/e3ctw3tWJVgHAxrnADbdbqvR8u2yY0FOH/91Ye3ifagBBFr 7weA== X-Forwarded-Encrypted: i=1; AJvYcCVsmdahF9xPSIUAW7HZgWNkaseXFZuRfpoxcinkK8VZEZ3U7BWQCfWc/8dDn7+cGUlBS2qH1jgActs4RDUUz88vTIKGsAqJOjJLqnjglB7v+xywv2s= X-Gm-Message-State: AOJu0YxDWDxi8qwoK45VHBLj6UUcK59SExyFrH4IQH04lzJE7bccqVqs rKMx+6yV+VNnT2am+04w1tIxuEmJAdFf63vTHgnvHO9YPFrDanMWcustL7z+8A== X-Google-Smtp-Source: AGHT+IHhhzzPytfNy1akq9lEmeO1LBTMtBLfCNyTCRSEt91lpkiU1VmEpGZ8WkgxTVaHZ49GNZvZ5w== X-Received: by 2002:a17:90b:1208:b0:2cb:5455:8018 with SMTP id 98e67ed59e1d1-2d3dfd8c73cmr1309322a91.23.1723762682128; Thu, 15 Aug 2024 15:58:02 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.57.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:58:01 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , 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 v6 06/13] PCI: brcmstb: Use swinit reset if available Date: Thu, 15 Aug 2024 18:57:19 -0400 Message-Id: <20240815225731.40276-7-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155803_301125_FE49D613 X-CRM114-Status: GOOD ( 13.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 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: Manivannan Sadhasivam Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index af14debd81d0..aa21c4c7b7f7 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_reset; + struct reset_control *swinit_reset; int num_memc; u64 memc_size[PCIE_BRCM_MAX_MEMC]; u32 hw_rev; @@ -1633,12 +1634,35 @@ static int brcm_pcie_probe(struct platform_device *pdev) if (IS_ERR(pcie->bridge_reset)) return PTR_ERR(pcie->bridge_reset); + pcie->swinit_reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "swinit"); + if (IS_ERR(pcie->swinit_reset)) + return PTR_ERR(pcie->swinit_reset); + ret = clk_prepare_enable(pcie->clk); if (ret) return dev_err_probe(&pdev->dev, ret, "could not enable clock\n"); pcie->bridge_sw_init_set(pcie, 0); + if (pcie->swinit_reset) { + ret = reset_control_assert(pcie->swinit_reset); + if (ret) { + clk_disable_unprepare(pcie->clk); + return dev_err_probe(&pdev->dev, ret, + "could not assert reset 'swinit'\n"); + } + + /* HW team recommends 1us for proper sync and propagation of reset */ + udelay(1); + + ret = reset_control_deassert(pcie->swinit_reset); + if (ret) { + clk_disable_unprepare(pcie->clk); + return dev_err_probe(&pdev->dev, ret, + "could not de-assert reset 'swinit'\n"); + } + } + ret = reset_control_reset(pcie->rescal); if (ret) { clk_disable_unprepare(pcie->clk); From patchwork Thu Aug 15 22:57: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: 13765265 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3CF1AC52D7F for ; Thu, 15 Aug 2024 23:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=B0X1wn9NMaiuQrJz2MlOiOWSzcZgLEDGUdh3XvBe1/A=; b=ccatj6PnD09eU4TXbWQ+UkQVeS ujFxlLnqIYmgIHvalFl7KpdYMxXUDiJsXP44dvEzuYljyuQBDSBbKHPMy+N5149jYRWs18no9VCle ykvJguVl6wGg77/ICIFqybh3N9ZasXsXtXwjJ0cOkSpQPelG9QLvYp2ydI1p/D+lVldF7lmXCGFmO +QUrZVsVwXygRpPoApjiHlspDGJ3HnL8mLXU9FDR8nDlrT+yMVc+mhh9YtcFdAKeiLGqWYMIiuY5j Wy8c4/sZGCrFRAGgZRs7oTzElGeHUivXgcj+/yLcBarrylmG4gl9qWD78ZLTTHBdh2u8yVwa4UJen QqSqU+KQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejUT-0000000BFWx-2bkP; Thu, 15 Aug 2024 23:02:45 +0000 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejPy-0000000BE6S-1zKE for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:58:07 +0000 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-7a10b293432so1013997a12.0 for ; Thu, 15 Aug 2024 15:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762686; x=1724367486; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=B0X1wn9NMaiuQrJz2MlOiOWSzcZgLEDGUdh3XvBe1/A=; b=ID1VsFOOjbYQxca9UBTqYEB2yakbBLYj352jwhIQAENVU5FhtoXuWFQdkptKVG+O+/ KiPdC81T+BvC3rpeI3y9jHeKX0oT2Lh1poWmBndXzleze2eajdQCQt4hXS85XgRLWbVj WzUc5eqGivFujudGWRU8twQd0d/uTiVEBtUdg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762686; x=1724367486; 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=B0X1wn9NMaiuQrJz2MlOiOWSzcZgLEDGUdh3XvBe1/A=; b=XRxjzO+dOmSszdhedgS3sqVs6/WMLzjOxFRiac5DsyVerviurhbxHyvYjtf4n5MBqC 3jhxQ14pXk95orLemnyifLHvNBhrrXR7R4ugo+nHzXF3olOf0b89FyjKI8WKveji8smO r2WzWON7m03EnAfhWirja4i4Xiv9K1iLaU88AyO+4/FTGWQUHRgOSAZ9DQV90o6X89Yf yEe8Ef6cqV4Xh9r+GC+FkTSIg/cYy8VZpCd/neTic5S/xK5pJHxGwmbzUOlF16vgZZ9U q9gPgKcj78aqK4axFynz1QF6SoCy9Fi3Nr7UGVonVHl6lDlhmRO9BDMFnk1Gq22ueMUR i1BQ== X-Forwarded-Encrypted: i=1; AJvYcCW6NkCsIXbnp5uplavoP9MJsahjxEOQpy44Usx5XOh5NO61Le26iKacYmj3ToytDrCU1H8j+FNSQD3hl0aMYBpIUH9frvb4/y8QMZ9xrLafs6yXl/I= X-Gm-Message-State: AOJu0Yzhm4gFzMstV/vQiLlCGKNk8/VapjVkLwKBR97y3gRHijwQAY8G MZ5Fz3RkQxyE4veATxl73y58MSOTEMsB6mT9DWUSfSA+n/Z14mA/Mgd36bjRFg== X-Google-Smtp-Source: AGHT+IEGn/rCG97NahVwT/mQs4TqVzkFRTUgFUvrLGVXrwglBEYFVn1dhN6p57opZidOhlSTfzh6dQ== X-Received: by 2002:a17:90b:4b02:b0:2cb:5134:562a with SMTP id 98e67ed59e1d1-2d3dfc2402fmr1371267a91.7.1723762685606; Thu, 15 Aug 2024 15:58:05 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:58:05 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , 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 v6 07/13] PCI: brcmstb: PCI: brcmstb: Make HARD_DEBUG, INTR2_CPU_BASE offsets SoC-specific Date: Thu, 15 Aug 2024 18:57:20 -0400 Message-Id: <20240815225731.40276-8-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155806_551824_246079DD X-CRM114-Status: GOOD ( 16.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Do prepatory work for the 7712 SoC, which is introduced in a future commit. Our HW design has changed two register offsets for the 7712, where previously it was a common value for all Broadcom SOCs with PCIe cores. Specifically, the two offsets are to 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 aa21c4c7b7f7..1444f2a9c21e 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 Thu Aug 15 22:57: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: 13765266 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 15108C52D7D for ; Thu, 15 Aug 2024 23:03:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KilTSS2hPoygKRd18QPDDGRiZt2QPvEb7dOr4l2nKe8=; b=uX/ykklz/df/1syvhguy42+ZTR LpBXla/1HN+hG2l2lZ5eHHU3x/1/h0nC5wyUyoBV6lbO55eiKNeMCtCMFZECv2jWiVZRUbQSsr77E XvMxdStZU8FTG9uGN68HMOG36G3/i5k+feUO2x5O8LBvWpuek/WrWlyTZSVkfo4Tsli9rljNAHX1b uOnVVMPXTf/+IAxbbBon9Gx12qeVzNhpbO+uUbaQs0sNui6mck09XyfXcEM58S7T5Xk5DUEntGMf1 Do6aiLyX6JFataGaX43uoTWetsDaGGRnxzUvPnte8ROPETA0RQ3ILpuvjYPzo5QTu/6ErKzHfyXq9 174TLxQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejVH-0000000BFeB-02KX; Thu, 15 Aug 2024 23:03:35 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejQ2-0000000BE8V-12Ft for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:58:11 +0000 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-2cb53da06a9so978185a91.0 for ; Thu, 15 Aug 2024 15:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762689; x=1724367489; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=KilTSS2hPoygKRd18QPDDGRiZt2QPvEb7dOr4l2nKe8=; b=W61QFdvi31L2IsGQpHuie0tZmFV7SA0+zkOq1LP91t3bt8KjzTiGHxIgWcYCfF21Fk aHuRX/eJETle2cNr08qcnHOqsfv8SHKNQxyyimX+/kUclpTsrKxDx2xIjJqj/LvpBEJz X7E3TBdpPKxDtiXIjl5drYIiK0avu79tMidRI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762689; x=1724367489; 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=KilTSS2hPoygKRd18QPDDGRiZt2QPvEb7dOr4l2nKe8=; b=WnWCP47mYTATxD9IYgz7AWlIwMS4so699Ejdln7gFuLsmSa4yaDNWTdWhu/q9DFnnJ FSFiVvC7NG77HJG7lvcAMCteInFcFrpI4SMYPV/SCG1aF5vrcdIo3aghW0kz0MqycTr0 uIK2boBK0yiCqvHUQLSF82QfRLDhF68JO78cPiVU60T9KOpaQvoMXoXYtGq72LehIfYs a5AFYkIh1wTLtzaIS9Cqg9bhnZPv4Z753Fy0a1/2Htvz0BAQAu+TU3rHwwRoYYjp4cKb QhZ80R4r5H1dh0onINCwmHIMG/X7IfqlT6BidusCf6JKqzfQ2SHz8ImMPbNoH9PoSIai 37ng== X-Forwarded-Encrypted: i=1; AJvYcCX9U4dyJfqZqPqqlvpwwHpVyAV7N5Pz7tOcVKP95zLW5QqT1HTD3a+It2WGsMQIQQpNxWGtb9QHOQQcWMHN+nNkAK0l9aPXmXIgVCIY9wBu5CiiPw0= X-Gm-Message-State: AOJu0YzBGZ4hVmgNZHa0PnGxdqKdyVbI8t8alXQNhQVieAv8+6TKYJcz piEnrx8J4iY9oAN1xM1Jr8FDGFno8bHIE8mrVd9jEZmgv1//b7WwmwBztXM+Rg== X-Google-Smtp-Source: AGHT+IGVevgXwnN4XnwiiR+wYitz2w7Us7nSDwVB2LvLoMWElqIPNYYknYIqxswtfiLumTPBy/dykQ== X-Received: by 2002:a17:90a:3ea5:b0:2c2:d590:808e with SMTP id 98e67ed59e1d1-2d3e4579733mr1068240a91.13.1723762689089; Thu, 15 Aug 2024 15:58:09 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:58:08 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , 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 v6 08/13] PCI: brcmstb: Remove two unused constants from driver Date: Thu, 15 Aug 2024 18:57:21 -0400 Message-Id: <20240815225731.40276-9-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155810_368259_4D2C1969 X-CRM114-Status: UNSURE ( 9.20 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Remove two constants in the driver which are no longer used: RGR1_SW_INIT_1_INIT_MASK and RGR1_SW_INIT_1_INIT_SHIFT. 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 1444f2a9c21e..51b715fbf3a9 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 Thu Aug 15 22:57: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: 13765267 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7351C52D7D for ; Thu, 15 Aug 2024 23:04:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Sw/y1YudoYw0z5x3kyJbYb7Us6/Aelo6uwQtXJHsCTc=; b=lDMS8pTzFk7ygUC5cGSmKNGbJz xEqn6UdrrXneri8fE/VC8Hr6crVYONL1Gg0LFGWOZg5Sfmaw7hDm6ypPAeAg7sazfNeMnPd4wW2t9 xT/Ior8IP7lWUlcT8IX831MWh4yiksBMDkCQwM0y+aSTOlSbeSLOoofer4ZTTYthI0+MraaiAu6T3 6mUN9mG8jJ8afELM0PvEbY5mUYgtagL1h50iylhBAmr7QwiHSYkRC3/PlG0zxnOdrncE6Q1RrK1eg 4KIDpSoy4gMl1HDNhsBJt3yq3p0GmZLXhS7Jw7jnVtlElPFsRqMh6YskjiJBR0lTlJ3w+i0UxL1DC RjD0lfww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejVy-0000000BFly-2FV2; Thu, 15 Aug 2024 23:04:18 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejQ5-0000000BEAS-3mjy for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:58:15 +0000 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-7a0e8b76813so1137099a12.3 for ; Thu, 15 Aug 2024 15:58:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762693; x=1724367493; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=Sw/y1YudoYw0z5x3kyJbYb7Us6/Aelo6uwQtXJHsCTc=; b=D4EFjve99OFbdKcZ/hTBshtfHnLEAF2JYQvOgcL6CwOfFkzg/lWReeb65U7OfsQT78 0MInUeyT3CpoQpz7r896e+vAVYXZ7LA6OqChREfixWpYq4pjyKiCPXEeBHwNnCRKcZSo T57z38fpcLv08ErG2uugkPc7K26eSLEMNmB6A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762693; x=1724367493; 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=Sw/y1YudoYw0z5x3kyJbYb7Us6/Aelo6uwQtXJHsCTc=; b=YEPPo16AApCLSbTX748/2v+zpkpJHllgRStULdxZmqMmWeDf5Chp4Dr3NH9vMgmdh3 9tflXkIh5d5EjBOoAVdfsgs5Wnfss3PLzDpCPdpOYusr7TQo+i9X0GYv44Yno05N7YLf AqB5TkiWyY00XFO+7ZCIr6g8BCQCO0vzgPN1xm3Ld8kL1zKQ1FENaG8fNskyq3IZLnDm P2h1DmfU3nYkRvH7F32SuYFeel42eaolGceHsnXuPFaUExTGbYpuajdnR2E70vGrEI2q tH1t1FyomQUfFP7bP29vZZF5DDqUDa7vr5lTe1tq559NwQ7FYdtgj9sySojhXvcFSS7s szvA== X-Forwarded-Encrypted: i=1; AJvYcCUvnUYmaxcLO1vggWd8GzS4/qqxsxnY1/yOFtSgy86CHjlxEQ6USfmusFv52RAXeKIUP1hgV9BvA9wL7hYwFaMqAdZW6JlkidsL/kMrka5QjKEqDIk= X-Gm-Message-State: AOJu0YyVr2NTR0MrtG4TDiXhthl9rkWF13TY3tK7otqVbZJ1hysifL+i v8cWEOBgEitsHkW1dvJvFl7rdqeh+qrHaEEck5QsbgNCrqel6q83O5r8W1rijQ== X-Google-Smtp-Source: AGHT+IGe2VnSskgWUeuQ6btU4om0yhswtchJFUKGi72EMM35kbN0Vl7eoIcl778qfal49Wwzmi+SJA== X-Received: by 2002:a17:90a:34c1:b0:2c9:81fd:4c27 with SMTP id 98e67ed59e1d1-2d3dfc61a9bmr1382610a91.14.1723762692574; Thu, 15 Aug 2024 15:58:12 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.58.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:58:12 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , 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 v6 09/13] PCI: brcmstb: Don't conflate the reset rescal with phy ctrl Date: Thu, 15 Aug 2024 18:57:22 -0400 Message-Id: <20240815225731.40276-10-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155813_966605_C87C1A09 X-CRM114-Status: GOOD ( 14.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a "has_phy" field indicating that the internal phy has SW control that requires configuration. Some previous chips only required the firing of the "rescal" reset controller. This change requires us to give the 7216 SoC its own cfg_data structure. Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli Reviewed-by: Manivannan Sadhasivam --- 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 51b715fbf3a9..2431c5a75cde 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 Thu Aug 15 22:57: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: 13765268 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D726C52D7F for ; Thu, 15 Aug 2024 23:05:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+BQ+hMl9ONnW8tvoJ3Oktqj2IgfP2NARVxel81Lp090=; b=P+kEnCXf2B9dsLWfmJsgHX5cxF 5PN0WrWGQibPv3KB2hUvAOMYpI+ZpprnB31xqnDePtdIoQF9L6rvcjHnbz0Ls96u2ZoeaACJXpIy1 FyepZQ3jsytrWWYzOwMdZTj1YxjlDOk8oKHFvwm/ODsk/T00UBIXwd1R1q7Bo5G50qcA1FUl4Vmm0 wha+6UJBXnsRQJHGU2rQuxkDi0f7Y49yi3zgMtwVFTzgrnZG7eZ0O1YkcJT09KP888DNoH0jx+GOM TzffiKOmg2xxQ0di4bXPS5kIYxEUqJ8ZSSJSGN6myqSaat3ZpRJVrW/ookD3W4TwyrDYHntoA1s/7 YFOpH1tQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejWa-0000000BFtN-1tu7; Thu, 15 Aug 2024 23:04:56 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejQ9-0000000BEBD-0ax9 for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:58:20 +0000 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-7c6b03c414fso530981a12.2 for ; Thu, 15 Aug 2024 15:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762696; x=1724367496; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=+BQ+hMl9ONnW8tvoJ3Oktqj2IgfP2NARVxel81Lp090=; b=M+8cR2G3S6Nzblsp9wxqZ4guljC3GyfRBeN08JWFlBlQVGUylaZZyPgZAoIR+vaqHV rJKFVo61P2gOZDqfhGpnDRYihT6fOP57Qqoh7kpiUNu+nog+6C/yNAwXLn5tKzyRjyHH SNgDGsNPSoqLC+axBD2RBYNFN/PuZNVD0knQo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762696; x=1724367496; 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=+BQ+hMl9ONnW8tvoJ3Oktqj2IgfP2NARVxel81Lp090=; b=jJdcoe64dX3ahDOJhM+m6cI0wsfhWtwrhAFHi0Aoc0rk1RyJg2juuw2dUp3DSnCPGJ Cl6Pom//DgX9+VHC9u2C3ZLaJXk51gFIc2F9lEL2m92XUGnQBJSpZHXgYoQswTFcwIVV E/ne2uUFepVGV+c6+UyKKq6dyIYBeOa2xxM7LJJaeWoJFUHDKVOf3jl2Bhgl20/DVa43 kEK11FvGqHrnZqk9XwErN9nmPahH1n0b2WmL9dGcpgI8c2p4bVINPdPSoy62oPVOa54E Xe7UuqDiOEhfCWSwt4L0C7PlrUG9NaXcDV4EdfTPJO+nECRpSHNAWGwVLrtEuQqJnaJt YfPA== X-Forwarded-Encrypted: i=1; AJvYcCUS7jE7+OTV1NegnI6UDr/HCQgYTr0TqoyXX3PIi7BCVVnGSoxgOp8kQNkgn9wxD3WNgWGQnkuB0fa2+94GDe05/JKQ9Q4a6rT7LQ0jPNi5EzQ9CCE= X-Gm-Message-State: AOJu0YxyR62IV7fZ4W2ZOsNL/DmfmRP0gQAo35DKI9OabJBYhcNC3ijS Nb9FCdV0LtTkv1vJ8H8jHWepHqjUFRX5SKm9nJTEaMmbQrfLAD4Vpxs4eSTbzw== X-Google-Smtp-Source: AGHT+IErUTWDwWFK0h+Hr/lyOmtdpeoyiaayvI83suBfnCF8UuoMqGihR0FBCkhQ3DfTxE9v075Ujg== X-Received: by 2002:a17:90b:1011:b0:2c9:8b33:3191 with SMTP id 98e67ed59e1d1-2d3dfc6bc52mr1211488a91.11.1723762696285; Thu, 15 Aug 2024 15:58:16 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.58.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:58:15 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , 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 v6 10/13] PCI: brcmstb: Refactor for chips with many regular inbound windows Date: Thu, 15 Aug 2024 18:57:23 -0400 Message-Id: <20240815225731.40276-11-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155817_231637_BC934B3D X-CRM114-Status: GOOD ( 32.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Provide support for new chips with multiple inbound windows while keeping the legacy support for the older chips. In existing chips there are three inbound windows 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. Typically, only one window was used. Complicating the inbound window 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 take a step forward and drop the internal mapping while providing for multiple inbound windows. This works in concert with the dma-ranges property, where each provided range becomes an inbound window. Signed-off-by: Jim Quinlan Acked-by: Manivannan Sadhasivam Reviewed-by: Florian Fainelli Reviewed-by: Stanimir Varbanov --- drivers/pci/controller/pcie-brcmstb.c | 235 ++++++++++++++++++++------ 1 file changed, 181 insertions(+), 54 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 2431c5a75cde..c5d3a5e9e0fc 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -75,15 +75,19 @@ #define PCIE_MEM_WIN0_HI(win) \ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_HI + ((win) * 8) +/* + * NOTE: You may see the term "BAR" in a number of register names used by + * this driver. The term is an artifact of when the HW core was an + * endpoint device (EP). Now it is a root complex (RC) and anywhere a + * register has the term "BAR" it is related to an inbound window. + */ + +#define PCIE_BRCM_MAX_INBOUND_WINS 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 +134,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 +225,20 @@ enum pcie_type { BCM4908, BCM7278, BCM2711, + BCM7712, +}; + +struct inbound_win { + u64 size; + u64 pci_offset; + u64 cpu_addr; }; struct pcie_cfg_data { const int *offsets; const enum pcie_type type; const bool has_phy; + u8 num_inbound_wins; void (*perst_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); }; @@ -274,6 +290,7 @@ struct brcm_pcie { struct subdev_regulators *sr; bool ep_wakeup_capable; bool has_phy; + u8 num_inbound_wins; }; static inline bool is_bmips(const struct brcm_pcie *pcie) @@ -396,7 +413,7 @@ static void brcm_pcie_set_gen(struct brcm_pcie *pcie, int gen) } static void brcm_pcie_set_outbound_win(struct brcm_pcie *pcie, - unsigned int win, u64 cpu_addr, + u8 win, u64 cpu_addr, u64 pcie_addr, u64 size) { u32 cpu_addr_mb_high, limit_addr_mb_high; @@ -789,23 +806,62 @@ 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 void add_inbound_win(struct inbound_win *b, u8 *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 inbound_win inbound_wins[]) { 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; + u8 n = 0; + + /* + * The HW registers (and PCIe) use order-1 numbering for BARs. As + * such, we have inbound_wins[0] unused and BAR1 starts at inbound_wins[1]. + */ + struct inbound_win *b_begin = &inbound_wins[1]; + struct inbound_win *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) + add_inbound_win(b++, &n, 0, 0, 0); resource_list_for_each_entry(entry, &bridge->dma_ranges) { - u64 pcie_beg = entry->res->start - entry->offset; + u64 pcie_start = entry->res->start - entry->offset; + u64 cpu_start = entry->res->start; - size += entry->res->end - entry->res->start + 1; - if (pcie_beg < lowest_pcie_addr) - lowest_pcie_addr = pcie_beg; + size = resource_size(entry->res); + tot_size += size; + if (pcie_start < lowest_pcie_addr) + lowest_pcie_addr = pcie_start; + /* + * 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) + add_inbound_win(b++, &n, size, cpu_start, pcie_start); + + if (n > pcie->num_inbound_wins) + break; } if (lowest_pcie_addr == ~(u64)0) { @@ -813,13 +869,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 +891,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 +934,90 @@ 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)) { - dev_err(dev, "Invalid rc_bar2_offset/size: size 0x%llx, off 0x%llx\n", - *rc_bar2_size, *rc_bar2_offset); + if (!size || (pci_offset & (size - 1)) || + (pci_offset < SZ_4G && pci_offset > SZ_2G)) { + dev_err(dev, "Invalid inbound_win2_offset/size: size 0x%llx, off 0x%llx\n", + size, pci_offset); return -EINVAL; } - return 0; + /* Enable inbound window 2, the main inbound window for STB chips */ + add_inbound_win(b++, &n, size, cpu_addr, pci_offset); + + /* + * Disable inbound window 3. On some chips presents the same + * window as #2 but the data appears in a settable endianness. + */ + add_inbound_win(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 inbound_win *inbound_wins, + u8 num_inbound_wins) +{ + void __iomem *base = pcie->base; + int i; + + for (i = 1; i <= num_inbound_wins; i++) { + u64 pci_offset = inbound_wins[i].pci_offset; + u64 cpu_addr = inbound_wins[i].cpu_addr; + u64 size = inbound_wins[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_relaxed(tmp, base + reg_offset); + /* Write high */ + writel_relaxed(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_relaxed(tmp, base + reg_offset); + tmp = upper_32_bits(cpu_addr); + writel_relaxed(tmp, base + reg_offset + 4); + } + } } static int brcm_pcie_setup(struct brcm_pcie *pcie) { - u64 rc_bar2_offset, rc_bar2_size; + struct inbound_win inbound_wins[PCIE_BRCM_MAX_INBOUND_WINS]; 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; + u8 num_out_wins = 0, num_inbound_wins = 0; + int memc; /* Reset the bridge */ pcie->bridge_sw_init_set(pcie, 1); @@ -933,17 +1066,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_inbound_wins = brcm_pcie_get_inbound_wins(pcie, inbound_wins); + if (num_inbound_wins < 0) + return num_inbound_wins; + + set_inbound_win_registers(pcie, inbound_wins, num_inbound_wins); - tmp = lower_32_bits(rc_bar2_offset); - u32p_replace_bits(&tmp, brcm_pcie_encode_ibar_size(rc_bar2_size), - PCIE_MISC_RC_BAR2_CONFIG_LO_SIZE_MASK); - writel(tmp, base + PCIE_MISC_RC_BAR2_CONFIG_LO); - writel(upper_32_bits(rc_bar2_offset), - base + PCIE_MISC_RC_BAR2_CONFIG_HI); + if (!brcm_pcie_rc_mode(pcie)) { + dev_err(pcie->dev, "PCIe RC controller misconfigured as Endpoint\n"); + return -EINVAL; + } tmp = readl(base + PCIE_MISC_MISC_CTRL); for (memc = 0; memc < pcie->num_memc; memc++) { @@ -965,25 +1097,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 (inbound_wins[2].pci_offset >= SZ_4G || + (inbound_wins[2].size + inbound_wins[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; @@ -1034,7 +1153,7 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) num_out_wins++; } - /* PCIe->SCB endian mode for BAR */ + /* PCIe->SCB endian mode for inbound window */ tmp = readl(base + PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1); u32p_replace_bits(&tmp, PCIE_RC_CFG_VENDOR_SPCIFIC_REG1_LITTLE_ENDIAN, PCIE_RC_CFG_VENDOR_VENDOR_SPECIFIC_REG1_ENDIAN_MODE_BAR2_MASK); @@ -1516,6 +1635,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_wins = 3, }; static const struct pcie_cfg_data bcm7425_cfg = { @@ -1523,6 +1643,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_wins = 3, }; static const struct pcie_cfg_data bcm7435_cfg = { @@ -1530,6 +1651,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_wins = 3, }; static const struct pcie_cfg_data bcm4908_cfg = { @@ -1537,6 +1659,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_wins = 3, }; static const int pcie_offset_bcm7278[] = { @@ -1552,6 +1675,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_wins = 3, }; static const struct pcie_cfg_data bcm2711_cfg = { @@ -1559,6 +1683,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_wins = 3, }; static const struct pcie_cfg_data bcm7216_cfg = { @@ -1567,6 +1692,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_wins = 3, }; static const struct of_device_id brcm_pcie_match[] = { @@ -1623,6 +1749,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_wins = data->num_inbound_wins; pcie->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pcie->base)) From patchwork Thu Aug 15 22:57: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: 13765269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1DB0C52D7D for ; Thu, 15 Aug 2024 23:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3zLMqycN4rXeFsBYmKp14DrtBnvb0YcnBAmaGiLI0z8=; b=DfXbckulxgSmqWrYw+/dTVtu7f sGJZyQwMFkSuR4KJMCrdPCSSuMKzikhy9MaoAxMZ3ol21xSfcHKzVKA0Ig6FvGEwXx+boNqLHx/2r IZ2NWURr/Va/mX/Xk+HxsMMXde1lYF5CjCKI2J/umOw5BgJG/lHn9QAWXT9pEmpI7Md/TP/GdHRam Fw89bVNeg1NeUuVuqmSSwas9lBbw51S/yOp3U0twamuzbw/P/BhAs75D6d1jAsaBfGzwn8nHzDhFF 87HMreR9fsgpMIQecDcXMkxuEvCcCiD4peXLKIf9Y83SzgKLydJeO4Ms4bU9sFBbdbQGfhT6BTmw4 7S5Hz8aA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejXD-0000000BG1g-2ecL; Thu, 15 Aug 2024 23:05:35 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejQD-0000000BED0-0BBC for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:58:22 +0000 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-6c5bcb8e8edso1137063a12.2 for ; Thu, 15 Aug 2024 15:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762700; x=1724367500; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=3zLMqycN4rXeFsBYmKp14DrtBnvb0YcnBAmaGiLI0z8=; b=UyKdWlW1sAbgsp8MSUZK8Ht9h9Z/j+gbwlfPpytBdXRtSL4A0hPQV7e1WBCd9ZQ6qT YkUmbZaIqN9RFHckhLhVyf+FAlFum+bLIf8HYn/LY9J3yVyt+KjCobKXJhiaCJc7nGGM 31HdSA3kih7/xUMPu1s+yKHCXR0tbFKIUBsEU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762700; x=1724367500; 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=3zLMqycN4rXeFsBYmKp14DrtBnvb0YcnBAmaGiLI0z8=; b=ACrQy1rtXEHYrqC2/Bl4Cw6OlcFAhaJLqTWdiC7XczvTv1zkhQzNGMWRz54OJZUvJ0 bvHowyvXcDt4aauO80TLFqYjSiIV8/woDn0OopyWpyCG7pxWPEOkEL4ohYBzXB7DE871 yrmfH5Jq6Iy94ElFmioku2GafI31r4HZzYTaOPzxxDdMw/GtzNuOy4uENAQZygMSXuB4 t9PgNohuGgfi8SN12qNsE+s03/z8OsMcmJrnzd/DYDDzqln4Fjlxi93cQwd0pBHLlkeU Z9lJMsbfB/g3EvuHVx4vzZdx46luW74Z2ILSAJ55LHa1N8m/NP+nAVWgxCq4QKdrgzog e09Q== X-Forwarded-Encrypted: i=1; AJvYcCVtz2XAXz98Md6C4+kx/w9bOiT0gfc7ytWNPpiIM6M7cZSDGjk+F1J0mt124i8MQwTbZThq1ycao3Utz0kZPpqt5OIwQwJ+d+5fIWPw6i1TJH3AmY0= X-Gm-Message-State: AOJu0YzJcNxo2xXxKKgvuwGd/qNeiOFXcbmPkrIKHz7HfZEqeFMr/SpE krnQIKStQKlKmRAcxeKyOdZWuz0hgLpvEb0YQ3n81NWmA9r9ciq6u5+URdUYyg== X-Google-Smtp-Source: AGHT+IEDvdcuI7l/vZfd6lvZe/bqB12psvJxA01sGcQavX1gG8G5RM8r3Y/TruP93glM2KRB+3hQ4w== X-Received: by 2002:a17:90a:f001:b0:2ca:8b71:21f4 with SMTP id 98e67ed59e1d1-2d3dfc61aa6mr1371386a91.18.1723762699965; Thu, 15 Aug 2024 15:58:19 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.58.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:58:19 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , 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 v6 11/13] PCI: brcmstb: Check return value of all reset_control_xxx calls Date: Thu, 15 Aug 2024 18:57:24 -0400 Message-Id: <20240815225731.40276-12-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155821_115768_A1EC4702 X-CRM114-Status: GOOD ( 19.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Always check the return value for invocations of reset_control_xxx() and propagate the error to the next level. Although the current functions in reset-brcmstb.c cannot fail, this may someday change. Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli Reviewed-by: Manivannan Sadhasivam --- drivers/pci/controller/pcie-brcmstb.c | 102 ++++++++++++++++++-------- 1 file changed, 73 insertions(+), 29 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c5d3a5e9e0fc..d19eeeed623b 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -239,8 +239,8 @@ struct pcie_cfg_data { const enum pcie_type type; const bool has_phy; u8 num_inbound_wins; - 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 { @@ -285,8 +285,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; @@ -749,12 +749,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 (val) - reset_control_assert(pcie->bridge_reset); + ret = reset_control_assert(pcie->bridge_reset); else - reset_control_deassert(pcie->bridge_reset); + ret = reset_control_deassert(pcie->bridge_reset); + + if (ret) + dev_err(pcie->dev, "failed to %s 'bridge' reset, err=%d\n", + val ? "assert" : "deassert", ret); if (!pcie->bridge_reset) { u32 tmp, mask = RGR1_SW_INIT_1_INIT_GENERIC_MASK; @@ -764,9 +770,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; @@ -774,20 +782,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; @@ -795,15 +812,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 void add_inbound_win(struct inbound_win *b, u8 *count, u64 size, @@ -1017,19 +1038,28 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) struct resource_entry *entry; u32 tmp, burst, aspm_support; u8 num_out_wins = 0, num_inbound_wins = 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)) @@ -1248,7 +1278,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 @@ -1440,15 +1472,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); @@ -1461,7 +1495,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) @@ -1479,9 +1515,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 @@ -1510,7 +1549,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; } } @@ -1525,7 +1567,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); @@ -1587,7 +1629,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 Thu Aug 15 22:57: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: 13765272 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C86C4C52D7D for ; Thu, 15 Aug 2024 23:07:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CByAuUDKr027puS5rnvd5GaxVjxWYrvVYxntQLFOZp8=; b=4K+TpmAdxpMH3tt1/b/5UcokjY FIpFanKiOLPgH6cfx8/PY5wYl4Dk2vCsQcXSOxQbBNqMLPPEkeYNOYm4Y6Ut6lN9Cm0YUQ6SfrCTd pZfH3X3zMpb7ZBIc/FRHUP8g9J8+Gvaz1JA5xTXXOn4lzKVePA0jpUxiVCX69PLKNbLm+gWc681Jy NYKwi6ZcrSF57Ja9WM8gJpvSEsrFEalDSeJKP7eXJXCQI421WRT6LK3ZhTzzic5ArsnbCq/rWt8UH i90fnB5aVvrGGtgMR2Wun/YBIfdkmba2bEl8PZonVJvmWHZAiQC9qSI72Te6zOWh/850jrrDGJii9 TAxbBAuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejZN-0000000BGVj-1HPc; Thu, 15 Aug 2024 23:07:49 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejQG-0000000BEEs-31X6 for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:58:26 +0000 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-7a115c427f1so1078167a12.0 for ; Thu, 15 Aug 2024 15:58:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762704; x=1724367504; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=CByAuUDKr027puS5rnvd5GaxVjxWYrvVYxntQLFOZp8=; b=D6Fb+LAdvHSWqeqwDL8/SwsVoz8erTbBTJc5Y2w+eTA6RzhwvXniFYVh+O7+FzsgPX 2wdcPkFYZcy7lv2ZqdH/wObV36iNODJAd4/NKPbMxFg8sWpaSAtr6NyttpFJnHpdNTup Hvx6gl376NWvLZBYXHP0W99ZRfjx2o5hymzew= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762704; x=1724367504; 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=CByAuUDKr027puS5rnvd5GaxVjxWYrvVYxntQLFOZp8=; b=dX2uxs2LpszJLEJYxZczgNC4aiyNqWG6JQlRl/qridefjyf7MWs8CLKZIXrVXnRHj8 /wNTGmRD3BBYB0/GRtUqLNs2jAAPbWLM8xl91t6gx9NhRmLyVY2epBHrPy0VR5M3SqOf ly8UeXQC3aoj4IIRZHs1ebZjBuE93RXNgeNZ0ndSIGS7AbyJbB2DqKOWBSyvHOzrz9zR jlCh0EY3dAAzDd4Ln8eE+2kdpAyCyf7i2PFslNri97SXHWVT5dfQcADkYmKV/+l2kNQS TRDt/bmPvHBuPW2GRxu3Rhnllhm2X/ykHkhSusjdW5aG7jsoXZn5iufzur+n8vIj21WT 4krw== X-Forwarded-Encrypted: i=1; AJvYcCVWJ2MxxUsJnG1++8nZlPRlZURdzLYgsHCCOyahYuD+NRvRH7KzRH/Tb5XidXAJTIF88EoWKBfTeoV+WslMf17+XUfY5lG/eLI7cPscUd2SnKXYeRQ= X-Gm-Message-State: AOJu0YwNj6MwS/6l5g3lwu1kgt6tow8qsIguNsQceU8RAVyq+Mf699tj UpJ0nRBE2M0ofL5IpG1Mr7CG5h3WAh+YKH8SQZ4znfSfQ4aW/pWbSaivL4c8zw== X-Google-Smtp-Source: AGHT+IHStnKddiGSY4g7fehS+BcIowHG4comnSuVMlHCA47vkFuMMMSi84s1NB99e00TboqBa4okNQ== X-Received: by 2002:a17:90a:c28b:b0:2c9:80fd:a111 with SMTP id 98e67ed59e1d1-2d3dfc6c299mr1353521a91.18.1723762703465; Thu, 15 Aug 2024 15:58:23 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.58.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:58:23 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , 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 v6 12/13] PCI: brcmstb: Change field name from 'type' to 'soc_base' Date: Thu, 15 Aug 2024 18:57:25 -0400 Message-Id: <20240815225731.40276-13-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155824_773505_0EE56734 X-CRM114-Status: GOOD ( 20.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 'type' field used in the driver to discern SoC differences is confusing; change it to the more apt 'soc_base'. The 'base' is because some SoCs have the same characteristics as previous SoCs so it is convenient to classify them in the same group. Signed-off-by: Jim Quinlan Reviewed-by: Manivannan Sadhasivam 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 d19eeeed623b..26e8f544da4c 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -218,7 +218,7 @@ enum { PCIE_INTR2_CPU_BASE, }; -enum pcie_type { +enum pcie_soc_base { GENERIC, BCM7425, BCM7435, @@ -236,7 +236,7 @@ struct inbound_win { struct pcie_cfg_data { const int *offsets; - const enum pcie_type type; + const enum pcie_soc_base soc_base; const bool has_phy; u8 num_inbound_wins; int (*perst_set)(struct brcm_pcie *pcie, u32 val); @@ -277,7 +277,7 @@ struct brcm_pcie { u64 msi_target_addr; struct brcm_msi *msi; const int *reg_offsets; - enum pcie_type type; + enum pcie_soc_base soc_base; struct reset_control *rescal; struct reset_control *perst_reset; struct reset_control *bridge_reset; @@ -295,7 +295,7 @@ struct brcm_pcie { static inline bool is_bmips(const struct brcm_pcie *pcie) { - return pcie->type == BCM7435 || pcie->type == BCM7425; + return pcie->soc_base == BCM7435 || pcie->soc_base == BCM7425; } /* @@ -861,7 +861,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->soc_base != BCM7712) add_inbound_win(b++, &n, 0, 0, 0); resource_list_for_each_entry(entry, &bridge->dma_ranges) { @@ -878,7 +878,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->soc_base == BCM7712) add_inbound_win(b++, &n, size, cpu_start, pcie_start); if (n > pcie->num_inbound_wins) @@ -895,7 +895,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->soc_base == BCM7712) return n; ret = of_property_read_variable_u64_array(pcie->np, "brcm,scb-sizes", pcie->memc_size, 1, @@ -1018,7 +1018,7 @@ static void set_inbound_win_registers(struct brcm_pcie *pcie, * 7712: * All of their BARs need to be set. */ - if (pcie->type == BCM7712) { + if (pcie->soc_base == BCM7712) { /* BUS remap register settings */ reg_offset = brcm_ubus_reg_offset(i); tmp = lower_32_bits(cpu_addr) & ~0xfff; @@ -1046,7 +1046,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->soc_base == BCM2711) { ret = pcie->perst_set(pcie, 1); if (ret) { pcie->bridge_sw_init_set(pcie, 0); @@ -1077,9 +1077,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->soc_base == BCM2711) burst = 0x0; /* 128 bytes */ - else if (pcie->type == BCM7278) + else if (pcie->soc_base == BCM7278) burst = 0x3; /* 512 bytes */ else burst = 0x2; /* 512 bytes */ @@ -1676,7 +1676,7 @@ static const int pcie_offsets_bmips_7425[] = { static const struct pcie_cfg_data generic_cfg = { .offsets = pcie_offsets, - .type = GENERIC, + .soc_base = GENERIC, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound_wins = 3, @@ -1684,7 +1684,7 @@ static const struct pcie_cfg_data generic_cfg = { static const struct pcie_cfg_data bcm7425_cfg = { .offsets = pcie_offsets_bmips_7425, - .type = BCM7425, + .soc_base = BCM7425, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound_wins = 3, @@ -1692,7 +1692,7 @@ static const struct pcie_cfg_data bcm7425_cfg = { static const struct pcie_cfg_data bcm7435_cfg = { .offsets = pcie_offsets, - .type = BCM7435, + .soc_base = BCM7435, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound_wins = 3, @@ -1700,7 +1700,7 @@ static const struct pcie_cfg_data bcm7435_cfg = { static const struct pcie_cfg_data bcm4908_cfg = { .offsets = pcie_offsets, - .type = BCM4908, + .soc_base = BCM4908, .perst_set = brcm_pcie_perst_set_4908, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound_wins = 3, @@ -1716,7 +1716,7 @@ static const int pcie_offset_bcm7278[] = { static const struct pcie_cfg_data bcm7278_cfg = { .offsets = pcie_offset_bcm7278, - .type = BCM7278, + .soc_base = BCM7278, .perst_set = brcm_pcie_perst_set_7278, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, .num_inbound_wins = 3, @@ -1724,7 +1724,7 @@ static const struct pcie_cfg_data bcm7278_cfg = { static const struct pcie_cfg_data bcm2711_cfg = { .offsets = pcie_offsets, - .type = BCM2711, + .soc_base = BCM2711, .perst_set = brcm_pcie_perst_set_generic, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, .num_inbound_wins = 3, @@ -1732,7 +1732,7 @@ static const struct pcie_cfg_data bcm2711_cfg = { static const struct pcie_cfg_data bcm7216_cfg = { .offsets = pcie_offset_bcm7278, - .type = BCM7278, + .soc_base = BCM7278, .perst_set = brcm_pcie_perst_set_7278, .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_7278, .has_phy = true, @@ -1789,7 +1789,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->soc_base = data->soc_base; pcie->perst_set = data->perst_set; pcie->bridge_sw_init_set = data->bridge_sw_init_set; pcie->has_phy = data->has_phy; @@ -1867,7 +1867,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->soc_base == 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; @@ -1882,7 +1882,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) } } - bridge->ops = pcie->type == BCM7425 ? &brcm7425_pcie_ops : &brcm_pcie_ops; + bridge->ops = pcie->soc_base == BCM7425 ? &brcm7425_pcie_ops : &brcm_pcie_ops; bridge->sysdata = pcie; platform_set_drvdata(pdev, pcie); From patchwork Thu Aug 15 22:57: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: 13765271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A55DAC531DE for ; Thu, 15 Aug 2024 23:07:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iEyfkuyjidIDKVD0EgGnVsHdeDp6cB5THGfAbkbJ5pQ=; b=Hq6ko3qAKNqySxqR6td2vbduuP hucSwiBuEdegGA6XvaKNPPjTVQGArHWsUjO/Z9fGbIJgCGfyRWr7zXSIck9YAO/5acn4GiAsZk5mu 38JOW5ruaODY5abg8ABJdjL88YCQe1YEM7WxQsMcm5zI51b7sefvcTtqE7nb74dZgx+F2HbYEscx3 iwV3F60D9dFziDgUp4/yiySa9ngymymhuQD0rHmcLV/FMErgrQTjeLaY0f6/HYbYHuE7I1dUVyKYy ibnZCLmLchcpK0VzKLyWytwDPx3YpiNfN8Ohg2KCSdLhIL6X+Kf+VcRudh+Uf5Q49lHf7Gx2XNkTn LmODj6iw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejYk-0000000BGNu-21xw; Thu, 15 Aug 2024 23:07:10 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sejQJ-0000000BEGd-43C1 for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 22:58:29 +0000 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-2d3bae081efso1043870a91.1 for ; Thu, 15 Aug 2024 15:58:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1723762707; x=1724367507; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=iEyfkuyjidIDKVD0EgGnVsHdeDp6cB5THGfAbkbJ5pQ=; b=I//rt+rpvtre4ecMdXPgZOYkCiTcdzmTqQLdHymtC/QjxLH4T1YdmL+/zLBlaTz91P p6HowAFfguBeu/lSTvQMSiKzzK10ktyZDshIYSNCXZ5NguZJmm4Cf7PWRSy7qS0jTAoS ojqKwOKDN2ZLUVmKy99wG2wH8xjxCQS8JLfos= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723762707; x=1724367507; 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=iEyfkuyjidIDKVD0EgGnVsHdeDp6cB5THGfAbkbJ5pQ=; b=Uecsh/u0rRmotkxKm5ftVeEPaS+VSp9FDyp85US3gumyVXiyJYxn3f4ETBXnOvRM0W eBHaU6UB4Yy0h41MELXnlLz8MGhA3zOzaW0d/gLjhxbaCq2RYhLMMSk2CcQgOlxN15HM oHLnRzHzeAGHIK0S6p6XhALbxlCvrLJuKFSBQi408vvbA39m+zp5oTobjAWE8ahePu7B iFWV9roBBTmCBVPzbPwcfGfw9c2Ex/9Zm9j49pm3Np3HeeKE49gP2Aw6h0R4vCMoWL+I 3KImGGe/k+NhWVM3PkXJGFGqLOMaOtQCSaYueOp5d97YbhpW6LOEMZy9q7eDhtLT0ZwJ GOYg== X-Forwarded-Encrypted: i=1; AJvYcCWpQTVUfmbUclE9E/RmajahF1CU0l32svqenRGqFxhXh4Z+5CcRcYssnM+DtZ6kDc4oEIK7xTSi0jrHYGNid3PPhUwsX1YGCETJzDP5nIoO81Xip8U= X-Gm-Message-State: AOJu0Yy0P0X20N+X1qoPWT9Bv/Zd80QNf8paby/OIkczs6S9xqQojNM4 /EJ2WU47zMMagjVpx0UQwupZTz39SUt5oOi0Dr43lEIsGMlFKDFsUSDO6uZm6w== X-Google-Smtp-Source: AGHT+IGXdJjw0jDnc/rZ+TElPH5EDfkpxHpnAawNeGz/KmJkADzTu0pSSxdB5tMFhph2VdZ64qjpwA== X-Received: by 2002:a17:90a:8a81:b0:2d3:d0b7:da4 with SMTP id 98e67ed59e1d1-2d3dfc7a8f2mr1274469a91.19.1723762706894; Thu, 15 Aug 2024 15:58:26 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d3e2e6b2d1sm373997a91.18.2024.08.15.15.58.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 15:58:26 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Manivannan Sadhasivam , 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 v6 13/13] PCI: brcmstb: Enable 7712 SOCs Date: Thu, 15 Aug 2024 18:57:26 -0400 Message-Id: <20240815225731.40276-14-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240815225731.40276-1-james.quinlan@broadcom.com> References: <20240815225731.40276-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240815_155828_067759_091EABB0 X-CRM114-Status: GOOD ( 14.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The Broadcom STB 7712 is the sibling chip of the RPi 5 (2712). It has one PCIe controller with a single port, supports gen2 and one lane only. The current revision of the chip is "C0" or "C1". Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli Reviewed-by: Manivannan Sadhasivam --- 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 26e8f544da4c..21e692a57882 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1203,6 +1203,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->soc_base == BCM7712) + return; + /* Each unit in timeout register is 1/216,000,000 seconds */ writel(216 * timeout_us, pcie->base + REG_OFFSET); } @@ -1674,6 +1678,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, .soc_base = GENERIC, @@ -1739,6 +1750,14 @@ static const struct pcie_cfg_data bcm7216_cfg = { .num_inbound_wins = 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, + .soc_base = BCM7712, + .num_inbound_wins = 10, +}; + static const struct of_device_id brcm_pcie_match[] = { { .compatible = "brcm,bcm2711-pcie", .data = &bcm2711_cfg }, { .compatible = "brcm,bcm4908-pcie", .data = &bcm4908_cfg }, @@ -1748,6 +1767,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 }, {}, };