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

Commit b2b584fe authored by Sai Chaitanya Kaveti's avatar Sai Chaitanya Kaveti Committed by Gerrit - the friendly Code Review server
Browse files

msm: ep_pcie: Avoid polling for ltssm state if perst is asserted



Device polls for ltssm state by reading PCIE status register as part
of ep_pcie_core_enable_endpoint. If it receives a perst assertion
event during polling, device completes polling and then handles perst
assertion with the existing logic. But polling for ltssm state is not
necessary here as the L0 link state is not possible after perst
assertion. This delays the handling of perst assertion and subsequent
perst deaasertion events.

To avoid this delay, avoiding polling for ltssm state if perst is
asserted. Added check for perst during polling of ltssm state and
breaking the loop if perst is asserted.

Change-Id: I38dc82070749751cfd14661ac95eb95eb8dcb665
Signed-off-by: default avatarSai Chaitanya Kaveti <quic_skaveti@quicinc.com>
parent 46ca04c7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -393,6 +393,7 @@ struct ep_pcie_dev_t {
	ulong                        wake_counter;
	ulong                        msi_counter;
	ulong                        global_irq_counter;
	ulong                        perst_ast_in_enum_counter;

	bool                         dump_conf;
	bool                         config_mmio_init;
+11 −2
Original line number Diff line number Diff line
@@ -1681,6 +1681,7 @@ int ep_pcie_core_enable_endpoint(enum ep_pcie_options opt)
	u32 val = 0;
	u32 retries = 0;
	u32 bme = 0;
	bool perst = true;
	bool ltssm_en = false;
	struct ep_pcie_dev_t *dev = &ep_pcie_dev;

@@ -1921,11 +1922,19 @@ int ep_pcie_core_enable_endpoint(enum ep_pcie_options opt)
		if (retries % 100 == 0)
			EP_PCIE_DBG(dev, "PCIe V%d: LTSSM_STATE:0x%x\n",
					dev->rev, (val >> 0xC) & 0x3f);
		perst = atomic_read(&dev->perst_deast) ? 1 : 0;
	} while ((!(val & XMLH_LINK_UP) ||
		!ep_pcie_confirm_linkup(dev, false))
		&& (retries < LINK_UP_CHECK_MAX_COUNT));
		&& (retries < LINK_UP_CHECK_MAX_COUNT) && perst);

	if (retries == LINK_UP_CHECK_MAX_COUNT) {
	if (!perst) {
		dev->perst_ast_in_enum_counter++;
		EP_PCIE_ERR(dev,
				"PCIe V%d: Perst asserted No. %ld while waiting for link to be up\n",
				dev->rev, dev->perst_ast_in_enum_counter);
		ret = EP_PCIE_ERROR;
		goto link_fail;
	} else if (retries == LINK_UP_CHECK_MAX_COUNT) {
		EP_PCIE_ERR(dev, "PCIe V%d: link initialization failed\n",
			dev->rev);
		ret = EP_PCIE_ERROR;