From patchwork Wed Jul 10 22:16:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13729758 X-Patchwork-Delegate: kw@linux.com Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FFBE1514C0 for ; Wed, 10 Jul 2024 22:16:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720649803; cv=none; b=e4fPD7JG3SO/+292KjOV/Z6whd4ZwAY17gxsHQJRui4wAa3cnkeZi+VQLVOQ7a1+2KPTP+5bjMgMGeVhSlzmzYpA3SEUlC8bqQ4ApJf9ygkOfuFWD+lLem3c88asVR2KauR0w+a5OvyW9BRZo69b57vch++u5pDENkktmfumqOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720649803; c=relaxed/simple; bh=WJVIWKdvbA8eyw/aL4S/OL8E9R1kNLh5GhotjxC2yUo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=IrfqFg/oAZqWJjaslRBVYzBSO3YgYBt5EztivQ/KG75+JJHBo7RUlxOqRpzeYXd4Asw6fGbvoWRBHPiIt2+PxiCSWoYArY3Oc5fa+6q0FYfCg2gWkxWpqS7NGNe2NWg7m84hpjEFOiRf8oAJyVusHerf/XHbeY+M0X/RSWxIkXs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=KCotShSa; arc=none smtp.client-ip=209.85.160.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="KCotShSa" Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-44931f038f9so10904111cf.0 for ; Wed, 10 Jul 2024 15:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720649801; x=1721254601; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=e3s7x72gsUYzxU25jCVyuxtGTGJT5wFZAmKVQQLKTzk=; b=KCotShSaSVbTnm6bJQ6NXSmUjPYvgnjQ+BEAA/uTKEEfLYtFC7jXnxlhOtpdk2hEwc uXPZ2YgKE+sLQuFkIKC4Lyj2OaBzw/KmOYszXjWy2WJJK65kJHYQa8lXzV2lM0ZexM/h EGp7Z63PGdHqohk4m0vdxMxAaiK+Ube2CyyAs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720649801; x=1721254601; 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=e3s7x72gsUYzxU25jCVyuxtGTGJT5wFZAmKVQQLKTzk=; b=SGa/ziESK0nwEBR1eIt38ojs8b22w6T2kXwG/5QV1e6OETzKiii025uAONqSIbq5N2 FkdBIhXu/Ssgzqe0j/MdxMdZXxNrl6xT58tJqSBljOFxkoxX9bmztJM9USVY8K7zrHEJ 4Z0G3CXa5VebSEjvGTobTEUzif+h/2d67XHoTX2ZapVTvhXgKpV8Im952MHetVBQwxcf Eb4UDMskYnIVClbb4nVwA/lnQscRMbyTLY91CrR+hDlpeW5Ka+ILUEzmmlLZPxlKNv4W K1Wyr/u7uOidiKLezb6i5cGEbd1+xUJ11B+/8LfheM2pdEUiplTdMMB3GebYVcyw2iu6 RBUQ== X-Gm-Message-State: AOJu0Yws32RNW03sEt3XfeMHYzlLhRxFqF7cOBekzTClxU3a46V+qt2u G4uHVRFk01OM0JZYPXAiWWPuddCUo6GpCNz+5XHSOHCPCMEgNuKwmTZmQSkyWV16L9aiy7bzhP+ rI5knXJUnJoPdL1HYhVYKLDMuMsPrAHRJ5mAGRIyfkld413GMOQrKGPdUpBCP0IfCEwEzMxcAW5 qpM203p/7Jk2oB2uS+4P0iJOD9GRLhau7E9uTVNEUrPIUOikTd X-Google-Smtp-Source: AGHT+IEFszqDYHgLTXOgHqniypXaVbCrQbk7+dn4z18FToqE6q68oLFQCznDBmnR9H0GvGwhBcSjWA== X-Received: by 2002:ad4:576d:0:b0:6b5:82e1:f89e with SMTP id 6a1803df08f44-6b74af4debbmr21921196d6.9.1720649800729; Wed, 10 Jul 2024 15:16:40 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b61ba04c16sm20182326d6.60.2024.07.10.15.16.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 15:16:39 -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 v3 04/12] PCI: brcmstb: Use bridge reset if available Date: Wed, 10 Jul 2024 18:16:18 -0400 Message-Id: <20240710221630.29561-5-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240710221630.29561-1-james.quinlan@broadcom.com> References: <20240710221630.29561-1-james.quinlan@broadcom.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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");