aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Valo <kvalo@qca.qualcomm.com>2012-03-25 10:15:27 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2012-03-26 09:36:46 -0400
commite76ac2bf637defbe3b7fc644813be584b941ff0a (patch)
treefc925282edd69d20b8e7885909f9a50b190b9d08
parent048f24f695cb7cf5fd78eaa4aee38ce1c2e2f8c5 (diff)
ath6kl: add htc ops
In preparation for adding HTC pipe implementation add htc-ops.h to make it possible dynamically choose which HTC type is used. Needed for full USB support. Based on the code by Ray Chen <raychen@qca.qualcomm.com>. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com> Signed-off-by: Ray Chen <raychen@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/Makefile2
-rw-r--r--drivers/net/wireless/ath/ath6kl/core.c12
-rw-r--r--drivers/net/wireless/ath/ath6kl/core.h7
-rw-r--r--drivers/net/wireless/ath/ath6kl/htc-ops.h113
-rw-r--r--drivers/net/wireless/ath/ath6kl/htc.h53
-rw-r--r--drivers/net/wireless/ath/ath6kl/htc_mbox.c (renamed from drivers/net/wireless/ath/ath6kl/htc.c)77
-rw-r--r--drivers/net/wireless/ath/ath6kl/init.c3
-rw-r--r--drivers/net/wireless/ath/ath6kl/sdio.c2
-rw-r--r--drivers/net/wireless/ath/ath6kl/txrx.c3
-rw-r--r--drivers/net/wireless/ath/ath6kl/usb.c2
10 files changed, 219 insertions, 55 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/Makefile b/drivers/net/wireless/ath/ath6kl/Makefile
index 85746c3eb027..f4ac8174b24c 100644
--- a/drivers/net/wireless/ath/ath6kl/Makefile
+++ b/drivers/net/wireless/ath/ath6kl/Makefile
@@ -25,7 +25,7 @@
25obj-$(CONFIG_ATH6KL) += ath6kl_core.o 25obj-$(CONFIG_ATH6KL) += ath6kl_core.o
26ath6kl_core-y += debug.o 26ath6kl_core-y += debug.o
27ath6kl_core-y += hif.o 27ath6kl_core-y += hif.o
28ath6kl_core-y += htc.o 28ath6kl_core-y += htc_mbox.o
29ath6kl_core-y += bmi.o 29ath6kl_core-y += bmi.o
30ath6kl_core-y += cfg80211.o 30ath6kl_core-y += cfg80211.o
31ath6kl_core-y += init.o 31ath6kl_core-y += init.o
diff --git a/drivers/net/wireless/ath/ath6kl/core.c b/drivers/net/wireless/ath/ath6kl/core.c
index 45e641f3a41b..bb9fe381c3c6 100644
--- a/drivers/net/wireless/ath/ath6kl/core.c
+++ b/drivers/net/wireless/ath/ath6kl/core.c
@@ -23,6 +23,7 @@
23 23
24#include "debug.h" 24#include "debug.h"
25#include "hif-ops.h" 25#include "hif-ops.h"
26#include "htc-ops.h"
26#include "cfg80211.h" 27#include "cfg80211.h"
27 28
28unsigned int debug_mask; 29unsigned int debug_mask;
@@ -39,12 +40,21 @@ module_param(uart_debug, uint, 0644);
39module_param(ath6kl_p2p, uint, 0644); 40module_param(ath6kl_p2p, uint, 0644);
40module_param(testmode, uint, 0644); 41module_param(testmode, uint, 0644);
41 42
42int ath6kl_core_init(struct ath6kl *ar) 43int ath6kl_core_init(struct ath6kl *ar, enum ath6kl_htc_type htc_type)
43{ 44{
44 struct ath6kl_bmi_target_info targ_info; 45 struct ath6kl_bmi_target_info targ_info;
45 struct net_device *ndev; 46 struct net_device *ndev;
46 int ret = 0, i; 47 int ret = 0, i;
47 48
49 switch (htc_type) {
50 case ATH6KL_HTC_TYPE_MBOX:
51 ath6kl_htc_mbox_attach(ar);
52 break;
53 default:
54 WARN_ON(1);
55 return -ENOMEM;
56 }
57
48 ar->ath6kl_wq = create_singlethread_workqueue("ath6kl"); 58 ar->ath6kl_wq = create_singlethread_workqueue("ath6kl");
49 if (!ar->ath6kl_wq) 59 if (!ar->ath6kl_wq)
50 return -ENOMEM; 60 return -ENOMEM;
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index f1ce00314a99..f71c3a7a5e72 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -462,6 +462,10 @@ enum ath6kl_hif_type {
462 ATH6KL_HIF_TYPE_USB, 462 ATH6KL_HIF_TYPE_USB,
463}; 463};
464 464
465enum ath6kl_htc_type {
466 ATH6KL_HTC_TYPE_MBOX,
467};
468
465/* Max number of filters that hw supports */ 469/* Max number of filters that hw supports */
466#define ATH6K_MAX_MC_FILTERS_PER_LIST 7 470#define ATH6K_MAX_MC_FILTERS_PER_LIST 7
467struct ath6kl_mc_filter { 471struct ath6kl_mc_filter {
@@ -576,6 +580,7 @@ struct ath6kl {
576 580
577 struct ath6kl_bmi bmi; 581 struct ath6kl_bmi bmi;
578 const struct ath6kl_hif_ops *hif_ops; 582 const struct ath6kl_hif_ops *hif_ops;
583 const struct ath6kl_htc_ops *htc_ops;
579 struct wmi *wmi; 584 struct wmi *wmi;
580 int tx_pending[ENDPOINT_MAX]; 585 int tx_pending[ENDPOINT_MAX];
581 int total_tx_data_pend; 586 int total_tx_data_pend;
@@ -831,7 +836,7 @@ int ath6kl_init_hw_params(struct ath6kl *ar);
831void ath6kl_check_wow_status(struct ath6kl *ar); 836void ath6kl_check_wow_status(struct ath6kl *ar);
832 837
833struct ath6kl *ath6kl_core_create(struct device *dev); 838struct ath6kl *ath6kl_core_create(struct device *dev);
834int ath6kl_core_init(struct ath6kl *ar); 839int ath6kl_core_init(struct ath6kl *ar, enum ath6kl_htc_type htc_type);
835void ath6kl_core_cleanup(struct ath6kl *ar); 840void ath6kl_core_cleanup(struct ath6kl *ar);
836void ath6kl_core_destroy(struct ath6kl *ar); 841void ath6kl_core_destroy(struct ath6kl *ar);
837 842
diff --git a/drivers/net/wireless/ath/ath6kl/htc-ops.h b/drivers/net/wireless/ath/ath6kl/htc-ops.h
new file mode 100644
index 000000000000..2d4eed55cfd1
--- /dev/null
+++ b/drivers/net/wireless/ath/ath6kl/htc-ops.h
@@ -0,0 +1,113 @@
1/*
2 * Copyright (c) 2004-2011 Atheros Communications Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef HTC_OPS_H
18#define HTC_OPS_H
19
20#include "htc.h"
21#include "debug.h"
22
23static inline void *ath6kl_htc_create(struct ath6kl *ar)
24{
25 return ar->htc_ops->create(ar);
26}
27
28static inline int ath6kl_htc_wait_target(struct htc_target *target)
29{
30 return target->dev->ar->htc_ops->wait_target(target);
31}
32
33static inline int ath6kl_htc_start(struct htc_target *target)
34{
35 return target->dev->ar->htc_ops->start(target);
36}
37
38static inline int ath6kl_htc_conn_service(struct htc_target *target,
39 struct htc_service_connect_req *req,
40 struct htc_service_connect_resp *resp)
41{
42 return target->dev->ar->htc_ops->conn_service(target, req, resp);
43}
44
45static inline int ath6kl_htc_tx(struct htc_target *target,
46 struct htc_packet *packet)
47{
48 return target->dev->ar->htc_ops->tx(target, packet);
49}
50
51static inline void ath6kl_htc_stop(struct htc_target *target)
52{
53 return target->dev->ar->htc_ops->stop(target);
54}
55
56static inline void ath6kl_htc_cleanup(struct htc_target *target)
57{
58 return target->dev->ar->htc_ops->cleanup(target);
59}
60
61static inline void ath6kl_htc_flush_txep(struct htc_target *target,
62 enum htc_endpoint_id endpoint,
63 u16 tag)
64{
65 return target->dev->ar->htc_ops->flush_txep(target, endpoint, tag);
66}
67
68static inline void ath6kl_htc_flush_rx_buf(struct htc_target *target)
69{
70 return target->dev->ar->htc_ops->flush_rx_buf(target);
71}
72
73static inline void ath6kl_htc_activity_changed(struct htc_target *target,
74 enum htc_endpoint_id endpoint,
75 bool active)
76{
77 return target->dev->ar->htc_ops->activity_changed(target, endpoint,
78 active);
79}
80
81static inline int ath6kl_htc_get_rxbuf_num(struct htc_target *target,
82 enum htc_endpoint_id endpoint)
83{
84 return target->dev->ar->htc_ops->get_rxbuf_num(target, endpoint);
85}
86
87static inline int ath6kl_htc_add_rxbuf_multiple(struct htc_target *target,
88 struct list_head *pktq)
89{
90 return target->dev->ar->htc_ops->add_rxbuf_multiple(target, pktq);
91}
92
93static inline int ath6kl_htc_credit_setup(struct htc_target *target,
94 struct ath6kl_htc_credit_info *info)
95{
96 return target->dev->ar->htc_ops->credit_setup(target, info);
97}
98
99static inline void ath6kl_htc_tx_complete(struct ath6kl *ar,
100 struct sk_buff *skb)
101{
102 ar->htc_ops->tx_complete(ar, skb);
103}
104
105
106static inline void ath6kl_htc_rx_complete(struct ath6kl *ar,
107 struct sk_buff *skb, u8 pipe)
108{
109 ar->htc_ops->rx_complete(ar, skb, pipe);
110}
111
112
113#endif
diff --git a/drivers/net/wireless/ath/ath6kl/htc.h b/drivers/net/wireless/ath/ath6kl/htc.h
index 0ba8deb2f096..43cb2cf270d6 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.h
+++ b/drivers/net/wireless/ath/ath6kl/htc.h
@@ -519,6 +519,32 @@ struct htc_control_buffer {
519 u8 *buf; 519 u8 *buf;
520}; 520};
521 521
522struct ath6kl_htc_ops {
523 void* (*create)(struct ath6kl *ar);
524 int (*wait_target)(struct htc_target *target);
525 int (*start)(struct htc_target *target);
526 int (*conn_service)(struct htc_target *target,
527 struct htc_service_connect_req *req,
528 struct htc_service_connect_resp *resp);
529 int (*tx)(struct htc_target *target, struct htc_packet *packet);
530 void (*stop)(struct htc_target *target);
531 void (*cleanup)(struct htc_target *target);
532 void (*flush_txep)(struct htc_target *target,
533 enum htc_endpoint_id endpoint, u16 tag);
534 void (*flush_rx_buf)(struct htc_target *target);
535 void (*activity_changed)(struct htc_target *target,
536 enum htc_endpoint_id endpoint,
537 bool active);
538 int (*get_rxbuf_num)(struct htc_target *target,
539 enum htc_endpoint_id endpoint);
540 int (*add_rxbuf_multiple)(struct htc_target *target,
541 struct list_head *pktq);
542 int (*credit_setup)(struct htc_target *target,
543 struct ath6kl_htc_credit_info *cred_info);
544 int (*tx_complete)(struct ath6kl *ar, struct sk_buff *skb);
545 int (*rx_complete)(struct ath6kl *ar, struct sk_buff *skb, u8 pipe);
546};
547
522struct ath6kl_device; 548struct ath6kl_device;
523 549
524/* our HTC target state */ 550/* our HTC target state */
@@ -569,34 +595,9 @@ struct htc_target {
569 u32 ac_tx_count[WMM_NUM_AC]; 595 u32 ac_tx_count[WMM_NUM_AC];
570}; 596};
571 597
572void *ath6kl_htc_create(struct ath6kl *ar);
573void ath6kl_htc_set_credit_dist(struct htc_target *target,
574 struct ath6kl_htc_credit_info *cred_info,
575 u16 svc_pri_order[], int len);
576int ath6kl_htc_wait_target(struct htc_target *target);
577int ath6kl_htc_start(struct htc_target *target);
578int ath6kl_htc_conn_service(struct htc_target *target,
579 struct htc_service_connect_req *req,
580 struct htc_service_connect_resp *resp);
581int ath6kl_htc_tx(struct htc_target *target, struct htc_packet *packet);
582void ath6kl_htc_stop(struct htc_target *target);
583void ath6kl_htc_cleanup(struct htc_target *target);
584void ath6kl_htc_flush_txep(struct htc_target *target,
585 enum htc_endpoint_id endpoint, u16 tag);
586void ath6kl_htc_flush_rx_buf(struct htc_target *target);
587void ath6kl_htc_indicate_activity_change(struct htc_target *target,
588 enum htc_endpoint_id endpoint,
589 bool active);
590int ath6kl_htc_get_rxbuf_num(struct htc_target *target,
591 enum htc_endpoint_id endpoint);
592int ath6kl_htc_add_rxbuf_multiple(struct htc_target *target,
593 struct list_head *pktq);
594int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target, 598int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target,
595 u32 msg_look_ahead, int *n_pkts); 599 u32 msg_look_ahead, int *n_pkts);
596 600
597int ath6kl_credit_setup(struct htc_target *htc_target,
598 struct ath6kl_htc_credit_info *cred_info);
599
600static inline void set_htc_pkt_info(struct htc_packet *packet, void *context, 601static inline void set_htc_pkt_info(struct htc_packet *packet, void *context,
601 u8 *buf, unsigned int len, 602 u8 *buf, unsigned int len,
602 enum htc_endpoint_id eid, u16 tag) 603 enum htc_endpoint_id eid, u16 tag)
@@ -636,4 +637,6 @@ static inline int get_queue_depth(struct list_head *queue)
636 return depth; 637 return depth;
637} 638}
638 639
640void ath6kl_htc_mbox_attach(struct ath6kl *ar);
641
639#endif 642#endif
diff --git a/drivers/net/wireless/ath/ath6kl/htc.c b/drivers/net/wireless/ath/ath6kl/htc_mbox.c
index f282772d9121..065e61516d7a 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.c
+++ b/drivers/net/wireless/ath/ath6kl/htc_mbox.c
@@ -23,6 +23,14 @@
23 23
24#define CALC_TXRX_PADDED_LEN(dev, len) (__ALIGN_MASK((len), (dev)->block_mask)) 24#define CALC_TXRX_PADDED_LEN(dev, len) (__ALIGN_MASK((len), (dev)->block_mask))
25 25
26static void ath6kl_htc_mbox_cleanup(struct htc_target *target);
27static void ath6kl_htc_mbox_stop(struct htc_target *target);
28static int ath6kl_htc_mbox_add_rxbuf_multiple(struct htc_target *target,
29 struct list_head *pkt_queue);
30static void ath6kl_htc_set_credit_dist(struct htc_target *target,
31 struct ath6kl_htc_credit_info *cred_info,
32 u16 svc_pri_order[], int len);
33
26/* threshold to re-enable Tx bundling for an AC*/ 34/* threshold to re-enable Tx bundling for an AC*/
27#define TX_RESUME_BUNDLE_THRESHOLD 1500 35#define TX_RESUME_BUNDLE_THRESHOLD 1500
28 36
@@ -130,8 +138,8 @@ static void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_info,
130} 138}
131 139
132/* initialize and setup credit distribution */ 140/* initialize and setup credit distribution */
133int ath6kl_credit_setup(struct htc_target *htc_target, 141static int ath6kl_htc_mbox_credit_setup(struct htc_target *htc_target,
134 struct ath6kl_htc_credit_info *cred_info) 142 struct ath6kl_htc_credit_info *cred_info)
135{ 143{
136 u16 servicepriority[5]; 144 u16 servicepriority[5];
137 145
@@ -1065,7 +1073,7 @@ static int htc_setup_tx_complete(struct htc_target *target)
1065 return status; 1073 return status;
1066} 1074}
1067 1075
1068void ath6kl_htc_set_credit_dist(struct htc_target *target, 1076static void ath6kl_htc_set_credit_dist(struct htc_target *target,
1069 struct ath6kl_htc_credit_info *credit_info, 1077 struct ath6kl_htc_credit_info *credit_info,
1070 u16 srvc_pri_order[], int list_len) 1078 u16 srvc_pri_order[], int list_len)
1071{ 1079{
@@ -1093,7 +1101,8 @@ void ath6kl_htc_set_credit_dist(struct htc_target *target,
1093 } 1101 }
1094} 1102}
1095 1103
1096int ath6kl_htc_tx(struct htc_target *target, struct htc_packet *packet) 1104static int ath6kl_htc_mbox_tx(struct htc_target *target,
1105 struct htc_packet *packet)
1097{ 1106{
1098 struct htc_endpoint *endpoint; 1107 struct htc_endpoint *endpoint;
1099 struct list_head queue; 1108 struct list_head queue;
@@ -1121,7 +1130,7 @@ int ath6kl_htc_tx(struct htc_target *target, struct htc_packet *packet)
1121} 1130}
1122 1131
1123/* flush endpoint TX queue */ 1132/* flush endpoint TX queue */
1124void ath6kl_htc_flush_txep(struct htc_target *target, 1133static void ath6kl_htc_mbox_flush_txep(struct htc_target *target,
1125 enum htc_endpoint_id eid, u16 tag) 1134 enum htc_endpoint_id eid, u16 tag)
1126{ 1135{
1127 struct htc_packet *packet, *tmp_pkt; 1136 struct htc_packet *packet, *tmp_pkt;
@@ -1173,12 +1182,13 @@ static void ath6kl_htc_flush_txep_all(struct htc_target *target)
1173 if (endpoint->svc_id == 0) 1182 if (endpoint->svc_id == 0)
1174 /* not in use.. */ 1183 /* not in use.. */
1175 continue; 1184 continue;
1176 ath6kl_htc_flush_txep(target, i, HTC_TX_PACKET_TAG_ALL); 1185 ath6kl_htc_mbox_flush_txep(target, i, HTC_TX_PACKET_TAG_ALL);
1177 } 1186 }
1178} 1187}
1179 1188
1180void ath6kl_htc_indicate_activity_change(struct htc_target *target, 1189static void ath6kl_htc_mbox_activity_changed(struct htc_target *target,
1181 enum htc_endpoint_id eid, bool active) 1190 enum htc_endpoint_id eid,
1191 bool active)
1182{ 1192{
1183 struct htc_endpoint *endpoint = &target->endpoint[eid]; 1193 struct htc_endpoint *endpoint = &target->endpoint[eid];
1184 bool dist = false; 1194 bool dist = false;
@@ -1246,7 +1256,7 @@ static int htc_add_rxbuf(struct htc_target *target, struct htc_packet *packet)
1246 1256
1247 INIT_LIST_HEAD(&queue); 1257 INIT_LIST_HEAD(&queue);
1248 list_add_tail(&packet->list, &queue); 1258 list_add_tail(&packet->list, &queue);
1249 return ath6kl_htc_add_rxbuf_multiple(target, &queue); 1259 return ath6kl_htc_mbox_add_rxbuf_multiple(target, &queue);
1250} 1260}
1251 1261
1252static void htc_reclaim_rxbuf(struct htc_target *target, 1262static void htc_reclaim_rxbuf(struct htc_target *target,
@@ -2290,7 +2300,7 @@ fail_ctrl_rx:
2290 return NULL; 2300 return NULL;
2291} 2301}
2292 2302
2293int ath6kl_htc_add_rxbuf_multiple(struct htc_target *target, 2303static int ath6kl_htc_mbox_add_rxbuf_multiple(struct htc_target *target,
2294 struct list_head *pkt_queue) 2304 struct list_head *pkt_queue)
2295{ 2305{
2296 struct htc_endpoint *endpoint; 2306 struct htc_endpoint *endpoint;
@@ -2352,7 +2362,7 @@ int ath6kl_htc_add_rxbuf_multiple(struct htc_target *target,
2352 return status; 2362 return status;
2353} 2363}
2354 2364
2355void ath6kl_htc_flush_rx_buf(struct htc_target *target) 2365static void ath6kl_htc_mbox_flush_rx_buf(struct htc_target *target)
2356{ 2366{
2357 struct htc_endpoint *endpoint; 2367 struct htc_endpoint *endpoint;
2358 struct htc_packet *packet, *tmp_pkt; 2368 struct htc_packet *packet, *tmp_pkt;
@@ -2394,7 +2404,7 @@ void ath6kl_htc_flush_rx_buf(struct htc_target *target)
2394 } 2404 }
2395} 2405}
2396 2406
2397int ath6kl_htc_conn_service(struct htc_target *target, 2407static int ath6kl_htc_mbox_conn_service(struct htc_target *target,
2398 struct htc_service_connect_req *conn_req, 2408 struct htc_service_connect_req *conn_req,
2399 struct htc_service_connect_resp *conn_resp) 2409 struct htc_service_connect_resp *conn_resp)
2400{ 2410{
@@ -2566,7 +2576,7 @@ static void reset_ep_state(struct htc_target *target)
2566 INIT_LIST_HEAD(&target->cred_dist_list); 2576 INIT_LIST_HEAD(&target->cred_dist_list);
2567} 2577}
2568 2578
2569int ath6kl_htc_get_rxbuf_num(struct htc_target *target, 2579static int ath6kl_htc_mbox_get_rxbuf_num(struct htc_target *target,
2570 enum htc_endpoint_id endpoint) 2580 enum htc_endpoint_id endpoint)
2571{ 2581{
2572 int num; 2582 int num;
@@ -2626,7 +2636,7 @@ static void htc_setup_msg_bndl(struct htc_target *target)
2626 } 2636 }
2627} 2637}
2628 2638
2629int ath6kl_htc_wait_target(struct htc_target *target) 2639static int ath6kl_htc_mbox_wait_target(struct htc_target *target)
2630{ 2640{
2631 struct htc_packet *packet = NULL; 2641 struct htc_packet *packet = NULL;
2632 struct htc_ready_ext_msg *rdy_msg; 2642 struct htc_ready_ext_msg *rdy_msg;
@@ -2695,12 +2705,12 @@ int ath6kl_htc_wait_target(struct htc_target *target)
2695 connect.svc_id = HTC_CTRL_RSVD_SVC; 2705 connect.svc_id = HTC_CTRL_RSVD_SVC;
2696 2706
2697 /* connect fake service */ 2707 /* connect fake service */
2698 status = ath6kl_htc_conn_service((void *)target, &connect, &resp); 2708 status = ath6kl_htc_mbox_conn_service((void *)target, &connect, &resp);
2699 2709
2700 if (status) 2710 if (status)
2701 /* 2711 /*
2702 * FIXME: this call doesn't make sense, the caller should 2712 * FIXME: this call doesn't make sense, the caller should
2703 * call ath6kl_htc_cleanup() when it wants remove htc 2713 * call ath6kl_htc_mbox_cleanup() when it wants remove htc
2704 */ 2714 */
2705 ath6kl_hif_cleanup_scatter(target->dev->ar); 2715 ath6kl_hif_cleanup_scatter(target->dev->ar);
2706 2716
@@ -2717,7 +2727,7 @@ fail_wait_target:
2717 * Start HTC, enable interrupts and let the target know 2727 * Start HTC, enable interrupts and let the target know
2718 * host has finished setup. 2728 * host has finished setup.
2719 */ 2729 */
2720int ath6kl_htc_start(struct htc_target *target) 2730static int ath6kl_htc_mbox_start(struct htc_target *target)
2721{ 2731{
2722 struct htc_packet *packet; 2732 struct htc_packet *packet;
2723 int status; 2733 int status;
@@ -2754,7 +2764,7 @@ int ath6kl_htc_start(struct htc_target *target)
2754 status = ath6kl_hif_unmask_intrs(target->dev); 2764 status = ath6kl_hif_unmask_intrs(target->dev);
2755 2765
2756 if (status) 2766 if (status)
2757 ath6kl_htc_stop(target); 2767 ath6kl_htc_mbox_stop(target);
2758 2768
2759 return status; 2769 return status;
2760} 2770}
@@ -2798,7 +2808,7 @@ static int ath6kl_htc_reset(struct htc_target *target)
2798} 2808}
2799 2809
2800/* htc_stop: stop interrupt reception, and flush all queued buffers */ 2810/* htc_stop: stop interrupt reception, and flush all queued buffers */
2801void ath6kl_htc_stop(struct htc_target *target) 2811static void ath6kl_htc_mbox_stop(struct htc_target *target)
2802{ 2812{
2803 spin_lock_bh(&target->htc_lock); 2813 spin_lock_bh(&target->htc_lock);
2804 target->htc_flags |= HTC_OP_STATE_STOPPING; 2814 target->htc_flags |= HTC_OP_STATE_STOPPING;
@@ -2813,12 +2823,12 @@ void ath6kl_htc_stop(struct htc_target *target)
2813 2823
2814 ath6kl_htc_flush_txep_all(target); 2824 ath6kl_htc_flush_txep_all(target);
2815 2825
2816 ath6kl_htc_flush_rx_buf(target); 2826 ath6kl_htc_mbox_flush_rx_buf(target);
2817 2827
2818 ath6kl_htc_reset(target); 2828 ath6kl_htc_reset(target);
2819} 2829}
2820 2830
2821void *ath6kl_htc_create(struct ath6kl *ar) 2831static void *ath6kl_htc_mbox_create(struct ath6kl *ar)
2822{ 2832{
2823 struct htc_target *target = NULL; 2833 struct htc_target *target = NULL;
2824 int status = 0; 2834 int status = 0;
@@ -2859,13 +2869,13 @@ void *ath6kl_htc_create(struct ath6kl *ar)
2859 return target; 2869 return target;
2860 2870
2861err_htc_cleanup: 2871err_htc_cleanup:
2862 ath6kl_htc_cleanup(target); 2872 ath6kl_htc_mbox_cleanup(target);
2863 2873
2864 return NULL; 2874 return NULL;
2865} 2875}
2866 2876
2867/* cleanup the HTC instance */ 2877/* cleanup the HTC instance */
2868void ath6kl_htc_cleanup(struct htc_target *target) 2878static void ath6kl_htc_mbox_cleanup(struct htc_target *target)
2869{ 2879{
2870 struct htc_packet *packet, *tmp_packet; 2880 struct htc_packet *packet, *tmp_packet;
2871 2881
@@ -2890,3 +2900,24 @@ void ath6kl_htc_cleanup(struct htc_target *target)
2890 kfree(target->dev); 2900 kfree(target->dev);
2891 kfree(target); 2901 kfree(target);
2892} 2902}
2903
2904static const struct ath6kl_htc_ops ath6kl_htc_mbox_ops = {
2905 .create = ath6kl_htc_mbox_create,
2906 .wait_target = ath6kl_htc_mbox_wait_target,
2907 .start = ath6kl_htc_mbox_start,
2908 .conn_service = ath6kl_htc_mbox_conn_service,
2909 .tx = ath6kl_htc_mbox_tx,
2910 .stop = ath6kl_htc_mbox_stop,
2911 .cleanup = ath6kl_htc_mbox_cleanup,
2912 .flush_txep = ath6kl_htc_mbox_flush_txep,
2913 .flush_rx_buf = ath6kl_htc_mbox_flush_rx_buf,
2914 .activity_changed = ath6kl_htc_mbox_activity_changed,
2915 .get_rxbuf_num = ath6kl_htc_mbox_get_rxbuf_num,
2916 .add_rxbuf_multiple = ath6kl_htc_mbox_add_rxbuf_multiple,
2917 .credit_setup = ath6kl_htc_mbox_credit_setup,
2918};
2919
2920void ath6kl_htc_mbox_attach(struct ath6kl *ar)
2921{
2922 ar->htc_ops = &ath6kl_htc_mbox_ops;
2923}
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index d33691e8f128..092e4cddfed3 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -27,6 +27,7 @@
27#include "target.h" 27#include "target.h"
28#include "debug.h" 28#include "debug.h"
29#include "hif-ops.h" 29#include "hif-ops.h"
30#include "htc-ops.h"
30 31
31static const struct ath6kl_hw hw_list[] = { 32static const struct ath6kl_hw hw_list[] = {
32 { 33 {
@@ -1510,7 +1511,7 @@ int ath6kl_init_hw_start(struct ath6kl *ar)
1510 } 1511 }
1511 1512
1512 /* setup credit distribution */ 1513 /* setup credit distribution */
1513 ath6kl_credit_setup(ar->htc_target, &ar->credit_state_info); 1514 ath6kl_htc_credit_setup(ar->htc_target, &ar->credit_state_info);
1514 1515
1515 /* start HTC */ 1516 /* start HTC */
1516 ret = ath6kl_htc_start(ar->htc_target); 1517 ret = ath6kl_htc_start(ar->htc_target);
diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
index 53528648b425..44ea7a742101 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -1362,7 +1362,7 @@ static int ath6kl_sdio_probe(struct sdio_func *func,
1362 goto err_core_alloc; 1362 goto err_core_alloc;
1363 } 1363 }
1364 1364
1365 ret = ath6kl_core_init(ar); 1365 ret = ath6kl_core_init(ar, ATH6KL_HTC_TYPE_MBOX);
1366 if (ret) { 1366 if (ret) {
1367 ath6kl_err("Failed to init ath6kl core\n"); 1367 ath6kl_err("Failed to init ath6kl core\n");
1368 goto err_core_alloc; 1368 goto err_core_alloc;
diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c
index 5559c9b281b6..fdcc6ee5fe32 100644
--- a/drivers/net/wireless/ath/ath6kl/txrx.c
+++ b/drivers/net/wireless/ath/ath6kl/txrx.c
@@ -17,6 +17,7 @@
17 17
18#include "core.h" 18#include "core.h"
19#include "debug.h" 19#include "debug.h"
20#include "htc-ops.h"
20 21
21/* 22/*
22 * tid - tid_mux0..tid_mux3 23 * tid - tid_mux0..tid_mux3
@@ -572,7 +573,7 @@ void ath6kl_indicate_tx_activity(void *devt, u8 traffic_class, bool active)
572 573
573notify_htc: 574notify_htc:
574 /* notify HTC, this may cause credit distribution changes */ 575 /* notify HTC, this may cause credit distribution changes */
575 ath6kl_htc_indicate_activity_change(ar->htc_target, eid, active); 576 ath6kl_htc_activity_changed(ar->htc_target, eid, active);
576} 577}
577 578
578enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target, 579enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target,
diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c
index 325b1224c2b1..991fbc5ca1f8 100644
--- a/drivers/net/wireless/ath/ath6kl/usb.c
+++ b/drivers/net/wireless/ath/ath6kl/usb.c
@@ -368,7 +368,7 @@ static int ath6kl_usb_probe(struct usb_interface *interface,
368 368
369 ar_usb->ar = ar; 369 ar_usb->ar = ar;
370 370
371 ret = ath6kl_core_init(ar); 371 ret = ath6kl_core_init(ar, ATH6KL_HTC_TYPE_MBOX);
372 if (ret) { 372 if (ret) {
373 ath6kl_err("Failed to init ath6kl core: %d\n", ret); 373 ath6kl_err("Failed to init ath6kl core: %d\n", ret);
374 goto err_core_free; 374 goto err_core_free;