From patchwork Fri Oct 29 20:03:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12593689 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 9D497C433F5 for ; Fri, 29 Oct 2021 20:22:01 +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 5628860F56 for ; Fri, 29 Oct 2021 20:22:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5628860F56 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=VURrGp7KM+HVDJqZ9gI/nxULunTk+15yvHGtg4M50S8=; b=wRQfj7wFbZJxOV vSq56tGcDNCeQA+zvu7palc3TPlzDqnw5GHiB+N7mUwObmWdkmBX2EmJH0rqp3Txo6Uny3L2wE2BX LQr9zLmKG/CNv+RxK44ORdvNtaF+rz3VekM9L/qjA2D1GpM7PDrUBLSmWavDffL9kR7/0XkXk3+TE dhRNcGdOQIBetkD4JF/mv1uuZr3JU8Z7LEUMrY17jpE5BJ3ensEZ4n8ne/XOfAUBqFpSEoK6nGy+f DBiABusY2w2eI3rD4ozjeuOsYN7na8ukIXsNZef9ke0x+6CUjyuSbmGJoTmbHp8Xm5Vl0ZPtJChZZ kS5mqHjc8m+XF1wUvGlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgYLr-00CDoQ-O4; Fri, 29 Oct 2021 20:19:49 +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 1mgY6E-00C9cS-Dj; Fri, 29 Oct 2021 20:03:41 +0000 Received: by mail-pj1-x102c.google.com with SMTP id nn3-20020a17090b38c300b001a03bb6c4ebso8101815pjb.1; Fri, 29 Oct 2021 13:03:37 -0700 (PDT) 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=+KIUczUS/ZsYc2yKqmHED/7x17icKPInYDTolIdaty0=; b=qjSLHUXCDQWygnVlyrtmeX80jN8aeq1XvoNqVZbcgz3pWBNXh2WUTbMxhMcqf6Dy6L Y4b+BpSNhZm3TwUwIyJpnh7f9gY/5lESKlhSZmdENaKYakRR4wWQ2GAh40GPdp7Z5csi S55V7NyXufyKihgew1e11sQGlAkkspyYiGOvhjDaiPCWkge568MSaSuoJFqrHiZF6flb D6lAmbmbfPM4jB1keRmDH6qOEwYbUo49nk5ujBzeKcAqYt1VML7em0zYZYwk1uravbYj f7fabu+/GOWr9aP30GdqxwFQHniV9QABhzWk5Jx24yBOhjV1dHSpHt3duL95ucNnVCX2 rM9w== 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=+KIUczUS/ZsYc2yKqmHED/7x17icKPInYDTolIdaty0=; b=BYTeCDyKIllFVpQGeR8Gx/vFfBiTSiv2429gKyUnuOMw9NNMuqv/F3RuvMuORxCXK9 JXphh5iepquDfbHr469XKHR2MzvPRvbfNOpHc+PZo/OqxxXhIgFcReBtp9jV6U9fBexl wtZdPQS9lEiB11g4z/vlt5wyD5heEe7006PQFrk69pbFZoTkmw9RJQTrUBF0A5AQ+QfO McZfF5A5uH0W+wD3s08l538ijAm7/0qxLP/sQ9CAIMECQi0j5GcN1Tn7FjO+9fSZifML QiqmANdd+e3VycNy23GzYtxxg5sa4tG9ZXQVQuwO9YckRvX12mDiy1SxlxYJMCDGgF/g 0VkA== X-Gm-Message-State: AOAM533/giKzt1ciOPqWrdNGygBzJqSlysQaSmF0XcDCwGKtg18ltfEB JTtXCP87PzgL2pWfSk+amAg= X-Google-Smtp-Source: ABdhPJz8kWh0F8QgJktCkgyP+kh03917s5z8vxLV8DEMrXsbHm9kC89imHO+DLcCD6SsMQdbqPK9cQ== X-Received: by 2002:a17:902:64c2:b0:141:c171:b99b with SMTP id y2-20020a17090264c200b00141c171b99bmr351680pli.55.1635537816878; Fri, 29 Oct 2021 13:03:36 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id j16sm8775041pfj.16.2021.10.29.13.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Oct 2021 13:03:36 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, 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?= , Bjorn Helgaas , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v6 6/9] PCI: brcmstb: split brcm_pcie_setup() into two funcs Date: Fri, 29 Oct 2021 16:03:14 -0400 Message-Id: <20211029200319.23475-7-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211029200319.23475-1-jim2101024@gmail.com> References: <20211029200319.23475-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211029_130338_530790_720E57DD X-CRM114-Status: GOOD ( 14.96 ) 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 split a function in two so that the driver can take advantage of the recently added function pci_subdev_prepare() which is a member of struct pci_host_bridge. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 30 +++++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index cc30215f5a43..ba4d6daf312c 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -863,17 +863,10 @@ 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; - u32 tmp, burst, aspm_support; + int ret, memc; + u32 tmp, burst; /* Reset the bridge */ pcie->bridge_sw_init_set(pcie, 1); @@ -956,6 +949,21 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) if (pcie->gen) brcm_pcie_set_gen(pcie, pcie->gen); + 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 aspm_support, tmp; + int ret, i; /* Unassert the fundamental reset */ pcie->perst_set(pcie, 0); @@ -1186,6 +1194,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);