Эх сурвалжийг харах

cnss2: Wait for PCIe switch ready

If WLAN is attached to PCIe switch, it's possible that PCIe switch is
not probed when cnss_probe call PCIe enumeration. This case can lead to
cnss_probe failure, it prenventing the cld driver ko loading. From user
layer can see WLAN interface is not up.

To fix this issue, cnss_probe call PCIe enumeration until PCIe switch is
probed.

Change-Id: I302f23cc2af6c738e4c18c7eb6a09685a49a643c
CRs-Fixed: 3863866
Jiani Liu 7 сар өмнө
parent
commit
a9b214d91e
1 өөрчлөгдсөн 24 нэмэгдсэн , 1 устгасан
  1. 24 1
      cnss2/pci_qcom.c

+ 24 - 1
cnss2/pci_qcom.c

@@ -34,9 +34,32 @@ static struct cnss_msi_config msi_config_one_msi = {
 };
 #endif
 
+#define ENUM_RETRY_MAX_TIMES 8
+#define ENUM_RETRY_DELAY_MS 500
+
 int _cnss_pci_enumerate(struct cnss_plat_data *plat_priv, u32 rc_num)
 {
-	return msm_pcie_enumerate(rc_num);
+	u32 retry = 0;
+	int ret;
+
+	if (plat_priv->pcie_switch_type == PCIE_SWITCH_NTN3) {
+		while (retry++ < ENUM_RETRY_MAX_TIMES) {
+			ret = msm_pcie_enumerate(rc_num);
+			/* For PCIe switch platform, cnss_probe may called
+			 * before PCIe switch hardware ready, wait for
+			 * msm_pcie_enumerate complete.
+			 */
+			if (ret == -EPROBE_DEFER) {
+				cnss_pr_dbg("PCIe RC%d not ready, retry:%dth\n",
+					    rc_num, retry);
+				msleep(ENUM_RETRY_DELAY_MS);
+			}
+		}
+	} else {
+		return msm_pcie_enumerate(rc_num);
+	}
+
+	return ret;
 }
 
 int cnss_pci_assert_perst(struct cnss_pci_data *pci_priv)