From b87b69ca1acd9b813fe477e8a5eb71b6be7fcb1f Mon Sep 17 00:00:00 2001 From: Dedy Lansky Date: Mon, 1 Apr 2019 15:04:25 +0300 Subject: [PATCH] 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 --- drivers/net/wireless/ath/wil6210/cfg80211.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index 0ad83e5aa5c5..74d459a19f54 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c @@ -103,6 +103,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 { @@ -3575,6 +3577,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",