From patchwork Tue Oct 11 18:42:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13004255 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 A29BEC433FE for ; Tue, 11 Oct 2022 18:43:39 +0000 (UTC) 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=8/TBgKshvQbEOxRnA0hbaUCLv8xvh7BnA/c8GFQTrN8=; b=S2pMxpobwqp4dn 0RfU5Z5tWuwoTjZWn4T1pINcQOZBtVrW+kO0MuhbU6iyXXaP5qcxhMw/pdOHvq00iZE2LHe9/jVVt 3CkwKpzPySelQDiP6Eu78Ia0xk7fP73sIPWOup9tCBh6lXJUMwfXXW/UpwfGow7dw7zWB0LXmut60 gjr3Z15uw3+BqIbquO5gCYWnN8hFcxtD/PhMeIX2kmAceP1eErMkU/AlWZM6X2SRvtHq5JMOGtgaE FCop09hiw1JvmX1qHjp1GIBmqS9+UFoSp6x1MdHZcygNo8JVIjZXeWKatWeWF7z3KgQjAYQDw3n70 G08BfEwR/Eio/phA+YMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiKD1-005TGn-EH; Tue, 11 Oct 2022 18:42:31 +0000 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiKCq-005TAA-0E; Tue, 11 Oct 2022 18:42:21 +0000 Received: by mail-qk1-x736.google.com with SMTP id t25so2008924qkm.2; Tue, 11 Oct 2022 11:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=VS2GXG21DjRdeQjnmza5VEtpvDq1HC+087/4J2zXY70=; b=kIkrDBQ649U2RhFRoxOmCqKmWosJ2Ya9xlSmG2NtSdMT3UM92ZKefI1r2Cfqec69Fb i0H8dvUKeDZmxx+kB8/kXIPJ9U7da18cXsq2PnSsQNMTmetDy+gD+N+GjWYhz0dhWIMz ycBtLQVh4RfCPGWwwbWAbVAF+7QfwEtiejNgtuabQU6ColpwLbXSQAk/9zFN46aYY4+F 8p/7fnoOSLEK47Muc8DjH5qam7YY44lBmsMNNEqWXQ5//TE+lwTK7gWFegK69LZJWv8v QNM4nTj7OtA4vZC9MHnElaE100dG/0R0ixMl479xEx9Yw+lQ4eyEAYPL4OpTHzZq3EQr 1kfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=VS2GXG21DjRdeQjnmza5VEtpvDq1HC+087/4J2zXY70=; b=XDXHHWzZm9jU3z+Pec+GU61yDxjmbcSsphwCKtxsYzV8agtl1NIKgitQKSO2xk980n 152bjxYJGNQ/rrvj/FbrwrHwhb5NyGdgLICB27mIVYrY7nGcT2n+3dL6VYtRm6cMvakz 7HConBAU6kt5Ys2iAarQ2bETPracX5LieFeyAzvUqNZsOsG33knzqE6lhzB4xkaCxstD 3ln4JoIdeHJIzUuskMw/ZgSrmGUfhYT2M20wuihjKLgkot3CeyZToyuV1JY43e048E67 Gjo2zBd7b7gOTHqYPz/MSWRY8nw1K8vRMNIrs+g1fsasu2b3yf037JnhhZmWgWX0pr5m XF2A== X-Gm-Message-State: ACrzQf15nHKUXmmfbAj+FvQDNZG9kUvxgUzd8ssLiBhGQRk+5QKpuoZo vGnnAP+LyUwuc/MjXNrdpts= X-Google-Smtp-Source: AMsMyM53rDZRF8GSDj2tWNygq39EPCcGobdIWvrgxjFSBGYyZVwV0M5jHCi6Y28pLL6YgxnDaTLfEA== X-Received: by 2002:a05:620a:25d0:b0:6bb:f597:1a3 with SMTP id y16-20020a05620a25d000b006bbf59701a3mr17401628qko.43.1665513735071; Tue, 11 Oct 2022 11:42:15 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id fc8-20020a05622a488800b003938a65479bsm10961732qtb.10.2022.10.11.11.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 11:42:14 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=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 v2 1/5] PCI: brcmstb: Enable Multi-MSI Date: Tue, 11 Oct 2022 14:42:06 -0400 Message-Id: <20221011184211.18128-2-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011184211.18128-1-jim2101024@gmail.com> References: <20221011184211.18128-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221011_114220_064380_87FA452F X-CRM114-Status: GOOD ( 15.89 ) 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 always wanted to enable Multi-MSI but didn't have a test device until recently. In addition, there are some devices out there that will ask for multiple MSI but refuse to work if they are only granted one. Signed-off-by: Jim Quinlan Acked-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 521acd632f1a..a45ce7d61847 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -445,7 +445,8 @@ static struct irq_chip brcm_msi_irq_chip = { static struct msi_domain_info brcm_msi_domain_info = { /* Multi MSI is supported by the controller, but not by this driver */ - .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS), + .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | + MSI_FLAG_MULTI_PCI_MSI), .chip = &brcm_msi_irq_chip, }; @@ -505,21 +506,23 @@ static struct irq_chip brcm_msi_bottom_irq_chip = { .irq_ack = brcm_msi_ack_irq, }; -static int brcm_msi_alloc(struct brcm_msi *msi) +static int brcm_msi_alloc(struct brcm_msi *msi, unsigned int nr_irqs) { int hwirq; mutex_lock(&msi->lock); - hwirq = bitmap_find_free_region(msi->used, msi->nr, 0); + hwirq = bitmap_find_free_region(msi->used, msi->nr, + order_base_2(nr_irqs)); mutex_unlock(&msi->lock); return hwirq; } -static void brcm_msi_free(struct brcm_msi *msi, unsigned long hwirq) +static void brcm_msi_free(struct brcm_msi *msi, unsigned long hwirq, + unsigned int nr_irqs) { mutex_lock(&msi->lock); - bitmap_release_region(msi->used, hwirq, 0); + bitmap_release_region(msi->used, hwirq, order_base_2(nr_irqs)); mutex_unlock(&msi->lock); } @@ -527,16 +530,17 @@ static int brcm_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, unsigned int nr_irqs, void *args) { struct brcm_msi *msi = domain->host_data; - int hwirq; + int hwirq, i; - hwirq = brcm_msi_alloc(msi); + hwirq = brcm_msi_alloc(msi, nr_irqs); if (hwirq < 0) return hwirq; - irq_domain_set_info(domain, virq, (irq_hw_number_t)hwirq, - &brcm_msi_bottom_irq_chip, domain->host_data, - handle_edge_irq, NULL, NULL); + for (i = 0; i < nr_irqs; i++) + irq_domain_set_info(domain, virq + i, hwirq + i, + &brcm_msi_bottom_irq_chip, domain->host_data, + handle_edge_irq, NULL, NULL); return 0; } @@ -546,7 +550,7 @@ static void brcm_irq_domain_free(struct irq_domain *domain, struct irq_data *d = irq_domain_get_irq_data(domain, virq); struct brcm_msi *msi = irq_data_get_irq_chip_data(d); - brcm_msi_free(msi, d->hwirq); + brcm_msi_free(msi, d->hwirq, nr_irqs); } static const struct irq_domain_ops msi_domain_ops = { From patchwork Tue Oct 11 18:42:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13004256 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 2D35CC433FE for ; Tue, 11 Oct 2022 18:43:51 +0000 (UTC) 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=H+SVR/QG1/9lpx6FMdSA/qpOH1O0+fTcKXDwdAkWS/A=; b=zlsso9bXnlKBWz nRtRXZe7NLK7pPZl+Ia/opOtJb1RuEXCVzdITTpYufjDZ1UljKr1OD9qc/FYzCon6oz+wtfg4xePr q1/B+WK43BK+GFRpO4hlsC0uqYTQYpIV8P9nTgcVW4NVKhzmLargOHvdct1t8w0G2y0rJRkmqenYJ MwovTpTspMQNt9XtwBhUjqqSaQz+mlHOEscix3ouRuDj0DsKa4y/ok6dW1ve21qZuChMA0bPrjVRD uZqfiJW9ZRPZyzXWsmh59P8Y+P9EJc87zUR9mqIFBZIP2wbTc35zO4vE5zBfREEWnqGosK82vjyLo Dn26loX55XHfA+dM4DLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiKD9-005TIc-Oq; Tue, 11 Oct 2022 18:42:39 +0000 Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiKCq-005TAF-5v; Tue, 11 Oct 2022 18:42:22 +0000 Received: by mail-qk1-x732.google.com with SMTP id a5so4056151qkl.6; Tue, 11 Oct 2022 11:42:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=ZtG62yJbqIS8I6QUrG+przRY/17aM7QpmVb3R+LpRSg=; b=e2UxZkjdHT1/gH9KPu5K9mIPgqAyJ+P/9Q3AnM2oh7crO1Pgm4GlT8rINymylRbreu XAfbmh8brx1W5NZfau9uVaqUHOWAUEI8XR1etIHH+h23ZeEnjXXBc0xXhRXqF6AlNsGr 1+phwmIjU9gG0h/jwO1Y7RKIIoNzlga2sEKX87DdpkJle7dvQUcEqWuflF05fvWEvQot eWKVgv8toCT1Tz3qgwmQNj6wByo0Or7aw3jzCLcVqmxudf9D+SffB5XHWx2lOCpQ2ouU m1iYsrmOA+LnkkyGZiySuCzsgfGVmbcLYqCZ4gcFVPo14Pw6S+echD7eU9iLGs8ehoSo QUvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ZtG62yJbqIS8I6QUrG+przRY/17aM7QpmVb3R+LpRSg=; b=KWRK0oawLOwC8rxPAIK5vUBO/ZlOyMlMzF/qXO4rVyDmxsZ3w5II+Zonm9SZt6AzIM bV66saXezSq2tojLmNRNLwBM3njfryLM/IFKex3vYoisCEeKfvl64r3D8IApWrGrpU4w TyScE20bQh4t8H/aysPUmUkA+vO4rtuzgcxJTIiWteEyhMW0Q4Oe8UFZ2hQ8hCP1MktV UHOdvvY8kOFDDGe1DBvcBizqBKXTCsde5v2tZoM3ICKP63yKmF99MUhZdLp+v+Z5u9mO OZlOHW0LzuGDzI5JJKy2tDgNDBMHSXlo/mR6VXLMhu0aZAy6zI5PZrP+7oUNX5l7xLnk kkLg== X-Gm-Message-State: ACrzQf0i/qvWxvvJiylLftGTe9mp1C9nYButCP3CnPIauU1F61Owha2S I9bLlbP5RNB3XelVc8EuIlo= X-Google-Smtp-Source: AMsMyM5O7zbQttUz+a7lUjKpe6+4O68+pvNdZSPYmodxGpzocDWp7GUPiIVxzDTOzwDMl5+XVATp0w== X-Received: by 2002:a05:620a:530a:b0:6df:b743:9671 with SMTP id oo10-20020a05620a530a00b006dfb7439671mr17009906qkn.762.1665513736435; Tue, 11 Oct 2022 11:42:16 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id fc8-20020a05622a488800b003938a65479bsm10961732qtb.10.2022.10.11.11.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 11:42:15 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=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 v2 2/5] PCI: brcmstb: Wait for 100ms following PERST# deassert Date: Tue, 11 Oct 2022 14:42:07 -0400 Message-Id: <20221011184211.18128-3-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011184211.18128-1-jim2101024@gmail.com> References: <20221011184211.18128-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221011_114220_250541_E195FADA X-CRM114-Status: GOOD ( 11.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 Be prudent and give some time for power and clocks to become stable. As described in the PCIe CEM specification sections 2.2 and 2.2.1; as well as PCIe r5.0, 6.6.1. Signed-off-by: Jim Quinlan Acked-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index a45ce7d61847..39b545713ba0 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1037,8 +1037,15 @@ static int brcm_pcie_start_link(struct brcm_pcie *pcie) pcie->perst_set(pcie, 0); /* - * Give the RC/EP time to wake up, before trying to configure RC. - * Intermittently check status for link-up, up to a total of 100ms. + * Wait for 100ms after PERST# deassertion; see PCIe CEM specification + * sections 2.2, PCIe r5.0, 6.6.1. + */ + msleep(100); + + /* + * Give the RC/EP even more time to wake up, before trying to + * configure RC. Intermittently check status for link-up, up to a + * total of 100ms. */ for (i = 0; i < 100 && !brcm_pcie_link_up(pcie); i += 5) msleep(5); From patchwork Tue Oct 11 18:42:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13004257 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 90A38C433F5 for ; Tue, 11 Oct 2022 18:43:53 +0000 (UTC) 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=G0/3jj+ovRlQahBfNDCY5VEF4MoBeEsbPlhpd728kvM=; b=4IAAwc942uYT7W mQH3ePxXxDBGWd2XtlkZWQrIh6sA4fuOyqBe26yA7K/RR+3Wf6rLhpFnK1VKCLhEE69jWDnvtuGfY JuMoL8MWOjrjaMr3dmqVofEUI2qkVi34ZUrL9fpXBgWj8glvLZ/3UccL7Y7AQBw2Ki9/ccy4AMn02 LUeHpcaXKBDXrFoXzPsSMyfXFKiagYSQkwV4QgYLseE9RWEcUOSXizR5dD9lOOY26NR6Q5qxiSKbM ITmz89hYkzkrEXmN8b2HdC7ls80bhjIRYBfR29d0uvf9gUENp6hOJlup7gBR+jmxcdDdoogtZSikv 63cBQybMUd6zBBidxEVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiKDI-005TKY-1F; Tue, 11 Oct 2022 18:42:48 +0000 Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiKCq-005TB5-62; Tue, 11 Oct 2022 18:42:22 +0000 Received: by mail-qk1-x732.google.com with SMTP id o2so1883564qkk.10; Tue, 11 Oct 2022 11:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=yC68PwSujcmdozdXRLObvH5ia1utZiSGZZx8tkWQRwM=; b=BM856Tof1maVbKADbUoeep+v/Kh8Xs4qIGjPkd1Sxt3W/8Y6ieF7VVHMspdh6BFj6G iXG0PCB0OrR+maaj9i05cbmgMrUiZ2Yv2KMwekF2Xr7SwJ5Xu5raHGepeHyp3GCCYAiZ PWgBi8HaDT6cWz1658v8xfGY8Yw//RrgNDoOwgB5eTmtFhNiN91sht2mLWf1qJ6CNpOy daMwLlGgcLOAw6XYIgAZZ+bdCx0AruOla8hAtt/N/HLDEEzgvtt58sv1osYo5Jr2k04o C9MHMrsCz4sa5JnMTMiDonVFbcyD/IdAgZGUBbqxwwMljnoY1n6cUvkpvp6ZEZb1uXmz 1Dqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=yC68PwSujcmdozdXRLObvH5ia1utZiSGZZx8tkWQRwM=; b=BojHPn2fxrDldMWUXSXW+73ojpS5sTDaeukcSbgdnzIz1wdVS9CUpP3aTRwZDQyKDu 92XEuvtUYCqwttnsoJvbkmpp/Y4ZSonr9J5g+maoLYtJik/5T02xhBJ031Utv3n15Eud rNVrkHc3OKp0oMf1cG9PfqAtVNXSsQlN5C0jIMio95VKefsza0hN5h6q5ikofq24K2TA eRsBjIL1rB8VaWCcruDOzydWGQRUXiSxdKuascXPqoXMWLcDUHALb8hPcg6KveMscGfi +NLV4FAdMWtXL3xiNm+QQ/OSAKN1BWbRNr++EeXuCf1DjfNh3IDnwBtcjSdLKsSgjaK1 2/pw== X-Gm-Message-State: ACrzQf1X+JhctZxwcq48ot58L6oMHh0RTi5xWkwX6rNEh/tO4tuqcCZm VMVgcpq8/0UIOSfL3a502EAmIpQywaM= X-Google-Smtp-Source: AMsMyM4Vf6sWyq8Gx07MlfotRqmjQhuQIEe0h6hqEI4mPD99OXt3GmtehfAZuvdtbMJqLkVQo7HZWw== X-Received: by 2002:a05:620a:12fb:b0:6ee:79f2:3716 with SMTP id f27-20020a05620a12fb00b006ee79f23716mr3676940qkl.348.1665513738030; Tue, 11 Oct 2022 11:42:18 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id fc8-20020a05622a488800b003938a65479bsm10961732qtb.10.2022.10.11.11.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 11:42:17 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=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 v2 3/5] PCI: brcmstb: Replace status loops with read_poll_timeout_atomic() Date: Tue, 11 Oct 2022 14:42:08 -0400 Message-Id: <20221011184211.18128-4-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011184211.18128-1-jim2101024@gmail.com> References: <20221011184211.18128-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221011_114220_255343_3D201AED X-CRM114-Status: GOOD ( 11.09 ) 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 It would be nice to replace the PCIe link-up loop as well but there are too many uses of this that do not poll (and the read_poll_timeout uses "timeout==0" to loop forever). Signed-off-by: Jim Quinlan Acked-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 39b545713ba0..c7210cec1f58 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -302,42 +303,34 @@ static u32 brcm_pcie_mdio_form_pkt(int port, int regad, int cmd) /* negative return value indicates error */ static int brcm_pcie_mdio_read(void __iomem *base, u8 port, u8 regad, u32 *val) { - int tries; u32 data; + int err; writel(brcm_pcie_mdio_form_pkt(port, regad, MDIO_CMD_READ), base + PCIE_RC_DL_MDIO_ADDR); readl(base + PCIE_RC_DL_MDIO_ADDR); - - data = readl(base + PCIE_RC_DL_MDIO_RD_DATA); - for (tries = 0; !MDIO_RD_DONE(data) && tries < 10; tries++) { - udelay(10); - data = readl(base + PCIE_RC_DL_MDIO_RD_DATA); - } - + err = readl_poll_timeout_atomic(base + PCIE_RC_DL_MDIO_RD_DATA, data, + MDIO_RD_DONE(data), 10, 100); *val = FIELD_GET(MDIO_DATA_MASK, data); - return MDIO_RD_DONE(data) ? 0 : -EIO; + + return err; } /* negative return value indicates error */ static int brcm_pcie_mdio_write(void __iomem *base, u8 port, u8 regad, u16 wrdata) { - int tries; u32 data; + int err; writel(brcm_pcie_mdio_form_pkt(port, regad, MDIO_CMD_WRITE), base + PCIE_RC_DL_MDIO_ADDR); readl(base + PCIE_RC_DL_MDIO_ADDR); writel(MDIO_DATA_DONE_MASK | wrdata, base + PCIE_RC_DL_MDIO_WR_DATA); - data = readl(base + PCIE_RC_DL_MDIO_WR_DATA); - for (tries = 0; !MDIO_WT_DONE(data) && tries < 10; tries++) { - udelay(10); - data = readl(base + PCIE_RC_DL_MDIO_WR_DATA); - } - - return MDIO_WT_DONE(data) ? 0 : -EIO; + err = readw_poll_timeout_atomic(base + PCIE_RC_DL_MDIO_WR_DATA, data, + MDIO_WT_DONE(data), 10, 100); + return err; } /* From patchwork Tue Oct 11 18:42:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13004259 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 2C396C433FE for ; Tue, 11 Oct 2022 18:44:17 +0000 (UTC) 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=2kg110OExgIL/zC4lP0RiBAcQ5c5lJvSNHllua+v7nk=; b=TCmzbwEBB0/jYc e0AV4KV1d1QH6lYKizhaZppph+r3i9j+sSsgJb57xWNkGlR/ZOZlmT7qxcfHmf0/cH0GWeAKQCOYD dxZzxZz5hxgB9fENhn2h1wzyeDzWw5VEpyFHgt2Ne2PxEEi+YL9cIL9BHf1dbdqMtceihoNDL19bu lrxLjMy5GP37En5NRJ8fMGzYHZBve+ugmBnHnC2AnZo68EeixOcltPG0Rftx7lLZeiHE4bL9lLHGf mo67LWH2Qt3uI16/JTlei4kktiji4vNKQ5d8iV90a5HAfFj6KEQhOKYcR4oLVhqETEB8y6uRpgc+c hgWdUJdNwcEWjM+dXmKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiKDj-005TTG-U0; Tue, 11 Oct 2022 18:43:17 +0000 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiKCu-005TBm-AC; Tue, 11 Oct 2022 18:42:27 +0000 Received: by mail-qt1-x835.google.com with SMTP id c23so4827758qtw.8; Tue, 11 Oct 2022 11:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=jC9v6x5O9g4o36lTWYhNYvUXqkkWlvK03fmUWelD46Y=; b=QJXGNK69c45gXxMdpzsU32P1osw4qt8d4ezCrzK7p+V9A9LWM7zYJYKdkJi4RCVhU/ xlprNjlA0EEFoHkTc98wUvsr0TGnRoDMxZEQNJ/2AVBdNKFGpAKU6W1udWq4eeNdpFpj 3qLuT1Xli21zAtRxMdp8YsiAtmUKH5nPqzUL8MpDKW4sFAT+30a2U3pzok4z9qJGHjzk Lkh/5rsq73Ib6fXEJfZboA1ADYW8kK4sdtBUb1F3qYC8vqmiys/xoge+3oX4Eo0/beDF Sg+1iuecagwXvBNWP+pfASw79MbYknWYbyaFHSgHDDdB6bimib1Ir8YC2509qr+R4PaE 8x3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=jC9v6x5O9g4o36lTWYhNYvUXqkkWlvK03fmUWelD46Y=; b=xb23/zmS5+9U/4d4YyGfcvqy5NnoHsHlCJl5iA+ygwMH6I/hF2bbdlkR5aESJlmWNF vk4HdXHYhn2QK0xMzXvv6BnxBg7UxpuSQP8AlaszA8J5OIBN8+U4LMX/3nIIlWYePXUK seaTgxZ6l99FSyvAFurS1kKrvEK6D7H7NwZvmPeo7mubxTlTTRqsws74tXWd6Ay6sdkg jWUq3Lm8WZYtI3C877b6IErq6BLmjitxL0+RFF9BXKelP9ue/VagCo3Ev5bUb14x4HS5 KxIpm6W7h4KWRsPfvrz3aiCLf7JfCM/DQqWvsh6r6DzzsmI2YvJWCYx0BTnyn1LPtslY spmA== X-Gm-Message-State: ACrzQf2wMX3B0dp3o9zAK/n7AqNAXtTU9huYPA7W856PeA3z/6hAVqom i63bCQdylhyDrV+rSvUxJhc= X-Google-Smtp-Source: AMsMyM7LATMcDiFcvI+0/DRZQnhodXci0t2uK77a9y8u6aghVCj0Oo0ASbgemMCgyldZFJrJqqrrHw== X-Received: by 2002:ac8:5751:0:b0:39c:b848:198f with SMTP id 17-20020ac85751000000b0039cb848198fmr2170312qtx.429.1665513739432; Tue, 11 Oct 2022 11:42:19 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id fc8-20020a05622a488800b003938a65479bsm10961732qtb.10.2022.10.11.11.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 11:42:18 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=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 v2 4/5] PCI: brcmstb: Functions needlessly specified as "inline" Date: Tue, 11 Oct 2022 14:42:09 -0400 Message-Id: <20221011184211.18128-5-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011184211.18128-1-jim2101024@gmail.com> References: <20221011184211.18128-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221011_114224_380727_D00DDD6A X-CRM114-Status: UNSURE ( 9.03 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A number of inline functions are called rarely and/or are not time-critical. Take out the "inline" and let the compiler do its work. Signed-off-by: Jim Quinlan Acked-by: Florian Fainelli Reviewed-by: Bjorn Helgaas --- drivers/pci/controller/pcie-brcmstb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c7210cec1f58..e3045f1eadbc 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -723,7 +723,7 @@ static void __iomem *brcm7425_pcie_map_bus(struct pci_bus *bus, return base + DATA_ADDR(pcie); } -static inline void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val) +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; @@ -733,7 +733,7 @@ static inline void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); } -static inline void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val) +static void 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; @@ -743,7 +743,7 @@ static inline void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); } -static inline void brcm_pcie_perst_set_4908(struct brcm_pcie *pcie, u32 val) +static void brcm_pcie_perst_set_4908(struct brcm_pcie *pcie, u32 val) { if (WARN_ONCE(!pcie->perst_reset, "missing PERST# reset controller\n")) return; @@ -754,7 +754,7 @@ static inline void brcm_pcie_perst_set_4908(struct brcm_pcie *pcie, u32 val) reset_control_deassert(pcie->perst_reset); } -static inline void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val) +static void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val) { u32 tmp; @@ -764,7 +764,7 @@ static inline void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val) writel(tmp, pcie->base + PCIE_MISC_PCIE_CTRL); } -static inline void brcm_pcie_perst_set_generic(struct brcm_pcie *pcie, u32 val) +static void brcm_pcie_perst_set_generic(struct brcm_pcie *pcie, u32 val) { u32 tmp; @@ -773,7 +773,7 @@ static inline void brcm_pcie_perst_set_generic(struct brcm_pcie *pcie, u32 val) writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); } -static inline int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie, +static int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie, u64 *rc_bar2_size, u64 *rc_bar2_offset) { From patchwork Tue Oct 11 18:42:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13004258 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 BB0E0C433F5 for ; Tue, 11 Oct 2022 18:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: 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=BLmoz3rm5720vDzaFCMdhYgzm/p1Ffi5J2mvtxvO620=; b=RiGumSmrXjv0CE M5ymAIFk3YXIPOucs8IDUelWVFM5NdNhc/rgeGkympcT07ikGsec0VxTBoT3vBVsD20Z9ukfLBxNS DU2siRWsnNagT7VA8j1HrHiDbP10jpq9tt1QFKnah1RCmdh2lx0s5POARTCeJf1eyhRWn2HJmcDtX 7qSmzVwMavpOUcbLieoggUZjKhzE1cfVm9rGF4mYbvhfI+6qOp/lyDKxVvH9bmYpvGfr+mws+UIvW DojNwG4Uw6qYmGSJA4eXH4pyBVODqv9Jlf0xA3am+BL+IO4BwjrHnp6mGZMmu2ovwKboMoLVVD+Ik m+U5Isd3+1CXktlxTGhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiKDR-005TMx-2x; Tue, 11 Oct 2022 18:42:57 +0000 Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oiKCu-005TCe-A7; Tue, 11 Oct 2022 18:42:25 +0000 Received: by mail-qv1-xf35.google.com with SMTP id df9so9502295qvb.9; Tue, 11 Oct 2022 11:42:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=EpuVq5iO2zl1W3X3kc36q+RPKt7tweIdU1vHs5t+3eg=; b=Gj5Nqr+LDbbfdcwkpISaFWC3XdZGLsNhMyp9yQ7I2jPcpQFr3j9ML16AFN5gJP5fqd BggKYoQCVRge/F/uQcDXmxPixlp26y/RiwefonggUi8wI5Tlwj9BOqncJN50vyboUfsG e1KfLU7BdpAPHtq7FjP0mMGBepXyaQm3kwLTR2uAqZn0I/OboA/lrzEZJh+vYUoBmKj4 FoOnn8aDImOV0axl6bToLeNcYB88xFfEQfErGYk5v0Hq7aRZ0/L7CfN1yJtl2G6pIo1X yM5JxaruyYzUbEp8e/GyPnWxEHcvIzLSnOuA99XIpnKk3U32vJyhVpxYqW4undxRX6Ip 8REw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=EpuVq5iO2zl1W3X3kc36q+RPKt7tweIdU1vHs5t+3eg=; b=Hp1Hnu+bf2/ohECkDLmc4HIfCVS4GFaMKztVSYp761Qidd1KPfEhV50pH2YHz9thAV q4tl7k8i1x0q8VM1z0RI8p3/ejnM+PRXRI5XM21MhneOKHI3bt9WKmH4hin5tZaIV7GJ PnB8EuNeNA84G7p67XYc+k+15+399yo93Ws/0jSb5MgL9OiWuTPc0cr74cIOlBAbtfQZ YGBYV0/GGoz5fPziswMzt+fo1aLWFDfHzmH214FifCry77aeIbHf0n4sXimQmCJbK4IG Nskm0G2kOo+IKIfyQS2o0xgRbvT2kazSw5DNQR8qQd+9IYvChosS2xuyqKMHuneP1TJz +TkQ== X-Gm-Message-State: ACrzQf24v/f9gFwj5oIbysASk2VnZaUN7Wbr6rvXptw5GbUar6RGaDmh jLbXGJiMIUo5N3W/L43qzJg= X-Google-Smtp-Source: AMsMyM4cEoY8/pxM0W8zIScP7/MI6kym/0Bnwf2jYpcX+HtPFjAmBxPBvLmmdBInV4CuI83G8h7/kg== X-Received: by 2002:a05:6214:2aaa:b0:4b1:8f0b:97ac with SMTP id js10-20020a0562142aaa00b004b18f0b97acmr20181393qvb.84.1665513740738; Tue, 11 Oct 2022 11:42:20 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id fc8-20020a05622a488800b003938a65479bsm10961732qtb.10.2022.10.11.11.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 11:42:20 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=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 v2 5/5] PCI: brcmstb: Set RCB_{MPS,64B}_MODE bits Date: Tue, 11 Oct 2022 14:42:10 -0400 Message-Id: <20221011184211.18128-6-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011184211.18128-1-jim2101024@gmail.com> References: <20221011184211.18128-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221011_114224_390126_D5CC6C85 X-CRM114-Status: GOOD ( 10.81 ) 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 Set RCB_MPS mode bit so that data for PCIe read requests up to the size of the Maximum Payload Size (MPS) are returned in one completion, and data for PCIe read requests greater than the MPS are split at the specified Read Completion Boundary setting. Set RCB_64B so that the Read Compeletion Boundary is 64B. Signed-off-by: Jim Quinlan Acked-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index e3045f1eadbc..edf283e2b5dd 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -53,6 +53,8 @@ #define PCIE_RC_DL_MDIO_RD_DATA 0x1108 #define PCIE_MISC_MISC_CTRL 0x4008 +#define PCIE_MISC_MISC_CTRL_PCIE_RCB_64B_MODE_MASK 0x80 +#define PCIE_MISC_MISC_CTRL_PCIE_RCB_MPS_MODE_MASK 0x400 #define PCIE_MISC_MISC_CTRL_SCB_ACCESS_EN_MASK 0x1000 #define PCIE_MISC_MISC_CTRL_CFG_READ_UR_MODE_MASK 0x2000 #define PCIE_MISC_MISC_CTRL_MAX_BURST_SIZE_MASK 0x300000 @@ -900,11 +902,16 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) else burst = 0x2; /* 512 bytes */ - /* Set SCB_MAX_BURST_SIZE, CFG_READ_UR_MODE, SCB_ACCESS_EN */ + /* + * Set SCB_MAX_BURST_SIZE, CFG_READ_UR_MODE, SCB_ACCESS_EN, + * RCB_MPS_MODE, RCB_64B_MODE + */ tmp = readl(base + PCIE_MISC_MISC_CTRL); u32p_replace_bits(&tmp, 1, PCIE_MISC_MISC_CTRL_SCB_ACCESS_EN_MASK); u32p_replace_bits(&tmp, 1, PCIE_MISC_MISC_CTRL_CFG_READ_UR_MODE_MASK); u32p_replace_bits(&tmp, burst, PCIE_MISC_MISC_CTRL_MAX_BURST_SIZE_MASK); + u32p_replace_bits(&tmp, 1, PCIE_MISC_MISC_CTRL_PCIE_RCB_MPS_MODE_MASK); + 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,