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

Commit a3076b8c authored by Sujeev Dias's avatar Sujeev Dias Committed by Gerrit - the friendly Code Review server
Browse files

mhi: cntrl: qcom: save POR PCIe link speed during probe



MHI host could transition into system suspend before receiving
any bandwidth change request from device. Without a default link
state, host would switch link state into unsupported state and
cause a PCIe link down. Avoid this unsupported scenario by
explicitly saving the initial link state during probe.

CRs-Fixed: 2436570
Change-Id: Icc5c681937a51eeb4f2df3c95914f924311ca388
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent 37afaf2a
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -392,11 +392,13 @@ int mhi_arch_pcie_init(struct mhi_controller *mhi_cntrl)
	struct arch_info *arch_info = mhi_dev->arch_info;
	char node[32];
	int ret;
	u16 linkstat;

	if (!arch_info) {
		struct msm_pcie_register_event *reg_event;
		struct pci_dev *root_port;
		struct device_node *root_ofnode;
		struct mhi_link_info *cur_link_info;

		arch_info = devm_kzalloc(&mhi_dev->pci_dev->dev,
					 sizeof(*arch_info), GFP_KERNEL);
@@ -485,6 +487,20 @@ int mhi_arch_pcie_init(struct mhi_controller *mhi_cntrl)
			  mhi_arch_pcie_bw_scale_work);
		mhi_dev->bw_scale = mhi_arch_pcie_bw_scale_cb;

		/* store the current bw info */
		ret = pcie_capability_read_word(mhi_dev->pci_dev,
						PCI_EXP_LNKSTA, &linkstat);
		if (ret)
			return ret;

		cur_link_info = &arch_info->current_link_info;
		cur_link_info->target_link_speed =
			linkstat & PCI_EXP_LNKSTA_CLS;
		cur_link_info->target_link_width =
			(linkstat & PCI_EXP_LNKSTA_NLW) >>
			PCI_EXP_LNKSTA_NLW_SHIFT;
		mhi_cntrl->mhi_link_info = *cur_link_info;

		mhi_driver_register(&mhi_bl_driver);
	}