wil6210: support NL_60G_GEN_FW_RESET UNSPEC vendor command

Userspace can use this command to reset the FW/HW. Currently this is
supported only with WMI_ONLY FW.

The recommended way to reset the FW/HW is by interface down/up.
However there are cases where this is not allowed, specifically when
using WMI_ONLY FW. To overcome this limitation, userspace can use
NL_60G_GEN_FW_RESET instead.

Change-Id: If047beaa76bcd6c3ce567a10db919a884d5ec89d
Signed-off-by: Dedy Lansky <dlansky@codeaurora.org>
This commit is contained in:
Dedy Lansky 2019-04-01 15:04:25 +03:00 • committed by Alexei Avshalom Lazar
commit b5e9995cb8

View file

@ -139,6 +139,8 @@ enum wil_nl_60g_evt_type {
enum wil_nl_60g_debug_cmd {
NL_60G_DBG_FORCE_WMI_SEND,
NL_60G_GEN_RADAR_ALLOC_BUFFER,
NL_60G_GEN_FW_RESET,
};
struct wil_nl_60g_send_receive_wmi {
@ -3707,6 +3709,23 @@ static int wil_nl_60g_handle_cmd(struct wiphy *wiphy, struct wireless_dev *wdev,
wil_dbg_wmi(wil, "force sending wmi commands %d\n",
wil->force_wmi_send);
break;
case NL_60G_GEN_FW_RESET:
if (!test_bit(WMI_FW_CAPABILITY_WMI_ONLY,
wil->fw_capabilities)) {
rc = -EOPNOTSUPP;
break;
}
wil_dbg_misc(wil,
"NL_60G_GEN_FW_RESET, resetting...\n");
mutex_lock(&wil->mutex);
down_write(&wil->mem_lock);
rc = wil_reset(wil, true);
up_write(&wil->mem_lock);
mutex_unlock(&wil->mutex);
break;
default:
rc = -EINVAL;
wil_err(wil, "invalid debug_cmd id %d",