Commit 8aa0f64a authored by David S. Miller's avatar David S. Miller
parents cd7e1f0b eab2ec83
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
menuconfig WLAN menuconfig WLAN
bool "Wireless LAN" bool "Wireless LAN"
depends on !S390 depends on !S390
select WIRELESS
default y default y
---help--- ---help---
This section contains all the pre 802.11 and 802.11 wireless This section contains all the pre 802.11 and 802.11 wireless
...@@ -67,6 +68,8 @@ config WAVELAN ...@@ -67,6 +68,8 @@ config WAVELAN
tristate "AT&T/Lucent old WaveLAN & DEC RoamAbout DS ISA support" tristate "AT&T/Lucent old WaveLAN & DEC RoamAbout DS ISA support"
depends on ISA && WLAN_PRE80211 depends on ISA && WLAN_PRE80211
select WIRELESS_EXT select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
---help--- ---help---
The Lucent WaveLAN (formerly NCR and AT&T; or DEC RoamAbout DS) is The Lucent WaveLAN (formerly NCR and AT&T; or DEC RoamAbout DS) is
a Radio LAN (wireless Ethernet-like Local Area Network) using the a Radio LAN (wireless Ethernet-like Local Area Network) using the
...@@ -90,6 +93,8 @@ config PCMCIA_WAVELAN ...@@ -90,6 +93,8 @@ config PCMCIA_WAVELAN
tristate "AT&T/Lucent old WaveLAN Pcmcia wireless support" tristate "AT&T/Lucent old WaveLAN Pcmcia wireless support"
depends on PCMCIA && WLAN_PRE80211 depends on PCMCIA && WLAN_PRE80211
select WIRELESS_EXT select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
help help
Say Y here if you intend to attach an AT&T/Lucent Wavelan PCMCIA Say Y here if you intend to attach an AT&T/Lucent Wavelan PCMCIA
(PC-card) wireless Ethernet networking card to your computer. This (PC-card) wireless Ethernet networking card to your computer. This
...@@ -102,6 +107,7 @@ config PCMCIA_NETWAVE ...@@ -102,6 +107,7 @@ config PCMCIA_NETWAVE
tristate "Xircom Netwave AirSurfer Pcmcia wireless support" tristate "Xircom Netwave AirSurfer Pcmcia wireless support"
depends on PCMCIA && WLAN_PRE80211 depends on PCMCIA && WLAN_PRE80211
select WIRELESS_EXT select WIRELESS_EXT
select WEXT_PRIV
help help
Say Y here if you intend to attach this type of PCMCIA (PC-card) Say Y here if you intend to attach this type of PCMCIA (PC-card)
wireless Ethernet networking card to your computer. wireless Ethernet networking card to your computer.
...@@ -123,6 +129,8 @@ config PCMCIA_RAYCS ...@@ -123,6 +129,8 @@ config PCMCIA_RAYCS
tristate "Aviator/Raytheon 2.4GHz wireless support" tristate "Aviator/Raytheon 2.4GHz wireless support"
depends on PCMCIA && WLAN_80211 depends on PCMCIA && WLAN_80211
select WIRELESS_EXT select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
---help--- ---help---
Say Y here if you intend to attach an Aviator/Raytheon PCMCIA Say Y here if you intend to attach an Aviator/Raytheon PCMCIA
(PC-card) wireless Ethernet networking card to your computer. (PC-card) wireless Ethernet networking card to your computer.
...@@ -132,46 +140,6 @@ config PCMCIA_RAYCS ...@@ -132,46 +140,6 @@ config PCMCIA_RAYCS
To compile this driver as a module, choose M here: the module will be To compile this driver as a module, choose M here: the module will be
called ray_cs. If unsure, say N. called ray_cs. If unsure, say N.
config LIBERTAS
tristate "Marvell 8xxx Libertas WLAN driver support"
depends on WLAN_80211
select WIRELESS_EXT
select LIB80211
select FW_LOADER
---help---
A library for Marvell Libertas 8xxx devices.
config LIBERTAS_USB
tristate "Marvell Libertas 8388 USB 802.11b/g cards"
depends on LIBERTAS && USB
---help---
A driver for Marvell Libertas 8388 USB devices.
config LIBERTAS_CS
tristate "Marvell Libertas 8385 CompactFlash 802.11b/g cards"
depends on LIBERTAS && PCMCIA
select FW_LOADER
---help---
A driver for Marvell Libertas 8385 CompactFlash devices.
config LIBERTAS_SDIO
tristate "Marvell Libertas 8385/8686/8688 SDIO 802.11b/g cards"
depends on LIBERTAS && MMC
---help---
A driver for Marvell Libertas 8385/8686/8688 SDIO devices.
config LIBERTAS_SPI
tristate "Marvell Libertas 8686 SPI 802.11b/g cards"
depends on LIBERTAS && SPI
---help---
A driver for Marvell Libertas 8686 SPI devices.
config LIBERTAS_DEBUG
bool "Enable full debugging output in the Libertas module."
depends on LIBERTAS
---help---
Debugging support.
config LIBERTAS_THINFIRM config LIBERTAS_THINFIRM
tristate "Marvell 8xxx Libertas WLAN driver support with thin firmware" tristate "Marvell 8xxx Libertas WLAN driver support with thin firmware"
depends on WLAN_80211 && MAC80211 depends on WLAN_80211 && MAC80211
...@@ -190,6 +158,8 @@ config AIRO ...@@ -190,6 +158,8 @@ config AIRO
depends on ISA_DMA_API && WLAN_80211 && (PCI || BROKEN) depends on ISA_DMA_API && WLAN_80211 && (PCI || BROKEN)
select WIRELESS_EXT select WIRELESS_EXT
select CRYPTO select CRYPTO
select WEXT_SPY
select WEXT_PRIV
---help--- ---help---
This is the standard Linux driver to support Cisco/Aironet ISA and This is the standard Linux driver to support Cisco/Aironet ISA and
PCI 802.11 wireless cards. PCI 802.11 wireless cards.
...@@ -207,6 +177,7 @@ config ATMEL ...@@ -207,6 +177,7 @@ config ATMEL
tristate "Atmel at76c50x chipset 802.11b support" tristate "Atmel at76c50x chipset 802.11b support"
depends on (PCI || PCMCIA) && WLAN_80211 depends on (PCI || PCMCIA) && WLAN_80211
select WIRELESS_EXT select WIRELESS_EXT
select WEXT_PRIV
select FW_LOADER select FW_LOADER
select CRC32 select CRC32
---help--- ---help---
...@@ -266,18 +237,21 @@ config AIRO_CS ...@@ -266,18 +237,21 @@ config AIRO_CS
Cisco Linux utilities can be used to configure the card. Cisco Linux utilities can be used to configure the card.
config PCMCIA_WL3501 config PCMCIA_WL3501
tristate "Planet WL3501 PCMCIA cards" tristate "Planet WL3501 PCMCIA cards"
depends on EXPERIMENTAL && PCMCIA && WLAN_80211 depends on EXPERIMENTAL && PCMCIA && WLAN_80211
select WIRELESS_EXT select WIRELESS_EXT
---help--- select WEXT_SPY
A driver for WL3501 PCMCIA 802.11 wireless cards made by Planet. help
It has basic support for Linux wireless extensions and initial A driver for WL3501 PCMCIA 802.11 wireless cards made by Planet.
micro support for ethtool. It has basic support for Linux wireless extensions and initial
micro support for ethtool.
config PRISM54 config PRISM54
tristate 'Intersil Prism GT/Duette/Indigo PCI/Cardbus (DEPRECATED)' tristate 'Intersil Prism GT/Duette/Indigo PCI/Cardbus (DEPRECATED)'
depends on PCI && EXPERIMENTAL && WLAN_80211 depends on PCI && EXPERIMENTAL && WLAN_80211
select WIRELESS_EXT select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
select FW_LOADER select FW_LOADER
---help--- ---help---
This enables support for FullMAC PCI/Cardbus prism54 devices. This This enables support for FullMAC PCI/Cardbus prism54 devices. This
...@@ -300,6 +274,7 @@ config USB_ZD1201 ...@@ -300,6 +274,7 @@ config USB_ZD1201
tristate "USB ZD1201 based Wireless device support" tristate "USB ZD1201 based Wireless device support"
depends on USB && WLAN_80211 depends on USB && WLAN_80211
select WIRELESS_EXT select WIRELESS_EXT
select WEXT_PRIV
select FW_LOADER select FW_LOADER
---help--- ---help---
Say Y if you want to use wireless LAN adapters based on the ZyDAS Say Y if you want to use wireless LAN adapters based on the ZyDAS
...@@ -476,17 +451,18 @@ config MWL8K ...@@ -476,17 +451,18 @@ config MWL8K
To compile this driver as a module, choose M here: the module To compile this driver as a module, choose M here: the module
will be called mwl8k. If unsure, say N. will be called mwl8k. If unsure, say N.
source "drivers/net/wireless/p54/Kconfig"
source "drivers/net/wireless/ath/Kconfig" source "drivers/net/wireless/ath/Kconfig"
source "drivers/net/wireless/ipw2x00/Kconfig"
source "drivers/net/wireless/iwlwifi/Kconfig"
source "drivers/net/wireless/hostap/Kconfig"
source "drivers/net/wireless/b43/Kconfig" source "drivers/net/wireless/b43/Kconfig"
source "drivers/net/wireless/b43legacy/Kconfig" source "drivers/net/wireless/b43legacy/Kconfig"
source "drivers/net/wireless/zd1211rw/Kconfig" source "drivers/net/wireless/hostap/Kconfig"
source "drivers/net/wireless/rt2x00/Kconfig" source "drivers/net/wireless/ipw2x00/Kconfig"
source "drivers/net/wireless/iwlwifi/Kconfig"
source "drivers/net/wireless/iwmc3200wifi/Kconfig"
source "drivers/net/wireless/libertas/Kconfig"
source "drivers/net/wireless/orinoco/Kconfig" source "drivers/net/wireless/orinoco/Kconfig"
source "drivers/net/wireless/p54/Kconfig"
source "drivers/net/wireless/rt2x00/Kconfig"
source "drivers/net/wireless/wl12xx/Kconfig" source "drivers/net/wireless/wl12xx/Kconfig"
source "drivers/net/wireless/iwmc3200wifi/Kconfig" source "drivers/net/wireless/zd1211rw/Kconfig"
endif # WLAN endif # WLAN
...@@ -2217,6 +2217,8 @@ static struct ieee80211_supported_band at76_supported_band = { ...@@ -2217,6 +2217,8 @@ static struct ieee80211_supported_band at76_supported_band = {
static int at76_init_new_device(struct at76_priv *priv, static int at76_init_new_device(struct at76_priv *priv,
struct usb_interface *interface) struct usb_interface *interface)
{ {
struct wiphy *wiphy;
size_t len;
int ret; int ret;
/* set up the endpoint information */ /* set up the endpoint information */
...@@ -2254,6 +2256,7 @@ static int at76_init_new_device(struct at76_priv *priv, ...@@ -2254,6 +2256,7 @@ static int at76_init_new_device(struct at76_priv *priv,
priv->device_unplugged = 0; priv->device_unplugged = 0;
/* mac80211 initialisation */ /* mac80211 initialisation */
wiphy = priv->hw->wiphy;
priv->hw->wiphy->max_scan_ssids = 1; priv->hw->wiphy->max_scan_ssids = 1;
priv->hw->wiphy->max_scan_ie_len = 0; priv->hw->wiphy->max_scan_ie_len = 0;
priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
...@@ -2265,6 +2268,13 @@ static int at76_init_new_device(struct at76_priv *priv, ...@@ -2265,6 +2268,13 @@ static int at76_init_new_device(struct at76_priv *priv,
SET_IEEE80211_DEV(priv->hw, &interface->dev); SET_IEEE80211_DEV(priv->hw, &interface->dev);
SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr);
len = sizeof(wiphy->fw_version);
snprintf(wiphy->fw_version, len, "%d.%d.%d-%d",
priv->fw_version.major, priv->fw_version.minor,
priv->fw_version.patch, priv->fw_version.build);
wiphy->hw_version = priv->board_type;
ret = ieee80211_register_hw(priv->hw); ret = ieee80211_register_hw(priv->hw);
if (ret) { if (ret) {
printk(KERN_ERR "cannot register mac80211 hw (status %d)!\n", printk(KERN_ERR "cannot register mac80211 hw (status %d)!\n",
......
...@@ -16,7 +16,15 @@ menuconfig ATH_COMMON ...@@ -16,7 +16,15 @@ menuconfig ATH_COMMON
http://wireless.kernel.org/en/users/Drivers/Atheros http://wireless.kernel.org/en/users/Drivers/Atheros
if ATH_COMMON if ATH_COMMON
config ATH_DEBUG
bool "Atheros wireless debugging"
---help---
Say Y, if you want to debug atheros wireless drivers.
Right now only ath9k makes use of this.
source "drivers/net/wireless/ath/ath5k/Kconfig" source "drivers/net/wireless/ath/ath5k/Kconfig"
source "drivers/net/wireless/ath/ath9k/Kconfig" source "drivers/net/wireless/ath/ath9k/Kconfig"
source "drivers/net/wireless/ath/ar9170/Kconfig" source "drivers/net/wireless/ath/ar9170/Kconfig"
endif endif
obj-$(CONFIG_ATH5K) += ath5k/ obj-$(CONFIG_ATH5K) += ath5k/
obj-$(CONFIG_ATH9K) += ath9k/ obj-$(CONFIG_ATH9K_HW) += ath9k/
obj-$(CONFIG_AR9170_USB) += ar9170/ obj-$(CONFIG_AR9170_USB) += ar9170/
obj-$(CONFIG_ATH_COMMON) += ath.o obj-$(CONFIG_ATH_COMMON) += ath.o
ath-objs := main.o regd.o
ath-objs := main.o \
regd.o \
hw.o
ath-$(CONFIG_ATH_DEBUG) += debug.o
...@@ -172,8 +172,6 @@ struct ar9170 { ...@@ -172,8 +172,6 @@ struct ar9170 {
/* interface mode settings */ /* interface mode settings */
struct ieee80211_vif *vif; struct ieee80211_vif *vif;
u8 mac_addr[ETH_ALEN];
u8 bssid[ETH_ALEN];
/* beaconing */ /* beaconing */
struct sk_buff *beacon; struct sk_buff *beacon;
...@@ -204,6 +202,8 @@ struct ar9170 { ...@@ -204,6 +202,8 @@ struct ar9170 {
u8 power_2G_ht20[8]; u8 power_2G_ht20[8];
u8 power_2G_ht40[8]; u8 power_2G_ht40[8];
u8 phy_heavy_clip;
#ifdef CONFIG_AR9170_LEDS #ifdef CONFIG_AR9170_LEDS
struct delayed_work led_work; struct delayed_work led_work;
struct ar9170_led leds[AR9170_NUM_LEDS]; struct ar9170_led leds[AR9170_NUM_LEDS];
......
...@@ -72,8 +72,7 @@ int ar9170_write_reg(struct ar9170 *ar, const u32 reg, const u32 val) ...@@ -72,8 +72,7 @@ int ar9170_write_reg(struct ar9170 *ar, const u32 reg, const u32 val)
return err; return err;
} }
static int ar9170_read_mreg(struct ar9170 *ar, int nregs, int ar9170_read_mreg(struct ar9170 *ar, int nregs, const u32 *regs, u32 *out)
const u32 *regs, u32 *out)
{ {
int i, err; int i, err;
__le32 *offs, *res; __le32 *offs, *res;
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
int ar9170_write_mem(struct ar9170 *ar, const __le32 *data, size_t len); int ar9170_write_mem(struct ar9170 *ar, const __le32 *data, size_t len);
int ar9170_write_reg(struct ar9170 *ar, const u32 reg, const u32 val); int ar9170_write_reg(struct ar9170 *ar, const u32 reg, const u32 val);
int ar9170_read_reg(struct ar9170 *ar, u32 reg, u32 *val); int ar9170_read_reg(struct ar9170 *ar, u32 reg, u32 *val);
int ar9170_read_mreg(struct ar9170 *ar, int nregs, const u32 *regs, u32 *out);
int ar9170_echo_test(struct ar9170 *ar, u32 v); int ar9170_echo_test(struct ar9170 *ar, u32 v);
/* /*
......
...@@ -311,6 +311,8 @@ struct ar9170_tx_control { ...@@ -311,6 +311,8 @@ struct ar9170_tx_control {
#define AR9170_TX_PHY_SHORT_GI 0x80000000 #define AR9170_TX_PHY_SHORT_GI 0x80000000
#define AR5416_MAX_RATE_POWER 63
struct ar9170_rx_head { struct ar9170_rx_head {
u8 plcp[12]; u8 plcp[12];
} __packed; } __packed;
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include <asm/unaligned.h>
#include "ar9170.h" #include "ar9170.h"
#include "cmd.h" #include "cmd.h"
...@@ -227,11 +230,8 @@ static int ar9170_set_mac_reg(struct ar9170 *ar, const u32 reg, const u8 *mac) ...@@ -227,11 +230,8 @@ static int ar9170_set_mac_reg(struct ar9170 *ar, const u32 reg, const u8 *mac)
ar9170_regwrite_begin(ar); ar9170_regwrite_begin(ar);
ar9170_regwrite(reg, ar9170_regwrite(reg, get_unaligned_le32(mac));
(mac[3] << 24) | (mac[2] << 16) | ar9170_regwrite(reg + 4, get_unaligned_le16(mac + 4));
(mac[1] << 8) | mac[0]);
ar9170_regwrite(reg + 4, (mac[5] << 8) | mac[4]);
ar9170_regwrite_finish(); ar9170_regwrite_finish();
...@@ -311,13 +311,14 @@ static int ar9170_set_promiscouous(struct ar9170 *ar) ...@@ -311,13 +311,14 @@ static int ar9170_set_promiscouous(struct ar9170 *ar)
int ar9170_set_operating_mode(struct ar9170 *ar) int ar9170_set_operating_mode(struct ar9170 *ar)
{ {
struct ath_common *common = &ar->common;
u32 pm_mode = AR9170_MAC_REG_POWERMGT_DEFAULTS; u32 pm_mode = AR9170_MAC_REG_POWERMGT_DEFAULTS;
u8 *mac_addr, *bssid; u8 *mac_addr, *bssid;
int err; int err;
if (ar->vif) { if (ar->vif) {
mac_addr = ar->mac_addr; mac_addr = common->macaddr;
bssid = ar->bssid; bssid = common->curbssid;
switch (ar->vif->type) { switch (ar->vif->type) {
case NL80211_IFTYPE_MESH_POINT: case NL80211_IFTYPE_MESH_POINT:
......
...@@ -1952,6 +1952,7 @@ static int ar9170_op_add_interface(struct ieee80211_hw *hw, ...@@ -1952,6 +1952,7 @@ static int ar9170_op_add_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf) struct ieee80211_if_init_conf *conf)
{ {
struct ar9170 *ar = hw->priv; struct ar9170 *ar = hw->priv;
struct ath_common *common = &ar->common;
int err = 0; int err = 0;
mutex_lock(&ar->mutex); mutex_lock(&ar->mutex);
...@@ -1962,7 +1963,7 @@ static int ar9170_op_add_interface(struct ieee80211_hw *hw, ...@@ -1962,7 +1963,7 @@ static int ar9170_op_add_interface(struct ieee80211_hw *hw,
} }
ar->vif = conf->vif; ar->vif = conf->vif;
memcpy(ar->mac_addr, conf->mac_addr, ETH_ALEN); memcpy(common->macaddr, conf->mac_addr, ETH_ALEN);
if (modparam_nohwcrypt || (ar->vif->type != NL80211_IFTYPE_STATION)) { if (modparam_nohwcrypt || (ar->vif->type != NL80211_IFTYPE_STATION)) {
ar->rx_software_decryption = true; ar->rx_software_decryption = true;
...@@ -2131,12 +2132,13 @@ static void ar9170_op_bss_info_changed(struct ieee80211_hw *hw, ...@@ -2131,12 +2132,13 @@ static void ar9170_op_bss_info_changed(struct ieee80211_hw *hw,
u32 changed) u32 changed)
{ {
struct ar9170 *ar = hw->priv; struct ar9170 *ar = hw->priv;
struct ath_common *common = &ar->common;
int err = 0; int err = 0;
mutex_lock(&ar->mutex); mutex_lock(&ar->mutex);
if (changed & BSS_CHANGED_BSSID) { if (changed & BSS_CHANGED_BSSID) {
memcpy(ar->bssid, bss_conf->bssid, ETH_ALEN); memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
err = ar9170_set_operating_mode(ar); err = ar9170_set_operating_mode(ar);
if (err) if (err)
goto out; goto out;
...@@ -2190,22 +2192,30 @@ static u64 ar9170_op_get_tsf(struct ieee80211_hw *hw) ...@@ -2190,22 +2192,30 @@ static u64 ar9170_op_get_tsf(struct ieee80211_hw *hw)
{ {
struct ar9170 *ar = hw->priv; struct ar9170 *ar = hw->priv;
int err; int err;
u32 tsf_low;
u32 tsf_high;
u64 tsf; u64 tsf;
#define NR 3
static const u32 addr[NR] = { AR9170_MAC_REG_TSF_H,
AR9170_MAC_REG_TSF_L,
AR9170_MAC_REG_TSF_H };
u32 val[NR];
int loops = 0;
mutex_lock(&ar->mutex); mutex_lock(&ar->mutex);
err = ar9170_read_reg(ar, AR9170_MAC_REG_TSF_L, &tsf_low);
if (!err) while (loops++ < 10) {
err = ar9170_read_reg(ar, AR9170_MAC_REG_TSF_H, &tsf_high); err = ar9170_read_mreg(ar, NR, addr, val);
if (err || val[0] == val[2])
break;
}
mutex_unlock(&ar->mutex); mutex_unlock(&ar->mutex);
if (WARN_ON(err)) if (WARN_ON(err))
return 0; return 0;
tsf = val[0];
tsf = tsf_high; tsf = (tsf << 32) | val[1];
tsf = (tsf << 32) | tsf_low;
return tsf; return tsf;
#undef NR
} }
static int ar9170_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, static int ar9170_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
......
...@@ -1239,9 +1239,6 @@ static u8 ar9170_get_max_edge_power(struct ar9170 *ar, ...@@ -1239,9 +1239,6 @@ static u8 ar9170_get_max_edge_power(struct ar9170 *ar,
struct ar9170_calctl_edges edges[], struct ar9170_calctl_edges edges[],
u32 freq) u32 freq)
{ {
/* TODO: move somewhere else */
#define AR5416_MAX_RATE_POWER 63
int i; int i;
u8 rc = AR5416_MAX_RATE_POWER; u8 rc = AR5416_MAX_RATE_POWER;
u8 f; u8 f;
...@@ -1259,10 +1256,11 @@ static u8 ar9170_get_max_edge_power(struct ar9170 *ar, ...@@ -1259,10 +1256,11 @@ static u8 ar9170_get_max_edge_power(struct ar9170 *ar,
break; break;
} }
if (i > 0 && f < edges[i].channel) { if (i > 0 && f < edges[i].channel) {
if (f > edges[i-1].channel && if (f > edges[i - 1].channel &&
edges[i-1].power_flags & AR9170_CALCTL_EDGE_FLAGS) { edges[i - 1].power_flags &
AR9170_CALCTL_EDGE_FLAGS) {
/* lower channel has the inband flag set */ /* lower channel has the inband flag set */
rc = edges[i-1].power_flags & rc = edges[i - 1].power_flags &
~AR9170_CALCTL_EDGE_FLAGS; ~AR9170_CALCTL_EDGE_FLAGS;
} }
break; break;
...@@ -1270,18 +1268,48 @@ static u8 ar9170_get_max_edge_power(struct ar9170 *ar, ...@@ -1270,18 +1268,48 @@ static u8 ar9170_get_max_edge_power(struct ar9170 *ar,
} }
if (i == AR5416_NUM_BAND_EDGES) { if (i == AR5416_NUM_BAND_EDGES) {
if (f > edges[i-1].channel && if (f > edges[i - 1].channel &&
edges[i-1].power_flags & AR9170_CALCTL_EDGE_FLAGS) { edges[i - 1].power_flags & AR9170_CALCTL_EDGE_FLAGS) {
/* lower channel has the inband flag set */ /* lower channel has the inband flag set */
rc = edges[i-1].power_flags & rc = edges[i - 1].power_flags &
~AR9170_CALCTL_EDGE_FLAGS; ~AR9170_CALCTL_EDGE_FLAGS;
} }
} }
return rc; return rc;
} }
/* calculate the conformance test limits and apply them to ar->power* static u8 ar9170_get_heavy_clip(struct ar9170 *ar,
* (derived from otus hal/hpmain.c, line 3706 ff.) struct ar9170_calctl_edges edges[],
u32 freq, enum ar9170_bw bw)
{
u8 f;
int i;
u8 rc = 0;
if (freq < 3000)
f = freq - 2300;
else
f = (freq - 4800) / 5;
if (bw == AR9170_BW_40_BELOW || bw == AR9170_BW_40_ABOVE)
rc |= 0xf0;
for (i = 0; i < AR5416_NUM_BAND_EDGES; i++) {
if (edges[i].channel == 0xff)
break;
if (f == edges[i].channel) {
if (!(edges[i].power_flags & AR9170_CALCTL_EDGE_FLAGS))
rc |= 0x0f;
break;
}
}
return rc;
}
/*
* calculate the conformance test limits and the heavy clip parameter
* and apply them to ar->power* (derived from otus hal/hpmain.c, line 3706)
*/ */
static void ar9170_calc_ctl(struct ar9170 *ar, u32 freq, enum ar9170_bw bw) static void ar9170_calc_ctl(struct ar9170 *ar, u32 freq, enum ar9170_bw bw)
{ {
...@@ -1295,7 +1323,8 @@ static void ar9170_calc_ctl(struct ar9170 *ar, u32 freq, enum ar9170_bw bw) ...@@ -1295,7 +1323,8 @@ static void ar9170_calc_ctl(struct ar9170 *ar, u32 freq, enum ar9170_bw bw)
int pwr_cal_len; int pwr_cal_len;
} *modes; } *modes;
/* order is relevant in the mode_list_*: we fall back to the /*
* order is relevant in the mode_list_*: we fall back to the
* lower indices if any mode is missed in the EEPROM. * lower indices if any mode is missed in the EEPROM.
*/ */
struct ctl_modes mode_list_2ghz[] = { struct ctl_modes mode_list_2ghz[] = {
...@@ -1313,7 +1342,10 @@ static void ar9170_calc_ctl(struct ar9170 *ar, u32 freq, enum ar9170_bw bw) ...@@ -1313,7 +1342,10 @@ static void ar9170_calc_ctl(struct ar9170 *ar, u32 freq, enum ar9170_bw bw)
#define EDGES(c, n) (ar->eeprom.ctl_data[c].control_edges[n]) #define EDGES(c, n) (ar->eeprom.ctl_data[c].control_edges[n])
/* TODO: investigate the differences between OTUS' ar->phy_heavy_clip = 0;
/*
* TODO: investigate the differences between OTUS'
* hpreg.c::zfHpGetRegulatoryDomain() and * hpreg.c::zfHpGetRegulatoryDomain() and
* ath/regd.c::ath_regd_get_band_ctl() - * ath/regd.c::ath_regd_get_band_ctl() -
* e.g. for FCC3_WORLD the OTUS procedure * e.g. for FCC3_WORLD the OTUS procedure
...@@ -1347,6 +1379,15 @@ static void ar9170_calc_ctl(struct ar9170 *ar, u32 freq, enum ar9170_bw bw) ...@@ -1347,6 +1379,15 @@ static void ar9170_calc_ctl(struct ar9170 *ar, u32 freq, enum ar9170_bw bw)
if (ctl_idx < AR5416_NUM_CTLS) { if (ctl_idx < AR5416_NUM_CTLS) {
int f_off = 0; int f_off = 0;
/* determine heav clip parameter from
the 11G edges array */
if (modes[i].ctl_mode == CTL_11G) {
ar->phy_heavy_clip =
ar9170_get_heavy_clip(ar,
EDGES(ctl_idx, 1),
freq, bw);
}
/* adjust freq for 40MHz */ /* adjust freq for 40MHz */
if (modes[i].ctl_mode == CTL_2GHT40 || if (modes[i].ctl_mode == CTL_2GHT40 ||
modes[i].ctl_mode == CTL_5GHT40) { modes[i].ctl_mode == CTL_5GHT40) {
...@@ -1360,13 +1401,15 @@ static void ar9170_calc_ctl(struct ar9170 *ar, u32 freq, enum ar9170_bw bw) ...@@ -1360,13 +1401,15 @@ static void ar9170_calc_ctl(struct ar9170 *ar, u32 freq, enum ar9170_bw bw)
ar9170_get_max_edge_power(ar, EDGES(ctl_idx, 1), ar9170_get_max_edge_power(ar, EDGES(ctl_idx, 1),
freq+f_off); freq+f_off);
/* TODO: check if the regulatory max. power is /*
* TODO: check if the regulatory max. power is
* controlled by cfg80211 for DFS * controlled by cfg80211 for DFS
* (hpmain applies it to max_power itself for DFS freq) * (hpmain applies it to max_power itself for DFS freq)
*/ */
} else { } else {
/* Workaround in otus driver, hpmain.c, line 3906: /*
* Workaround in otus driver, hpmain.c, line 3906:
* if no data for 5GHT20 are found, take the * if no data for 5GHT20 are found, take the
* legacy 5G value. * legacy 5G value.
* We extend this here to fallback from any other *HT or * We extend this here to fallback from any other *HT or
...@@ -1390,6 +1433,19 @@ static void ar9170_calc_ctl(struct ar9170 *ar, u32 freq, enum ar9170_bw bw) ...@@ -1390,6 +1433,19 @@ static void ar9170_calc_ctl(struct ar9170 *ar, u32 freq, enum ar9170_bw bw)
modes[i].max_power); modes[i].max_power);
} }
} }
if (ar->phy_heavy_clip & 0xf0) {
ar->power_2G_ht40[0]--;
ar->power_2G_ht40[1]--;
ar->power_2G_ht40[2]--;
}
if (ar->phy_heavy_clip & 0xf) {
ar->power_2G_ht20[0]++;
ar->power_2G_ht20[1]++;
ar->power_2G_ht20[2]++;
}
#undef EDGES #undef EDGES
} }
...@@ -1499,8 +1555,6 @@ static int ar9170_set_power_cal(struct ar9170 *ar, u32 freq, enum ar9170_bw bw) ...@@ -1499,8 +1555,6 @@ static int ar9170_set_power_cal(struct ar9170 *ar, u32 freq, enum ar9170_bw bw)
/* calc. conformance test limits and apply to ar->power*[] */ /* calc. conformance test limits and apply to ar->power*[] */
ar9170_calc_ctl(ar, freq, bw); ar9170_calc_ctl(ar, freq, bw);
/* TODO: (heavy clip) regulatory domain power level fine-tuning. */
/* set ACK/CTS TX power */ /* set ACK/CTS TX power */
ar9170_regwrite_begin(ar); ar9170_regwrite_begin(ar);
...@@ -1643,6 +1697,17 @@ int ar9170_set_channel(struct ar9170 *ar, struct ieee80211_channel *channel, ...@@ -1643,6 +1697,17 @@ int ar9170_set_channel(struct ar9170 *ar, struct ieee80211_channel *channel,
if (err) if (err)
return err; return err;
if (ar->phy_heavy_clip) {
err = ar9170_write_reg(ar, 0x1c59e0,
0x200 | ar->phy_heavy_clip);
if (err) {
if (ar9170_nag_limiter(ar))
printk(KERN_ERR "%s: failed to set "
"heavy clip\n",
wiphy_name(ar->hw->wiphy));
}
}
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
ar->noise[i] = ar9170_calc_noise_dbm( ar->noise[i] = ar9170_calc_noise_dbm(
(le32_to_cpu(vals[2 + i]) >> 19) & 0x1ff); (le32_to_cpu(vals[2 + i]) >> 19) & 0x1ff);
......
...@@ -18,6 +18,15 @@ ...@@ -18,6 +18,15 @@
#define ATH_H #define ATH_H
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/if_ether.h>
#include <net/mac80211.h>
static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
enum ath_device_state {
ATH_HW_UNAVAILABLE,
ATH_HW_INITIALIZED,
};
struct reg_dmn_pair_mapping { struct reg_dmn_pair_mapping {
u16 regDmnEnum; u16 regDmnEnum;
...@@ -36,13 +45,45 @@ struct ath_regulatory { ...@@ -36,13 +45,45 @@ struct ath_regulatory {
struct reg_dmn_pair_mapping *regpair; struct reg_dmn_pair_mapping *regpair;
}; };
struct ath_ops {
unsigned int (*read)(void *, u32 reg_offset);
void (*write)(void *, u32 val, u32 reg_offset);
};
struct ath_common;
struct ath_bus_ops {
void (*read_cachesize)(struct ath_common *common, int *csz);
void (*cleanup)(struct ath_common *common);
bool (*eeprom_read)(struct ath_common *common, u32 off, u16 *data);
void (*bt_coex_prep)(struct ath_common *common);
};
struct ath_common { struct ath_common {
void *ah;
void *priv;
struct ieee80211_hw *hw;
int debug_mask;
enum ath_device_state state;
u16 cachelsz; u16 cachelsz;
u16 curaid;
u8 macaddr[ETH_ALEN];
u8 curbssid[ETH_ALEN];
u8 bssidmask[ETH_ALEN];
u8 tx_chainmask;
u8 rx_chainmask;
struct ath_regulatory regulatory; struct ath_regulatory regulatory;
const struct ath_ops *ops;
const struct ath_bus_ops *bus_ops;
}; };
struct sk_buff *ath_rxbuf_alloc(struct ath_common *common, struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
u32 len, u32 len,
gfp_t gfp_mask); gfp_t gfp_mask);
void ath_hw_setbssidmask(struct ath_common *common);
#endif /* ATH_H */ #endif /* ATH_H */
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
* TODO: Make a more generic struct (eg. add more stuff to ath5k_capabilities) * TODO: Make a more generic struct (eg. add more stuff to ath5k_capabilities)
* and clean up common bits, then introduce set/get functions in eeprom.c */ * and clean up common bits, then introduce set/get functions in eeprom.c */
#include "eeprom.h" #include "eeprom.h"
#include "../ath.h"
/* PCI IDs */ /* PCI IDs */
#define PCI_DEVICE_ID_ATHEROS_AR5210 0x0007 /* AR5210 */ #define PCI_DEVICE_ID_ATHEROS_AR5210 0x0007 /* AR5210 */
...@@ -165,13 +166,6 @@ ...@@ -165,13 +166,6 @@
#define AR5K_INI_VAL_XR 0 #define AR5K_INI_VAL_XR 0
#define AR5K_INI_VAL_MAX 5 #define AR5K_INI_VAL_MAX 5
/* Used for BSSID etc manipulation */
#define AR5K_LOW_ID(_a)( \
(_a)[0] | (_a)[1] << 8 | (_a)[2] << 16 | (_a)[3] << 24 \
)
#define AR5K_HIGH_ID(_a) ((_a)[4] | (_a)[5] << 8)
/* /*
* Some tuneable values (these should be changeable by the user) * Some tuneable values (these should be changeable by the user)
* TODO: Make use of them and add more options OR use debug/configfs * TODO: Make use of them and add more options OR use debug/configfs
...@@ -1027,6 +1021,7 @@ struct ath5k_capabilities { ...@@ -1027,6 +1021,7 @@ struct ath5k_capabilities {
/* TODO: Clean up and merge with ath5k_softc */ /* TODO: Clean up and merge with ath5k_softc */
struct ath5k_hw { struct ath5k_hw {
u32 ah_magic; u32 ah_magic;
struct ath_common common;
struct ath5k_softc *ah_sc; struct ath5k_softc *ah_sc;
void __iomem *ah_iobase; void __iomem *ah_iobase;
...@@ -1067,14 +1062,6 @@ struct ath5k_hw { ...@@ -1067,14 +1062,6 @@ struct ath5k_hw {
u8 ah_def_ant; u8 ah_def_ant;
bool ah_software_retry; bool ah_software_retry;
u8 ah_sta_id[ETH_ALEN];
/* Current BSSID we are trying to assoc to / create.
* This is passed by mac80211 on config_interface() and cached here for
* use in resets */
u8 ah_bssid[ETH_ALEN];
u8 ah_bssid_mask[ETH_ALEN];
int ah_gpio_npins; int ah_gpio_npins;
struct ath5k_capabilities ah_capabilities; struct ath5k_capabilities ah_capabilities;
...@@ -1160,7 +1147,7 @@ struct ath5k_hw { ...@@ -1160,7 +1147,7 @@ struct ath5k_hw {
*/ */
/* Attach/Detach Functions */ /* Attach/Detach Functions */
extern struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc); extern int ath5k_hw_attach(struct ath5k_softc *sc);
extern void ath5k_hw_detach(struct ath5k_hw *ah); extern void ath5k_hw_detach(struct ath5k_hw *ah);
/* LED functions */ /* LED functions */
...@@ -1203,10 +1190,9 @@ extern bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah); ...@@ -1203,10 +1190,9 @@ extern bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah);
/* Protocol Control Unit Functions */ /* Protocol Control Unit Functions */
extern int ath5k_hw_set_opmode(struct ath5k_hw *ah); extern int ath5k_hw_set_opmode(struct ath5k_hw *ah);
/* BSSID Functions */ /* BSSID Functions */
extern void ath5k_hw_get_lladdr(struct ath5k_hw *ah, u8 *mac);
extern int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac); extern int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac);
extern void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id); extern void ath5k_hw_set_associd(struct ath5k_hw *ah);
extern int ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask); extern void ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask);
/* Receive start/stop functions */ /* Receive start/stop functions */
extern void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah); extern void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah);
extern void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah); extern void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah);
...@@ -1329,17 +1315,21 @@ static inline unsigned int ath5k_hw_clocktoh(unsigned int clock, bool turbo) ...@@ -1329,17 +1315,21 @@ static inline unsigned int ath5k_hw_clocktoh(unsigned int clock, bool turbo)
return turbo ? (clock / 80) : (clock / 40); return turbo ? (clock / 80) : (clock / 40);
} }
/* static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah)
* Read from a register {
*/ return &ah->common;
}
static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
{
return &(ath5k_hw_common(ah)->regulatory);
}
static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg) static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
{ {
return ioread32(ah->ah_iobase + reg); return ioread32(ah->ah_iobase + reg);
} }
/*
* Write to a register
*/
static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg) static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
{ {
iowrite32(val, ah->ah_iobase + reg); iowrite32(val, ah->ah_iobase + reg);
......
...@@ -101,25 +101,15 @@ static int ath5k_hw_post(struct ath5k_hw *ah) ...@@ -101,25 +101,15 @@ static int ath5k_hw_post(struct ath5k_hw *ah)
* -ENODEV if the device is not supported or prints an error msg if something * -ENODEV if the device is not supported or prints an error msg if something
* else went wrong. * else went wrong.
*/ */
struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc) int ath5k_hw_attach(struct ath5k_softc *sc)
{ {
struct ath5k_hw *ah; struct ath5k_hw *ah = sc->ah;
struct ath_common *common = ath5k_hw_common(ah);
struct pci_dev *pdev = sc->pdev; struct pci_dev *pdev = sc->pdev;
struct ath5k_eeprom_info *ee; struct ath5k_eeprom_info *ee;
int ret; int ret;
u32 srev; u32 srev;
/*If we passed the test malloc a ath5k_hw struct*/
ah = kzalloc(sizeof(struct ath5k_hw), GFP_KERNEL);
if (ah == NULL) {
ret = -ENOMEM;
ATH5K_ERR(sc, "out of memory\n");
goto err;
}
ah->ah_sc = sc;
ah->ah_iobase = sc->iobase;
/* /*
* HW information * HW information
*/ */
...@@ -278,12 +268,12 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc) ...@@ -278,12 +268,12 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc)
goto err_free; goto err_free;
} }
ee = &ah->ah_capabilities.cap_eeprom;
/* /*
* Write PCI-E power save settings * Write PCI-E power save settings
*/ */
if ((ah->ah_version == AR5K_AR5212) && (pdev->is_pcie)) { if ((ah->ah_version == AR5K_AR5212) && (pdev->is_pcie)) {
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES); ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES);
ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES); ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES);
...@@ -321,7 +311,6 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc) ...@@ -321,7 +311,6 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc)
} }
/* Crypto settings */ /* Crypto settings */
ee = &ah->ah_capabilities.cap_eeprom;
ah->ah_aes_support = srev >= AR5K_SREV_AR5212_V4 && ah->ah_aes_support = srev >= AR5K_SREV_AR5212_V4 &&
(ee->ee_version >= AR5K_EEPROM_VERSION_5_0 && (ee->ee_version >= AR5K_EEPROM_VERSION_5_0 &&
!AR5K_EEPROM_AES_DIS(ee->ee_misc5)); !AR5K_EEPROM_AES_DIS(ee->ee_misc5));
...@@ -336,8 +325,8 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc) ...@@ -336,8 +325,8 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc)
ath5k_hw_set_lladdr(ah, (u8[ETH_ALEN]){}); ath5k_hw_set_lladdr(ah, (u8[ETH_ALEN]){});
/* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */ /* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */
memset(ah->ah_bssid, 0xff, ETH_ALEN); memcpy(common->curbssid, ath_bcast_mac, ETH_ALEN);
ath5k_hw_set_associd(ah, ah->ah_bssid, 0); ath5k_hw_set_associd(ah);
ath5k_hw_set_opmode(ah); ath5k_hw_set_opmode(ah);
ath5k_hw_rfgain_opt_init(ah); ath5k_hw_rfgain_opt_init(ah);
...@@ -345,11 +334,10 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc) ...@@ -345,11 +334,10 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc)
/* turn on HW LEDs */ /* turn on HW LEDs */
ath5k_hw_set_ledstate(ah, AR5K_LED_INIT); ath5k_hw_set_ledstate(ah, AR5K_LED_INIT);
return ah; return 0;
err_free: err_free:
kfree(ah); kfree(ah);
err: return ret;
return ERR_PTR(ret);
} }
/** /**
...@@ -369,5 +357,4 @@ void ath5k_hw_detach(struct ath5k_hw *ah) ...@@ -369,5 +357,4 @@ void ath5k_hw_detach(struct ath5k_hw *ah)
ath5k_eeprom_detach(ah); ath5k_eeprom_detach(ah);
/* assume interrupts are down */ /* assume interrupts are down */
kfree(ah);
} }
...@@ -195,12 +195,13 @@ static int __devinit ath5k_pci_probe(struct pci_dev *pdev, ...@@ -195,12 +195,13 @@ static int __devinit ath5k_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id); const struct pci_device_id *id);
static void __devexit ath5k_pci_remove(struct pci_dev *pdev); static void __devexit ath5k_pci_remove(struct pci_dev *pdev);
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int ath5k_pci_suspend(struct pci_dev *pdev, static int ath5k_pci_suspend(struct device *dev);
pm_message_t state); static int ath5k_pci_resume(struct device *dev);
static int ath5k_pci_resume(struct pci_dev *pdev);
SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume);
#define ATH5K_PM_OPS (&ath5k_pm_ops)
#else #else
#define ath5k_pci_suspend NULL #define ATH5K_PM_OPS NULL
#define ath5k_pci_resume NULL
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static struct pci_driver ath5k_pci_driver = { static struct pci_driver ath5k_pci_driver = {
...@@ -208,8 +209,7 @@ static struct pci_driver ath5k_pci_driver = { ...@@ -208,8 +209,7 @@ static struct pci_driver ath5k_pci_driver = {
.id_table = ath5k_pci_id_table, .id_table = ath5k_pci_id_table,
.probe = ath5k_pci_probe, .probe = ath5k_pci_probe,
.remove = __devexit_p(ath5k_pci_remove), .remove = __devexit_p(ath5k_pci_remove),
.suspend = ath5k_pci_suspend, .driver.pm = ATH5K_PM_OPS,
.resume = ath5k_pci_resume,
}; };
...@@ -437,6 +437,22 @@ ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val) ...@@ -437,6 +437,22 @@ ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val)
return name; return name;
} }
static unsigned int ath5k_ioread32(void *hw_priv, u32 reg_offset)
{
struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv;
return ath5k_hw_reg_read(ah, reg_offset);
}
static void ath5k_iowrite32(void *hw_priv, u32 val, u32 reg_offset)
{
struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv;
ath5k_hw_reg_write(ah, val, reg_offset);
}
static const struct ath_ops ath5k_common_ops = {
.read = ath5k_ioread32,
.write = ath5k_iowrite32,
};
static int __devinit static int __devinit
ath5k_pci_probe(struct pci_dev *pdev, ath5k_pci_probe(struct pci_dev *pdev,
...@@ -444,6 +460,7 @@ ath5k_pci_probe(struct pci_dev *pdev, ...@@ -444,6 +460,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
{ {
void __iomem *mem; void __iomem *mem;
struct ath5k_softc *sc; struct ath5k_softc *sc;
struct ath_common *common;
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
int ret; int ret;
u8 csz; u8 csz;
...@@ -547,7 +564,6 @@ ath5k_pci_probe(struct pci_dev *pdev, ...@@ -547,7 +564,6 @@ ath5k_pci_probe(struct pci_dev *pdev,
__set_bit(ATH_STAT_INVALID, sc->status); __set_bit(ATH_STAT_INVALID, sc->status);
sc->iobase = mem; /* So we can unmap it on detach */ sc->iobase = mem; /* So we can unmap it on detach */
sc->common.cachelsz = csz << 2; /* convert to bytes */
sc->opmode = NL80211_IFTYPE_STATION; sc->opmode = NL80211_IFTYPE_STATION;
sc->bintval = 1000; sc->bintval = 1000;
mutex_init(&sc->lock); mutex_init(&sc->lock);
...@@ -565,13 +581,28 @@ ath5k_pci_probe(struct pci_dev *pdev, ...@@ -565,13 +581,28 @@ ath5k_pci_probe(struct pci_dev *pdev,
goto err_free; goto err_free;
} }
/* Initialize device */ /*If we passed the test malloc a ath5k_hw struct*/
sc->ah = ath5k_hw_attach(sc); sc->ah = kzalloc(sizeof(struct ath5k_hw), GFP_KERNEL);
if (IS_ERR(sc->ah)) { if (!sc->ah) {
ret = PTR_ERR(sc->ah); ret = -ENOMEM;
ATH5K_ERR(sc, "out of memory\n");
goto err_irq; goto err_irq;
} }
sc->ah->ah_sc = sc;
sc->ah->ah_iobase = sc->iobase;
common = ath5k_hw_common(sc->ah);
common->ops = &ath5k_common_ops;
common->ah = sc->ah;
common->hw = hw;
common->cachelsz = csz << 2; /* convert to bytes */
/* Initialize device */
ret = ath5k_hw_attach(sc);
if (ret) {
goto err_free_ah;
}
/* set up multi-rate retry capabilities */ /* set up multi-rate retry capabilities */
if (sc->ah->ah_version == AR5K_AR5212) { if (sc->ah->ah_version == AR5K_AR5212) {
hw->max_rates = 4; hw->max_rates = 4;
...@@ -640,6 +671,8 @@ ath5k_pci_probe(struct pci_dev *pdev, ...@@ -640,6 +671,8 @@ ath5k_pci_probe(struct pci_dev *pdev,
ath5k_hw_detach(sc->ah); ath5k_hw_detach(sc->ah);
err_irq: err_irq:
free_irq(pdev->irq, sc); free_irq(pdev->irq, sc);
err_free_ah:
kfree(sc->ah);
err_free: err_free:
ieee80211_free_hw(hw); ieee80211_free_hw(hw);
err_map: err_map:
...@@ -661,6 +694,7 @@ ath5k_pci_remove(struct pci_dev *pdev) ...@@ -661,6 +694,7 @@ ath5k_pci_remove(struct pci_dev *pdev)
ath5k_debug_finish_device(sc); ath5k_debug_finish_device(sc);
ath5k_detach(pdev, hw); ath5k_detach(pdev, hw);
ath5k_hw_detach(sc->ah); ath5k_hw_detach(sc->ah);
kfree(sc->ah);
free_irq(pdev->irq, sc); free_irq(pdev->irq, sc);
pci_iounmap(pdev, sc->iobase); pci_iounmap(pdev, sc->iobase);
pci_release_region(pdev, 0); pci_release_region(pdev, 0);
...@@ -669,33 +703,20 @@ ath5k_pci_remove(struct pci_dev *pdev) ...@@ -669,33 +703,20 @@ ath5k_pci_remove(struct pci_dev *pdev)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int static int ath5k_pci_suspend(struct device *dev)
ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{ {
struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct ieee80211_hw *hw = pci_get_drvdata(to_pci_dev(dev));
struct ath5k_softc *sc = hw->priv; struct ath5k_softc *sc = hw->priv;
ath5k_led_off(sc); ath5k_led_off(sc);
pci_save_state(pdev);
pci_disable_device(pdev);
pci_set_power_state(pdev, PCI_D3hot);
return 0; return 0;
} }
static int static int ath5k_pci_resume(struct device *dev)
ath5k_pci_resume(struct pci_dev *pdev)
{ {
struct pci_dev *pdev = to_pci_dev(dev);
struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct ieee80211_hw *hw = pci_get_drvdata(pdev);
struct ath5k_softc *sc = hw->priv; struct ath5k_softc *sc = hw->priv;
int err;
pci_restore_state(pdev);
err = pci_enable_device(pdev);
if (err)
return err;
/* /*
* Suspend/Resume resets the PCI configuration space, so we have to * Suspend/Resume resets the PCI configuration space, so we have to
...@@ -718,7 +739,7 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re ...@@ -718,7 +739,7 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re
{ {
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct ath5k_softc *sc = hw->priv; struct ath5k_softc *sc = hw->priv;
struct ath_regulatory *regulatory = &sc->common.regulatory; struct ath_regulatory *regulatory = ath5k_hw_regulatory(sc->ah);
return ath_reg_notifier_apply(wiphy, request, regulatory); return ath_reg_notifier_apply(wiphy, request, regulatory);
} }
...@@ -728,7 +749,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) ...@@ -728,7 +749,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
{ {
struct ath5k_softc *sc = hw->priv; struct ath5k_softc *sc = hw->priv;
struct ath5k_hw *ah = sc->ah; struct ath5k_hw *ah = sc->ah;
struct ath_regulatory *regulatory = &sc->common.regulatory; struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah);
u8 mac[ETH_ALEN] = {}; u8 mac[ETH_ALEN] = {};
int ret; int ret;
...@@ -815,7 +836,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) ...@@ -815,7 +836,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
SET_IEEE80211_PERM_ADDR(hw, mac); SET_IEEE80211_PERM_ADDR(hw, mac);
/* All MAC address bits matter for ACKs */ /* All MAC address bits matter for ACKs */
memset(sc->bssidmask, 0xff, ETH_ALEN); memcpy(sc->bssidmask, ath_bcast_mac, ETH_ALEN);
ath5k_hw_set_bssid_mask(sc->ah, sc->bssidmask); ath5k_hw_set_bssid_mask(sc->ah, sc->bssidmask);
regulatory->current_rd = ah->ah_capabilities.cap_eeprom.ee_regdomain; regulatory->current_rd = ah->ah_capabilities.cap_eeprom.ee_regdomain;
...@@ -1153,19 +1174,20 @@ ath5k_hw_to_driver_rix(struct ath5k_softc *sc, int hw_rix) ...@@ -1153,19 +1174,20 @@ ath5k_hw_to_driver_rix(struct ath5k_softc *sc, int hw_rix)
static static
struct sk_buff *ath5k_rx_skb_alloc(struct ath5k_softc *sc, dma_addr_t *skb_addr) struct sk_buff *ath5k_rx_skb_alloc(struct ath5k_softc *sc, dma_addr_t *skb_addr)
{ {
struct ath_common *common = ath5k_hw_common(sc->ah);
struct sk_buff *skb; struct sk_buff *skb;
/* /*
* Allocate buffer with headroom_needed space for the * Allocate buffer with headroom_needed space for the
* fake physical layer header at the start. * fake physical layer header at the start.
*/ */
skb = ath_rxbuf_alloc(&sc->common, skb = ath_rxbuf_alloc(common,
sc->rxbufsize + sc->common.cachelsz - 1, sc->rxbufsize + common->cachelsz - 1,
GFP_ATOMIC); GFP_ATOMIC);
if (!skb) { if (!skb) {
ATH5K_ERR(sc, "can't alloc skbuff of size %u\n", ATH5K_ERR(sc, "can't alloc skbuff of size %u\n",
sc->rxbufsize + sc->common.cachelsz - 1); sc->rxbufsize + common->cachelsz - 1);
return NULL; return NULL;
} }
...@@ -1606,13 +1628,14 @@ static int ...@@ -1606,13 +1628,14 @@ static int
ath5k_rx_start(struct ath5k_softc *sc) ath5k_rx_start(struct ath5k_softc *sc)
{ {
struct ath5k_hw *ah = sc->ah; struct ath5k_hw *ah = sc->ah;
struct ath_common *common = ath5k_hw_common(ah);
struct ath5k_buf *bf; struct ath5k_buf *bf;
int ret; int ret;
sc->rxbufsize = roundup(IEEE80211_MAX_LEN, sc->common.cachelsz); sc->rxbufsize = roundup(IEEE80211_MAX_LEN, common->cachelsz);
ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "cachelsz %u rxbufsize %u\n", ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "cachelsz %u rxbufsize %u\n",
sc->common.cachelsz, sc->rxbufsize); common->cachelsz, sc->rxbufsize);
spin_lock_bh(&sc->rxbuflock); spin_lock_bh(&sc->rxbuflock);
sc->rxlink = NULL; sc->rxlink = NULL;
...@@ -1685,13 +1708,14 @@ static void ...@@ -1685,13 +1708,14 @@ static void
ath5k_check_ibss_tsf(struct ath5k_softc *sc, struct sk_buff *skb, ath5k_check_ibss_tsf(struct ath5k_softc *sc, struct sk_buff *skb,
struct ieee80211_rx_status *rxs) struct ieee80211_rx_status *rxs)
{ {
struct ath_common *common = ath5k_hw_common(sc->ah);
u64 tsf, bc_tstamp; u64 tsf, bc_tstamp;
u32 hw_tu; u32 hw_tu;
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
if (ieee80211_is_beacon(mgmt->frame_control) && if (ieee80211_is_beacon(mgmt->frame_control) &&
le16_to_cpu(mgmt->u.beacon.capab_info) & WLAN_CAPABILITY_IBSS && le16_to_cpu(mgmt->u.beacon.capab_info) & WLAN_CAPABILITY_IBSS &&
memcmp(mgmt->bssid, sc->ah->ah_bssid, ETH_ALEN) == 0) { memcmp(mgmt->bssid, common->curbssid, ETH_ALEN) == 0) {
/* /*
* Received an IBSS beacon with the same BSSID. Hardware *must* * Received an IBSS beacon with the same BSSID. Hardware *must*
* have updated the local TSF. We have to work around various * have updated the local TSF. We have to work around various
...@@ -3177,6 +3201,7 @@ static void ath5k_bss_info_changed(struct ieee80211_hw *hw, ...@@ -3177,6 +3201,7 @@ static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
{ {
struct ath5k_softc *sc = hw->priv; struct ath5k_softc *sc = hw->priv;
struct ath5k_hw *ah = sc->ah; struct ath5k_hw *ah = sc->ah;
struct ath_common *common = ath5k_hw_common(ah);
unsigned long flags; unsigned long flags;
mutex_lock(&sc->lock); mutex_lock(&sc->lock);
...@@ -3185,10 +3210,9 @@ static void ath5k_bss_info_changed(struct ieee80211_hw *hw, ...@@ -3185,10 +3210,9 @@ static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
if (changes & BSS_CHANGED_BSSID) { if (changes & BSS_CHANGED_BSSID) {
/* Cache for later use during resets */ /* Cache for later use during resets */
memcpy(ah->ah_bssid, bss_conf->bssid, ETH_ALEN); memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
/* XXX: assoc id is set to 0 for now, mac80211 doesn't have common->curaid = 0;
* a clean way of letting us retrieve this yet. */ ath5k_hw_set_associd(ah);
ath5k_hw_set_associd(ah, ah->ah_bssid, 0);
mmiowb(); mmiowb();
} }
...@@ -3201,6 +3225,14 @@ static void ath5k_bss_info_changed(struct ieee80211_hw *hw, ...@@ -3201,6 +3225,14 @@ static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
set_beacon_filter(hw, sc->assoc); set_beacon_filter(hw, sc->assoc);
ath5k_hw_set_ledstate(sc->ah, sc->assoc ? ath5k_hw_set_ledstate(sc->ah, sc->assoc ?
AR5K_LED_ASSOC : AR5K_LED_INIT); AR5K_LED_ASSOC : AR5K_LED_INIT);
if (bss_conf->assoc) {
ATH5K_DBG(sc, ATH5K_DEBUG_ANY,
"Bss Info ASSOC %d, bssid: %pM\n",
bss_conf->aid, common->curbssid);
common->curaid = bss_conf->aid;
ath5k_hw_set_associd(ah);
/* Once ANI is available you would start it here */
}
} }
if (changes & BSS_CHANGED_BEACON) { if (changes & BSS_CHANGED_BEACON) {
......
...@@ -115,7 +115,6 @@ struct ath5k_rfkill { ...@@ -115,7 +115,6 @@ struct ath5k_rfkill {
* associated with an instance of a device */ * associated with an instance of a device */
struct ath5k_softc { struct ath5k_softc {
struct pci_dev *pdev; /* for dma mapping */ struct pci_dev *pdev; /* for dma mapping */
struct ath_common common;
void __iomem *iobase; /* address of the device */ void __iomem *iobase; /* address of the device */
struct mutex lock; /* dev-level lock */ struct mutex lock; /* dev-level lock */
struct ieee80211_tx_queue_stats tx_stats[AR5K_NUM_TX_QUEUES]; struct ieee80211_tx_queue_stats tx_stats[AR5K_NUM_TX_QUEUES];
...@@ -202,15 +201,4 @@ struct ath5k_softc { ...@@ -202,15 +201,4 @@ struct ath5k_softc {
#define ath5k_hw_hasveol(_ah) \ #define ath5k_hw_hasveol(_ah) \
(ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0) (ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0)
static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah)
{
return &ah->ah_sc->common;
}
static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
{
return &(ath5k_hw_common(ah)->regulatory);
}
#endif #endif
...@@ -560,8 +560,8 @@ static const struct ath5k_ini ar5212_ini_common_start[] = { ...@@ -560,8 +560,8 @@ static const struct ath5k_ini ar5212_ini_common_start[] = {
{ AR5K_SLEEP0, 0x0002aaaa }, { AR5K_SLEEP0, 0x0002aaaa },
{ AR5K_SLEEP1, 0x02005555 }, { AR5K_SLEEP1, 0x02005555 },
{ AR5K_SLEEP2, 0x00000000 }, { AR5K_SLEEP2, 0x00000000 },
{ AR5K_BSS_IDM0, 0xffffffff }, { AR_BSSMSKL, 0xffffffff },
{ AR5K_BSS_IDM1, 0x0000ffff }, { AR_BSSMSKU, 0x0000ffff },
{ AR5K_TXPC, 0x00000000 }, { AR5K_TXPC, 0x00000000 },
{ AR5K_PROFCNT_TX, 0x00000000 }, { AR5K_PROFCNT_TX, 0x00000000 },
{ AR5K_PROFCNT_RX, 0x00000000 }, { AR5K_PROFCNT_RX, 0x00000000 },
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
* Protocol Control Unit Functions * * Protocol Control Unit Functions *
\*********************************/ \*********************************/
#include <asm/unaligned.h>
#include "ath5k.h" #include "ath5k.h"
#include "reg.h" #include "reg.h"
#include "debug.h" #include "debug.h"
...@@ -44,6 +46,7 @@ ...@@ -44,6 +46,7 @@
*/ */
int ath5k_hw_set_opmode(struct ath5k_hw *ah) int ath5k_hw_set_opmode(struct ath5k_hw *ah)
{ {
struct ath_common *common = ath5k_hw_common(ah);
u32 pcu_reg, beacon_reg, low_id, high_id; u32 pcu_reg, beacon_reg, low_id, high_id;
...@@ -95,8 +98,8 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah) ...@@ -95,8 +98,8 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah)
/* /*
* Set PCU registers * Set PCU registers
*/ */
low_id = AR5K_LOW_ID(ah->ah_sta_id); low_id = get_unaligned_le32(common->macaddr);
high_id = AR5K_HIGH_ID(ah->ah_sta_id); high_id = get_unaligned_le16(common->macaddr + 4);
ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0);
ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1);
...@@ -238,28 +241,6 @@ int ath5k_hw_set_cts_timeout(struct ath5k_hw *ah, unsigned int timeout) ...@@ -238,28 +241,6 @@ int ath5k_hw_set_cts_timeout(struct ath5k_hw *ah, unsigned int timeout)
return 0; return 0;
} }
/****************\
* BSSID handling *
\****************/
/**
* ath5k_hw_get_lladdr - Get station id
*
* @ah: The &struct ath5k_hw
* @mac: The card's mac address
*
* Initialize ah->ah_sta_id using the mac address provided
* (just a memcpy).
*
* TODO: Remove it once we merge ath5k_softc and ath5k_hw
*/
void ath5k_hw_get_lladdr(struct ath5k_hw *ah, u8 *mac)
{
ATH5K_TRACE(ah->ah_sc);
memcpy(mac, ah->ah_sta_id, ETH_ALEN);
}
/** /**
* ath5k_hw_set_lladdr - Set station id * ath5k_hw_set_lladdr - Set station id
* *
...@@ -270,17 +251,18 @@ void ath5k_hw_get_lladdr(struct ath5k_hw *ah, u8 *mac) ...@@ -270,17 +251,18 @@ void ath5k_hw_get_lladdr(struct ath5k_hw *ah, u8 *mac)
*/ */
int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac) int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac)
{ {
struct ath_common *common = ath5k_hw_common(ah);
u32 low_id, high_id; u32 low_id, high_id;
u32 pcu_reg; u32 pcu_reg;
ATH5K_TRACE(ah->ah_sc); ATH5K_TRACE(ah->ah_sc);
/* Set new station ID */ /* Set new station ID */
memcpy(ah->ah_sta_id, mac, ETH_ALEN); memcpy(common->macaddr, mac, ETH_ALEN);
pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000;
low_id = AR5K_LOW_ID(mac); low_id = get_unaligned_le32(mac);
high_id = AR5K_HIGH_ID(mac); high_id = get_unaligned_le16(mac + 4);
ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0);
ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1);
...@@ -297,159 +279,51 @@ int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac) ...@@ -297,159 +279,51 @@ int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac)
* *
* Sets the BSSID which trigers the "SME Join" operation * Sets the BSSID which trigers the "SME Join" operation
*/ */
void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id) void ath5k_hw_set_associd(struct ath5k_hw *ah)
{ {
u32 low_id, high_id; struct ath_common *common = ath5k_hw_common(ah);
u16 tim_offset = 0; u16 tim_offset = 0;
/* /*
* Set simple BSSID mask on 5212 * Set simple BSSID mask on 5212
*/ */
if (ah->ah_version == AR5K_AR5212) { if (ah->ah_version == AR5K_AR5212)
ath5k_hw_reg_write(ah, AR5K_LOW_ID(ah->ah_bssid_mask), ath_hw_setbssidmask(common);
AR5K_BSS_IDM0);
ath5k_hw_reg_write(ah, AR5K_HIGH_ID(ah->ah_bssid_mask),
AR5K_BSS_IDM1);
}
/* /*
* Set BSSID which triggers the "SME Join" operation * Set BSSID which triggers the "SME Join" operation
*/ */
low_id = AR5K_LOW_ID(bssid); ath5k_hw_reg_write(ah,
high_id = AR5K_HIGH_ID(bssid); get_unaligned_le32(common->curbssid),
ath5k_hw_reg_write(ah, low_id, AR5K_BSS_ID0); AR5K_BSS_ID0);
ath5k_hw_reg_write(ah, high_id | ((assoc_id & 0x3fff) << ath5k_hw_reg_write(ah,
AR5K_BSS_ID1_AID_S), AR5K_BSS_ID1); get_unaligned_le16(common->curbssid + 4) |
((common->curaid & 0x3fff) << AR5K_BSS_ID1_AID_S),
if (assoc_id == 0) { AR5K_BSS_ID1);
if (common->curaid == 0) {
ath5k_hw_disable_pspoll(ah); ath5k_hw_disable_pspoll(ah);
return; return;
} }
AR5K_REG_WRITE_BITS(ah, AR5K_BEACON, AR5K_BEACON_TIM, AR5K_REG_WRITE_BITS(ah, AR5K_BEACON, AR5K_BEACON_TIM,
tim_offset ? tim_offset + 4 : 0); tim_offset ? tim_offset + 4 : 0);
ath5k_hw_enable_pspoll(ah, NULL, 0); ath5k_hw_enable_pspoll(ah, NULL, 0);
} }
/** void ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask)
* ath5k_hw_set_bssid_mask - filter out bssids we listen
*
* @ah: the &struct ath5k_hw
* @mask: the bssid_mask, a u8 array of size ETH_ALEN
*
* BSSID masking is a method used by AR5212 and newer hardware to inform PCU
* which bits of the interface's MAC address should be looked at when trying
* to decide which packets to ACK. In station mode and AP mode with a single
* BSS every bit matters since we lock to only one BSS. In AP mode with
* multiple BSSes (virtual interfaces) not every bit matters because hw must
* accept frames for all BSSes and so we tweak some bits of our mac address
* in order to have multiple BSSes.
*
* NOTE: This is a simple filter and does *not* filter out all
* relevant frames. Some frames that are not for us might get ACKed from us
* by PCU because they just match the mask.
*
* When handling multiple BSSes you can get the BSSID mask by computing the
* set of ~ ( MAC XOR BSSID ) for all bssids we handle.
*
* When you do this you are essentially computing the common bits of all your
* BSSes. Later it is assumed the harware will "and" (&) the BSSID mask with
* the MAC address to obtain the relevant bits and compare the result with
* (frame's BSSID & mask) to see if they match.
*/
/*
* Simple example: on your card you have have two BSSes you have created with
* BSSID-01 and BSSID-02. Lets assume BSSID-01 will not use the MAC address.
* There is another BSSID-03 but you are not part of it. For simplicity's sake,
* assuming only 4 bits for a mac address and for BSSIDs you can then have:
*
* \
* MAC: 0001 |
* BSSID-01: 0100 | --> Belongs to us
* BSSID-02: 1001 |
* /
* -------------------
* BSSID-03: 0110 | --> External
* -------------------
*
* Our bssid_mask would then be:
*
* On loop iteration for BSSID-01:
* ~(0001 ^ 0100) -> ~(0101)
* -> 1010
* bssid_mask = 1010
*
* On loop iteration for BSSID-02:
* bssid_mask &= ~(0001 ^ 1001)
* bssid_mask = (1010) & ~(0001 ^ 1001)
* bssid_mask = (1010) & ~(1001)
* bssid_mask = (1010) & (0110)
* bssid_mask = 0010
*
* A bssid_mask of 0010 means "only pay attention to the second least
* significant bit". This is because its the only bit common
* amongst the MAC and all BSSIDs we support. To findout what the real
* common bit is we can simply "&" the bssid_mask now with any BSSID we have
* or our MAC address (we assume the hardware uses the MAC address).
*
* Now, suppose there's an incoming frame for BSSID-03:
*
* IFRAME-01: 0110
*
* An easy eye-inspeciton of this already should tell you that this frame
* will not pass our check. This is beacuse the bssid_mask tells the
* hardware to only look at the second least significant bit and the
* common bit amongst the MAC and BSSIDs is 0, this frame has the 2nd LSB
* as 1, which does not match 0.
*
* So with IFRAME-01 we *assume* the hardware will do:
*
* allow = (IFRAME-01 & bssid_mask) == (bssid_mask & MAC) ? 1 : 0;
* --> allow = (0110 & 0010) == (0010 & 0001) ? 1 : 0;
* --> allow = (0010) == 0000 ? 1 : 0;
* --> allow = 0
*
* Lets now test a frame that should work:
*
* IFRAME-02: 0001 (we should allow)
*
* allow = (0001 & 1010) == 1010
*
* allow = (IFRAME-02 & bssid_mask) == (bssid_mask & MAC) ? 1 : 0;
* --> allow = (0001 & 0010) == (0010 & 0001) ? 1 :0;
* --> allow = (0010) == (0010)
* --> allow = 1
*
* Other examples:
*
* IFRAME-03: 0100 --> allowed
* IFRAME-04: 1001 --> allowed
* IFRAME-05: 1101 --> allowed but its not for us!!!
*
*/
int ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask)
{ {
u32 low_id, high_id; struct ath_common *common = ath5k_hw_common(ah);
ATH5K_TRACE(ah->ah_sc); ATH5K_TRACE(ah->ah_sc);
/* Cache bssid mask so that we can restore it /* Cache bssid mask so that we can restore it
* on reset */ * on reset */
memcpy(ah->ah_bssid_mask, mask, ETH_ALEN); memcpy(common->bssidmask, mask, ETH_ALEN);
if (ah->ah_version == AR5K_AR5212) { if (ah->ah_version == AR5K_AR5212)
low_id = AR5K_LOW_ID(mask); ath_hw_setbssidmask(common);
high_id = AR5K_HIGH_ID(mask);
ath5k_hw_reg_write(ah, low_id, AR5K_BSS_IDM0);
ath5k_hw_reg_write(ah, high_id, AR5K_BSS_IDM1);
return 0;
}
return -EIO;
} }
/************\ /************\
* RX Control * * RX Control *
\************/ \************/
...@@ -1157,14 +1031,17 @@ int ath5k_hw_set_key_lladdr(struct ath5k_hw *ah, u16 entry, const u8 *mac) ...@@ -1157,14 +1031,17 @@ int ath5k_hw_set_key_lladdr(struct ath5k_hw *ah, u16 entry, const u8 *mac)
/* Invalid entry (key table overflow) */ /* Invalid entry (key table overflow) */
AR5K_ASSERT_ENTRY(entry, AR5K_KEYTABLE_SIZE); AR5K_ASSERT_ENTRY(entry, AR5K_KEYTABLE_SIZE);
/* MAC may be NULL if it's a broadcast key. In this case no need to /*
* to compute AR5K_LOW_ID and AR5K_HIGH_ID as we already know it. */ * MAC may be NULL if it's a broadcast key. In this case no need to
* to compute get_unaligned_le32 and get_unaligned_le16 as we
* already know it.
*/
if (!mac) { if (!mac) {
low_id = 0xffffffff; low_id = 0xffffffff;
high_id = 0xffff | AR5K_KEYTABLE_VALID; high_id = 0xffff | AR5K_KEYTABLE_VALID;
} else { } else {
low_id = AR5K_LOW_ID(mac); low_id = get_unaligned_le32(mac);
high_id = AR5K_HIGH_ID(mac) | AR5K_KEYTABLE_VALID; high_id = get_unaligned_le16(mac + 4) | AR5K_KEYTABLE_VALID;
} }
ath5k_hw_reg_write(ah, low_id, AR5K_KEYTABLE_MAC0(entry)); ath5k_hw_reg_write(ah, low_id, AR5K_KEYTABLE_MAC0(entry));
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
* released by Atheros and on various debug messages found on the net. * released by Atheros and on various debug messages found on the net.
*/ */
#include "../reg.h"
/*====MAC DMA REGISTERS====*/ /*====MAC DMA REGISTERS====*/
...@@ -1649,12 +1649,6 @@ ...@@ -1649,12 +1649,6 @@
#define AR5K_SLEEP2_DTIM_PER 0xffff0000 /* Mask for DTIM period (?) */ #define AR5K_SLEEP2_DTIM_PER 0xffff0000 /* Mask for DTIM period (?) */
#define AR5K_SLEEP2_DTIM_PER_S 16 #define AR5K_SLEEP2_DTIM_PER_S 16
/*
* BSSID mask registers
*/
#define AR5K_BSS_IDM0 0x80e0 /* Upper bits */
#define AR5K_BSS_IDM1 0x80e4 /* Lower bits */
/* /*
* TX power control (TPC) register * TX power control (TPC) register
* *
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
Reset functions and helpers Reset functions and helpers
\*****************************/ \*****************************/
#include <asm/unaligned.h>
#include <linux/pci.h> /* To determine if a card is pci-e */ #include <linux/pci.h> /* To determine if a card is pci-e */
#include <linux/log2.h> #include <linux/log2.h>
#include "ath5k.h" #include "ath5k.h"
...@@ -870,6 +872,7 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah, ...@@ -870,6 +872,7 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
struct ieee80211_channel *channel, bool change_channel) struct ieee80211_channel *channel, bool change_channel)
{ {
struct ath_common *common = ath5k_hw_common(ah);
u32 s_seq[10], s_ant, s_led[3], staid1_flags, tsf_up, tsf_lo; u32 s_seq[10], s_ant, s_led[3], staid1_flags, tsf_up, tsf_lo;
u32 phy_tst1; u32 phy_tst1;
u8 mode, freq, ee_mode, ant[2]; u8 mode, freq, ee_mode, ant[2];
...@@ -1171,10 +1174,12 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, ...@@ -1171,10 +1174,12 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
ath5k_hw_reg_write(ah, s_led[2], AR5K_GPIODO); ath5k_hw_reg_write(ah, s_led[2], AR5K_GPIODO);
/* Restore sta_id flags and preserve our mac address*/ /* Restore sta_id flags and preserve our mac address*/
ath5k_hw_reg_write(ah, AR5K_LOW_ID(ah->ah_sta_id), ath5k_hw_reg_write(ah,
AR5K_STA_ID0); get_unaligned_le32(common->macaddr),
ath5k_hw_reg_write(ah, staid1_flags | AR5K_HIGH_ID(ah->ah_sta_id), AR5K_STA_ID0);
AR5K_STA_ID1); ath5k_hw_reg_write(ah,
staid1_flags | get_unaligned_le16(common->macaddr + 4),
AR5K_STA_ID1);
/* /*
...@@ -1182,8 +1187,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, ...@@ -1182,8 +1187,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
*/ */
/* Restore bssid and bssid mask */ /* Restore bssid and bssid mask */
/* XXX: add ah->aid once mac80211 gives this to us */ ath5k_hw_set_associd(ah);
ath5k_hw_set_associd(ah, ah->ah_bssid, 0);
/* Set PCU config */ /* Set PCU config */
ath5k_hw_set_opmode(ah); ath5k_hw_set_opmode(ah);
......
config ATH9K_HW
tristate
config ATH9K config ATH9K
tristate "Atheros 802.11n wireless cards support" tristate "Atheros 802.11n wireless cards support"
depends on PCI && MAC80211 && WLAN_80211 depends on PCI && MAC80211 && WLAN_80211
select ATH9K_HW
select MAC80211_LEDS select MAC80211_LEDS
select LEDS_CLASS select LEDS_CLASS
select NEW_LEDS select NEW_LEDS
...@@ -16,6 +20,8 @@ config ATH9K ...@@ -16,6 +20,8 @@ config ATH9K
If you choose to build a module, it'll be called ath9k. If you choose to build a module, it'll be called ath9k.
if ATH_DEBUG
config ATH9K_DEBUG config ATH9K_DEBUG
bool "Atheros ath9k debugging" bool "Atheros ath9k debugging"
depends on ATH9K depends on ATH9K
...@@ -26,3 +32,5 @@ config ATH9K_DEBUG ...@@ -26,3 +32,5 @@ config ATH9K_DEBUG
modprobe ath9k debug=0x00000200 modprobe ath9k debug=0x00000200
Look in ath9k/debug.h for possible debug masks Look in ath9k/debug.h for possible debug masks
endif # ATH_DEBUG
ath9k-y += hw.o \ ath9k-y += beacon.o \
eeprom.o \
eeprom_def.o \
eeprom_4k.o \
eeprom_9287.o \
mac.o \
calib.o \
ani.o \
phy.o \
beacon.o \
main.o \ main.o \
recv.o \ recv.o \
xmit.o \ xmit.o \
virtual.o \ virtual.o \
rc.o \ rc.o
btcoex.o
ath9k-$(CONFIG_PCI) += pci.o ath9k-$(CONFIG_PCI) += pci.o
ath9k-$(CONFIG_ATHEROS_AR71XX) += ahb.o ath9k-$(CONFIG_ATHEROS_AR71XX) += ahb.o
ath9k-$(CONFIG_ATH9K_DEBUG) += debug.o ath9k-$(CONFIG_ATH9K_DEBUG) += debug.o
obj-$(CONFIG_ATH9K) += ath9k.o obj-$(CONFIG_ATH9K) += ath9k.o
ath9k_hw-y:= hw.o \
eeprom.o \
eeprom_def.o \
eeprom_4k.o \
eeprom_9287.o \
calib.o \
ani.o \
phy.o \
btcoex.o \
mac.o \
obj-$(CONFIG_ATH9K_HW) += ath9k_hw.o
...@@ -22,27 +22,31 @@ ...@@ -22,27 +22,31 @@
#include "ath9k.h" #include "ath9k.h"
/* return bus cachesize in 4B word units */ /* return bus cachesize in 4B word units */
static void ath_ahb_read_cachesize(struct ath_softc *sc, int *csz) static void ath_ahb_read_cachesize(struct ath_common *common, int *csz)
{ {
*csz = L1_CACHE_BYTES >> 2; *csz = L1_CACHE_BYTES >> 2;
} }
static void ath_ahb_cleanup(struct ath_softc *sc) static void ath_ahb_cleanup(struct ath_common *common)
{ {
struct ath_hw *ah = (struct ath_hw *) common->ah;
struct ath_softc *sc = ah->ah_sc;
iounmap(sc->mem); iounmap(sc->mem);
} }
static bool ath_ahb_eeprom_read(struct ath_hw *ah, u32 off, u16 *data) static bool ath_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
{ {
struct ath_hw *ah = (struct ath_hw *) common->ah;
struct ath_softc *sc = ah->ah_sc; struct ath_softc *sc = ah->ah_sc;
struct platform_device *pdev = to_platform_device(sc->dev); struct platform_device *pdev = to_platform_device(sc->dev);
struct ath9k_platform_data *pdata; struct ath9k_platform_data *pdata;
pdata = (struct ath9k_platform_data *) pdev->dev.platform_data; pdata = (struct ath9k_platform_data *) pdev->dev.platform_data;
if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { if (off >= (ARRAY_SIZE(pdata->eeprom_data))) {
DPRINTF(ah->ah_sc, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"%s: flash read failed, offset %08x is out of range\n", "%s: flash read failed, offset %08x "
__func__, off); "is out of range\n",
__func__, off);
return false; return false;
} }
...@@ -116,10 +120,9 @@ static int ath_ahb_probe(struct platform_device *pdev) ...@@ -116,10 +120,9 @@ static int ath_ahb_probe(struct platform_device *pdev)
sc->hw = hw; sc->hw = hw;
sc->dev = &pdev->dev; sc->dev = &pdev->dev;
sc->mem = mem; sc->mem = mem;
sc->bus_ops = &ath_ahb_bus_ops;
sc->irq = irq; sc->irq = irq;
ret = ath_init_device(AR5416_AR9100_DEVID, sc, 0x0); ret = ath_init_device(AR5416_AR9100_DEVID, sc, 0x0, &ath_ahb_bus_ops);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to initialize device\n"); dev_err(&pdev->dev, "failed to initialize device\n");
goto err_free_hw; goto err_free_hw;
......
This diff is collapsed.
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "rc.h" #include "rc.h"
#include "debug.h" #include "debug.h"
#include "../ath.h" #include "../ath.h"
#include "btcoex.h" #include "../debug.h"
struct ath_node; struct ath_node;
...@@ -54,15 +54,11 @@ struct ath_node; ...@@ -54,15 +54,11 @@ struct ath_node;
#define A_MAX(a, b) ((a) > (b) ? (a) : (b)) #define A_MAX(a, b) ((a) > (b) ? (a) : (b))
#define ASSERT(exp) BUG_ON(!(exp))
#define TSF_TO_TU(_h,_l) \ #define TSF_TO_TU(_h,_l) \
((((u32)(_h)) << 22) | (((u32)(_l)) >> 10)) ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10))
#define ATH_TXQ_SETUP(sc, i) ((sc)->tx.txqsetup & (1<<i)) #define ATH_TXQ_SETUP(sc, i) ((sc)->tx.txqsetup & (1<<i))
static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
struct ath_config { struct ath_config {
u32 ath_aggr_prot; u32 ath_aggr_prot;
u16 txpowlimit; u16 txpowlimit;
...@@ -191,7 +187,6 @@ void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd, ...@@ -191,7 +187,6 @@ void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd,
/* minimum h/w qdepth to be sustained to maximize aggregation */ /* minimum h/w qdepth to be sustained to maximize aggregation */
#define ATH_AGGR_MIN_QDEPTH 2 #define ATH_AGGR_MIN_QDEPTH 2
#define ATH_AMPDU_SUBFRAME_DEFAULT 32 #define ATH_AMPDU_SUBFRAME_DEFAULT 32
#define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1)
#define IEEE80211_SEQ_SEQ_SHIFT 4 #define IEEE80211_SEQ_SEQ_SHIFT 4
#define IEEE80211_SEQ_MAX 4096 #define IEEE80211_SEQ_MAX 4096
...@@ -293,7 +288,6 @@ struct ath_tx_control { ...@@ -293,7 +288,6 @@ struct ath_tx_control {
#define ATH_RSSI_LPF_LEN 10 #define ATH_RSSI_LPF_LEN 10
#define RSSI_LPF_THRESHOLD -20 #define RSSI_LPF_THRESHOLD -20
#define ATH9K_RSSI_BAD 0x80
#define ATH_RSSI_EP_MULTIPLIER (1<<7) #define ATH_RSSI_EP_MULTIPLIER (1<<7)
#define ATH_EP_MUL(x, mul) ((x) * (mul)) #define ATH_EP_MUL(x, mul) ((x) * (mul))
#define ATH_RSSI_IN(x) (ATH_EP_MUL((x), ATH_RSSI_EP_MULTIPLIER)) #define ATH_RSSI_IN(x) (ATH_EP_MUL((x), ATH_RSSI_EP_MULTIPLIER))
...@@ -427,7 +421,6 @@ struct ath_beacon { ...@@ -427,7 +421,6 @@ struct ath_beacon {
void ath_beacon_tasklet(unsigned long data); void ath_beacon_tasklet(unsigned long data);
void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif); void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif);
int ath_beaconq_setup(struct ath_hw *ah);
int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif); int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif);
void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp); void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp);
...@@ -451,6 +444,26 @@ struct ath_ani { ...@@ -451,6 +444,26 @@ struct ath_ani {
struct timer_list timer; struct timer_list timer;
}; };
/* Defines the BT AR_BT_COEX_WGHT used */
enum ath_stomp_type {
ATH_BTCOEX_NO_STOMP,
ATH_BTCOEX_STOMP_ALL,
ATH_BTCOEX_STOMP_LOW,
ATH_BTCOEX_STOMP_NONE
};
struct ath_btcoex {
bool hw_timer_enabled;
spinlock_t btcoex_lock;
struct timer_list period_timer; /* Timer for BT period */
u32 bt_priority_cnt;
unsigned long bt_priority_time;
int bt_stomp_type; /* Types of BT stomping */
u32 btcoex_no_stomp; /* in usec */
u32 btcoex_period; /* in usec */
struct ath_gen_timer *no_stomp_timer; /* Timer for no BT stomping */
};
/********************/ /********************/
/* LED Control */ /* LED Control */
/********************/ /********************/
...@@ -484,7 +497,6 @@ struct ath_led { ...@@ -484,7 +497,6 @@ struct ath_led {
* Used when PCI device not fully initialized by bootrom/BIOS * Used when PCI device not fully initialized by bootrom/BIOS
*/ */
#define DEFAULT_CACHELINE 32 #define DEFAULT_CACHELINE 32
#define ATH_DEFAULT_NOISE_FLOOR -95
#define ATH_REGCLASSIDS_MAX 10 #define ATH_REGCLASSIDS_MAX 10
#define ATH_CABQ_READY_TIME 80 /* % of beacon interval */ #define ATH_CABQ_READY_TIME 80 /* % of beacon interval */
#define ATH_MAX_SW_RETRIES 10 #define ATH_MAX_SW_RETRIES 10
...@@ -522,23 +534,14 @@ struct ath_led { ...@@ -522,23 +534,14 @@ struct ath_led {
#define SC_OP_WAIT_FOR_PSPOLL_DATA BIT(17) #define SC_OP_WAIT_FOR_PSPOLL_DATA BIT(17)
#define SC_OP_WAIT_FOR_TX_ACK BIT(18) #define SC_OP_WAIT_FOR_TX_ACK BIT(18)
#define SC_OP_BEACON_SYNC BIT(19) #define SC_OP_BEACON_SYNC BIT(19)
#define SC_OP_BTCOEX_ENABLED BIT(20)
#define SC_OP_BT_PRIORITY_DETECTED BIT(21) #define SC_OP_BT_PRIORITY_DETECTED BIT(21)
struct ath_bus_ops {
void (*read_cachesize)(struct ath_softc *sc, int *csz);
void (*cleanup)(struct ath_softc *sc);
bool (*eeprom_read)(struct ath_hw *ah, u32 off, u16 *data);
};
struct ath_wiphy; struct ath_wiphy;
struct ath_softc { struct ath_softc {
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
struct device *dev; struct device *dev;
struct ath_common common;
spinlock_t wiphy_lock; /* spinlock to protect ath_wiphy data */ spinlock_t wiphy_lock; /* spinlock to protect ath_wiphy data */
struct ath_wiphy *pri_wiphy; struct ath_wiphy *pri_wiphy;
struct ath_wiphy **sec_wiphy; /* secondary wiphys (virtual radios); may struct ath_wiphy **sec_wiphy; /* secondary wiphys (virtual radios); may
...@@ -565,24 +568,17 @@ struct ath_softc { ...@@ -565,24 +568,17 @@ struct ath_softc {
spinlock_t sc_pm_lock; spinlock_t sc_pm_lock;
struct mutex mutex; struct mutex mutex;
u8 curbssid[ETH_ALEN];
u8 bssidmask[ETH_ALEN];
u32 intrstatus; u32 intrstatus;
u32 sc_flags; /* SC_OP_* */ u32 sc_flags; /* SC_OP_* */
u16 curtxpow; u16 curtxpow;
u16 curaid;
u8 nbcnvifs; u8 nbcnvifs;
u16 nvifs; u16 nvifs;
u8 tx_chainmask;
u8 rx_chainmask;
u32 keymax; u32 keymax;
DECLARE_BITMAP(keymap, ATH_KEYMAX); DECLARE_BITMAP(keymap, ATH_KEYMAX);
u8 splitmic; u8 splitmic;
bool ps_enabled; bool ps_enabled;
unsigned long ps_usecount; unsigned long ps_usecount;
enum ath9k_int imask; enum ath9k_int imask;
enum ath9k_ht_extprotspacing ht_extprotspacing;
enum ath9k_ht_macmode tx_chan_width;
struct ath_config config; struct ath_config config;
struct ath_rx rx; struct ath_rx rx;
...@@ -609,10 +605,9 @@ struct ath_softc { ...@@ -609,10 +605,9 @@ struct ath_softc {
#ifdef CONFIG_ATH9K_DEBUG #ifdef CONFIG_ATH9K_DEBUG
struct ath9k_debug debug; struct ath9k_debug debug;
#endif #endif
struct ath_bus_ops *bus_ops;
struct ath_beacon_config cur_beacon_conf; struct ath_beacon_config cur_beacon_conf;
struct delayed_work tx_complete_work; struct delayed_work tx_complete_work;
struct ath_btcoex_info btcoex_info; struct ath_btcoex btcoex;
}; };
struct ath_wiphy { struct ath_wiphy {
...@@ -634,31 +629,22 @@ int ath_get_hal_qnum(u16 queue, struct ath_softc *sc); ...@@ -634,31 +629,22 @@ int ath_get_hal_qnum(u16 queue, struct ath_softc *sc);
int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc); int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc);
int ath_cabq_update(struct ath_softc *); int ath_cabq_update(struct ath_softc *);
static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah) static inline void ath_read_cachesize(struct ath_common *common, int *csz)
{
return &ah->ah_sc->common;
}
static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah)
{ {
return &(ath9k_hw_common(ah)->regulatory); common->bus_ops->read_cachesize(common, csz);
} }
static inline void ath_read_cachesize(struct ath_softc *sc, int *csz) static inline void ath_bus_cleanup(struct ath_common *common)
{ {
sc->bus_ops->read_cachesize(sc, csz); common->bus_ops->cleanup(common);
}
static inline void ath_bus_cleanup(struct ath_softc *sc)
{
sc->bus_ops->cleanup(sc);
} }
extern struct ieee80211_ops ath9k_ops; extern struct ieee80211_ops ath9k_ops;
irqreturn_t ath_isr(int irq, void *dev); irqreturn_t ath_isr(int irq, void *dev);
void ath_cleanup(struct ath_softc *sc); void ath_cleanup(struct ath_softc *sc);
int ath_init_device(u16 devid, struct ath_softc *sc, u16 subsysid); int ath_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,
const struct ath_bus_ops *bus_ops);
void ath_detach(struct ath_softc *sc); void ath_detach(struct ath_softc *sc);
const char *ath_mac_bb_name(u32 mac_bb_version); const char *ath_mac_bb_name(u32 mac_bb_version);
const char *ath_rf_name(u16 rf_version); const char *ath_rf_name(u16 rf_version);
...@@ -706,8 +692,5 @@ bool ath9k_wiphy_scanning(struct ath_softc *sc); ...@@ -706,8 +692,5 @@ bool ath9k_wiphy_scanning(struct ath_softc *sc);
void ath9k_wiphy_work(struct work_struct *work); void ath9k_wiphy_work(struct work_struct *work);
bool ath9k_all_wiphys_idle(struct ath_softc *sc); bool ath9k_all_wiphys_idle(struct ath_softc *sc);
void ath9k_iowrite32(struct ath_hw *ah, u32 reg_offset, u32 val);
unsigned int ath9k_ioread32(struct ath_hw *ah, u32 reg_offset);
int ath_tx_get_qnum(struct ath_softc *sc, int qtype, int haltype); int ath_tx_get_qnum(struct ath_softc *sc, int qtype, int haltype);
#endif /* ATH9K_H */ #endif /* ATH9K_H */
This diff is collapsed.
This diff is collapsed.
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#ifndef BTCOEX_H #ifndef BTCOEX_H
#define BTCOEX_H #define BTCOEX_H
#include "hw.h"
#define ATH_WLANACTIVE_GPIO 5 #define ATH_WLANACTIVE_GPIO 5
#define ATH_BTACTIVE_GPIO 6 #define ATH_BTACTIVE_GPIO 6
#define ATH_BTPRIORITY_GPIO 7 #define ATH_BTPRIORITY_GPIO 7
...@@ -34,67 +36,25 @@ enum ath_btcoex_scheme { ...@@ -34,67 +36,25 @@ enum ath_btcoex_scheme {
ATH_BTCOEX_CFG_3WIRE, ATH_BTCOEX_CFG_3WIRE,
}; };
enum ath_stomp_type { struct ath_btcoex_hw {
ATH_BTCOEX_NO_STOMP, enum ath_btcoex_scheme scheme;
ATH_BTCOEX_STOMP_ALL, bool enabled;
ATH_BTCOEX_STOMP_LOW,
ATH_BTCOEX_STOMP_NONE
};
enum ath_bt_mode {
ATH_BT_COEX_MODE_LEGACY, /* legacy rx_clear mode */
ATH_BT_COEX_MODE_UNSLOTTED, /* untimed/unslotted mode */
ATH_BT_COEX_MODE_SLOTTED, /* slotted mode */
ATH_BT_COEX_MODE_DISALBED, /* coexistence disabled */
};
struct ath_btcoex_config {
u8 bt_time_extend;
bool bt_txstate_extend;
bool bt_txframe_extend;
enum ath_bt_mode bt_mode; /* coexistence mode */
bool bt_quiet_collision;
bool bt_rxclear_polarity; /* invert rx_clear as WLAN_ACTIVE*/
u8 bt_priority_time;
u8 bt_first_slot_time;
bool bt_hold_rx_clear;
};
struct ath_btcoex_info {
enum ath_btcoex_scheme btcoex_scheme;
u8 wlanactive_gpio; u8 wlanactive_gpio;
u8 btactive_gpio; u8 btactive_gpio;
u8 btpriority_gpio; u8 btpriority_gpio;
u8 bt_duty_cycle; /* BT duty cycle in percentage */
int bt_stomp_type; /* Types of BT stomping */
u32 bt_coex_mode; /* Register setting for AR_BT_COEX_MODE */ u32 bt_coex_mode; /* Register setting for AR_BT_COEX_MODE */
u32 bt_coex_weights; /* Register setting for AR_BT_COEX_WEIGHT */ u32 bt_coex_weights; /* Register setting for AR_BT_COEX_WEIGHT */
u32 bt_coex_mode2; /* Register setting for AR_BT_COEX_MODE2 */ u32 bt_coex_mode2; /* Register setting for AR_BT_COEX_MODE2 */
u32 btcoex_no_stomp; /* in usec */
u32 btcoex_period; /* in usec */
u32 bt_priority_cnt;
unsigned long bt_priority_time;
bool hw_timer_enabled;
spinlock_t btcoex_lock;
struct timer_list period_timer; /* Timer for BT period */
struct ath_gen_timer *no_stomp_timer; /*Timer for no BT stomping*/
}; };
bool ath_btcoex_supported(u16 subsysid); bool ath9k_hw_btcoex_supported(struct ath_hw *ah);
int ath9k_hw_btcoex_init(struct ath_hw *ah); void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah);
void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah);
void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum);
void ath9k_hw_btcoex_set_weight(struct ath_hw *ah,
u32 bt_weight,
u32 wlan_weight);
void ath9k_hw_btcoex_enable(struct ath_hw *ah); void ath9k_hw_btcoex_enable(struct ath_hw *ah);
void ath9k_hw_btcoex_disable(struct ath_hw *ah); void ath9k_hw_btcoex_disable(struct ath_hw *ah);
void ath_btcoex_timer_resume(struct ath_softc *sc,
struct ath_btcoex_info *btinfo);
void ath_btcoex_timer_pause(struct ath_softc *sc,
struct ath_btcoex_info *btinfo);
static inline void ath_btcoex_set_weight(struct ath_btcoex_info *btcoex_info,
u32 bt_weight,
u32 wlan_weight)
{
btcoex_info->bt_coex_weights = SM(bt_weight, AR_BTCOEX_BT_WGHT) |
SM(wlan_weight, AR_BTCOEX_WL_WGHT);
}
#endif #endif
This diff is collapsed.
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#ifndef CALIB_H #ifndef CALIB_H
#define CALIB_H #define CALIB_H
#include "hw.h"
extern const struct ath9k_percal_data iq_cal_multi_sample; extern const struct ath9k_percal_data iq_cal_multi_sample;
extern const struct ath9k_percal_data iq_cal_single_sample; extern const struct ath9k_percal_data iq_cal_single_sample;
extern const struct ath9k_percal_data adc_gain_cal_multi_sample; extern const struct ath9k_percal_data adc_gain_cal_multi_sample;
......
...@@ -18,26 +18,13 @@ ...@@ -18,26 +18,13 @@
#include "ath9k.h" #include "ath9k.h"
static unsigned int ath9k_debug = DBG_DEFAULT; #define REG_WRITE_D(_ah, _reg, _val) \
module_param_named(debug, ath9k_debug, uint, 0); ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg))
#define REG_READ_D(_ah, _reg) \
ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
static struct dentry *ath9k_debugfs_root; static struct dentry *ath9k_debugfs_root;
void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...)
{
if (!sc)
return;
if (sc->debug.debug_mask & dbg_mask) {
va_list args;
va_start(args, fmt);
printk(KERN_DEBUG "ath9k: ");
vprintk(fmt, args);
va_end(args);
}
}
static int ath9k_debugfs_open(struct inode *inode, struct file *file) static int ath9k_debugfs_open(struct inode *inode, struct file *file)
{ {
file->private_data = inode->i_private; file->private_data = inode->i_private;
...@@ -48,10 +35,11 @@ static ssize_t read_file_debug(struct file *file, char __user *user_buf, ...@@ -48,10 +35,11 @@ static ssize_t read_file_debug(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct ath_softc *sc = file->private_data; struct ath_softc *sc = file->private_data;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
char buf[32]; char buf[32];
unsigned int len; unsigned int len;
len = snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.debug_mask); len = snprintf(buf, sizeof(buf), "0x%08x\n", common->debug_mask);
return simple_read_from_buffer(user_buf, count, ppos, buf, len); return simple_read_from_buffer(user_buf, count, ppos, buf, len);
} }
...@@ -59,6 +47,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf, ...@@ -59,6 +47,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct ath_softc *sc = file->private_data; struct ath_softc *sc = file->private_data;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
unsigned long mask; unsigned long mask;
char buf[32]; char buf[32];
ssize_t len; ssize_t len;
...@@ -71,7 +60,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf, ...@@ -71,7 +60,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
if (strict_strtoul(buf, 0, &mask)) if (strict_strtoul(buf, 0, &mask))
return -EINVAL; return -EINVAL;
sc->debug.debug_mask = mask; common->debug_mask = mask;
return count; return count;
} }
...@@ -95,7 +84,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, ...@@ -95,7 +84,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf,
ath9k_ps_wakeup(sc); ath9k_ps_wakeup(sc);
REG_WRITE(ah, AR_MACMISC, REG_WRITE_D(ah, AR_MACMISC,
((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) | ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) |
(AR_MACMISC_MISC_OBS_BUS_1 << (AR_MACMISC_MISC_OBS_BUS_1 <<
AR_MACMISC_MISC_OBS_BUS_MSB_S))); AR_MACMISC_MISC_OBS_BUS_MSB_S)));
...@@ -107,7 +96,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, ...@@ -107,7 +96,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf,
if (i % 4 == 0) if (i % 4 == 0)
len += snprintf(buf + len, sizeof(buf) - len, "\n"); len += snprintf(buf + len, sizeof(buf) - len, "\n");
val[i] = REG_READ(ah, AR_DMADBG_0 + (i * sizeof(u32))); val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32)));
len += snprintf(buf + len, sizeof(buf) - len, "%d: %08x ", len += snprintf(buf + len, sizeof(buf) - len, "%d: %08x ",
i, val[i]); i, val[i]);
} }
...@@ -157,9 +146,9 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, ...@@ -157,9 +146,9 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf,
(val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17); (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17);
len += snprintf(buf + len, sizeof(buf) - len, "pcu observe: 0x%x \n", len += snprintf(buf + len, sizeof(buf) - len, "pcu observe: 0x%x \n",
REG_READ(ah, AR_OBS_BUS_1)); REG_READ_D(ah, AR_OBS_BUS_1));
len += snprintf(buf + len, sizeof(buf) - len, len += snprintf(buf + len, sizeof(buf) - len,
"AR_CR: 0x%x \n", REG_READ(ah, AR_CR)); "AR_CR: 0x%x \n", REG_READ_D(ah, AR_CR));
ath9k_ps_restore(sc); ath9k_ps_restore(sc);
...@@ -376,12 +365,12 @@ static ssize_t read_file_wiphy(struct file *file, char __user *user_buf, ...@@ -376,12 +365,12 @@ static ssize_t read_file_wiphy(struct file *file, char __user *user_buf,
aphy->chan_idx, aphy->chan_is_ht); aphy->chan_idx, aphy->chan_is_ht);
} }
put_unaligned_le32(REG_READ(sc->sc_ah, AR_STA_ID0), addr); put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_STA_ID0), addr);
put_unaligned_le16(REG_READ(sc->sc_ah, AR_STA_ID1) & 0xffff, addr + 4); put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_STA_ID1) & 0xffff, addr + 4);
len += snprintf(buf + len, sizeof(buf) - len, len += snprintf(buf + len, sizeof(buf) - len,
"addr: %pM\n", addr); "addr: %pM\n", addr);
put_unaligned_le32(REG_READ(sc->sc_ah, AR_BSSMSKL), addr); put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_BSSMSKL), addr);
put_unaligned_le16(REG_READ(sc->sc_ah, AR_BSSMSKU) & 0xffff, addr + 4); put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_BSSMSKU) & 0xffff, addr + 4);
len += snprintf(buf + len, sizeof(buf) - len, len += snprintf(buf + len, sizeof(buf) - len,
"addrmask: %pM\n", addr); "addrmask: %pM\n", addr);
...@@ -568,9 +557,10 @@ static const struct file_operations fops_xmit = { ...@@ -568,9 +557,10 @@ static const struct file_operations fops_xmit = {
.owner = THIS_MODULE .owner = THIS_MODULE
}; };
int ath9k_init_debug(struct ath_softc *sc) int ath9k_init_debug(struct ath_hw *ah)
{ {
sc->debug.debug_mask = ath9k_debug; struct ath_common *common = ath9k_hw_common(ah);
struct ath_softc *sc = (struct ath_softc *) common->priv;
if (!ath9k_debugfs_root) if (!ath9k_debugfs_root)
return -ENOENT; return -ENOENT;
...@@ -619,12 +609,15 @@ int ath9k_init_debug(struct ath_softc *sc) ...@@ -619,12 +609,15 @@ int ath9k_init_debug(struct ath_softc *sc)
return 0; return 0;
err: err:
ath9k_exit_debug(sc); ath9k_exit_debug(ah);
return -ENOMEM; return -ENOMEM;
} }
void ath9k_exit_debug(struct ath_softc *sc) void ath9k_exit_debug(struct ath_hw *ah)
{ {
struct ath_common *common = ath9k_hw_common(ah);
struct ath_softc *sc = (struct ath_softc *) common->priv;
debugfs_remove(sc->debug.debugfs_xmit); debugfs_remove(sc->debug.debugfs_xmit);
debugfs_remove(sc->debug.debugfs_wiphy); debugfs_remove(sc->debug.debugfs_wiphy);
debugfs_remove(sc->debug.debugfs_rcstat); debugfs_remove(sc->debug.debugfs_rcstat);
......
...@@ -17,25 +17,7 @@ ...@@ -17,25 +17,7 @@
#ifndef DEBUG_H #ifndef DEBUG_H
#define DEBUG_H #define DEBUG_H
enum ATH_DEBUG { #include "hw.h"
ATH_DBG_RESET = 0x00000001,
ATH_DBG_QUEUE = 0x00000002,
ATH_DBG_EEPROM = 0x00000004,
ATH_DBG_CALIBRATE = 0x00000008,
ATH_DBG_INTERRUPT = 0x00000010,
ATH_DBG_REGULATORY = 0x00000020,
ATH_DBG_ANI = 0x00000040,
ATH_DBG_XMIT = 0x00000080,
ATH_DBG_BEACON = 0x00000100,
ATH_DBG_CONFIG = 0x00000200,
ATH_DBG_FATAL = 0x00000400,
ATH_DBG_PS = 0x00000800,
ATH_DBG_HWTIMER = 0x00001000,
ATH_DBG_BTCOEX = 0x00002000,
ATH_DBG_ANY = 0xffffffff
};
#define DBG_DEFAULT (ATH_DBG_FATAL)
struct ath_txq; struct ath_txq;
struct ath_buf; struct ath_buf;
...@@ -140,7 +122,6 @@ struct ath_stats { ...@@ -140,7 +122,6 @@ struct ath_stats {
}; };
struct ath9k_debug { struct ath9k_debug {
int debug_mask;
struct dentry *debugfs_phy; struct dentry *debugfs_phy;
struct dentry *debugfs_debug; struct dentry *debugfs_debug;
struct dentry *debugfs_dma; struct dentry *debugfs_dma;
...@@ -151,9 +132,9 @@ struct ath9k_debug { ...@@ -151,9 +132,9 @@ struct ath9k_debug {
struct ath_stats stats; struct ath_stats stats;
}; };
void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...); int ath9k_init_debug(struct ath_hw *ah);
int ath9k_init_debug(struct ath_softc *sc); void ath9k_exit_debug(struct ath_hw *ah);
void ath9k_exit_debug(struct ath_softc *sc);
int ath9k_debug_create_root(void); int ath9k_debug_create_root(void);
void ath9k_debug_remove_root(void); void ath9k_debug_remove_root(void);
void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
...@@ -165,17 +146,12 @@ void ath_debug_stat_retries(struct ath_softc *sc, int rix, ...@@ -165,17 +146,12 @@ void ath_debug_stat_retries(struct ath_softc *sc, int rix,
#else #else
static inline void DPRINTF(struct ath_softc *sc, int dbg_mask, static inline int ath9k_init_debug(struct ath_hw *ah)
const char *fmt, ...)
{
}
static inline int ath9k_init_debug(struct ath_softc *sc)
{ {
return 0; return 0;
} }
static inline void ath9k_exit_debug(struct ath_softc *sc) static inline void ath9k_exit_debug(struct ath_hw *ah)
{ {
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "ath9k.h" #include "hw.h"
static inline u16 ath9k_hw_fbin2freq(u8 fbin, bool is2GHz) static inline u16 ath9k_hw_fbin2freq(u8 fbin, bool is2GHz)
{ {
...@@ -83,11 +83,9 @@ bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, ...@@ -83,11 +83,9 @@ bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize,
return false; return false;
} }
bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data) bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data)
{ {
struct ath_softc *sc = ah->ah_sc; return common->bus_ops->eeprom_read(common, off, data);
return sc->bus_ops->eeprom_read(ah, off, data);
} }
void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList,
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#ifndef EEPROM_H #ifndef EEPROM_H
#define EEPROM_H #define EEPROM_H
#include "../ath.h"
#include <net/cfg80211.h> #include <net/cfg80211.h>
#define AH_USE_EEPROM 0x1 #define AH_USE_EEPROM 0x1
...@@ -133,6 +134,7 @@ ...@@ -133,6 +134,7 @@
#define AR5416_EEP_MINOR_VER_17 0x11 #define AR5416_EEP_MINOR_VER_17 0x11
#define AR5416_EEP_MINOR_VER_19 0x13 #define AR5416_EEP_MINOR_VER_19 0x13
#define AR5416_EEP_MINOR_VER_20 0x14 #define AR5416_EEP_MINOR_VER_20 0x14
#define AR5416_EEP_MINOR_VER_21 0x15
#define AR5416_EEP_MINOR_VER_22 0x16 #define AR5416_EEP_MINOR_VER_22 0x16
#define AR5416_NUM_5G_CAL_PIERS 8 #define AR5416_NUM_5G_CAL_PIERS 8
...@@ -153,7 +155,7 @@ ...@@ -153,7 +155,7 @@
#define AR5416_BCHAN_UNUSED 0xFF #define AR5416_BCHAN_UNUSED 0xFF
#define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64 #define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64
#define AR5416_MAX_CHAINS 3 #define AR5416_MAX_CHAINS 3
#define AR5416_PWR_TABLE_OFFSET -5 #define AR5416_PWR_TABLE_OFFSET_DB -5
/* Rx gain type values */ /* Rx gain type values */
#define AR5416_EEP_RXGAIN_23DB_BACKOFF 0 #define AR5416_EEP_RXGAIN_23DB_BACKOFF 0
...@@ -301,7 +303,7 @@ struct base_eep_header { ...@@ -301,7 +303,7 @@ struct base_eep_header {
u8 txGainType; u8 txGainType;
u8 rcChainMask; u8 rcChainMask;
u8 desiredScaleCCK; u8 desiredScaleCCK;
u8 power_table_offset; u8 pwr_table_offset;
u8 frac_n_5g; u8 frac_n_5g;
u8 futureBase_3[21]; u8 futureBase_3[21];
} __packed; } __packed;
...@@ -638,6 +640,7 @@ struct ar9287_eeprom { ...@@ -638,6 +640,7 @@ struct ar9287_eeprom {
} __packed; } __packed;
enum reg_ext_bitmap { enum reg_ext_bitmap {
REG_EXT_FCC_MIDBAND = 0,
REG_EXT_JAPAN_MIDBAND = 1, REG_EXT_JAPAN_MIDBAND = 1,
REG_EXT_FCC_DFS_HT40 = 2, REG_EXT_FCC_DFS_HT40 = 2,
REG_EXT_JAPAN_NONDFS_HT40 = 3, REG_EXT_JAPAN_NONDFS_HT40 = 3,
...@@ -684,7 +687,7 @@ int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight, ...@@ -684,7 +687,7 @@ int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight,
int16_t targetRight); int16_t targetRight);
bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize,
u16 *indexL, u16 *indexR); u16 *indexL, u16 *indexR);
bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data); bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data);
void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList,
u8 *pVpdList, u16 numIntercepts, u8 *pVpdList, u16 numIntercepts,
u8 *pRetVpdList); u8 *pRetVpdList);
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "ath9k.h" #include "hw.h"
static int ath9k_hw_4k_get_eeprom_ver(struct ath_hw *ah) static int ath9k_hw_4k_get_eeprom_ver(struct ath_hw *ah)
{ {
...@@ -29,20 +29,21 @@ static int ath9k_hw_4k_get_eeprom_rev(struct ath_hw *ah) ...@@ -29,20 +29,21 @@ static int ath9k_hw_4k_get_eeprom_rev(struct ath_hw *ah)
static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah) static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
{ {
#define SIZE_EEPROM_4K (sizeof(struct ar5416_eeprom_4k) / sizeof(u16)) #define SIZE_EEPROM_4K (sizeof(struct ar5416_eeprom_4k) / sizeof(u16))
struct ath_common *common = ath9k_hw_common(ah);
u16 *eep_data = (u16 *)&ah->eeprom.map4k; u16 *eep_data = (u16 *)&ah->eeprom.map4k;
int addr, eep_start_loc = 0; int addr, eep_start_loc = 0;
eep_start_loc = 64; eep_start_loc = 64;
if (!ath9k_hw_use_flash(ah)) { if (!ath9k_hw_use_flash(ah)) {
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, ath_print(common, ATH_DBG_EEPROM,
"Reading from EEPROM, not flash\n"); "Reading from EEPROM, not flash\n");
} }
for (addr = 0; addr < SIZE_EEPROM_4K; addr++) { for (addr = 0; addr < SIZE_EEPROM_4K; addr++) {
if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) { if (!ath9k_hw_nvram_read(common, addr + eep_start_loc, eep_data)) {
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, ath_print(common, ATH_DBG_EEPROM,
"Unable to read eeprom region \n"); "Unable to read eeprom region \n");
return false; return false;
} }
eep_data++; eep_data++;
...@@ -55,6 +56,7 @@ static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah) ...@@ -55,6 +56,7 @@ static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah) static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
{ {
#define EEPROM_4K_SIZE (sizeof(struct ar5416_eeprom_4k) / sizeof(u16)) #define EEPROM_4K_SIZE (sizeof(struct ar5416_eeprom_4k) / sizeof(u16))
struct ath_common *common = ath9k_hw_common(ah);
struct ar5416_eeprom_4k *eep = struct ar5416_eeprom_4k *eep =
(struct ar5416_eeprom_4k *) &ah->eeprom.map4k; (struct ar5416_eeprom_4k *) &ah->eeprom.map4k;
u16 *eepdata, temp, magic, magic2; u16 *eepdata, temp, magic, magic2;
...@@ -64,15 +66,15 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah) ...@@ -64,15 +66,15 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
if (!ath9k_hw_use_flash(ah)) { if (!ath9k_hw_use_flash(ah)) {
if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET,
&magic)) { &magic)) {
DPRINTF(ah->ah_sc, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Reading Magic # failed\n"); "Reading Magic # failed\n");
return false; return false;
} }
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, ath_print(common, ATH_DBG_EEPROM,
"Read Magic = 0x%04X\n", magic); "Read Magic = 0x%04X\n", magic);
if (magic != AR5416_EEPROM_MAGIC) { if (magic != AR5416_EEPROM_MAGIC) {
magic2 = swab16(magic); magic2 = swab16(magic);
...@@ -87,16 +89,16 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah) ...@@ -87,16 +89,16 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
eepdata++; eepdata++;
} }
} else { } else {
DPRINTF(ah->ah_sc, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Invalid EEPROM Magic. " "Invalid EEPROM Magic. "
"endianness mismatch.\n"); "endianness mismatch.\n");
return -EINVAL; return -EINVAL;
} }
} }
} }
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, "need_swap = %s.\n", ath_print(common, ATH_DBG_EEPROM, "need_swap = %s.\n",
need_swap ? "True" : "False"); need_swap ? "True" : "False");
if (need_swap) if (need_swap)
el = swab16(ah->eeprom.map4k.baseEepHeader.length); el = swab16(ah->eeprom.map4k.baseEepHeader.length);
...@@ -117,8 +119,8 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah) ...@@ -117,8 +119,8 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
u32 integer; u32 integer;
u16 word; u16 word;
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, ath_print(common, ATH_DBG_EEPROM,
"EEPROM Endianness is not native.. Changing\n"); "EEPROM Endianness is not native.. Changing\n");
word = swab16(eep->baseEepHeader.length); word = swab16(eep->baseEepHeader.length);
eep->baseEepHeader.length = word; eep->baseEepHeader.length = word;
...@@ -160,9 +162,9 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah) ...@@ -160,9 +162,9 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER || if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER ||
ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) { ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) {
DPRINTF(ah->ah_sc, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Bad EEPROM checksum 0x%x or revision 0x%04x\n", "Bad EEPROM checksum 0x%x or revision 0x%04x\n",
sum, ah->eep_ops->get_eeprom_ver(ah)); sum, ah->eep_ops->get_eeprom_ver(ah));
return -EINVAL; return -EINVAL;
} }
...@@ -208,6 +210,8 @@ static u32 ath9k_hw_4k_get_eeprom(struct ath_hw *ah, ...@@ -208,6 +210,8 @@ static u32 ath9k_hw_4k_get_eeprom(struct ath_hw *ah,
return pBase->rxMask; return pBase->rxMask;
case EEP_FRAC_N_5G: case EEP_FRAC_N_5G:
return 0; return 0;
case EEP_PWR_TABLE_OFFSET:
return AR5416_PWR_TABLE_OFFSET_DB;
default: default:
return 0; return 0;
} }
...@@ -385,6 +389,7 @@ static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah, ...@@ -385,6 +389,7 @@ static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah,
struct ath9k_channel *chan, struct ath9k_channel *chan,
int16_t *pTxPowerIndexOffset) int16_t *pTxPowerIndexOffset)
{ {
struct ath_common *common = ath9k_hw_common(ah);
struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k; struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k;
struct cal_data_per_freq_4k *pRawDataset; struct cal_data_per_freq_4k *pRawDataset;
u8 *pCalBChans = NULL; u8 *pCalBChans = NULL;
...@@ -470,21 +475,21 @@ static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah, ...@@ -470,21 +475,21 @@ static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah,
((pdadcValues[4 * j + 3] & 0xFF) << 24); ((pdadcValues[4 * j + 3] & 0xFF) << 24);
REG_WRITE(ah, regOffset, reg32); REG_WRITE(ah, regOffset, reg32);
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, ath_print(common, ATH_DBG_EEPROM,
"PDADC (%d,%4x): %4.4x %8.8x\n", "PDADC (%d,%4x): %4.4x %8.8x\n",
i, regChainOffset, regOffset, i, regChainOffset, regOffset,
reg32); reg32);
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, ath_print(common, ATH_DBG_EEPROM,
"PDADC: Chain %d | " "PDADC: Chain %d | "
"PDADC %3d Value %3d | " "PDADC %3d Value %3d | "
"PDADC %3d Value %3d | " "PDADC %3d Value %3d | "
"PDADC %3d Value %3d | " "PDADC %3d Value %3d | "
"PDADC %3d Value %3d |\n", "PDADC %3d Value %3d |\n",
i, 4 * j, pdadcValues[4 * j], i, 4 * j, pdadcValues[4 * j],
4 * j + 1, pdadcValues[4 * j + 1], 4 * j + 1, pdadcValues[4 * j + 1],
4 * j + 2, pdadcValues[4 * j + 2], 4 * j + 2, pdadcValues[4 * j + 2],
4 * j + 3, 4 * j + 3,
pdadcValues[4 * j + 3]); pdadcValues[4 * j + 3]);
regOffset += 4; regOffset += 4;
} }
...@@ -750,7 +755,7 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, ...@@ -750,7 +755,7 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah,
if (AR_SREV_9280_10_OR_LATER(ah)) { if (AR_SREV_9280_10_OR_LATER(ah)) {
for (i = 0; i < Ar5416RateSize; i++) for (i = 0; i < Ar5416RateSize; i++)
ratesArray[i] -= AR5416_PWR_TABLE_OFFSET * 2; ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2;
} }
/* OFDM power per rate */ /* OFDM power per rate */
...@@ -1148,20 +1153,21 @@ static u16 ath9k_hw_4k_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz) ...@@ -1148,20 +1153,21 @@ static u16 ath9k_hw_4k_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz)
{ {
#define EEP_MAP4K_SPURCHAN \ #define EEP_MAP4K_SPURCHAN \
(ah->eeprom.map4k.modalHeader.spurChans[i].spurChan) (ah->eeprom.map4k.modalHeader.spurChans[i].spurChan)
struct ath_common *common = ath9k_hw_common(ah);
u16 spur_val = AR_NO_SPUR; u16 spur_val = AR_NO_SPUR;
DPRINTF(ah->ah_sc, ATH_DBG_ANI, ath_print(common, ATH_DBG_ANI,
"Getting spur idx %d is2Ghz. %d val %x\n", "Getting spur idx %d is2Ghz. %d val %x\n",
i, is2GHz, ah->config.spurchans[i][is2GHz]); i, is2GHz, ah->config.spurchans[i][is2GHz]);
switch (ah->config.spurmode) { switch (ah->config.spurmode) {
case SPUR_DISABLE: case SPUR_DISABLE:
break; break;
case SPUR_ENABLE_IOCTL: case SPUR_ENABLE_IOCTL:
spur_val = ah->config.spurchans[i][is2GHz]; spur_val = ah->config.spurchans[i][is2GHz];
DPRINTF(ah->ah_sc, ATH_DBG_ANI, ath_print(common, ATH_DBG_ANI,
"Getting spur val from new loc. %d\n", spur_val); "Getting spur val from new loc. %d\n", spur_val);
break; break;
case SPUR_ENABLE_EEPROM: case SPUR_ENABLE_EEPROM:
spur_val = EEP_MAP4K_SPURCHAN; spur_val = EEP_MAP4K_SPURCHAN;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "ath9k.h" #include "hw.h"
static int ath9k_hw_AR9287_get_eeprom_ver(struct ath_hw *ah) static int ath9k_hw_AR9287_get_eeprom_ver(struct ath_hw *ah)
{ {
...@@ -29,20 +29,22 @@ static int ath9k_hw_AR9287_get_eeprom_rev(struct ath_hw *ah) ...@@ -29,20 +29,22 @@ static int ath9k_hw_AR9287_get_eeprom_rev(struct ath_hw *ah)
static bool ath9k_hw_AR9287_fill_eeprom(struct ath_hw *ah) static bool ath9k_hw_AR9287_fill_eeprom(struct ath_hw *ah)
{ {
struct ar9287_eeprom *eep = &ah->eeprom.map9287; struct ar9287_eeprom *eep = &ah->eeprom.map9287;
struct ath_common *common = ath9k_hw_common(ah);
u16 *eep_data; u16 *eep_data;
int addr, eep_start_loc = AR9287_EEP_START_LOC; int addr, eep_start_loc = AR9287_EEP_START_LOC;
eep_data = (u16 *)eep; eep_data = (u16 *)eep;
if (!ath9k_hw_use_flash(ah)) { if (!ath9k_hw_use_flash(ah)) {
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, ath_print(common, ATH_DBG_EEPROM,
"Reading from EEPROM, not flash\n"); "Reading from EEPROM, not flash\n");
} }
for (addr = 0; addr < sizeof(struct ar9287_eeprom) / sizeof(u16); for (addr = 0; addr < sizeof(struct ar9287_eeprom) / sizeof(u16);
addr++) { addr++) {
if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) { if (!ath9k_hw_nvram_read(common,
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, addr + eep_start_loc, eep_data)) {
"Unable to read eeprom region \n"); ath_print(common, ATH_DBG_EEPROM,
"Unable to read eeprom region \n");
return false; return false;
} }
eep_data++; eep_data++;
...@@ -57,17 +59,18 @@ static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah) ...@@ -57,17 +59,18 @@ static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah)
int i, addr; int i, addr;
bool need_swap = false; bool need_swap = false;
struct ar9287_eeprom *eep = &ah->eeprom.map9287; struct ar9287_eeprom *eep = &ah->eeprom.map9287;
struct ath_common *common = ath9k_hw_common(ah);
if (!ath9k_hw_use_flash(ah)) { if (!ath9k_hw_use_flash(ah)) {
if (!ath9k_hw_nvram_read if (!ath9k_hw_nvram_read(common,
(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
DPRINTF(ah->ah_sc, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Reading Magic # failed\n"); "Reading Magic # failed\n");
return false; return false;
} }
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, ath_print(common, ATH_DBG_EEPROM,
"Read Magic = 0x%04X\n", magic); "Read Magic = 0x%04X\n", magic);
if (magic != AR5416_EEPROM_MAGIC) { if (magic != AR5416_EEPROM_MAGIC) {
magic2 = swab16(magic); magic2 = swab16(magic);
...@@ -83,15 +86,15 @@ static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah) ...@@ -83,15 +86,15 @@ static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah)
eepdata++; eepdata++;
} }
} else { } else {
DPRINTF(ah->ah_sc, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Invalid EEPROM Magic. " "Invalid EEPROM Magic. "
"endianness mismatch.\n"); "endianness mismatch.\n");
return -EINVAL; return -EINVAL;
} }
} }
} }
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, "need_swap = %s.\n", need_swap ? ath_print(common, ATH_DBG_EEPROM, "need_swap = %s.\n", need_swap ?
"True" : "False"); "True" : "False");
if (need_swap) if (need_swap)
el = swab16(ah->eeprom.map9287.baseEepHeader.length); el = swab16(ah->eeprom.map9287.baseEepHeader.length);
...@@ -148,9 +151,9 @@ static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah) ...@@ -148,9 +151,9 @@ static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah)
if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR9287_EEP_VER if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR9287_EEP_VER
|| ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) { || ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) {
DPRINTF(ah->ah_sc, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Bad EEPROM checksum 0x%x or revision 0x%04x\n", "Bad EEPROM checksum 0x%x or revision 0x%04x\n",
sum, ah->eep_ops->get_eeprom_ver(ah)); sum, ah->eep_ops->get_eeprom_ver(ah));
return -EINVAL; return -EINVAL;
} }
...@@ -436,6 +439,7 @@ static void ath9k_hw_set_AR9287_power_cal_table(struct ath_hw *ah, ...@@ -436,6 +439,7 @@ static void ath9k_hw_set_AR9287_power_cal_table(struct ath_hw *ah,
struct ath9k_channel *chan, struct ath9k_channel *chan,
int16_t *pTxPowerIndexOffset) int16_t *pTxPowerIndexOffset)
{ {
struct ath_common *common = ath9k_hw_common(ah);
struct cal_data_per_freq_ar9287 *pRawDataset; struct cal_data_per_freq_ar9287 *pRawDataset;
struct cal_data_op_loop_ar9287 *pRawDatasetOpenLoop; struct cal_data_op_loop_ar9287 *pRawDatasetOpenLoop;
u8 *pCalBChans = NULL; u8 *pCalBChans = NULL;
...@@ -564,24 +568,25 @@ static void ath9k_hw_set_AR9287_power_cal_table(struct ath_hw *ah, ...@@ -564,24 +568,25 @@ static void ath9k_hw_set_AR9287_power_cal_table(struct ath_hw *ah,
& 0xFF) << 24) ; & 0xFF) << 24) ;
REG_WRITE(ah, regOffset, reg32); REG_WRITE(ah, regOffset, reg32);
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, ath_print(common, ATH_DBG_EEPROM,
"PDADC (%d,%4x): %4.4x %8.8x\n", "PDADC (%d,%4x): %4.4x "
i, regChainOffset, regOffset, "%8.8x\n",
reg32); i, regChainOffset, regOffset,
reg32);
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
"PDADC: Chain %d | " ath_print(common, ATH_DBG_EEPROM,
"PDADC %3d Value %3d | " "PDADC: Chain %d | "
"PDADC %3d Value %3d | " "PDADC %3d Value %3d | "
"PDADC %3d Value %3d | " "PDADC %3d Value %3d | "
"PDADC %3d Value %3d |\n", "PDADC %3d Value %3d | "
i, 4 * j, pdadcValues[4 * j], "PDADC %3d Value %3d |\n",
4 * j + 1, i, 4 * j, pdadcValues[4 * j],
pdadcValues[4 * j + 1], 4 * j + 1,
4 * j + 2, pdadcValues[4 * j + 1],
pdadcValues[4 * j + 2], 4 * j + 2,
4 * j + 3, pdadcValues[4 * j + 2],
pdadcValues[4 * j + 3]); 4 * j + 3,
pdadcValues[4 * j + 3]);
regOffset += 4; regOffset += 4;
} }
...@@ -831,6 +836,7 @@ static void ath9k_hw_AR9287_set_txpower(struct ath_hw *ah, ...@@ -831,6 +836,7 @@ static void ath9k_hw_AR9287_set_txpower(struct ath_hw *ah,
{ {
#define INCREASE_MAXPOW_BY_TWO_CHAIN 6 #define INCREASE_MAXPOW_BY_TWO_CHAIN 6
#define INCREASE_MAXPOW_BY_THREE_CHAIN 10 #define INCREASE_MAXPOW_BY_THREE_CHAIN 10
struct ath_common *common = ath9k_hw_common(ah);
struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
struct ar9287_eeprom *pEepData = &ah->eeprom.map9287; struct ar9287_eeprom *pEepData = &ah->eeprom.map9287;
struct modal_eep_ar9287_header *pModal = &pEepData->modalHeader; struct modal_eep_ar9287_header *pModal = &pEepData->modalHeader;
...@@ -966,8 +972,8 @@ static void ath9k_hw_AR9287_set_txpower(struct ath_hw *ah, ...@@ -966,8 +972,8 @@ static void ath9k_hw_AR9287_set_txpower(struct ath_hw *ah,
INCREASE_MAXPOW_BY_THREE_CHAIN; INCREASE_MAXPOW_BY_THREE_CHAIN;
break; break;
default: default:
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, ath_print(common, ATH_DBG_EEPROM,
"Invalid chainmask configuration\n"); "Invalid chainmask configuration\n");
break; break;
} }
} }
...@@ -1138,19 +1144,20 @@ static u16 ath9k_hw_AR9287_get_spur_channel(struct ath_hw *ah, ...@@ -1138,19 +1144,20 @@ static u16 ath9k_hw_AR9287_get_spur_channel(struct ath_hw *ah,
{ {
#define EEP_MAP9287_SPURCHAN \ #define EEP_MAP9287_SPURCHAN \
(ah->eeprom.map9287.modalHeader.spurChans[i].spurChan) (ah->eeprom.map9287.modalHeader.spurChans[i].spurChan)
struct ath_common *common = ath9k_hw_common(ah);
u16 spur_val = AR_NO_SPUR; u16 spur_val = AR_NO_SPUR;
DPRINTF(ah->ah_sc, ATH_DBG_ANI, ath_print(common, ATH_DBG_ANI,
"Getting spur idx %d is2Ghz. %d val %x\n", "Getting spur idx %d is2Ghz. %d val %x\n",
i, is2GHz, ah->config.spurchans[i][is2GHz]); i, is2GHz, ah->config.spurchans[i][is2GHz]);
switch (ah->config.spurmode) { switch (ah->config.spurmode) {
case SPUR_DISABLE: case SPUR_DISABLE:
break; break;
case SPUR_ENABLE_IOCTL: case SPUR_ENABLE_IOCTL:
spur_val = ah->config.spurchans[i][is2GHz]; spur_val = ah->config.spurchans[i][is2GHz];
DPRINTF(ah->ah_sc, ATH_DBG_ANI, ath_print(common, ATH_DBG_ANI,
"Getting spur val from new loc. %d\n", spur_val); "Getting spur val from new loc. %d\n", spur_val);
break; break;
case SPUR_ENABLE_EEPROM: case SPUR_ENABLE_EEPROM:
spur_val = EEP_MAP9287_SPURCHAN; spur_val = EEP_MAP9287_SPURCHAN;
......
This diff is collapsed.
This diff is collapsed.
...@@ -27,17 +27,24 @@ ...@@ -27,17 +27,24 @@
#include "calib.h" #include "calib.h"
#include "reg.h" #include "reg.h"
#include "phy.h" #include "phy.h"
#include "btcoex.h"
#include "../regd.h" #include "../regd.h"
#include "../debug.h"
#define ATHEROS_VENDOR_ID 0x168c #define ATHEROS_VENDOR_ID 0x168c
#define AR5416_DEVID_PCI 0x0023 #define AR5416_DEVID_PCI 0x0023
#define AR5416_DEVID_PCIE 0x0024 #define AR5416_DEVID_PCIE 0x0024
#define AR9160_DEVID_PCI 0x0027 #define AR9160_DEVID_PCI 0x0027
#define AR9280_DEVID_PCI 0x0029 #define AR9280_DEVID_PCI 0x0029
#define AR9280_DEVID_PCIE 0x002a #define AR9280_DEVID_PCIE 0x002a
#define AR9285_DEVID_PCIE 0x002b #define AR9285_DEVID_PCIE 0x002b
#define AR5416_AR9100_DEVID 0x000b #define AR5416_AR9100_DEVID 0x000b
#define AR9271_USB 0x9271
#define AR_SUBVENDOR_ID_NOG 0x0e11 #define AR_SUBVENDOR_ID_NOG 0x0e11
#define AR_SUBVENDOR_ID_NEW_A 0x7065 #define AR_SUBVENDOR_ID_NEW_A 0x7065
#define AR5416_MAGIC 0x19641014 #define AR5416_MAGIC 0x19641014
...@@ -49,9 +56,18 @@ ...@@ -49,9 +56,18 @@
#define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa #define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa
#define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab #define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab
#define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1)
#define ATH_DEFAULT_NOISE_FLOOR -95
#define ATH9K_RSSI_BAD 0x80
/* Register read/write primitives */ /* Register read/write primitives */
#define REG_WRITE(_ah, _reg, _val) ath9k_iowrite32((_ah), (_reg), (_val)) #define REG_WRITE(_ah, _reg, _val) \
#define REG_READ(_ah, _reg) ath9k_ioread32((_ah), (_reg)) ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg))
#define REG_READ(_ah, _reg) \
ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
#define SM(_v, _f) (((_v) << _f##_S) & _f) #define SM(_v, _f) (((_v) << _f##_S) & _f)
#define MS(_v, _f) (((_v) & _f) >> _f##_S) #define MS(_v, _f) (((_v) & _f) >> _f##_S)
...@@ -91,7 +107,7 @@ ...@@ -91,7 +107,7 @@
#define AR_GPIO_BIT(_gpio) (1 << (_gpio)) #define AR_GPIO_BIT(_gpio) (1 << (_gpio))
#define BASE_ACTIVATE_DELAY 100 #define BASE_ACTIVATE_DELAY 100
#define RTC_PLL_SETTLE_DELAY 1000 #define RTC_PLL_SETTLE_DELAY 100
#define COEF_SCALE_S 24 #define COEF_SCALE_S 24
#define HT40_CHANNEL_CENTER_SHIFT 10 #define HT40_CHANNEL_CENTER_SHIFT 10
...@@ -433,7 +449,8 @@ struct ath_gen_timer_table { ...@@ -433,7 +449,8 @@ struct ath_gen_timer_table {
}; };
struct ath_hw { struct ath_hw {
struct ath_softc *ah_sc; struct ieee80211_hw *hw;
struct ath_common common;
struct ath9k_hw_version hw_version; struct ath9k_hw_version hw_version;
struct ath9k_ops_config config; struct ath9k_ops_config config;
struct ath9k_hw_capabilities caps; struct ath9k_hw_capabilities caps;
...@@ -450,7 +467,6 @@ struct ath_hw { ...@@ -450,7 +467,6 @@ struct ath_hw {
bool sw_mgmt_crypto; bool sw_mgmt_crypto;
bool is_pciexpress; bool is_pciexpress;
u8 macaddr[ETH_ALEN];
u16 tx_trig_level; u16 tx_trig_level;
u16 rfsilent; u16 rfsilent;
u32 rfkill_gpio; u32 rfkill_gpio;
...@@ -553,8 +569,10 @@ struct ath_hw { ...@@ -553,8 +569,10 @@ struct ath_hw {
int firpwr[5]; int firpwr[5];
enum ath9k_ani_cmd ani_function; enum ath9k_ani_cmd ani_function;
/* Bluetooth coexistance */
struct ath_btcoex_hw btcoex_hw;
u32 intr_txqs; u32 intr_txqs;
enum ath9k_ht_extprotspacing extprotspacing;
u8 txchainmask; u8 txchainmask;
u8 rxchainmask; u8 rxchainmask;
...@@ -578,12 +596,24 @@ struct ath_hw { ...@@ -578,12 +596,24 @@ struct ath_hw {
struct ar5416IniArray iniModesAdditional; struct ar5416IniArray iniModesAdditional;
struct ar5416IniArray iniModesRxGain; struct ar5416IniArray iniModesRxGain;
struct ar5416IniArray iniModesTxGain; struct ar5416IniArray iniModesTxGain;
struct ar5416IniArray iniCckfirNormal;
struct ar5416IniArray iniCckfirJapan2484;
u32 intr_gen_timer_trigger; u32 intr_gen_timer_trigger;
u32 intr_gen_timer_thresh; u32 intr_gen_timer_thresh;
struct ath_gen_timer_table hw_gen_timers; struct ath_gen_timer_table hw_gen_timers;
}; };
static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah)
{
return &ah->common;
}
static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah)
{
return &(ath9k_hw_common(ah)->regulatory);
}
/* Initialization, Detach, Reset */ /* Initialization, Detach, Reset */
const char *ath9k_hw_probe(u16 vendorid, u16 devid); const char *ath9k_hw_probe(u16 vendorid, u16 devid);
void ath9k_hw_detach(struct ath_hw *ah); void ath9k_hw_detach(struct ath_hw *ah);
...@@ -637,19 +667,20 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit); ...@@ -637,19 +667,20 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit);
void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac); void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac);
void ath9k_hw_setopmode(struct ath_hw *ah); void ath9k_hw_setopmode(struct ath_hw *ah);
void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1); void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1);
void ath9k_hw_setbssidmask(struct ath_softc *sc); void ath9k_hw_setbssidmask(struct ath_hw *ah);
void ath9k_hw_write_associd(struct ath_softc *sc); void ath9k_hw_write_associd(struct ath_hw *ah);
u64 ath9k_hw_gettsf64(struct ath_hw *ah); u64 ath9k_hw_gettsf64(struct ath_hw *ah);
void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64);
void ath9k_hw_reset_tsf(struct ath_hw *ah); void ath9k_hw_reset_tsf(struct ath_hw *ah);
void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting); void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting);
bool ath9k_hw_setslottime(struct ath_hw *ah, u32 us); bool ath9k_hw_setslottime(struct ath_hw *ah, u32 us);
void ath9k_hw_set11nmac2040(struct ath_hw *ah, enum ath9k_ht_macmode mode); void ath9k_hw_set11nmac2040(struct ath_hw *ah);
void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period);
void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
const struct ath9k_beacon_state *bs); const struct ath9k_beacon_state *bs);
bool ath9k_hw_setpower(struct ath_hw *ah,
enum ath9k_power_mode mode); bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off); void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off);
/* Interrupt Handling */ /* Interrupt Handling */
...@@ -663,9 +694,12 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, ...@@ -663,9 +694,12 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
void (*overflow)(void *), void (*overflow)(void *),
void *arg, void *arg,
u8 timer_index); u8 timer_index);
void ath_gen_timer_start(struct ath_hw *ah, struct ath_gen_timer *timer, void ath9k_hw_gen_timer_start(struct ath_hw *ah,
u32 timer_next, u32 timer_period); struct ath_gen_timer *timer,
void ath_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer); u32 timer_next,
u32 timer_period);
void ath9k_hw_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer);
void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer); void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer);
void ath_gen_timer_isr(struct ath_hw *hw); void ath_gen_timer_isr(struct ath_hw *hw);
u32 ath9k_hw_gettsf32(struct ath_hw *ah); u32 ath9k_hw_gettsf32(struct ath_hw *ah);
...@@ -674,5 +708,4 @@ u32 ath9k_hw_gettsf32(struct ath_hw *ah); ...@@ -674,5 +708,4 @@ u32 ath9k_hw_gettsf32(struct ath_hw *ah);
#define ATH_PCIE_CAP_LINK_L0S 1 #define ATH_PCIE_CAP_LINK_L0S 1
#define ATH_PCIE_CAP_LINK_L1 2 #define ATH_PCIE_CAP_LINK_L1 2
void ath_pcie_aspm_disable(struct ath_softc *sc);
#endif #endif
This diff is collapsed.
This diff is collapsed.
...@@ -614,16 +614,6 @@ enum ath9k_cipher { ...@@ -614,16 +614,6 @@ enum ath9k_cipher {
ATH9K_CIPHER_MIC = 127 ATH9K_CIPHER_MIC = 127
}; };
enum ath9k_ht_macmode {
ATH9K_HT_MACMODE_20 = 0,
ATH9K_HT_MACMODE_2040 = 1,
};
enum ath9k_ht_extprotspacing {
ATH9K_HT_EXTPROTSPACING_20 = 0,
ATH9K_HT_EXTPROTSPACING_25 = 1,
};
struct ath_hw; struct ath_hw;
struct ath9k_channel; struct ath9k_channel;
struct ath_rate_table; struct ath_rate_table;
...@@ -677,5 +667,6 @@ void ath9k_hw_rxena(struct ath_hw *ah); ...@@ -677,5 +667,6 @@ void ath9k_hw_rxena(struct ath_hw *ah);
void ath9k_hw_startpcureceive(struct ath_hw *ah); void ath9k_hw_startpcureceive(struct ath_hw *ah);
void ath9k_hw_stoppcurecv(struct ath_hw *ah); void ath9k_hw_stoppcurecv(struct ath_hw *ah);
bool ath9k_hw_stopdmarecv(struct ath_hw *ah); bool ath9k_hw_stopdmarecv(struct ath_hw *ah);
int ath9k_hw_beaconq_setup(struct ath_hw *ah);
#endif /* MAC_H */ #endif /* MAC_H */
This diff is collapsed.
...@@ -31,8 +31,9 @@ static struct pci_device_id ath_pci_id_table[] __devinitdata = { ...@@ -31,8 +31,9 @@ static struct pci_device_id ath_pci_id_table[] __devinitdata = {
}; };
/* return bus cachesize in 4B word units */ /* return bus cachesize in 4B word units */
static void ath_pci_read_cachesize(struct ath_softc *sc, int *csz) static void ath_pci_read_cachesize(struct ath_common *common, int *csz)
{ {
struct ath_softc *sc = (struct ath_softc *) common->priv;
u8 u8tmp; u8 u8tmp;
pci_read_config_byte(to_pci_dev(sc->dev), PCI_CACHE_LINE_SIZE, &u8tmp); pci_read_config_byte(to_pci_dev(sc->dev), PCI_CACHE_LINE_SIZE, &u8tmp);
...@@ -48,8 +49,9 @@ static void ath_pci_read_cachesize(struct ath_softc *sc, int *csz) ...@@ -48,8 +49,9 @@ static void ath_pci_read_cachesize(struct ath_softc *sc, int *csz)
*csz = DEFAULT_CACHELINE >> 2; /* Use the default size */ *csz = DEFAULT_CACHELINE >> 2; /* Use the default size */
} }
static void ath_pci_cleanup(struct ath_softc *sc) static void ath_pci_cleanup(struct ath_common *common)
{ {
struct ath_softc *sc = (struct ath_softc *) common->priv;
struct pci_dev *pdev = to_pci_dev(sc->dev); struct pci_dev *pdev = to_pci_dev(sc->dev);
pci_iounmap(pdev, sc->mem); pci_iounmap(pdev, sc->mem);
...@@ -57,9 +59,11 @@ static void ath_pci_cleanup(struct ath_softc *sc) ...@@ -57,9 +59,11 @@ static void ath_pci_cleanup(struct ath_softc *sc)
pci_release_region(pdev, 0); pci_release_region(pdev, 0);
} }
static bool ath_pci_eeprom_read(struct ath_hw *ah, u32 off, u16 *data) static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data)
{ {
(void)REG_READ(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S)); struct ath_hw *ah = (struct ath_hw *) common->ah;
common->ops->read(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S));
if (!ath9k_hw_wait(ah, if (!ath9k_hw_wait(ah,
AR_EEPROM_STATUS_DATA, AR_EEPROM_STATUS_DATA,
...@@ -69,16 +73,34 @@ static bool ath_pci_eeprom_read(struct ath_hw *ah, u32 off, u16 *data) ...@@ -69,16 +73,34 @@ static bool ath_pci_eeprom_read(struct ath_hw *ah, u32 off, u16 *data)
return false; return false;
} }
*data = MS(REG_READ(ah, AR_EEPROM_STATUS_DATA), *data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA),
AR_EEPROM_STATUS_DATA_VAL); AR_EEPROM_STATUS_DATA_VAL);
return true; return true;
} }
static struct ath_bus_ops ath_pci_bus_ops = { /*
* Bluetooth coexistance requires disabling ASPM.
*/
static void ath_pci_bt_coex_prep(struct ath_common *common)
{
struct ath_softc *sc = (struct ath_softc *) common->priv;
struct pci_dev *pdev = to_pci_dev(sc->dev);
u8 aspm;
if (!pdev->is_pcie)
return;
pci_read_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, &aspm);
aspm &= ~(ATH_PCIE_CAP_LINK_L0S | ATH_PCIE_CAP_LINK_L1);
pci_write_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, aspm);
}
const static struct ath_bus_ops ath_pci_bus_ops = {
.read_cachesize = ath_pci_read_cachesize, .read_cachesize = ath_pci_read_cachesize,
.cleanup = ath_pci_cleanup, .cleanup = ath_pci_cleanup,
.eeprom_read = ath_pci_eeprom_read, .eeprom_read = ath_pci_eeprom_read,
.bt_coex_prep = ath_pci_bt_coex_prep,
}; };
static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
...@@ -177,10 +199,9 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -177,10 +199,9 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
sc->hw = hw; sc->hw = hw;
sc->dev = &pdev->dev; sc->dev = &pdev->dev;
sc->mem = mem; sc->mem = mem;
sc->bus_ops = &ath_pci_bus_ops;
pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &subsysid); pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &subsysid);
ret = ath_init_device(id->device, sc, subsysid); ret = ath_init_device(id->device, sc, subsysid, &ath_pci_bus_ops);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to initialize device\n"); dev_err(&pdev->dev, "failed to initialize device\n");
goto bad3; goto bad3;
......
This diff is collapsed.
...@@ -45,6 +45,7 @@ bool ath9k_hw_init_rf(struct ath_hw *ah, ...@@ -45,6 +45,7 @@ bool ath9k_hw_init_rf(struct ath_hw *ah,
#define AR_PHY_FC_DYN2040_EN 0x00000004 #define AR_PHY_FC_DYN2040_EN 0x00000004
#define AR_PHY_FC_DYN2040_PRI_ONLY 0x00000008 #define AR_PHY_FC_DYN2040_PRI_ONLY 0x00000008
#define AR_PHY_FC_DYN2040_PRI_CH 0x00000010 #define AR_PHY_FC_DYN2040_PRI_CH 0x00000010
/* For 25 MHz channel spacing -- not used but supported by hw */
#define AR_PHY_FC_DYN2040_EXT_CH 0x00000020 #define AR_PHY_FC_DYN2040_EXT_CH 0x00000020
#define AR_PHY_FC_HT_EN 0x00000040 #define AR_PHY_FC_HT_EN 0x00000040
#define AR_PHY_FC_SHORT_GI_40 0x00000080 #define AR_PHY_FC_SHORT_GI_40 0x00000080
......
This diff is collapsed.
This diff is collapsed.
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#ifndef REG_H #ifndef REG_H
#define REG_H #define REG_H
#include "../reg.h"
#define AR_CR 0x0008 #define AR_CR 0x0008
#define AR_CR_RXE 0x00000004 #define AR_CR_RXE 0x00000004
#define AR_CR_RXD 0x00000020 #define AR_CR_RXD 0x00000020
...@@ -1421,9 +1423,6 @@ enum { ...@@ -1421,9 +1423,6 @@ enum {
#define AR_SLEEP2_BEACON_TIMEOUT 0xFFE00000 #define AR_SLEEP2_BEACON_TIMEOUT 0xFFE00000
#define AR_SLEEP2_BEACON_TIMEOUT_S 21 #define AR_SLEEP2_BEACON_TIMEOUT_S 21
#define AR_BSSMSKL 0x80e0
#define AR_BSSMSKU 0x80e4
#define AR_TPC 0x80e8 #define AR_TPC 0x80e8
#define AR_TPC_ACK 0x0000003f #define AR_TPC_ACK 0x0000003f
#define AR_TPC_ACK_S 0x00 #define AR_TPC_ACK_S 0x00
......
...@@ -40,6 +40,7 @@ void ath9k_set_bssid_mask(struct ieee80211_hw *hw) ...@@ -40,6 +40,7 @@ void ath9k_set_bssid_mask(struct ieee80211_hw *hw)
{ {
struct ath_wiphy *aphy = hw->priv; struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc; struct ath_softc *sc = aphy->sc;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath9k_vif_iter_data iter_data; struct ath9k_vif_iter_data iter_data;
int i, j; int i, j;
u8 mask[ETH_ALEN]; u8 mask[ETH_ALEN];
...@@ -51,7 +52,7 @@ void ath9k_set_bssid_mask(struct ieee80211_hw *hw) ...@@ -51,7 +52,7 @@ void ath9k_set_bssid_mask(struct ieee80211_hw *hw)
*/ */
iter_data.addr = kmalloc(ETH_ALEN, GFP_ATOMIC); iter_data.addr = kmalloc(ETH_ALEN, GFP_ATOMIC);
if (iter_data.addr) { if (iter_data.addr) {
memcpy(iter_data.addr, sc->sc_ah->macaddr, ETH_ALEN); memcpy(iter_data.addr, common->macaddr, ETH_ALEN);
iter_data.count = 1; iter_data.count = 1;
} else } else
iter_data.count = 0; iter_data.count = 0;
...@@ -86,20 +87,21 @@ void ath9k_set_bssid_mask(struct ieee80211_hw *hw) ...@@ -86,20 +87,21 @@ void ath9k_set_bssid_mask(struct ieee80211_hw *hw)
kfree(iter_data.addr); kfree(iter_data.addr);
/* Invert the mask and configure hardware */ /* Invert the mask and configure hardware */
sc->bssidmask[0] = ~mask[0]; common->bssidmask[0] = ~mask[0];
sc->bssidmask[1] = ~mask[1]; common->bssidmask[1] = ~mask[1];
sc->bssidmask[2] = ~mask[2]; common->bssidmask[2] = ~mask[2];
sc->bssidmask[3] = ~mask[3]; common->bssidmask[3] = ~mask[3];
sc->bssidmask[4] = ~mask[4]; common->bssidmask[4] = ~mask[4];
sc->bssidmask[5] = ~mask[5]; common->bssidmask[5] = ~mask[5];
ath9k_hw_setbssidmask(sc); ath_hw_setbssidmask(common);
} }
int ath9k_wiphy_add(struct ath_softc *sc) int ath9k_wiphy_add(struct ath_softc *sc)
{ {
int i, error; int i, error;
struct ath_wiphy *aphy; struct ath_wiphy *aphy;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
u8 addr[ETH_ALEN]; u8 addr[ETH_ALEN];
...@@ -138,7 +140,7 @@ int ath9k_wiphy_add(struct ath_softc *sc) ...@@ -138,7 +140,7 @@ int ath9k_wiphy_add(struct ath_softc *sc)
sc->sec_wiphy[i] = aphy; sc->sec_wiphy[i] = aphy;
spin_unlock_bh(&sc->wiphy_lock); spin_unlock_bh(&sc->wiphy_lock);
memcpy(addr, sc->sc_ah->macaddr, ETH_ALEN); memcpy(addr, common->macaddr, ETH_ALEN);
addr[0] |= 0x02; /* Locally managed address */ addr[0] |= 0x02; /* Locally managed address */
/* /*
* XOR virtual wiphy index into the least significant bits to generate * XOR virtual wiphy index into the least significant bits to generate
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment