Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a86c718 authored by Siva Kumar Akkireddi's avatar Siva Kumar Akkireddi Committed by Siddartha Mohanadoss
Browse files

msm: ep_pcie: Update PCIe controller reset sequence



PCIe controller reset is done before MHI mmio registers are
restored to avoid enumeration issues in host-reboot scenario.

Change-Id: Ife5f37dc32f9023f5e3d32131269cfa91c0eca5b
Signed-off-by: default avatarSiva Kumar Akkireddi <sivaa@codeaurora.org>
parent ce0b0579
Loading
Loading
Loading
Loading
+34 −31
Original line number Diff line number Diff line
@@ -1368,20 +1368,15 @@ int ep_pcie_core_enable_endpoint(enum ep_pcie_options opt)
		}

		dev->power_on = true;
	}

	if (!(opt & EP_PCIE_OPT_ENUM))
		goto out;

		/* check link status during initial bootup */
		if (!dev->enumerated) {
			val = readl_relaxed(dev->parf + PCIE20_PARF_PM_STTS);
			val = val & PARF_XMLH_LINK_UP;
		EP_PCIE_DBG(dev, "PCIe V%d: Link status is 0x%x\n", dev->rev,
				val);
			EP_PCIE_DBG(dev, "PCIe V%d: Link status is 0x%x.\n",
					dev->rev, val);
			if (val) {
				EP_PCIE_INFO(dev,
				"PCIe V%d: link initialized by bootloader for LE PCIe endpoint; skip link training in HLOS\n",
					"PCIe V%d: link initialized by bootloader for LE PCIe endpoint; skip link training in HLOS.\n",
					dev->rev);
				ep_pcie_core_init(dev, true);
				dev->link_status = EP_PCIE_LINK_UP;
@@ -1393,18 +1388,26 @@ int ep_pcie_core_enable_endpoint(enum ep_pcie_options opt)

				if (ltssm_en) {
					EP_PCIE_ERR(dev,
					"PCIe V%d: link is not up when LTSSM has already enabled by bootloader\n",
						"PCIe V%d: link is not up when LTSSM has already enabled by bootloader.\n",
						dev->rev);
					ret = EP_PCIE_ERROR;
					goto link_fail;
				} else {
					EP_PCIE_DBG(dev,
					"PCIe V%d: Proceed with regular link training\n",
						"PCIe V%d: Proceed with regular link training.\n",
						dev->rev);
				}
			}
		}

		ret = ep_pcie_reset_init(dev);
		if (ret)
			goto link_fail;
	}

	if (!(opt & EP_PCIE_OPT_ENUM))
		goto out;

	if (opt & EP_PCIE_OPT_AST_WAKE) {
		/* assert PCIe WAKE# */
		EP_PCIE_INFO(dev, "PCIe V%d: assert PCIe WAKE#\n",