From patchwork Wed Nov 10 22:14:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12692203 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6D87C433FE for ; Wed, 10 Nov 2021 22:16:34 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 7786C6124C for ; Wed, 10 Nov 2021 22:16:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7786C6124C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version: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:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zV9lJn6alHZhZpkv18JjgyFK421jyfZfqvkEwed6MhM=; b=GzbUbQhvQ+8clw 5oE4HpNN3QDFXWiisp1prUF2pCLhxR/1yeQYVqg6ImIDuTH5GqzGInMB8EEiMVdyhuMZ7WIEd5rm8 MvfIOjysbRrZ4ifZTi3htWfKTgl4GPlW5pwg61bOWpSmWdzD5qCzObkuCCK4W8UCOZ4lo649cm1ET Orx6jGwqanWt9iBldA56vZlNIgv+GnPRoqTxlcuK3REIMq0dC3Cin3nHInj5ydg9fttWH2B8aW59B USmFThZn7EoXKvJjA6bxhG8N5nwuV/m7XIVRBP8WQzXgivQfohAwdmRw8hG2M8aa8mGnyotzYr+tb /I7yMZvDcRu2hQIy+koQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkvsH-006TIg-IE; Wed, 10 Nov 2021 22:15:21 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkvs2-006TEE-LA; Wed, 10 Nov 2021 22:15:07 +0000 Received: by mail-pj1-x102c.google.com with SMTP id gt5so2683483pjb.1; Wed, 10 Nov 2021 14:15:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DtWhfKdUtW9iOKlARDdNWnnImSZ5FB7Na1++POtAlgg=; b=LM7Ah0rKfOoHj+lixTe9M3QqNrzZ7r9PZ2Q+E7+ErGLfbyXA5s8RglAQZgt1FUrck1 ON/2vWjlzQUftUJkwHqBs8YsReO8zt/ZFl0ejVH1QqbM7IoRHkYLwUxSd1E1LAAq1egi 2m/NHpXXtSTB0iZa6CBkikESeFgEVpmxHE+sAS4hmSzTEGy3bjHB/ZhvFOeDpEyrAFVr 9tTlOzVnlOfPConWe8SvpAOxdRcR+4CtkpUYmYenHbTs9Qb4tmTiWbAxgDja4upCDcoR PHwuupSvA7n3LYEKDykBf57h/ULOwtyPcVsKguEHFqKOiRk8cogXZ54mcu6/Tb6yS60H F8wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DtWhfKdUtW9iOKlARDdNWnnImSZ5FB7Na1++POtAlgg=; b=DdWqQ+lnD3yhwzHXfIUSYf7jKX/OoAOO086exGHwEQhCw0BsxbGgLN8Y6IDr01cV2y wR/guD2Tu8o7p92180cGnSmeE3JSEpk0IKrVwYhK4NkRJrS/4/LxL414P7X7nSZJO4D3 qqz/qzzs60DbE/eMe3xKDsIs1cJ1TxT/w8bPlexpa06oXGetLfulgouoMJXoO9RYfdOi RRO0mniZTYxXMibX131dPwxTFSwAviYGCp7syIawPLfIUEliQLvJooS5BkpI+iRMdLhs IeFp1s8oPQbb2oFKrfUwtNJwKBX3wLs6grvza4omzxojPdzy1xGWRUgEzZE/UQ5o6+1x mPeQ== X-Gm-Message-State: AOAM532q2M7n1zRoG1KXW+kl33QZeDc9qtUt7Cl7zJpjZoLOuvuNBiVL EqnZzFdSwL8pnln/es/h+30= X-Google-Smtp-Source: ABdhPJyxzsEjf9jRaw67JXc4mjFC5lTQZqMd/0Rt9PxJGUaSDkuZVg58yf/bwW6/8MOU7wSjW15Efw== X-Received: by 2002:a17:902:d114:b0:142:3934:be82 with SMTP id w20-20020a170902d11400b001423934be82mr2316791plw.40.1636582505108; Wed, 10 Nov 2021 14:15:05 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id q11sm611774pfk.192.2021.11.10.14.15.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 14:15:04 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Bjorn Helgaas , Nicolas Saenz Julienne , Rob Herring , Mark Brown , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , 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 v8 1/8] PCI: brcmstb: Change brcm_phy_stop() to return void Date: Wed, 10 Nov 2021 17:14:41 -0500 Message-Id: <20211110221456.11977-2-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211110221456.11977-1-jim2101024@gmail.com> References: <20211110221456.11977-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211110_141506_716310_439E5EAB X-CRM114-Status: GOOD ( 13.69 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We do not use the result of this function so make it void. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index cc30215f5a43..ff7d0d291531 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1111,9 +1111,10 @@ static inline int brcm_phy_start(struct brcm_pcie *pcie) return pcie->rescal ? brcm_phy_cntl(pcie, 1) : 0; } -static inline int brcm_phy_stop(struct brcm_pcie *pcie) +static inline void brcm_phy_stop(struct brcm_pcie *pcie) { - return pcie->rescal ? brcm_phy_cntl(pcie, 0) : 0; + if (pcie->rescal) + brcm_phy_cntl(pcie, 0); } static void brcm_pcie_turn_off(struct brcm_pcie *pcie) @@ -1143,14 +1144,13 @@ static void brcm_pcie_turn_off(struct brcm_pcie *pcie) static int brcm_pcie_suspend(struct device *dev) { struct brcm_pcie *pcie = dev_get_drvdata(dev); - int ret; brcm_pcie_turn_off(pcie); - ret = brcm_phy_stop(pcie); + brcm_phy_stop(pcie); reset_control_rearm(pcie->rescal); clk_disable_unprepare(pcie->clk); - return ret; + return 0; } static int brcm_pcie_resume(struct device *dev) From patchwork Wed Nov 10 22:14:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12692204 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EA89C433EF for ; Wed, 10 Nov 2021 22:17:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4EE6C6112F for ; Wed, 10 Nov 2021 22:17:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4EE6C6112F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version: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:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DqG4Ts71dwKXeKsnBK+o7XQn5EA6iRtYjSiTx6RSCw8=; b=lf6XwTgnszlINy 2DP2glherhhVoE7nMC45gjZ405jlhk9MEMf2egGAOyZnrHuiJw1vnZMW+JM8JlfrSsgknflMfTCre CqKpXSYQOZvY8nDlTVM+UfJCcNrwEVXNnXEtl1xFPAmm2R9yrJ2ODwzkAfoyxACnVGsWb9tTs5R+8 Vg9w9i3VM0nXLzmfYJ8YW0hH4smhUS3rZqMe0+h9Yv8l2ZJRfUm1igsg6doOPcVoAsN5aqIriKTQf bH4w+hH2zlFYVAo6adFFM/tmPAgdv1cQhhcop3S3L3QE9I6nsd9JqyqyjSIAaeYz+6pBt/kR31Tqn 8bjth3TtzeHQGuzUZyng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkvsZ-006TOY-4R; Wed, 10 Nov 2021 22:15:39 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkvs4-006TF1-AN; Wed, 10 Nov 2021 22:15:09 +0000 Received: by mail-pl1-x62f.google.com with SMTP id u11so4208746plf.3; Wed, 10 Nov 2021 14:15:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fkZ8oSbM149H4kVEdywu4YO/VDBT9raRSHF6PBOWSzY=; b=MX8Wb8jHc8CNttwYxXJDGsm6mgUi5AQdnGJACRhVrpkcDwkMc4QDp6ZbdanwMk2qfG lU6Z/wWeA474bpBesh1JR3Qktd70hhrhregM08IErKc/xSvqBYuYUJiPW37SSp9iGfFM 29pBHFgg5Y4/jxVAxD/hM6Ut0h117R7Z35JLcxyNK7e3ko/NTw5nz5qmhYbHEDq5P64F BxyS23qDAc3khi/qcs2HSlXLSvzczixbJzl3ywhw1XmYnlhhANFkWQEyJbvG00e7kCRq 3dUb84z/ECZE6j4g50rCQEj2oyUgyFtnyt5yuCLTgqew7GlYtNwD4j2s8zHfFR4eEWvW +qdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fkZ8oSbM149H4kVEdywu4YO/VDBT9raRSHF6PBOWSzY=; b=g3e+piawjwbRgWOe8C4hhTbT0nCTes7XhTM2JFnPbzAvZ17hNsO4XliLhh8PccKG75 CZd8IXH822DElwSqc23pt+7u+tn1i6UegDnsOMmL7jWqfhvy14276vrExP40Tcs44nMV vB/TFi4oD+aQGDTWN7W0MTjqh16ZW7rmX8Nc2mia4RjycUTivBWoezKmAQ90eBR4Ma76 lfcJ+300YjyK4Oh61UcyanzShOSnZoKdz6bhKndHmNBcJ+3Hue3HgJoLvuduKo7iaRbk l0zNTcga+EeRbEyTddXuvkiFXvImW6TkrqOsqvg/hFs9Rw9j00TBp92lrA83Tn8D75Da v3Ew== X-Gm-Message-State: AOAM533On9RuMBFvpw16XueJmPZ04q4D8dgURLhtE6A7SV6+BqYxtmNO OVLV0j3MF72FkBuT9gPYGLg= X-Google-Smtp-Source: ABdhPJy9hiMvnGtT6AbFDLiDYRtbR/3Df4gjY8OhUycTTE12MmhzG80OFpZCq+MU8r59kRpaStmwMw== X-Received: by 2002:a17:903:32c2:b0:141:eed4:ec1c with SMTP id i2-20020a17090332c200b00141eed4ec1cmr2604938plr.33.1636582507575; Wed, 10 Nov 2021 14:15:07 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id q11sm611774pfk.192.2021.11.10.14.15.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 14:15:07 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Bjorn Helgaas , Nicolas Saenz Julienne , Rob Herring , Mark Brown , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Rob Herring , Saenz Julienne , 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 v8 2/8] dt-bindings: PCI: Correct brcmstb interrupts, interrupt-map. Date: Wed, 10 Nov 2021 17:14:42 -0500 Message-Id: <20211110221456.11977-3-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211110221456.11977-1-jim2101024@gmail.com> References: <20211110221456.11977-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211110_141508_410027_94732397 X-CRM114-Status: GOOD ( 10.10 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The "pcie" and "msi" interrupts were given the same interrupt when they are actually different. Interrupt-map only had the INTA entry; the INTB, INTC, and INTD entries are added. Signed-off-by: Jim Quinlan Acked-by: Florian Fainelli Acked-by: Rob Herring --- Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index b9589a0daa5c..508e5dce1282 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -142,11 +142,15 @@ examples: #address-cells = <3>; #size-cells = <2>; #interrupt-cells = <1>; - interrupts = , + interrupts = , ; interrupt-names = "pcie", "msi"; interrupt-map-mask = <0x0 0x0 0x0 0x7>; - interrupt-map = <0 0 0 1 &gicv2 GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>; + interrupt-map = <0 0 0 1 &gicv2 GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH + 0 0 0 2 &gicv2 GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH + 0 0 0 3 &gicv2 GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH + 0 0 0 4 &gicv2 GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>; + msi-parent = <&pcie0>; msi-controller; ranges = <0x02000000 0x0 0xf8000000 0x6 0x00000000 0x0 0x04000000>; From patchwork Wed Nov 10 22:14:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12692205 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13A4AC433EF for ; Wed, 10 Nov 2021 22:17:15 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CBA8261104 for ; Wed, 10 Nov 2021 22:17:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CBA8261104 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version: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:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CP0rmEG7wM7DJAtkxnSpjyHke+939KRmLCdNd8KNpXM=; b=fVpZ+C3DMJOPEK GKhkBodeYTAUI0wRi460Eu3vFivvDJ+s9Cxh62BQTfnwH6/hXZ6OOQWEQcKJCbGua0HpnSXhOZO+D Pz/Am6vzgm2b9DbR5jXDNK0m1ysJzu2aVmaf6RgTxP1lx18WIdDqi60R9xpxym1wfnjTAqO5/E5KV u7MCu9jR9w7oDQwrt4vhPlPVACPqFblQ0hFfRz3vCOwlQ08fmX+RGy23jSxUeGWXAOAqUH2bVU/sW tLbRIB+/0YAAr0eMnStlpHJx2A9FLa8G7CgmzgBj0XF1s2nHAFyRI4GWnWRNIj/OqAaUvZmDs92+l ycVoplTyXM8cVYeOo75A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkvsm-006TTK-Au; Wed, 10 Nov 2021 22:15:52 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkvs6-006TGM-RK; Wed, 10 Nov 2021 22:15:12 +0000 Received: by mail-pl1-x62d.google.com with SMTP id r5so4230156pls.1; Wed, 10 Nov 2021 14:15:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XxDFU6zngH2MiSJPUrDOxFHmK942PXrD/2AGczC8Ul8=; b=U8PlSZUXO2Nb4DgwDzXO5TM4bgwclJ59oz8A1dNV72ro2GUKVOZamS+TfYHezB0BRI lLsDAlIR1FnilVZhJS+/iTxU0OukeihbJETdBWX6hUCaQu1V8mc40VolvrSyA48W+rUo 6+hT2xHS6T2TCsDVd3r8kyKFTGkWR/V6vxnrjdrI7nPhCgzhP/5e5CpfomOmm4goBIik u6VOhjkM2+vgnNLYqef/XjL0cVjCvPwzMB3Kjrg0LXbblonBBFCTHorkf8BNKLQ7P2ub Z8/D68ZyWdzwtoEciXUiOudqGCZFQTUluBVdHv/60GjdOppChbBDvJWYVxakr100NC20 Tv7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XxDFU6zngH2MiSJPUrDOxFHmK942PXrD/2AGczC8Ul8=; b=ao9zx3UWLZIv58K+zSMI5m1/1vHxTIA7uqlWuaZoaLzEkmMlyhmpKD0+ZRBmEL9Z3u 26Aip39rxpFPXkBP3pOJY07uKaJyitUvlp2S7h1DA7+MSENKMTYhU6VonniJYV2+HQxX PXxu7t9MUa8Rur+3BkJ3MDvJV703PAd/EVrv9KxsBcbAx6EspGmqENlaO1h1eZxsvu42 5ll1JGRkTNoaC+IGvMt74GF6+rzTEz+zoTRaonftKJOo47QAPadBrHGMjDVkLn18/2lb uVmo7Se/HWBNA+vwmNjSBAifbD4DhPUHnGqkPtHwcV5s7LG0tE1TkyflhYqJkaFa0/7F Q3rA== X-Gm-Message-State: AOAM532+9qy/tzSXIhY2BMY4NfFuDtwbQlBZ2UbKEIY5tP5YPZoKcc4R vBkFlxvlexNuLer39SRb5X0= X-Google-Smtp-Source: ABdhPJz69xPfkDk7VZal+/vPVQLGzVtHQBOzwHeh1QSi55XAjMhcdOd99CHjXEDMq8GdsaYaog0big== X-Received: by 2002:a17:902:7001:b0:141:67d3:adc6 with SMTP id y1-20020a170902700100b0014167d3adc6mr2207600plk.65.1636582510038; Wed, 10 Nov 2021 14:15:10 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id q11sm611774pfk.192.2021.11.10.14.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 14:15:09 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Bjorn Helgaas , Nicolas Saenz Julienne , Rob Herring , Mark Brown , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Rob Herring , Saenz Julienne , 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 v8 3/8] dt-bindings: PCI: Add bindings for Brcmstb EP voltage regulators Date: Wed, 10 Nov 2021 17:14:43 -0500 Message-Id: <20211110221456.11977-4-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211110221456.11977-1-jim2101024@gmail.com> References: <20211110221456.11977-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211110_141510_930642_8641CC71 X-CRM114-Status: GOOD ( 10.14 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Similar to the regulator bindings found in "rockchip-pcie-host.txt", this allows optional regulators to be attached and controlled by the PCIe RC driver. That being said, this driver searches in the DT subnode (the EP node, eg pci-ep@0,0) for the regulator property. The use of a regulator property in the pcie EP subnode such as "vpcie12v-supply" depends on a pending pullreq to the pci-bus.yaml file at https://github.com/devicetree-org/dt-schema/pull/63 Signed-off-by: Jim Quinlan --- .../bindings/pci/brcm,stb-pcie.yaml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml index 508e5dce1282..ef2427320b7d 100644 --- a/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml @@ -158,5 +158,28 @@ examples: <0x42000000 0x1 0x80000000 0x3 0x00000000 0x0 0x80000000>; brcm,enable-ssc; brcm,scb-sizes = <0x0000000080000000 0x0000000080000000>; + + /* PCIe bridge */ + pci@0,0 { + #address-cells = <3>; + #size-cells = <2>; + reg = <0x0 0x0 0x0 0x0 0x0>; + compatible = "pciclass,0604"; + device_type = "pci"; + vpcie3v3-supply = <&vreg7>; + ranges; + + /* PCIe endpoint */ + pci-ep@0,0 { + assigned-addresses = + <0x82010000 0x0 0xf8000000 0x6 0x00000000 0x0 0x2000>; + reg = <0x0 0x0 0x0 0x0 0x0>; + compatible = "pci14e4,1688"; + #address-cells = <3>; + #size-cells = <2>; + + ranges; + }; + }; }; }; From patchwork Wed Nov 10 22:14:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12692206 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA048C433F5 for ; Wed, 10 Nov 2021 22:17:32 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8012861058 for ; Wed, 10 Nov 2021 22:17:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8012861058 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version: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:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AQuzhI8XDnWW+rPrpUDQiQrvuB9Qpchs06wKPIORvBM=; b=GjpsOMwTiUmzsn xtJ5LlJ4vAduyLXBgNHXto6Z/CXm0H00p2n22geh7CK1wv8TBNj7Zi4KvkThB7JQE1/qe7+ntAsn+ YJl8KSwNs4SBBKyf8qG7ez2JWeAzMrecPwTdntOedBCnvxrsLP13/9lVU4n1EB1bFl6q0/JnmlHV+ 7rGhCLZEgEsc/yvxKu3FLzdSWspsR4b0+pieTZrFNhaKqdrBxUu+0EziyUgNJD2sJf0jsyBncGuzj 9QkOBw6GEye7pqbldhuqaMgRUkiKA+Iy6gA4ahQMKZPBYlTRme00BjsWX4A0qtgkeDpPZcIp2XOYh RWZgNvIaebmnmlbWBd1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkvt8-006TcZ-NK; Wed, 10 Nov 2021 22:16:14 +0000 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkvsL-006TK9-3b; Wed, 10 Nov 2021 22:15:27 +0000 Received: by mail-pg1-x52f.google.com with SMTP id r28so3501127pga.0; Wed, 10 Nov 2021 14:15:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PvW84sSM/ElHSJsh3mR8zIRk7WcSP30fNyjpi271Ac0=; b=o1ywP0id3ECtESf0REWtug+UcPlSNjlFpDDWFPhKmC76P7GNw1EEPeuGSPLSVgQW83 Y19SYpmAeiDtFqfDFqHhGhe0Xrptn7Z5qtkBsLxB9I5w1kNz3zCdZG0P6NZ0WqP3VEAz FKT6NwHi/PDsa5FJ8DYNO+MlgtWAdG5XBRDvCr6u405AJpmHJdGK5HEjpmLnjHmy4hn8 r+rea+cKrHsH5yWF9gPQuxn8A9I1ya29KdGSWIvf4ky2/txyMyKzJhyeW62+1AEOEly8 DFbpSKcxvw7P6Yw2fu4tHgws/ur9NCFqHpQfaNfWhJsV8swsY1EsQkanRx8GV62RVGIV NAOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PvW84sSM/ElHSJsh3mR8zIRk7WcSP30fNyjpi271Ac0=; b=GmctQLNeYifhqJ54nwCF/gxPkGcPc6+atQ5shn2ddUVoof9wyCChLLcjT2Gmv7p+Fo qYD6zI68ZJJbf5frBlu7XC3ma8NzfjDeL0fmTpK2EKBSlkOV4IT3/Sr2CzaWz2R3bCBX CGKI8E54s6x5s4aSiXLAAPJ8M0yADp6LH7/Zkq86ZQF0U9DeHmBK1dhFzvbqfZLhXMI7 21q9/TKFg51xTJLvrLhIlvzzQxUnvOdWf8kJnLTGPc11hbLuq3rFnVHmu4wFhVyM+nfP awe3Or5zavO757ARi6Hd9IBPITMk2WKbmCC8SEup6+K4oo0/yLtaiqPJWWAFpftPSgpf xt/Q== X-Gm-Message-State: AOAM532RhTHqa35IReiT4zngWIefHxeRIeaL/GJuj282m9VJVJeIGqaZ HvK5DthU2Nb32dkv7FckmgA= X-Google-Smtp-Source: ABdhPJzIGi5KipSekueMBs3NqNVbMJL1cyf++SsRu8rJ6bD9cBYgCuQ1ksTGud46Cw7E7X6WmepKJg== X-Received: by 2002:aa7:8059:0:b0:47e:5de6:5bc7 with SMTP id y25-20020aa78059000000b0047e5de65bc7mr2285307pfm.78.1636582524337; Wed, 10 Nov 2021 14:15:24 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id q11sm611774pfk.192.2021.11.10.14.15.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 14:15:23 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Bjorn Helgaas , Nicolas Saenz Julienne , Rob Herring , Mark Brown , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , 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 v8 7/8] PCI: brcmstb: Split brcm_pcie_setup() into two funcs Date: Wed, 10 Nov 2021 17:14:47 -0500 Message-Id: <20211110221456.11977-8-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211110221456.11977-1-jim2101024@gmail.com> References: <20211110221456.11977-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211110_141525_199370_D111E601 X-CRM114-Status: GOOD ( 20.63 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We need to take some code in brcm_pcie_setup() and put it in a new function brcm_pcie_linkup(). In future commits the brcm_pcie_linkup() function will be called indirectly by pci_host_probe() as opposed to the host driver invoking it directly. Some code that was executed after the PCIe linkup is now placed so that it executes prior to linkup, since this code has to run prior to the invocation of pci_host_probe(). Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 65 ++++++++++++++++----------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index ff7d0d291531..1a841c240abb 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -863,16 +863,9 @@ static inline int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie, static int brcm_pcie_setup(struct brcm_pcie *pcie) { - struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); u64 rc_bar2_offset, rc_bar2_size; void __iomem *base = pcie->base; - struct device *dev = pcie->dev; - struct resource_entry *entry; - bool ssc_good = false; - struct resource *res; - int num_out_wins = 0; - u16 nlw, cls, lnksta; - int i, ret, memc; + int ret, memc; u32 tmp, burst, aspm_support; /* Reset the bridge */ @@ -957,6 +950,40 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) if (pcie->gen) brcm_pcie_set_gen(pcie, pcie->gen); + /* Don't advertise L0s capability if 'aspm-no-l0s' */ + aspm_support = PCIE_LINK_STATE_L1; + if (!of_property_read_bool(pcie->np, "aspm-no-l0s")) + aspm_support |= PCIE_LINK_STATE_L0S; + tmp = readl(base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY); + u32p_replace_bits(&tmp, aspm_support, + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK); + writel(tmp, base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY); + + /* + * For config space accesses on the RC, show the right class for + * a PCIe-PCIe bridge (the default setting is to be EP mode). + */ + tmp = readl(base + PCIE_RC_CFG_PRIV1_ID_VAL3); + u32p_replace_bits(&tmp, 0x060400, + PCIE_RC_CFG_PRIV1_ID_VAL3_CLASS_CODE_MASK); + writel(tmp, base + PCIE_RC_CFG_PRIV1_ID_VAL3); + + return 0; +} + +static int brcm_pcie_linkup(struct brcm_pcie *pcie) +{ + struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); + struct device *dev = pcie->dev; + void __iomem *base = pcie->base; + struct resource_entry *entry; + struct resource *res; + int num_out_wins = 0; + u16 nlw, cls, lnksta; + bool ssc_good = false; + u32 tmp; + int ret, i; + /* Unassert the fundamental reset */ pcie->perst_set(pcie, 0); @@ -994,24 +1021,6 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) num_out_wins++; } - /* Don't advertise L0s capability if 'aspm-no-l0s' */ - aspm_support = PCIE_LINK_STATE_L1; - if (!of_property_read_bool(pcie->np, "aspm-no-l0s")) - aspm_support |= PCIE_LINK_STATE_L0S; - tmp = readl(base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY); - u32p_replace_bits(&tmp, aspm_support, - PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK); - writel(tmp, base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY); - - /* - * For config space accesses on the RC, show the right class for - * a PCIe-PCIe bridge (the default setting is to be EP mode). - */ - tmp = readl(base + PCIE_RC_CFG_PRIV1_ID_VAL3); - u32p_replace_bits(&tmp, 0x060400, - PCIE_RC_CFG_PRIV1_ID_VAL3_CLASS_CODE_MASK); - writel(tmp, base + PCIE_RC_CFG_PRIV1_ID_VAL3); - if (pcie->ssc) { ret = brcm_pcie_set_ssc(pcie); if (ret == 0) @@ -1186,6 +1195,10 @@ static int brcm_pcie_resume(struct device *dev) if (ret) goto err_reset; + ret = brcm_pcie_linkup(pcie); + if (ret) + goto err_reset; + if (pcie->msi) brcm_msi_set_regs(pcie->msi); From patchwork Wed Nov 10 22:14:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12692207 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9FB9C433EF for ; Wed, 10 Nov 2021 22:17:58 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id BBD3961058 for ; Wed, 10 Nov 2021 22:17:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BBD3961058 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version: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:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=q5YOOqQbfr8132DUKFdVNTMbHMq1Q2u03htp0+Wb2Bs=; b=cNYHaQCLdMVYWe lYH2uu32fT8jlzk1F1abbJCYaAZVoIX9DGUP4aO1AOGsT2YA8XIkdO7zvRyyhjBjBfzq1Zh+IhEm/ 9OPhqN6MJeqHtXWdQ/y3ocnspgRMBWzb1ScAAX6fvM0MrFOnvHpnMrUkIei/BXFe3OB6x9RFyxbz0 axxOrUSmp0YlCVC7RNWy00qYujsCDunPkKgv4+h7aXkffG9IYCmhIMSH9Je5jKPPl5NYQW0MQ9dS9 vyIKasqLoue/w8h/CBR5JppApddKNse6IRah5dvw4okq3sSnUi5NIwxH42KP/DyiUm/hNGHDo2iYI ngvO1Fe3kismq/6BoAbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkvtX-006TqX-Mc; Wed, 10 Nov 2021 22:16:40 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkvsN-006TLB-AW; Wed, 10 Nov 2021 22:15:28 +0000 Received: by mail-pj1-x1031.google.com with SMTP id o6-20020a17090a0a0600b001a64b9a11aeso3046617pjo.3; Wed, 10 Nov 2021 14:15:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fphIdUDXSUqQoN+550Js8LMURtYvUNV04vrXLaftqCA=; b=ln4adG2D4DDbq+rFf48o0HcEK0FDmocia0H8rr3LEwkHDfo2H/+WjFR9ays+LbzTcu fFzPxWA3n+Cvq0bS3Q+eX3qtnO19Qoext6nY+slmvdD4XGOM8VHcfdne05O2u6TMzpRy Sp93MFXN9qp3dNlJKnsLsXLy06pbdUog0MIAPlgt2wb7H/s/hQxXZkOg4PmCrgiYNrsI sYb2cz2VzuaOVHCdKVfq/UWQHCU4mylRjZP/sd/JYUyA8JRtzHPv3ax1XpqOr69Smsmc a+jw/hWmXgTt6AKyeKrm5SJk/6ogV0vJm7c6yWOd0JZQgholaOnlOaP2gVVf1hrCJ/rf 0X3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fphIdUDXSUqQoN+550Js8LMURtYvUNV04vrXLaftqCA=; b=ogAe20mPbjSUEx44l3dLeo1ji6DluguT7NKQsSsrLh3fMvRDwBDj0kZv56epB3nfh8 zFpiGPz9n5HLAe8M1kCqfW348UYlPnNEe3b643aTWJ8091YEJHa5fWZQH/M1yRWyVXvU aMu7Gfe2AeEQFVOkLIWHERSKKAWS8vsK0vgifrrb+FDn4TViD606rPZrU5mWY0j3/F2Z VaFhMh/OchU188b68tOSXzmk98CyKjOV6hAqlKZIzo+q+dVcv4NCLelRMJmc8wBCJskP vNt23WsXKq+NcMVWl4/OtCQmTA4qxtoljC3B7zdKE9mUGWYZwyTsmQ2wi9+pfkCcvCIf OJuQ== X-Gm-Message-State: AOAM5317eRjXVVqFeXjALn1TiiuE2dBi5TFcUR1xhfdDpGsT3DZZ9Jsj 63XHCtmBiWpiDBFHDXhLkaM= X-Google-Smtp-Source: ABdhPJyQQlP061pJeeiR5E45HKt/hY21coyGMCUv9LXIeukPDxZPkugMJD4lzg5n7VjYO33voos8CQ== X-Received: by 2002:a17:90a:4701:: with SMTP id h1mr2725940pjg.184.1636582526604; Wed, 10 Nov 2021 14:15:26 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id q11sm611774pfk.192.2021.11.10.14.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 14:15:26 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Bjorn Helgaas , Nicolas Saenz Julienne , Rob Herring , Mark Brown , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , 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 v8 8/8] PCI: brcmstb: Add control of subdevice voltage regulators Date: Wed, 10 Nov 2021 17:14:48 -0500 Message-Id: <20211110221456.11977-9-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211110221456.11977-1-jim2101024@gmail.com> References: <20211110221456.11977-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211110_141527_395210_447DE1F3 X-CRM114-Status: GOOD ( 25.47 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This Broadcom STB PCIe RC driver has one port and connects directly to one device, be it a switch or an endpoint. We want to be able to leverage the recently added mechansim that allocates and turns on/off subdevice regulators. All that needs to be done is to put the regulator DT nodes in the bridge below host and to set the pci_ops methods add_bus and remove_bus. Note that the pci_subdev_regulators_add_bus() method is wrapped for two reasons: 1. To acheive linkup after the voltage regulators are turned on. 2. If, in the case of an unsuccessful linkup, to redirect any PCIe accesses to subdevices, e.g. the scan for DEV/ID. This redirection is needed because the Broadcom PCIe HW wil issue a CPU abort if such an access is made when there is no linkup. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 56 ++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 1a841c240abb..692df3dda77a 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -191,6 +191,7 @@ static inline void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, static inline void brcm_pcie_perst_set_4908(struct brcm_pcie *pcie, u32 val); static inline void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val); static inline void brcm_pcie_perst_set_generic(struct brcm_pcie *pcie, u32 val); +static int brcm_pcie_add_bus(struct pci_bus *bus); enum { RGR1_SW_INIT_1, @@ -295,6 +296,7 @@ struct brcm_pcie { u32 hw_rev; void (*perst_set)(struct brcm_pcie *pcie, u32 val); void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); + bool refusal_mode; }; /* @@ -711,6 +713,18 @@ static void __iomem *brcm_pcie_map_conf(struct pci_bus *bus, unsigned int devfn, /* Accesses to the RC go right to the RC registers if slot==0 */ if (pci_is_root_bus(bus)) return PCI_SLOT(devfn) ? NULL : base + where; + if (pcie->refusal_mode) { + /* + * At this point we do not have link. There will be a CPU + * abort -- a quirk with this controller --if Linux tries + * to read any config-space registers besides those + * targeting the host bridge. To prevent this we hijack + * the address to point to a safe access that will return + * 0xffffffff. + */ + writel(0xffffffff, base + PCIE_MISC_RC_BAR2_CONFIG_HI); + return base + PCIE_MISC_RC_BAR2_CONFIG_HI + (where & 0x3); + } /* For devices, write to the config space index register */ idx = PCIE_ECAM_OFFSET(bus->number, devfn, 0); @@ -722,6 +736,8 @@ static struct pci_ops brcm_pcie_ops = { .map_bus = brcm_pcie_map_conf, .read = pci_generic_config_read, .write = pci_generic_config_write, + .add_bus = brcm_pcie_add_bus, + .remove_bus = pci_subdev_regulators_remove_bus, }; static inline void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val) @@ -1242,6 +1258,34 @@ static const struct of_device_id brcm_pcie_match[] = { {}, }; +static int brcm_pcie_add_bus(struct pci_bus *bus) +{ + struct pci_host_bridge *hb; + struct brcm_pcie *pcie; + int ret; + + if (!pcie_is_port_dev(bus->self)) + return 0; + + hb = pci_find_host_bridge(bus); + pcie = (struct brcm_pcie *) hb->sysdata; + + ret = pci_subdev_regulators_add_bus(bus); + if (ret) + return ret; + + /* + * If we have failed linkup there is no point to return an error as + * currently it will cause a WARNING() from pci_alloc_child_bus(). + * We return 0 and turn on the "refusal_mode" so that any further + * accesses to the pci_dev just get 0xffffffff + */ + if (brcm_pcie_linkup(pcie) != 0) + pcie->refusal_mode = true; + + return 0; +} + static int brcm_pcie_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node, *msi_np; @@ -1333,7 +1377,17 @@ static int brcm_pcie_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pcie); - return pci_host_probe(bridge); + ret = pci_host_probe(bridge); + if (!ret && !brcm_pcie_link_up(pcie)) + ret = -ENODEV; + + if (ret) { + brcm_pcie_remove(pdev); + return ret; + } + + return 0; + fail: __brcm_pcie_remove(pcie); return ret;