Merge "cnss2: Add retry in cnss_probe if bus init fail"

This commit is contained in:
qctecmdr 2021-05-17 21:32:08 -07:00 • committed by Gerrit - the friendly Code Review server
commit 0a526d680d
3 changed files with 13 additions and 4 deletions

View file

@ -3136,6 +3136,7 @@ static int cnss_probe(struct platform_device *plat_dev)
struct cnss_plat_data *plat_priv;
const struct of_device_id *of_id;
const struct platform_device_id *device_id;
int retry = 0;
if (cnss_get_plat_priv(plat_dev)) {
cnss_pr_err("Driver is already initialized!\n");
@ -3218,13 +3219,22 @@ static int cnss_probe(struct platform_device *plat_dev)
* device power on and bus init.
*/
if (!test_bit(SKIP_DEVICE_BOOT, &plat_priv->ctrl_params.quirks)) {
retry:
ret = cnss_power_on_device(plat_priv);
if (ret)
goto deinit_misc;
ret = cnss_bus_init(plat_priv);
if (ret)
if (ret) {
if ((ret != -EPROBE_DEFER) &&
retry++ < POWER_ON_RETRY_MAX_TIMES) {
cnss_power_off_device(plat_priv);
cnss_pr_dbg("Retry cnss_bus_init #%d\n", retry);
msleep(POWER_ON_RETRY_DELAY_MS * retry);
goto retry;
}
goto power_off;
}
}
cnss_register_coex_service(plat_priv);

View file

@ -43,6 +43,8 @@
#define CNSS_RAMDUMP_VERSION 0
#define MAX_FIRMWARE_NAME_LEN 40
#define FW_V2_NUMBER 2
#define POWER_ON_RETRY_MAX_TIMES 3
#define POWER_ON_RETRY_DELAY_MS 200
#define CNSS_EVENT_SYNC BIT(0)
#define CNSS_EVENT_UNINTERRUPTIBLE BIT(1)

View file

@ -76,9 +76,6 @@ static DEFINE_SPINLOCK(time_sync_lock);
#define FORCE_WAKE_DELAY_MAX_US 6000
#define FORCE_WAKE_DELAY_TIMEOUT_US 60000
#define POWER_ON_RETRY_MAX_TIMES 3
#define POWER_ON_RETRY_DELAY_MS 200
#define LINK_TRAINING_RETRY_MAX_TIMES 3
#define LINK_TRAINING_RETRY_DELAY_MS 500