From patchwork Thu Oct 6 22:03:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13000771 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 0E87EC433FE for ; Thu, 6 Oct 2022 22:05:00 +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=BCtXjta/aT6WVH7Q5Nwb/buQjRUvNJwbi+wtHBp59u0=; b=hqZLTz3jqFdkGq ID7QudQwlx4rQhIyDDUUloTHJRnxHxh25PqwAjsTg0l/yVxBQnLVnxT/rGgBHoJViZ9n6FlX/XKKT ful1dLaRf02ccjsiVXoiNlLLQi1wB6UayYFpM3qnejh+8feZcL+X4S1e2snG1THA8PVPdnMYIgt1W addx7R/JfNfnVSspdSAVxwTlmFTB1mPg7FpvzRW5OAbE9WjvucmZYomQjuj/zkYMsl/02E5VQ7HwR HSWpL4I9Tit5d32d+xjFTkp6IP28kBA7f0HOfT818gLyVZ9UFYIS5+BHblgS15miv9SiPsyfLpp1s vhNDold6jlmg2x4711ZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogYy0-005WVa-Vq; Thu, 06 Oct 2022 22:03:45 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogYxq-005WKG-PH; Thu, 06 Oct 2022 22:03:36 +0000 Received: by mail-ed1-x52d.google.com with SMTP id u21so4685105edi.9; Thu, 06 Oct 2022 15:03:32 -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=LvjVJjiaNiXSnHQ1r2rSRUSpphAvqfDohp9kovF79Fw=; b=a6ENQW/fBFHrcuTkmewx1Ezqz7WdsS8lHYb3wM4ybF+4tVltkXPGBh9RMEa1f+9ZPE Cufh1iIddOcvRVvVoDjB8B8tJmcOTi/yZcYKcHaqPJksUXjbk2cSadcpBollm7L7ZUrL fOZWjV/N1lzLku1HwKyPOxlWfXbQnwoEnF5LoAOqCCg5PW7J895CKOglppVEpRT8NmRD 587qGPl+18YVo1ZnaLoMc6O3138Pu8+h8geFWNPN7bOB41cOXgIM4MJK0fVi/ffMF0k6 TQq9TFlzGZHE2iVhQmshUn02czDFIG/TcxYRey4Hl+pCTOlOtSs/4vAfpVQ7KYemoqF1 lsyw== 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=LvjVJjiaNiXSnHQ1r2rSRUSpphAvqfDohp9kovF79Fw=; b=rJP3yIhukJIHVtwdMrSIV/1sCMZys3jWFwKLgLhsgXVCAhpUCkLzdqOL2wZkwPi4dq itBVjlc0gfQ4mtfTWLV/fJtCQnrFOm+KGyW9zbWJvqs/SK7w0nfaSRhriBjU2DAgFyK3 8OmxCOxCuLRd381CDoSiUAPOlomB8SASQcUBCbjdlUkjZ5j0bfkspVnQ0soUTh0VqIpM fN9Hb/A55RmMQ7rUNVPU7h2iy/j4v/osTEDeQTQxjuuX+6moTPX6T6+IJDorQhyiIIga ErKtYFDnuighzpprK+2j0QTTqKifadhUE2LyXoeHpdLZ31ZPRYXCabpRvuohL/6AacVc PoLw== X-Gm-Message-State: ACrzQf1e7m5RSb1aJuVkm1jjA02c/oqIN9yAu+z3YTecbxa0ioQE6H+Y YBjut05fKdowt7DNV1JA7KY= X-Google-Smtp-Source: AMsMyM5lpw9c0Xsha7zB9F1tvzVa0a06GrkmekFIVkKbSmB4K3Yw55PgrVrY9J3MOB30bkMwUrJBtg== X-Received: by 2002:a05:6402:847:b0:453:943b:bf4 with SMTP id b7-20020a056402084700b00453943b0bf4mr1785028edz.301.1665093811706; Thu, 06 Oct 2022 15:03:31 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id f14-20020a17090631ce00b0078246b1360fsm241484ejf.131.2022.10.06.15.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 15:03:30 -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 v1 1/5] PCI: brcmstb: Enable Multi-MSI Date: Thu, 6 Oct 2022 18:03:17 -0400 Message-Id: <20221006220322.33000-2-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221006220322.33000-1-jim2101024@gmail.com> References: <20221006220322.33000-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221006_150334_836332_62B02793 X-CRM114-Status: GOOD ( 15.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: , 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 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 Thu Oct 6 22:03:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13000770 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 434AAC433F5 for ; Thu, 6 Oct 2022 22:04:59 +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=ZSzvhX7TXIVWXDa3XWXjaBbTyHYxPgyE8maX4SwLA8Q=; b=ClMgnoazmSazRh RkIQ1hHE/PQRKJzw2w1VIZqYquE0cs249g9iwP7t50LI0fqlCe6AdO9bmrbDiyETSSkQkeN9uvZs0 x5fp2/FWLvSxF2+0732WbaHib7nV6XN4nh5jzHBe5XgbjJwmXTTKY9TbLS01Y/6b5cdqSgob3mlj0 M5zbc/fvQXBja6zHocjCkAwOUYapMtbVIrWbV5SACl4DmPaaz6H1+zL0CrKiBMTA/dzw/uirwnjrU kBH+XO+lKQmy/Ug++dwf7gOIR+kOZcSwxO17IuVT+lHPcZ5zG1mlvG4paHS4JHFZpxiMlT2ddhktv 9e+SgSIKQyDG3qxv9XkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogYy9-005WZT-Js; Thu, 06 Oct 2022 22:03:53 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogYxt-005WLy-GT; Thu, 06 Oct 2022 22:03:38 +0000 Received: by mail-ed1-x533.google.com with SMTP id m15so4656971edb.13; Thu, 06 Oct 2022 15:03:36 -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=+F1i8mswqP1sOXLGE0a7iwcDafA7tYx629sD2VumcwM=; b=jwBoQvzQ/LxjK8kx7cK6AYwRfB/MWLeaTyoiyxCTogu2djnodPVti9tH75mNWdv8Wl RxeehYapXNgU4BocLjtIzM0z237x1gGRdkfNCrmMjTzkru3FAELYmvAddQCdH42XRd0+ MbFnFjlfPmvrrTi//XXWzKZjN2fdtSzOF6ZHsGwIaW/H7th+rWTqcA2fdvvD7TUfKGRf Y3swYaF0YXRTR92WGvEE/B8Lhaq366ram+7yQihSoyRN1W+jbqmWSCpe0xga3cOfpSr9 Su0JyQLzDK2vDhjFd/R2Thrzz1qRyz9/hZgSjhJmxg2kq6cICkRNaBimVXvlJvpKN2sX U5Sg== 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=+F1i8mswqP1sOXLGE0a7iwcDafA7tYx629sD2VumcwM=; b=go0F6aqSCOBOgXg+7CqhlQn4Es/ovpVkgttZ2ReM/l4X6n4iDTe270rH1guXTrFV5n R36XJReM11nB1Db+GCPrjaz2H5KK4g0WYzZ17bEI59XjUb2ECDp/J0TWP3k0KlOhSSM5 6xDUe4YGbIeK1RRIJr6bGMxpKe/BePPv3cP5jGCbFQ3lnL0oFY9Rzv6Ck5CnyoMGB0+x n3oUYDi7SrnC0CGw2yQ5kC3dF4r2qgeqBcavudbM/hPMti3WvPEtqMwafHb6P4o1musP +cCmuLrco2j+qLZm126KBc8qb+tw7mO1YXpffFW5ZDq/UotdcKd6gCAM2ctrvda8ZXxz j0pQ== X-Gm-Message-State: ACrzQf23zpaakrPG5mPG37Cu9uGFuSK4pXiFXWf2N30hHkcK1qyXXB7q cuOlV1oEqSiU/SCHfa1oJq8= X-Google-Smtp-Source: AMsMyM45Yyx4Aawv9K44B8BVX+nb7uc1JOiB7C0zFJxGLs97p4qwRQZ60HKSJLscxOirRlc77wpvvQ== X-Received: by 2002:aa7:db07:0:b0:458:f6e5:ab71 with SMTP id t7-20020aa7db07000000b00458f6e5ab71mr1855183eds.330.1665093815001; Thu, 06 Oct 2022 15:03:35 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id f14-20020a17090631ce00b0078246b1360fsm241484ejf.131.2022.10.06.15.03.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 15:03:34 -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 v1 2/5] PCI: brcmstb: Wait for 100ms following PERST# deassert Date: Thu, 6 Oct 2022 18:03:18 -0400 Message-Id: <20221006220322.33000-3-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221006220322.33000-1-jim2101024@gmail.com> References: <20221006220322.33000-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221006_150337_570776_642B9F49 X-CRM114-Status: GOOD ( 11.02 ) 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 Thu Oct 6 22:03:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13000773 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 455B6C4332F for ; Thu, 6 Oct 2022 22: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: 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=+ZFdbQbrmQNBPuK+SQ6PlCSaGLTcEd4jtV00BmyHfq0=; b=jh/Q8d7ERhzTzY El8xA9N5QglewzAdjjvpP9EKHQBwm3aPPCv2ZmNl2/4wJqToPEqz3qbEkgKZQivx50147nPP26Fy1 ZJDEJb9YFfxAd58M5KzbHdOyK+3h0pr/+uFgx5LBdI90d7hk6hJEJx6n7VrXzMCxenzhA8LzS6IR+ ZlbXOS3TQAfDD72/whesPvq8dDy7aNDIF3cXNf8u5P6BenjM/S6EOj+QhMqgpE9ucertLQzJkVxlT rYeGBikbKJEDZkcH9gnaUxsG4WCaxjZfjUahIbFx1tzA+jQUCWE4aR6jjo5ZdNUeWEApeXC5pnv9P qjQ3lOyZnFypNvTFWR6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogYyI-005WcT-7f; Thu, 06 Oct 2022 22:04:02 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogYxx-005WNt-Sa; Thu, 06 Oct 2022 22:03:43 +0000 Received: by mail-ej1-x630.google.com with SMTP id 13so7568481ejn.3; Thu, 06 Oct 2022 15:03:39 -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=BLYOB0a4x/X6dZd/1nZQ9gYDvNArvXo1VpvInak5Wn0=; b=J4Fk509zYUCWEF0CVRUktZHIEROIeoftJ9eHsCOkYd0x+SncnK69V4ioM0JGD4lCzJ Ae4ZX1XFbfVnSOohDaWUIEEaY4nipt4B1IeCvvqQ5c+UNx9mKwU29CD5Tdkhtv5yKN/I F1gs28aafnlENHgK8qWBn6ShaEinoKdmX/6K6HPYVFcbpwgQNGNsNEGnJRgtPXmWslkV 2cTKm/taL3/41xJRbCWrXHqa8TfF/EVVNzpd2gCqSb0axeNULSFLyZ6P0Ptrb7NbBfzj FqC2WI6CKNhOohrYgxKPfqJlrE21aCONGbWW2tKtj98jr9yEUGrsj57PULP1lDCiSKT/ oi0Q== 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=BLYOB0a4x/X6dZd/1nZQ9gYDvNArvXo1VpvInak5Wn0=; b=GuMCAUguN/+zPaFgR1/gevP2/euIxN7VUQav+pgmq5K/o7kUzqRQ4+QC9abzbTQ0zX ZrjCXzzYN10t27Uwf8Hn9+kiv5dXL9aKW92nw1hIFUAgxxMHsoOAu/K2Rs2f3i9YtBoh 0h6VRpVZfF3IfU2D3U8+YxRg6T7nwt4vfV9UgfMLbK6z1SZC1n5U7PtHAGmXsFdq6p8c DQRmamgbVHp5NF43dTNfqMeTrzckBEALCFSyDa9YoDBHSfphQAO4XPr7LlIxTW1DwY26 uUt3LfLpSfFSlNx0+yNcJfrKZV6KvHO1S8Od+zHgmFinj4+0BoZT1A8fg+dPsY/NoiSe 7sww== X-Gm-Message-State: ACrzQf1XoT6vlDhnf0NLhe/zlDhgSRRPDOBtADho29gISqU7VDmS9Rke vurGKJZ+xsfK3XuScP33aYM= X-Google-Smtp-Source: AMsMyM6xoPk32OflUxBn5euuJgnfF6SFYRYD2jnSaALoGLTWmUzpuPDH50kZ5SrEKJiGZtp1Cxzn0w== X-Received: by 2002:a17:907:7f93:b0:787:7fbc:8081 with SMTP id qk19-20020a1709077f9300b007877fbc8081mr1615376ejc.543.1665093818210; Thu, 06 Oct 2022 15:03:38 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id f14-20020a17090631ce00b0078246b1360fsm241484ejf.131.2022.10.06.15.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 15:03:37 -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 v1 3/5] PCI: brcmstb: Replace status loops with read_poll_timeout_atomic() Date: Thu, 6 Oct 2022 18:03:19 -0400 Message-Id: <20221006220322.33000-4-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221006220322.33000-1-jim2101024@gmail.com> References: <20221006220322.33000-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221006_150341_946862_2A1DEBC2 X-CRM114-Status: GOOD ( 10.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: , 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 Thu Oct 6 22:03:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13000774 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 3228BC433F5 for ; Thu, 6 Oct 2022 22:05:14 +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=Vgr+qSB21a0MKi3uVWCxa10Klyq1YCRqmOdyokYIHLw=; b=Ifa0lW3UnkKwkS ym1lBptuWzM1awxZG47xzXz2ghDWWAw4msIxDfMr9URsWteeaaSCI/sItA3YIWtCLxDY5rJbf9hrD YEpYGKFFSZEtmmIoLsD8Z3ukSPDO4e/mvHUODqjt30RM6y5lLV/JtPdtVWCbexp1ohgLqbQpc+vQs Hu8/pBpLLl77K1N4XNVHgbjTuVvzJsYnzVfWYBy+N26SAVzTUpADWPTG6OftrKgQyRc6Hm3uYuQ+8 muA9Z04a5iKh56zZz/6mCnGTcwT8i7MdRPWA3w10C/R9bSKJO2ihqiW/PuIzy6uSLjw0m9zM2f/OJ LA1RBFwlW4PJjxur+xzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogYyR-005Wf6-04; Thu, 06 Oct 2022 22:04:11 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogYy1-005WUe-3X; Thu, 06 Oct 2022 22:03:46 +0000 Received: by mail-ej1-x636.google.com with SMTP id q9so3006513ejd.0; Thu, 06 Oct 2022 15:03:43 -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=gs9ymlzhHg78SV9AeCxTEe9UU7UvQjNqAP4fEvcWuVo=; b=cDvtzJ1+rH2aUDW/MjVaanBqq4xprQ163nM3w0nQS67mWJ8EUWOVoaS7Wl9XbcKOI4 OU4XdH1S8zjbofM+8kGAp3I54MA+l4SFGmpJSZn5AS17PYIvlDLnZFB/ER+n+w0C/PYo 7Y8sAoebIFnwjsMUtJEyBzABclMOwjAnEuUW2DVeXuaRX8t2O0AbeBOro9BKp9QpaEBw Z4uoma5saX2eK48eG+abHMsqWn1ytkvW/jbehgnFL1q7FplpoSRbm9nrfXd0+cu+jSc8 RmrPifWxJhEnQIpmSq8YIh1QYyiBl6ilcVqU2gS72q4V98XBoF6/4uWXo5v5rBz+6Jy3 sGUg== 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=gs9ymlzhHg78SV9AeCxTEe9UU7UvQjNqAP4fEvcWuVo=; b=fHn4gKFqfu8ru0WS32b2uUwNRKaRfY9mt9uSlrpySkcE4zmFzc51sL9togejFX6W4i i8mBoiGjF4o0l9V8sx/pUOGvWjs/L2w18v0F/u0oymjGKq4ncBTbFavBzNivxk5uFyO8 4eWFza4VeGDfWa8iyZOZwxI65N0LzwxXX/34xMN89fC5c/acQ+RnfNt1Q472TVl9+Ete PSI7DlrAdY265sHAx0ighQOv8pf9t9iOKUbgD1U5J0xWs7HHsUWW533IqbMjt6qIiNVB OYqhlc26GnLnoHDyc5GcHKJLJiUblPMez3aBrPVzLRizvQso2rFCSEzLnjSU4PuLw23l Bx3Q== X-Gm-Message-State: ACrzQf3xKIj31yTBAEf+ZL+wuyD5ypCNFubO2ueXvp8s8N6FYjfGDuIV 7HjjfN9vxnWVZaVJELaoLnA= X-Google-Smtp-Source: AMsMyM5dtCnFEjRz1leYXttCvnccz2O+6tIP0Hmu/upNBDMJIqo0vffiWQ8Hc3rZamj4iiPGRM0L8Q== X-Received: by 2002:a17:906:fe49:b0:73d:70c5:1a52 with SMTP id wz9-20020a170906fe4900b0073d70c51a52mr1637528ejb.469.1665093821971; Thu, 06 Oct 2022 15:03:41 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id f14-20020a17090631ce00b0078246b1360fsm241484ejf.131.2022.10.06.15.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 15:03:40 -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 v1 4/5] PCI: brcmstb: Functions needlessly specified as "inline" Date: Thu, 6 Oct 2022 18:03:20 -0400 Message-Id: <20221006220322.33000-5-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221006220322.33000-1-jim2101024@gmail.com> References: <20221006220322.33000-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221006_150345_174920_861372F4 X-CRM114-Status: UNSURE ( 8.92 ) 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 --- 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 Thu Oct 6 22:03:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13000775 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 5202CC433FE for ; Thu, 6 Oct 2022 22:05:19 +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=5q9lWfN92Afz2mRA/8UhitTkTrRhnixu5a3eNDSkwZM=; b=1RpzaAHKHPFdXA d1LSPz1Yc18UFZMZ/cKM6Y0EDEppmfzP+SXcjRbiNQPNY0ANCvcDVNzXEJkVBNrHffnIQLpr7zkKg feGyw4VT3OgLcRLYc2G02F+1J7qLwKrVTjTCocAHGpqV/AmMRlPNcCvyBqiZdatV2Vd3Mq6wTvdhf RjfqsT3OW9qXbfP44BWJLYdNmfFAN2AHCUR0GUwbdFuxixMl+pu3SI3bnQIgy7gO2of+HPdaSzoi0 YeWUFLizWnETmpNL2fUSrtdOjRpyCuCd+aepW/LVtWLesoLUK6TRb09uYJB7+d/yTTpkLlXiwhofw Ef4asFSxyf1SdfRMZ45w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogYyb-005Wlr-Ab; Thu, 06 Oct 2022 22:04:21 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogYy6-005WWk-7t; Thu, 06 Oct 2022 22:03:51 +0000 Received: by mail-ej1-x631.google.com with SMTP id ot12so7593550ejb.1; Thu, 06 Oct 2022 15:03:46 -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=WVgi7cf2nCE6FtjgZdFym8h242QTEgsOcOWpCYFthvU=; b=i8nPaM07aW4cMqaMDWT75pSBMzwZRPp1grWHmnpf6JyHfmUyVET6ufw21LcCDff05L CrN2uZhUoyuEE+tn9hX5KHQlJ/ugeZvxNrXuPoX93juF8DSn1okUYV6ZNQ4Dfpy9wX5s eylSiTE05hB3tAPXWHDBF45EVs/A6mF273B4GshO1jDGMtEbprs9Une7tcHF070HXCSC PoUfLyz8CD9Z9foxK6lY2IkDslbStcy23Zm57u/iAOn3RO/OuWgDoQotpK/Gtzbnq2DH LacJHThC+ndnfOi7XBJEwdjNpqWUMkRKxYyZdXN+xVkWY2ToYACmzyH4G3K8TyRMQPcs cIsg== 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=WVgi7cf2nCE6FtjgZdFym8h242QTEgsOcOWpCYFthvU=; b=oYx5eYn1QBDfaQbIC0ng6i/YZSDtNa3I1uHyJwkIHr0ZBijZki1q+xgMUEu7fvSl5b POi15/gHDSvG+4x2DegC1FI0huGM+9wntUetj7Raou90BhMzdNs+fyUBrAG/1CJP5M1q ADWkyE6wpmJBxVWXzovFNoKuGJjPm8cQBM2FFw2jPbEXn1v9u4P1wnWap15CNnl8EUIK g9Uxs+0Dij524Y1+SuoSrj4AqqW/LAOqk2RBMPMl6g4iclTAimQLlouJN2c8yITYqrPp /bmZnYmbvr8sgPMV5vcRk5ntEfZsDwbYa5qESnWwaUc6HVsyyavnggXBlZq77IcvYpBb 22eg== X-Gm-Message-State: ACrzQf2UVV7V9GWP0gusiZdHXUenhsE8Ce0mDcVrgJ9lkfCuGVjERjT4 ejNPfHBgklNZiDkxy7DgFx8= X-Google-Smtp-Source: AMsMyM4Q4/D5aTPTEHm/+pjWR/xFQs5R+gr+q/KnW2RoaEJtIaSqwoApES+cSI8EAe6Hf+m+MM8Dqg== X-Received: by 2002:a17:907:9816:b0:787:4350:3a19 with SMTP id ji22-20020a170907981600b0078743503a19mr1521283ejc.627.1665093825886; Thu, 06 Oct 2022 15:03:45 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id f14-20020a17090631ce00b0078246b1360fsm241484ejf.131.2022.10.06.15.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 15:03:44 -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 v1 5/5] PCI: brcmstb: Set RCB_{MPS,64B}_MODE bits Date: Thu, 6 Oct 2022 18:03:21 -0400 Message-Id: <20221006220322.33000-6-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221006220322.33000-1-jim2101024@gmail.com> References: <20221006220322.33000-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221006_150350_303987_CD22C40F 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: , 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 read compeletion boudnary 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,