Commit 59502647 authored by Dedy Lansky's avatar Dedy Lansky Committed by John W. Linville

wil6210: introduce separate completion for WMI

re-use of wmi_ready for both FW ready event and for wmi_call was causing
false "FW not ready" indication in case wmi_call() was invoked while reset
took place.
add wmi_call completion variable instead of re-using wmi_ready.
Signed-off-by: default avatarDedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: default avatarVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e0106ada
...@@ -286,6 +286,7 @@ int wil_priv_init(struct wil6210_priv *wil) ...@@ -286,6 +286,7 @@ int wil_priv_init(struct wil6210_priv *wil)
mutex_init(&wil->wmi_mutex); mutex_init(&wil->wmi_mutex);
init_completion(&wil->wmi_ready); init_completion(&wil->wmi_ready);
init_completion(&wil->wmi_call);
wil->pending_connect_cid = -1; wil->pending_connect_cid = -1;
setup_timer(&wil->connect_timer, wil_connect_timer_fn, (ulong)wil); setup_timer(&wil->connect_timer, wil_connect_timer_fn, (ulong)wil);
...@@ -536,6 +537,7 @@ int wil_reset(struct wil6210_priv *wil) ...@@ -536,6 +537,7 @@ int wil_reset(struct wil6210_priv *wil)
/* init after reset */ /* init after reset */
wil->pending_connect_cid = -1; wil->pending_connect_cid = -1;
reinit_completion(&wil->wmi_ready); reinit_completion(&wil->wmi_ready);
reinit_completion(&wil->wmi_call);
wil6210_enable_irq(wil); wil6210_enable_irq(wil);
......
...@@ -399,6 +399,7 @@ struct wil6210_priv { ...@@ -399,6 +399,7 @@ struct wil6210_priv {
struct mutex wmi_mutex; struct mutex wmi_mutex;
struct wil6210_mbox_ctl mbox_ctl; struct wil6210_mbox_ctl mbox_ctl;
struct completion wmi_ready; struct completion wmi_ready;
struct completion wmi_call;
u16 wmi_seq; u16 wmi_seq;
u16 reply_id; /**< wait for this WMI event */ u16 reply_id; /**< wait for this WMI event */
void *reply_buf; void *reply_buf;
......
...@@ -300,7 +300,7 @@ static void wmi_evt_fw_ready(struct wil6210_priv *wil, int id, void *d, ...@@ -300,7 +300,7 @@ static void wmi_evt_fw_ready(struct wil6210_priv *wil, int id, void *d,
wil_dbg_wmi(wil, "WMI: got FW ready event\n"); wil_dbg_wmi(wil, "WMI: got FW ready event\n");
set_bit(wil_status_fwready, &wil->status); set_bit(wil_status_fwready, &wil->status);
/* reuse wmi_ready for the firmware ready indication */ /* let the reset sequence continue */
complete(&wil->wmi_ready); complete(&wil->wmi_ready);
} }
...@@ -764,7 +764,7 @@ int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len, ...@@ -764,7 +764,7 @@ int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len,
wil->reply_id = reply_id; wil->reply_id = reply_id;
wil->reply_buf = reply; wil->reply_buf = reply;
wil->reply_size = reply_size; wil->reply_size = reply_size;
remain = wait_for_completion_timeout(&wil->wmi_ready, remain = wait_for_completion_timeout(&wil->wmi_call,
msecs_to_jiffies(to_msec)); msecs_to_jiffies(to_msec));
if (0 == remain) { if (0 == remain) {
wil_err(wil, "wmi_call(0x%04x->0x%04x) timeout %d msec\n", wil_err(wil, "wmi_call(0x%04x->0x%04x) timeout %d msec\n",
...@@ -1160,7 +1160,7 @@ static void wmi_event_handle(struct wil6210_priv *wil, ...@@ -1160,7 +1160,7 @@ static void wmi_event_handle(struct wil6210_priv *wil,
len - sizeof(*wmi)); len - sizeof(*wmi));
} }
wil_dbg_wmi(wil, "Complete WMI 0x%04x\n", id); wil_dbg_wmi(wil, "Complete WMI 0x%04x\n", id);
complete(&wil->wmi_ready); complete(&wil->wmi_call);
return; return;
} }
/* unsolicited event */ /* unsolicited event */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment