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

Commit 44eb6a60 authored by Yan He's avatar Yan He
Browse files

msm: pcie: check power condition when disable a link



Ignore the request to disable a PCIe link if that link is already
in power down state.

Change-Id: I0984d7af68554c04a7700927a8e4921591ba0ae2
CRs-fixed: 656177
Signed-off-by: default avatarYan He <yanhe@codeaurora.org>
parent a8816441
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -1228,6 +1228,7 @@ int msm_pcie_enable(struct msm_pcie_dev_t *dev, u32 options)
		msm_pcie_config_l1ss(dev);

	dev->link_status = MSM_PCIE_LINK_ENABLED;
	dev->power_on = true;
	goto out;

link_fail:
@@ -1250,7 +1251,17 @@ void msm_pcie_disable(struct msm_pcie_dev_t *dev, u32 options)

	if ((dev->link_status == MSM_PCIE_LINK_DISABLED)
		&& !(options & PM_EXPT)) {
		pr_err("PCIe:%s: the link is already enabled\n", __func__);
		pr_err(
			"PCIe:%s: the link of RC%d is already disabled\n",
			__func__, dev->rc_idx);
		mutex_unlock(&dev->setup_lock);
		return;
	}

	if (!dev->power_on) {
		PCIE_DBG(
			"PCIe:%s: the link of RC%d is already power down.\n",
			__func__, dev->rc_idx);
		mutex_unlock(&dev->setup_lock);
		return;
	}
@@ -1274,6 +1285,7 @@ void msm_pcie_disable(struct msm_pcie_dev_t *dev, u32 options)
		msm_pcie_pipe_clk_deinit(dev);

	dev->link_status = MSM_PCIE_LINK_DISABLED;
	dev->power_on = false;

	mutex_unlock(&dev->setup_lock);
}
@@ -1534,6 +1546,7 @@ static int msm_pcie_probe(struct platform_device *pdev)
	msm_pcie_dev[rc_idx].recovery_pending = false;
	msm_pcie_dev[rc_idx].linkdown_counter = 0;
	msm_pcie_dev[rc_idx].wake_counter = 0;
	msm_pcie_dev[rc_idx].power_on = false;
	memcpy(msm_pcie_dev[rc_idx].vreg, msm_pcie_vreg_info,
				sizeof(msm_pcie_vreg_info));
	memcpy(msm_pcie_dev[rc_idx].gpio, msm_pcie_gpio_info,
+1 −0
Original line number Diff line number Diff line
@@ -208,6 +208,7 @@ struct msm_pcie_dev_t {
	u32                          rc_shadow[PCIE_CONF_SPACE_DW];
	bool                         shadow_en;
	struct msm_pcie_register_event *event_reg;
	bool                         power_on;
};

extern int msm_pcie_enumerate(u32 rc_idx);