From 1175e4cdbf4ea9974452bf25e1ed3dfb9bb26700 Mon Sep 17 00:00:00 2001 From: Sai Chaitanya Kaveti Date: Fri, 6 May 2022 11:46:22 +0530 Subject: [PATCH] msm: ep_pcie: Avoid releasing resources if pcie-perst-enum is set When link is not up during the enumeration, enumeration fails and the driver releases resources, disables Perst IRQ. If the ep_pcie gets a Perst de assertion after this it is not handled, as Perst IRQ is disabled. Here, avoiding disabling of Perst IRQ, De-initializing of GPIOs and making the base addresses of various resources as NULL, if pcie-perst-enum is set in device tree. This ensures that the enumeration is done as part of the subsequent Perst de assertion events. Change-Id: If5d8ce08031d089b1477d93a2125e3fe0fc97942 Signed-off-by: Sai Chaitanya Kaveti --- drivers/platform/msm/ep_pcie/ep_pcie_core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/platform/msm/ep_pcie/ep_pcie_core.c b/drivers/platform/msm/ep_pcie/ep_pcie_core.c index 684ce0400a5e..13b055c808cb 100644 --- a/drivers/platform/msm/ep_pcie/ep_pcie_core.c +++ b/drivers/platform/msm/ep_pcie/ep_pcie_core.c @@ -2324,7 +2324,7 @@ static int ep_pcie_enumeration(struct ep_pcie_dev_t *dev) EP_PCIE_ERR(&ep_pcie_dev, "PCIe V%d: the input handler is NULL\n", ep_pcie_dev.rev); - return EP_PCIE_ERROR; + return -ENODEV; } EP_PCIE_DBG(dev, @@ -3503,7 +3503,11 @@ static int ep_pcie_probe(struct platform_device *pdev) ep_pcie_dev.rev, dev_name(&(pdev->dev))); ret = ep_pcie_enumeration(&ep_pcie_dev); - if (ret && !ep_pcie_debug_keep_resource) + if (ret == EP_PCIE_ERROR) + EP_PCIE_ERR(&ep_pcie_dev, + "PCIe V%d: Enumeration failed in probe, waiting for Perst deassert\n", + ep_pcie_dev.rev); + if (ret && !ep_pcie_debug_keep_resource & !ep_pcie_dev.perst_enum) goto irq_deinit; register_reboot_notifier(&ep_pcie_core_reboot_notifier);