1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * This file is part of wlcore
5 * Copyright (C) 2011 Texas Instruments Inc.
8 #ifndef __WLCORE_HW_OPS_H__
9 #define __WLCORE_HW_OPS_H__
15 wlcore_hw_calc_tx_blocks(struct wl1271
*wl
, u32 len
, u32 spare_blks
)
17 if (!wl
->ops
->calc_tx_blocks
)
20 return wl
->ops
->calc_tx_blocks(wl
, len
, spare_blks
);
24 wlcore_hw_set_tx_desc_blocks(struct wl1271
*wl
, struct wl1271_tx_hw_descr
*desc
,
25 u32 blks
, u32 spare_blks
)
27 if (!wl
->ops
->set_tx_desc_blocks
)
30 return wl
->ops
->set_tx_desc_blocks(wl
, desc
, blks
, spare_blks
);
34 wlcore_hw_set_tx_desc_data_len(struct wl1271
*wl
,
35 struct wl1271_tx_hw_descr
*desc
,
38 if (!wl
->ops
->set_tx_desc_data_len
)
41 wl
->ops
->set_tx_desc_data_len(wl
, desc
, skb
);
44 static inline enum wl_rx_buf_align
45 wlcore_hw_get_rx_buf_align(struct wl1271
*wl
, u32 rx_desc
)
48 if (!wl
->ops
->get_rx_buf_align
)
51 return wl
->ops
->get_rx_buf_align(wl
, rx_desc
);
55 wlcore_hw_prepare_read(struct wl1271
*wl
, u32 rx_desc
, u32 len
)
57 if (wl
->ops
->prepare_read
)
58 return wl
->ops
->prepare_read(wl
, rx_desc
, len
);
64 wlcore_hw_get_rx_packet_len(struct wl1271
*wl
, void *rx_data
, u32 data_len
)
66 if (!wl
->ops
->get_rx_packet_len
)
69 return wl
->ops
->get_rx_packet_len(wl
, rx_data
, data_len
);
72 static inline int wlcore_hw_tx_delayed_compl(struct wl1271
*wl
)
74 if (wl
->ops
->tx_delayed_compl
)
75 return wl
->ops
->tx_delayed_compl(wl
);
80 static inline void wlcore_hw_tx_immediate_compl(struct wl1271
*wl
)
82 if (wl
->ops
->tx_immediate_compl
)
83 wl
->ops
->tx_immediate_compl(wl
);
87 wlcore_hw_init_vif(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
)
89 if (wl
->ops
->init_vif
)
90 return wl
->ops
->init_vif(wl
, wlvif
);
96 wlcore_hw_convert_fw_status(struct wl1271
*wl
, void *raw_fw_status
,
97 struct wl_fw_status
*fw_status
)
99 BUG_ON(!wl
->ops
->convert_fw_status
);
101 wl
->ops
->convert_fw_status(wl
, raw_fw_status
, fw_status
);
105 wlcore_hw_sta_get_ap_rate_mask(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
)
107 if (!wl
->ops
->sta_get_ap_rate_mask
)
110 return wl
->ops
->sta_get_ap_rate_mask(wl
, wlvif
);
113 static inline int wlcore_identify_fw(struct wl1271
*wl
)
115 if (wl
->ops
->identify_fw
)
116 return wl
->ops
->identify_fw(wl
);
122 wlcore_hw_set_tx_desc_csum(struct wl1271
*wl
,
123 struct wl1271_tx_hw_descr
*desc
,
126 if (!wl
->ops
->set_tx_desc_csum
)
129 wl
->ops
->set_tx_desc_csum(wl
, desc
, skb
);
133 wlcore_hw_set_rx_csum(struct wl1271
*wl
,
134 struct wl1271_rx_descriptor
*desc
,
137 if (wl
->ops
->set_rx_csum
)
138 wl
->ops
->set_rx_csum(wl
, desc
, skb
);
142 wlcore_hw_ap_get_mimo_wide_rate_mask(struct wl1271
*wl
,
143 struct wl12xx_vif
*wlvif
)
145 if (wl
->ops
->ap_get_mimo_wide_rate_mask
)
146 return wl
->ops
->ap_get_mimo_wide_rate_mask(wl
, wlvif
);
152 wlcore_debugfs_init(struct wl1271
*wl
, struct dentry
*rootdir
)
154 if (wl
->ops
->debugfs_init
)
155 return wl
->ops
->debugfs_init(wl
, rootdir
);
161 wlcore_handle_static_data(struct wl1271
*wl
, void *static_data
)
163 if (wl
->ops
->handle_static_data
)
164 return wl
->ops
->handle_static_data(wl
, static_data
);
170 wlcore_hw_get_spare_blocks(struct wl1271
*wl
, bool is_gem
)
172 if (!wl
->ops
->get_spare_blocks
)
175 return wl
->ops
->get_spare_blocks(wl
, is_gem
);
179 wlcore_hw_set_key(struct wl1271
*wl
, enum set_key_cmd cmd
,
180 struct ieee80211_vif
*vif
,
181 struct ieee80211_sta
*sta
,
182 struct ieee80211_key_conf
*key_conf
)
184 if (!wl
->ops
->set_key
)
187 return wl
->ops
->set_key(wl
, cmd
, vif
, sta
, key_conf
);
191 wlcore_hw_pre_pkt_send(struct wl1271
*wl
, u32 buf_offset
, u32 last_len
)
193 if (wl
->ops
->pre_pkt_send
)
194 return wl
->ops
->pre_pkt_send(wl
, buf_offset
, last_len
);
200 wlcore_hw_sta_rc_update(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
)
202 if (wl
->ops
->sta_rc_update
)
203 wl
->ops
->sta_rc_update(wl
, wlvif
);
207 wlcore_hw_interrupt_notify(struct wl1271
*wl
, bool action
)
209 if (wl
->ops
->interrupt_notify
)
210 return wl
->ops
->interrupt_notify(wl
, action
);
215 wlcore_hw_rx_ba_filter(struct wl1271
*wl
, bool action
)
217 if (wl
->ops
->rx_ba_filter
)
218 return wl
->ops
->rx_ba_filter(wl
, action
);
223 wlcore_hw_ap_sleep(struct wl1271
*wl
)
225 if (wl
->ops
->ap_sleep
)
226 return wl
->ops
->ap_sleep(wl
);
232 wlcore_hw_set_peer_cap(struct wl1271
*wl
,
233 struct ieee80211_sta_ht_cap
*ht_cap
,
234 bool allow_ht_operation
,
235 u32 rate_set
, u8 hlid
)
237 if (wl
->ops
->set_peer_cap
)
238 return wl
->ops
->set_peer_cap(wl
, ht_cap
, allow_ht_operation
,
245 wlcore_hw_convert_hwaddr(struct wl1271
*wl
, u32 hwaddr
)
247 if (!wl
->ops
->convert_hwaddr
)
250 return wl
->ops
->convert_hwaddr(wl
, hwaddr
);
254 wlcore_hw_lnk_high_prio(struct wl1271
*wl
, u8 hlid
,
255 struct wl1271_link
*lnk
)
257 if (!wl
->ops
->lnk_high_prio
)
260 return wl
->ops
->lnk_high_prio(wl
, hlid
, lnk
);
264 wlcore_hw_lnk_low_prio(struct wl1271
*wl
, u8 hlid
,
265 struct wl1271_link
*lnk
)
267 if (!wl
->ops
->lnk_low_prio
)
270 return wl
->ops
->lnk_low_prio(wl
, hlid
, lnk
);
274 wlcore_smart_config_start(struct wl1271
*wl
, u32 group_bitmap
)
276 if (!wl
->ops
->smart_config_start
)
279 return wl
->ops
->smart_config_start(wl
, group_bitmap
);
283 wlcore_smart_config_stop(struct wl1271
*wl
)
285 if (!wl
->ops
->smart_config_stop
)
288 return wl
->ops
->smart_config_stop(wl
);
292 wlcore_smart_config_set_group_key(struct wl1271
*wl
, u16 group_id
,
295 if (!wl
->ops
->smart_config_set_group_key
)
298 return wl
->ops
->smart_config_set_group_key(wl
, group_id
, key_len
, key
);
302 wlcore_hw_set_cac(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
, bool start
)
304 if (!wl
->ops
->set_cac
)
307 return wl
->ops
->set_cac(wl
, wlvif
, start
);
311 wlcore_hw_dfs_master_restart(struct wl1271
*wl
, struct wl12xx_vif
*wlvif
)
313 if (!wl
->ops
->dfs_master_restart
)
316 return wl
->ops
->dfs_master_restart(wl
, wlvif
);