From patchwork Tue Jul 16 21:31:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13734974 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 994B5C3DA49 for ; Tue, 16 Jul 2024 21:33: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:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QC2rxwEhSLtqYa48S8M5bAmpLSgNv4FnZ49VrasTClc=; b=JRWi4cPVn2kVRfiGdsP6vr4N+3 APfhnUFUsSPApof/bOQBiXejvqEYxQ7P0dzqQ0y45DsfcjIHQde1QdvAZdHg8TxY04uCEwA7YEtv7 FbOSmxbWElraEO9EfAyKe+nstrySO0EGIXIrjJwdqmJhf2CiENsFlfTU4IRI2bWyxRRNQRqUeRzHu 4p77QzyU6tdJB+OuFKbEOXuBH629w6WHRVMYfnXyg3vMEZTGTB1BxUOtf8GIV/Iqbv5a2Tt+LlwMv yYkRkQy/WqbZ/IpcAmB3arKE/ggQSpBCOE9I3Osmk4HA+7tvAJirby622B3BnpJOLa/BC6yTXsvyh v5MElCfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpnp-0000000Bq3J-20vP; Tue, 16 Jul 2024 21:33:41 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTpm5-0000000BpCW-3KhQ for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 21:31:55 +0000 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-70ce3d66a8bso7082b3a.0 for ; Tue, 16 Jul 2024 14:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1721165513; x=1721770313; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=QC2rxwEhSLtqYa48S8M5bAmpLSgNv4FnZ49VrasTClc=; b=UisxRWYuYAKxZjreIX3l+l5frWRNzQHZzdBQS73qI4xQ9obDUUD9Dc++Y322ppWPWw ncdMCBS69aiypEcziX4ZJQ4dcAks7dFy1EtnEL/pE1ShNMLFF5xc+lo3pKaDMRIAI5oG Loc4AV7/F9SHhuOF707OV2kY/eh2FzNg7ftT8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721165513; x=1721770313; 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=QC2rxwEhSLtqYa48S8M5bAmpLSgNv4FnZ49VrasTClc=; b=wkCMYNqqYhYbmpjyzafjrIv7t8PYCfztY405OPGixur0KigoCJgPsiJ9k3uL4TIK9u RUvLdi8cufeAbzGUwqNGlfjoMkUxZC2UWgDh9ifHJSnRawZMBm1zPxcStJ9Jdx+nHac7 Xs3/DjvmyTZPIMBLELf/DqLBRD80woKRw8dYQ7uvXmOsY+SuMu65cd7ubVzUWyIX/Z0T EfCbTVyU9uAZJ0Qyyn9Zvdag3f0jjjmzrXVr3FELiHwN6cJ6NNd0bM1cZEKNByuOTKnh mJ3ZYtKTAvzkOcSgll12SV00C6hdODbJldrHNzlEZCb9fzbugQWh4E+flHBBYCMPSjI9 uZcg== X-Forwarded-Encrypted: i=1; AJvYcCVjWP6FMQd5jUmE/9LWbkicMyDt08X4g53U+wbKy5HItaVmAaRpFQDGnB57gdPIrR0i62lpHvS1QCJIcWSVfBTqXxZ26O4WB4PDr4YEoKgVvXEMISo= X-Gm-Message-State: AOJu0Yyv7v1evrFP/QhA7f2lKXj2kkQrh0IDce9ozJvSTC/olKrn29Km 37X279HmCWfR1spABct3YwiQ9lvRm2zHjz30UMvLqgBaWNkBXs8SxrQGYHWj0w== X-Google-Smtp-Source: AGHT+IHCARefO9Q321jDvjEHJDSQPCVyz+1t2AKROGzfe5YcdNqEPgxb9TJaujSadqlPYWaeSwYl+A== X-Received: by 2002:a05:6a00:a1a:b0:704:23dc:6473 with SMTP id d2e1a72fcca58-70c2ea01f0cmr3716530b3a.30.1721165513082; Tue, 16 Jul 2024 14:31:53 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b7eb9e20fsm6812828b3a.31.2024.07.16.14.31.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jul 2024 14:31:52 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , Krzysztof Kozlowski , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Philipp Zabel , 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 v4 04/12] PCI: brcmstb: Use bridge reset if available Date: Tue, 16 Jul 2024 17:31:19 -0400 Message-Id: <20240716213131.6036-5-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240716213131.6036-1-james.quinlan@broadcom.com> References: <20240716213131.6036-1-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_143153_901081_20914A01 X-CRM114-Status: GOOD ( 15.59 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 7712 SOC has a bridge reset which can be described in the device tree. If it is present, use it. Otherwise, continue to use the legacy method to reset the bridge. Signed-off-by: Jim Quinlan Reviewed-by: Stanimir Varbanov Reviewed-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c257434edc08..92816d8d215a 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -265,6 +265,7 @@ struct brcm_pcie { enum pcie_type type; struct reset_control *rescal; struct reset_control *perst_reset; + struct reset_control *bridge; int num_memc; u64 memc_size[PCIE_BRCM_MAX_MEMC]; u32 hw_rev; @@ -732,12 +733,19 @@ static void __iomem *brcm7425_pcie_map_bus(struct pci_bus *bus, 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; + if (pcie->bridge) { + if (val) + reset_control_assert(pcie->bridge); + else + reset_control_deassert(pcie->bridge); + } else { + u32 tmp, mask = RGR1_SW_INIT_1_INIT_GENERIC_MASK; + u32 shift = RGR1_SW_INIT_1_INIT_GENERIC_SHIFT; - tmp = readl(pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); - tmp = (tmp & ~mask) | ((val << shift) & mask); - writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); + tmp = readl(pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); + tmp = (tmp & ~mask) | ((val << shift) & mask); + writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); + } } static void brcm_pcie_bridge_sw_init_set_7278(struct brcm_pcie *pcie, u32 val) @@ -1621,6 +1629,10 @@ static int brcm_pcie_probe(struct platform_device *pdev) if (IS_ERR(pcie->perst_reset)) return PTR_ERR(pcie->perst_reset); + pcie->bridge = devm_reset_control_get_optional_exclusive(&pdev->dev, "bridge"); + if (IS_ERR(pcie->bridge)) + return PTR_ERR(pcie->bridge); + ret = clk_prepare_enable(pcie->clk); if (ret) { dev_err(&pdev->dev, "could not enable clock\n");