xref: /openbmc/linux/drivers/net/wireless/ath/ath11k/hif.h (revision 15324652)
1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3  * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
4  */
5 
6 #include "core.h"
7 
8 struct ath11k_hif_ops {
9 	u32 (*read32)(struct ath11k_base *sc, u32 address);
10 	void (*write32)(struct ath11k_base *sc, u32 address, u32 data);
11 	void (*irq_enable)(struct ath11k_base *sc);
12 	void (*irq_disable)(struct ath11k_base *sc);
13 	int (*start)(struct ath11k_base *sc);
14 	void (*stop)(struct ath11k_base *sc);
15 	int (*power_up)(struct ath11k_base *sc);
16 	void (*power_down)(struct ath11k_base *sc);
17 	int (*map_service_to_pipe)(struct ath11k_base *sc, u16 service_id,
18 				   u8 *ul_pipe, u8 *dl_pipe);
19 };
20 
21 static inline int ath11k_hif_start(struct ath11k_base *sc)
22 {
23 	return sc->hif.ops->start(sc);
24 }
25 
26 static inline void ath11k_hif_stop(struct ath11k_base *sc)
27 {
28 	sc->hif.ops->stop(sc);
29 }
30 
31 static inline void ath11k_hif_irq_enable(struct ath11k_base *sc)
32 {
33 	sc->hif.ops->irq_enable(sc);
34 }
35 
36 static inline void ath11k_hif_irq_disable(struct ath11k_base *sc)
37 {
38 	sc->hif.ops->irq_disable(sc);
39 }
40 
41 static inline int ath11k_hif_power_up(struct ath11k_base *sc)
42 {
43 	return sc->hif.ops->power_up(sc);
44 }
45 
46 static inline void ath11k_hif_power_down(struct ath11k_base *sc)
47 {
48 	sc->hif.ops->power_down(sc);
49 }
50 
51 static inline u32 ath11k_hif_read32(struct ath11k_base *sc, u32 address)
52 {
53 	return sc->hif.ops->read32(sc, address);
54 }
55 
56 static inline void ath11k_hif_write32(struct ath11k_base *sc, u32 address, u32 data)
57 {
58 	sc->hif.ops->write32(sc, address, data);
59 }
60 
61 static inline int ath11k_hif_map_service_to_pipe(struct ath11k_base *sc, u16 service_id,
62 						 u8 *ul_pipe, u8 *dl_pipe)
63 {
64 	return sc->hif.ops->map_service_to_pipe(sc, service_id, ul_pipe, dl_pipe);
65 }
66