1bdcd8170SKalle Valo /*
2bdcd8170SKalle Valo  * Copyright (c) 2004-2011 Atheros Communications Inc.
3bdcd8170SKalle Valo  *
4bdcd8170SKalle Valo  * Permission to use, copy, modify, and/or distribute this software for any
5bdcd8170SKalle Valo  * purpose with or without fee is hereby granted, provided that the above
6bdcd8170SKalle Valo  * copyright notice and this permission notice appear in all copies.
7bdcd8170SKalle Valo  *
8bdcd8170SKalle Valo  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9bdcd8170SKalle Valo  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10bdcd8170SKalle Valo  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11bdcd8170SKalle Valo  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12bdcd8170SKalle Valo  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13bdcd8170SKalle Valo  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14bdcd8170SKalle Valo  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15bdcd8170SKalle Valo  */
16bdcd8170SKalle Valo 
17bdcd8170SKalle Valo #ifndef HIF_OPS_H
18bdcd8170SKalle Valo #define HIF_OPS_H
19bdcd8170SKalle Valo 
20bdcd8170SKalle Valo #include "hif.h"
2183973e03SKalle Valo #include "debug.h"
22bdcd8170SKalle Valo 
23bdcd8170SKalle Valo static inline int hif_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf,
24bdcd8170SKalle Valo 				      u32 len, u32 request)
25bdcd8170SKalle Valo {
2683973e03SKalle Valo 	ath6kl_dbg(ATH6KL_DBG_HIF,
2783973e03SKalle Valo 		   "hif %s sync addr 0x%x buf 0x%p len %d request 0x%x\n",
2883973e03SKalle Valo 		   (request & HIF_WRITE) ? "write" : "read",
2983973e03SKalle Valo 		   addr, buf, len, request);
3083973e03SKalle Valo 
31bdcd8170SKalle Valo 	return ar->hif_ops->read_write_sync(ar, addr, buf, len, request);
32bdcd8170SKalle Valo }
33bdcd8170SKalle Valo 
34bdcd8170SKalle Valo static inline int hif_write_async(struct ath6kl *ar, u32 address, u8 *buffer,
35bdcd8170SKalle Valo 				  u32 length, u32 request,
36bdcd8170SKalle Valo 				  struct htc_packet *packet)
37bdcd8170SKalle Valo {
3883973e03SKalle Valo 	ath6kl_dbg(ATH6KL_DBG_HIF,
3983973e03SKalle Valo 		   "hif write async addr 0x%x buf 0x%p len %d request 0x%x\n",
4083973e03SKalle Valo 		   address, buffer, length, request);
4183973e03SKalle Valo 
42bdcd8170SKalle Valo 	return ar->hif_ops->write_async(ar, address, buffer, length,
43bdcd8170SKalle Valo 					request, packet);
44bdcd8170SKalle Valo }
45bdcd8170SKalle Valo static inline void ath6kl_hif_irq_enable(struct ath6kl *ar)
46bdcd8170SKalle Valo {
4783973e03SKalle Valo 	ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq enable\n");
4883973e03SKalle Valo 
49bdcd8170SKalle Valo 	return ar->hif_ops->irq_enable(ar);
50bdcd8170SKalle Valo }
51bdcd8170SKalle Valo 
52bdcd8170SKalle Valo static inline void ath6kl_hif_irq_disable(struct ath6kl *ar)
53bdcd8170SKalle Valo {
5483973e03SKalle Valo 	ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq disable\n");
5583973e03SKalle Valo 
56bdcd8170SKalle Valo 	return ar->hif_ops->irq_disable(ar);
57bdcd8170SKalle Valo }
58bdcd8170SKalle Valo 
59bdcd8170SKalle Valo static inline struct hif_scatter_req *hif_scatter_req_get(struct ath6kl *ar)
60bdcd8170SKalle Valo {
61bdcd8170SKalle Valo 	return ar->hif_ops->scatter_req_get(ar);
62bdcd8170SKalle Valo }
63bdcd8170SKalle Valo 
64bdcd8170SKalle Valo static inline void hif_scatter_req_add(struct ath6kl *ar,
65bdcd8170SKalle Valo 				       struct hif_scatter_req *s_req)
66bdcd8170SKalle Valo {
67bdcd8170SKalle Valo 	return ar->hif_ops->scatter_req_add(ar, s_req);
68bdcd8170SKalle Valo }
69bdcd8170SKalle Valo 
7050745af7SVasanthakumar Thiagarajan static inline int ath6kl_hif_enable_scatter(struct ath6kl *ar)
71bdcd8170SKalle Valo {
7250745af7SVasanthakumar Thiagarajan 	return ar->hif_ops->enable_scatter(ar);
73bdcd8170SKalle Valo }
74bdcd8170SKalle Valo 
75f74a7361SVasanthakumar Thiagarajan static inline int ath6kl_hif_scat_req_rw(struct ath6kl *ar,
76f74a7361SVasanthakumar Thiagarajan 					 struct hif_scatter_req *scat_req)
77f74a7361SVasanthakumar Thiagarajan {
78f74a7361SVasanthakumar Thiagarajan 	return ar->hif_ops->scat_req_rw(ar, scat_req);
79f74a7361SVasanthakumar Thiagarajan }
80f74a7361SVasanthakumar Thiagarajan 
81bdcd8170SKalle Valo static inline void ath6kl_hif_cleanup_scatter(struct ath6kl *ar)
82bdcd8170SKalle Valo {
83bdcd8170SKalle Valo 	return ar->hif_ops->cleanup_scatter(ar);
84bdcd8170SKalle Valo }
85bdcd8170SKalle Valo 
860f60e9f4SRaja Mani static inline int ath6kl_hif_suspend(struct ath6kl *ar,
870f60e9f4SRaja Mani 				     struct cfg80211_wowlan *wow)
88abcb344bSKalle Valo {
8983973e03SKalle Valo 	ath6kl_dbg(ATH6KL_DBG_HIF, "hif suspend\n");
9083973e03SKalle Valo 
910f60e9f4SRaja Mani 	return ar->hif_ops->suspend(ar, wow);
92abcb344bSKalle Valo }
93abcb344bSKalle Valo 
94aa6cffc1SChilam Ng static inline int ath6kl_hif_resume(struct ath6kl *ar)
95aa6cffc1SChilam Ng {
9683973e03SKalle Valo 	ath6kl_dbg(ATH6KL_DBG_HIF, "hif resume\n");
9783973e03SKalle Valo 
98aa6cffc1SChilam Ng 	return ar->hif_ops->resume(ar);
99aa6cffc1SChilam Ng }
100b2e75698SKalle Valo 
101b2e75698SKalle Valo static inline int ath6kl_hif_power_on(struct ath6kl *ar)
102b2e75698SKalle Valo {
103b2e75698SKalle Valo 	ath6kl_dbg(ATH6KL_DBG_HIF, "hif power on\n");
104b2e75698SKalle Valo 
105b2e75698SKalle Valo 	return ar->hif_ops->power_on(ar);
106b2e75698SKalle Valo }
107b2e75698SKalle Valo 
108b2e75698SKalle Valo static inline int ath6kl_hif_power_off(struct ath6kl *ar)
109b2e75698SKalle Valo {
110b2e75698SKalle Valo 	ath6kl_dbg(ATH6KL_DBG_HIF, "hif power off\n");
111b2e75698SKalle Valo 
112b2e75698SKalle Valo 	return ar->hif_ops->power_off(ar);
113b2e75698SKalle Valo }
114b2e75698SKalle Valo 
11532a07e44SKalle Valo static inline void ath6kl_hif_stop(struct ath6kl *ar)
11632a07e44SKalle Valo {
11732a07e44SKalle Valo 	ath6kl_dbg(ATH6KL_DBG_HIF, "hif stop\n");
11832a07e44SKalle Valo 
11932a07e44SKalle Valo 	ar->hif_ops->stop(ar);
12032a07e44SKalle Valo }
12132a07e44SKalle Valo 
122bdcd8170SKalle Valo #endif
123