[PATCH 2/2] smd: use hal stop command
Kalle Valo
kvalo at qca.qualcomm.com
Tue May 21 16:29:43 EDT 2013
Now, at least on mako, you can freely put interface up and down and everything
will still work. Also you can remove and insert wcn36xx.ko freely.
Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
hal.h | 9 ++-------
main.c | 1 +
smd.c | 18 ++++++++++++++++++
smd.h | 1 +
4 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/hal.h b/hal.h
index 29c1b8d..2c75a3e 100644
--- a/hal.h
+++ b/hal.h
@@ -730,15 +730,10 @@ struct wcn36xx_hal_mac_start_rsp_msg {
struct wcn36xx_hal_mac_start_rsp_params start_rsp_params;
} __packed;
-struct wcn36xx_hal_mac_stop_req_params {
- /* The reason for which the device is being stopped */
- enum wcn36xx_hal_stop_type reason;
-
-};
-
struct wcn36xx_hal_mac_stop_req_msg {
struct wcn36xx_hal_msg_header header;
- struct wcn36xx_hal_mac_stop_req_params stopReqParams;
+
+ enum wcn36xx_hal_stop_type reason;
};
struct wcn36xx_hal_mac_stop_rsp_msg {
diff --git a/main.c b/main.c
index 0f5dc81..0b1f5dd 100644
--- a/main.c
+++ b/main.c
@@ -81,6 +81,7 @@ static void wcn36xx_stop(struct ieee80211_hw *hw)
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac stop");
wcn36xx_dxe_deinit(wcn);
+ wcn36xx_smd_stop(wcn);
wcn36xx_smd_close(wcn);
kfree(wcn->smd_buf);
diff --git a/smd.c b/smd.c
index e596646..8c7dfb2 100644
--- a/smd.c
+++ b/smd.c
@@ -138,6 +138,7 @@ int wcn36xx_smd_start(struct wcn36xx *wcn)
return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
}
+
static int wcn36xx_smd_start_rsp(struct wcn36xx *wcn, void *buf, size_t len)
{
struct wcn36xx_hal_mac_start_rsp_msg * rsp;
@@ -176,6 +177,22 @@ static int wcn36xx_smd_start_rsp(struct wcn36xx *wcn, void *buf, size_t len)
return 0;
}
+int wcn36xx_smd_stop(struct wcn36xx *wcn)
+{
+ struct wcn36xx_hal_mac_stop_req_msg msg_body;
+
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_STOP_REQ);
+
+ msg_body.reason = HAL_STOP_TYPE_SYS_RESET;
+
+ PREPARE_HAL_BUF(wcn->smd_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "hal stop reason %d",
+ msg_body.reason);
+
+ return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+}
+
int wcn36xx_smd_init_scan(struct wcn36xx *wcn)
{
struct wcn36xx_hal_init_scan_req_msg msg_body;
@@ -680,6 +697,7 @@ static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len)
case WCN36XX_HAL_START_RSP:
wcn36xx_smd_start_rsp(wcn, buf, len);
break;
+ case WCN36XX_HAL_STOP_RSP:
case WCN36XX_HAL_ADD_STA_SELF_RSP:
case WCN36XX_HAL_DELETE_STA_RSP:
case WCN36XX_HAL_INIT_SCAN_RSP:
diff --git a/smd.h b/smd.h
index ad5af54..43e548f 100644
--- a/smd.h
+++ b/smd.h
@@ -49,6 +49,7 @@ void wcn36xx_smd_close(struct wcn36xx *wcn);
int wcn36xx_smd_load_nv(struct wcn36xx *wcn);
int wcn36xx_smd_start(struct wcn36xx *wcn);
+int wcn36xx_smd_stop(struct wcn36xx *wcn);
int wcn36xx_smd_init_scan(struct wcn36xx *wcn);
int wcn36xx_smd_start_scan(struct wcn36xx *wcn, int ch);
int wcn36xx_smd_end_scan(struct wcn36xx *wcn, int ch);
More information about the wcn36xx
mailing list