Browse Source

cnss2: Add wlan PCIe switch property

Add wlan dts property qcom,pcie_switch_type to mark the wlan chip
is attached on the PCIe switch NTN3. If it's PCIE_SWITCH_NTN3, cnss
driver will enable/disable accordingly PCIe switch dsp link when
power on and shutdown wlan chip.

Change-Id: I48bb56879d5c00f05d0b4e62888027c435f861ee
CRs-Fixed: 3878342
Jiani Liu 1 năm trước cách đây
mục cha
commit
b458d07087
3 tập tin đã thay đổi với 25 bổ sung0 xóa
  1. 1 0
      cnss2/main.c
  2. 7 0
      cnss2/main.h
  3. 17 0
      cnss2/pci.c

+ 1 - 0
cnss2/main.c

@@ -5598,6 +5598,7 @@ static int cnss_probe(struct platform_device *plat_dev)
 	cnss_get_pm_domain_info(plat_priv);
 	cnss_get_wlaon_pwr_ctrl_info(plat_priv);
 	cnss_power_misc_params_init(plat_priv);
+	cnss_pci_of_switch_type_init(plat_priv);
 	cnss_get_tcs_info(plat_priv);
 	cnss_get_cpr_info(plat_priv);
 	cnss_aop_interface_init(plat_priv);

+ 7 - 0
cnss2/main.h

@@ -118,6 +118,11 @@ enum cnss_vreg_type {
 	CNSS_VREG_PRIM,
 };
 
+enum cnss_pci_switch_type {
+	PCIE_DIRECT_ATTACH = 0,
+	PCIE_SWITCH_NTN3,
+};
+
 struct cnss_clk_cfg {
 	const char *name;
 	u32 freq;
@@ -650,6 +655,7 @@ struct cnss_plat_data {
 	bool sleep_clk;
 	struct wlchip_serial_id_v01 serial_id;
 	bool ipa_shared_cb_enable;
+	u32 pcie_switch_type;
 };
 
 #if IS_ENABLED(CONFIG_ARCH_QCOM)
@@ -741,6 +747,7 @@ void cnss_aop_interface_deinit(struct cnss_plat_data *plat_priv);
 int cnss_aop_pdc_reconfig(struct cnss_plat_data *plat_priv);
 int cnss_aop_send_msg(struct cnss_plat_data *plat_priv, char *msg);
 void cnss_power_misc_params_init(struct cnss_plat_data *plat_priv);
+void cnss_pci_of_switch_type_init(struct cnss_plat_data *plat_priv);
 int cnss_aop_ol_cpr_cfg_setup(struct cnss_plat_data *plat_priv,
 			      struct wlfw_pmu_cfg_v01 *fw_pmu_cfg);
 int cnss_request_firmware_direct(struct cnss_plat_data *plat_priv,

+ 17 - 0
cnss2/pci.c

@@ -7377,6 +7377,23 @@ static int cnss_try_suspend(struct cnss_plat_data *plat_priv)
 }
 #endif
 
+void cnss_pci_of_switch_type_init(struct cnss_plat_data *plat_priv)
+{
+	struct device *dev = &plat_priv->plat_dev->dev;
+	int ret;
+
+	if (dev && dev->of_node) {
+		ret = of_property_read_u32(dev->of_node,
+					   "qcom,pcie-switch-type",
+					   &plat_priv->pcie_switch_type);
+		if (ret)
+			plat_priv->pcie_switch_type = 0;
+	} else {
+		cnss_pr_err("device or node is not available.");
+	}
+	cnss_pr_dbg("pcie_switch_type is %d", plat_priv->pcie_switch_type);
+}
+
 /* Setting to use this cnss_pm_domain ops will let PM framework override the
  * ops from dev->bus->pm which is pci_dev_pm_ops from pci-driver.c. This ops
  * has to take care everything device driver needed which is currently done