1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
3 * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
11 struct ath11k_hif_ops {
12 u32 (*read32)(struct ath11k_base *sc, u32 address);
13 void (*write32)(struct ath11k_base *sc, u32 address, u32 data);
14 void (*irq_enable)(struct ath11k_base *sc);
15 void (*irq_disable)(struct ath11k_base *sc);
16 int (*start)(struct ath11k_base *sc);
17 void (*stop)(struct ath11k_base *sc);
18 int (*power_up)(struct ath11k_base *sc);
19 void (*power_down)(struct ath11k_base *sc);
20 int (*suspend)(struct ath11k_base *ab);
21 int (*resume)(struct ath11k_base *ab);
22 int (*map_service_to_pipe)(struct ath11k_base *sc, u16 service_id,
23 u8 *ul_pipe, u8 *dl_pipe);
24 int (*get_user_msi_vector)(struct ath11k_base *ab, char *user_name,
25 int *num_vectors, u32 *user_base_data,
27 void (*get_msi_address)(struct ath11k_base *ab, u32 *msi_addr_lo,
29 void (*ce_irq_enable)(struct ath11k_base *ab);
30 void (*ce_irq_disable)(struct ath11k_base *ab);
31 void (*get_ce_msi_idx)(struct ath11k_base *ab, u32 ce_id, u32 *msi_idx);
34 static inline void ath11k_hif_ce_irq_enable(struct ath11k_base *ab)
36 if (ab->hif.ops->ce_irq_enable)
37 ab->hif.ops->ce_irq_enable(ab);
40 static inline void ath11k_hif_ce_irq_disable(struct ath11k_base *ab)
42 if (ab->hif.ops->ce_irq_disable)
43 ab->hif.ops->ce_irq_disable(ab);
46 static inline int ath11k_hif_start(struct ath11k_base *sc)
48 return sc->hif.ops->start(sc);
51 static inline void ath11k_hif_stop(struct ath11k_base *sc)
53 sc->hif.ops->stop(sc);
56 static inline void ath11k_hif_irq_enable(struct ath11k_base *sc)
58 sc->hif.ops->irq_enable(sc);
61 static inline void ath11k_hif_irq_disable(struct ath11k_base *sc)
63 sc->hif.ops->irq_disable(sc);
66 static inline int ath11k_hif_power_up(struct ath11k_base *sc)
68 return sc->hif.ops->power_up(sc);
71 static inline void ath11k_hif_power_down(struct ath11k_base *sc)
73 sc->hif.ops->power_down(sc);
76 static inline int ath11k_hif_suspend(struct ath11k_base *ab)
78 if (ab->hif.ops->suspend)
79 return ab->hif.ops->suspend(ab);
84 static inline int ath11k_hif_resume(struct ath11k_base *ab)
86 if (ab->hif.ops->resume)
87 return ab->hif.ops->resume(ab);
92 static inline u32 ath11k_hif_read32(struct ath11k_base *sc, u32 address)
94 return sc->hif.ops->read32(sc, address);
97 static inline void ath11k_hif_write32(struct ath11k_base *sc, u32 address, u32 data)
99 sc->hif.ops->write32(sc, address, data);
102 static inline int ath11k_hif_map_service_to_pipe(struct ath11k_base *sc, u16 service_id,
103 u8 *ul_pipe, u8 *dl_pipe)
105 return sc->hif.ops->map_service_to_pipe(sc, service_id, ul_pipe, dl_pipe);
108 static inline int ath11k_get_user_msi_vector(struct ath11k_base *ab, char *user_name,
109 int *num_vectors, u32 *user_base_data,
112 if (!ab->hif.ops->get_user_msi_vector)
115 return ab->hif.ops->get_user_msi_vector(ab, user_name, num_vectors,
120 static inline void ath11k_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo,
123 if (!ab->hif.ops->get_msi_address)
126 ab->hif.ops->get_msi_address(ab, msi_addr_lo, msi_addr_hi);
129 static inline void ath11k_get_ce_msi_idx(struct ath11k_base *ab, u32 ce_id,
132 if (ab->hif.ops->get_ce_msi_idx)
133 ab->hif.ops->get_ce_msi_idx(ab, ce_id, msi_data_idx);
135 *msi_data_idx = ce_id;