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

Commit 813ce455 authored by Vivek Pernamitta's avatar Vivek Pernamitta
Browse files

msm: pcie : Extend link recovery for config space access failure



Extend recovery mechanism for both config read and write
failures for FF's.

Change-Id: Iee22b04b5c6de83c55466d6a379a6734dea8026e
Signed-off-by: default avatarVivek Pernamitta <vpernami@codeaurora.org>
parent 566edd21
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.*/
/* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.*/

#include <dt-bindings/regulator/qcom,rpmh-regulator-levels.h>
#include <linux/bitops.h>
@@ -3219,23 +3219,15 @@ static inline int msm_pcie_oper_conf(struct pci_bus *bus, u32 devfn, int oper,

		if (dev->shadow_en) {
			if (rd_val == PCIE_LINK_DOWN &&
			   (readl_relaxed(config_base) == PCIE_LINK_DOWN)) {
			   (readl_relaxed(config_base) == PCIE_LINK_DOWN))
				PCIE_ERR(dev,
					"Read of RC%d %d:0x%02x + 0x%04x[%d] is all FFs\n",
					rc_idx, bus->number, devfn,
					where, size);
				if (dev->config_recovery) {
					PCIE_ERR(dev,
						"RC%d link recovery schedule\n",
						rc_idx);
					dev->cfg_access = false;
					schedule_work(&dev->link_recover_wq);
				}
			} else {
			else
				msm_pcie_save_shadow(dev, word_offset, wr_val,
					bdf, rc);
		}
		}

		PCIE_DBG3(dev,
			"RC%d %d:0x%02x + 0x%04x[%d] <- 0x%08x; rd 0x%08x val 0x%08x\n",
@@ -3243,6 +3235,17 @@ static inline int msm_pcie_oper_conf(struct pci_bus *bus, u32 devfn, int oper,
			wr_val, rd_val, *val);
	}

	if (rd_val == PCIE_LINK_DOWN &&
	   (readl_relaxed(config_base) == PCIE_LINK_DOWN)) {
		if (dev->config_recovery) {
			PCIE_ERR(dev,
				"RC%d link recovery schedule\n",
				rc_idx);
			dev->cfg_access = false;
			schedule_work(&dev->link_recover_wq);
		}
	}

unlock:
	spin_unlock_irqrestore(&dev->cfg_lock, dev->irqsave_flags);
out: