You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Conflicts: Documentation/feature-removal-schedule.txt drivers/net/wireless/ath/ath5k/phy.c
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
rfkill - radio frequency (RF) connector kill switch support
|
||||
|
||||
For details to this subsystem look at Documentation/rfkill.txt.
|
||||
|
||||
What: /sys/class/rfkill/rfkill[0-9]+/state
|
||||
Date: 09-Jul-2007
|
||||
KernelVersion v2.6.22
|
||||
Contact: linux-wireless@vger.kernel.org
|
||||
Description: Current state of the transmitter.
|
||||
This file is deprecated and sheduled to be removed in 2014,
|
||||
because its not possible to express the 'soft and hard block'
|
||||
state of the rfkill driver.
|
||||
Values: A numeric value.
|
||||
0: RFKILL_STATE_SOFT_BLOCKED
|
||||
transmitter is turned off by software
|
||||
1: RFKILL_STATE_UNBLOCKED
|
||||
transmitter is (potentially) active
|
||||
2: RFKILL_STATE_HARD_BLOCKED
|
||||
transmitter is forced off by something outside of
|
||||
the driver's control.
|
||||
|
||||
What: /sys/class/rfkill/rfkill[0-9]+/claim
|
||||
Date: 09-Jul-2007
|
||||
KernelVersion v2.6.22
|
||||
Contact: linux-wireless@vger.kernel.org
|
||||
Description: This file is deprecated because there no longer is a way to
|
||||
claim just control over a single rfkill instance.
|
||||
This file is scheduled to be removed in 2012.
|
||||
Values: 0: Kernel handles events
|
||||
@@ -0,0 +1,67 @@
|
||||
rfkill - radio frequency (RF) connector kill switch support
|
||||
|
||||
For details to this subsystem look at Documentation/rfkill.txt.
|
||||
|
||||
For the deprecated /sys/class/rfkill/*/state and
|
||||
/sys/class/rfkill/*/claim knobs of this interface look in
|
||||
Documentation/ABI/obsolete/sysfs-class-rfkill.
|
||||
|
||||
What: /sys/class/rfkill
|
||||
Date: 09-Jul-2007
|
||||
KernelVersion: v2.6.22
|
||||
Contact: linux-wireless@vger.kernel.org,
|
||||
Description: The rfkill class subsystem folder.
|
||||
Each registered rfkill driver is represented by an rfkillX
|
||||
subfolder (X being an integer > 0).
|
||||
|
||||
|
||||
What: /sys/class/rfkill/rfkill[0-9]+/name
|
||||
Date: 09-Jul-2007
|
||||
KernelVersion v2.6.22
|
||||
Contact: linux-wireless@vger.kernel.org
|
||||
Description: Name assigned by driver to this key (interface or driver name).
|
||||
Values: arbitrary string.
|
||||
|
||||
|
||||
What: /sys/class/rfkill/rfkill[0-9]+/type
|
||||
Date: 09-Jul-2007
|
||||
KernelVersion v2.6.22
|
||||
Contact: linux-wireless@vger.kernel.org
|
||||
Description: Driver type string ("wlan", "bluetooth", etc).
|
||||
Values: See include/linux/rfkill.h.
|
||||
|
||||
|
||||
What: /sys/class/rfkill/rfkill[0-9]+/persistent
|
||||
Date: 09-Jul-2007
|
||||
KernelVersion v2.6.22
|
||||
Contact: linux-wireless@vger.kernel.org
|
||||
Description: Whether the soft blocked state is initialised from non-volatile
|
||||
storage at startup.
|
||||
Values: A numeric value.
|
||||
0: false
|
||||
1: true
|
||||
|
||||
|
||||
What: /sys/class/rfkill/rfkill[0-9]+/hard
|
||||
Date: 12-March-2010
|
||||
KernelVersion v2.6.34
|
||||
Contact: linux-wireless@vger.kernel.org
|
||||
Description: Current hardblock state. This file is read only.
|
||||
Values: A numeric value.
|
||||
0: inactive
|
||||
The transmitter is (potentially) active.
|
||||
1: active
|
||||
The transmitter is forced off by something outside of
|
||||
the driver's control.
|
||||
|
||||
|
||||
What: /sys/class/rfkill/rfkill[0-9]+/soft
|
||||
Date: 12-March-2010
|
||||
KernelVersion v2.6.34
|
||||
Contact: linux-wireless@vger.kernel.org
|
||||
Description: Current softblock state. This file is read and write.
|
||||
Values: A numeric value.
|
||||
0: inactive
|
||||
The transmitter is (potentially) active.
|
||||
1: active
|
||||
The transmitter is turned off by software.
|
||||
@@ -520,6 +520,7 @@ Who: Hans de Goede <hdegoede@redhat.com>
|
||||
|
||||
----------------------------
|
||||
|
||||
|
||||
What: corgikbd, spitzkbd, tosakbd driver
|
||||
When: 2.6.35
|
||||
Files: drivers/input/keyboard/{corgi,spitz,tosa}kbd.c
|
||||
@@ -543,6 +544,24 @@ Who: Eric Miao <eric.y.miao@gmail.com>
|
||||
|
||||
----------------------------
|
||||
|
||||
What: sysfs-class-rfkill state file
|
||||
When: Feb 2014
|
||||
Files: net/rfkill/core.c
|
||||
Why: Documented as obsolete since Feb 2010. This file is limited to 3
|
||||
states while the rfkill drivers can have 4 states.
|
||||
Who: anybody or Florian Mickler <florian@mickler.org>
|
||||
|
||||
----------------------------
|
||||
|
||||
What: sysfs-class-rfkill claim file
|
||||
When: Feb 2012
|
||||
Files: net/rfkill/core.c
|
||||
Why: It is not possible to claim an rfkill driver since 2007. This is
|
||||
Documented as obsolete since Feb 2010.
|
||||
Who: anybody or Florian Mickler <florian@mickler.org>
|
||||
|
||||
----------------------------
|
||||
|
||||
What: capifs
|
||||
When: February 2011
|
||||
Files: drivers/isdn/capi/capifs.*
|
||||
|
||||
+11
-29
@@ -99,37 +99,15 @@ system. Also, it is possible to switch all rfkill drivers (or all drivers of
|
||||
a specified type) into a state which also updates the default state for
|
||||
hotplugged devices.
|
||||
|
||||
After an application opens /dev/rfkill, it can read the current state of
|
||||
all devices, and afterwards can poll the descriptor for hotplug or state
|
||||
change events.
|
||||
After an application opens /dev/rfkill, it can read the current state of all
|
||||
devices. Changes can be either obtained by either polling the descriptor for
|
||||
hotplug or state change events or by listening for uevents emitted by the
|
||||
rfkill core framework.
|
||||
|
||||
Applications must ignore operations (the "op" field) they do not handle,
|
||||
this allows the API to be extended in the future.
|
||||
Additionally, each rfkill device is registered in sysfs and emits uevents.
|
||||
|
||||
Additionally, each rfkill device is registered in sysfs and there has the
|
||||
following attributes:
|
||||
|
||||
name: Name assigned by driver to this key (interface or driver name).
|
||||
type: Driver type string ("wlan", "bluetooth", etc).
|
||||
persistent: Whether the soft blocked state is initialised from
|
||||
non-volatile storage at startup.
|
||||
state: Current state of the transmitter
|
||||
0: RFKILL_STATE_SOFT_BLOCKED
|
||||
transmitter is turned off by software
|
||||
1: RFKILL_STATE_UNBLOCKED
|
||||
transmitter is (potentially) active
|
||||
2: RFKILL_STATE_HARD_BLOCKED
|
||||
transmitter is forced off by something outside of
|
||||
the driver's control.
|
||||
This file is deprecated because it can only properly show
|
||||
three of the four possible states, soft-and-hard-blocked is
|
||||
missing.
|
||||
claim: 0: Kernel handles events
|
||||
This file is deprecated because there no longer is a way to
|
||||
claim just control over a single rfkill instance.
|
||||
|
||||
rfkill devices also issue uevents (with an action of "change"), with the
|
||||
following environment variables set:
|
||||
rfkill devices issue uevents (with an action of "change"), with the following
|
||||
environment variables set:
|
||||
|
||||
RFKILL_NAME
|
||||
RFKILL_STATE
|
||||
@@ -137,3 +115,7 @@ RFKILL_TYPE
|
||||
|
||||
The contents of these variables corresponds to the "name", "state" and
|
||||
"type" sysfs files explained above.
|
||||
|
||||
|
||||
For further details consult Documentation/ABI/stable/dev-rfkill and
|
||||
Documentation/ABI/stable/sysfs-class-rfkill.
|
||||
|
||||
+24
-13
@@ -2876,7 +2876,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
|
||||
ai->wep_capable = (cap_rid.softCap & cpu_to_le16(0x02)) ? 1 : 0;
|
||||
ai->max_wep_idx = (cap_rid.softCap & cpu_to_le16(0x80)) ? 3 : 0;
|
||||
|
||||
airo_print_info(dev->name, "Firmware version %x.%x.%02x",
|
||||
airo_print_info(dev->name, "Firmware version %x.%x.%02d",
|
||||
((le16_to_cpu(cap_rid.softVer) >> 8) & 0xF),
|
||||
(le16_to_cpu(cap_rid.softVer) & 0xFF),
|
||||
le16_to_cpu(cap_rid.softSubVer));
|
||||
@@ -3193,19 +3193,26 @@ static void airo_print_status(const char *devname, u16 status)
|
||||
{
|
||||
u8 reason = status & 0xFF;
|
||||
|
||||
switch (status) {
|
||||
switch (status & 0xFF00) {
|
||||
case STAT_NOBEACON:
|
||||
airo_print_dbg(devname, "link lost (missed beacons)");
|
||||
break;
|
||||
case STAT_MAXRETRIES:
|
||||
case STAT_MAXARL:
|
||||
airo_print_dbg(devname, "link lost (max retries)");
|
||||
break;
|
||||
case STAT_FORCELOSS:
|
||||
airo_print_dbg(devname, "link lost (local choice)");
|
||||
break;
|
||||
case STAT_TSFSYNC:
|
||||
airo_print_dbg(devname, "link lost (TSF sync lost)");
|
||||
switch (status) {
|
||||
case STAT_NOBEACON:
|
||||
airo_print_dbg(devname, "link lost (missed beacons)");
|
||||
break;
|
||||
case STAT_MAXRETRIES:
|
||||
case STAT_MAXARL:
|
||||
airo_print_dbg(devname, "link lost (max retries)");
|
||||
break;
|
||||
case STAT_FORCELOSS:
|
||||
airo_print_dbg(devname, "link lost (local choice)");
|
||||
break;
|
||||
case STAT_TSFSYNC:
|
||||
airo_print_dbg(devname, "link lost (TSF sync lost)");
|
||||
break;
|
||||
default:
|
||||
airo_print_dbg(devname, "unknow status %x\n", status);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case STAT_DEAUTH:
|
||||
airo_print_dbg(devname, "deauthenticated (reason: %d)", reason);
|
||||
@@ -3221,7 +3228,11 @@ static void airo_print_status(const char *devname, u16 status)
|
||||
airo_print_dbg(devname, "authentication failed (reason: %d)",
|
||||
reason);
|
||||
break;
|
||||
case STAT_ASSOC:
|
||||
case STAT_REASSOC:
|
||||
break;
|
||||
default:
|
||||
airo_print_dbg(devname, "unknow status %x\n", status);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +202,6 @@
|
||||
#define AR5K_TUNE_MAX_TXPOWER 63
|
||||
#define AR5K_TUNE_DEFAULT_TXPOWER 25
|
||||
#define AR5K_TUNE_TPC_TXPOWER false
|
||||
#define AR5K_TUNE_HWTXTRIES 4
|
||||
|
||||
#define AR5K_INIT_CARR_SENSE_EN 1
|
||||
|
||||
@@ -614,28 +613,6 @@ struct ath5k_rx_status {
|
||||
#define AR5K_BEACON_ENA 0x00800000 /*enable beacon xmit*/
|
||||
#define AR5K_BEACON_RESET_TSF 0x01000000 /*force a TSF reset*/
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* struct ath5k_beacon_state - Per-station beacon timer state.
|
||||
* @bs_interval: in TU's, can also include the above flags
|
||||
* @bs_cfp_max_duration: if non-zero hw is setup to coexist with a
|
||||
* Point Coordination Function capable AP
|
||||
*/
|
||||
struct ath5k_beacon_state {
|
||||
u32 bs_next_beacon;
|
||||
u32 bs_next_dtim;
|
||||
u32 bs_interval;
|
||||
u8 bs_dtim_period;
|
||||
u8 bs_cfp_period;
|
||||
u16 bs_cfp_max_duration;
|
||||
u16 bs_cfp_du_remain;
|
||||
u16 bs_tim_offset;
|
||||
u16 bs_sleep_duration;
|
||||
u16 bs_bmiss_threshold;
|
||||
u32 bs_cfp_next;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* TSF to TU conversion:
|
||||
@@ -1028,7 +1005,6 @@ struct ath5k_nfcal_hist
|
||||
|
||||
/* TODO: Clean up and merge with ath5k_softc */
|
||||
struct ath5k_hw {
|
||||
u32 ah_magic;
|
||||
struct ath_common common;
|
||||
|
||||
struct ath5k_softc *ah_sc;
|
||||
@@ -1036,7 +1012,6 @@ struct ath5k_hw {
|
||||
|
||||
enum ath5k_int ah_imr;
|
||||
|
||||
enum nl80211_iftype ah_op_mode;
|
||||
struct ieee80211_channel *ah_current_channel;
|
||||
bool ah_turbo;
|
||||
bool ah_calibration;
|
||||
@@ -1049,7 +1024,6 @@ struct ath5k_hw {
|
||||
u32 ah_phy;
|
||||
u32 ah_mac_srev;
|
||||
u16 ah_mac_version;
|
||||
u16 ah_mac_revision;
|
||||
u16 ah_phy_revision;
|
||||
u16 ah_radio_5ghz_revision;
|
||||
u16 ah_radio_2ghz_revision;
|
||||
@@ -1071,8 +1045,6 @@ struct ath5k_hw {
|
||||
u8 ah_def_ant;
|
||||
bool ah_software_retry;
|
||||
|
||||
int ah_gpio_npins;
|
||||
|
||||
struct ath5k_capabilities ah_capabilities;
|
||||
|
||||
struct ath5k_txq_info ah_txq[AR5K_NUM_TX_QUEUES];
|
||||
@@ -1141,9 +1113,9 @@ struct ath5k_hw {
|
||||
int (*ah_setup_rx_desc)(struct ath5k_hw *ah, struct ath5k_desc *desc,
|
||||
u32 size, unsigned int flags);
|
||||
int (*ah_setup_tx_desc)(struct ath5k_hw *, struct ath5k_desc *,
|
||||
unsigned int, unsigned int, enum ath5k_pkt_type, unsigned int,
|
||||
unsigned int, unsigned int, int, enum ath5k_pkt_type,
|
||||
unsigned int, unsigned int, unsigned int, unsigned int,
|
||||
unsigned int, unsigned int, unsigned int);
|
||||
unsigned int, unsigned int, unsigned int, unsigned int);
|
||||
int (*ah_setup_mrr_tx_desc)(struct ath5k_hw *, struct ath5k_desc *,
|
||||
unsigned int, unsigned int, unsigned int, unsigned int,
|
||||
unsigned int, unsigned int);
|
||||
@@ -1158,158 +1130,147 @@ struct ath5k_hw {
|
||||
*/
|
||||
|
||||
/* Attach/Detach Functions */
|
||||
extern int ath5k_hw_attach(struct ath5k_softc *sc);
|
||||
extern void ath5k_hw_detach(struct ath5k_hw *ah);
|
||||
int ath5k_hw_attach(struct ath5k_softc *sc);
|
||||
void ath5k_hw_detach(struct ath5k_hw *ah);
|
||||
|
||||
/* LED functions */
|
||||
extern int ath5k_init_leds(struct ath5k_softc *sc);
|
||||
extern void ath5k_led_enable(struct ath5k_softc *sc);
|
||||
extern void ath5k_led_off(struct ath5k_softc *sc);
|
||||
extern void ath5k_unregister_leds(struct ath5k_softc *sc);
|
||||
int ath5k_init_leds(struct ath5k_softc *sc);
|
||||
void ath5k_led_enable(struct ath5k_softc *sc);
|
||||
void ath5k_led_off(struct ath5k_softc *sc);
|
||||
void ath5k_unregister_leds(struct ath5k_softc *sc);
|
||||
|
||||
/* Reset Functions */
|
||||
extern int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial);
|
||||
extern int ath5k_hw_on_hold(struct ath5k_hw *ah);
|
||||
extern int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, struct ieee80211_channel *channel, bool change_channel);
|
||||
int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial);
|
||||
int ath5k_hw_on_hold(struct ath5k_hw *ah);
|
||||
int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
|
||||
struct ieee80211_channel *channel, bool change_channel);
|
||||
int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag, u32 val,
|
||||
bool is_set);
|
||||
/* Power management functions */
|
||||
extern int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode, bool set_chip, u16 sleep_duration);
|
||||
|
||||
/* DMA Related Functions */
|
||||
extern void ath5k_hw_start_rx_dma(struct ath5k_hw *ah);
|
||||
extern int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah);
|
||||
extern u32 ath5k_hw_get_rxdp(struct ath5k_hw *ah);
|
||||
extern void ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr);
|
||||
extern int ath5k_hw_start_tx_dma(struct ath5k_hw *ah, unsigned int queue);
|
||||
extern int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue);
|
||||
extern u32 ath5k_hw_get_txdp(struct ath5k_hw *ah, unsigned int queue);
|
||||
extern int ath5k_hw_set_txdp(struct ath5k_hw *ah, unsigned int queue,
|
||||
void ath5k_hw_start_rx_dma(struct ath5k_hw *ah);
|
||||
int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah);
|
||||
u32 ath5k_hw_get_rxdp(struct ath5k_hw *ah);
|
||||
void ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr);
|
||||
int ath5k_hw_start_tx_dma(struct ath5k_hw *ah, unsigned int queue);
|
||||
int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue);
|
||||
u32 ath5k_hw_get_txdp(struct ath5k_hw *ah, unsigned int queue);
|
||||
int ath5k_hw_set_txdp(struct ath5k_hw *ah, unsigned int queue,
|
||||
u32 phys_addr);
|
||||
extern int ath5k_hw_update_tx_triglevel(struct ath5k_hw *ah, bool increase);
|
||||
int ath5k_hw_update_tx_triglevel(struct ath5k_hw *ah, bool increase);
|
||||
/* Interrupt handling */
|
||||
extern bool ath5k_hw_is_intr_pending(struct ath5k_hw *ah);
|
||||
extern int ath5k_hw_get_isr(struct ath5k_hw *ah, enum ath5k_int *interrupt_mask);
|
||||
extern enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum
|
||||
ath5k_int new_mask);
|
||||
extern void ath5k_hw_update_mib_counters(struct ath5k_hw *ah, struct ieee80211_low_level_stats *stats);
|
||||
bool ath5k_hw_is_intr_pending(struct ath5k_hw *ah);
|
||||
int ath5k_hw_get_isr(struct ath5k_hw *ah, enum ath5k_int *interrupt_mask);
|
||||
enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask);
|
||||
void ath5k_hw_update_mib_counters(struct ath5k_hw *ah,
|
||||
struct ieee80211_low_level_stats *stats);
|
||||
|
||||
/* EEPROM access functions */
|
||||
extern int ath5k_eeprom_init(struct ath5k_hw *ah);
|
||||
extern void ath5k_eeprom_detach(struct ath5k_hw *ah);
|
||||
extern int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac);
|
||||
extern bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah);
|
||||
int ath5k_eeprom_init(struct ath5k_hw *ah);
|
||||
void ath5k_eeprom_detach(struct ath5k_hw *ah);
|
||||
int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac);
|
||||
|
||||
/* Protocol Control Unit Functions */
|
||||
extern int ath5k_hw_set_opmode(struct ath5k_hw *ah);
|
||||
extern void ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class);
|
||||
extern int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype opmode);
|
||||
void ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class);
|
||||
/* BSSID Functions */
|
||||
extern int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac);
|
||||
extern void ath5k_hw_set_associd(struct ath5k_hw *ah);
|
||||
extern void ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask);
|
||||
int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac);
|
||||
void ath5k_hw_set_associd(struct ath5k_hw *ah);
|
||||
void ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask);
|
||||
/* Receive start/stop functions */
|
||||
extern void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah);
|
||||
extern void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah);
|
||||
void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah);
|
||||
void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah);
|
||||
/* RX Filter functions */
|
||||
extern void ath5k_hw_set_mcast_filter(struct ath5k_hw *ah, u32 filter0, u32 filter1);
|
||||
extern int ath5k_hw_set_mcast_filter_idx(struct ath5k_hw *ah, u32 index);
|
||||
extern int ath5k_hw_clear_mcast_filter_idx(struct ath5k_hw *ah, u32 index);
|
||||
extern u32 ath5k_hw_get_rx_filter(struct ath5k_hw *ah);
|
||||
extern void ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter);
|
||||
void ath5k_hw_set_mcast_filter(struct ath5k_hw *ah, u32 filter0, u32 filter1);
|
||||
u32 ath5k_hw_get_rx_filter(struct ath5k_hw *ah);
|
||||
void ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter);
|
||||
/* Beacon control functions */
|
||||
extern u32 ath5k_hw_get_tsf32(struct ath5k_hw *ah);
|
||||
extern u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah);
|
||||
extern void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64);
|
||||
extern void ath5k_hw_reset_tsf(struct ath5k_hw *ah);
|
||||
extern void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval);
|
||||
#if 0
|
||||
extern int ath5k_hw_set_beacon_timers(struct ath5k_hw *ah, const struct ath5k_beacon_state *state);
|
||||
extern void ath5k_hw_reset_beacon(struct ath5k_hw *ah);
|
||||
extern int ath5k_hw_beaconq_finish(struct ath5k_hw *ah, unsigned long phys_addr);
|
||||
#endif
|
||||
u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah);
|
||||
void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64);
|
||||
void ath5k_hw_reset_tsf(struct ath5k_hw *ah);
|
||||
void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval);
|
||||
/* ACK bit rate */
|
||||
void ath5k_hw_set_ack_bitrate_high(struct ath5k_hw *ah, bool high);
|
||||
/* ACK/CTS Timeouts */
|
||||
extern int ath5k_hw_set_ack_timeout(struct ath5k_hw *ah, unsigned int timeout);
|
||||
extern unsigned int ath5k_hw_get_ack_timeout(struct ath5k_hw *ah);
|
||||
extern int ath5k_hw_set_cts_timeout(struct ath5k_hw *ah, unsigned int timeout);
|
||||
extern unsigned int ath5k_hw_get_cts_timeout(struct ath5k_hw *ah);
|
||||
/* Clock rate related functions */
|
||||
unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec);
|
||||
unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock);
|
||||
unsigned int ath5k_hw_get_clockrate(struct ath5k_hw *ah);
|
||||
/* Key table (WEP) functions */
|
||||
extern int ath5k_hw_reset_key(struct ath5k_hw *ah, u16 entry);
|
||||
extern int ath5k_hw_is_key_valid(struct ath5k_hw *ah, u16 entry);
|
||||
extern int ath5k_hw_set_key(struct ath5k_hw *ah, u16 entry, const struct ieee80211_key_conf *key, const u8 *mac);
|
||||
extern int ath5k_hw_set_key_lladdr(struct ath5k_hw *ah, u16 entry, const u8 *mac);
|
||||
int ath5k_hw_reset_key(struct ath5k_hw *ah, u16 entry);
|
||||
int ath5k_hw_set_key(struct ath5k_hw *ah, u16 entry,
|
||||
const struct ieee80211_key_conf *key, const u8 *mac);
|
||||
int ath5k_hw_set_key_lladdr(struct ath5k_hw *ah, u16 entry, const u8 *mac);
|
||||
|
||||
/* Queue Control Unit, DFS Control Unit Functions */
|
||||
extern int ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue, struct ath5k_txq_info *queue_info);
|
||||
extern int ath5k_hw_set_tx_queueprops(struct ath5k_hw *ah, int queue,
|
||||
const struct ath5k_txq_info *queue_info);
|
||||
extern int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah,
|
||||
enum ath5k_tx_queue queue_type,
|
||||
struct ath5k_txq_info *queue_info);
|
||||
extern u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue);
|
||||
extern void ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue);
|
||||
extern int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue);
|
||||
extern unsigned int ath5k_hw_get_slot_time(struct ath5k_hw *ah);
|
||||
extern int ath5k_hw_set_slot_time(struct ath5k_hw *ah, unsigned int slot_time);
|
||||
int ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue,
|
||||
struct ath5k_txq_info *queue_info);
|
||||
int ath5k_hw_set_tx_queueprops(struct ath5k_hw *ah, int queue,
|
||||
const struct ath5k_txq_info *queue_info);
|
||||
int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah,
|
||||
enum ath5k_tx_queue queue_type,
|
||||
struct ath5k_txq_info *queue_info);
|
||||
u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue);
|
||||
void ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue);
|
||||
int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue);
|
||||
int ath5k_hw_set_slot_time(struct ath5k_hw *ah, unsigned int slot_time);
|
||||
|
||||
/* Hardware Descriptor Functions */
|
||||
extern int ath5k_hw_init_desc_functions(struct ath5k_hw *ah);
|
||||
int ath5k_hw_init_desc_functions(struct ath5k_hw *ah);
|
||||
|
||||
/* GPIO Functions */
|
||||
extern void ath5k_hw_set_ledstate(struct ath5k_hw *ah, unsigned int state);
|
||||
extern int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio);
|
||||
extern int ath5k_hw_set_gpio_output(struct ath5k_hw *ah, u32 gpio);
|
||||
extern u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio);
|
||||
extern int ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val);
|
||||
extern void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, u32 interrupt_level);
|
||||
void ath5k_hw_set_ledstate(struct ath5k_hw *ah, unsigned int state);
|
||||
int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio);
|
||||
int ath5k_hw_set_gpio_output(struct ath5k_hw *ah, u32 gpio);
|
||||
u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio);
|
||||
int ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val);
|
||||
void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio,
|
||||
u32 interrupt_level);
|
||||
|
||||
/* rfkill Functions */
|
||||
extern void ath5k_rfkill_hw_start(struct ath5k_hw *ah);
|
||||
extern void ath5k_rfkill_hw_stop(struct ath5k_hw *ah);
|
||||
void ath5k_rfkill_hw_start(struct ath5k_hw *ah);
|
||||
void ath5k_rfkill_hw_stop(struct ath5k_hw *ah);
|
||||
|
||||
/* Misc functions */
|
||||
int ath5k_hw_set_capabilities(struct ath5k_hw *ah);
|
||||
extern int ath5k_hw_get_capability(struct ath5k_hw *ah, enum ath5k_capability_type cap_type, u32 capability, u32 *result);
|
||||
extern int ath5k_hw_enable_pspoll(struct ath5k_hw *ah, u8 *bssid, u16 assoc_id);
|
||||
extern int ath5k_hw_disable_pspoll(struct ath5k_hw *ah);
|
||||
int ath5k_hw_get_capability(struct ath5k_hw *ah,
|
||||
enum ath5k_capability_type cap_type, u32 capability,
|
||||
u32 *result);
|
||||
int ath5k_hw_enable_pspoll(struct ath5k_hw *ah, u8 *bssid, u16 assoc_id);
|
||||
int ath5k_hw_disable_pspoll(struct ath5k_hw *ah);
|
||||
|
||||
/* Initial register settings functions */
|
||||
extern int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel);
|
||||
int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel);
|
||||
|
||||
/* Initialize RF */
|
||||
extern int ath5k_hw_rfregs_init(struct ath5k_hw *ah,
|
||||
struct ieee80211_channel *channel,
|
||||
unsigned int mode);
|
||||
extern int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq);
|
||||
extern enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah);
|
||||
extern int ath5k_hw_rfgain_opt_init(struct ath5k_hw *ah);
|
||||
int ath5k_hw_rfregs_init(struct ath5k_hw *ah,
|
||||
struct ieee80211_channel *channel,
|
||||
unsigned int mode);
|
||||
int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq);
|
||||
enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah);
|
||||
int ath5k_hw_rfgain_opt_init(struct ath5k_hw *ah);
|
||||
/* PHY/RF channel functions */
|
||||
extern bool ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags);
|
||||
extern int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel);
|
||||
bool ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags);
|
||||
int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel);
|
||||
/* PHY calibration */
|
||||
void ath5k_hw_init_nfcal_hist(struct ath5k_hw *ah);
|
||||
extern int ath5k_hw_phy_calibrate(struct ath5k_hw *ah, struct ieee80211_channel *channel);
|
||||
extern int ath5k_hw_noise_floor_calibration(struct ath5k_hw *ah, short freq);
|
||||
extern s16 ath5k_hw_get_noise_floor(struct ath5k_hw *ah);
|
||||
extern void ath5k_hw_calibration_poll(struct ath5k_hw *ah);
|
||||
int ath5k_hw_phy_calibrate(struct ath5k_hw *ah,
|
||||
struct ieee80211_channel *channel);
|
||||
void ath5k_hw_calibration_poll(struct ath5k_hw *ah);
|
||||
/* Spur mitigation */
|
||||
bool ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah,
|
||||
struct ieee80211_channel *channel);
|
||||
struct ieee80211_channel *channel);
|
||||
void ath5k_hw_set_spur_mitigation_filter(struct ath5k_hw *ah,
|
||||
struct ieee80211_channel *channel);
|
||||
struct ieee80211_channel *channel);
|
||||
/* Misc PHY functions */
|
||||
extern u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan);
|
||||
extern int ath5k_hw_phy_disable(struct ath5k_hw *ah);
|
||||
u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan);
|
||||
int ath5k_hw_phy_disable(struct ath5k_hw *ah);
|
||||
/* Antenna control */
|
||||
extern void ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode);
|
||||
extern void ath5k_hw_set_def_antenna(struct ath5k_hw *ah, u8 ant);
|
||||
extern unsigned int ath5k_hw_get_def_antenna(struct ath5k_hw *ah);
|
||||
void ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode);
|
||||
/* TX power setup */
|
||||
extern int ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, u8 ee_mode, u8 txpower);
|
||||
extern int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower);
|
||||
int ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
|
||||
u8 ee_mode, u8 txpower);
|
||||
int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower);
|
||||
|
||||
/*
|
||||
* Functions used internaly
|
||||
@@ -1335,29 +1296,6 @@ static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
|
||||
iowrite32(val, ah->ah_iobase + reg);
|
||||
}
|
||||
|
||||
#if defined(_ATH5K_RESET) || defined(_ATH5K_PHY)
|
||||
/*
|
||||
* Check if a register write has been completed
|
||||
*/
|
||||
static int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag,
|
||||
u32 val, bool is_set)
|
||||
{
|
||||
int i;
|
||||
u32 data;
|
||||
|
||||
for (i = AR5K_TUNE_REGISTER_TIMEOUT; i > 0; i--) {
|
||||
data = ath5k_hw_reg_read(ah, reg);
|
||||
if (is_set && (data & flag))
|
||||
break;
|
||||
else if ((data & flag) == val)
|
||||
break;
|
||||
udelay(15);
|
||||
}
|
||||
|
||||
return (i <= 0) ? -EAGAIN : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits)
|
||||
{
|
||||
u32 retval = 0, bit, i;
|
||||
@@ -1370,9 +1308,4 @@ static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline int ath5k_pad_size(int hdrlen)
|
||||
{
|
||||
return (hdrlen < 24) ? 0 : hdrlen & 3;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -113,7 +113,6 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
|
||||
/*
|
||||
* HW information
|
||||
*/
|
||||
ah->ah_op_mode = NL80211_IFTYPE_STATION;
|
||||
ah->ah_radar.r_enabled = AR5K_TUNE_RADAR_ALERT;
|
||||
ah->ah_turbo = false;
|
||||
ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
|
||||
@@ -123,6 +122,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
|
||||
ah->ah_cw_min = AR5K_TUNE_CWMIN;
|
||||
ah->ah_limit_tx_retries = AR5K_INIT_TX_RETRY;
|
||||
ah->ah_software_retry = false;
|
||||
ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT;
|
||||
|
||||
/*
|
||||
* Find the mac version
|
||||
@@ -148,7 +148,6 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
|
||||
/* Get MAC, PHY and RADIO revisions */
|
||||
ah->ah_mac_srev = srev;
|
||||
ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER);
|
||||
ah->ah_mac_revision = AR5K_REG_MS(srev, AR5K_SREV_REV);
|
||||
ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) &
|
||||
0xffffffff;
|
||||
ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah,
|
||||
@@ -327,7 +326,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
|
||||
/* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */
|
||||
memcpy(common->curbssid, ath_bcast_mac, ETH_ALEN);
|
||||
ath5k_hw_set_associd(ah);
|
||||
ath5k_hw_set_opmode(ah);
|
||||
ath5k_hw_set_opmode(ah, sc->opmode);
|
||||
|
||||
ath5k_hw_rfgain_opt_init(ah);
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ static void __devexit ath5k_pci_remove(struct pci_dev *pdev);
|
||||
static int ath5k_pci_suspend(struct device *dev);
|
||||
static int ath5k_pci_resume(struct device *dev);
|
||||
|
||||
SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume);
|
||||
static SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume);
|
||||
#define ATH5K_PM_OPS (&ath5k_pm_ops)
|
||||
#else
|
||||
#define ATH5K_PM_OPS NULL
|
||||
@@ -307,7 +307,7 @@ static int ath5k_rxbuf_setup(struct ath5k_softc *sc,
|
||||
struct ath5k_buf *bf);
|
||||
static int ath5k_txbuf_setup(struct ath5k_softc *sc,
|
||||
struct ath5k_buf *bf,
|
||||
struct ath5k_txq *txq);
|
||||
struct ath5k_txq *txq, int padsize);
|
||||
static inline void ath5k_txbuf_free(struct ath5k_softc *sc,
|
||||
struct ath5k_buf *bf)
|
||||
{
|
||||
@@ -1137,8 +1137,6 @@ ath5k_mode_setup(struct ath5k_softc *sc)
|
||||
struct ath5k_hw *ah = sc->ah;
|
||||
u32 rfilt;
|
||||
|
||||
ah->ah_op_mode = sc->opmode;
|
||||
|
||||
/* configure rx filter */
|
||||
rfilt = sc->filter_flags;
|
||||
ath5k_hw_set_rx_filter(ah, rfilt);
|
||||
@@ -1147,8 +1145,9 @@ ath5k_mode_setup(struct ath5k_softc *sc)
|
||||
ath5k_hw_set_bssid_mask(ah, sc->bssidmask);
|
||||
|
||||
/* configure operational mode */
|
||||
ath5k_hw_set_opmode(ah);
|
||||
ath5k_hw_set_opmode(ah, sc->opmode);
|
||||
|
||||
ATH5K_DBG(sc, ATH5K_DEBUG_MODE, "mode setup opmode %d\n", sc->opmode);
|
||||
ATH5K_DBG(sc, ATH5K_DEBUG_MODE, "RX filter 0x%x\n", rfilt);
|
||||
}
|
||||
|
||||
@@ -1271,7 +1270,7 @@ static enum ath5k_pkt_type get_hw_packet_type(struct sk_buff *skb)
|
||||
|
||||
static int
|
||||
ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
|
||||
struct ath5k_txq *txq)
|
||||
struct ath5k_txq *txq, int padsize)
|
||||
{
|
||||
struct ath5k_hw *ah = sc->ah;
|
||||
struct ath5k_desc *ds = bf->desc;
|
||||
@@ -1323,7 +1322,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
|
||||
sc->vif, pktlen, info));
|
||||
}
|
||||
ret = ah->ah_setup_tx_desc(ah, ds, pktlen,
|
||||
ieee80211_get_hdrlen_from_skb(skb),
|
||||
ieee80211_get_hdrlen_from_skb(skb), padsize,
|
||||
get_hw_packet_type(skb),
|
||||
(sc->power_level * 2),
|
||||
hw_rate,
|
||||
@@ -1805,6 +1804,67 @@ ath5k_check_ibss_tsf(struct ath5k_softc *sc, struct sk_buff *skb,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute padding position. skb must contains an IEEE 802.11 frame
|
||||
*/
|
||||
static int ath5k_common_padpos(struct sk_buff *skb)
|
||||
{
|
||||
struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data;
|
||||
__le16 frame_control = hdr->frame_control;
|
||||
int padpos = 24;
|
||||
|
||||
if (ieee80211_has_a4(frame_control)) {
|
||||
padpos += ETH_ALEN;
|
||||
}
|
||||
if (ieee80211_is_data_qos(frame_control)) {
|
||||
padpos += IEEE80211_QOS_CTL_LEN;
|
||||
}
|
||||
|
||||
return padpos;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function expects a 802.11 frame and returns the number of
|
||||
* bytes added, or -1 if we don't have enought header room.
|
||||
*/
|
||||
|
||||
static int ath5k_add_padding(struct sk_buff *skb)
|
||||
{
|
||||
int padpos = ath5k_common_padpos(skb);
|
||||
int padsize = padpos & 3;
|
||||
|
||||
if (padsize && skb->len>padpos) {
|
||||
|
||||
if (skb_headroom(skb) < padsize)
|
||||
return -1;
|
||||
|
||||
skb_push(skb, padsize);
|
||||
memmove(skb->data, skb->data+padsize, padpos);
|
||||
return padsize;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function expects a 802.11 frame and returns the number of
|
||||
* bytes removed
|
||||
*/
|
||||
|
||||
static int ath5k_remove_padding(struct sk_buff *skb)
|
||||
{
|
||||
int padpos = ath5k_common_padpos(skb);
|
||||
int padsize = padpos & 3;
|
||||
|
||||
if (padsize && skb->len>=padpos+padsize) {
|
||||
memmove(skb->data + padsize, skb->data, padpos);
|
||||
skb_pull(skb, padsize);
|
||||
return padsize;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
ath5k_tasklet_rx(unsigned long data)
|
||||
{
|
||||
@@ -1818,8 +1878,6 @@ ath5k_tasklet_rx(unsigned long data)
|
||||
struct ath5k_buf *bf;
|
||||
struct ath5k_desc *ds;
|
||||
int ret;
|
||||
int hdrlen;
|
||||
int padsize;
|
||||
int rx_flag;
|
||||
|
||||
spin_lock(&sc->rxbuflock);
|
||||
@@ -1844,18 +1902,28 @@ ath5k_tasklet_rx(unsigned long data)
|
||||
break;
|
||||
else if (unlikely(ret)) {
|
||||
ATH5K_ERR(sc, "error in processing rx descriptor\n");
|
||||
sc->stats.rxerr_proc++;
|
||||
spin_unlock(&sc->rxbuflock);
|
||||
return;
|
||||
}
|
||||
|
||||
sc->stats.rx_all_count++;
|
||||
|
||||
if (unlikely(rs.rs_more)) {
|
||||
ATH5K_WARN(sc, "unsupported jumbo\n");
|
||||
sc->stats.rxerr_jumbo++;
|
||||
goto next;
|
||||
}
|
||||
|
||||
if (unlikely(rs.rs_status)) {
|
||||
if (rs.rs_status & AR5K_RXERR_PHY)
|
||||
if (rs.rs_status & AR5K_RXERR_CRC)
|
||||
sc->stats.rxerr_crc++;
|
||||
if (rs.rs_status & AR5K_RXERR_FIFO)
|
||||
sc->stats.rxerr_fifo++;
|
||||
if (rs.rs_status & AR5K_RXERR_PHY) {
|
||||
sc->stats.rxerr_phy++;
|
||||
goto next;
|
||||
}
|
||||
if (rs.rs_status & AR5K_RXERR_DECRYPT) {
|
||||
/*
|
||||
* Decrypt error. If the error occurred
|
||||
@@ -1867,12 +1935,14 @@ ath5k_tasklet_rx(unsigned long data)
|
||||
*
|
||||
* XXX do key cache faulting
|
||||
*/
|
||||
sc->stats.rxerr_decrypt++;
|
||||
if (rs.rs_keyix == AR5K_RXKEYIX_INVALID &&
|
||||
!(rs.rs_status & AR5K_RXERR_CRC))
|
||||
goto accept;
|
||||
}
|
||||
if (rs.rs_status & AR5K_RXERR_MIC) {
|
||||
rx_flag |= RX_FLAG_MMIC_ERROR;
|
||||
sc->stats.rxerr_mic++;
|
||||
goto accept;
|
||||
}
|
||||
|
||||
@@ -1904,12 +1974,8 @@ accept:
|
||||
* bytes and we can optimize this a bit. In addition, we must
|
||||
* not try to remove padding from short control frames that do
|
||||
* not have payload. */
|
||||
hdrlen = ieee80211_get_hdrlen_from_skb(skb);
|
||||
padsize = ath5k_pad_size(hdrlen);
|
||||
if (padsize) {
|
||||
memmove(skb->data + padsize, skb->data, hdrlen);
|
||||
skb_pull(skb, padsize);
|
||||
}
|
||||
ath5k_remove_padding(skb);
|
||||
|
||||
rxs = IEEE80211_SKB_RXCB(skb);
|
||||
|
||||
/*
|
||||
@@ -1942,6 +2008,12 @@ accept:
|
||||
rxs->signal = rxs->noise + rs.rs_rssi;
|
||||
|
||||
rxs->antenna = rs.rs_antenna;
|
||||
|
||||
if (rs.rs_antenna > 0 && rs.rs_antenna < 5)
|
||||
sc->stats.antenna_rx[rs.rs_antenna]++;
|
||||
else
|
||||
sc->stats.antenna_rx[0]++; /* invalid */
|
||||
|
||||
rxs->rate_idx = ath5k_hw_to_driver_rix(sc, rs.rs_rate);
|
||||
rxs->flag |= ath5k_rx_decrypted(sc, ds, skb, &rs);
|
||||
|
||||
@@ -1996,6 +2068,7 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
|
||||
break;
|
||||
}
|
||||
|
||||
sc->stats.tx_all_count++;
|
||||
skb = bf->skb;
|
||||
info = IEEE80211_SKB_CB(skb);
|
||||
bf->skb = NULL;
|
||||
@@ -2022,13 +2095,30 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
|
||||
|
||||
if (unlikely(ts.ts_status)) {
|
||||
sc->ll_stats.dot11ACKFailureCount++;
|
||||
if (ts.ts_status & AR5K_TXERR_FILT)
|
||||
if (ts.ts_status & AR5K_TXERR_FILT) {
|
||||
info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
|
||||
sc->stats.txerr_filt++;
|
||||
}
|
||||
if (ts.ts_status & AR5K_TXERR_XRETRY)
|
||||
sc->stats.txerr_retry++;
|
||||
if (ts.ts_status & AR5K_TXERR_FIFO)
|
||||
sc->stats.txerr_fifo++;
|
||||
} else {
|
||||
info->flags |= IEEE80211_TX_STAT_ACK;
|
||||
info->status.ack_signal = ts.ts_rssi;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove MAC header padding before giving the frame
|
||||
* back to mac80211.
|
||||
*/
|
||||
ath5k_remove_padding(skb);
|
||||
|
||||
if (ts.ts_antenna > 0 && ts.ts_antenna < 5)
|
||||
sc->stats.antenna_tx[ts.ts_antenna]++;
|
||||
else
|
||||
sc->stats.antenna_tx[0]++; /* invalid */
|
||||
|
||||
ieee80211_tx_status(sc->hw, skb);
|
||||
|
||||
spin_lock(&sc->txbuflock);
|
||||
@@ -2072,6 +2162,7 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
|
||||
int ret = 0;
|
||||
u8 antenna;
|
||||
u32 flags;
|
||||
const int padsize = 0;
|
||||
|
||||
bf->skbaddr = pci_map_single(sc->pdev, skb->data, skb->len,
|
||||
PCI_DMA_TODEVICE);
|
||||
@@ -2119,7 +2210,7 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
|
||||
* from tx power (value is in dB units already) */
|
||||
ds->ds_data = bf->skbaddr;
|
||||
ret = ah->ah_setup_tx_desc(ah, ds, skb->len,
|
||||
ieee80211_get_hdrlen_from_skb(skb),
|
||||
ieee80211_get_hdrlen_from_skb(skb), padsize,
|
||||
AR5K_PKT_TYPE_BEACON, (sc->power_level * 2),
|
||||
ieee80211_get_tx_rate(sc->hw, info)->hw_value,
|
||||
1, AR5K_TXKEYIX_INVALID,
|
||||
@@ -2679,7 +2770,6 @@ static int ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
|
||||
struct ath5k_softc *sc = hw->priv;
|
||||
struct ath5k_buf *bf;
|
||||
unsigned long flags;
|
||||
int hdrlen;
|
||||
int padsize;
|
||||
|
||||
ath5k_debug_dump_skb(sc, skb, "TX ", 1);
|
||||
@@ -2691,17 +2781,11 @@ static int ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
|
||||
* the hardware expects the header padded to 4 byte boundaries
|
||||
* if this is not the case we add the padding after the header
|
||||
*/
|
||||
hdrlen = ieee80211_get_hdrlen_from_skb(skb);
|
||||
padsize = ath5k_pad_size(hdrlen);
|
||||
if (padsize) {
|
||||
|
||||
if (skb_headroom(skb) < padsize) {
|
||||
ATH5K_ERR(sc, "tx hdrlen not %%4: %d not enough"
|
||||
" headroom to pad %d\n", hdrlen, padsize);
|
||||
goto drop_packet;
|
||||
}
|
||||
skb_push(skb, padsize);
|
||||
memmove(skb->data, skb->data+padsize, hdrlen);
|
||||
padsize = ath5k_add_padding(skb);
|
||||
if (padsize < 0) {
|
||||
ATH5K_ERR(sc, "tx hdrlen not %%4: not enough"
|
||||
" headroom to pad");
|
||||
goto drop_packet;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&sc->txbuflock, flags);
|
||||
@@ -2720,7 +2804,7 @@ static int ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
|
||||
|
||||
bf->skb = skb;
|
||||
|
||||
if (ath5k_txbuf_setup(sc, bf, txq)) {
|
||||
if (ath5k_txbuf_setup(sc, bf, txq, padsize)) {
|
||||
bf->skb = NULL;
|
||||
spin_lock_irqsave(&sc->txbuflock, flags);
|
||||
list_add_tail(&bf->list, &sc->txbuf);
|
||||
@@ -2835,6 +2919,8 @@ static int ath5k_add_interface(struct ieee80211_hw *hw,
|
||||
goto end;
|
||||
}
|
||||
|
||||
ATH5K_DBG(sc, ATH5K_DEBUG_MODE, "add interface mode %d\n", sc->opmode);
|
||||
|
||||
ath5k_hw_set_lladdr(sc->ah, vif->addr);
|
||||
ath5k_mode_setup(sc);
|
||||
|
||||
@@ -2905,7 +2991,7 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed)
|
||||
* then we must allow the user to set how many tx antennas we
|
||||
* have available
|
||||
*/
|
||||
ath5k_hw_set_antenna_mode(ah, AR5K_ANTMODE_DEFAULT);
|
||||
ath5k_hw_set_antenna_mode(ah, ah->ah_ant_mode);
|
||||
|
||||
unlock:
|
||||
mutex_unlock(&sc->lock);
|
||||
|
||||
@@ -105,6 +105,24 @@ struct ath5k_rfkill {
|
||||
struct tasklet_struct toggleq;
|
||||
};
|
||||
|
||||
/* statistics (only used for debugging now) */
|
||||
struct ath5k_statistics {
|
||||
unsigned int antenna_rx[5]; /* frames count per antenna RX */
|
||||
unsigned int antenna_tx[5]; /* frames count per antenna TX */
|
||||
unsigned int rx_all_count; /* all RX frames, including errors */
|
||||
unsigned int tx_all_count; /* all TX frames, including errors */
|
||||
unsigned int rxerr_crc;
|
||||
unsigned int rxerr_phy;
|
||||
unsigned int rxerr_fifo;
|
||||
unsigned int rxerr_decrypt;
|
||||
unsigned int rxerr_mic;
|
||||
unsigned int rxerr_proc;
|
||||
unsigned int rxerr_jumbo;
|
||||
unsigned int txerr_retry;
|
||||
unsigned int txerr_fifo;
|
||||
unsigned int txerr_filt;
|
||||
};
|
||||
|
||||
#if CHAN_DEBUG
|
||||
#define ATH_CHAN_MAX (26+26+26+200+200)
|
||||
#else
|
||||
@@ -191,6 +209,8 @@ struct ath5k_softc {
|
||||
int power_level; /* Requested tx power in dbm */
|
||||
bool assoc; /* associate state */
|
||||
bool enable_beacon; /* true if beacons are on */
|
||||
|
||||
struct ath5k_statistics stats;
|
||||
};
|
||||
|
||||
#define ath5k_hw_hasbssidmask(_ah) \
|
||||
|
||||
@@ -102,9 +102,6 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
|
||||
}
|
||||
}
|
||||
|
||||
/* GPIO */
|
||||
ah->ah_gpio_npins = AR5K_NUM_GPIO;
|
||||
|
||||
/* Set number of supported TX queues */
|
||||
if (ah->ah_version == AR5K_AR5210)
|
||||
ah->ah_capabilities.cap_queues.q_tx_num =
|
||||
|
||||
@@ -364,6 +364,207 @@ static const struct file_operations fops_debug = {
|
||||
};
|
||||
|
||||
|
||||
/* debugfs: antenna */
|
||||
|
||||
static ssize_t read_file_antenna(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath5k_softc *sc = file->private_data;
|
||||
char buf[700];
|
||||
unsigned int len = 0;
|
||||
unsigned int i;
|
||||
unsigned int v;
|
||||
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "antenna mode\t%d\n",
|
||||
sc->ah->ah_ant_mode);
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "default antenna\t%d\n",
|
||||
sc->ah->ah_def_ant);
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "tx antenna\t%d\n",
|
||||
sc->ah->ah_tx_ant);
|
||||
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "\nANTENNA\t\tRX\tTX\n");
|
||||
for (i = 1; i < ARRAY_SIZE(sc->stats.antenna_rx); i++) {
|
||||
len += snprintf(buf+len, sizeof(buf)-len,
|
||||
"[antenna %d]\t%d\t%d\n",
|
||||
i, sc->stats.antenna_rx[i], sc->stats.antenna_tx[i]);
|
||||
}
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "[invalid]\t%d\t%d\n",
|
||||
sc->stats.antenna_rx[0], sc->stats.antenna_tx[0]);
|
||||
|
||||
v = ath5k_hw_reg_read(sc->ah, AR5K_DEFAULT_ANTENNA);
|
||||
len += snprintf(buf+len, sizeof(buf)-len,
|
||||
"\nAR5K_DEFAULT_ANTENNA\t0x%08x\n", v);
|
||||
|
||||
v = ath5k_hw_reg_read(sc->ah, AR5K_STA_ID1);
|
||||
len += snprintf(buf+len, sizeof(buf)-len,
|
||||
"AR5K_STA_ID1_DEFAULT_ANTENNA\t%d\n",
|
||||
(v & AR5K_STA_ID1_DEFAULT_ANTENNA) != 0);
|
||||
len += snprintf(buf+len, sizeof(buf)-len,
|
||||
"AR5K_STA_ID1_DESC_ANTENNA\t%d\n",
|
||||
(v & AR5K_STA_ID1_DESC_ANTENNA) != 0);
|
||||
len += snprintf(buf+len, sizeof(buf)-len,
|
||||
"AR5K_STA_ID1_RTS_DEF_ANTENNA\t%d\n",
|
||||
(v & AR5K_STA_ID1_RTS_DEF_ANTENNA) != 0);
|
||||
len += snprintf(buf+len, sizeof(buf)-len,
|
||||
"AR5K_STA_ID1_SELFGEN_DEF_ANT\t%d\n",
|
||||
(v & AR5K_STA_ID1_SELFGEN_DEF_ANT) != 0);
|
||||
|
||||
v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_AGCCTL);
|
||||
len += snprintf(buf+len, sizeof(buf)-len,
|
||||
"\nAR5K_PHY_AGCCTL_OFDM_DIV_DIS\t%d\n",
|
||||
(v & AR5K_PHY_AGCCTL_OFDM_DIV_DIS) != 0);
|
||||
|
||||
v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_RESTART);
|
||||
len += snprintf(buf+len, sizeof(buf)-len,
|
||||
"AR5K_PHY_RESTART_DIV_GC\t\t%x\n",
|
||||
(v & AR5K_PHY_RESTART_DIV_GC) >> AR5K_PHY_RESTART_DIV_GC_S);
|
||||
|
||||
v = ath5k_hw_reg_read(sc->ah, AR5K_PHY_FAST_ANT_DIV);
|
||||
len += snprintf(buf+len, sizeof(buf)-len,
|
||||
"AR5K_PHY_FAST_ANT_DIV_EN\t%d\n",
|
||||
(v & AR5K_PHY_FAST_ANT_DIV_EN) != 0);
|
||||
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||
}
|
||||
|
||||
static ssize_t write_file_antenna(struct file *file,
|
||||
const char __user *userbuf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath5k_softc *sc = file->private_data;
|
||||
unsigned int i;
|
||||
char buf[20];
|
||||
|
||||
if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
|
||||
return -EFAULT;
|
||||
|
||||
if (strncmp(buf, "diversity", 9) == 0) {
|
||||
ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_DEFAULT);
|
||||
printk(KERN_INFO "ath5k debug: enable diversity\n");
|
||||
} else if (strncmp(buf, "fixed-a", 7) == 0) {
|
||||
ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_A);
|
||||
printk(KERN_INFO "ath5k debugfs: fixed antenna A\n");
|
||||
} else if (strncmp(buf, "fixed-b", 7) == 0) {
|
||||
ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_B);
|
||||
printk(KERN_INFO "ath5k debug: fixed antenna B\n");
|
||||
} else if (strncmp(buf, "clear", 5) == 0) {
|
||||
for (i = 0; i < ARRAY_SIZE(sc->stats.antenna_rx); i++) {
|
||||
sc->stats.antenna_rx[i] = 0;
|
||||
sc->stats.antenna_tx[i] = 0;
|
||||
}
|
||||
printk(KERN_INFO "ath5k debug: cleared antenna stats\n");
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_antenna = {
|
||||
.read = read_file_antenna,
|
||||
.write = write_file_antenna,
|
||||
.open = ath5k_debugfs_open,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
|
||||
/* debugfs: frameerrors */
|
||||
|
||||
static ssize_t read_file_frameerrors(struct file *file, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath5k_softc *sc = file->private_data;
|
||||
struct ath5k_statistics *st = &sc->stats;
|
||||
char buf[700];
|
||||
unsigned int len = 0;
|
||||
|
||||
len += snprintf(buf+len, sizeof(buf)-len,
|
||||
"RX\n---------------------\n");
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "CRC\t%d\t(%d%%)\n",
|
||||
st->rxerr_crc,
|
||||
st->rx_all_count > 0 ?
|
||||
st->rxerr_crc*100/st->rx_all_count : 0);
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "PHY\t%d\t(%d%%)\n",
|
||||
st->rxerr_phy,
|
||||
st->rx_all_count > 0 ?
|
||||
st->rxerr_phy*100/st->rx_all_count : 0);
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "FIFO\t%d\t(%d%%)\n",
|
||||
st->rxerr_fifo,
|
||||
st->rx_all_count > 0 ?
|
||||
st->rxerr_fifo*100/st->rx_all_count : 0);
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "decrypt\t%d\t(%d%%)\n",
|
||||
st->rxerr_decrypt,
|
||||
st->rx_all_count > 0 ?
|
||||
st->rxerr_decrypt*100/st->rx_all_count : 0);
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "MIC\t%d\t(%d%%)\n",
|
||||
st->rxerr_mic,
|
||||
st->rx_all_count > 0 ?
|
||||
st->rxerr_mic*100/st->rx_all_count : 0);
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "process\t%d\t(%d%%)\n",
|
||||
st->rxerr_proc,
|
||||
st->rx_all_count > 0 ?
|
||||
st->rxerr_proc*100/st->rx_all_count : 0);
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "jumbo\t%d\t(%d%%)\n",
|
||||
st->rxerr_jumbo,
|
||||
st->rx_all_count > 0 ?
|
||||
st->rxerr_jumbo*100/st->rx_all_count : 0);
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "[RX all\t%d]\n",
|
||||
st->rx_all_count);
|
||||
|
||||
len += snprintf(buf+len, sizeof(buf)-len,
|
||||
"\nTX\n---------------------\n");
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "retry\t%d\t(%d%%)\n",
|
||||
st->txerr_retry,
|
||||
st->tx_all_count > 0 ?
|
||||
st->txerr_retry*100/st->tx_all_count : 0);
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "FIFO\t%d\t(%d%%)\n",
|
||||
st->txerr_fifo,
|
||||
st->tx_all_count > 0 ?
|
||||
st->txerr_fifo*100/st->tx_all_count : 0);
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "filter\t%d\t(%d%%)\n",
|
||||
st->txerr_filt,
|
||||
st->tx_all_count > 0 ?
|
||||
st->txerr_filt*100/st->tx_all_count : 0);
|
||||
len += snprintf(buf+len, sizeof(buf)-len, "[TX all\t%d]\n",
|
||||
st->tx_all_count);
|
||||
|
||||
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
||||
}
|
||||
|
||||
static ssize_t write_file_frameerrors(struct file *file,
|
||||
const char __user *userbuf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct ath5k_softc *sc = file->private_data;
|
||||
struct ath5k_statistics *st = &sc->stats;
|
||||
char buf[20];
|
||||
|
||||
if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
|
||||
return -EFAULT;
|
||||
|
||||
if (strncmp(buf, "clear", 5) == 0) {
|
||||
st->rxerr_crc = 0;
|
||||
st->rxerr_phy = 0;
|
||||
st->rxerr_fifo = 0;
|
||||
st->rxerr_decrypt = 0;
|
||||
st->rxerr_mic = 0;
|
||||
st->rxerr_proc = 0;
|
||||
st->rxerr_jumbo = 0;
|
||||
st->rx_all_count = 0;
|
||||
st->txerr_retry = 0;
|
||||
st->txerr_fifo = 0;
|
||||
st->txerr_filt = 0;
|
||||
st->tx_all_count = 0;
|
||||
printk(KERN_INFO "ath5k debug: cleared frameerrors stats\n");
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations fops_frameerrors = {
|
||||
.read = read_file_frameerrors,
|
||||
.write = write_file_frameerrors,
|
||||
.open = ath5k_debugfs_open,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
|
||||
/* init */
|
||||
|
||||
void
|
||||
@@ -393,6 +594,15 @@ ath5k_debug_init_device(struct ath5k_softc *sc)
|
||||
|
||||
sc->debug.debugfs_reset = debugfs_create_file("reset", S_IWUSR,
|
||||
sc->debug.debugfs_phydir, sc, &fops_reset);
|
||||
|
||||
sc->debug.debugfs_antenna = debugfs_create_file("antenna",
|
||||
S_IWUSR | S_IRUSR,
|
||||
sc->debug.debugfs_phydir, sc, &fops_antenna);
|
||||
|
||||
sc->debug.debugfs_frameerrors = debugfs_create_file("frameerrors",
|
||||
S_IWUSR | S_IRUSR,
|
||||
sc->debug.debugfs_phydir, sc,
|
||||
&fops_frameerrors);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -408,6 +618,8 @@ ath5k_debug_finish_device(struct ath5k_softc *sc)
|
||||
debugfs_remove(sc->debug.debugfs_registers);
|
||||
debugfs_remove(sc->debug.debugfs_beacon);
|
||||
debugfs_remove(sc->debug.debugfs_reset);
|
||||
debugfs_remove(sc->debug.debugfs_antenna);
|
||||
debugfs_remove(sc->debug.debugfs_frameerrors);
|
||||
debugfs_remove(sc->debug.debugfs_phydir);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,8 @@ struct ath5k_dbg_info {
|
||||
struct dentry *debugfs_registers;
|
||||
struct dentry *debugfs_beacon;
|
||||
struct dentry *debugfs_reset;
|
||||
struct dentry *debugfs_antenna;
|
||||
struct dentry *debugfs_frameerrors;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
*/
|
||||
static int
|
||||
ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
|
||||
unsigned int pkt_len, unsigned int hdr_len, enum ath5k_pkt_type type,
|
||||
unsigned int pkt_len, unsigned int hdr_len, int padsize,
|
||||
enum ath5k_pkt_type type,
|
||||
unsigned int tx_power, unsigned int tx_rate0, unsigned int tx_tries0,
|
||||
unsigned int key_index, unsigned int antenna_mode, unsigned int flags,
|
||||
unsigned int rtscts_rate, unsigned int rtscts_duration)
|
||||
@@ -71,7 +72,7 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
|
||||
/* Verify and set frame length */
|
||||
|
||||
/* remove padding we might have added before */
|
||||
frame_len = pkt_len - ath5k_pad_size(hdr_len) + FCS_LEN;
|
||||
frame_len = pkt_len - padsize + FCS_LEN;
|
||||
|
||||
if (frame_len & ~AR5K_2W_TX_DESC_CTL0_FRAME_LEN)
|
||||
return -EINVAL;
|
||||
@@ -100,7 +101,7 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
|
||||
AR5K_REG_SM(hdr_len, AR5K_2W_TX_DESC_CTL0_HEADER_LEN);
|
||||
}
|
||||
|
||||
/*Diferences between 5210-5211*/
|
||||
/*Differences between 5210-5211*/
|
||||
if (ah->ah_version == AR5K_AR5210) {
|
||||
switch (type) {
|
||||
case AR5K_PKT_TYPE_BEACON:
|
||||
@@ -165,6 +166,7 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
|
||||
*/
|
||||
static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
|
||||
struct ath5k_desc *desc, unsigned int pkt_len, unsigned int hdr_len,
|
||||
int padsize,
|
||||
enum ath5k_pkt_type type, unsigned int tx_power, unsigned int tx_rate0,
|
||||
unsigned int tx_tries0, unsigned int key_index,
|
||||
unsigned int antenna_mode, unsigned int flags,
|
||||
@@ -206,7 +208,7 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
|
||||
/* Verify and set frame length */
|
||||
|
||||
/* remove padding we might have added before */
|
||||
frame_len = pkt_len - ath5k_pad_size(hdr_len) + FCS_LEN;
|
||||
frame_len = pkt_len - padsize + FCS_LEN;
|
||||
|
||||
if (frame_len & ~AR5K_4W_TX_DESC_CTL0_FRAME_LEN)
|
||||
return -EINVAL;
|
||||
@@ -229,7 +231,7 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
|
||||
AR5K_REG_SM(antenna_mode, AR5K_4W_TX_DESC_CTL0_ANT_MODE_XMIT);
|
||||
tx_ctl->tx_control_1 |= AR5K_REG_SM(type,
|
||||
AR5K_4W_TX_DESC_CTL1_FRAME_TYPE);
|
||||
tx_ctl->tx_control_2 = AR5K_REG_SM(tx_tries0 + AR5K_TUNE_HWTXTRIES,
|
||||
tx_ctl->tx_control_2 = AR5K_REG_SM(tx_tries0,
|
||||
AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0);
|
||||
tx_ctl->tx_control_3 = tx_rate0 & AR5K_4W_TX_DESC_CTL3_XMIT_RATE0;
|
||||
|
||||
@@ -668,12 +670,6 @@ int ath5k_hw_init_desc_functions(struct ath5k_hw *ah)
|
||||
ah->ah_version != AR5K_AR5212)
|
||||
return -ENOTSUPP;
|
||||
|
||||
/* XXX: What is this magic value and where is it used ? */
|
||||
if (ah->ah_version == AR5K_AR5212)
|
||||
ah->ah_magic = AR5K_EEPROM_MAGIC_5212;
|
||||
else if (ah->ah_version == AR5K_AR5211)
|
||||
ah->ah_magic = AR5K_EEPROM_MAGIC_5211;
|
||||
|
||||
if (ah->ah_version == AR5K_AR5212) {
|
||||
ah->ah_setup_rx_desc = ath5k_hw_setup_rx_desc;
|
||||
ah->ah_setup_tx_desc = ath5k_hw_setup_4word_tx_desc;
|
||||
|
||||
@@ -329,7 +329,8 @@ static int ath5k_eeprom_read_modes(struct ath5k_hw *ah, u32 *offset,
|
||||
ee->ee_x_gain[mode] = (val >> 1) & 0xf;
|
||||
ee->ee_xpd[mode] = val & 0x1;
|
||||
|
||||
if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0)
|
||||
if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0 &&
|
||||
mode != AR5K_EEPROM_MODE_11B)
|
||||
ee->ee_fixed_bias[mode] = (val >> 13) & 0x1;
|
||||
|
||||
if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_3_3) {
|
||||
@@ -339,6 +340,7 @@ static int ath5k_eeprom_read_modes(struct ath5k_hw *ah, u32 *offset,
|
||||
if (mode == AR5K_EEPROM_MODE_11A)
|
||||
ee->ee_xr_power[mode] = val & 0x3f;
|
||||
else {
|
||||
/* b_DB_11[bg] and b_OB_11[bg] */
|
||||
ee->ee_ob[mode][0] = val & 0x7;
|
||||
ee->ee_db[mode][0] = (val >> 3) & 0x7;
|
||||
}
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
* SERDES infos are present */
|
||||
#define AR5K_EEPROM_MAGIC 0x003d /* EEPROM Magic number */
|
||||
#define AR5K_EEPROM_MAGIC_VALUE 0x5aa5 /* Default - found on EEPROM */
|
||||
#define AR5K_EEPROM_MAGIC_5212 0x0000145c /* 5212 */
|
||||
#define AR5K_EEPROM_MAGIC_5211 0x0000145b /* 5211 */
|
||||
#define AR5K_EEPROM_MAGIC_5210 0x0000145a /* 5210 */
|
||||
|
||||
#define AR5K_EEPROM_IS_HB63 0x000b /* Talon detect */
|
||||
|
||||
@@ -78,9 +75,9 @@
|
||||
#define AR5K_EEPROM_HDR_11A(_v) (((_v) >> AR5K_EEPROM_MODE_11A) & 0x1)
|
||||
#define AR5K_EEPROM_HDR_11B(_v) (((_v) >> AR5K_EEPROM_MODE_11B) & 0x1)
|
||||
#define AR5K_EEPROM_HDR_11G(_v) (((_v) >> AR5K_EEPROM_MODE_11G) & 0x1)
|
||||
#define AR5K_EEPROM_HDR_T_2GHZ_DIS(_v) (((_v) >> 3) & 0x1) /* Disable turbo for 2Ghz (?) */
|
||||
#define AR5K_EEPROM_HDR_T_5GHZ_DBM(_v) (((_v) >> 4) & 0x7f) /* Max turbo power for a/XR mode (eeprom_init) */
|
||||
#define AR5K_EEPROM_HDR_DEVICE(_v) (((_v) >> 11) & 0x7)
|
||||
#define AR5K_EEPROM_HDR_T_2GHZ_DIS(_v) (((_v) >> 3) & 0x1) /* Disable turbo for 2Ghz */
|
||||
#define AR5K_EEPROM_HDR_T_5GHZ_DBM(_v) (((_v) >> 4) & 0x7f) /* Max turbo power for < 2W power consumption */
|
||||
#define AR5K_EEPROM_HDR_DEVICE(_v) (((_v) >> 11) & 0x7) /* Device type (1 Cardbus, 2 PCI, 3 MiniPCI, 4 AP) */
|
||||
#define AR5K_EEPROM_HDR_RFKILL(_v) (((_v) >> 14) & 0x1) /* Device has RFKill support */
|
||||
#define AR5K_EEPROM_HDR_T_5GHZ_DIS(_v) (((_v) >> 15) & 0x1) /* Disable turbo for 5Ghz */
|
||||
|
||||
@@ -101,7 +98,7 @@
|
||||
|
||||
#define AR5K_EEPROM_MISC1 AR5K_EEPROM_INFO(5)
|
||||
#define AR5K_EEPROM_TARGET_PWRSTART(_v) ((_v) & 0xfff)
|
||||
#define AR5K_EEPROM_HAS32KHZCRYSTAL(_v) (((_v) >> 14) & 0x1)
|
||||
#define AR5K_EEPROM_HAS32KHZCRYSTAL(_v) (((_v) >> 14) & 0x1) /* has 32KHz crystal for sleep mode */
|
||||
#define AR5K_EEPROM_HAS32KHZCRYSTAL_OLD(_v) (((_v) >> 15) & 0x1)
|
||||
|
||||
#define AR5K_EEPROM_MISC2 AR5K_EEPROM_INFO(6)
|
||||
@@ -114,26 +111,27 @@
|
||||
|
||||
#define AR5K_EEPROM_MISC4 AR5K_EEPROM_INFO(8)
|
||||
#define AR5K_EEPROM_CAL_DATA_START(_v) (((_v) >> 4) & 0xfff)
|
||||
#define AR5K_EEPROM_MASK_R0(_v) (((_v) >> 2) & 0x3)
|
||||
#define AR5K_EEPROM_MASK_R1(_v) ((_v) & 0x3)
|
||||
#define AR5K_EEPROM_MASK_R0(_v) (((_v) >> 2) & 0x3) /* modes supported by radio 0 (bit 1: G, bit 2: A) */
|
||||
#define AR5K_EEPROM_MASK_R1(_v) ((_v) & 0x3) /* modes supported by radio 1 (bit 1: G, bit 2: A) */
|
||||
|
||||
#define AR5K_EEPROM_MISC5 AR5K_EEPROM_INFO(9)
|
||||
#define AR5K_EEPROM_COMP_DIS(_v) ((_v) & 0x1)
|
||||
#define AR5K_EEPROM_AES_DIS(_v) (((_v) >> 1) & 0x1)
|
||||
#define AR5K_EEPROM_FF_DIS(_v) (((_v) >> 2) & 0x1)
|
||||
#define AR5K_EEPROM_BURST_DIS(_v) (((_v) >> 3) & 0x1)
|
||||
#define AR5K_EEPROM_MAX_QCU(_v) (((_v) >> 4) & 0xf)
|
||||
#define AR5K_EEPROM_HEAVY_CLIP_EN(_v) (((_v) >> 8) & 0x1)
|
||||
#define AR5K_EEPROM_KEY_CACHE_SIZE(_v) (((_v) >> 12) & 0xf)
|
||||
#define AR5K_EEPROM_COMP_DIS(_v) ((_v) & 0x1) /* disable compression */
|
||||
#define AR5K_EEPROM_AES_DIS(_v) (((_v) >> 1) & 0x1) /* disable AES */
|
||||
#define AR5K_EEPROM_FF_DIS(_v) (((_v) >> 2) & 0x1) /* disable fast frames */
|
||||
#define AR5K_EEPROM_BURST_DIS(_v) (((_v) >> 3) & 0x1) /* disable bursting */
|
||||
#define AR5K_EEPROM_MAX_QCU(_v) (((_v) >> 4) & 0xf) /* max number of QCUs. defaults to 10 */
|
||||
#define AR5K_EEPROM_HEAVY_CLIP_EN(_v) (((_v) >> 8) & 0x1) /* enable heayy clipping */
|
||||
#define AR5K_EEPROM_KEY_CACHE_SIZE(_v) (((_v) >> 12) & 0xf) /* key cache size. defaults to 128 */
|
||||
|
||||
#define AR5K_EEPROM_MISC6 AR5K_EEPROM_INFO(10)
|
||||
#define AR5K_EEPROM_TX_CHAIN_DIS ((_v) & 0x8)
|
||||
#define AR5K_EEPROM_RX_CHAIN_DIS (((_v) >> 3) & 0x8)
|
||||
#define AR5K_EEPROM_FCC_MID_EN (((_v) >> 6) & 0x1)
|
||||
#define AR5K_EEPROM_JAP_U1EVEN_EN (((_v) >> 7) & 0x1)
|
||||
#define AR5K_EEPROM_JAP_U2_EN (((_v) >> 8) & 0x1)
|
||||
#define AR5K_EEPROM_JAP_U1ODD_EN (((_v) >> 9) & 0x1)
|
||||
#define AR5K_EEPROM_JAP_11A_NEW_EN (((_v) >> 10) & 0x1)
|
||||
#define AR5K_EEPROM_TX_CHAIN_DIS ((_v) & 0x7) /* MIMO chains disabled for TX bitmask */
|
||||
#define AR5K_EEPROM_RX_CHAIN_DIS (((_v) >> 3) & 0x7) /* MIMO chains disabled for RX bitmask */
|
||||
#define AR5K_EEPROM_FCC_MID_EN (((_v) >> 6) & 0x1) /* 5.47-5.7GHz supported */
|
||||
#define AR5K_EEPROM_JAP_U1EVEN_EN (((_v) >> 7) & 0x1) /* Japan UNII1 band (5.15-5.25GHz) on even channels (5180, 5200, 5220, 5240) supported */
|
||||
#define AR5K_EEPROM_JAP_U2_EN (((_v) >> 8) & 0x1) /* Japan UNII2 band (5.25-5.35GHz) supported */
|
||||
#define AR5K_EEPROM_JAP_MID_EN (((_v) >> 9) & 0x1) /* Japan band from 5.47-5.7GHz supported */
|
||||
#define AR5K_EEPROM_JAP_U1ODD_EN (((_v) >> 10) & 0x1) /* Japan UNII2 band (5.15-5.25GHz) on odd channels (5170, 5190, 5210, 5230) supported */
|
||||
#define AR5K_EEPROM_JAP_11A_NEW_EN (((_v) >> 11) & 0x1) /* Japan A mode enabled (using even channels) */
|
||||
|
||||
/* calibration settings */
|
||||
#define AR5K_EEPROM_MODES_11A(_v) AR5K_EEPROM_OFF(_v, 0x00c5, 0x00d4)
|
||||
@@ -389,7 +387,49 @@ struct ath5k_edge_power {
|
||||
bool flag;
|
||||
};
|
||||
|
||||
/* EEPROM calibration data */
|
||||
/**
|
||||
* struct ath5k_eeprom_info - EEPROM calibration data
|
||||
*
|
||||
* @ee_regdomain: ath/regd.c takes care of COUNTRY_ERD and WORLDWIDE_ROAMING
|
||||
* flags
|
||||
* @ee_ant_gain: Antenna gain in 0.5dB steps signed [5211 only?]
|
||||
* @ee_cck_ofdm_gain_delta: difference in gainF to output the same power for
|
||||
* OFDM and CCK packets
|
||||
* @ee_cck_ofdm_power_delta: power difference between OFDM (6Mbps) and CCK
|
||||
* (11Mbps) rate in G mode. 0.1dB steps
|
||||
* @ee_scaled_cck_delta: for Japan Channel 14: 0.1dB resolution
|
||||
*
|
||||
* @ee_i_cal: Initial I coefficient to correct I/Q mismatch in the receive path
|
||||
* @ee_q_cal: Initial Q coefficient to correct I/Q mismatch in the receive path
|
||||
* @ee_fixed_bias: use ee_ob and ee_db settings or use automatic control
|
||||
* @ee_switch_settling: RX/TX Switch settling time
|
||||
* @ee_atn_tx_rx: Difference in attenuation between TX and RX in 1dB steps
|
||||
* @ee_ant_control: Antenna Control Settings
|
||||
* @ee_ob: Bias current for Output stage of PA
|
||||
* B/G mode: Index [0] is used for AR2112/5112, otherwise [1]
|
||||
* A mode: [0] 5.15-5.25 [1] 5.25-5.50 [2] 5.50-5.70 [3] 5.70-5.85 GHz
|
||||
* @ee_db: Bias current for Output stage of PA. see @ee_ob
|
||||
* @ee_tx_end2xlna_enable: Time difference from when BB finishes sending a frame
|
||||
* to when the external LNA is activated
|
||||
* @ee_tx_end2xpa_disable: Time difference from when BB finishes sending a frame
|
||||
* to when the external PA switch is deactivated
|
||||
* @ee_tx_frm2xpa_enable: Time difference from when MAC sends frame to when
|
||||
* external PA switch is activated
|
||||
* @ee_thr_62: Clear Channel Assessment (CCA) sensitivity
|
||||
* (IEEE802.11a section 17.3.10.5 )
|
||||
* @ee_xlna_gain: Total gain of the LNA (information only)
|
||||
* @ee_xpd: Use external (1) or internal power detector
|
||||
* @ee_x_gain: Gain for external power detector output (differences in EEMAP
|
||||
* versions!)
|
||||
* @ee_i_gain: Initial gain value after reset
|
||||
* @ee_margin_tx_rx: Margin in dB when final attenuation stage should be used
|
||||
*
|
||||
* @ee_false_detect: Backoff in Sensitivity (dB) on channels with spur signals
|
||||
* @ee_noise_floor_thr: Noise floor threshold in 1dB steps
|
||||
* @ee_adc_desired_size: Desired amplitude for ADC, used by AGC; in 0.5 dB steps
|
||||
* @ee_pga_desired_size: Desired output of PGA (for BB gain) in 0.5 dB steps
|
||||
* @ee_pd_gain_overlap: PD ADC curves need to overlap in 0.5dB steps (ee_map>=2)
|
||||
*/
|
||||
struct ath5k_eeprom_info {
|
||||
|
||||
/* Header information */
|
||||
|
||||
@@ -39,16 +39,16 @@
|
||||
* ath5k_hw_set_opmode - Set PCU operating mode
|
||||
*
|
||||
* @ah: The &struct ath5k_hw
|
||||
* @op_mode: &enum nl80211_iftype operating mode
|
||||
*
|
||||
* Initialize PCU for the various operating modes (AP/STA etc)
|
||||
*
|
||||
* NOTE: ah->ah_op_mode must be set before calling this.
|
||||
*/
|
||||
int ath5k_hw_set_opmode(struct ath5k_hw *ah)
|
||||
int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype op_mode)
|
||||
{
|
||||
struct ath_common *common = ath5k_hw_common(ah);
|
||||
u32 pcu_reg, beacon_reg, low_id, high_id;
|
||||
|
||||
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_MODE, "mode %d\n", op_mode);
|
||||
|
||||
/* Preserve rest settings */
|
||||
pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000;
|
||||
@@ -61,7 +61,7 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah)
|
||||
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
|
||||
switch (ah->ah_op_mode) {
|
||||
switch (op_mode) {
|
||||
case NL80211_IFTYPE_ADHOC:
|
||||
pcu_reg |= AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_KEYSRCH_MODE;
|
||||
beacon_reg |= AR5K_BCR_ADHOC;
|
||||
@@ -178,26 +178,13 @@ void ath5k_hw_set_ack_bitrate_high(struct ath5k_hw *ah, bool high)
|
||||
* ACK/CTS Timeouts *
|
||||
\******************/
|
||||
|
||||
/**
|
||||
* ath5k_hw_het_ack_timeout - Get ACK timeout from PCU in usec
|
||||
*
|
||||
* @ah: The &struct ath5k_hw
|
||||
*/
|
||||
unsigned int ath5k_hw_get_ack_timeout(struct ath5k_hw *ah)
|
||||
{
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
|
||||
return ath5k_hw_clocktoh(ah, AR5K_REG_MS(ath5k_hw_reg_read(ah,
|
||||
AR5K_TIME_OUT), AR5K_TIME_OUT_ACK));
|
||||
}
|
||||
|
||||
/**
|
||||
* ath5k_hw_set_ack_timeout - Set ACK timeout on PCU
|
||||
*
|
||||
* @ah: The &struct ath5k_hw
|
||||
* @timeout: Timeout in usec
|
||||
*/
|
||||
int ath5k_hw_set_ack_timeout(struct ath5k_hw *ah, unsigned int timeout)
|
||||
static int ath5k_hw_set_ack_timeout(struct ath5k_hw *ah, unsigned int timeout)
|
||||
{
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
if (ath5k_hw_clocktoh(ah, AR5K_REG_MS(0xffffffff, AR5K_TIME_OUT_ACK))
|
||||
@@ -210,25 +197,13 @@ int ath5k_hw_set_ack_timeout(struct ath5k_hw *ah, unsigned int timeout)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ath5k_hw_get_cts_timeout - Get CTS timeout from PCU in usec
|
||||
*
|
||||
* @ah: The &struct ath5k_hw
|
||||
*/
|
||||
unsigned int ath5k_hw_get_cts_timeout(struct ath5k_hw *ah)
|
||||
{
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
return ath5k_hw_clocktoh(ah, AR5K_REG_MS(ath5k_hw_reg_read(ah,
|
||||
AR5K_TIME_OUT), AR5K_TIME_OUT_CTS));
|
||||
}
|
||||
|
||||
/**
|
||||
* ath5k_hw_set_cts_timeout - Set CTS timeout on PCU
|
||||
*
|
||||
* @ah: The &struct ath5k_hw
|
||||
* @timeout: Timeout in usec
|
||||
*/
|
||||
int ath5k_hw_set_cts_timeout(struct ath5k_hw *ah, unsigned int timeout)
|
||||
static int ath5k_hw_set_cts_timeout(struct ath5k_hw *ah, unsigned int timeout)
|
||||
{
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
if (ath5k_hw_clocktoh(ah, AR5K_REG_MS(0xffffffff, AR5K_TIME_OUT_CTS))
|
||||
@@ -290,7 +265,7 @@ unsigned int ath5k_hw_get_clockrate(struct ath5k_hw *ah)
|
||||
*
|
||||
* @ah: The &struct ath5k_hw
|
||||
*/
|
||||
unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah)
|
||||
static unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah)
|
||||
{
|
||||
struct ieee80211_channel *channel = ah->ah_current_channel;
|
||||
|
||||
@@ -308,7 +283,7 @@ unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah)
|
||||
*
|
||||
* @ah: The &struct ath5k_hw
|
||||
*/
|
||||
unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah)
|
||||
static unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah)
|
||||
{
|
||||
struct ieee80211_channel *channel = ah->ah_current_channel;
|
||||
|
||||
@@ -451,42 +426,6 @@ void ath5k_hw_set_mcast_filter(struct ath5k_hw *ah, u32 filter0, u32 filter1)
|
||||
ath5k_hw_reg_write(ah, filter1, AR5K_MCAST_FILTER1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set multicast filter by index
|
||||
*/
|
||||
int ath5k_hw_set_mcast_filter_idx(struct ath5k_hw *ah, u32 index)
|
||||
{
|
||||
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
if (index >= 64)
|
||||
return -EINVAL;
|
||||
else if (index >= 32)
|
||||
AR5K_REG_ENABLE_BITS(ah, AR5K_MCAST_FILTER1,
|
||||
(1 << (index - 32)));
|
||||
else
|
||||
AR5K_REG_ENABLE_BITS(ah, AR5K_MCAST_FILTER0, (1 << index));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear Multicast filter by index
|
||||
*/
|
||||
int ath5k_hw_clear_mcast_filter_idx(struct ath5k_hw *ah, u32 index)
|
||||
{
|
||||
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
if (index >= 64)
|
||||
return -EINVAL;
|
||||
else if (index >= 32)
|
||||
AR5K_REG_DISABLE_BITS(ah, AR5K_MCAST_FILTER1,
|
||||
(1 << (index - 32)));
|
||||
else
|
||||
AR5K_REG_DISABLE_BITS(ah, AR5K_MCAST_FILTER0, (1 << index));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ath5k_hw_get_rx_filter - Get current rx filter
|
||||
*
|
||||
@@ -571,19 +510,6 @@ void ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter)
|
||||
* Beacon control *
|
||||
\****************/
|
||||
|
||||
/**
|
||||
* ath5k_hw_get_tsf32 - Get a 32bit TSF
|
||||
*
|
||||
* @ah: The &struct ath5k_hw
|
||||
*
|
||||
* Returns lower 32 bits of current TSF
|
||||
*/
|
||||
u32 ath5k_hw_get_tsf32(struct ath5k_hw *ah)
|
||||
{
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
return ath5k_hw_reg_read(ah, AR5K_TSF_L32);
|
||||
}
|
||||
|
||||
/**
|
||||
* ath5k_hw_get_tsf64 - Get the full 64bit TSF
|
||||
*
|
||||
@@ -651,7 +577,7 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)
|
||||
/*
|
||||
* Set the additional timers by mode
|
||||
*/
|
||||
switch (ah->ah_op_mode) {
|
||||
switch (ah->ah_sc->opmode) {
|
||||
case NL80211_IFTYPE_MONITOR:
|
||||
case NL80211_IFTYPE_STATION:
|
||||
/* In STA mode timer1 is used as next wakeup
|
||||
@@ -688,8 +614,8 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)
|
||||
* Set the beacon register and enable all timers.
|
||||
*/
|
||||
/* When in AP or Mesh Point mode zero timer0 to start TSF */
|
||||
if (ah->ah_op_mode == NL80211_IFTYPE_AP ||
|
||||
ah->ah_op_mode == NL80211_IFTYPE_MESH_POINT)
|
||||
if (ah->ah_sc->opmode == NL80211_IFTYPE_AP ||
|
||||
ah->ah_sc->opmode == NL80211_IFTYPE_MESH_POINT)
|
||||
ath5k_hw_reg_write(ah, 0, AR5K_TIMER0);
|
||||
|
||||
ath5k_hw_reg_write(ah, next_beacon, AR5K_TIMER0);
|
||||
@@ -722,203 +648,6 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Set beacon timers
|
||||
*/
|
||||
int ath5k_hw_set_beacon_timers(struct ath5k_hw *ah,
|
||||
const struct ath5k_beacon_state *state)
|
||||
{
|
||||
u32 cfp_period, next_cfp, dtim, interval, next_beacon;
|
||||
|
||||
/*
|
||||
* TODO: should be changed through *state
|
||||
* review struct ath5k_beacon_state struct
|
||||
*
|
||||
* XXX: These are used for cfp period bellow, are they
|
||||
* ok ? Is it O.K. for tsf here to be 0 or should we use
|
||||
* get_tsf ?
|
||||
*/
|
||||
u32 dtim_count = 0; /* XXX */
|
||||
u32 cfp_count = 0; /* XXX */
|
||||
u32 tsf = 0; /* XXX */
|
||||
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
/* Return on an invalid beacon state */
|
||||
if (state->bs_interval < 1)
|
||||
return -EINVAL;
|
||||
|
||||
interval = state->bs_interval;
|
||||
dtim = state->bs_dtim_period;
|
||||
|
||||
/*
|
||||
* PCF support?
|
||||
*/
|
||||
if (state->bs_cfp_period > 0) {
|
||||
/*
|
||||
* Enable PCF mode and set the CFP
|
||||
* (Contention Free Period) and timer registers
|
||||
*/
|
||||
cfp_period = state->bs_cfp_period * state->bs_dtim_period *
|
||||
state->bs_interval;
|
||||
next_cfp = (cfp_count * state->bs_dtim_period + dtim_count) *
|
||||
state->bs_interval;
|
||||
|
||||
AR5K_REG_ENABLE_BITS(ah, AR5K_STA_ID1,
|
||||
AR5K_STA_ID1_DEFAULT_ANTENNA |
|
||||
AR5K_STA_ID1_PCF);
|
||||
ath5k_hw_reg_write(ah, cfp_period, AR5K_CFP_PERIOD);
|
||||
ath5k_hw_reg_write(ah, state->bs_cfp_max_duration,
|
||||
AR5K_CFP_DUR);
|
||||
ath5k_hw_reg_write(ah, (tsf + (next_cfp == 0 ? cfp_period :
|
||||
next_cfp)) << 3, AR5K_TIMER2);
|
||||
} else {
|
||||
/* Disable PCF mode */
|
||||
AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1,
|
||||
AR5K_STA_ID1_DEFAULT_ANTENNA |
|
||||
AR5K_STA_ID1_PCF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable the beacon timer register
|
||||
*/
|
||||
ath5k_hw_reg_write(ah, state->bs_next_beacon, AR5K_TIMER0);
|
||||
|
||||
/*
|
||||
* Start the beacon timers
|
||||
*/
|
||||
ath5k_hw_reg_write(ah, (ath5k_hw_reg_read(ah, AR5K_BEACON) &
|
||||
~(AR5K_BEACON_PERIOD | AR5K_BEACON_TIM)) |
|
||||
AR5K_REG_SM(state->bs_tim_offset ? state->bs_tim_offset + 4 : 0,
|
||||
AR5K_BEACON_TIM) | AR5K_REG_SM(state->bs_interval,
|
||||
AR5K_BEACON_PERIOD), AR5K_BEACON);
|
||||
|
||||
/*
|
||||
* Write new beacon miss threshold, if it appears to be valid
|
||||
* XXX: Figure out right values for min <= bs_bmiss_threshold <= max
|
||||
* and return if its not in range. We can test this by reading value and
|
||||
* setting value to a largest value and seeing which values register.
|
||||
*/
|
||||
|
||||
AR5K_REG_WRITE_BITS(ah, AR5K_RSSI_THR, AR5K_RSSI_THR_BMISS,
|
||||
state->bs_bmiss_threshold);
|
||||
|
||||
/*
|
||||
* Set sleep control register
|
||||
* XXX: Didn't find this in 5210 code but since this register
|
||||
* exists also in ar5k's 5210 headers i leave it as common code.
|
||||
*/
|
||||
AR5K_REG_WRITE_BITS(ah, AR5K_SLEEP_CTL, AR5K_SLEEP_CTL_SLDUR,
|
||||
(state->bs_sleep_duration - 3) << 3);
|
||||
|
||||
/*
|
||||
* Set enhanced sleep registers on 5212
|
||||
*/
|
||||
if (ah->ah_version == AR5K_AR5212) {
|
||||
if (state->bs_sleep_duration > state->bs_interval &&
|
||||
roundup(state->bs_sleep_duration, interval) ==
|
||||
state->bs_sleep_duration)
|
||||
interval = state->bs_sleep_duration;
|
||||
|
||||
if (state->bs_sleep_duration > dtim && (dtim == 0 ||
|
||||
roundup(state->bs_sleep_duration, dtim) ==
|
||||
state->bs_sleep_duration))
|
||||
dtim = state->bs_sleep_duration;
|
||||
|
||||
if (interval > dtim)
|
||||
return -EINVAL;
|
||||
|
||||
next_beacon = interval == dtim ? state->bs_next_dtim :
|
||||
state->bs_next_beacon;
|
||||
|
||||
ath5k_hw_reg_write(ah,
|
||||
AR5K_REG_SM((state->bs_next_dtim - 3) << 3,
|
||||
AR5K_SLEEP0_NEXT_DTIM) |
|
||||
AR5K_REG_SM(10, AR5K_SLEEP0_CABTO) |
|
||||
AR5K_SLEEP0_ENH_SLEEP_EN |
|
||||
AR5K_SLEEP0_ASSUME_DTIM, AR5K_SLEEP0);
|
||||
|
||||
ath5k_hw_reg_write(ah, AR5K_REG_SM((next_beacon - 3) << 3,
|
||||
AR5K_SLEEP1_NEXT_TIM) |
|
||||
AR5K_REG_SM(10, AR5K_SLEEP1_BEACON_TO), AR5K_SLEEP1);
|
||||
|
||||
ath5k_hw_reg_write(ah,
|
||||
AR5K_REG_SM(interval, AR5K_SLEEP2_TIM_PER) |
|
||||
AR5K_REG_SM(dtim, AR5K_SLEEP2_DTIM_PER), AR5K_SLEEP2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset beacon timers
|
||||
*/
|
||||
void ath5k_hw_reset_beacon(struct ath5k_hw *ah)
|
||||
{
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
/*
|
||||
* Disable beacon timer
|
||||
*/
|
||||
ath5k_hw_reg_write(ah, 0, AR5K_TIMER0);
|
||||
|
||||
/*
|
||||
* Disable some beacon register values
|
||||
*/
|
||||
AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1,
|
||||
AR5K_STA_ID1_DEFAULT_ANTENNA | AR5K_STA_ID1_PCF);
|
||||
ath5k_hw_reg_write(ah, AR5K_BEACON_PERIOD, AR5K_BEACON);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for beacon queue to finish
|
||||
*/
|
||||
int ath5k_hw_beaconq_finish(struct ath5k_hw *ah, unsigned long phys_addr)
|
||||
{
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
|
||||
/* 5210 doesn't have QCU*/
|
||||
if (ah->ah_version == AR5K_AR5210) {
|
||||
/*
|
||||
* Wait for beaconn queue to finish by checking
|
||||
* Control Register and Beacon Status Register.
|
||||
*/
|
||||
for (i = AR5K_TUNE_BEACON_INTERVAL / 2; i > 0; i--) {
|
||||
if (!(ath5k_hw_reg_read(ah, AR5K_BSR) & AR5K_BSR_TXQ1F)
|
||||
||
|
||||
!(ath5k_hw_reg_read(ah, AR5K_CR) & AR5K_BSR_TXQ1F))
|
||||
break;
|
||||
udelay(10);
|
||||
}
|
||||
|
||||
/* Timeout... */
|
||||
if (i <= 0) {
|
||||
/*
|
||||
* Re-schedule the beacon queue
|
||||
*/
|
||||
ath5k_hw_reg_write(ah, phys_addr, AR5K_NOQCU_TXDP1);
|
||||
ath5k_hw_reg_write(ah, AR5K_BCR_TQ1V | AR5K_BCR_BDMAE,
|
||||
AR5K_BCR);
|
||||
|
||||
return -EIO;
|
||||
}
|
||||
ret = 0;
|
||||
} else {
|
||||
/*5211/5212*/
|
||||
ret = ath5k_hw_register_timeout(ah,
|
||||
AR5K_QUEUE_STATUS(AR5K_TX_QUEUE_ID_BEACON),
|
||||
AR5K_QCU_STS_FRMPENDCNT, 0, false);
|
||||
|
||||
if (AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, AR5K_TX_QUEUE_ID_BEACON))
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*********************\
|
||||
* Key table functions *
|
||||
@@ -971,19 +700,6 @@ int ath5k_hw_reset_key(struct ath5k_hw *ah, u16 entry)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if a table entry is valid
|
||||
*/
|
||||
int ath5k_hw_is_key_valid(struct ath5k_hw *ah, u16 entry)
|
||||
{
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
AR5K_ASSERT_ENTRY(entry, AR5K_KEYTABLE_SIZE);
|
||||
|
||||
/* Check the validation flag at the end of the entry */
|
||||
return ath5k_hw_reg_read(ah, AR5K_KEYTABLE_MAC1(entry)) &
|
||||
AR5K_KEYTABLE_VALID;
|
||||
}
|
||||
|
||||
static
|
||||
int ath5k_keycache_type(const struct ieee80211_key_conf *key)
|
||||
{
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _ATH5K_PHY
|
||||
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include "ath5k.h"
|
||||
@@ -1190,7 +1188,7 @@ static s16 ath5k_hw_get_median_noise_floor(struct ath5k_hw *ah)
|
||||
* The median of the values in the history is then loaded into the
|
||||
* hardware for its own use for RSSI and CCA measurements.
|
||||
*/
|
||||
void ath5k_hw_update_noise_floor(struct ath5k_hw *ah)
|
||||
static void ath5k_hw_update_noise_floor(struct ath5k_hw *ah)
|
||||
{
|
||||
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
|
||||
u32 val;
|
||||
@@ -1399,7 +1397,11 @@ static int ath5k_hw_rf511x_calibrate(struct ath5k_hw *ah,
|
||||
}
|
||||
|
||||
i_coffd = ((i_pwr >> 1) + (q_pwr >> 1)) >> 7;
|
||||
q_coffd = q_pwr >> 7;
|
||||
|
||||
if (ah->ah_version == AR5K_AR5211)
|
||||
q_coffd = q_pwr >> 6;
|
||||
else
|
||||
q_coffd = q_pwr >> 7;
|
||||
|
||||
/* protect against divide by 0 and loss of sign bits */
|
||||
if (i_coffd == 0 || q_coffd < 2)
|
||||
@@ -1768,7 +1770,7 @@ u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan)
|
||||
* Antenna control *
|
||||
\*****************/
|
||||
|
||||
void /*TODO:Boundary check*/
|
||||
static void /*TODO:Boundary check*/
|
||||
ath5k_hw_set_def_antenna(struct ath5k_hw *ah, u8 ant)
|
||||
{
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
@@ -1777,16 +1779,6 @@ ath5k_hw_set_def_antenna(struct ath5k_hw *ah, u8 ant)
|
||||
ath5k_hw_reg_write(ah, ant & 0x7, AR5K_DEFAULT_ANTENNA);
|
||||
}
|
||||
|
||||
unsigned int ath5k_hw_get_def_antenna(struct ath5k_hw *ah)
|
||||
{
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
|
||||
if (ah->ah_version != AR5K_AR5210)
|
||||
return ath5k_hw_reg_read(ah, AR5K_DEFAULT_ANTENNA) & 0x7;
|
||||
|
||||
return false; /*XXX: What do we return for 5210 ?*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable/disable fast rx antenna diversity
|
||||
*/
|
||||
@@ -1930,6 +1922,7 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode)
|
||||
|
||||
ah->ah_tx_ant = tx_ant;
|
||||
ah->ah_ant_mode = ant_mode;
|
||||
ah->ah_def_ant = def_ant;
|
||||
|
||||
sta_id1 |= use_def_for_tx ? AR5K_STA_ID1_DEFAULT_ANTENNA : 0;
|
||||
sta_id1 |= update_def_on_tx ? AR5K_STA_ID1_DESC_ANTENNA : 0;
|
||||
@@ -2440,19 +2433,6 @@ ath5k_combine_linear_pcdac_curves(struct ath5k_hw *ah, s16* table_min,
|
||||
pcdac_tmp = pcdac_high_pwr;
|
||||
|
||||
edge_flag = 0x40;
|
||||
#if 0
|
||||
/* If both min and max power limits are in lower
|
||||
* power curve's range, only use the low power curve.
|
||||
* TODO: min/max levels are related to target
|
||||
* power values requested from driver/user
|
||||
* XXX: Is this really needed ? */
|
||||
if (min_pwr < table_max[1] &&
|
||||
max_pwr < table_max[1]) {
|
||||
edge_flag = 0;
|
||||
pcdac_tmp = pcdac_low_pwr;
|
||||
max_pwr_idx = (table_max[1] - table_min[1])/2;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
pcdac_low_pwr = ah->ah_txpower.tmpL[1]; /* Zeroed */
|
||||
pcdac_high_pwr = ah->ah_txpower.tmpL[0];
|
||||
@@ -3143,5 +3123,3 @@ int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower)
|
||||
|
||||
return ath5k_hw_txpower(ah, channel, ee_mode, txpower);
|
||||
}
|
||||
|
||||
#undef _ATH5K_PHY
|
||||
|
||||
@@ -516,23 +516,6 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get slot time from DCU
|
||||
*/
|
||||
unsigned int ath5k_hw_get_slot_time(struct ath5k_hw *ah)
|
||||
{
|
||||
unsigned int slot_time_clock;
|
||||
|
||||
ATH5K_TRACE(ah->ah_sc);
|
||||
|
||||
if (ah->ah_version == AR5K_AR5210)
|
||||
slot_time_clock = ath5k_hw_reg_read(ah, AR5K_SLOT_TIME);
|
||||
else
|
||||
slot_time_clock = ath5k_hw_reg_read(ah, AR5K_DCU_GBL_IFS_SLOT);
|
||||
|
||||
return ath5k_hw_clocktoh(ah, slot_time_clock & 0xffff);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set slot time on DCU
|
||||
*/
|
||||
|
||||
@@ -1974,7 +1974,7 @@
|
||||
#define AR5K_PHY_SETTLING 0x9844 /* Register Address */
|
||||
#define AR5K_PHY_SETTLING_AGC 0x0000007f /* AGC settling time */
|
||||
#define AR5K_PHY_SETTLING_AGC_S 0
|
||||
#define AR5K_PHY_SETTLING_SWITCH 0x00003f80 /* Switch settlig time */
|
||||
#define AR5K_PHY_SETTLING_SWITCH 0x00003f80 /* Switch settling time */
|
||||
#define AR5K_PHY_SETTLING_SWITCH_S 7
|
||||
|
||||
/*
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _ATH5K_RESET
|
||||
|
||||
/*****************************\
|
||||
Reset functions and helpers
|
||||
\*****************************/
|
||||
@@ -34,6 +32,27 @@
|
||||
#include "base.h"
|
||||
#include "debug.h"
|
||||
|
||||
/*
|
||||
* Check if a register write has been completed
|
||||
*/
|
||||
int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag, u32 val,
|
||||
bool is_set)
|
||||
{
|
||||
int i;
|
||||
u32 data;
|
||||
|
||||
for (i = AR5K_TUNE_REGISTER_TIMEOUT; i > 0; i--) {
|
||||
data = ath5k_hw_reg_read(ah, reg);
|
||||
if (is_set && (data & flag))
|
||||
break;
|
||||
else if ((data & flag) == val)
|
||||
break;
|
||||
udelay(15);
|
||||
}
|
||||
|
||||
return (i <= 0) ? -EAGAIN : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ath5k_hw_write_ofdm_timings - set OFDM timings on AR5212
|
||||
*
|
||||
@@ -221,8 +240,8 @@ static int ath5k_hw_nic_reset(struct ath5k_hw *ah, u32 val)
|
||||
/*
|
||||
* Sleep control
|
||||
*/
|
||||
int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode,
|
||||
bool set_chip, u16 sleep_duration)
|
||||
static int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode,
|
||||
bool set_chip, u16 sleep_duration)
|
||||
{
|
||||
unsigned int i;
|
||||
u32 staid, data;
|
||||
@@ -1017,11 +1036,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* Initialize operating mode
|
||||
*/
|
||||
ah->ah_op_mode = op_mode;
|
||||
|
||||
/* PHY access enable */
|
||||
if (ah->ah_mac_srev >= AR5K_SREV_AR5211)
|
||||
ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0));
|
||||
@@ -1192,7 +1206,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
|
||||
ath5k_hw_set_associd(ah);
|
||||
|
||||
/* Set PCU config */
|
||||
ath5k_hw_set_opmode(ah);
|
||||
ath5k_hw_set_opmode(ah, op_mode);
|
||||
|
||||
/* Clear any pending interrupts
|
||||
* PISR/SISR Not available on 5210 */
|
||||
@@ -1378,7 +1392,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
|
||||
* external 32KHz crystal when sleeping if one
|
||||
* exists */
|
||||
if (ah->ah_version == AR5K_AR5212 &&
|
||||
ah->ah_op_mode != NL80211_IFTYPE_AP)
|
||||
op_mode != NL80211_IFTYPE_AP)
|
||||
ath5k_hw_set_sleep_clock(ah, true);
|
||||
|
||||
/*
|
||||
@@ -1388,5 +1402,3 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
|
||||
ath5k_hw_reset_tsf(ah);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef _ATH5K_RESET
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user