From patchwork Wed Jul 3 18:02:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722646 X-Patchwork-Delegate: kw@linux.com Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (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 506BB1891C6 for ; Wed, 3 Jul 2024 18:03:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029792; cv=none; b=sNcLo88396MKJNcDOu9ZMEth1kYBytQyHdS5/tCTd+IN2tSpsNWleymAu+FMi7/VkybpSy97D46PZQl47j2OZZqU5XRY+khgGytkMBuF/pLzJn4U+unHetAwmeEKgoAX/Kw/LpTV4Bq9u5q5iQHo6oYkL5wUk5OSfI66KWvAF4E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029792; c=relaxed/simple; bh=5buvZ/IIv1R+ME4azaN2Zd6D0bSorVFDmmygxiLLOhU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=mhX6zbAIdz3U3p7+VoDj1qYTTO1Ajyb0XKx99SbPbXgPF81lDJpQAiasveqgZ8G5e5fzYwbroavCqD3JrO/fW463Ml7woIpHAux602V3VDDvFkoGEScDyPod1xlNxGpSgA9eWulyeDN0p2Y6/7xGWdRYsDruvyh4G8XJHpsr1oM= 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=aYgYPt4U; arc=none smtp.client-ip=209.85.219.43 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="aYgYPt4U" Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-6b590e36a8dso25647936d6.1 for ; Wed, 03 Jul 2024 11:03:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029790; x=1720634590; 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=R77LF2aYlhd/01h15H3mhK8pf6wp2iLP0dwJLnHochE=; b=aYgYPt4UZpv+YLFj+pD2jFt5CKtY38D1Z49lNkV5O7r17u2crF8527iAflPyEaDyME GmK9Y0AySFbYUQd5yQHa+s0DZGa7cQT1ankplPLA4u+jDXBb7kGL0cZCm8G/wDIjNbKh gz15FxNERmLP9OotleQ30N88C/SOJ1fZCuzSc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029790; x=1720634590; 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=R77LF2aYlhd/01h15H3mhK8pf6wp2iLP0dwJLnHochE=; b=DTKo0TU7eYJqX+n2nNV5+xwXt3o5HNulcFcqwAx0FrcNubN8EVgh3K00sp2h1V27GF EmyWPNACKcHDoVxvRrCDnhQGd308rNYEkYUZHz2kOteHJsLaf7MnAWo1mh31uOE3003y NPeJwM3NZKMi9HqXgWfjE1ItspJ9ayJbEO0vGez+okoIoEpS2FQ+4A8VbScWigSksQ2R vI2SxHVXeB5DlmN5gb654sGgr+LrI+/GEnVTc/6RnIqoAoSN1L4NTjgZNGIFrVE6HC1E usOwFE5yqyN8fBdPDqW3k6YLKvVT15CYJXTJsKvn2KdVjziNYYSw22nwimtUpYNL7KRa zEuQ== X-Gm-Message-State: AOJu0YwC/oxwJenzBqbj0rstitEB69y4hALgXhEPKzXPx+iqw9MzCuhX W/gVZsfiO7U9Jb0GxcXHYnKaaekQmZtViMn8tO07t2h9H0fsryETIUjYDGINKyKds2VAF27FmNv atG08yblDiUzoth+4B4xv+nReXGuPY4iDIVOATc54kmnyCsCIMc2ZgWooD19lKNJnN+LVysUHB+ Vr1IvMTg0GcqSo68YAZqmwH/0yZPW4YJOfQJ8eNNQBk3lDGyhJ X-Google-Smtp-Source: AGHT+IHrIodtULPxBVRNVIp6XlZEo4cm9rcmium+oajhbYxKHA+sJtGuN7oqp5wbg8H+RmYxWagMIg== X-Received: by 2002:a05:6214:ca3:b0:6b5:34b:8c02 with SMTP id 6a1803df08f44-6b5b70c2856mr146549116d6.27.1720029789499; Wed, 03 Jul 2024 11:03:09 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:08 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , 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 v2 03/12] PCI: brcmstb: Use bridge reset if available Date: Wed, 3 Jul 2024 14:02:47 -0400 Message-Id: <20240703180300.42959-4-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-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 --- drivers/pci/controller/pcie-brcmstb.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c2eb29b886f7..4104c3668fdb 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) @@ -1635,6 +1643,12 @@ static int brcm_pcie_probe(struct platform_device *pdev) goto clk_out; } + pcie->bridge = devm_reset_control_get_optional_exclusive(&pdev->dev, "bridge"); + if (IS_ERR(pcie->bridge)) { + ret = PTR_ERR(pcie->bridge); + goto clk_out; + } + ret = brcm_phy_start(pcie); if (ret) { reset_control_rearm(pcie->rescal);