From: Manikanta Maddireddy <mmaddireddy@nvidia.com>
To: <lpieralisi@kernel.org>, <kwilczynski@kernel.org>,
<mani@kernel.org>, <bhelgaas@google.com>,
<linux-pci@vger.kernel.org>
Cc: <robh@kernel.org>, <thierry.reding@kernel.org>,
<jonathanh@nvidia.com>, <kishon@kernel.org>,
<Frank.Li@kernel.org>, <vidyas@nvidia.com>, <cassel@kernel.org>,
<den@valinux.co.jp>, <marco.crivellari@suse.com>,
<andriy.shevchenko@linux.intel.com>,
<linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<mmaddireddy@nvidia.com>, Frank Li <Frank.Li@nxp.com>
Subject: [PATCH v3 05/10] PCI: tegra194: Check for 16 GT/s capability before programming
Date: Mon, 2 Nov 2026 16:57:14 +0530 [thread overview]
Message-ID: <20261102112719.4022633-6-mmaddireddy@nvidia.com> (raw)
In-Reply-To: <20261102112719.4022633-1-mmaddireddy@nvidia.com>
config_gen3_gen4_eq_presets() added PCI_PL_16GT_LE_CTRL to the result of
dw_pcie_find_ext_capability() without checking whether the 16 GT/s
capability exists. If the capability is absent, the code writes lane
presets at an unrelated configuration offset.
Look up the capability once before the lane loop and skip the 16 GT/s lane
equivalent control programming when it is absent.
Fixes: 56e15a238d92 ("PCI: tegra: Add Tegra194 PCIe support")
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
Changes V2 -> V3: None apart from rebasing.
Changes V1 -> V2: None
drivers/pci/controller/dwc/pcie-tegra194.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index 0027c0adc7a1..4926fea2ee05 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -841,7 +841,11 @@ static void tegra_pcie_enable_interrupts(struct dw_pcie_rp *pp)
static void config_gen3_gen4_eq_presets(struct tegra_pcie_dw *pcie)
{
struct dw_pcie *pci = &pcie->pci;
- u32 val, offset, i;
+ u32 pl16g, val, i;
+
+ pl16g = dw_pcie_find_ext_capability(pci, PCI_EXT_CAP_ID_PL_16GT);
+ if (pl16g)
+ pl16g += PCI_PL_16GT_LE_CTRL;
/* Program init preset */
for (i = 0; i < pcie->num_lanes; i++) {
@@ -852,15 +856,15 @@ static void config_gen3_gen4_eq_presets(struct tegra_pcie_dw *pcie)
GEN3_GEN4_EQ_PRESET_INIT);
dw_pcie_writew_dbi(pci, CAP_SPCIE_CAP_OFF + (i * 2), val);
- offset = dw_pcie_find_ext_capability(pci,
- PCI_EXT_CAP_ID_PL_16GT) +
- PCI_PL_16GT_LE_CTRL;
- val = dw_pcie_readb_dbi(pci, offset + i);
+ if (!pl16g)
+ continue;
+
+ val = dw_pcie_readb_dbi(pci, pl16g + i);
FIELD_MODIFY(PCI_PL_16GT_LE_CTRL_DSP_TX_PRESET_MASK, &val,
GEN3_GEN4_EQ_PRESET_INIT);
FIELD_MODIFY(PCI_PL_16GT_LE_CTRL_USP_TX_PRESET_MASK, &val,
GEN3_GEN4_EQ_PRESET_INIT);
- dw_pcie_writeb_dbi(pci, offset + i, val);
+ dw_pcie_writeb_dbi(pci, pl16g + i, val);
}
val = dw_pcie_readl_dbi(pci, GEN3_CTRL);
--
2.34.1
next prev parent reply other threads:[~2026-11-02 11:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 11:27 [PATCH v3 00/10] PCI: tegra194: Fix EP and Root Port corner cases Manikanta Maddireddy
2026-11-02 11:27 ` [PATCH v3 01/10] PCI: tegra194: Propagate REFCLK select GPIO errors Manikanta Maddireddy
2026-11-02 11:27 ` [PATCH v3 02/10] PCI: tegra194: Check core reset deassertion Manikanta Maddireddy
2026-11-02 11:27 ` [PATCH v3 03/10] PCI: tegra194: Fix Endpoint PERST# IRQ suspend race Manikanta Maddireddy
2026-11-02 11:27 ` [PATCH v3 04/10] PCI: tegra194: Do not skip no-link Root Port remove cleanup Manikanta Maddireddy
2026-11-02 11:27 ` Manikanta Maddireddy [this message]
2026-11-02 11:27 ` [PATCH v3 06/10] PCI: tegra194: Check for L1SS capability before programming Manikanta Maddireddy
2026-11-02 11:27 ` [PATCH v3 07/10] PCI: tegra194: Always disable Tegra234 Endpoint L1.2 Manikanta Maddireddy
2026-11-02 11:27 ` [PATCH v3 08/10] PCI: tegra194: Guard Endpoint PLL-off error path Manikanta Maddireddy
2026-11-02 11:27 ` [PATCH v3 09/10] PCI: tegra194: Enable core monitor clock after link setup Manikanta Maddireddy
2026-11-02 11:27 ` [PATCH v3 10/10] PCI: tegra194: Reject zero MSI interrupt number Manikanta Maddireddy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261102112719.4022633-6-mmaddireddy@nvidia.com \
--to=mmaddireddy@nvidia.com \
--cc=Frank.Li@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=den@valinux.co.jp \
--cc=jonathanh@nvidia.com \
--cc=kishon@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=marco.crivellari@suse.com \
--cc=robh@kernel.org \
--cc=thierry.reding@kernel.org \
--cc=vidyas@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®