From a558aeb6246f7e101f31b8699c5a55ef65c8aae8 Mon Sep 17 00:00:00 2001 From: Manikanta Maddireddy Date: Tue, 20 Aug 2024 18:20:26 +0000 Subject: [PATCH] PCI: tegra264: On EP_RESET poll for detect reset LTSSM When Root port applies secondary bus reset(SBR) or link disable, EP_RESET interrupt is received at Endpoint. On EP_RESET poll for detect reset LTSSM state which confirms that SBR reset released or link disable is cleared. After polling perform Endpoint controller cold reset. Due to HW bug 4777981, C2 x2/x1 LTSSM state doesn't move to detect reset when SBR reset is released, instead it stays in hot reset state. In this case perform Endpoint controller cold reset after poll timeout. PCIe link still comes up in this case. Bug 4777981 Bug 4785875 Change-Id: I89402aa7c963082510170b88a1f7a4ec481162be Signed-off-by: Manikanta Maddireddy Reviewed-on: https://git-master.nvidia.com/r/c/linux-t264/+/3197116 Reviewed-by: Nagarjuna Kristam GVS: buildbot_gerritrpt Reviewed-by: Bibek Basu --- drivers/pci/controller/private-soc/pcie-tegra264-ep.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/private-soc/pcie-tegra264-ep.c b/drivers/pci/controller/private-soc/pcie-tegra264-ep.c index 455a2ef0..e0f65708 100644 --- a/drivers/pci/controller/private-soc/pcie-tegra264-ep.c +++ b/drivers/pci/controller/private-soc/pcie-tegra264-ep.c @@ -110,8 +110,7 @@ #define XPL_PL_LTSSM_STATE 0x1700 #define XPL_PL_LTSSM_STATE_FULL GENMASK(7, 0) -#define XPL_PL_LTSSM_STATE_DISABLE_TX 40 -#define XPL_PL_LTSSM_STATE_HOT_RESET 41 +#define XPL_PL_LTSSM_DETECT_QUIET 1 #define NV_EP_PCFG_MSI_64_HEADER 0x48 @@ -570,8 +569,7 @@ static irqreturn_t tegra264_pcie_ep_irq_thread(int irq, void *arg) int ret; ret = readl_poll_timeout(pcie->xpl_base + XPL_PL_LTSSM_STATE, val, - ((val & XPL_PL_LTSSM_STATE_FULL) == XPL_PL_LTSSM_STATE_DISABLE_TX) || - ((val & XPL_PL_LTSSM_STATE_FULL) == XPL_PL_LTSSM_STATE_HOT_RESET), + (val & XPL_PL_LTSSM_STATE_FULL) == XPL_PL_LTSSM_DETECT_QUIET, PCIE_LTSSM_DELAY, PCIE_LTSSM_TIMEOUT); if (ret) dev_err(pcie->dev, "PCIe LTSSM state not in detect reset, ltssm: 0x%x\n", val);