wlan: Wait until NV download to finish
Wait until platform driver finishes NV download before module
init or SSR re-init routine can proceed with initialization.
Change-Id: I2092e186eb1a66e1f501bd75d7bcd4522e6fea33
CRs-Fixed: 458741
diff --git a/CORE/HDD/src/wlan_hdd_early_suspend.c b/CORE/HDD/src/wlan_hdd_early_suspend.c
index 7984a35..26993df 100644
--- a/CORE/HDD/src/wlan_hdd_early_suspend.c
+++ b/CORE/HDD/src/wlan_hdd_early_suspend.c
@@ -1410,6 +1410,9 @@
v_CONTEXT_t pVosContext = NULL;
hdd_context_t *pHddCtx = NULL;
eHalStatus halStatus;
+#ifdef HAVE_WCNSS_CAL_DOWNLOAD
+ int max_retries = 0;
+#endif
#ifdef WLAN_BTAMP_FEATURE
hdd_config_t *pConfig = NULL;
WLANBAP_ConfigType btAmpConfig;
@@ -1418,6 +1421,17 @@
hdd_ssr_timer_del();
hdd_prevent_suspend();
+#ifdef HAVE_WCNSS_CAL_DOWNLOAD
+ /* wait until WCNSS driver downloads NV */
+ while (!wcnss_device_ready() && 5 >= ++max_retries) {
+ msleep(1000);
+ }
+ if (max_retries >= 5) {
+ hddLog(VOS_TRACE_LEVEL_FATAL,"%s: WCNSS driver not ready", __func__);
+ goto err_re_init;
+ }
+#endif
+
/* The driver should always be initialized in STA mode after SSR */
hdd_set_conparam(0);
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index a0d56de..18d6a96 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -5378,6 +5378,9 @@
v_CONTEXT_t pVosContext = NULL;
struct device *dev = NULL;
int ret_status = 0;
+#ifdef HAVE_WCNSS_CAL_DOWNLOAD
+ int max_retries = 0;
+#endif
ENTER();
@@ -5404,6 +5407,18 @@
#endif // ANI_BUS_TYPE_PCI
#ifdef ANI_BUS_TYPE_PLATFORM
+
+#ifdef HAVE_WCNSS_CAL_DOWNLOAD
+ /* wait until WCNSS driver downloads NV */
+ while (!wcnss_device_ready() && 5 >= ++max_retries) {
+ msleep(1000);
+ }
+ if (max_retries >= 5) {
+ hddLog(VOS_TRACE_LEVEL_FATAL,"%s: WCNSS driver not ready", __func__);
+ return -ENODEV;
+ }
+#endif
+
dev = wcnss_wlan_get_device();
#endif // ANI_BUS_TYPE_PLATFORM