Просмотр исходного кода

cnss2: Allow wlan host driver loading if cnss2 node is present

This change allows wlan host driver loading only if cnss2
node is present in dtsi. On spf, qca6490 wlan driver loading
is getting retried 100 times even if cnss2 node is not present
which is causing andoid bootup delay. This change will return
ENODEV error on wlan driver loading if cnss2 node is not present
instead of EAGAIN which was getting returned earlier.

Change-Id: Ic8568147257642a84983a0d6e738e4bf0ee917b5
CRs-Fixed: 3201930
Naman Padhiar 2 лет назад
Родитель
Сommit
126f48b0f4
3 измененных файлов с 30 добавлено и 0 удалено
  1. 24 0
      cnss2/main.c
  2. 1 0
      cnss2/main.h
  3. 5 0
      cnss2/pci.c

+ 24 - 0
cnss2/main.c

@@ -77,6 +77,8 @@ enum cnss_recovery_type {
 
 static struct cnss_plat_data *plat_env;
 
+static bool cnss_allow_driver_loading;
+
 static DECLARE_RWSEM(cnss_pm_sem);
 
 static struct cnss_fw_files FW_FILES_QCA6174_FW_3_0 = {
@@ -104,6 +106,11 @@ static void cnss_set_plat_priv(struct platform_device *plat_dev,
 	plat_env = plat_priv;
 }
 
+bool cnss_check_driver_loading_allowed(void)
+{
+	return cnss_allow_driver_loading;
+}
+
 struct cnss_plat_data *cnss_get_plat_priv(struct platform_device *plat_dev)
 {
 	return plat_env;
@@ -4061,6 +4068,20 @@ static struct platform_driver cnss_platform_driver = {
 	},
 };
 
+static bool cnss_check_compatible_node(void)
+{
+	struct device_node *dn = NULL;
+
+	for_each_matching_node(dn, cnss_of_match_table) {
+		if (of_device_is_available(dn)) {
+			cnss_allow_driver_loading = true;
+			return true;
+		}
+	}
+
+	return false;
+}
+
 /**
  * cnss_is_valid_dt_node_found - Check if valid device tree node present
  *
@@ -4091,6 +4112,9 @@ static int __init cnss_initialize(void)
 	if (!cnss_is_valid_dt_node_found())
 		return -ENODEV;
 
+	if (!cnss_check_compatible_node())
+		return ret;
+
 	cnss_debug_init();
 	ret = platform_driver_register(&cnss_platform_driver);
 	if (ret)

+ 1 - 0
cnss2/main.h

@@ -636,4 +636,5 @@ int cnss_clear_feature_list(struct cnss_plat_data *plat_priv,
 int cnss_get_feature_list(struct cnss_plat_data *plat_priv,
 			  u64 *feature_list);
 int cnss_get_input_gpio_value(struct cnss_plat_data *plat_priv, int gpio_num);
+bool cnss_check_driver_loading_allowed(void);
 #endif /* _CNSS_MAIN_H */

+ 5 - 0
cnss2/pci.c

@@ -2882,6 +2882,11 @@ int cnss_wlan_register_driver(struct cnss_wlan_driver *driver_ops)
 	const struct pci_device_id *id_table = driver_ops->id_table;
 	unsigned int timeout;
 
+	if (!cnss_check_driver_loading_allowed()) {
+		cnss_pr_info("No cnss2 dtsi entry present");
+		return -ENODEV;
+	}
+
 	if (!plat_priv) {
 		cnss_pr_buf("plat_priv is not ready for register driver\n");
 		return -EAGAIN;