From patchwork Fri Oct 22 14:06:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12577913 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 C64AEC433F5 for ; Fri, 22 Oct 2021 14:10:53 +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 9238661213 for ; Fri, 22 Oct 2021 14:10:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9238661213 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=bgWJqc9S/bon0y V8j410jYLuVr5sKMT755p8/XJn5s4XGLkgqi0zU5ZXqcQQ5g3qCnJqGlOmyxNyzVoD11yZ/M/ONbL rgADdoTw3icU7/p/Sv7CnWfGYJT9Pqc9WBwWdsHFSTKd5qNR7ZmD8dZXGGjT/IHOOSTbSOEI1mz48 Xo3t2CyWw0LFLk12B7Bwo8dLmpH6Og8PoW05IzifugBE7RgtaHdLTdE4/WuvnwqRSHDHr+PYvrq39 xMfOCGMhN/XnOS5k52YkgSE69sGGUSooJh1gry0HQFaV0//hsxJQc4h39jQz/o2KJkGFNkO77w7Lw 9I9rvUVfO/2+pQf2EEog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdvD4-00BBx9-J8; Fri, 22 Oct 2021 14:07:50 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdvCm-00BBqR-4B; Fri, 22 Oct 2021 14:07:33 +0000 Received: by mail-pf1-x436.google.com with SMTP id v8so3710389pfu.11; Fri, 22 Oct 2021 07:07:30 -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=R5SGZu++CgAI53CDoFpKRRq5pfPpbRWzsDQhASS7V4vht2a8aJA26iGAM6WMSY8/DI iwh/3R/FvCGNziPaSgeMjNtmqoG//S/ugGtHwv7FzwaV+D/6Ts9VQFQ9SMA5cRZPe6A6 7bCbyu8IPjO4jLXNpe59zANpZ3tLFdg9fMiVg5ihOdFiexyP78XUVsCEXGblSkPCcLgK 8IupRQ+hjlwQKGX2iZaduGm4oFG6mwBl0J6c4U6KoUjhDpo6Oys3yb8U3VhSIpD6M4w4 HuNrJg14LPzjgVOWapzHaZbCk0EagD12edxAhjgpGv43/Fl8N1tq0EcBccWfaU35pGGH TIAA== 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=qq+7Ziemt+FyF0ggHaRjIIgk8U7eKez/MGNM8MVaxRDHczYzF9RciYIy00VMYipER/ w8E6a0GLS4ElR79CYsTQwOw23md/z0tXtQ4S6NfVHnPrn6Ucn1ewu3UyibYfxvnQmyZo EHzuzws8pDJCa9PME4MSvQF42OWY9WXbok2iihCyfM+GbQ1htTx5TjsFYiCywKEgxQxO xOwymMSRg5nzETDT07XPxPBmQsHoTqxJWvr16ED5uSDwVrT8UhevR6dVuLHL8gaZyg0a sNbijp9nJpzvdKYg4BV4O50DyvzxBe2Xo0/cyKzOmJ0ESxVo0kNLXrDkCKXEhG4m6x+5 eb6A== X-Gm-Message-State: AOAM532MvQ9BkZaIS7xE4RalLe/Fwnb8KSoT19SCtWA1LvBkHqODGZ2A CTalaGmcjEo0Ug0x+SMQMtA= X-Google-Smtp-Source: ABdhPJyEsS1l7Tar/HjbpqhXPB/7RZ8R0mvhJOIAjFQICeySHFB/Iw9Wd2lHo3yMnA7UWO/xk/F2AA== X-Received: by 2002:a05:6a00:1309:b0:44d:4d1e:c930 with SMTP id j9-20020a056a00130900b0044d4d1ec930mr12610806pfu.65.1634911649761; Fri, 22 Oct 2021 07:07:29 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id e12sm9482990pfl.67.2021.10.22.07.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 07:07:29 -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 v5 3/6] PCI: brcmstb: split brcm_pcie_setup() into two funcs Date: Fri, 22 Oct 2021 10:06:56 -0400 Message-Id: <20211022140714.28767-4-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211022140714.28767-1-jim2101024@gmail.com> References: <20211022140714.28767-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211022_070732_196830_3F8D62C1 X-CRM114-Status: GOOD ( 14.85 ) 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);