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

Commit b9a496f3 authored by Yan He's avatar Yan He
Browse files

msm: pcie: enable client to control config space shadowing



PCIe client driver has the requirement to turn on and turn off
the shadowing of config space in PCIe bus driver to resume the
PCIe device or recover the link after expected linkdown happens.
Add the support in PCIe bus driver for this.

Change-Id: I7bc3d08fce33a6564b24dab1fa9f9591822e2f38
Signed-off-by: default avatarYan He <yanhe@codeaurora.org>
parent d81481d4
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -106,4 +106,16 @@ int msm_pcie_deregister_event(struct msm_pcie_register_event *reg);
 * Return: 0 on success, negative value on error
 */
int msm_pcie_recover_config(struct pci_dev *dev);

/**
 * msm_pcie_shadow_control - control the shadowing of PCIe config space.
 * @dev:	pci device structure
 * @enable:	shadowing should be enabled or disabled
 *
 * This function gives PCIe endpoint device drivers the control to enable
 * or disable the shadowing of PCIe config space.
 *
 * Return: 0 on success, negative value on error
 */
int msm_pcie_shadow_control(struct pci_dev *dev, bool enable);
#endif
+28 −0
Original line number Diff line number Diff line
@@ -2250,3 +2250,31 @@ int msm_pcie_recover_config(struct pci_dev *dev)
	return ret;
}
EXPORT_SYMBOL(msm_pcie_recover_config);

int msm_pcie_shadow_control(struct pci_dev *dev, bool enable)
{
	int ret = 0;
	struct msm_pcie_dev_t *pcie_dev;

	if (dev) {
		pcie_dev = PCIE_BUS_PRIV_DATA(dev);
		PCIE_DBG(pcie_dev,
			"Recovery for the link of RC%d\n", pcie_dev->rc_idx);
	} else {
		pr_err("PCIe: the input pci dev is NULL.\n");
		return -ENODEV;
	}

	PCIE_DBG(pcie_dev,
		"The shadowing of RC%d is %s enabled currently.\n",
		pcie_dev->rc_idx, pcie_dev->shadow_en ? "" : "not");

	pcie_dev->shadow_en = enable;

	PCIE_DBG(pcie_dev,
		"Shadowing of RC%d is turned %s upon user's request.\n",
		pcie_dev->rc_idx, enable ? "on" : "off");

	return ret;
}
EXPORT_SYMBOL(msm_pcie_shadow_control);