Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next
This commit is contained in:
commit
8317e2047e
167 changed files with 40219 additions and 39230 deletions
|
|
@ -42,7 +42,7 @@ obj-$(CONFIG_ADM8211) += adm8211.o
|
|||
obj-$(CONFIG_MWL8K) += mwl8k.o
|
||||
|
||||
obj-$(CONFIG_IWLWIFI) += iwlwifi/
|
||||
obj-$(CONFIG_IWLWIFI_LEGACY) += iwlegacy/
|
||||
obj-$(CONFIG_IWLEGACY) += iwlegacy/
|
||||
obj-$(CONFIG_RT2X00) += rt2x00/
|
||||
|
||||
obj-$(CONFIG_P54_COMMON) += p54/
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
obj-$(CONFIG_ATH6KL) := ath6kl.o
|
||||
ath6kl-y += debug.o
|
||||
ath6kl-y += htc_hif.o
|
||||
ath6kl-y += hif.o
|
||||
ath6kl-y += htc.o
|
||||
ath6kl-y += bmi.o
|
||||
ath6kl-y += cfg80211.o
|
||||
|
|
|
|||
|
|
@ -196,8 +196,6 @@ int ath6kl_bmi_done(struct ath6kl *ar)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ath6kl_bmi_cleanup(ar);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -672,6 +670,11 @@ int ath6kl_bmi_fast_download(struct ath6kl *ar, u32 addr, u8 *buf, u32 len)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void ath6kl_bmi_reset(struct ath6kl *ar)
|
||||
{
|
||||
ar->bmi.done_sent = false;
|
||||
}
|
||||
|
||||
int ath6kl_bmi_init(struct ath6kl *ar)
|
||||
{
|
||||
ar->bmi.cmd_buf = kzalloc(MAX_BMI_CMDBUF_SZ, GFP_ATOMIC);
|
||||
|
|
|
|||
|
|
@ -230,6 +230,8 @@ struct ath6kl_bmi_target_info {
|
|||
|
||||
int ath6kl_bmi_init(struct ath6kl *ar);
|
||||
void ath6kl_bmi_cleanup(struct ath6kl *ar);
|
||||
void ath6kl_bmi_reset(struct ath6kl *ar);
|
||||
|
||||
int ath6kl_bmi_done(struct ath6kl *ar);
|
||||
int ath6kl_bmi_get_target_info(struct ath6kl *ar,
|
||||
struct ath6kl_bmi_target_info *targ_info);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -17,23 +17,41 @@
|
|||
#ifndef ATH6KL_CFG80211_H
|
||||
#define ATH6KL_CFG80211_H
|
||||
|
||||
struct wireless_dev *ath6kl_cfg80211_init(struct device *dev);
|
||||
void ath6kl_cfg80211_deinit(struct ath6kl *ar);
|
||||
enum ath6kl_cfg_suspend_mode {
|
||||
ATH6KL_CFG_SUSPEND_DEEPSLEEP,
|
||||
ATH6KL_CFG_SUSPEND_CUTPOWER,
|
||||
ATH6KL_CFG_SUSPEND_WOW
|
||||
};
|
||||
|
||||
void ath6kl_cfg80211_scan_complete_event(struct ath6kl *ar, int status);
|
||||
struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
|
||||
enum nl80211_iftype type,
|
||||
u8 fw_vif_idx, u8 nw_type);
|
||||
int ath6kl_register_ieee80211_hw(struct ath6kl *ar);
|
||||
struct ath6kl *ath6kl_core_alloc(struct device *dev);
|
||||
void ath6kl_deinit_ieee80211_hw(struct ath6kl *ar);
|
||||
|
||||
void ath6kl_cfg80211_connect_event(struct ath6kl *ar, u16 channel,
|
||||
void ath6kl_cfg80211_scan_complete_event(struct ath6kl_vif *vif, bool aborted);
|
||||
|
||||
void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel,
|
||||
u8 *bssid, u16 listen_intvl,
|
||||
u16 beacon_intvl,
|
||||
enum network_type nw_type,
|
||||
u8 beacon_ie_len, u8 assoc_req_len,
|
||||
u8 assoc_resp_len, u8 *assoc_info);
|
||||
|
||||
void ath6kl_cfg80211_disconnect_event(struct ath6kl *ar, u8 reason,
|
||||
void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason,
|
||||
u8 *bssid, u8 assoc_resp_len,
|
||||
u8 *assoc_info, u16 proto_reason);
|
||||
|
||||
void ath6kl_cfg80211_tkip_micerr_event(struct ath6kl *ar, u8 keyid,
|
||||
void ath6kl_cfg80211_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid,
|
||||
bool ismcast);
|
||||
|
||||
int ath6kl_cfg80211_suspend(struct ath6kl *ar,
|
||||
enum ath6kl_cfg_suspend_mode mode,
|
||||
struct cfg80211_wowlan *wow);
|
||||
|
||||
int ath6kl_cfg80211_resume(struct ath6kl *ar);
|
||||
|
||||
void ath6kl_cfg80211_stop(struct ath6kl *ar);
|
||||
|
||||
#endif /* ATH6KL_CFG80211_H */
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
extern int ath6kl_printk(const char *level, const char *fmt, ...);
|
||||
|
||||
#define A_CACHE_LINE_PAD 128
|
||||
|
||||
/*
|
||||
* Reflects the version of binary interface exposed by ATH6KL target
|
||||
* firmware. Needs to be incremented by 1 for any change in the firmware
|
||||
|
|
@ -78,20 +76,10 @@ enum crypto_type {
|
|||
struct htc_endpoint_credit_dist;
|
||||
struct ath6kl;
|
||||
enum htc_credit_dist_reason;
|
||||
struct htc_credit_state_info;
|
||||
struct ath6kl_htc_credit_info;
|
||||
|
||||
int ath6k_setup_credit_dist(void *htc_handle,
|
||||
struct htc_credit_state_info *cred_info);
|
||||
void ath6k_credit_distribute(struct htc_credit_state_info *cred_inf,
|
||||
struct list_head *epdist_list,
|
||||
enum htc_credit_dist_reason reason);
|
||||
void ath6k_credit_init(struct htc_credit_state_info *cred_inf,
|
||||
struct list_head *ep_list,
|
||||
int tot_credits);
|
||||
void ath6k_seek_credits(struct htc_credit_state_info *cred_inf,
|
||||
struct htc_endpoint_credit_dist *ep_dist);
|
||||
struct ath6kl *ath6kl_core_alloc(struct device *sdev);
|
||||
int ath6kl_core_init(struct ath6kl *ar);
|
||||
int ath6kl_unavail_ev(struct ath6kl *ar);
|
||||
void ath6kl_core_cleanup(struct ath6kl *ar);
|
||||
struct sk_buff *ath6kl_buf_alloc(int size);
|
||||
#endif /* COMMON_H */
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ struct ath6kl_fw_ie {
|
|||
#define ATH6KL_CONF_IGNORE_PS_FAIL_EVT_IN_SCAN BIT(1)
|
||||
#define ATH6KL_CONF_ENABLE_11N BIT(2)
|
||||
#define ATH6KL_CONF_ENABLE_TX_BURST BIT(3)
|
||||
#define ATH6KL_CONF_SUSPEND_CUTPOWER BIT(4)
|
||||
|
||||
enum wlan_low_pwr_state {
|
||||
WLAN_POWER_STATE_ON,
|
||||
|
|
@ -380,40 +381,33 @@ struct ath6kl_req_key {
|
|||
u8 key_len;
|
||||
};
|
||||
|
||||
/* Flag info */
|
||||
#define WMI_ENABLED 0
|
||||
#define WMI_READY 1
|
||||
#define CONNECTED 2
|
||||
#define STATS_UPDATE_PEND 3
|
||||
#define CONNECT_PEND 4
|
||||
#define WMM_ENABLED 5
|
||||
#define NETQ_STOPPED 6
|
||||
#define WMI_CTRL_EP_FULL 7
|
||||
#define DTIM_EXPIRED 8
|
||||
#define DESTROY_IN_PROGRESS 9
|
||||
#define NETDEV_REGISTERED 10
|
||||
#define SKIP_SCAN 11
|
||||
#define WLAN_ENABLED 12
|
||||
#define TESTMODE 13
|
||||
#define CLEAR_BSSFILTER_ON_BEACON 14
|
||||
#define DTIM_PERIOD_AVAIL 15
|
||||
#define MAX_NUM_VIF 1
|
||||
|
||||
struct ath6kl {
|
||||
struct device *dev;
|
||||
struct net_device *net_dev;
|
||||
struct ath6kl_bmi bmi;
|
||||
const struct ath6kl_hif_ops *hif_ops;
|
||||
struct wmi *wmi;
|
||||
int tx_pending[ENDPOINT_MAX];
|
||||
int total_tx_data_pend;
|
||||
struct htc_target *htc_target;
|
||||
void *hif_priv;
|
||||
spinlock_t lock;
|
||||
struct semaphore sem;
|
||||
/* vif flags info */
|
||||
enum ath6kl_vif_state {
|
||||
CONNECTED,
|
||||
CONNECT_PEND,
|
||||
WMM_ENABLED,
|
||||
NETQ_STOPPED,
|
||||
DTIM_EXPIRED,
|
||||
NETDEV_REGISTERED,
|
||||
CLEAR_BSSFILTER_ON_BEACON,
|
||||
DTIM_PERIOD_AVAIL,
|
||||
WLAN_ENABLED,
|
||||
STATS_UPDATE_PEND,
|
||||
};
|
||||
|
||||
struct ath6kl_vif {
|
||||
struct list_head list;
|
||||
struct wireless_dev wdev;
|
||||
struct net_device *ndev;
|
||||
struct ath6kl *ar;
|
||||
/* Lock to protect vif specific net_stats and flags */
|
||||
spinlock_t if_lock;
|
||||
u8 fw_vif_idx;
|
||||
unsigned long flags;
|
||||
int ssid_len;
|
||||
u8 ssid[IEEE80211_MAX_SSID_LEN];
|
||||
u8 next_mode;
|
||||
u8 nw_type;
|
||||
u8 dot11_auth_mode;
|
||||
u8 auth_mode;
|
||||
u8 prwise_crypto;
|
||||
|
|
@ -421,21 +415,83 @@ struct ath6kl {
|
|||
u8 grp_crypto;
|
||||
u8 grp_crypto_len;
|
||||
u8 def_txkey_index;
|
||||
struct ath6kl_wep_key wep_key_list[WMI_MAX_KEY_INDEX + 1];
|
||||
u8 next_mode;
|
||||
u8 nw_type;
|
||||
u8 bssid[ETH_ALEN];
|
||||
u8 req_bssid[ETH_ALEN];
|
||||
u16 ch_hint;
|
||||
u16 bss_ch;
|
||||
struct ath6kl_wep_key wep_key_list[WMI_MAX_KEY_INDEX + 1];
|
||||
struct ath6kl_key keys[WMI_MAX_KEY_INDEX + 1];
|
||||
struct aggr_info *aggr_cntxt;
|
||||
struct timer_list disconnect_timer;
|
||||
struct cfg80211_scan_request *scan_req;
|
||||
enum sme_state sme_state;
|
||||
int reconnect_flag;
|
||||
u32 last_roc_id;
|
||||
u32 last_cancel_roc_id;
|
||||
u32 send_action_id;
|
||||
bool probe_req_report;
|
||||
u16 next_chan;
|
||||
u16 assoc_bss_beacon_int;
|
||||
u8 assoc_bss_dtim_period;
|
||||
struct net_device_stats net_stats;
|
||||
struct target_stats target_stats;
|
||||
};
|
||||
|
||||
#define WOW_LIST_ID 0
|
||||
#define WOW_HOST_REQ_DELAY 500 /* ms */
|
||||
|
||||
/* Flag info */
|
||||
enum ath6kl_dev_state {
|
||||
WMI_ENABLED,
|
||||
WMI_READY,
|
||||
WMI_CTRL_EP_FULL,
|
||||
TESTMODE,
|
||||
DESTROY_IN_PROGRESS,
|
||||
SKIP_SCAN,
|
||||
ROAM_TBL_PEND,
|
||||
FIRST_BOOT,
|
||||
};
|
||||
|
||||
enum ath6kl_state {
|
||||
ATH6KL_STATE_OFF,
|
||||
ATH6KL_STATE_ON,
|
||||
ATH6KL_STATE_DEEPSLEEP,
|
||||
ATH6KL_STATE_CUTPOWER,
|
||||
ATH6KL_STATE_WOW,
|
||||
};
|
||||
|
||||
struct ath6kl {
|
||||
struct device *dev;
|
||||
struct wiphy *wiphy;
|
||||
|
||||
enum ath6kl_state state;
|
||||
|
||||
struct ath6kl_bmi bmi;
|
||||
const struct ath6kl_hif_ops *hif_ops;
|
||||
struct wmi *wmi;
|
||||
int tx_pending[ENDPOINT_MAX];
|
||||
int total_tx_data_pend;
|
||||
struct htc_target *htc_target;
|
||||
void *hif_priv;
|
||||
struct list_head vif_list;
|
||||
/* Lock to avoid race in vif_list entries among add/del/traverse */
|
||||
spinlock_t list_lock;
|
||||
u8 num_vif;
|
||||
u8 max_norm_iface;
|
||||
u8 avail_idx_map;
|
||||
spinlock_t lock;
|
||||
struct semaphore sem;
|
||||
u16 listen_intvl_b;
|
||||
u16 listen_intvl_t;
|
||||
u8 lrssi_roam_threshold;
|
||||
struct ath6kl_version version;
|
||||
u32 target_type;
|
||||
u8 tx_pwr;
|
||||
struct net_device_stats net_stats;
|
||||
struct target_stats target_stats;
|
||||
struct ath6kl_node_mapping node_map[MAX_NODE_NUM];
|
||||
u8 ibss_ps_enable;
|
||||
bool ibss_if_active;
|
||||
u8 node_num;
|
||||
u8 next_ep_id;
|
||||
struct ath6kl_cookie *cookie_list;
|
||||
|
|
@ -446,7 +502,7 @@ struct ath6kl {
|
|||
u8 hiac_stream_active_pri;
|
||||
u8 ep2ac_map[ENDPOINT_MAX];
|
||||
enum htc_endpoint_id ctrl_ep;
|
||||
struct htc_credit_state_info credit_state_info;
|
||||
struct ath6kl_htc_credit_info credit_state_info;
|
||||
u32 connect_ctrl_flags;
|
||||
u32 user_key_ctrl;
|
||||
u8 usr_bss_filter;
|
||||
|
|
@ -456,18 +512,13 @@ struct ath6kl {
|
|||
struct sk_buff_head mcastpsq;
|
||||
spinlock_t mcastpsq_lock;
|
||||
u8 intra_bss;
|
||||
struct aggr_info *aggr_cntxt;
|
||||
struct wmi_ap_mode_stat ap_stats;
|
||||
u8 ap_country_code[3];
|
||||
struct list_head amsdu_rx_buffer_queue;
|
||||
struct timer_list disconnect_timer;
|
||||
u8 rx_meta_ver;
|
||||
struct wireless_dev *wdev;
|
||||
struct cfg80211_scan_request *scan_req;
|
||||
struct ath6kl_key keys[WMI_MAX_KEY_INDEX + 1];
|
||||
enum sme_state sme_state;
|
||||
enum wlan_low_pwr_state wlan_pwr_state;
|
||||
struct wmi_scan_params_cmd sc_params;
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
#define AR_MCAST_FILTER_MAC_ADDR_SIZE 4
|
||||
struct {
|
||||
void *rx_report;
|
||||
|
|
@ -487,7 +538,6 @@ struct ath6kl {
|
|||
struct ath6kl_mbox_info mbox_info;
|
||||
|
||||
struct ath6kl_cookie cookie_mem[MAX_COOKIE_NUM];
|
||||
int reconnect_flag;
|
||||
unsigned long flag;
|
||||
|
||||
u8 *fw_board;
|
||||
|
|
@ -508,13 +558,7 @@ struct ath6kl {
|
|||
|
||||
struct dentry *debugfs_phy;
|
||||
|
||||
u32 send_action_id;
|
||||
bool probe_req_report;
|
||||
u16 next_chan;
|
||||
|
||||
bool p2p;
|
||||
u16 assoc_bss_beacon_int;
|
||||
u8 assoc_bss_dtim_period;
|
||||
|
||||
#ifdef CONFIG_ATH6KL_DEBUG
|
||||
struct {
|
||||
|
|
@ -529,23 +573,19 @@ struct ath6kl {
|
|||
struct {
|
||||
unsigned int invalid_rate;
|
||||
} war_stats;
|
||||
|
||||
u8 *roam_tbl;
|
||||
unsigned int roam_tbl_len;
|
||||
|
||||
u8 keepalive;
|
||||
u8 disc_timeout;
|
||||
} debug;
|
||||
#endif /* CONFIG_ATH6KL_DEBUG */
|
||||
};
|
||||
|
||||
static inline void *ath6kl_priv(struct net_device *dev)
|
||||
{
|
||||
return wdev_priv(dev->ieee80211_ptr);
|
||||
}
|
||||
|
||||
static inline void ath6kl_deposit_credit_to_ep(struct htc_credit_state_info
|
||||
*cred_info,
|
||||
struct htc_endpoint_credit_dist
|
||||
*ep_dist, int credits)
|
||||
{
|
||||
ep_dist->credits += credits;
|
||||
ep_dist->cred_assngd += credits;
|
||||
cred_info->cur_free_credits -= credits;
|
||||
return ((struct ath6kl_vif *) netdev_priv(dev))->ar;
|
||||
}
|
||||
|
||||
static inline u32 ath6kl_get_hi_item_addr(struct ath6kl *ar,
|
||||
|
|
@ -561,7 +601,6 @@ static inline u32 ath6kl_get_hi_item_addr(struct ath6kl *ar,
|
|||
return addr;
|
||||
}
|
||||
|
||||
void ath6kl_destroy(struct net_device *dev, unsigned int unregister);
|
||||
int ath6kl_configure_target(struct ath6kl *ar);
|
||||
void ath6kl_detect_error(unsigned long ptr);
|
||||
void disconnect_timer_handler(unsigned long ptr);
|
||||
|
|
@ -579,10 +618,8 @@ int ath6kl_diag_write(struct ath6kl *ar, u32 address, void *data, u32 length);
|
|||
int ath6kl_diag_read32(struct ath6kl *ar, u32 address, u32 *value);
|
||||
int ath6kl_diag_read(struct ath6kl *ar, u32 address, void *data, u32 length);
|
||||
int ath6kl_read_fwlogs(struct ath6kl *ar);
|
||||
void ath6kl_init_profile_info(struct ath6kl *ar);
|
||||
void ath6kl_init_profile_info(struct ath6kl_vif *vif);
|
||||
void ath6kl_tx_data_cleanup(struct ath6kl *ar);
|
||||
void ath6kl_stop_endpoint(struct net_device *dev, bool keep_profile,
|
||||
bool get_dbglogs);
|
||||
|
||||
struct ath6kl_cookie *ath6kl_alloc_cookie(struct ath6kl *ar);
|
||||
void ath6kl_free_cookie(struct ath6kl *ar, struct ath6kl_cookie *cookie);
|
||||
|
|
@ -598,40 +635,49 @@ struct htc_packet *ath6kl_alloc_amsdu_rxbuf(struct htc_target *target,
|
|||
void aggr_module_destroy(struct aggr_info *aggr_info);
|
||||
void aggr_reset_state(struct aggr_info *aggr_info);
|
||||
|
||||
struct ath6kl_sta *ath6kl_find_sta(struct ath6kl *ar, u8 * node_addr);
|
||||
struct ath6kl_sta *ath6kl_find_sta(struct ath6kl_vif *vif, u8 * node_addr);
|
||||
struct ath6kl_sta *ath6kl_find_sta_by_aid(struct ath6kl *ar, u8 aid);
|
||||
|
||||
void ath6kl_ready_event(void *devt, u8 * datap, u32 sw_ver, u32 abi_ver);
|
||||
int ath6kl_control_tx(void *devt, struct sk_buff *skb,
|
||||
enum htc_endpoint_id eid);
|
||||
void ath6kl_connect_event(struct ath6kl *ar, u16 channel,
|
||||
void ath6kl_connect_event(struct ath6kl_vif *vif, u16 channel,
|
||||
u8 *bssid, u16 listen_int,
|
||||
u16 beacon_int, enum network_type net_type,
|
||||
u8 beacon_ie_len, u8 assoc_req_len,
|
||||
u8 assoc_resp_len, u8 *assoc_info);
|
||||
void ath6kl_connect_ap_mode_bss(struct ath6kl *ar, u16 channel);
|
||||
void ath6kl_connect_ap_mode_sta(struct ath6kl *ar, u16 aid, u8 *mac_addr,
|
||||
void ath6kl_connect_ap_mode_bss(struct ath6kl_vif *vif, u16 channel);
|
||||
void ath6kl_connect_ap_mode_sta(struct ath6kl_vif *vif, u16 aid, u8 *mac_addr,
|
||||
u8 keymgmt, u8 ucipher, u8 auth,
|
||||
u8 assoc_req_len, u8 *assoc_info);
|
||||
void ath6kl_disconnect_event(struct ath6kl *ar, u8 reason,
|
||||
void ath6kl_disconnect_event(struct ath6kl_vif *vif, u8 reason,
|
||||
u8 *bssid, u8 assoc_resp_len,
|
||||
u8 *assoc_info, u16 prot_reason_status);
|
||||
void ath6kl_tkip_micerr_event(struct ath6kl *ar, u8 keyid, bool ismcast);
|
||||
void ath6kl_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid, bool ismcast);
|
||||
void ath6kl_txpwr_rx_evt(void *devt, u8 tx_pwr);
|
||||
void ath6kl_scan_complete_evt(struct ath6kl *ar, int status);
|
||||
void ath6kl_tgt_stats_event(struct ath6kl *ar, u8 *ptr, u32 len);
|
||||
void ath6kl_scan_complete_evt(struct ath6kl_vif *vif, int status);
|
||||
void ath6kl_tgt_stats_event(struct ath6kl_vif *vif, u8 *ptr, u32 len);
|
||||
void ath6kl_indicate_tx_activity(void *devt, u8 traffic_class, bool active);
|
||||
enum htc_endpoint_id ath6kl_ac2_endpoint_id(void *devt, u8 ac);
|
||||
|
||||
void ath6kl_pspoll_event(struct ath6kl *ar, u8 aid);
|
||||
void ath6kl_pspoll_event(struct ath6kl_vif *vif, u8 aid);
|
||||
|
||||
void ath6kl_dtimexpiry_event(struct ath6kl *ar);
|
||||
void ath6kl_disconnect(struct ath6kl *ar);
|
||||
void ath6kl_deep_sleep_enable(struct ath6kl *ar);
|
||||
void aggr_recv_delba_req_evt(struct ath6kl *ar, u8 tid);
|
||||
void aggr_recv_addba_req_evt(struct ath6kl *ar, u8 tid, u16 seq_no,
|
||||
void ath6kl_dtimexpiry_event(struct ath6kl_vif *vif);
|
||||
void ath6kl_disconnect(struct ath6kl_vif *vif);
|
||||
void aggr_recv_delba_req_evt(struct ath6kl_vif *vif, u8 tid);
|
||||
void aggr_recv_addba_req_evt(struct ath6kl_vif *vif, u8 tid, u16 seq_no,
|
||||
u8 win_sz);
|
||||
void ath6kl_wakeup_event(void *dev);
|
||||
void ath6kl_target_failure(struct ath6kl *ar);
|
||||
|
||||
void ath6kl_reset_device(struct ath6kl *ar, u32 target_type,
|
||||
bool wait_fot_compltn, bool cold_reset);
|
||||
void ath6kl_init_control_info(struct ath6kl_vif *vif);
|
||||
void ath6kl_deinit_if_data(struct ath6kl_vif *vif);
|
||||
void ath6kl_core_free(struct ath6kl *ar);
|
||||
struct ath6kl_vif *ath6kl_vif_first(struct ath6kl *ar);
|
||||
void ath6kl_cleanup_vif(struct ath6kl_vif *vif, bool wmi_ready);
|
||||
int ath6kl_init_hw_start(struct ath6kl *ar);
|
||||
int ath6kl_init_hw_stop(struct ath6kl *ar);
|
||||
void ath6kl_check_wow_status(struct ath6kl *ar);
|
||||
|
||||
#endif /* CORE_H */
|
||||
|
|
|
|||
|
|
@ -143,49 +143,48 @@ void ath6kl_dump_registers(struct ath6kl_device *dev,
|
|||
|
||||
static void dump_cred_dist(struct htc_endpoint_credit_dist *ep_dist)
|
||||
{
|
||||
ath6kl_dbg(ATH6KL_DBG_ANY,
|
||||
ath6kl_dbg(ATH6KL_DBG_CREDIT,
|
||||
"--- endpoint: %d svc_id: 0x%X ---\n",
|
||||
ep_dist->endpoint, ep_dist->svc_id);
|
||||
ath6kl_dbg(ATH6KL_DBG_ANY, " dist_flags : 0x%X\n",
|
||||
ath6kl_dbg(ATH6KL_DBG_CREDIT, " dist_flags : 0x%X\n",
|
||||
ep_dist->dist_flags);
|
||||
ath6kl_dbg(ATH6KL_DBG_ANY, " cred_norm : %d\n",
|
||||
ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_norm : %d\n",
|
||||
ep_dist->cred_norm);
|
||||
ath6kl_dbg(ATH6KL_DBG_ANY, " cred_min : %d\n",
|
||||
ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_min : %d\n",
|
||||
ep_dist->cred_min);
|
||||
ath6kl_dbg(ATH6KL_DBG_ANY, " credits : %d\n",
|
||||
ath6kl_dbg(ATH6KL_DBG_CREDIT, " credits : %d\n",
|
||||
ep_dist->credits);
|
||||
ath6kl_dbg(ATH6KL_DBG_ANY, " cred_assngd : %d\n",
|
||||
ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_assngd : %d\n",
|
||||
ep_dist->cred_assngd);
|
||||
ath6kl_dbg(ATH6KL_DBG_ANY, " seek_cred : %d\n",
|
||||
ath6kl_dbg(ATH6KL_DBG_CREDIT, " seek_cred : %d\n",
|
||||
ep_dist->seek_cred);
|
||||
ath6kl_dbg(ATH6KL_DBG_ANY, " cred_sz : %d\n",
|
||||
ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_sz : %d\n",
|
||||
ep_dist->cred_sz);
|
||||
ath6kl_dbg(ATH6KL_DBG_ANY, " cred_per_msg : %d\n",
|
||||
ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_per_msg : %d\n",
|
||||
ep_dist->cred_per_msg);
|
||||
ath6kl_dbg(ATH6KL_DBG_ANY, " cred_to_dist : %d\n",
|
||||
ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_to_dist : %d\n",
|
||||
ep_dist->cred_to_dist);
|
||||
ath6kl_dbg(ATH6KL_DBG_ANY, " txq_depth : %d\n",
|
||||
get_queue_depth(&((struct htc_endpoint *)
|
||||
ep_dist->htc_rsvd)->txq));
|
||||
ath6kl_dbg(ATH6KL_DBG_ANY,
|
||||
ath6kl_dbg(ATH6KL_DBG_CREDIT, " txq_depth : %d\n",
|
||||
get_queue_depth(&ep_dist->htc_ep->txq));
|
||||
ath6kl_dbg(ATH6KL_DBG_CREDIT,
|
||||
"----------------------------------\n");
|
||||
}
|
||||
|
||||
/* FIXME: move to htc.c */
|
||||
void dump_cred_dist_stats(struct htc_target *target)
|
||||
{
|
||||
struct htc_endpoint_credit_dist *ep_list;
|
||||
|
||||
if (!AR_DBG_LVL_CHECK(ATH6KL_DBG_TRC))
|
||||
if (!AR_DBG_LVL_CHECK(ATH6KL_DBG_CREDIT))
|
||||
return;
|
||||
|
||||
list_for_each_entry(ep_list, &target->cred_dist_list, list)
|
||||
dump_cred_dist(ep_list);
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_HTC_SEND, "ctxt:%p dist:%p\n",
|
||||
target->cred_dist_cntxt, NULL);
|
||||
ath6kl_dbg(ATH6KL_DBG_TRC, "credit distribution, total : %d, free : %d\n",
|
||||
target->cred_dist_cntxt->total_avail_credits,
|
||||
target->cred_dist_cntxt->cur_free_credits);
|
||||
ath6kl_dbg(ATH6KL_DBG_CREDIT,
|
||||
"credit distribution total %d free %d\n",
|
||||
target->credit_info->total_avail_credits,
|
||||
target->credit_info->cur_free_credits);
|
||||
}
|
||||
|
||||
static int ath6kl_debugfs_open(struct inode *inode, struct file *file)
|
||||
|
|
@ -397,13 +396,20 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
|
|||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
struct target_stats *tgt_stats = &ar->target_stats;
|
||||
struct ath6kl_vif *vif;
|
||||
struct target_stats *tgt_stats;
|
||||
char *buf;
|
||||
unsigned int len = 0, buf_len = 1500;
|
||||
int i;
|
||||
long left;
|
||||
ssize_t ret_cnt;
|
||||
|
||||
vif = ath6kl_vif_first(ar);
|
||||
if (!vif)
|
||||
return -EIO;
|
||||
|
||||
tgt_stats = &vif->target_stats;
|
||||
|
||||
buf = kzalloc(buf_len, GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
|
@ -413,9 +419,9 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
|
|||
return -EBUSY;
|
||||
}
|
||||
|
||||
set_bit(STATS_UPDATE_PEND, &ar->flag);
|
||||
set_bit(STATS_UPDATE_PEND, &vif->flags);
|
||||
|
||||
if (ath6kl_wmi_get_stats_cmd(ar->wmi)) {
|
||||
if (ath6kl_wmi_get_stats_cmd(ar->wmi, 0)) {
|
||||
up(&ar->sem);
|
||||
kfree(buf);
|
||||
return -EIO;
|
||||
|
|
@ -423,7 +429,7 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
|
|||
|
||||
left = wait_event_interruptible_timeout(ar->event_wq,
|
||||
!test_bit(STATS_UPDATE_PEND,
|
||||
&ar->flag), WMI_TIMEOUT);
|
||||
&vif->flags), WMI_TIMEOUT);
|
||||
|
||||
up(&ar->sem);
|
||||
|
||||
|
|
@ -555,10 +561,10 @@ static ssize_t read_file_credit_dist_stats(struct file *file,
|
|||
|
||||
len += scnprintf(buf + len, buf_len - len, "%25s%5d\n",
|
||||
"Total Avail Credits: ",
|
||||
target->cred_dist_cntxt->total_avail_credits);
|
||||
target->credit_info->total_avail_credits);
|
||||
len += scnprintf(buf + len, buf_len - len, "%25s%5d\n",
|
||||
"Free credits :",
|
||||
target->cred_dist_cntxt->cur_free_credits);
|
||||
target->credit_info->cur_free_credits);
|
||||
|
||||
len += scnprintf(buf + len, buf_len - len,
|
||||
" Epid Flags Cred_norm Cred_min Credits Cred_assngd"
|
||||
|
|
@ -577,8 +583,7 @@ static ssize_t read_file_credit_dist_stats(struct file *file,
|
|||
print_credit_info("%9d", cred_per_msg);
|
||||
print_credit_info("%14d", cred_to_dist);
|
||||
len += scnprintf(buf + len, buf_len - len, "%12d\n",
|
||||
get_queue_depth(&((struct htc_endpoint *)
|
||||
ep_list->htc_rsvd)->txq));
|
||||
get_queue_depth(&ep_list->htc_ep->txq));
|
||||
}
|
||||
|
||||
if (len > buf_len)
|
||||
|
|
@ -596,6 +601,107 @@ static const struct file_operations fops_credit_dist_stats = {
|
|||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
static unsigned int print_endpoint_stat(struct htc_target *target, char *buf,
|
||||
unsigned int buf_len, unsigned int len,
|
||||
int offset, const char *name)
|
||||
{
|
||||
int i;
|
||||
struct htc_endpoint_stats *ep_st;
|
||||
u32 *counter;
|
||||
|
||||
len += scnprintf(buf + len, buf_len - len, "%s:", name);
|
||||
for (i = 0; i < ENDPOINT_MAX; i++) {
|
||||
ep_st = &target->endpoint[i].ep_st;
|
||||
counter = ((u32 *) ep_st) + (offset / 4);
|
||||
len += scnprintf(buf + len, buf_len - len, " %u", *counter);
|
||||
}
|
||||
len += scnprintf(buf + len, buf_len - len, "\n");
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t ath6kl_endpoint_stats_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
struct htc_target *target = ar->htc_target;
|
||||
char *buf;
|
||||
unsigned int buf_len, len = 0;
|
||||
ssize_t ret_cnt;
|
||||
|
||||
buf_len = sizeof(struct htc_endpoint_stats) / sizeof(u32) *
|
||||
(25 + ENDPOINT_MAX * 11);
|
||||
buf = kmalloc(buf_len, GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
#define EPSTAT(name) \
|
||||
len = print_endpoint_stat(target, buf, buf_len, len, \
|
||||
offsetof(struct htc_endpoint_stats, name), \
|
||||
#name)
|
||||
EPSTAT(cred_low_indicate);
|
||||
EPSTAT(tx_issued);
|
||||
EPSTAT(tx_pkt_bundled);
|
||||
EPSTAT(tx_bundles);
|
||||
EPSTAT(tx_dropped);
|
||||
EPSTAT(tx_cred_rpt);
|
||||
EPSTAT(cred_rpt_from_rx);
|
||||
EPSTAT(cred_rpt_from_other);
|
||||
EPSTAT(cred_rpt_ep0);
|
||||
EPSTAT(cred_from_rx);
|
||||
EPSTAT(cred_from_other);
|
||||
EPSTAT(cred_from_ep0);
|
||||
EPSTAT(cred_cosumd);
|
||||
EPSTAT(cred_retnd);
|
||||
EPSTAT(rx_pkts);
|
||||
EPSTAT(rx_lkahds);
|
||||
EPSTAT(rx_bundl);
|
||||
EPSTAT(rx_bundle_lkahd);
|
||||
EPSTAT(rx_bundle_from_hdr);
|
||||
EPSTAT(rx_alloc_thresh_hit);
|
||||
EPSTAT(rxalloc_thresh_byte);
|
||||
#undef EPSTAT
|
||||
|
||||
if (len > buf_len)
|
||||
len = buf_len;
|
||||
|
||||
ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||
kfree(buf);
|
||||
return ret_cnt;
|
||||
}
|
||||
|
||||
static ssize_t ath6kl_endpoint_stats_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
struct htc_target *target = ar->htc_target;
|
||||
int ret, i;
|
||||
u32 val;
|
||||
struct htc_endpoint_stats *ep_st;
|
||||
|
||||
ret = kstrtou32_from_user(user_buf, count, 0, &val);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (val == 0) {
|
||||
for (i = 0; i < ENDPOINT_MAX; i++) {
|
||||
ep_st = &target->endpoint[i].ep_st;
|
||||
memset(ep_st, 0, sizeof(*ep_st));
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_endpoint_stats = {
|
||||
.open = ath6kl_debugfs_open,
|
||||
.read = ath6kl_endpoint_stats_read,
|
||||
.write = ath6kl_endpoint_stats_write,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
static unsigned long ath6kl_get_num_reg(void)
|
||||
{
|
||||
int i;
|
||||
|
|
@ -868,6 +974,660 @@ static const struct file_operations fops_diag_reg_write = {
|
|||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, const void *buf,
|
||||
size_t len)
|
||||
{
|
||||
const struct wmi_target_roam_tbl *tbl;
|
||||
u16 num_entries;
|
||||
|
||||
if (len < sizeof(*tbl))
|
||||
return -EINVAL;
|
||||
|
||||
tbl = (const struct wmi_target_roam_tbl *) buf;
|
||||
num_entries = le16_to_cpu(tbl->num_entries);
|
||||
if (sizeof(*tbl) + num_entries * sizeof(struct wmi_bss_roam_info) >
|
||||
len)
|
||||
return -EINVAL;
|
||||
|
||||
if (ar->debug.roam_tbl == NULL ||
|
||||
ar->debug.roam_tbl_len < (unsigned int) len) {
|
||||
kfree(ar->debug.roam_tbl);
|
||||
ar->debug.roam_tbl = kmalloc(len, GFP_ATOMIC);
|
||||
if (ar->debug.roam_tbl == NULL)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memcpy(ar->debug.roam_tbl, buf, len);
|
||||
ar->debug.roam_tbl_len = len;
|
||||
|
||||
if (test_bit(ROAM_TBL_PEND, &ar->flag)) {
|
||||
clear_bit(ROAM_TBL_PEND, &ar->flag);
|
||||
wake_up(&ar->event_wq);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t ath6kl_roam_table_read(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
int ret;
|
||||
long left;
|
||||
struct wmi_target_roam_tbl *tbl;
|
||||
u16 num_entries, i;
|
||||
char *buf;
|
||||
unsigned int len, buf_len;
|
||||
ssize_t ret_cnt;
|
||||
|
||||
if (down_interruptible(&ar->sem))
|
||||
return -EBUSY;
|
||||
|
||||
set_bit(ROAM_TBL_PEND, &ar->flag);
|
||||
|
||||
ret = ath6kl_wmi_get_roam_tbl_cmd(ar->wmi);
|
||||
if (ret) {
|
||||
up(&ar->sem);
|
||||
return ret;
|
||||
}
|
||||
|
||||
left = wait_event_interruptible_timeout(
|
||||
ar->event_wq, !test_bit(ROAM_TBL_PEND, &ar->flag), WMI_TIMEOUT);
|
||||
up(&ar->sem);
|
||||
|
||||
if (left <= 0)
|
||||
return -ETIMEDOUT;
|
||||
|
||||
if (ar->debug.roam_tbl == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
tbl = (struct wmi_target_roam_tbl *) ar->debug.roam_tbl;
|
||||
num_entries = le16_to_cpu(tbl->num_entries);
|
||||
|
||||
buf_len = 100 + num_entries * 100;
|
||||
buf = kzalloc(buf_len, GFP_KERNEL);
|
||||
if (buf == NULL)
|
||||
return -ENOMEM;
|
||||
len = 0;
|
||||
len += scnprintf(buf + len, buf_len - len,
|
||||
"roam_mode=%u\n\n"
|
||||
"# roam_util bssid rssi rssidt last_rssi util bias\n",
|
||||
le16_to_cpu(tbl->roam_mode));
|
||||
|
||||
for (i = 0; i < num_entries; i++) {
|
||||
struct wmi_bss_roam_info *info = &tbl->info[i];
|
||||
len += scnprintf(buf + len, buf_len - len,
|
||||
"%d %pM %d %d %d %d %d\n",
|
||||
a_sle32_to_cpu(info->roam_util), info->bssid,
|
||||
info->rssi, info->rssidt, info->last_rssi,
|
||||
info->util, info->bias);
|
||||
}
|
||||
|
||||
if (len > buf_len)
|
||||
len = buf_len;
|
||||
|
||||
ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||
|
||||
kfree(buf);
|
||||
return ret_cnt;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_roam_table = {
|
||||
.read = ath6kl_roam_table_read,
|
||||
.open = ath6kl_debugfs_open,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
static ssize_t ath6kl_force_roam_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
int ret;
|
||||
char buf[20];
|
||||
size_t len;
|
||||
u8 bssid[ETH_ALEN];
|
||||
int i;
|
||||
int addr[ETH_ALEN];
|
||||
|
||||
len = min(count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, user_buf, len))
|
||||
return -EFAULT;
|
||||
buf[len] = '\0';
|
||||
|
||||
if (sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
&addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5])
|
||||
!= ETH_ALEN)
|
||||
return -EINVAL;
|
||||
for (i = 0; i < ETH_ALEN; i++)
|
||||
bssid[i] = addr[i];
|
||||
|
||||
ret = ath6kl_wmi_force_roam_cmd(ar->wmi, bssid);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_force_roam = {
|
||||
.write = ath6kl_force_roam_write,
|
||||
.open = ath6kl_debugfs_open,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
static ssize_t ath6kl_roam_mode_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
int ret;
|
||||
char buf[20];
|
||||
size_t len;
|
||||
enum wmi_roam_mode mode;
|
||||
|
||||
len = min(count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, user_buf, len))
|
||||
return -EFAULT;
|
||||
buf[len] = '\0';
|
||||
if (len > 0 && buf[len - 1] == '\n')
|
||||
buf[len - 1] = '\0';
|
||||
|
||||
if (strcasecmp(buf, "default") == 0)
|
||||
mode = WMI_DEFAULT_ROAM_MODE;
|
||||
else if (strcasecmp(buf, "bssbias") == 0)
|
||||
mode = WMI_HOST_BIAS_ROAM_MODE;
|
||||
else if (strcasecmp(buf, "lock") == 0)
|
||||
mode = WMI_LOCK_BSS_MODE;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
ret = ath6kl_wmi_set_roam_mode_cmd(ar->wmi, mode);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_roam_mode = {
|
||||
.write = ath6kl_roam_mode_write,
|
||||
.open = ath6kl_debugfs_open,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive)
|
||||
{
|
||||
ar->debug.keepalive = keepalive;
|
||||
}
|
||||
|
||||
static ssize_t ath6kl_keepalive_read(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
char buf[16];
|
||||
int len;
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.keepalive);
|
||||
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||
}
|
||||
|
||||
static ssize_t ath6kl_keepalive_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
int ret;
|
||||
u8 val;
|
||||
|
||||
ret = kstrtou8_from_user(user_buf, count, 0, &val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = ath6kl_wmi_set_keepalive_cmd(ar->wmi, 0, val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_keepalive = {
|
||||
.open = ath6kl_debugfs_open,
|
||||
.read = ath6kl_keepalive_read,
|
||||
.write = ath6kl_keepalive_write,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, u8 timeout)
|
||||
{
|
||||
ar->debug.disc_timeout = timeout;
|
||||
}
|
||||
|
||||
static ssize_t ath6kl_disconnect_timeout_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
char buf[16];
|
||||
int len;
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.disc_timeout);
|
||||
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||
}
|
||||
|
||||
static ssize_t ath6kl_disconnect_timeout_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
int ret;
|
||||
u8 val;
|
||||
|
||||
ret = kstrtou8_from_user(user_buf, count, 0, &val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = ath6kl_wmi_disctimeout_cmd(ar->wmi, 0, val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_disconnect_timeout = {
|
||||
.open = ath6kl_debugfs_open,
|
||||
.read = ath6kl_disconnect_timeout_read,
|
||||
.write = ath6kl_disconnect_timeout_write,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
static ssize_t ath6kl_create_qos_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
|
||||
struct ath6kl *ar = file->private_data;
|
||||
struct ath6kl_vif *vif;
|
||||
char buf[200];
|
||||
ssize_t len;
|
||||
char *sptr, *token;
|
||||
struct wmi_create_pstream_cmd pstream;
|
||||
u32 val32;
|
||||
u16 val16;
|
||||
|
||||
vif = ath6kl_vif_first(ar);
|
||||
if (!vif)
|
||||
return -EIO;
|
||||
|
||||
len = min(count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, user_buf, len))
|
||||
return -EFAULT;
|
||||
buf[len] = '\0';
|
||||
sptr = buf;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou8(token, 0, &pstream.user_pri))
|
||||
return -EINVAL;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou8(token, 0, &pstream.traffic_direc))
|
||||
return -EINVAL;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou8(token, 0, &pstream.traffic_class))
|
||||
return -EINVAL;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou8(token, 0, &pstream.traffic_type))
|
||||
return -EINVAL;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou8(token, 0, &pstream.voice_psc_cap))
|
||||
return -EINVAL;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val32))
|
||||
return -EINVAL;
|
||||
pstream.min_service_int = cpu_to_le32(val32);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val32))
|
||||
return -EINVAL;
|
||||
pstream.max_service_int = cpu_to_le32(val32);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val32))
|
||||
return -EINVAL;
|
||||
pstream.inactivity_int = cpu_to_le32(val32);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val32))
|
||||
return -EINVAL;
|
||||
pstream.suspension_int = cpu_to_le32(val32);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val32))
|
||||
return -EINVAL;
|
||||
pstream.service_start_time = cpu_to_le32(val32);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou8(token, 0, &pstream.tsid))
|
||||
return -EINVAL;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou16(token, 0, &val16))
|
||||
return -EINVAL;
|
||||
pstream.nominal_msdu = cpu_to_le16(val16);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou16(token, 0, &val16))
|
||||
return -EINVAL;
|
||||
pstream.max_msdu = cpu_to_le16(val16);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val32))
|
||||
return -EINVAL;
|
||||
pstream.min_data_rate = cpu_to_le32(val32);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val32))
|
||||
return -EINVAL;
|
||||
pstream.mean_data_rate = cpu_to_le32(val32);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val32))
|
||||
return -EINVAL;
|
||||
pstream.peak_data_rate = cpu_to_le32(val32);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val32))
|
||||
return -EINVAL;
|
||||
pstream.max_burst_size = cpu_to_le32(val32);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val32))
|
||||
return -EINVAL;
|
||||
pstream.delay_bound = cpu_to_le32(val32);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val32))
|
||||
return -EINVAL;
|
||||
pstream.min_phy_rate = cpu_to_le32(val32);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val32))
|
||||
return -EINVAL;
|
||||
pstream.sba = cpu_to_le32(val32);
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou32(token, 0, &val32))
|
||||
return -EINVAL;
|
||||
pstream.medium_time = cpu_to_le32(val32);
|
||||
|
||||
ath6kl_wmi_create_pstream_cmd(ar->wmi, vif->fw_vif_idx, &pstream);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_create_qos = {
|
||||
.write = ath6kl_create_qos_write,
|
||||
.open = ath6kl_debugfs_open,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
static ssize_t ath6kl_delete_qos_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
|
||||
struct ath6kl *ar = file->private_data;
|
||||
struct ath6kl_vif *vif;
|
||||
char buf[100];
|
||||
ssize_t len;
|
||||
char *sptr, *token;
|
||||
u8 traffic_class;
|
||||
u8 tsid;
|
||||
|
||||
vif = ath6kl_vif_first(ar);
|
||||
if (!vif)
|
||||
return -EIO;
|
||||
|
||||
len = min(count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, user_buf, len))
|
||||
return -EFAULT;
|
||||
buf[len] = '\0';
|
||||
sptr = buf;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou8(token, 0, &traffic_class))
|
||||
return -EINVAL;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou8(token, 0, &tsid))
|
||||
return -EINVAL;
|
||||
|
||||
ath6kl_wmi_delete_pstream_cmd(ar->wmi, vif->fw_vif_idx,
|
||||
traffic_class, tsid);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_delete_qos = {
|
||||
.write = ath6kl_delete_qos_write,
|
||||
.open = ath6kl_debugfs_open,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
static ssize_t ath6kl_bgscan_int_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
u16 bgscan_int;
|
||||
char buf[32];
|
||||
ssize_t len;
|
||||
|
||||
len = min(count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, user_buf, len))
|
||||
return -EFAULT;
|
||||
|
||||
buf[len] = '\0';
|
||||
if (kstrtou16(buf, 0, &bgscan_int))
|
||||
return -EINVAL;
|
||||
|
||||
if (bgscan_int == 0)
|
||||
bgscan_int = 0xffff;
|
||||
|
||||
ath6kl_wmi_scanparams_cmd(ar->wmi, 0, 0, 0, bgscan_int, 0, 0, 0, 3,
|
||||
0, 0, 0);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_bgscan_int = {
|
||||
.write = ath6kl_bgscan_int_write,
|
||||
.open = ath6kl_debugfs_open,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
static ssize_t ath6kl_listen_int_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
u16 listen_int_t, listen_int_b;
|
||||
char buf[32];
|
||||
char *sptr, *token;
|
||||
ssize_t len;
|
||||
|
||||
len = min(count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, user_buf, len))
|
||||
return -EFAULT;
|
||||
|
||||
buf[len] = '\0';
|
||||
sptr = buf;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
|
||||
if (kstrtou16(token, 0, &listen_int_t))
|
||||
return -EINVAL;
|
||||
|
||||
if (kstrtou16(sptr, 0, &listen_int_b))
|
||||
return -EINVAL;
|
||||
|
||||
if ((listen_int_t < 15) || (listen_int_t > 5000))
|
||||
return -EINVAL;
|
||||
|
||||
if ((listen_int_b < 1) || (listen_int_b > 50))
|
||||
return -EINVAL;
|
||||
|
||||
ar->listen_intvl_t = listen_int_t;
|
||||
ar->listen_intvl_b = listen_int_b;
|
||||
|
||||
ath6kl_wmi_listeninterval_cmd(ar->wmi, 0, ar->listen_intvl_t,
|
||||
ar->listen_intvl_b);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t ath6kl_listen_int_read(struct file *file,
|
||||
char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
char buf[16];
|
||||
int len;
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "%u %u\n", ar->listen_intvl_t,
|
||||
ar->listen_intvl_b);
|
||||
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||
}
|
||||
|
||||
static const struct file_operations fops_listen_int = {
|
||||
.read = ath6kl_listen_int_read,
|
||||
.write = ath6kl_listen_int_write,
|
||||
.open = ath6kl_debugfs_open,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
static ssize_t ath6kl_power_params_write(struct file *file,
|
||||
const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath6kl *ar = file->private_data;
|
||||
u8 buf[100];
|
||||
unsigned int len = 0;
|
||||
char *sptr, *token;
|
||||
u16 idle_period, ps_poll_num, dtim,
|
||||
tx_wakeup, num_tx;
|
||||
|
||||
len = min(count, sizeof(buf) - 1);
|
||||
if (copy_from_user(buf, user_buf, len))
|
||||
return -EFAULT;
|
||||
buf[len] = '\0';
|
||||
sptr = buf;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou16(token, 0, &idle_period))
|
||||
return -EINVAL;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou16(token, 0, &ps_poll_num))
|
||||
return -EINVAL;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou16(token, 0, &dtim))
|
||||
return -EINVAL;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou16(token, 0, &tx_wakeup))
|
||||
return -EINVAL;
|
||||
|
||||
token = strsep(&sptr, " ");
|
||||
if (!token)
|
||||
return -EINVAL;
|
||||
if (kstrtou16(token, 0, &num_tx))
|
||||
return -EINVAL;
|
||||
|
||||
ath6kl_wmi_pmparams_cmd(ar->wmi, 0, idle_period, ps_poll_num,
|
||||
dtim, tx_wakeup, num_tx, 0);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_power_params = {
|
||||
.write = ath6kl_power_params_write,
|
||||
.open = ath6kl_debugfs_open,
|
||||
.owner = THIS_MODULE,
|
||||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
int ath6kl_debug_init(struct ath6kl *ar)
|
||||
{
|
||||
ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE);
|
||||
|
|
@ -889,7 +1649,7 @@ int ath6kl_debug_init(struct ath6kl *ar)
|
|||
ar->debug.fwlog_mask = 0;
|
||||
|
||||
ar->debugfs_phy = debugfs_create_dir("ath6kl",
|
||||
ar->wdev->wiphy->debugfsdir);
|
||||
ar->wiphy->debugfsdir);
|
||||
if (!ar->debugfs_phy) {
|
||||
vfree(ar->debug.fwlog_buf.buf);
|
||||
kfree(ar->debug.fwlog_tmp);
|
||||
|
|
@ -902,6 +1662,9 @@ int ath6kl_debug_init(struct ath6kl *ar)
|
|||
debugfs_create_file("credit_dist_stats", S_IRUSR, ar->debugfs_phy, ar,
|
||||
&fops_credit_dist_stats);
|
||||
|
||||
debugfs_create_file("endpoint_stats", S_IRUSR | S_IWUSR,
|
||||
ar->debugfs_phy, ar, &fops_endpoint_stats);
|
||||
|
||||
debugfs_create_file("fwlog", S_IRUSR, ar->debugfs_phy, ar,
|
||||
&fops_fwlog);
|
||||
|
||||
|
|
@ -923,6 +1686,33 @@ int ath6kl_debug_init(struct ath6kl *ar)
|
|||
debugfs_create_file("war_stats", S_IRUSR, ar->debugfs_phy, ar,
|
||||
&fops_war_stats);
|
||||
|
||||
debugfs_create_file("roam_table", S_IRUSR, ar->debugfs_phy, ar,
|
||||
&fops_roam_table);
|
||||
|
||||
debugfs_create_file("force_roam", S_IWUSR, ar->debugfs_phy, ar,
|
||||
&fops_force_roam);
|
||||
|
||||
debugfs_create_file("roam_mode", S_IWUSR, ar->debugfs_phy, ar,
|
||||
&fops_roam_mode);
|
||||
|
||||
debugfs_create_file("keepalive", S_IRUSR | S_IWUSR, ar->debugfs_phy, ar,
|
||||
&fops_keepalive);
|
||||
|
||||
debugfs_create_file("disconnect_timeout", S_IRUSR | S_IWUSR,
|
||||
ar->debugfs_phy, ar, &fops_disconnect_timeout);
|
||||
|
||||
debugfs_create_file("create_qos", S_IWUSR, ar->debugfs_phy, ar,
|
||||
&fops_create_qos);
|
||||
|
||||
debugfs_create_file("delete_qos", S_IWUSR, ar->debugfs_phy, ar,
|
||||
&fops_delete_qos);
|
||||
|
||||
debugfs_create_file("bgscan_interval", S_IWUSR,
|
||||
ar->debugfs_phy, ar, &fops_bgscan_int);
|
||||
|
||||
debugfs_create_file("power_params", S_IWUSR, ar->debugfs_phy, ar,
|
||||
&fops_power_params);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -930,6 +1720,7 @@ void ath6kl_debug_cleanup(struct ath6kl *ar)
|
|||
{
|
||||
vfree(ar->debug.fwlog_buf.buf);
|
||||
kfree(ar->debug.fwlog_tmp);
|
||||
kfree(ar->debug.roam_tbl);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -17,19 +17,19 @@
|
|||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#include "htc_hif.h"
|
||||
#include "hif.h"
|
||||
|
||||
enum ATH6K_DEBUG_MASK {
|
||||
ATH6KL_DBG_WLAN_CONNECT = BIT(0), /* wlan connect */
|
||||
ATH6KL_DBG_WLAN_SCAN = BIT(1), /* wlan scan */
|
||||
ATH6KL_DBG_CREDIT = BIT(0),
|
||||
/* hole */
|
||||
ATH6KL_DBG_WLAN_TX = BIT(2), /* wlan tx */
|
||||
ATH6KL_DBG_WLAN_RX = BIT(3), /* wlan rx */
|
||||
ATH6KL_DBG_BMI = BIT(4), /* bmi tracing */
|
||||
ATH6KL_DBG_HTC_SEND = BIT(5), /* htc send */
|
||||
ATH6KL_DBG_HTC_RECV = BIT(6), /* htc recv */
|
||||
ATH6KL_DBG_HTC = BIT(5),
|
||||
ATH6KL_DBG_HIF = BIT(6),
|
||||
ATH6KL_DBG_IRQ = BIT(7), /* interrupt processing */
|
||||
ATH6KL_DBG_PM = BIT(8), /* power management */
|
||||
ATH6KL_DBG_WLAN_NODE = BIT(9), /* general wlan node tracing */
|
||||
/* hole */
|
||||
/* hole */
|
||||
ATH6KL_DBG_WMI = BIT(10), /* wmi tracing */
|
||||
ATH6KL_DBG_TRC = BIT(11), /* generic func tracing */
|
||||
ATH6KL_DBG_SCATTER = BIT(12), /* hif scatter tracing */
|
||||
|
|
@ -40,6 +40,7 @@ enum ATH6K_DEBUG_MASK {
|
|||
ATH6KL_DBG_SDIO_DUMP = BIT(17),
|
||||
ATH6KL_DBG_BOOT = BIT(18), /* driver init and fw boot */
|
||||
ATH6KL_DBG_WMI_DUMP = BIT(19),
|
||||
ATH6KL_DBG_SUSPEND = BIT(20),
|
||||
ATH6KL_DBG_ANY = 0xffffffff /* enable all logs */
|
||||
};
|
||||
|
||||
|
|
@ -90,6 +91,10 @@ void ath6kl_dump_registers(struct ath6kl_device *dev,
|
|||
void dump_cred_dist_stats(struct htc_target *target);
|
||||
void ath6kl_debug_fwlog_event(struct ath6kl *ar, const void *buf, size_t len);
|
||||
void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war);
|
||||
int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, const void *buf,
|
||||
size_t len);
|
||||
void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive);
|
||||
void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, u8 timeout);
|
||||
int ath6kl_debug_init(struct ath6kl *ar);
|
||||
void ath6kl_debug_cleanup(struct ath6kl *ar);
|
||||
|
||||
|
|
@ -125,6 +130,21 @@ static inline void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war)
|
|||
{
|
||||
}
|
||||
|
||||
static inline int ath6kl_debug_roam_tbl_event(struct ath6kl *ar,
|
||||
const void *buf, size_t len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar,
|
||||
u8 timeout)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int ath6kl_debug_init(struct ath6kl *ar)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -18,10 +18,16 @@
|
|||
#define HIF_OPS_H
|
||||
|
||||
#include "hif.h"
|
||||
#include "debug.h"
|
||||
|
||||
static inline int hif_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf,
|
||||
u32 len, u32 request)
|
||||
{
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF,
|
||||
"hif %s sync addr 0x%x buf 0x%p len %d request 0x%x\n",
|
||||
(request & HIF_WRITE) ? "write" : "read",
|
||||
addr, buf, len, request);
|
||||
|
||||
return ar->hif_ops->read_write_sync(ar, addr, buf, len, request);
|
||||
}
|
||||
|
||||
|
|
@ -29,16 +35,24 @@ static inline int hif_write_async(struct ath6kl *ar, u32 address, u8 *buffer,
|
|||
u32 length, u32 request,
|
||||
struct htc_packet *packet)
|
||||
{
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF,
|
||||
"hif write async addr 0x%x buf 0x%p len %d request 0x%x\n",
|
||||
address, buffer, length, request);
|
||||
|
||||
return ar->hif_ops->write_async(ar, address, buffer, length,
|
||||
request, packet);
|
||||
}
|
||||
static inline void ath6kl_hif_irq_enable(struct ath6kl *ar)
|
||||
{
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq enable\n");
|
||||
|
||||
return ar->hif_ops->irq_enable(ar);
|
||||
}
|
||||
|
||||
static inline void ath6kl_hif_irq_disable(struct ath6kl *ar)
|
||||
{
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq disable\n");
|
||||
|
||||
return ar->hif_ops->irq_disable(ar);
|
||||
}
|
||||
|
||||
|
|
@ -69,9 +83,40 @@ static inline void ath6kl_hif_cleanup_scatter(struct ath6kl *ar)
|
|||
return ar->hif_ops->cleanup_scatter(ar);
|
||||
}
|
||||
|
||||
static inline int ath6kl_hif_suspend(struct ath6kl *ar)
|
||||
static inline int ath6kl_hif_suspend(struct ath6kl *ar,
|
||||
struct cfg80211_wowlan *wow)
|
||||
{
|
||||
return ar->hif_ops->suspend(ar);
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF, "hif suspend\n");
|
||||
|
||||
return ar->hif_ops->suspend(ar, wow);
|
||||
}
|
||||
|
||||
static inline int ath6kl_hif_resume(struct ath6kl *ar)
|
||||
{
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF, "hif resume\n");
|
||||
|
||||
return ar->hif_ops->resume(ar);
|
||||
}
|
||||
|
||||
static inline int ath6kl_hif_power_on(struct ath6kl *ar)
|
||||
{
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF, "hif power on\n");
|
||||
|
||||
return ar->hif_ops->power_on(ar);
|
||||
}
|
||||
|
||||
static inline int ath6kl_hif_power_off(struct ath6kl *ar)
|
||||
{
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF, "hif power off\n");
|
||||
|
||||
return ar->hif_ops->power_off(ar);
|
||||
}
|
||||
|
||||
static inline void ath6kl_hif_stop(struct ath6kl *ar)
|
||||
{
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF, "hif stop\n");
|
||||
|
||||
ar->hif_ops->stop(ar);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
697
drivers/net/wireless/ath/ath6kl/hif.c
Normal file
697
drivers/net/wireless/ath/ath6kl/hif.c
Normal file
|
|
@ -0,0 +1,697 @@
|
|||
/*
|
||||
* Copyright (c) 2007-2011 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#include "hif.h"
|
||||
|
||||
#include "core.h"
|
||||
#include "target.h"
|
||||
#include "hif-ops.h"
|
||||
#include "debug.h"
|
||||
|
||||
#define MAILBOX_FOR_BLOCK_SIZE 1
|
||||
|
||||
#define ATH6KL_TIME_QUANTUM 10 /* in ms */
|
||||
|
||||
static int ath6kl_hif_cp_scat_dma_buf(struct hif_scatter_req *req,
|
||||
bool from_dma)
|
||||
{
|
||||
u8 *buf;
|
||||
int i;
|
||||
|
||||
buf = req->virt_dma_buf;
|
||||
|
||||
for (i = 0; i < req->scat_entries; i++) {
|
||||
|
||||
if (from_dma)
|
||||
memcpy(req->scat_list[i].buf, buf,
|
||||
req->scat_list[i].len);
|
||||
else
|
||||
memcpy(buf, req->scat_list[i].buf,
|
||||
req->scat_list[i].len);
|
||||
|
||||
buf += req->scat_list[i].len;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ath6kl_hif_rw_comp_handler(void *context, int status)
|
||||
{
|
||||
struct htc_packet *packet = context;
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF, "hif rw completion pkt 0x%p status %d\n",
|
||||
packet, status);
|
||||
|
||||
packet->status = status;
|
||||
packet->completion(packet->context, packet);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#define REG_DUMP_COUNT_AR6003 60
|
||||
#define REGISTER_DUMP_LEN_MAX 60
|
||||
|
||||
static void ath6kl_hif_dump_fw_crash(struct ath6kl *ar)
|
||||
{
|
||||
__le32 regdump_val[REGISTER_DUMP_LEN_MAX];
|
||||
u32 i, address, regdump_addr = 0;
|
||||
int ret;
|
||||
|
||||
if (ar->target_type != TARGET_TYPE_AR6003)
|
||||
return;
|
||||
|
||||
/* the reg dump pointer is copied to the host interest area */
|
||||
address = ath6kl_get_hi_item_addr(ar, HI_ITEM(hi_failure_state));
|
||||
address = TARG_VTOP(ar->target_type, address);
|
||||
|
||||
/* read RAM location through diagnostic window */
|
||||
ret = ath6kl_diag_read32(ar, address, ®dump_addr);
|
||||
|
||||
if (ret || !regdump_addr) {
|
||||
ath6kl_warn("failed to get ptr to register dump area: %d\n",
|
||||
ret);
|
||||
return;
|
||||
}
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_IRQ, "register dump data address 0x%x\n",
|
||||
regdump_addr);
|
||||
regdump_addr = TARG_VTOP(ar->target_type, regdump_addr);
|
||||
|
||||
/* fetch register dump data */
|
||||
ret = ath6kl_diag_read(ar, regdump_addr, (u8 *)®dump_val[0],
|
||||
REG_DUMP_COUNT_AR6003 * (sizeof(u32)));
|
||||
if (ret) {
|
||||
ath6kl_warn("failed to get register dump: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
ath6kl_info("crash dump:\n");
|
||||
ath6kl_info("hw 0x%x fw %s\n", ar->wiphy->hw_version,
|
||||
ar->wiphy->fw_version);
|
||||
|
||||
BUILD_BUG_ON(REG_DUMP_COUNT_AR6003 % 4);
|
||||
|
||||
for (i = 0; i < REG_DUMP_COUNT_AR6003 / 4; i++) {
|
||||
ath6kl_info("%d: 0x%8.8x 0x%8.8x 0x%8.8x 0x%8.8x\n",
|
||||
4 * i,
|
||||
le32_to_cpu(regdump_val[i]),
|
||||
le32_to_cpu(regdump_val[i + 1]),
|
||||
le32_to_cpu(regdump_val[i + 2]),
|
||||
le32_to_cpu(regdump_val[i + 3]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int ath6kl_hif_proc_dbg_intr(struct ath6kl_device *dev)
|
||||
{
|
||||
u32 dummy;
|
||||
int ret;
|
||||
|
||||
ath6kl_warn("firmware crashed\n");
|
||||
|
||||
/*
|
||||
* read counter to clear the interrupt, the debug error interrupt is
|
||||
* counter 0.
|
||||
*/
|
||||
ret = hif_read_write_sync(dev->ar, COUNT_DEC_ADDRESS,
|
||||
(u8 *)&dummy, 4, HIF_RD_SYNC_BYTE_INC);
|
||||
if (ret)
|
||||
ath6kl_warn("Failed to clear debug interrupt: %d\n", ret);
|
||||
|
||||
ath6kl_hif_dump_fw_crash(dev->ar);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* mailbox recv message polling */
|
||||
int ath6kl_hif_poll_mboxmsg_rx(struct ath6kl_device *dev, u32 *lk_ahd,
|
||||
int timeout)
|
||||
{
|
||||
struct ath6kl_irq_proc_registers *rg;
|
||||
int status = 0, i;
|
||||
u8 htc_mbox = 1 << HTC_MAILBOX;
|
||||
|
||||
for (i = timeout / ATH6KL_TIME_QUANTUM; i > 0; i--) {
|
||||
/* this is the standard HIF way, load the reg table */
|
||||
status = hif_read_write_sync(dev->ar, HOST_INT_STATUS_ADDRESS,
|
||||
(u8 *) &dev->irq_proc_reg,
|
||||
sizeof(dev->irq_proc_reg),
|
||||
HIF_RD_SYNC_BYTE_INC);
|
||||
|
||||
if (status) {
|
||||
ath6kl_err("failed to read reg table\n");
|
||||
return status;
|
||||
}
|
||||
|
||||
/* check for MBOX data and valid lookahead */
|
||||
if (dev->irq_proc_reg.host_int_status & htc_mbox) {
|
||||
if (dev->irq_proc_reg.rx_lkahd_valid &
|
||||
htc_mbox) {
|
||||
/*
|
||||
* Mailbox has a message and the look ahead
|
||||
* is valid.
|
||||
*/
|
||||
rg = &dev->irq_proc_reg;
|
||||
*lk_ahd =
|
||||
le32_to_cpu(rg->rx_lkahd[HTC_MAILBOX]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* delay a little */
|
||||
mdelay(ATH6KL_TIME_QUANTUM);
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF, "hif retry mbox poll try %d\n", i);
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
ath6kl_err("timeout waiting for recv message\n");
|
||||
status = -ETIME;
|
||||
/* check if the target asserted */
|
||||
if (dev->irq_proc_reg.counter_int_status &
|
||||
ATH6KL_TARGET_DEBUG_INTR_MASK)
|
||||
/*
|
||||
* Target failure handler will be called in case of
|
||||
* an assert.
|
||||
*/
|
||||
ath6kl_hif_proc_dbg_intr(dev);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable packet reception (used in case the host runs out of buffers)
|
||||
* using the interrupt enable registers through the host I/F
|
||||
*/
|
||||
int ath6kl_hif_rx_control(struct ath6kl_device *dev, bool enable_rx)
|
||||
{
|
||||
struct ath6kl_irq_enable_reg regs;
|
||||
int status = 0;
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF, "hif rx %s\n",
|
||||
enable_rx ? "enable" : "disable");
|
||||
|
||||
/* take the lock to protect interrupt enable shadows */
|
||||
spin_lock_bh(&dev->lock);
|
||||
|
||||
if (enable_rx)
|
||||
dev->irq_en_reg.int_status_en |=
|
||||
SM(INT_STATUS_ENABLE_MBOX_DATA, 0x01);
|
||||
else
|
||||
dev->irq_en_reg.int_status_en &=
|
||||
~SM(INT_STATUS_ENABLE_MBOX_DATA, 0x01);
|
||||
|
||||
memcpy(®s, &dev->irq_en_reg, sizeof(regs));
|
||||
|
||||
spin_unlock_bh(&dev->lock);
|
||||
|
||||
status = hif_read_write_sync(dev->ar, INT_STATUS_ENABLE_ADDRESS,
|
||||
®s.int_status_en,
|
||||
sizeof(struct ath6kl_irq_enable_reg),
|
||||
HIF_WR_SYNC_BYTE_INC);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int ath6kl_hif_submit_scat_req(struct ath6kl_device *dev,
|
||||
struct hif_scatter_req *scat_req, bool read)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
if (read) {
|
||||
scat_req->req = HIF_RD_SYNC_BLOCK_FIX;
|
||||
scat_req->addr = dev->ar->mbox_info.htc_addr;
|
||||
} else {
|
||||
scat_req->req = HIF_WR_ASYNC_BLOCK_INC;
|
||||
|
||||
scat_req->addr =
|
||||
(scat_req->len > HIF_MBOX_WIDTH) ?
|
||||
dev->ar->mbox_info.htc_ext_addr :
|
||||
dev->ar->mbox_info.htc_addr;
|
||||
}
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF,
|
||||
"hif submit scatter request entries %d len %d mbox 0x%x %s %s\n",
|
||||
scat_req->scat_entries, scat_req->len,
|
||||
scat_req->addr, !read ? "async" : "sync",
|
||||
(read) ? "rd" : "wr");
|
||||
|
||||
if (!read && scat_req->virt_scat) {
|
||||
status = ath6kl_hif_cp_scat_dma_buf(scat_req, false);
|
||||
if (status) {
|
||||
scat_req->status = status;
|
||||
scat_req->complete(dev->ar->htc_target, scat_req);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
status = ath6kl_hif_scat_req_rw(dev->ar, scat_req);
|
||||
|
||||
if (read) {
|
||||
/* in sync mode, we can touch the scatter request */
|
||||
scat_req->status = status;
|
||||
if (!status && scat_req->virt_scat)
|
||||
scat_req->status =
|
||||
ath6kl_hif_cp_scat_dma_buf(scat_req, true);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static int ath6kl_hif_proc_counter_intr(struct ath6kl_device *dev)
|
||||
{
|
||||
u8 counter_int_status;
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_IRQ, "counter interrupt\n");
|
||||
|
||||
counter_int_status = dev->irq_proc_reg.counter_int_status &
|
||||
dev->irq_en_reg.cntr_int_status_en;
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_IRQ,
|
||||
"valid interrupt source(s) in COUNTER_INT_STATUS: 0x%x\n",
|
||||
counter_int_status);
|
||||
|
||||
/*
|
||||
* NOTE: other modules like GMBOX may use the counter interrupt for
|
||||
* credit flow control on other counters, we only need to check for
|
||||
* the debug assertion counter interrupt.
|
||||
*/
|
||||
if (counter_int_status & ATH6KL_TARGET_DEBUG_INTR_MASK)
|
||||
return ath6kl_hif_proc_dbg_intr(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ath6kl_hif_proc_err_intr(struct ath6kl_device *dev)
|
||||
{
|
||||
int status;
|
||||
u8 error_int_status;
|
||||
u8 reg_buf[4];
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_IRQ, "error interrupt\n");
|
||||
|
||||
error_int_status = dev->irq_proc_reg.error_int_status & 0x0F;
|
||||
if (!error_int_status) {
|
||||
WARN_ON(1);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_IRQ,
|
||||
"valid interrupt source(s) in ERROR_INT_STATUS: 0x%x\n",
|
||||
error_int_status);
|
||||
|
||||
if (MS(ERROR_INT_STATUS_WAKEUP, error_int_status))
|
||||
ath6kl_dbg(ATH6KL_DBG_IRQ, "error : wakeup\n");
|
||||
|
||||
if (MS(ERROR_INT_STATUS_RX_UNDERFLOW, error_int_status))
|
||||
ath6kl_err("rx underflow\n");
|
||||
|
||||
if (MS(ERROR_INT_STATUS_TX_OVERFLOW, error_int_status))
|
||||
ath6kl_err("tx overflow\n");
|
||||
|
||||
/* Clear the interrupt */
|
||||
dev->irq_proc_reg.error_int_status &= ~error_int_status;
|
||||
|
||||
/* set W1C value to clear the interrupt, this hits the register first */
|
||||
reg_buf[0] = error_int_status;
|
||||
reg_buf[1] = 0;
|
||||
reg_buf[2] = 0;
|
||||
reg_buf[3] = 0;
|
||||
|
||||
status = hif_read_write_sync(dev->ar, ERROR_INT_STATUS_ADDRESS,
|
||||
reg_buf, 4, HIF_WR_SYNC_BYTE_FIX);
|
||||
|
||||
if (status)
|
||||
WARN_ON(1);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static int ath6kl_hif_proc_cpu_intr(struct ath6kl_device *dev)
|
||||
{
|
||||
int status;
|
||||
u8 cpu_int_status;
|
||||
u8 reg_buf[4];
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_IRQ, "cpu interrupt\n");
|
||||
|
||||
cpu_int_status = dev->irq_proc_reg.cpu_int_status &
|
||||
dev->irq_en_reg.cpu_int_status_en;
|
||||
if (!cpu_int_status) {
|
||||
WARN_ON(1);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_IRQ,
|
||||
"valid interrupt source(s) in CPU_INT_STATUS: 0x%x\n",
|
||||
cpu_int_status);
|
||||
|
||||
/* Clear the interrupt */
|
||||
dev->irq_proc_reg.cpu_int_status &= ~cpu_int_status;
|
||||
|
||||
/*
|
||||
* Set up the register transfer buffer to hit the register 4 times ,
|
||||
* this is done to make the access 4-byte aligned to mitigate issues
|
||||
* with host bus interconnects that restrict bus transfer lengths to
|
||||
* be a multiple of 4-bytes.
|
||||
*/
|
||||
|
||||
/* set W1C value to clear the interrupt, this hits the register first */
|
||||
reg_buf[0] = cpu_int_status;
|
||||
/* the remaining are set to zero which have no-effect */
|
||||
reg_buf[1] = 0;
|
||||
reg_buf[2] = 0;
|
||||
reg_buf[3] = 0;
|
||||
|
||||
status = hif_read_write_sync(dev->ar, CPU_INT_STATUS_ADDRESS,
|
||||
reg_buf, 4, HIF_WR_SYNC_BYTE_FIX);
|
||||
|
||||
if (status)
|
||||
WARN_ON(1);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* process pending interrupts synchronously */
|
||||
static int proc_pending_irqs(struct ath6kl_device *dev, bool *done)
|
||||
{
|
||||
struct ath6kl_irq_proc_registers *rg;
|
||||
int status = 0;
|
||||
u8 host_int_status = 0;
|
||||
u32 lk_ahd = 0;
|
||||
u8 htc_mbox = 1 << HTC_MAILBOX;
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_IRQ, "proc_pending_irqs: (dev: 0x%p)\n", dev);
|
||||
|
||||
/*
|
||||
* NOTE: HIF implementation guarantees that the context of this
|
||||
* call allows us to perform SYNCHRONOUS I/O, that is we can block,
|
||||
* sleep or call any API that can block or switch thread/task
|
||||
* contexts. This is a fully schedulable context.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Process pending intr only when int_status_en is clear, it may
|
||||
* result in unnecessary bus transaction otherwise. Target may be
|
||||
* unresponsive at the time.
|
||||
*/
|
||||
if (dev->irq_en_reg.int_status_en) {
|
||||
/*
|
||||
* Read the first 28 bytes of the HTC register table. This
|
||||
* will yield us the value of different int status
|
||||
* registers and the lookahead registers.
|
||||
*
|
||||
* length = sizeof(int_status) + sizeof(cpu_int_status)
|
||||
* + sizeof(error_int_status) +
|
||||
* sizeof(counter_int_status) +
|
||||
* sizeof(mbox_frame) + sizeof(rx_lkahd_valid)
|
||||
* + sizeof(hole) + sizeof(rx_lkahd) +
|
||||
* sizeof(int_status_en) +
|
||||
* sizeof(cpu_int_status_en) +
|
||||
* sizeof(err_int_status_en) +
|
||||
* sizeof(cntr_int_status_en);
|
||||
*/
|
||||
status = hif_read_write_sync(dev->ar, HOST_INT_STATUS_ADDRESS,
|
||||
(u8 *) &dev->irq_proc_reg,
|
||||
sizeof(dev->irq_proc_reg),
|
||||
HIF_RD_SYNC_BYTE_INC);
|
||||
if (status)
|
||||
goto out;
|
||||
|
||||
if (AR_DBG_LVL_CHECK(ATH6KL_DBG_IRQ))
|
||||
ath6kl_dump_registers(dev, &dev->irq_proc_reg,
|
||||
&dev->irq_en_reg);
|
||||
|
||||
/* Update only those registers that are enabled */
|
||||
host_int_status = dev->irq_proc_reg.host_int_status &
|
||||
dev->irq_en_reg.int_status_en;
|
||||
|
||||
/* Look at mbox status */
|
||||
if (host_int_status & htc_mbox) {
|
||||
/*
|
||||
* Mask out pending mbox value, we use "lookAhead as
|
||||
* the real flag for mbox processing.
|
||||
*/
|
||||
host_int_status &= ~htc_mbox;
|
||||
if (dev->irq_proc_reg.rx_lkahd_valid &
|
||||
htc_mbox) {
|
||||
rg = &dev->irq_proc_reg;
|
||||
lk_ahd = le32_to_cpu(rg->rx_lkahd[HTC_MAILBOX]);
|
||||
if (!lk_ahd)
|
||||
ath6kl_err("lookAhead is zero!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!host_int_status && !lk_ahd) {
|
||||
*done = true;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (lk_ahd) {
|
||||
int fetched = 0;
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_IRQ,
|
||||
"pending mailbox msg, lk_ahd: 0x%X\n", lk_ahd);
|
||||
/*
|
||||
* Mailbox Interrupt, the HTC layer may issue async
|
||||
* requests to empty the mailbox. When emptying the recv
|
||||
* mailbox we use the async handler above called from the
|
||||
* completion routine of the callers read request. This can
|
||||
* improve performance by reducing context switching when
|
||||
* we rapidly pull packets.
|
||||
*/
|
||||
status = ath6kl_htc_rxmsg_pending_handler(dev->htc_cnxt,
|
||||
lk_ahd, &fetched);
|
||||
if (status)
|
||||
goto out;
|
||||
|
||||
if (!fetched)
|
||||
/*
|
||||
* HTC could not pull any messages out due to lack
|
||||
* of resources.
|
||||
*/
|
||||
dev->htc_cnxt->chk_irq_status_cnt = 0;
|
||||
}
|
||||
|
||||
/* now handle the rest of them */
|
||||
ath6kl_dbg(ATH6KL_DBG_IRQ,
|
||||
"valid interrupt source(s) for other interrupts: 0x%x\n",
|
||||
host_int_status);
|
||||
|
||||
if (MS(HOST_INT_STATUS_CPU, host_int_status)) {
|
||||
/* CPU Interrupt */
|
||||
status = ath6kl_hif_proc_cpu_intr(dev);
|
||||
if (status)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (MS(HOST_INT_STATUS_ERROR, host_int_status)) {
|
||||
/* Error Interrupt */
|
||||
status = ath6kl_hif_proc_err_intr(dev);
|
||||
if (status)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (MS(HOST_INT_STATUS_COUNTER, host_int_status))
|
||||
/* Counter Interrupt */
|
||||
status = ath6kl_hif_proc_counter_intr(dev);
|
||||
|
||||
out:
|
||||
/*
|
||||
* An optimization to bypass reading the IRQ status registers
|
||||
* unecessarily which can re-wake the target, if upper layers
|
||||
* determine that we are in a low-throughput mode, we can rely on
|
||||
* taking another interrupt rather than re-checking the status
|
||||
* registers which can re-wake the target.
|
||||
*
|
||||
* NOTE : for host interfaces that makes use of detecting pending
|
||||
* mbox messages at hif can not use this optimization due to
|
||||
* possible side effects, SPI requires the host to drain all
|
||||
* messages from the mailbox before exiting the ISR routine.
|
||||
*/
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_IRQ,
|
||||
"bypassing irq status re-check, forcing done\n");
|
||||
|
||||
if (!dev->htc_cnxt->chk_irq_status_cnt)
|
||||
*done = true;
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_IRQ,
|
||||
"proc_pending_irqs: (done:%d, status=%d\n", *done, status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* interrupt handler, kicks off all interrupt processing */
|
||||
int ath6kl_hif_intr_bh_handler(struct ath6kl *ar)
|
||||
{
|
||||
struct ath6kl_device *dev = ar->htc_target->dev;
|
||||
unsigned long timeout;
|
||||
int status = 0;
|
||||
bool done = false;
|
||||
|
||||
/*
|
||||
* Reset counter used to flag a re-scan of IRQ status registers on
|
||||
* the target.
|
||||
*/
|
||||
dev->htc_cnxt->chk_irq_status_cnt = 0;
|
||||
|
||||
/*
|
||||
* IRQ processing is synchronous, interrupt status registers can be
|
||||
* re-read.
|
||||
*/
|
||||
timeout = jiffies + msecs_to_jiffies(ATH6KL_HIF_COMMUNICATION_TIMEOUT);
|
||||
while (time_before(jiffies, timeout) && !done) {
|
||||
status = proc_pending_irqs(dev, &done);
|
||||
if (status)
|
||||
break;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static int ath6kl_hif_enable_intrs(struct ath6kl_device *dev)
|
||||
{
|
||||
struct ath6kl_irq_enable_reg regs;
|
||||
int status;
|
||||
|
||||
spin_lock_bh(&dev->lock);
|
||||
|
||||
/* Enable all but ATH6KL CPU interrupts */
|
||||
dev->irq_en_reg.int_status_en =
|
||||
SM(INT_STATUS_ENABLE_ERROR, 0x01) |
|
||||
SM(INT_STATUS_ENABLE_CPU, 0x01) |
|
||||
SM(INT_STATUS_ENABLE_COUNTER, 0x01);
|
||||
|
||||
/*
|
||||
* NOTE: There are some cases where HIF can do detection of
|
||||
* pending mbox messages which is disabled now.
|
||||
*/
|
||||
dev->irq_en_reg.int_status_en |= SM(INT_STATUS_ENABLE_MBOX_DATA, 0x01);
|
||||
|
||||
/* Set up the CPU Interrupt status Register */
|
||||
dev->irq_en_reg.cpu_int_status_en = 0;
|
||||
|
||||
/* Set up the Error Interrupt status Register */
|
||||
dev->irq_en_reg.err_int_status_en =
|
||||
SM(ERROR_STATUS_ENABLE_RX_UNDERFLOW, 0x01) |
|
||||
SM(ERROR_STATUS_ENABLE_TX_OVERFLOW, 0x1);
|
||||
|
||||
/*
|
||||
* Enable Counter interrupt status register to get fatal errors for
|
||||
* debugging.
|
||||
*/
|
||||
dev->irq_en_reg.cntr_int_status_en = SM(COUNTER_INT_STATUS_ENABLE_BIT,
|
||||
ATH6KL_TARGET_DEBUG_INTR_MASK);
|
||||
memcpy(®s, &dev->irq_en_reg, sizeof(regs));
|
||||
|
||||
spin_unlock_bh(&dev->lock);
|
||||
|
||||
status = hif_read_write_sync(dev->ar, INT_STATUS_ENABLE_ADDRESS,
|
||||
®s.int_status_en, sizeof(regs),
|
||||
HIF_WR_SYNC_BYTE_INC);
|
||||
|
||||
if (status)
|
||||
ath6kl_err("failed to update interrupt ctl reg err: %d\n",
|
||||
status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int ath6kl_hif_disable_intrs(struct ath6kl_device *dev)
|
||||
{
|
||||
struct ath6kl_irq_enable_reg regs;
|
||||
|
||||
spin_lock_bh(&dev->lock);
|
||||
/* Disable all interrupts */
|
||||
dev->irq_en_reg.int_status_en = 0;
|
||||
dev->irq_en_reg.cpu_int_status_en = 0;
|
||||
dev->irq_en_reg.err_int_status_en = 0;
|
||||
dev->irq_en_reg.cntr_int_status_en = 0;
|
||||
memcpy(®s, &dev->irq_en_reg, sizeof(regs));
|
||||
spin_unlock_bh(&dev->lock);
|
||||
|
||||
return hif_read_write_sync(dev->ar, INT_STATUS_ENABLE_ADDRESS,
|
||||
®s.int_status_en, sizeof(regs),
|
||||
HIF_WR_SYNC_BYTE_INC);
|
||||
}
|
||||
|
||||
/* enable device interrupts */
|
||||
int ath6kl_hif_unmask_intrs(struct ath6kl_device *dev)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
/*
|
||||
* Make sure interrupt are disabled before unmasking at the HIF
|
||||
* layer. The rationale here is that between device insertion
|
||||
* (where we clear the interrupts the first time) and when HTC
|
||||
* is finally ready to handle interrupts, other software can perform
|
||||
* target "soft" resets. The ATH6KL interrupt enables reset back to an
|
||||
* "enabled" state when this happens.
|
||||
*/
|
||||
ath6kl_hif_disable_intrs(dev);
|
||||
|
||||
/* unmask the host controller interrupts */
|
||||
ath6kl_hif_irq_enable(dev->ar);
|
||||
status = ath6kl_hif_enable_intrs(dev);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* disable all device interrupts */
|
||||
int ath6kl_hif_mask_intrs(struct ath6kl_device *dev)
|
||||
{
|
||||
/*
|
||||
* Mask the interrupt at the HIF layer to avoid any stray interrupt
|
||||
* taken while we zero out our shadow registers in
|
||||
* ath6kl_hif_disable_intrs().
|
||||
*/
|
||||
ath6kl_hif_irq_disable(dev->ar);
|
||||
|
||||
return ath6kl_hif_disable_intrs(dev);
|
||||
}
|
||||
|
||||
int ath6kl_hif_setup(struct ath6kl_device *dev)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
spin_lock_init(&dev->lock);
|
||||
|
||||
/*
|
||||
* NOTE: we actually get the block size of a mailbox other than 0,
|
||||
* for SDIO the block size on mailbox 0 is artificially set to 1.
|
||||
* So we use the block size that is set for the other 3 mailboxes.
|
||||
*/
|
||||
dev->htc_cnxt->block_sz = dev->ar->mbox_info.block_size;
|
||||
|
||||
/* must be a power of 2 */
|
||||
if ((dev->htc_cnxt->block_sz & (dev->htc_cnxt->block_sz - 1)) != 0) {
|
||||
WARN_ON(1);
|
||||
status = -EINVAL;
|
||||
goto fail_setup;
|
||||
}
|
||||
|
||||
/* assemble mask, used for padding to a block */
|
||||
dev->htc_cnxt->block_mask = dev->htc_cnxt->block_sz - 1;
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_HIF, "hif block size %d mbox addr 0x%x\n",
|
||||
dev->htc_cnxt->block_sz, dev->ar->mbox_info.htc_addr);
|
||||
|
||||
status = ath6kl_hif_disable_intrs(dev);
|
||||
|
||||
fail_setup:
|
||||
return status;
|
||||
|
||||
}
|
||||
|
|
@ -59,6 +59,18 @@
|
|||
/* mode to enable special 4-bit interrupt assertion without clock */
|
||||
#define SDIO_IRQ_MODE_ASYNC_4BIT_IRQ (1 << 0)
|
||||
|
||||
/* HTC runs over mailbox 0 */
|
||||
#define HTC_MAILBOX 0
|
||||
|
||||
#define ATH6KL_TARGET_DEBUG_INTR_MASK 0x01
|
||||
|
||||
/* FIXME: are these duplicates with MAX_SCATTER_ values in hif.h? */
|
||||
#define ATH6KL_SCATTER_ENTRIES_PER_REQ 16
|
||||
#define ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER (16 * 1024)
|
||||
#define ATH6KL_SCATTER_REQS 4
|
||||
|
||||
#define ATH6KL_HIF_COMMUNICATION_TIMEOUT 1000
|
||||
|
||||
struct bus_request {
|
||||
struct list_head list;
|
||||
|
||||
|
|
@ -186,6 +198,34 @@ struct hif_scatter_req {
|
|||
struct hif_scatter_item scat_list[1];
|
||||
};
|
||||
|
||||
struct ath6kl_irq_proc_registers {
|
||||
u8 host_int_status;
|
||||
u8 cpu_int_status;
|
||||
u8 error_int_status;
|
||||
u8 counter_int_status;
|
||||
u8 mbox_frame;
|
||||
u8 rx_lkahd_valid;
|
||||
u8 host_int_status2;
|
||||
u8 gmbox_rx_avail;
|
||||
__le32 rx_lkahd[2];
|
||||
__le32 rx_gmbox_lkahd_alias[2];
|
||||
} __packed;
|
||||
|
||||
struct ath6kl_irq_enable_reg {
|
||||
u8 int_status_en;
|
||||
u8 cpu_int_status_en;
|
||||
u8 err_int_status_en;
|
||||
u8 cntr_int_status_en;
|
||||
} __packed;
|
||||
|
||||
struct ath6kl_device {
|
||||
spinlock_t lock;
|
||||
struct ath6kl_irq_proc_registers irq_proc_reg;
|
||||
struct ath6kl_irq_enable_reg irq_en_reg;
|
||||
struct htc_target *htc_cnxt;
|
||||
struct ath6kl *ar;
|
||||
};
|
||||
|
||||
struct ath6kl_hif_ops {
|
||||
int (*read_write_sync)(struct ath6kl *ar, u32 addr, u8 *buf,
|
||||
u32 len, u32 request);
|
||||
|
|
@ -202,7 +242,26 @@ struct ath6kl_hif_ops {
|
|||
int (*scat_req_rw) (struct ath6kl *ar,
|
||||
struct hif_scatter_req *scat_req);
|
||||
void (*cleanup_scatter)(struct ath6kl *ar);
|
||||
int (*suspend)(struct ath6kl *ar);
|
||||
int (*suspend)(struct ath6kl *ar, struct cfg80211_wowlan *wow);
|
||||
int (*resume)(struct ath6kl *ar);
|
||||
int (*power_on)(struct ath6kl *ar);
|
||||
int (*power_off)(struct ath6kl *ar);
|
||||
void (*stop)(struct ath6kl *ar);
|
||||
};
|
||||
|
||||
int ath6kl_hif_setup(struct ath6kl_device *dev);
|
||||
int ath6kl_hif_unmask_intrs(struct ath6kl_device *dev);
|
||||
int ath6kl_hif_mask_intrs(struct ath6kl_device *dev);
|
||||
int ath6kl_hif_poll_mboxmsg_rx(struct ath6kl_device *dev,
|
||||
u32 *lk_ahd, int timeout);
|
||||
int ath6kl_hif_rx_control(struct ath6kl_device *dev, bool enable_rx);
|
||||
int ath6kl_hif_disable_intrs(struct ath6kl_device *dev);
|
||||
|
||||
int ath6kl_hif_rw_comp_handler(void *context, int status);
|
||||
int ath6kl_hif_intr_bh_handler(struct ath6kl *ar);
|
||||
|
||||
/* Scatter Function and Definitions */
|
||||
int ath6kl_hif_submit_scat_req(struct ath6kl_device *dev,
|
||||
struct hif_scatter_req *scat_req, bool read);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -393,7 +393,7 @@ struct htc_endpoint_credit_dist {
|
|||
int cred_per_msg;
|
||||
|
||||
/* reserved for HTC use */
|
||||
void *htc_rsvd;
|
||||
struct htc_endpoint *htc_ep;
|
||||
|
||||
/*
|
||||
* current depth of TX queue , i.e. messages waiting for credits
|
||||
|
|
@ -414,9 +414,11 @@ enum htc_credit_dist_reason {
|
|||
HTC_CREDIT_DIST_SEEK_CREDITS,
|
||||
};
|
||||
|
||||
struct htc_credit_state_info {
|
||||
struct ath6kl_htc_credit_info {
|
||||
int total_avail_credits;
|
||||
int cur_free_credits;
|
||||
|
||||
/* list of lowest priority endpoints */
|
||||
struct list_head lowestpri_ep_dist;
|
||||
};
|
||||
|
||||
|
|
@ -508,10 +510,13 @@ struct ath6kl_device;
|
|||
/* our HTC target state */
|
||||
struct htc_target {
|
||||
struct htc_endpoint endpoint[ENDPOINT_MAX];
|
||||
|
||||
/* contains struct htc_endpoint_credit_dist */
|
||||
struct list_head cred_dist_list;
|
||||
|
||||
struct list_head free_ctrl_txbuf;
|
||||
struct list_head free_ctrl_rxbuf;
|
||||
struct htc_credit_state_info *cred_dist_cntxt;
|
||||
struct ath6kl_htc_credit_info *credit_info;
|
||||
int tgt_creds;
|
||||
unsigned int tgt_cred_sz;
|
||||
spinlock_t htc_lock;
|
||||
|
|
@ -542,7 +547,7 @@ struct htc_target {
|
|||
|
||||
void *ath6kl_htc_create(struct ath6kl *ar);
|
||||
void ath6kl_htc_set_credit_dist(struct htc_target *target,
|
||||
struct htc_credit_state_info *cred_info,
|
||||
struct ath6kl_htc_credit_info *cred_info,
|
||||
u16 svc_pri_order[], int len);
|
||||
int ath6kl_htc_wait_target(struct htc_target *target);
|
||||
int ath6kl_htc_start(struct htc_target *target);
|
||||
|
|
@ -563,7 +568,10 @@ int ath6kl_htc_get_rxbuf_num(struct htc_target *target,
|
|||
int ath6kl_htc_add_rxbuf_multiple(struct htc_target *target,
|
||||
struct list_head *pktq);
|
||||
int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target,
|
||||
u32 msg_look_ahead[], int *n_pkts);
|
||||
u32 msg_look_ahead, int *n_pkts);
|
||||
|
||||
int ath6kl_credit_setup(void *htc_handle,
|
||||
struct ath6kl_htc_credit_info *cred_info);
|
||||
|
||||
static inline void set_htc_pkt_info(struct htc_packet *packet, void *context,
|
||||
u8 *buf, unsigned int len,
|
||||
|
|
|
|||
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2007-2011 Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef HTC_HIF_H
|
||||
#define HTC_HIF_H
|
||||
|
||||
#include "htc.h"
|
||||
#include "hif.h"
|
||||
|
||||
#define ATH6KL_MAILBOXES 4
|
||||
|
||||
/* HTC runs over mailbox 0 */
|
||||
#define HTC_MAILBOX 0
|
||||
|
||||
#define ATH6KL_TARGET_DEBUG_INTR_MASK 0x01
|
||||
|
||||
#define OTHER_INTS_ENABLED (INT_STATUS_ENABLE_ERROR_MASK | \
|
||||
INT_STATUS_ENABLE_CPU_MASK | \
|
||||
INT_STATUS_ENABLE_COUNTER_MASK)
|
||||
|
||||
#define ATH6KL_REG_IO_BUFFER_SIZE 32
|
||||
#define ATH6KL_MAX_REG_IO_BUFFERS 8
|
||||
#define ATH6KL_SCATTER_ENTRIES_PER_REQ 16
|
||||
#define ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER (16 * 1024)
|
||||
#define ATH6KL_SCATTER_REQS 4
|
||||
|
||||
#ifndef A_CACHE_LINE_PAD
|
||||
#define A_CACHE_LINE_PAD 128
|
||||
#endif
|
||||
#define ATH6KL_MIN_SCATTER_ENTRIES_PER_REQ 2
|
||||
#define ATH6KL_MIN_TRANSFER_SIZE_PER_SCATTER (4 * 1024)
|
||||
|
||||
struct ath6kl_irq_proc_registers {
|
||||
u8 host_int_status;
|
||||
u8 cpu_int_status;
|
||||
u8 error_int_status;
|
||||
u8 counter_int_status;
|
||||
u8 mbox_frame;
|
||||
u8 rx_lkahd_valid;
|
||||
u8 host_int_status2;
|
||||
u8 gmbox_rx_avail;
|
||||
__le32 rx_lkahd[2];
|
||||
__le32 rx_gmbox_lkahd_alias[2];
|
||||
} __packed;
|
||||
|
||||
struct ath6kl_irq_enable_reg {
|
||||
u8 int_status_en;
|
||||
u8 cpu_int_status_en;
|
||||
u8 err_int_status_en;
|
||||
u8 cntr_int_status_en;
|
||||
} __packed;
|
||||
|
||||
struct ath6kl_device {
|
||||
spinlock_t lock;
|
||||
u8 pad1[A_CACHE_LINE_PAD];
|
||||
struct ath6kl_irq_proc_registers irq_proc_reg;
|
||||
u8 pad2[A_CACHE_LINE_PAD];
|
||||
struct ath6kl_irq_enable_reg irq_en_reg;
|
||||
u8 pad3[A_CACHE_LINE_PAD];
|
||||
struct htc_target *htc_cnxt;
|
||||
struct ath6kl *ar;
|
||||
};
|
||||
|
||||
int ath6kldev_setup(struct ath6kl_device *dev);
|
||||
int ath6kldev_unmask_intrs(struct ath6kl_device *dev);
|
||||
int ath6kldev_mask_intrs(struct ath6kl_device *dev);
|
||||
int ath6kldev_poll_mboxmsg_rx(struct ath6kl_device *dev,
|
||||
u32 *lk_ahd, int timeout);
|
||||
int ath6kldev_rx_control(struct ath6kl_device *dev, bool enable_rx);
|
||||
int ath6kldev_disable_intrs(struct ath6kl_device *dev);
|
||||
|
||||
int ath6kldev_rw_comp_handler(void *context, int status);
|
||||
int ath6kldev_intr_bh_handler(struct ath6kl *ar);
|
||||
|
||||
/* Scatter Function and Definitions */
|
||||
int ath6kldev_submit_scat_req(struct ath6kl_device *dev,
|
||||
struct hif_scatter_req *scat_req, bool read);
|
||||
|
||||
#endif /*ATH6KL_H_ */
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -20,12 +20,13 @@
|
|||
#include "target.h"
|
||||
#include "debug.h"
|
||||
|
||||
struct ath6kl_sta *ath6kl_find_sta(struct ath6kl *ar, u8 *node_addr)
|
||||
struct ath6kl_sta *ath6kl_find_sta(struct ath6kl_vif *vif, u8 *node_addr)
|
||||
{
|
||||
struct ath6kl *ar = vif->ar;
|
||||
struct ath6kl_sta *conn = NULL;
|
||||
u8 i, max_conn;
|
||||
|
||||
max_conn = (ar->nw_type == AP_NETWORK) ? AP_MAX_NUM_STA : 0;
|
||||
max_conn = (vif->nw_type == AP_NETWORK) ? AP_MAX_NUM_STA : 0;
|
||||
|
||||
for (i = 0; i < max_conn; i++) {
|
||||
if (memcmp(node_addr, ar->sta_list[i].mac, ETH_ALEN) == 0) {
|
||||
|
|
@ -393,8 +394,8 @@ out:
|
|||
#define AR6003_RESET_CONTROL_ADDRESS 0x00004000
|
||||
#define AR6004_RESET_CONTROL_ADDRESS 0x00004000
|
||||
|
||||
static void ath6kl_reset_device(struct ath6kl *ar, u32 target_type,
|
||||
bool wait_fot_compltn, bool cold_reset)
|
||||
void ath6kl_reset_device(struct ath6kl *ar, u32 target_type,
|
||||
bool wait_fot_compltn, bool cold_reset)
|
||||
{
|
||||
int status = 0;
|
||||
u32 address;
|
||||
|
|
@ -425,102 +426,33 @@ static void ath6kl_reset_device(struct ath6kl *ar, u32 target_type,
|
|||
ath6kl_err("failed to reset target\n");
|
||||
}
|
||||
|
||||
void ath6kl_stop_endpoint(struct net_device *dev, bool keep_profile,
|
||||
bool get_dbglogs)
|
||||
{
|
||||
struct ath6kl *ar = ath6kl_priv(dev);
|
||||
static u8 bcast_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
bool discon_issued;
|
||||
|
||||
netif_stop_queue(dev);
|
||||
|
||||
/* disable the target and the interrupts associated with it */
|
||||
if (test_bit(WMI_READY, &ar->flag)) {
|
||||
discon_issued = (test_bit(CONNECTED, &ar->flag) ||
|
||||
test_bit(CONNECT_PEND, &ar->flag));
|
||||
ath6kl_disconnect(ar);
|
||||
if (!keep_profile)
|
||||
ath6kl_init_profile_info(ar);
|
||||
|
||||
del_timer(&ar->disconnect_timer);
|
||||
|
||||
clear_bit(WMI_READY, &ar->flag);
|
||||
ath6kl_wmi_shutdown(ar->wmi);
|
||||
clear_bit(WMI_ENABLED, &ar->flag);
|
||||
ar->wmi = NULL;
|
||||
|
||||
/*
|
||||
* After wmi_shudown all WMI events will be dropped. We
|
||||
* need to cleanup the buffers allocated in AP mode and
|
||||
* give disconnect notification to stack, which usually
|
||||
* happens in the disconnect_event. Simulate the disconnect
|
||||
* event by calling the function directly. Sometimes
|
||||
* disconnect_event will be received when the debug logs
|
||||
* are collected.
|
||||
*/
|
||||
if (discon_issued)
|
||||
ath6kl_disconnect_event(ar, DISCONNECT_CMD,
|
||||
(ar->nw_type & AP_NETWORK) ?
|
||||
bcast_mac : ar->bssid,
|
||||
0, NULL, 0);
|
||||
|
||||
ar->user_key_ctrl = 0;
|
||||
|
||||
} else {
|
||||
ath6kl_dbg(ATH6KL_DBG_TRC,
|
||||
"%s: wmi is not ready 0x%p 0x%p\n",
|
||||
__func__, ar, ar->wmi);
|
||||
|
||||
/* Shut down WMI if we have started it */
|
||||
if (test_bit(WMI_ENABLED, &ar->flag)) {
|
||||
ath6kl_dbg(ATH6KL_DBG_TRC,
|
||||
"%s: shut down wmi\n", __func__);
|
||||
ath6kl_wmi_shutdown(ar->wmi);
|
||||
clear_bit(WMI_ENABLED, &ar->flag);
|
||||
ar->wmi = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (ar->htc_target) {
|
||||
ath6kl_dbg(ATH6KL_DBG_TRC, "%s: shut down htc\n", __func__);
|
||||
ath6kl_htc_stop(ar->htc_target);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to reset the device if we can. The driver may have been
|
||||
* configure NOT to reset the target during a debug session.
|
||||
*/
|
||||
ath6kl_dbg(ATH6KL_DBG_TRC,
|
||||
"attempting to reset target on instance destroy\n");
|
||||
ath6kl_reset_device(ar, ar->target_type, true, true);
|
||||
}
|
||||
|
||||
static void ath6kl_install_static_wep_keys(struct ath6kl *ar)
|
||||
static void ath6kl_install_static_wep_keys(struct ath6kl_vif *vif)
|
||||
{
|
||||
u8 index;
|
||||
u8 keyusage;
|
||||
|
||||
for (index = WMI_MIN_KEY_INDEX; index <= WMI_MAX_KEY_INDEX; index++) {
|
||||
if (ar->wep_key_list[index].key_len) {
|
||||
if (vif->wep_key_list[index].key_len) {
|
||||
keyusage = GROUP_USAGE;
|
||||
if (index == ar->def_txkey_index)
|
||||
if (index == vif->def_txkey_index)
|
||||
keyusage |= TX_USAGE;
|
||||
|
||||
ath6kl_wmi_addkey_cmd(ar->wmi,
|
||||
ath6kl_wmi_addkey_cmd(vif->ar->wmi, vif->fw_vif_idx,
|
||||
index,
|
||||
WEP_CRYPT,
|
||||
keyusage,
|
||||
ar->wep_key_list[index].key_len,
|
||||
NULL,
|
||||
ar->wep_key_list[index].key,
|
||||
vif->wep_key_list[index].key_len,
|
||||
NULL, 0,
|
||||
vif->wep_key_list[index].key,
|
||||
KEY_OP_INIT_VAL, NULL,
|
||||
NO_SYNC_WMIFLAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ath6kl_connect_ap_mode_bss(struct ath6kl *ar, u16 channel)
|
||||
void ath6kl_connect_ap_mode_bss(struct ath6kl_vif *vif, u16 channel)
|
||||
{
|
||||
struct ath6kl *ar = vif->ar;
|
||||
struct ath6kl_req_key *ik;
|
||||
int res;
|
||||
u8 key_rsc[ATH6KL_KEY_SEQ_LEN];
|
||||
|
|
@ -529,10 +461,10 @@ void ath6kl_connect_ap_mode_bss(struct ath6kl *ar, u16 channel)
|
|||
|
||||
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "AP mode started on %u MHz\n", channel);
|
||||
|
||||
switch (ar->auth_mode) {
|
||||
switch (vif->auth_mode) {
|
||||
case NONE_AUTH:
|
||||
if (ar->prwise_crypto == WEP_CRYPT)
|
||||
ath6kl_install_static_wep_keys(ar);
|
||||
if (vif->prwise_crypto == WEP_CRYPT)
|
||||
ath6kl_install_static_wep_keys(vif);
|
||||
break;
|
||||
case WPA_PSK_AUTH:
|
||||
case WPA2_PSK_AUTH:
|
||||
|
|
@ -544,8 +476,9 @@ void ath6kl_connect_ap_mode_bss(struct ath6kl *ar, u16 channel)
|
|||
"the initial group key for AP mode\n");
|
||||
memset(key_rsc, 0, sizeof(key_rsc));
|
||||
res = ath6kl_wmi_addkey_cmd(
|
||||
ar->wmi, ik->key_index, ik->key_type,
|
||||
GROUP_USAGE, ik->key_len, key_rsc, ik->key,
|
||||
ar->wmi, vif->fw_vif_idx, ik->key_index, ik->key_type,
|
||||
GROUP_USAGE, ik->key_len, key_rsc, ATH6KL_KEY_SEQ_LEN,
|
||||
ik->key,
|
||||
KEY_OP_INIT_VAL, NULL, SYNC_BOTH_WMIFLAG);
|
||||
if (res) {
|
||||
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "Delayed "
|
||||
|
|
@ -554,15 +487,16 @@ void ath6kl_connect_ap_mode_bss(struct ath6kl *ar, u16 channel)
|
|||
break;
|
||||
}
|
||||
|
||||
ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0);
|
||||
set_bit(CONNECTED, &ar->flag);
|
||||
netif_carrier_on(ar->net_dev);
|
||||
ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, NONE_BSS_FILTER, 0);
|
||||
set_bit(CONNECTED, &vif->flags);
|
||||
netif_carrier_on(vif->ndev);
|
||||
}
|
||||
|
||||
void ath6kl_connect_ap_mode_sta(struct ath6kl *ar, u16 aid, u8 *mac_addr,
|
||||
void ath6kl_connect_ap_mode_sta(struct ath6kl_vif *vif, u16 aid, u8 *mac_addr,
|
||||
u8 keymgmt, u8 ucipher, u8 auth,
|
||||
u8 assoc_req_len, u8 *assoc_info)
|
||||
{
|
||||
struct ath6kl *ar = vif->ar;
|
||||
u8 *ies = NULL, *wpa_ie = NULL, *pos;
|
||||
size_t ies_len = 0;
|
||||
struct station_info sinfo;
|
||||
|
|
@ -617,350 +551,34 @@ void ath6kl_connect_ap_mode_sta(struct ath6kl *ar, u16 aid, u8 *mac_addr,
|
|||
sinfo.assoc_req_ies_len = ies_len;
|
||||
sinfo.filled |= STATION_INFO_ASSOC_REQ_IES;
|
||||
|
||||
cfg80211_new_sta(ar->net_dev, mac_addr, &sinfo, GFP_KERNEL);
|
||||
cfg80211_new_sta(vif->ndev, mac_addr, &sinfo, GFP_KERNEL);
|
||||
|
||||
netif_wake_queue(ar->net_dev);
|
||||
}
|
||||
|
||||
/* Functions for Tx credit handling */
|
||||
void ath6k_credit_init(struct htc_credit_state_info *cred_info,
|
||||
struct list_head *ep_list,
|
||||
int tot_credits)
|
||||
{
|
||||
struct htc_endpoint_credit_dist *cur_ep_dist;
|
||||
int count;
|
||||
|
||||
cred_info->cur_free_credits = tot_credits;
|
||||
cred_info->total_avail_credits = tot_credits;
|
||||
|
||||
list_for_each_entry(cur_ep_dist, ep_list, list) {
|
||||
if (cur_ep_dist->endpoint == ENDPOINT_0)
|
||||
continue;
|
||||
|
||||
cur_ep_dist->cred_min = cur_ep_dist->cred_per_msg;
|
||||
|
||||
if (tot_credits > 4)
|
||||
if ((cur_ep_dist->svc_id == WMI_DATA_BK_SVC) ||
|
||||
(cur_ep_dist->svc_id == WMI_DATA_BE_SVC)) {
|
||||
ath6kl_deposit_credit_to_ep(cred_info,
|
||||
cur_ep_dist,
|
||||
cur_ep_dist->cred_min);
|
||||
cur_ep_dist->dist_flags |= HTC_EP_ACTIVE;
|
||||
}
|
||||
|
||||
if (cur_ep_dist->svc_id == WMI_CONTROL_SVC) {
|
||||
ath6kl_deposit_credit_to_ep(cred_info, cur_ep_dist,
|
||||
cur_ep_dist->cred_min);
|
||||
/*
|
||||
* Control service is always marked active, it
|
||||
* never goes inactive EVER.
|
||||
*/
|
||||
cur_ep_dist->dist_flags |= HTC_EP_ACTIVE;
|
||||
} else if (cur_ep_dist->svc_id == WMI_DATA_BK_SVC)
|
||||
/* this is the lowest priority data endpoint */
|
||||
cred_info->lowestpri_ep_dist = cur_ep_dist->list;
|
||||
|
||||
/*
|
||||
* Streams have to be created (explicit | implicit) for all
|
||||
* kinds of traffic. BE endpoints are also inactive in the
|
||||
* beginning. When BE traffic starts it creates implicit
|
||||
* streams that redistributes credits.
|
||||
*
|
||||
* Note: all other endpoints have minimums set but are
|
||||
* initially given NO credits. credits will be distributed
|
||||
* as traffic activity demands
|
||||
*/
|
||||
}
|
||||
|
||||
WARN_ON(cred_info->cur_free_credits <= 0);
|
||||
|
||||
list_for_each_entry(cur_ep_dist, ep_list, list) {
|
||||
if (cur_ep_dist->endpoint == ENDPOINT_0)
|
||||
continue;
|
||||
|
||||
if (cur_ep_dist->svc_id == WMI_CONTROL_SVC)
|
||||
cur_ep_dist->cred_norm = cur_ep_dist->cred_per_msg;
|
||||
else {
|
||||
/*
|
||||
* For the remaining data endpoints, we assume that
|
||||
* each cred_per_msg are the same. We use a simple
|
||||
* calculation here, we take the remaining credits
|
||||
* and determine how many max messages this can
|
||||
* cover and then set each endpoint's normal value
|
||||
* equal to 3/4 this amount.
|
||||
*/
|
||||
count = (cred_info->cur_free_credits /
|
||||
cur_ep_dist->cred_per_msg)
|
||||
* cur_ep_dist->cred_per_msg;
|
||||
count = (count * 3) >> 2;
|
||||
count = max(count, cur_ep_dist->cred_per_msg);
|
||||
cur_ep_dist->cred_norm = count;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize and setup credit distribution */
|
||||
int ath6k_setup_credit_dist(void *htc_handle,
|
||||
struct htc_credit_state_info *cred_info)
|
||||
{
|
||||
u16 servicepriority[5];
|
||||
|
||||
memset(cred_info, 0, sizeof(struct htc_credit_state_info));
|
||||
|
||||
servicepriority[0] = WMI_CONTROL_SVC; /* highest */
|
||||
servicepriority[1] = WMI_DATA_VO_SVC;
|
||||
servicepriority[2] = WMI_DATA_VI_SVC;
|
||||
servicepriority[3] = WMI_DATA_BE_SVC;
|
||||
servicepriority[4] = WMI_DATA_BK_SVC; /* lowest */
|
||||
|
||||
/* set priority list */
|
||||
ath6kl_htc_set_credit_dist(htc_handle, cred_info, servicepriority, 5);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* reduce an ep's credits back to a set limit */
|
||||
static void ath6k_reduce_credits(struct htc_credit_state_info *cred_info,
|
||||
struct htc_endpoint_credit_dist *ep_dist,
|
||||
int limit)
|
||||
{
|
||||
int credits;
|
||||
|
||||
ep_dist->cred_assngd = limit;
|
||||
|
||||
if (ep_dist->credits <= limit)
|
||||
return;
|
||||
|
||||
credits = ep_dist->credits - limit;
|
||||
ep_dist->credits -= credits;
|
||||
cred_info->cur_free_credits += credits;
|
||||
}
|
||||
|
||||
static void ath6k_credit_update(struct htc_credit_state_info *cred_info,
|
||||
struct list_head *epdist_list)
|
||||
{
|
||||
struct htc_endpoint_credit_dist *cur_dist_list;
|
||||
|
||||
list_for_each_entry(cur_dist_list, epdist_list, list) {
|
||||
if (cur_dist_list->endpoint == ENDPOINT_0)
|
||||
continue;
|
||||
|
||||
if (cur_dist_list->cred_to_dist > 0) {
|
||||
cur_dist_list->credits +=
|
||||
cur_dist_list->cred_to_dist;
|
||||
cur_dist_list->cred_to_dist = 0;
|
||||
if (cur_dist_list->credits >
|
||||
cur_dist_list->cred_assngd)
|
||||
ath6k_reduce_credits(cred_info,
|
||||
cur_dist_list,
|
||||
cur_dist_list->cred_assngd);
|
||||
|
||||
if (cur_dist_list->credits >
|
||||
cur_dist_list->cred_norm)
|
||||
ath6k_reduce_credits(cred_info, cur_dist_list,
|
||||
cur_dist_list->cred_norm);
|
||||
|
||||
if (!(cur_dist_list->dist_flags & HTC_EP_ACTIVE)) {
|
||||
if (cur_dist_list->txq_depth == 0)
|
||||
ath6k_reduce_credits(cred_info,
|
||||
cur_dist_list, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* HTC has an endpoint that needs credits, ep_dist is the endpoint in
|
||||
* question.
|
||||
*/
|
||||
void ath6k_seek_credits(struct htc_credit_state_info *cred_info,
|
||||
struct htc_endpoint_credit_dist *ep_dist)
|
||||
{
|
||||
struct htc_endpoint_credit_dist *curdist_list;
|
||||
int credits = 0;
|
||||
int need;
|
||||
|
||||
if (ep_dist->svc_id == WMI_CONTROL_SVC)
|
||||
goto out;
|
||||
|
||||
if ((ep_dist->svc_id == WMI_DATA_VI_SVC) ||
|
||||
(ep_dist->svc_id == WMI_DATA_VO_SVC))
|
||||
if ((ep_dist->cred_assngd >= ep_dist->cred_norm))
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* For all other services, we follow a simple algorithm of:
|
||||
*
|
||||
* 1. checking the free pool for credits
|
||||
* 2. checking lower priority endpoints for credits to take
|
||||
*/
|
||||
|
||||
credits = min(cred_info->cur_free_credits, ep_dist->seek_cred);
|
||||
|
||||
if (credits >= ep_dist->seek_cred)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* We don't have enough in the free pool, try taking away from
|
||||
* lower priority services The rule for taking away credits:
|
||||
*
|
||||
* 1. Only take from lower priority endpoints
|
||||
* 2. Only take what is allocated above the minimum (never
|
||||
* starve an endpoint completely)
|
||||
* 3. Only take what you need.
|
||||
*/
|
||||
|
||||
list_for_each_entry_reverse(curdist_list,
|
||||
&cred_info->lowestpri_ep_dist,
|
||||
list) {
|
||||
if (curdist_list == ep_dist)
|
||||
break;
|
||||
|
||||
need = ep_dist->seek_cred - cred_info->cur_free_credits;
|
||||
|
||||
if ((curdist_list->cred_assngd - need) >=
|
||||
curdist_list->cred_min) {
|
||||
/*
|
||||
* The current one has been allocated more than
|
||||
* it's minimum and it has enough credits assigned
|
||||
* above it's minimum to fulfill our need try to
|
||||
* take away just enough to fulfill our need.
|
||||
*/
|
||||
ath6k_reduce_credits(cred_info, curdist_list,
|
||||
curdist_list->cred_assngd - need);
|
||||
|
||||
if (cred_info->cur_free_credits >=
|
||||
ep_dist->seek_cred)
|
||||
break;
|
||||
}
|
||||
|
||||
if (curdist_list->endpoint == ENDPOINT_0)
|
||||
break;
|
||||
}
|
||||
|
||||
credits = min(cred_info->cur_free_credits, ep_dist->seek_cred);
|
||||
|
||||
out:
|
||||
/* did we find some credits? */
|
||||
if (credits)
|
||||
ath6kl_deposit_credit_to_ep(cred_info, ep_dist, credits);
|
||||
|
||||
ep_dist->seek_cred = 0;
|
||||
}
|
||||
|
||||
/* redistribute credits based on activity change */
|
||||
static void ath6k_redistribute_credits(struct htc_credit_state_info *info,
|
||||
struct list_head *ep_dist_list)
|
||||
{
|
||||
struct htc_endpoint_credit_dist *curdist_list;
|
||||
|
||||
list_for_each_entry(curdist_list, ep_dist_list, list) {
|
||||
if (curdist_list->endpoint == ENDPOINT_0)
|
||||
continue;
|
||||
|
||||
if ((curdist_list->svc_id == WMI_DATA_BK_SVC) ||
|
||||
(curdist_list->svc_id == WMI_DATA_BE_SVC))
|
||||
curdist_list->dist_flags |= HTC_EP_ACTIVE;
|
||||
|
||||
if ((curdist_list->svc_id != WMI_CONTROL_SVC) &&
|
||||
!(curdist_list->dist_flags & HTC_EP_ACTIVE)) {
|
||||
if (curdist_list->txq_depth == 0)
|
||||
ath6k_reduce_credits(info,
|
||||
curdist_list, 0);
|
||||
else
|
||||
ath6k_reduce_credits(info,
|
||||
curdist_list,
|
||||
curdist_list->cred_min);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* This function is invoked whenever endpoints require credit
|
||||
* distributions. A lock is held while this function is invoked, this
|
||||
* function shall NOT block. The ep_dist_list is a list of distribution
|
||||
* structures in prioritized order as defined by the call to the
|
||||
* htc_set_credit_dist() api.
|
||||
*/
|
||||
void ath6k_credit_distribute(struct htc_credit_state_info *cred_info,
|
||||
struct list_head *ep_dist_list,
|
||||
enum htc_credit_dist_reason reason)
|
||||
{
|
||||
switch (reason) {
|
||||
case HTC_CREDIT_DIST_SEND_COMPLETE:
|
||||
ath6k_credit_update(cred_info, ep_dist_list);
|
||||
break;
|
||||
case HTC_CREDIT_DIST_ACTIVITY_CHANGE:
|
||||
ath6k_redistribute_credits(cred_info, ep_dist_list);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
WARN_ON(cred_info->cur_free_credits > cred_info->total_avail_credits);
|
||||
WARN_ON(cred_info->cur_free_credits < 0);
|
||||
netif_wake_queue(vif->ndev);
|
||||
}
|
||||
|
||||
void disconnect_timer_handler(unsigned long ptr)
|
||||
{
|
||||
struct net_device *dev = (struct net_device *)ptr;
|
||||
struct ath6kl *ar = ath6kl_priv(dev);
|
||||
struct ath6kl_vif *vif = netdev_priv(dev);
|
||||
|
||||
ath6kl_init_profile_info(ar);
|
||||
ath6kl_disconnect(ar);
|
||||
ath6kl_init_profile_info(vif);
|
||||
ath6kl_disconnect(vif);
|
||||
}
|
||||
|
||||
void ath6kl_disconnect(struct ath6kl *ar)
|
||||
void ath6kl_disconnect(struct ath6kl_vif *vif)
|
||||
{
|
||||
if (test_bit(CONNECTED, &ar->flag) ||
|
||||
test_bit(CONNECT_PEND, &ar->flag)) {
|
||||
ath6kl_wmi_disconnect_cmd(ar->wmi);
|
||||
if (test_bit(CONNECTED, &vif->flags) ||
|
||||
test_bit(CONNECT_PEND, &vif->flags)) {
|
||||
ath6kl_wmi_disconnect_cmd(vif->ar->wmi, vif->fw_vif_idx);
|
||||
/*
|
||||
* Disconnect command is issued, clear the connect pending
|
||||
* flag. The connected flag will be cleared in
|
||||
* disconnect event notification.
|
||||
*/
|
||||
clear_bit(CONNECT_PEND, &ar->flag);
|
||||
clear_bit(CONNECT_PEND, &vif->flags);
|
||||
}
|
||||
}
|
||||
|
||||
void ath6kl_deep_sleep_enable(struct ath6kl *ar)
|
||||
{
|
||||
switch (ar->sme_state) {
|
||||
case SME_CONNECTING:
|
||||
cfg80211_connect_result(ar->net_dev, ar->bssid, NULL, 0,
|
||||
NULL, 0,
|
||||
WLAN_STATUS_UNSPECIFIED_FAILURE,
|
||||
GFP_KERNEL);
|
||||
break;
|
||||
case SME_CONNECTED:
|
||||
default:
|
||||
/*
|
||||
* FIXME: oddly enough smeState is in DISCONNECTED during
|
||||
* suspend, why? Need to send disconnected event in that
|
||||
* state.
|
||||
*/
|
||||
cfg80211_disconnected(ar->net_dev, 0, NULL, 0, GFP_KERNEL);
|
||||
break;
|
||||
}
|
||||
|
||||
if (test_bit(CONNECTED, &ar->flag) ||
|
||||
test_bit(CONNECT_PEND, &ar->flag))
|
||||
ath6kl_wmi_disconnect_cmd(ar->wmi);
|
||||
|
||||
ar->sme_state = SME_DISCONNECTED;
|
||||
|
||||
/* disable scanning */
|
||||
if (ath6kl_wmi_scanparams_cmd(ar->wmi, 0xFFFF, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0) != 0)
|
||||
printk(KERN_WARNING "ath6kl: failed to disable scan "
|
||||
"during suspend\n");
|
||||
|
||||
ath6kl_cfg80211_scan_complete_event(ar, -ECANCELED);
|
||||
}
|
||||
|
||||
/* WMI Event handlers */
|
||||
|
||||
static const char *get_hw_id_string(u32 id)
|
||||
|
|
@ -980,17 +598,16 @@ static const char *get_hw_id_string(u32 id)
|
|||
void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver)
|
||||
{
|
||||
struct ath6kl *ar = devt;
|
||||
struct net_device *dev = ar->net_dev;
|
||||
|
||||
memcpy(dev->dev_addr, datap, ETH_ALEN);
|
||||
memcpy(ar->mac_addr, datap, ETH_ALEN);
|
||||
ath6kl_dbg(ATH6KL_DBG_TRC, "%s: mac addr = %pM\n",
|
||||
__func__, dev->dev_addr);
|
||||
__func__, ar->mac_addr);
|
||||
|
||||
ar->version.wlan_ver = sw_ver;
|
||||
ar->version.abi_ver = abi_ver;
|
||||
|
||||
snprintf(ar->wdev->wiphy->fw_version,
|
||||
sizeof(ar->wdev->wiphy->fw_version),
|
||||
snprintf(ar->wiphy->fw_version,
|
||||
sizeof(ar->wiphy->fw_version),
|
||||
"%u.%u.%u.%u",
|
||||
(ar->version.wlan_ver & 0xf0000000) >> 28,
|
||||
(ar->version.wlan_ver & 0x0f000000) >> 24,
|
||||
|
|
@ -1001,78 +618,91 @@ void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver)
|
|||
set_bit(WMI_READY, &ar->flag);
|
||||
wake_up(&ar->event_wq);
|
||||
|
||||
ath6kl_info("hw %s fw %s%s\n",
|
||||
get_hw_id_string(ar->wdev->wiphy->hw_version),
|
||||
ar->wdev->wiphy->fw_version,
|
||||
test_bit(TESTMODE, &ar->flag) ? " testmode" : "");
|
||||
if (test_and_clear_bit(FIRST_BOOT, &ar->flag)) {
|
||||
ath6kl_info("hw %s fw %s%s\n",
|
||||
get_hw_id_string(ar->wiphy->hw_version),
|
||||
ar->wiphy->fw_version,
|
||||
test_bit(TESTMODE, &ar->flag) ? " testmode" : "");
|
||||
}
|
||||
}
|
||||
|
||||
void ath6kl_scan_complete_evt(struct ath6kl *ar, int status)
|
||||
void ath6kl_scan_complete_evt(struct ath6kl_vif *vif, int status)
|
||||
{
|
||||
ath6kl_cfg80211_scan_complete_event(ar, status);
|
||||
struct ath6kl *ar = vif->ar;
|
||||
bool aborted = false;
|
||||
|
||||
if (status != WMI_SCAN_STATUS_SUCCESS)
|
||||
aborted = true;
|
||||
|
||||
ath6kl_cfg80211_scan_complete_event(vif, aborted);
|
||||
|
||||
if (!ar->usr_bss_filter) {
|
||||
clear_bit(CLEAR_BSSFILTER_ON_BEACON, &ar->flag);
|
||||
ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0);
|
||||
clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags);
|
||||
ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx,
|
||||
NONE_BSS_FILTER, 0);
|
||||
}
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_WLAN_SCAN, "scan complete: %d\n", status);
|
||||
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "scan complete: %d\n", status);
|
||||
}
|
||||
|
||||
void ath6kl_connect_event(struct ath6kl *ar, u16 channel, u8 *bssid,
|
||||
void ath6kl_connect_event(struct ath6kl_vif *vif, u16 channel, u8 *bssid,
|
||||
u16 listen_int, u16 beacon_int,
|
||||
enum network_type net_type, u8 beacon_ie_len,
|
||||
u8 assoc_req_len, u8 assoc_resp_len,
|
||||
u8 *assoc_info)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct ath6kl *ar = vif->ar;
|
||||
|
||||
ath6kl_cfg80211_connect_event(ar, channel, bssid,
|
||||
ath6kl_cfg80211_connect_event(vif, channel, bssid,
|
||||
listen_int, beacon_int,
|
||||
net_type, beacon_ie_len,
|
||||
assoc_req_len, assoc_resp_len,
|
||||
assoc_info);
|
||||
|
||||
memcpy(ar->bssid, bssid, sizeof(ar->bssid));
|
||||
ar->bss_ch = channel;
|
||||
memcpy(vif->bssid, bssid, sizeof(vif->bssid));
|
||||
vif->bss_ch = channel;
|
||||
|
||||
if ((ar->nw_type == INFRA_NETWORK))
|
||||
ath6kl_wmi_listeninterval_cmd(ar->wmi, ar->listen_intvl_t,
|
||||
if ((vif->nw_type == INFRA_NETWORK))
|
||||
ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx,
|
||||
ar->listen_intvl_t,
|
||||
ar->listen_intvl_b);
|
||||
|
||||
netif_wake_queue(ar->net_dev);
|
||||
netif_wake_queue(vif->ndev);
|
||||
|
||||
/* Update connect & link status atomically */
|
||||
spin_lock_irqsave(&ar->lock, flags);
|
||||
set_bit(CONNECTED, &ar->flag);
|
||||
clear_bit(CONNECT_PEND, &ar->flag);
|
||||
netif_carrier_on(ar->net_dev);
|
||||
spin_unlock_irqrestore(&ar->lock, flags);
|
||||
spin_lock_bh(&vif->if_lock);
|
||||
set_bit(CONNECTED, &vif->flags);
|
||||
clear_bit(CONNECT_PEND, &vif->flags);
|
||||
netif_carrier_on(vif->ndev);
|
||||
spin_unlock_bh(&vif->if_lock);
|
||||
|
||||
aggr_reset_state(ar->aggr_cntxt);
|
||||
ar->reconnect_flag = 0;
|
||||
aggr_reset_state(vif->aggr_cntxt);
|
||||
vif->reconnect_flag = 0;
|
||||
|
||||
if ((ar->nw_type == ADHOC_NETWORK) && ar->ibss_ps_enable) {
|
||||
if ((vif->nw_type == ADHOC_NETWORK) && ar->ibss_ps_enable) {
|
||||
memset(ar->node_map, 0, sizeof(ar->node_map));
|
||||
ar->node_num = 0;
|
||||
ar->next_ep_id = ENDPOINT_2;
|
||||
}
|
||||
|
||||
if (!ar->usr_bss_filter) {
|
||||
set_bit(CLEAR_BSSFILTER_ON_BEACON, &ar->flag);
|
||||
ath6kl_wmi_bssfilter_cmd(ar->wmi, CURRENT_BSS_FILTER, 0);
|
||||
set_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags);
|
||||
ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx,
|
||||
CURRENT_BSS_FILTER, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void ath6kl_tkip_micerr_event(struct ath6kl *ar, u8 keyid, bool ismcast)
|
||||
void ath6kl_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid, bool ismcast)
|
||||
{
|
||||
struct ath6kl_sta *sta;
|
||||
struct ath6kl *ar = vif->ar;
|
||||
u8 tsc[6];
|
||||
|
||||
/*
|
||||
* For AP case, keyid will have aid of STA which sent pkt with
|
||||
* MIC error. Use this aid to get MAC & send it to hostapd.
|
||||
*/
|
||||
if (ar->nw_type == AP_NETWORK) {
|
||||
if (vif->nw_type == AP_NETWORK) {
|
||||
sta = ath6kl_find_sta_by_aid(ar, (keyid >> 2));
|
||||
if (!sta)
|
||||
return;
|
||||
|
|
@ -1081,19 +711,20 @@ void ath6kl_tkip_micerr_event(struct ath6kl *ar, u8 keyid, bool ismcast)
|
|||
"ap tkip mic error received from aid=%d\n", keyid);
|
||||
|
||||
memset(tsc, 0, sizeof(tsc)); /* FIX: get correct TSC */
|
||||
cfg80211_michael_mic_failure(ar->net_dev, sta->mac,
|
||||
cfg80211_michael_mic_failure(vif->ndev, sta->mac,
|
||||
NL80211_KEYTYPE_PAIRWISE, keyid,
|
||||
tsc, GFP_KERNEL);
|
||||
} else
|
||||
ath6kl_cfg80211_tkip_micerr_event(ar, keyid, ismcast);
|
||||
ath6kl_cfg80211_tkip_micerr_event(vif, keyid, ismcast);
|
||||
|
||||
}
|
||||
|
||||
static void ath6kl_update_target_stats(struct ath6kl *ar, u8 *ptr, u32 len)
|
||||
static void ath6kl_update_target_stats(struct ath6kl_vif *vif, u8 *ptr, u32 len)
|
||||
{
|
||||
struct wmi_target_stats *tgt_stats =
|
||||
(struct wmi_target_stats *) ptr;
|
||||
struct target_stats *stats = &ar->target_stats;
|
||||
struct ath6kl *ar = vif->ar;
|
||||
struct target_stats *stats = &vif->target_stats;
|
||||
struct tkip_ccmp_stats *ccmp_stats;
|
||||
u8 ac;
|
||||
|
||||
|
|
@ -1189,8 +820,8 @@ static void ath6kl_update_target_stats(struct ath6kl *ar, u8 *ptr, u32 len)
|
|||
stats->wow_evt_discarded +=
|
||||
le16_to_cpu(tgt_stats->wow_stats.wow_evt_discarded);
|
||||
|
||||
if (test_bit(STATS_UPDATE_PEND, &ar->flag)) {
|
||||
clear_bit(STATS_UPDATE_PEND, &ar->flag);
|
||||
if (test_bit(STATS_UPDATE_PEND, &vif->flags)) {
|
||||
clear_bit(STATS_UPDATE_PEND, &vif->flags);
|
||||
wake_up(&ar->event_wq);
|
||||
}
|
||||
}
|
||||
|
|
@ -1200,14 +831,15 @@ static void ath6kl_add_le32(__le32 *var, __le32 val)
|
|||
*var = cpu_to_le32(le32_to_cpu(*var) + le32_to_cpu(val));
|
||||
}
|
||||
|
||||
void ath6kl_tgt_stats_event(struct ath6kl *ar, u8 *ptr, u32 len)
|
||||
void ath6kl_tgt_stats_event(struct ath6kl_vif *vif, u8 *ptr, u32 len)
|
||||
{
|
||||
struct wmi_ap_mode_stat *p = (struct wmi_ap_mode_stat *) ptr;
|
||||
struct ath6kl *ar = vif->ar;
|
||||
struct wmi_ap_mode_stat *ap = &ar->ap_stats;
|
||||
struct wmi_per_sta_stat *st_ap, *st_p;
|
||||
u8 ac;
|
||||
|
||||
if (ar->nw_type == AP_NETWORK) {
|
||||
if (vif->nw_type == AP_NETWORK) {
|
||||
if (len < sizeof(*p))
|
||||
return;
|
||||
|
||||
|
|
@ -1226,7 +858,7 @@ void ath6kl_tgt_stats_event(struct ath6kl *ar, u8 *ptr, u32 len)
|
|||
}
|
||||
|
||||
} else {
|
||||
ath6kl_update_target_stats(ar, ptr, len);
|
||||
ath6kl_update_target_stats(vif, ptr, len);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1245,11 +877,12 @@ void ath6kl_txpwr_rx_evt(void *devt, u8 tx_pwr)
|
|||
wake_up(&ar->event_wq);
|
||||
}
|
||||
|
||||
void ath6kl_pspoll_event(struct ath6kl *ar, u8 aid)
|
||||
void ath6kl_pspoll_event(struct ath6kl_vif *vif, u8 aid)
|
||||
{
|
||||
struct ath6kl_sta *conn;
|
||||
struct sk_buff *skb;
|
||||
bool psq_empty = false;
|
||||
struct ath6kl *ar = vif->ar;
|
||||
|
||||
conn = ath6kl_find_sta_by_aid(ar, aid);
|
||||
|
||||
|
|
@ -1272,7 +905,7 @@ void ath6kl_pspoll_event(struct ath6kl *ar, u8 aid)
|
|||
spin_unlock_bh(&conn->psq_lock);
|
||||
|
||||
conn->sta_flags |= STA_PS_POLLED;
|
||||
ath6kl_data_tx(skb, ar->net_dev);
|
||||
ath6kl_data_tx(skb, vif->ndev);
|
||||
conn->sta_flags &= ~STA_PS_POLLED;
|
||||
|
||||
spin_lock_bh(&conn->psq_lock);
|
||||
|
|
@ -1280,13 +913,14 @@ void ath6kl_pspoll_event(struct ath6kl *ar, u8 aid)
|
|||
spin_unlock_bh(&conn->psq_lock);
|
||||
|
||||
if (psq_empty)
|
||||
ath6kl_wmi_set_pvb_cmd(ar->wmi, conn->aid, 0);
|
||||
ath6kl_wmi_set_pvb_cmd(ar->wmi, vif->fw_vif_idx, conn->aid, 0);
|
||||
}
|
||||
|
||||
void ath6kl_dtimexpiry_event(struct ath6kl *ar)
|
||||
void ath6kl_dtimexpiry_event(struct ath6kl_vif *vif)
|
||||
{
|
||||
bool mcastq_empty = false;
|
||||
struct sk_buff *skb;
|
||||
struct ath6kl *ar = vif->ar;
|
||||
|
||||
/*
|
||||
* If there are no associated STAs, ignore the DTIM expiry event.
|
||||
|
|
@ -1308,31 +942,31 @@ void ath6kl_dtimexpiry_event(struct ath6kl *ar)
|
|||
return;
|
||||
|
||||
/* set the STA flag to dtim_expired for the frame to go out */
|
||||
set_bit(DTIM_EXPIRED, &ar->flag);
|
||||
set_bit(DTIM_EXPIRED, &vif->flags);
|
||||
|
||||
spin_lock_bh(&ar->mcastpsq_lock);
|
||||
while ((skb = skb_dequeue(&ar->mcastpsq)) != NULL) {
|
||||
spin_unlock_bh(&ar->mcastpsq_lock);
|
||||
|
||||
ath6kl_data_tx(skb, ar->net_dev);
|
||||
ath6kl_data_tx(skb, vif->ndev);
|
||||
|
||||
spin_lock_bh(&ar->mcastpsq_lock);
|
||||
}
|
||||
spin_unlock_bh(&ar->mcastpsq_lock);
|
||||
|
||||
clear_bit(DTIM_EXPIRED, &ar->flag);
|
||||
clear_bit(DTIM_EXPIRED, &vif->flags);
|
||||
|
||||
/* clear the LSB of the BitMapCtl field of the TIM IE */
|
||||
ath6kl_wmi_set_pvb_cmd(ar->wmi, MCAST_AID, 0);
|
||||
ath6kl_wmi_set_pvb_cmd(ar->wmi, vif->fw_vif_idx, MCAST_AID, 0);
|
||||
}
|
||||
|
||||
void ath6kl_disconnect_event(struct ath6kl *ar, u8 reason, u8 *bssid,
|
||||
void ath6kl_disconnect_event(struct ath6kl_vif *vif, u8 reason, u8 *bssid,
|
||||
u8 assoc_resp_len, u8 *assoc_info,
|
||||
u16 prot_reason_status)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct ath6kl *ar = vif->ar;
|
||||
|
||||
if (ar->nw_type == AP_NETWORK) {
|
||||
if (vif->nw_type == AP_NETWORK) {
|
||||
if (!ath6kl_remove_sta(ar, bssid, prot_reason_status))
|
||||
return;
|
||||
|
||||
|
|
@ -1344,31 +978,31 @@ void ath6kl_disconnect_event(struct ath6kl *ar, u8 reason, u8 *bssid,
|
|||
|
||||
/* clear the LSB of the TIM IE's BitMapCtl field */
|
||||
if (test_bit(WMI_READY, &ar->flag))
|
||||
ath6kl_wmi_set_pvb_cmd(ar->wmi, MCAST_AID, 0);
|
||||
ath6kl_wmi_set_pvb_cmd(ar->wmi, vif->fw_vif_idx,
|
||||
MCAST_AID, 0);
|
||||
}
|
||||
|
||||
if (!is_broadcast_ether_addr(bssid)) {
|
||||
/* send event to application */
|
||||
cfg80211_del_sta(ar->net_dev, bssid, GFP_KERNEL);
|
||||
cfg80211_del_sta(vif->ndev, bssid, GFP_KERNEL);
|
||||
}
|
||||
|
||||
if (memcmp(ar->net_dev->dev_addr, bssid, ETH_ALEN) == 0) {
|
||||
memset(ar->wep_key_list, 0, sizeof(ar->wep_key_list));
|
||||
clear_bit(CONNECTED, &ar->flag);
|
||||
if (memcmp(vif->ndev->dev_addr, bssid, ETH_ALEN) == 0) {
|
||||
memset(vif->wep_key_list, 0, sizeof(vif->wep_key_list));
|
||||
clear_bit(CONNECTED, &vif->flags);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ath6kl_cfg80211_disconnect_event(ar, reason, bssid,
|
||||
ath6kl_cfg80211_disconnect_event(vif, reason, bssid,
|
||||
assoc_resp_len, assoc_info,
|
||||
prot_reason_status);
|
||||
|
||||
aggr_reset_state(ar->aggr_cntxt);
|
||||
aggr_reset_state(vif->aggr_cntxt);
|
||||
|
||||
del_timer(&ar->disconnect_timer);
|
||||
del_timer(&vif->disconnect_timer);
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_WLAN_CONNECT,
|
||||
"disconnect reason is %d\n", reason);
|
||||
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "disconnect reason is %d\n", reason);
|
||||
|
||||
/*
|
||||
* If the event is due to disconnect cmd from the host, only they
|
||||
|
|
@ -1377,83 +1011,98 @@ void ath6kl_disconnect_event(struct ath6kl *ar, u8 reason, u8 *bssid,
|
|||
*/
|
||||
if (reason == DISCONNECT_CMD) {
|
||||
if (!ar->usr_bss_filter && test_bit(WMI_READY, &ar->flag))
|
||||
ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0);
|
||||
ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx,
|
||||
NONE_BSS_FILTER, 0);
|
||||
} else {
|
||||
set_bit(CONNECT_PEND, &ar->flag);
|
||||
set_bit(CONNECT_PEND, &vif->flags);
|
||||
if (((reason == ASSOC_FAILED) &&
|
||||
(prot_reason_status == 0x11)) ||
|
||||
((reason == ASSOC_FAILED) && (prot_reason_status == 0x0)
|
||||
&& (ar->reconnect_flag == 1))) {
|
||||
set_bit(CONNECTED, &ar->flag);
|
||||
&& (vif->reconnect_flag == 1))) {
|
||||
set_bit(CONNECTED, &vif->flags);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* update connect & link status atomically */
|
||||
spin_lock_irqsave(&ar->lock, flags);
|
||||
clear_bit(CONNECTED, &ar->flag);
|
||||
netif_carrier_off(ar->net_dev);
|
||||
spin_unlock_irqrestore(&ar->lock, flags);
|
||||
spin_lock_bh(&vif->if_lock);
|
||||
clear_bit(CONNECTED, &vif->flags);
|
||||
netif_carrier_off(vif->ndev);
|
||||
spin_unlock_bh(&vif->if_lock);
|
||||
|
||||
if ((reason != CSERV_DISCONNECT) || (ar->reconnect_flag != 1))
|
||||
ar->reconnect_flag = 0;
|
||||
if ((reason != CSERV_DISCONNECT) || (vif->reconnect_flag != 1))
|
||||
vif->reconnect_flag = 0;
|
||||
|
||||
if (reason != CSERV_DISCONNECT)
|
||||
ar->user_key_ctrl = 0;
|
||||
|
||||
netif_stop_queue(ar->net_dev);
|
||||
memset(ar->bssid, 0, sizeof(ar->bssid));
|
||||
ar->bss_ch = 0;
|
||||
netif_stop_queue(vif->ndev);
|
||||
memset(vif->bssid, 0, sizeof(vif->bssid));
|
||||
vif->bss_ch = 0;
|
||||
|
||||
ath6kl_tx_data_cleanup(ar);
|
||||
}
|
||||
|
||||
struct ath6kl_vif *ath6kl_vif_first(struct ath6kl *ar)
|
||||
{
|
||||
struct ath6kl_vif *vif;
|
||||
|
||||
spin_lock_bh(&ar->list_lock);
|
||||
if (list_empty(&ar->vif_list)) {
|
||||
spin_unlock_bh(&ar->list_lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vif = list_first_entry(&ar->vif_list, struct ath6kl_vif, list);
|
||||
|
||||
spin_unlock_bh(&ar->list_lock);
|
||||
|
||||
return vif;
|
||||
}
|
||||
|
||||
static int ath6kl_open(struct net_device *dev)
|
||||
{
|
||||
struct ath6kl *ar = ath6kl_priv(dev);
|
||||
unsigned long flags;
|
||||
struct ath6kl_vif *vif = netdev_priv(dev);
|
||||
|
||||
spin_lock_irqsave(&ar->lock, flags);
|
||||
set_bit(WLAN_ENABLED, &vif->flags);
|
||||
|
||||
set_bit(WLAN_ENABLED, &ar->flag);
|
||||
|
||||
if (test_bit(CONNECTED, &ar->flag)) {
|
||||
if (test_bit(CONNECTED, &vif->flags)) {
|
||||
netif_carrier_on(dev);
|
||||
netif_wake_queue(dev);
|
||||
} else
|
||||
netif_carrier_off(dev);
|
||||
|
||||
spin_unlock_irqrestore(&ar->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ath6kl_close(struct net_device *dev)
|
||||
{
|
||||
struct ath6kl *ar = ath6kl_priv(dev);
|
||||
struct ath6kl_vif *vif = netdev_priv(dev);
|
||||
|
||||
netif_stop_queue(dev);
|
||||
|
||||
ath6kl_disconnect(ar);
|
||||
ath6kl_disconnect(vif);
|
||||
|
||||
if (test_bit(WMI_READY, &ar->flag)) {
|
||||
if (ath6kl_wmi_scanparams_cmd(ar->wmi, 0xFFFF, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0))
|
||||
if (ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, 0xFFFF,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0))
|
||||
return -EIO;
|
||||
|
||||
clear_bit(WLAN_ENABLED, &ar->flag);
|
||||
}
|
||||
|
||||
ath6kl_cfg80211_scan_complete_event(ar, -ECANCELED);
|
||||
ath6kl_cfg80211_scan_complete_event(vif, true);
|
||||
|
||||
clear_bit(WLAN_ENABLED, &vif->flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct net_device_stats *ath6kl_get_stats(struct net_device *dev)
|
||||
{
|
||||
struct ath6kl *ar = ath6kl_priv(dev);
|
||||
struct ath6kl_vif *vif = netdev_priv(dev);
|
||||
|
||||
return &ar->net_stats;
|
||||
return &vif->net_stats;
|
||||
}
|
||||
|
||||
static struct net_device_ops ath6kl_netdev_ops = {
|
||||
|
|
@ -1466,6 +1115,7 @@ static struct net_device_ops ath6kl_netdev_ops = {
|
|||
void init_netdev(struct net_device *dev)
|
||||
{
|
||||
dev->netdev_ops = &ath6kl_netdev_ops;
|
||||
dev->destructor = free_netdev;
|
||||
dev->watchdog_timeo = ATH6KL_TX_TIMEOUT;
|
||||
|
||||
dev->needed_headroom = ETH_HLEN;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <linux/mmc/sdio_ids.h>
|
||||
#include <linux/mmc/sdio.h>
|
||||
#include <linux/mmc/sd.h>
|
||||
#include "htc_hif.h"
|
||||
#include "hif.h"
|
||||
#include "hif-ops.h"
|
||||
#include "target.h"
|
||||
#include "debug.h"
|
||||
|
|
@ -46,6 +46,8 @@ struct ath6kl_sdio {
|
|||
struct list_head scat_req;
|
||||
|
||||
spinlock_t scat_lock;
|
||||
bool scatter_enabled;
|
||||
|
||||
bool is_disabled;
|
||||
atomic_t irq_handling;
|
||||
const struct sdio_device_id *id;
|
||||
|
|
@ -135,6 +137,8 @@ static int ath6kl_sdio_io(struct sdio_func *func, u32 request, u32 addr,
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
sdio_claim_host(func);
|
||||
|
||||
if (request & HIF_WRITE) {
|
||||
/* FIXME: looks like ugly workaround for something */
|
||||
if (addr >= HIF_MBOX_BASE_ADDR &&
|
||||
|
|
@ -156,6 +160,8 @@ static int ath6kl_sdio_io(struct sdio_func *func, u32 request, u32 addr,
|
|||
ret = sdio_memcpy_fromio(func, buf, addr, len);
|
||||
}
|
||||
|
||||
sdio_release_host(func);
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_SDIO, "%s addr 0x%x%s buf 0x%p len %d\n",
|
||||
request & HIF_WRITE ? "wr" : "rd", addr,
|
||||
request & HIF_FIXED_ADDRESS ? " (fixed)" : "", buf, len);
|
||||
|
|
@ -167,12 +173,11 @@ static int ath6kl_sdio_io(struct sdio_func *func, u32 request, u32 addr,
|
|||
static struct bus_request *ath6kl_sdio_alloc_busreq(struct ath6kl_sdio *ar_sdio)
|
||||
{
|
||||
struct bus_request *bus_req;
|
||||
unsigned long flag;
|
||||
|
||||
spin_lock_irqsave(&ar_sdio->lock, flag);
|
||||
spin_lock_bh(&ar_sdio->lock);
|
||||
|
||||
if (list_empty(&ar_sdio->bus_req_freeq)) {
|
||||
spin_unlock_irqrestore(&ar_sdio->lock, flag);
|
||||
spin_unlock_bh(&ar_sdio->lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -180,7 +185,7 @@ static struct bus_request *ath6kl_sdio_alloc_busreq(struct ath6kl_sdio *ar_sdio)
|
|||
struct bus_request, list);
|
||||
list_del(&bus_req->list);
|
||||
|
||||
spin_unlock_irqrestore(&ar_sdio->lock, flag);
|
||||
spin_unlock_bh(&ar_sdio->lock);
|
||||
ath6kl_dbg(ATH6KL_DBG_SCATTER, "%s: bus request 0x%p\n",
|
||||
__func__, bus_req);
|
||||
|
||||
|
|
@ -190,14 +195,12 @@ static struct bus_request *ath6kl_sdio_alloc_busreq(struct ath6kl_sdio *ar_sdio)
|
|||
static void ath6kl_sdio_free_bus_req(struct ath6kl_sdio *ar_sdio,
|
||||
struct bus_request *bus_req)
|
||||
{
|
||||
unsigned long flag;
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_SCATTER, "%s: bus request 0x%p\n",
|
||||
__func__, bus_req);
|
||||
|
||||
spin_lock_irqsave(&ar_sdio->lock, flag);
|
||||
spin_lock_bh(&ar_sdio->lock);
|
||||
list_add_tail(&bus_req->list, &ar_sdio->bus_req_freeq);
|
||||
spin_unlock_irqrestore(&ar_sdio->lock, flag);
|
||||
spin_unlock_bh(&ar_sdio->lock);
|
||||
}
|
||||
|
||||
static void ath6kl_sdio_setup_scat_data(struct hif_scatter_req *scat_req,
|
||||
|
|
@ -291,10 +294,14 @@ static int ath6kl_sdio_scat_rw(struct ath6kl_sdio *ar_sdio,
|
|||
mmc_req.cmd = &cmd;
|
||||
mmc_req.data = &data;
|
||||
|
||||
sdio_claim_host(ar_sdio->func);
|
||||
|
||||
mmc_set_data_timeout(&data, ar_sdio->func->card);
|
||||
/* synchronous call to process request */
|
||||
mmc_wait_for_req(ar_sdio->func->card->host, &mmc_req);
|
||||
|
||||
sdio_release_host(ar_sdio->func);
|
||||
|
||||
status = cmd.error ? cmd.error : data.error;
|
||||
|
||||
scat_complete:
|
||||
|
|
@ -395,11 +402,9 @@ static int ath6kl_sdio_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf,
|
|||
} else
|
||||
tbuf = buf;
|
||||
|
||||
sdio_claim_host(ar_sdio->func);
|
||||
ret = ath6kl_sdio_io(ar_sdio->func, request, addr, tbuf, len);
|
||||
if ((request & HIF_READ) && bounced)
|
||||
memcpy(buf, tbuf, len);
|
||||
sdio_release_host(ar_sdio->func);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -418,29 +423,25 @@ static void __ath6kl_sdio_write_async(struct ath6kl_sdio *ar_sdio,
|
|||
req->request);
|
||||
context = req->packet;
|
||||
ath6kl_sdio_free_bus_req(ar_sdio, req);
|
||||
ath6kldev_rw_comp_handler(context, status);
|
||||
ath6kl_hif_rw_comp_handler(context, status);
|
||||
}
|
||||
}
|
||||
|
||||
static void ath6kl_sdio_write_async_work(struct work_struct *work)
|
||||
{
|
||||
struct ath6kl_sdio *ar_sdio;
|
||||
unsigned long flags;
|
||||
struct bus_request *req, *tmp_req;
|
||||
|
||||
ar_sdio = container_of(work, struct ath6kl_sdio, wr_async_work);
|
||||
sdio_claim_host(ar_sdio->func);
|
||||
|
||||
spin_lock_irqsave(&ar_sdio->wr_async_lock, flags);
|
||||
spin_lock_bh(&ar_sdio->wr_async_lock);
|
||||
list_for_each_entry_safe(req, tmp_req, &ar_sdio->wr_asyncq, list) {
|
||||
list_del(&req->list);
|
||||
spin_unlock_irqrestore(&ar_sdio->wr_async_lock, flags);
|
||||
spin_unlock_bh(&ar_sdio->wr_async_lock);
|
||||
__ath6kl_sdio_write_async(ar_sdio, req);
|
||||
spin_lock_irqsave(&ar_sdio->wr_async_lock, flags);
|
||||
spin_lock_bh(&ar_sdio->wr_async_lock);
|
||||
}
|
||||
spin_unlock_irqrestore(&ar_sdio->wr_async_lock, flags);
|
||||
|
||||
sdio_release_host(ar_sdio->func);
|
||||
spin_unlock_bh(&ar_sdio->wr_async_lock);
|
||||
}
|
||||
|
||||
static void ath6kl_sdio_irq_handler(struct sdio_func *func)
|
||||
|
|
@ -459,20 +460,23 @@ static void ath6kl_sdio_irq_handler(struct sdio_func *func)
|
|||
*/
|
||||
sdio_release_host(ar_sdio->func);
|
||||
|
||||
status = ath6kldev_intr_bh_handler(ar_sdio->ar);
|
||||
status = ath6kl_hif_intr_bh_handler(ar_sdio->ar);
|
||||
sdio_claim_host(ar_sdio->func);
|
||||
atomic_set(&ar_sdio->irq_handling, 0);
|
||||
WARN_ON(status && status != -ECANCELED);
|
||||
}
|
||||
|
||||
static int ath6kl_sdio_power_on(struct ath6kl_sdio *ar_sdio)
|
||||
static int ath6kl_sdio_power_on(struct ath6kl *ar)
|
||||
{
|
||||
struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
|
||||
struct sdio_func *func = ar_sdio->func;
|
||||
int ret = 0;
|
||||
|
||||
if (!ar_sdio->is_disabled)
|
||||
return 0;
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_BOOT, "sdio power on\n");
|
||||
|
||||
sdio_claim_host(func);
|
||||
|
||||
ret = sdio_enable_func(func);
|
||||
|
|
@ -495,13 +499,16 @@ static int ath6kl_sdio_power_on(struct ath6kl_sdio *ar_sdio)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ath6kl_sdio_power_off(struct ath6kl_sdio *ar_sdio)
|
||||
static int ath6kl_sdio_power_off(struct ath6kl *ar)
|
||||
{
|
||||
struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
|
||||
int ret;
|
||||
|
||||
if (ar_sdio->is_disabled)
|
||||
return 0;
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_BOOT, "sdio power off\n");
|
||||
|
||||
/* Disable the card */
|
||||
sdio_claim_host(ar_sdio->func);
|
||||
ret = sdio_disable_func(ar_sdio->func);
|
||||
|
|
@ -521,7 +528,6 @@ static int ath6kl_sdio_write_async(struct ath6kl *ar, u32 address, u8 *buffer,
|
|||
{
|
||||
struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
|
||||
struct bus_request *bus_req;
|
||||
unsigned long flags;
|
||||
|
||||
bus_req = ath6kl_sdio_alloc_busreq(ar_sdio);
|
||||
|
||||
|
|
@ -534,9 +540,9 @@ static int ath6kl_sdio_write_async(struct ath6kl *ar, u32 address, u8 *buffer,
|
|||
bus_req->request = request;
|
||||
bus_req->packet = packet;
|
||||
|
||||
spin_lock_irqsave(&ar_sdio->wr_async_lock, flags);
|
||||
spin_lock_bh(&ar_sdio->wr_async_lock);
|
||||
list_add_tail(&bus_req->list, &ar_sdio->wr_asyncq);
|
||||
spin_unlock_irqrestore(&ar_sdio->wr_async_lock, flags);
|
||||
spin_unlock_bh(&ar_sdio->wr_async_lock);
|
||||
queue_work(ar->ath6kl_wq, &ar_sdio->wr_async_work);
|
||||
|
||||
return 0;
|
||||
|
|
@ -582,9 +588,8 @@ static struct hif_scatter_req *ath6kl_sdio_scatter_req_get(struct ath6kl *ar)
|
|||
{
|
||||
struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
|
||||
struct hif_scatter_req *node = NULL;
|
||||
unsigned long flag;
|
||||
|
||||
spin_lock_irqsave(&ar_sdio->scat_lock, flag);
|
||||
spin_lock_bh(&ar_sdio->scat_lock);
|
||||
|
||||
if (!list_empty(&ar_sdio->scat_req)) {
|
||||
node = list_first_entry(&ar_sdio->scat_req,
|
||||
|
|
@ -592,7 +597,7 @@ static struct hif_scatter_req *ath6kl_sdio_scatter_req_get(struct ath6kl *ar)
|
|||
list_del(&node->list);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&ar_sdio->scat_lock, flag);
|
||||
spin_unlock_bh(&ar_sdio->scat_lock);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
|
@ -601,13 +606,12 @@ static void ath6kl_sdio_scatter_req_add(struct ath6kl *ar,
|
|||
struct hif_scatter_req *s_req)
|
||||
{
|
||||
struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
|
||||
unsigned long flag;
|
||||
|
||||
spin_lock_irqsave(&ar_sdio->scat_lock, flag);
|
||||
spin_lock_bh(&ar_sdio->scat_lock);
|
||||
|
||||
list_add_tail(&s_req->list, &ar_sdio->scat_req);
|
||||
|
||||
spin_unlock_irqrestore(&ar_sdio->scat_lock, flag);
|
||||
spin_unlock_bh(&ar_sdio->scat_lock);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -618,7 +622,6 @@ static int ath6kl_sdio_async_rw_scatter(struct ath6kl *ar,
|
|||
struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
|
||||
u32 request = scat_req->req;
|
||||
int status = 0;
|
||||
unsigned long flags;
|
||||
|
||||
if (!scat_req->len)
|
||||
return -EINVAL;
|
||||
|
|
@ -627,14 +630,12 @@ static int ath6kl_sdio_async_rw_scatter(struct ath6kl *ar,
|
|||
"hif-scatter: total len: %d scatter entries: %d\n",
|
||||
scat_req->len, scat_req->scat_entries);
|
||||
|
||||
if (request & HIF_SYNCHRONOUS) {
|
||||
sdio_claim_host(ar_sdio->func);
|
||||
if (request & HIF_SYNCHRONOUS)
|
||||
status = ath6kl_sdio_scat_rw(ar_sdio, scat_req->busrequest);
|
||||
sdio_release_host(ar_sdio->func);
|
||||
} else {
|
||||
spin_lock_irqsave(&ar_sdio->wr_async_lock, flags);
|
||||
else {
|
||||
spin_lock_bh(&ar_sdio->wr_async_lock);
|
||||
list_add_tail(&scat_req->busrequest->list, &ar_sdio->wr_asyncq);
|
||||
spin_unlock_irqrestore(&ar_sdio->wr_async_lock, flags);
|
||||
spin_unlock_bh(&ar_sdio->wr_async_lock);
|
||||
queue_work(ar->ath6kl_wq, &ar_sdio->wr_async_work);
|
||||
}
|
||||
|
||||
|
|
@ -646,23 +647,27 @@ static void ath6kl_sdio_cleanup_scatter(struct ath6kl *ar)
|
|||
{
|
||||
struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
|
||||
struct hif_scatter_req *s_req, *tmp_req;
|
||||
unsigned long flag;
|
||||
|
||||
/* empty the free list */
|
||||
spin_lock_irqsave(&ar_sdio->scat_lock, flag);
|
||||
spin_lock_bh(&ar_sdio->scat_lock);
|
||||
list_for_each_entry_safe(s_req, tmp_req, &ar_sdio->scat_req, list) {
|
||||
list_del(&s_req->list);
|
||||
spin_unlock_irqrestore(&ar_sdio->scat_lock, flag);
|
||||
spin_unlock_bh(&ar_sdio->scat_lock);
|
||||
|
||||
/*
|
||||
* FIXME: should we also call completion handler with
|
||||
* ath6kl_hif_rw_comp_handler() with status -ECANCELED so
|
||||
* that the packet is properly freed?
|
||||
*/
|
||||
if (s_req->busrequest)
|
||||
ath6kl_sdio_free_bus_req(ar_sdio, s_req->busrequest);
|
||||
kfree(s_req->virt_dma_buf);
|
||||
kfree(s_req->sgentries);
|
||||
kfree(s_req);
|
||||
|
||||
spin_lock_irqsave(&ar_sdio->scat_lock, flag);
|
||||
spin_lock_bh(&ar_sdio->scat_lock);
|
||||
}
|
||||
spin_unlock_irqrestore(&ar_sdio->scat_lock, flag);
|
||||
spin_unlock_bh(&ar_sdio->scat_lock);
|
||||
}
|
||||
|
||||
/* setup of HIF scatter resources */
|
||||
|
|
@ -673,6 +678,11 @@ static int ath6kl_sdio_enable_scatter(struct ath6kl *ar)
|
|||
int ret;
|
||||
bool virt_scat = false;
|
||||
|
||||
if (ar_sdio->scatter_enabled)
|
||||
return 0;
|
||||
|
||||
ar_sdio->scatter_enabled = true;
|
||||
|
||||
/* check if host supports scatter and it meets our requirements */
|
||||
if (ar_sdio->func->card->host->max_segs < MAX_SCATTER_ENTRIES_PER_REQ) {
|
||||
ath6kl_err("host only supports scatter of :%d entries, need: %d\n",
|
||||
|
|
@ -687,8 +697,8 @@ static int ath6kl_sdio_enable_scatter(struct ath6kl *ar)
|
|||
MAX_SCATTER_REQUESTS, virt_scat);
|
||||
|
||||
if (!ret) {
|
||||
ath6kl_dbg(ATH6KL_DBG_SCATTER,
|
||||
"hif-scatter enabled: max scatter req : %d entries: %d\n",
|
||||
ath6kl_dbg(ATH6KL_DBG_BOOT,
|
||||
"hif-scatter enabled requests %d entries %d\n",
|
||||
MAX_SCATTER_REQUESTS,
|
||||
MAX_SCATTER_ENTRIES_PER_REQ);
|
||||
|
||||
|
|
@ -712,8 +722,8 @@ static int ath6kl_sdio_enable_scatter(struct ath6kl *ar)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_SCATTER,
|
||||
"Vitual scatter enabled, max_scat_req:%d, entries:%d\n",
|
||||
ath6kl_dbg(ATH6KL_DBG_BOOT,
|
||||
"virtual scatter enabled requests %d entries %d\n",
|
||||
ATH6KL_SCATTER_REQS, ATH6KL_SCATTER_ENTRIES_PER_REQ);
|
||||
|
||||
target->max_scat_entries = ATH6KL_SCATTER_ENTRIES_PER_REQ;
|
||||
|
|
@ -724,7 +734,47 @@ static int ath6kl_sdio_enable_scatter(struct ath6kl *ar)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ath6kl_sdio_suspend(struct ath6kl *ar)
|
||||
static int ath6kl_sdio_config(struct ath6kl *ar)
|
||||
{
|
||||
struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
|
||||
struct sdio_func *func = ar_sdio->func;
|
||||
int ret;
|
||||
|
||||
sdio_claim_host(func);
|
||||
|
||||
if ((ar_sdio->id->device & MANUFACTURER_ID_ATH6KL_BASE_MASK) >=
|
||||
MANUFACTURER_ID_AR6003_BASE) {
|
||||
/* enable 4-bit ASYNC interrupt on AR6003 or later */
|
||||
ret = ath6kl_sdio_func0_cmd52_wr_byte(func->card,
|
||||
CCCR_SDIO_IRQ_MODE_REG,
|
||||
SDIO_IRQ_MODE_ASYNC_4BIT_IRQ);
|
||||
if (ret) {
|
||||
ath6kl_err("Failed to enable 4-bit async irq mode %d\n",
|
||||
ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_BOOT, "4-bit async irq mode enabled\n");
|
||||
}
|
||||
|
||||
/* give us some time to enable, in ms */
|
||||
func->enable_timeout = 100;
|
||||
|
||||
ret = sdio_set_block_size(func, HIF_MBOX_BLOCK_SIZE);
|
||||
if (ret) {
|
||||
ath6kl_err("Set sdio block size %d failed: %d)\n",
|
||||
HIF_MBOX_BLOCK_SIZE, ret);
|
||||
sdio_release_host(func);
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
sdio_release_host(func);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ath6kl_sdio_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow)
|
||||
{
|
||||
struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
|
||||
struct sdio_func *func = ar_sdio->func;
|
||||
|
|
@ -733,12 +783,14 @@ static int ath6kl_sdio_suspend(struct ath6kl *ar)
|
|||
|
||||
flags = sdio_get_host_pm_caps(func);
|
||||
|
||||
if (!(flags & MMC_PM_KEEP_POWER))
|
||||
/* as host doesn't support keep power we need to bail out */
|
||||
ath6kl_dbg(ATH6KL_DBG_SDIO,
|
||||
"func %d doesn't support MMC_PM_KEEP_POWER\n",
|
||||
func->num);
|
||||
return -EINVAL;
|
||||
ath6kl_dbg(ATH6KL_DBG_SUSPEND, "sdio suspend pm_caps 0x%x\n", flags);
|
||||
|
||||
if (!(flags & MMC_PM_KEEP_POWER) ||
|
||||
(ar->conf_flags & ATH6KL_CONF_SUSPEND_CUTPOWER)) {
|
||||
/* as host doesn't support keep power we need to cut power */
|
||||
return ath6kl_cfg80211_suspend(ar, ATH6KL_CFG_SUSPEND_CUTPOWER,
|
||||
NULL);
|
||||
}
|
||||
|
||||
ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
|
||||
if (ret) {
|
||||
|
|
@ -747,11 +799,85 @@ static int ath6kl_sdio_suspend(struct ath6kl *ar)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ath6kl_deep_sleep_enable(ar);
|
||||
if ((flags & MMC_PM_WAKE_SDIO_IRQ) && wow) {
|
||||
/*
|
||||
* The host sdio controller is capable of keep power and
|
||||
* sdio irq wake up at this point. It's fine to continue
|
||||
* wow suspend operation.
|
||||
*/
|
||||
ret = ath6kl_cfg80211_suspend(ar, ATH6KL_CFG_SUSPEND_WOW, wow);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = sdio_set_host_pm_flags(func, MMC_PM_WAKE_SDIO_IRQ);
|
||||
if (ret)
|
||||
ath6kl_err("set sdio wake irq flag failed: %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ath6kl_cfg80211_suspend(ar, ATH6KL_CFG_SUSPEND_DEEPSLEEP, NULL);
|
||||
}
|
||||
|
||||
static int ath6kl_sdio_resume(struct ath6kl *ar)
|
||||
{
|
||||
switch (ar->state) {
|
||||
case ATH6KL_STATE_OFF:
|
||||
case ATH6KL_STATE_CUTPOWER:
|
||||
ath6kl_dbg(ATH6KL_DBG_SUSPEND,
|
||||
"sdio resume configuring sdio\n");
|
||||
|
||||
/* need to set sdio settings after power is cut from sdio */
|
||||
ath6kl_sdio_config(ar);
|
||||
break;
|
||||
|
||||
case ATH6KL_STATE_ON:
|
||||
break;
|
||||
|
||||
case ATH6KL_STATE_DEEPSLEEP:
|
||||
break;
|
||||
|
||||
case ATH6KL_STATE_WOW:
|
||||
break;
|
||||
}
|
||||
|
||||
ath6kl_cfg80211_resume(ar);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ath6kl_sdio_stop(struct ath6kl *ar)
|
||||
{
|
||||
struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
|
||||
struct bus_request *req, *tmp_req;
|
||||
void *context;
|
||||
|
||||
/* FIXME: make sure that wq is not queued again */
|
||||
|
||||
cancel_work_sync(&ar_sdio->wr_async_work);
|
||||
|
||||
spin_lock_bh(&ar_sdio->wr_async_lock);
|
||||
|
||||
list_for_each_entry_safe(req, tmp_req, &ar_sdio->wr_asyncq, list) {
|
||||
list_del(&req->list);
|
||||
|
||||
if (req->scat_req) {
|
||||
/* this is a scatter gather request */
|
||||
req->scat_req->status = -ECANCELED;
|
||||
req->scat_req->complete(ar_sdio->ar->htc_target,
|
||||
req->scat_req);
|
||||
} else {
|
||||
context = req->packet;
|
||||
ath6kl_sdio_free_bus_req(ar_sdio, req);
|
||||
ath6kl_hif_rw_comp_handler(context, -ECANCELED);
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_bh(&ar_sdio->wr_async_lock);
|
||||
|
||||
WARN_ON(get_queue_depth(&ar_sdio->scat_req) != 4);
|
||||
}
|
||||
|
||||
static const struct ath6kl_hif_ops ath6kl_sdio_ops = {
|
||||
.read_write_sync = ath6kl_sdio_read_write_sync,
|
||||
.write_async = ath6kl_sdio_write_async,
|
||||
|
|
@ -763,8 +889,43 @@ static const struct ath6kl_hif_ops ath6kl_sdio_ops = {
|
|||
.scat_req_rw = ath6kl_sdio_async_rw_scatter,
|
||||
.cleanup_scatter = ath6kl_sdio_cleanup_scatter,
|
||||
.suspend = ath6kl_sdio_suspend,
|
||||
.resume = ath6kl_sdio_resume,
|
||||
.power_on = ath6kl_sdio_power_on,
|
||||
.power_off = ath6kl_sdio_power_off,
|
||||
.stop = ath6kl_sdio_stop,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
||||
/*
|
||||
* Empty handlers so that mmc subsystem doesn't remove us entirely during
|
||||
* suspend. We instead follow cfg80211 suspend/resume handlers.
|
||||
*/
|
||||
static int ath6kl_sdio_pm_suspend(struct device *device)
|
||||
{
|
||||
ath6kl_dbg(ATH6KL_DBG_SUSPEND, "sdio pm suspend\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ath6kl_sdio_pm_resume(struct device *device)
|
||||
{
|
||||
ath6kl_dbg(ATH6KL_DBG_SUSPEND, "sdio pm resume\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(ath6kl_sdio_pm_ops, ath6kl_sdio_pm_suspend,
|
||||
ath6kl_sdio_pm_resume);
|
||||
|
||||
#define ATH6KL_SDIO_PM_OPS (&ath6kl_sdio_pm_ops)
|
||||
|
||||
#else
|
||||
|
||||
#define ATH6KL_SDIO_PM_OPS NULL
|
||||
|
||||
#endif /* CONFIG_PM_SLEEP */
|
||||
|
||||
static int ath6kl_sdio_probe(struct sdio_func *func,
|
||||
const struct sdio_device_id *id)
|
||||
{
|
||||
|
|
@ -773,8 +934,8 @@ static int ath6kl_sdio_probe(struct sdio_func *func,
|
|||
struct ath6kl *ar;
|
||||
int count;
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_SDIO,
|
||||
"new func %d vendor 0x%x device 0x%x block 0x%x/0x%x\n",
|
||||
ath6kl_dbg(ATH6KL_DBG_BOOT,
|
||||
"sdio new func %d vendor 0x%x device 0x%x block 0x%x/0x%x\n",
|
||||
func->num, func->vendor, func->device,
|
||||
func->max_blksize, func->cur_blksize);
|
||||
|
||||
|
|
@ -820,57 +981,22 @@ static int ath6kl_sdio_probe(struct sdio_func *func,
|
|||
|
||||
ath6kl_sdio_set_mbox_info(ar);
|
||||
|
||||
sdio_claim_host(func);
|
||||
|
||||
if ((ar_sdio->id->device & MANUFACTURER_ID_ATH6KL_BASE_MASK) >=
|
||||
MANUFACTURER_ID_AR6003_BASE) {
|
||||
/* enable 4-bit ASYNC interrupt on AR6003 or later */
|
||||
ret = ath6kl_sdio_func0_cmd52_wr_byte(func->card,
|
||||
CCCR_SDIO_IRQ_MODE_REG,
|
||||
SDIO_IRQ_MODE_ASYNC_4BIT_IRQ);
|
||||
if (ret) {
|
||||
ath6kl_err("Failed to enable 4-bit async irq mode %d\n",
|
||||
ret);
|
||||
sdio_release_host(func);
|
||||
goto err_cfg80211;
|
||||
}
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_SDIO, "4-bit async irq mode enabled\n");
|
||||
}
|
||||
|
||||
/* give us some time to enable, in ms */
|
||||
func->enable_timeout = 100;
|
||||
|
||||
sdio_release_host(func);
|
||||
|
||||
ret = ath6kl_sdio_power_on(ar_sdio);
|
||||
if (ret)
|
||||
goto err_cfg80211;
|
||||
|
||||
sdio_claim_host(func);
|
||||
|
||||
ret = sdio_set_block_size(func, HIF_MBOX_BLOCK_SIZE);
|
||||
ret = ath6kl_sdio_config(ar);
|
||||
if (ret) {
|
||||
ath6kl_err("Set sdio block size %d failed: %d)\n",
|
||||
HIF_MBOX_BLOCK_SIZE, ret);
|
||||
sdio_release_host(func);
|
||||
goto err_off;
|
||||
ath6kl_err("Failed to config sdio: %d\n", ret);
|
||||
goto err_core_alloc;
|
||||
}
|
||||
|
||||
sdio_release_host(func);
|
||||
|
||||
ret = ath6kl_core_init(ar);
|
||||
if (ret) {
|
||||
ath6kl_err("Failed to init ath6kl core\n");
|
||||
goto err_off;
|
||||
goto err_core_alloc;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
err_off:
|
||||
ath6kl_sdio_power_off(ar_sdio);
|
||||
err_cfg80211:
|
||||
ath6kl_cfg80211_deinit(ar_sdio->ar);
|
||||
err_core_alloc:
|
||||
ath6kl_core_free(ar_sdio->ar);
|
||||
err_dma:
|
||||
kfree(ar_sdio->dma_buffer);
|
||||
err_hif:
|
||||
|
|
@ -883,8 +1009,8 @@ static void ath6kl_sdio_remove(struct sdio_func *func)
|
|||
{
|
||||
struct ath6kl_sdio *ar_sdio;
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_SDIO,
|
||||
"removed func %d vendor 0x%x device 0x%x\n",
|
||||
ath6kl_dbg(ATH6KL_DBG_BOOT,
|
||||
"sdio removed func %d vendor 0x%x device 0x%x\n",
|
||||
func->num, func->vendor, func->device);
|
||||
|
||||
ar_sdio = sdio_get_drvdata(func);
|
||||
|
|
@ -892,9 +1018,7 @@ static void ath6kl_sdio_remove(struct sdio_func *func)
|
|||
ath6kl_stop_txrx(ar_sdio->ar);
|
||||
cancel_work_sync(&ar_sdio->wr_async_work);
|
||||
|
||||
ath6kl_unavail_ev(ar_sdio->ar);
|
||||
|
||||
ath6kl_sdio_power_off(ar_sdio);
|
||||
ath6kl_core_cleanup(ar_sdio->ar);
|
||||
|
||||
kfree(ar_sdio->dma_buffer);
|
||||
kfree(ar_sdio);
|
||||
|
|
@ -909,10 +1033,11 @@ static const struct sdio_device_id ath6kl_sdio_devices[] = {
|
|||
MODULE_DEVICE_TABLE(sdio, ath6kl_sdio_devices);
|
||||
|
||||
static struct sdio_driver ath6kl_sdio_driver = {
|
||||
.name = "ath6kl_sdio",
|
||||
.name = "ath6kl",
|
||||
.id_table = ath6kl_sdio_devices,
|
||||
.probe = ath6kl_sdio_probe,
|
||||
.remove = ath6kl_sdio_remove,
|
||||
.drv.pm = ATH6KL_SDIO_PM_OPS,
|
||||
};
|
||||
|
||||
static int __init ath6kl_sdio_init(void)
|
||||
|
|
|
|||
|
|
@ -320,7 +320,10 @@ struct host_interest {
|
|||
| (2) | (2) | (2) | (2) | (2) | (2) | (2) | (2)
|
||||
|------------------------------------------------------------------------------|
|
||||
*/
|
||||
#define HI_OPTION_FW_MODE_BITS 0x2
|
||||
#define HI_OPTION_FW_MODE_SHIFT 0xC
|
||||
|
||||
#define HI_OPTION_FW_SUBMODE_BITS 0x2
|
||||
#define HI_OPTION_FW_SUBMODE_SHIFT 0x14
|
||||
|
||||
/* Convert a Target virtual address into a Target physical address */
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue