Browse Source

cnss2: Add support for qca6174

Added below mentioned changes to support qca6174 in cnss2 driver.
1.    While resuming pci link, restore the pci config space before
     enabling pci device.
2.    Add 10ms delay between wlan_en become active and pcie reset
     de-assert.
3.    For wlan chipsets which don't support cold boot calibration,
     schedule Wlan driver load in cnss_cold_boot_cal_start_hdlr.

Change-Id: I28435896314783353db5dd830051df9467be6585
CRs-Fixed: 3359223
Geetha Jaya Sri Bandla 2 years ago
parent
commit
7e956ba94e
4 changed files with 27 additions and 7 deletions
  1. 1 0
      cnss2/bus.h
  2. 12 1
      cnss2/main.c
  3. 4 5
      cnss2/pci.c
  4. 10 1
      cnss2/power.c

+ 1 - 0
cnss2/bus.h

@@ -20,6 +20,7 @@
 #define QCA6390_DEVICE_ID		0x1101
 #define QCA6490_VENDOR_ID		0x17CB
 #define QCA6490_DEVICE_ID		0x1103
+#define QCN7605_DEVICE_ID               0x1102
 #define KIWI_VENDOR_ID			0x17CB
 #define KIWI_DEVICE_ID			0x1107
 #define MANGO_VENDOR_ID			0x17CB

+ 12 - 1
cnss2/main.c

@@ -2138,6 +2138,18 @@ mark_cal_fail:
 		 */
 		plat_priv->cal_done = CNSS_CAL_FAILURE;
 		set_bit(CNSS_COLD_BOOT_CAL_DONE, &plat_priv->driver_state);
+
+		if (plat_priv->device_id == QCA6174_DEVICE_ID ||
+		    plat_priv->device_id == QCN7605_DEVICE_ID) {
+			if (!test_bit(CNSS_DRIVER_REGISTER, &plat_priv->driver_state))
+				goto out;
+
+			cnss_pr_info("Schedule WLAN driver load\n");
+
+			if (cancel_delayed_work_sync(&plat_priv->wlan_reg_driver_work))
+				schedule_delayed_work(&plat_priv->wlan_reg_driver_work,
+						      0);
+		}
 	}
 
 out:
@@ -4204,7 +4216,6 @@ int cnss_wlan_hw_enable(void)
 
 	if (test_bit(CNSS_PCI_PROBE_DONE, &plat_priv->driver_state))
 		goto register_driver;
-
 	ret = cnss_wlan_device_init(plat_priv);
 	if (ret) {
 		if (!test_bit(CNSS_WLAN_HW_DISABLED, &plat_priv->driver_state))

+ 4 - 5
cnss2/pci.c

@@ -1248,16 +1248,16 @@ int cnss_resume_pci_link(struct cnss_pci_data *pci_priv)
 		}
 	}
 
+	ret = cnss_set_pci_config_space(pci_priv, RESTORE_PCI_CONFIG_SPACE);
+	if (ret)
+		goto out;
+
 	ret = pci_enable_device(pci_priv->pci_dev);
 	if (ret) {
 		cnss_pr_err("Failed to enable PCI device, err = %d\n", ret);
 		goto out;
 	}
 
-	ret = cnss_set_pci_config_space(pci_priv, RESTORE_PCI_CONFIG_SPACE);
-	if (ret)
-		goto out;
-
 	pci_set_master(pci_priv->pci_dev);
 
 	if (pci_priv->pci_link_down_ind)
@@ -3097,7 +3097,6 @@ int cnss_wlan_register_driver(struct cnss_wlan_driver *driver_ops)
 	}
 
 	pci_priv = plat_priv->bus_priv;
-
 	if (test_bit(CNSS_WLAN_HW_DISABLED, &plat_priv->driver_state)) {
 		while (id_table && id_table->device) {
 			if (plat_priv->device_id == id_table->device) {

+ 10 - 1
cnss2/power.c

@@ -76,6 +76,7 @@ static struct cnss_clk_cfg cnss_clk_list[] = {
 
 #define BOOTSTRAP_DELAY			1000
 #define WLAN_ENABLE_DELAY		1000
+#define WLAN_ENABLE_DELAY_ROME		10000
 
 #define TCS_CMD_DATA_ADDR_OFFSET	0x4
 #define TCS_OFFSET			0xC8
@@ -1012,12 +1013,19 @@ static int cnss_select_pinctrl_state(struct cnss_plat_data *plat_priv,
 					    ret);
 				goto out;
 			}
-			udelay(WLAN_ENABLE_DELAY);
+
+			if (plat_priv->device_id == QCA6174_DEVICE_ID ||
+			    plat_priv->device_id == 0)
+				udelay(WLAN_ENABLE_DELAY_ROME);
+			else
+				udelay(WLAN_ENABLE_DELAY);
+
 			cnss_set_xo_clk_gpio_state(plat_priv, false);
 		} else {
 			cnss_set_xo_clk_gpio_state(plat_priv, false);
 			goto out;
 		}
+
 	} else {
 		if (!IS_ERR_OR_NULL(pinctrl_info->wlan_en_sleep)) {
 			cnss_wlan_hw_disable_check(plat_priv);
@@ -1789,4 +1797,5 @@ int cnss_dev_specific_power_on(struct cnss_plat_data *plat_priv)
 
 	plat_priv->powered_on = false;
 	return cnss_power_on_device(plat_priv);
+
 }