2009-11-04 17:35:32 +00:00
|
|
|
/*
|
2010-08-06 18:47:57 +00:00
|
|
|
Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
|
|
|
|
Copyright (C) 2010 Ivo van Doorn <IvDoorn@gmail.com>
|
2009-11-04 17:35:32 +00:00
|
|
|
Copyright (C) 2009 Bartlomiej Zolnierkiewicz
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the
|
|
|
|
Free Software Foundation, Inc.,
|
|
|
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RT2800LIB_H
|
|
|
|
#define RT2800LIB_H
|
|
|
|
|
|
|
|
struct rt2800_ops {
|
|
|
|
void (*register_read)(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset, u32 *value);
|
2009-11-14 19:20:36 +00:00
|
|
|
void (*register_read_lock)(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset, u32 *value);
|
2009-11-04 17:35:32 +00:00
|
|
|
void (*register_write)(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset, u32 value);
|
|
|
|
void (*register_write_lock)(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset, u32 value);
|
|
|
|
|
|
|
|
void (*register_multiread)(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset,
|
|
|
|
void *value, const u32 length);
|
|
|
|
void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset,
|
|
|
|
const void *value, const u32 length);
|
|
|
|
|
|
|
|
int (*regbusy_read)(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset,
|
|
|
|
const struct rt2x00_field32 field, u32 *reg);
|
2010-06-03 08:52:04 +00:00
|
|
|
|
2010-07-11 10:30:37 +00:00
|
|
|
int (*drv_write_firmware)(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const u8 *data, const size_t len);
|
2010-06-03 08:52:04 +00:00
|
|
|
int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
|
2010-08-06 18:47:20 +00:00
|
|
|
__le32 *(*drv_get_txwi)(struct queue_entry *entry);
|
2009-11-04 17:35:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset,
|
|
|
|
u32 *value)
|
|
|
|
{
|
2010-07-11 10:31:23 +00:00
|
|
|
const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
|
2009-11-04 17:35:32 +00:00
|
|
|
|
|
|
|
rt2800ops->register_read(rt2x00dev, offset, value);
|
|
|
|
}
|
|
|
|
|
2009-11-14 19:20:36 +00:00
|
|
|
static inline void rt2800_register_read_lock(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset,
|
|
|
|
u32 *value)
|
|
|
|
{
|
2010-07-11 10:31:23 +00:00
|
|
|
const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
|
2009-11-14 19:20:36 +00:00
|
|
|
|
|
|
|
rt2800ops->register_read_lock(rt2x00dev, offset, value);
|
|
|
|
}
|
|
|
|
|
2009-11-04 17:35:32 +00:00
|
|
|
static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset,
|
|
|
|
u32 value)
|
|
|
|
{
|
2010-07-11 10:31:23 +00:00
|
|
|
const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
|
2009-11-04 17:35:32 +00:00
|
|
|
|
|
|
|
rt2800ops->register_write(rt2x00dev, offset, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset,
|
|
|
|
u32 value)
|
|
|
|
{
|
2010-07-11 10:31:23 +00:00
|
|
|
const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
|
2009-11-04 17:35:32 +00:00
|
|
|
|
|
|
|
rt2800ops->register_write_lock(rt2x00dev, offset, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset,
|
|
|
|
void *value, const u32 length)
|
|
|
|
{
|
2010-07-11 10:31:23 +00:00
|
|
|
const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
|
2009-11-04 17:35:32 +00:00
|
|
|
|
|
|
|
rt2800ops->register_multiread(rt2x00dev, offset, value, length);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset,
|
|
|
|
const void *value,
|
|
|
|
const u32 length)
|
|
|
|
{
|
2010-07-11 10:31:23 +00:00
|
|
|
const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
|
2009-11-04 17:35:32 +00:00
|
|
|
|
|
|
|
rt2800ops->register_multiwrite(rt2x00dev, offset, value, length);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int offset,
|
|
|
|
const struct rt2x00_field32 field,
|
|
|
|
u32 *reg)
|
|
|
|
{
|
2010-07-11 10:31:23 +00:00
|
|
|
const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
|
2009-11-04 17:35:32 +00:00
|
|
|
|
|
|
|
return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg);
|
|
|
|
}
|
|
|
|
|
2010-07-11 10:30:37 +00:00
|
|
|
static inline int rt2800_drv_write_firmware(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const u8 *data, const size_t len)
|
|
|
|
{
|
2010-07-11 10:31:23 +00:00
|
|
|
const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
|
2010-07-11 10:30:37 +00:00
|
|
|
|
|
|
|
return rt2800ops->drv_write_firmware(rt2x00dev, data, len);
|
|
|
|
}
|
|
|
|
|
2010-06-03 08:52:04 +00:00
|
|
|
static inline int rt2800_drv_init_registers(struct rt2x00_dev *rt2x00dev)
|
|
|
|
{
|
2010-07-11 10:31:23 +00:00
|
|
|
const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
|
2010-06-03 08:52:04 +00:00
|
|
|
|
|
|
|
return rt2800ops->drv_init_registers(rt2x00dev);
|
|
|
|
}
|
|
|
|
|
2010-08-06 18:47:20 +00:00
|
|
|
static inline __le32 *rt2800_drv_get_txwi(struct queue_entry *entry)
|
|
|
|
{
|
|
|
|
const struct rt2800_ops *rt2800ops = entry->queue->rt2x00dev->ops->drv;
|
|
|
|
|
|
|
|
return rt2800ops->drv_get_txwi(entry);
|
|
|
|
}
|
|
|
|
|
2009-11-04 17:36:24 +00:00
|
|
|
void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const u8 command, const u8 token,
|
|
|
|
const u8 arg0, const u8 arg1);
|
|
|
|
|
2010-08-30 19:13:08 +00:00
|
|
|
int rt2800_wait_csr_ready(struct rt2x00_dev *rt2x00dev);
|
2010-08-23 17:55:22 +00:00
|
|
|
int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev);
|
|
|
|
|
2010-07-11 10:30:37 +00:00
|
|
|
int rt2800_check_firmware(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const u8 *data, const size_t len);
|
|
|
|
int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const u8 *data, const size_t len);
|
|
|
|
|
2010-08-06 18:47:20 +00:00
|
|
|
void rt2800_write_tx_data(struct queue_entry *entry,
|
|
|
|
struct txentry_desc *txdesc);
|
2010-07-11 10:23:50 +00:00
|
|
|
void rt2800_process_rxwi(struct queue_entry *entry, struct rxdone_entry_desc *txdesc);
|
2010-05-08 21:40:21 +00:00
|
|
|
|
2011-09-07 18:10:02 +00:00
|
|
|
void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32* txwi);
|
2010-08-06 18:47:57 +00:00
|
|
|
|
2010-06-03 08:51:53 +00:00
|
|
|
void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc);
|
2011-01-30 12:16:03 +00:00
|
|
|
void rt2800_clear_beacon(struct queue_entry *entry);
|
2010-06-03 08:51:53 +00:00
|
|
|
|
2009-11-04 17:36:40 +00:00
|
|
|
extern const struct rt2x00debug rt2800_rt2x00debug;
|
|
|
|
|
|
|
|
int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev);
|
|
|
|
int rt2800_config_shared_key(struct rt2x00_dev *rt2x00dev,
|
|
|
|
struct rt2x00lib_crypto *crypto,
|
|
|
|
struct ieee80211_key_conf *key);
|
|
|
|
int rt2800_config_pairwise_key(struct rt2x00_dev *rt2x00dev,
|
|
|
|
struct rt2x00lib_crypto *crypto,
|
|
|
|
struct ieee80211_key_conf *key);
|
2011-09-08 12:38:01 +00:00
|
|
|
int rt2800_sta_add(struct rt2x00_dev *rt2x00dev, struct ieee80211_vif *vif,
|
|
|
|
struct ieee80211_sta *sta);
|
|
|
|
int rt2800_sta_remove(struct rt2x00_dev *rt2x00dev, int wcid);
|
2009-11-04 17:36:40 +00:00
|
|
|
void rt2800_config_filter(struct rt2x00_dev *rt2x00dev,
|
|
|
|
const unsigned int filter_flags);
|
|
|
|
void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf,
|
|
|
|
struct rt2x00intf_conf *conf, const unsigned int flags);
|
2010-09-08 18:56:32 +00:00
|
|
|
void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp,
|
|
|
|
u32 changed);
|
2009-11-04 17:36:40 +00:00
|
|
|
void rt2800_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant);
|
|
|
|
void rt2800_config(struct rt2x00_dev *rt2x00dev,
|
|
|
|
struct rt2x00lib_conf *libconf,
|
|
|
|
const unsigned int flags);
|
|
|
|
void rt2800_link_stats(struct rt2x00_dev *rt2x00dev, struct link_qual *qual);
|
|
|
|
void rt2800_reset_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual);
|
|
|
|
void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual,
|
|
|
|
const u32 count);
|
2011-03-28 11:33:40 +00:00
|
|
|
void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev);
|
2012-02-16 13:40:57 +00:00
|
|
|
void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev);
|
2009-11-04 17:36:40 +00:00
|
|
|
|
2010-08-23 17:55:22 +00:00
|
|
|
int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev);
|
|
|
|
void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev);
|
2009-11-04 17:36:57 +00:00
|
|
|
|
2009-11-08 13:39:48 +00:00
|
|
|
int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev);
|
|
|
|
void rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev);
|
2009-11-08 13:39:01 +00:00
|
|
|
int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev);
|
|
|
|
int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev);
|
2009-11-08 13:39:32 +00:00
|
|
|
int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev);
|
2009-11-08 13:39:01 +00:00
|
|
|
|
2010-07-11 10:28:54 +00:00
|
|
|
void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx, u32 *iv32,
|
|
|
|
u16 *iv16);
|
|
|
|
int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
|
2011-10-02 08:15:52 +00:00
|
|
|
int rt2800_conf_tx(struct ieee80211_hw *hw,
|
|
|
|
struct ieee80211_vif *vif, u16 queue_idx,
|
2010-07-11 10:28:54 +00:00
|
|
|
const struct ieee80211_tx_queue_params *params);
|
2011-09-21 11:06:11 +00:00
|
|
|
u64 rt2800_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
|
2010-07-11 10:28:54 +00:00
|
|
|
int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
|
|
|
enum ieee80211_ampdu_mlme_action action,
|
2011-01-18 12:51:05 +00:00
|
|
|
struct ieee80211_sta *sta, u16 tid, u16 *ssn,
|
|
|
|
u8 buf_size);
|
2010-12-13 11:31:58 +00:00
|
|
|
int rt2800_get_survey(struct ieee80211_hw *hw, int idx,
|
|
|
|
struct survey_info *survey);
|
2012-04-03 01:40:47 +00:00
|
|
|
void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev);
|
2009-11-04 17:37:05 +00:00
|
|
|
|
2009-11-04 17:35:32 +00:00
|
|
|
#endif /* RT2800LIB_H */
|