Commit 41bf3711 authored by John W. Linville's avatar John W. Linville

Merge branch 'master' of...

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
parents 415b3334 6e6e8c51
...@@ -4097,6 +4097,12 @@ S: Maintained ...@@ -4097,6 +4097,12 @@ S: Maintained
F: drivers/net/mv643xx_eth.* F: drivers/net/mv643xx_eth.*
F: include/linux/mv643xx.h F: include/linux/mv643xx.h
MARVELL MWIFIEX WIRELESS DRIVER
M: Bing Zhao <bzhao@marvell.com>
L: linux-wireless@vger.kernel.org
S: Maintained
F: drivers/net/wireless/mwifiex/
MARVELL MWL8K WIRELESS DRIVER MARVELL MWL8K WIRELESS DRIVER
M: Lennert Buytenhek <buytenh@wantstofly.org> M: Lennert Buytenhek <buytenh@wantstofly.org>
L: linux-wireless@vger.kernel.org L: linux-wireless@vger.kernel.org
...@@ -6938,9 +6944,9 @@ S: Maintained ...@@ -6938,9 +6944,9 @@ S: Maintained
F: drivers/input/misc/wistron_btns.c F: drivers/input/misc/wistron_btns.c
WL1251 WIRELESS DRIVER WL1251 WIRELESS DRIVER
M: Kalle Valo <kvalo@adurom.com> M: Luciano Coelho <coelho@ti.com>
L: linux-wireless@vger.kernel.org L: linux-wireless@vger.kernel.org
W: http://wireless.kernel.org W: http://wireless.kernel.org/en/users/Drivers/wl1251
T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
S: Maintained S: Maintained
F: drivers/net/wireless/wl1251/* F: drivers/net/wireless/wl1251/*
......
...@@ -50,3 +50,75 @@ int bcma_core_enable(struct bcma_device *core, u32 flags) ...@@ -50,3 +50,75 @@ int bcma_core_enable(struct bcma_device *core, u32 flags)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(bcma_core_enable); EXPORT_SYMBOL_GPL(bcma_core_enable);
void bcma_core_set_clockmode(struct bcma_device *core,
enum bcma_clkmode clkmode)
{
u16 i;
WARN_ON(core->id.id != BCMA_CORE_CHIPCOMMON &&
core->id.id != BCMA_CORE_PCIE &&
core->id.id != BCMA_CORE_80211);
switch (clkmode) {
case BCMA_CLKMODE_FAST:
bcma_set32(core, BCMA_CLKCTLST, BCMA_CLKCTLST_FORCEHT);
udelay(64);
for (i = 0; i < 1500; i++) {
if (bcma_read32(core, BCMA_CLKCTLST) &
BCMA_CLKCTLST_HAVEHT) {
i = 0;
break;
}
udelay(10);
}
if (i)
pr_err("HT force timeout\n");
break;
case BCMA_CLKMODE_DYNAMIC:
pr_warn("Dynamic clockmode not supported yet!\n");
break;
}
}
EXPORT_SYMBOL_GPL(bcma_core_set_clockmode);
void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status, bool on)
{
u16 i;
WARN_ON(req & ~BCMA_CLKCTLST_EXTRESREQ);
WARN_ON(status & ~BCMA_CLKCTLST_EXTRESST);
if (on) {
bcma_set32(core, BCMA_CLKCTLST, req);
for (i = 0; i < 10000; i++) {
if ((bcma_read32(core, BCMA_CLKCTLST) & status) ==
status) {
i = 0;
break;
}
udelay(10);
}
if (i)
pr_err("PLL enable timeout\n");
} else {
pr_warn("Disabling PLL not supported yet!\n");
}
}
EXPORT_SYMBOL_GPL(bcma_core_pll_ctl);
u32 bcma_core_dma_translation(struct bcma_device *core)
{
switch (core->bus->hosttype) {
case BCMA_HOSTTYPE_PCI:
if (bcma_aread32(core, BCMA_IOST) & BCMA_IOST_DMA64)
return BCMA_DMA_TRANSLATION_DMA64_CMT;
else
return BCMA_DMA_TRANSLATION_DMA32_CMT;
default:
pr_err("DMA translation unknown for host %d\n",
core->bus->hosttype);
}
return BCMA_DMA_TRANSLATION_NONE;
}
EXPORT_SYMBOL(bcma_core_dma_translation);
...@@ -23,6 +23,9 @@ static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset, ...@@ -23,6 +23,9 @@ static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset,
void bcma_core_chipcommon_init(struct bcma_drv_cc *cc) void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
{ {
u32 leddc_on = 10;
u32 leddc_off = 90;
if (cc->core->id.rev >= 11) if (cc->core->id.rev >= 11)
cc->status = bcma_cc_read32(cc, BCMA_CC_CHIPSTAT); cc->status = bcma_cc_read32(cc, BCMA_CC_CHIPSTAT);
cc->capabilities = bcma_cc_read32(cc, BCMA_CC_CAP); cc->capabilities = bcma_cc_read32(cc, BCMA_CC_CAP);
...@@ -38,6 +41,17 @@ void bcma_core_chipcommon_init(struct bcma_drv_cc *cc) ...@@ -38,6 +41,17 @@ void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
bcma_pmu_init(cc); bcma_pmu_init(cc);
if (cc->capabilities & BCMA_CC_CAP_PCTL) if (cc->capabilities & BCMA_CC_CAP_PCTL)
pr_err("Power control not implemented!\n"); pr_err("Power control not implemented!\n");
if (cc->core->id.rev >= 16) {
if (cc->core->bus->sprom.leddc_on_time &&
cc->core->bus->sprom.leddc_off_time) {
leddc_on = cc->core->bus->sprom.leddc_on_time;
leddc_off = cc->core->bus->sprom.leddc_off_time;
}
bcma_cc_write32(cc, BCMA_CC_GPIOTIMER,
((leddc_on << BCMA_CC_GPIOTIMER_ONTIME_SHIFT) |
(leddc_off << BCMA_CC_GPIOTIMER_OFFTIME_SHIFT)));
}
} }
/* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */ /* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */
......
...@@ -172,8 +172,10 @@ static bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc) ...@@ -172,8 +172,10 @@ static bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc)
chipid_top != 0x5300) chipid_top != 0x5300)
return false; return false;
#ifdef CONFIG_SSB_DRIVER_PCICORE
if (bus->sprom.boardflags_lo & SSB_PCICORE_BFL_NOPCI) if (bus->sprom.boardflags_lo & SSB_PCICORE_BFL_NOPCI)
return false; return false;
#endif /* CONFIG_SSB_DRIVER_PCICORE */
#if 0 #if 0
/* TODO: on BCMA we use address from EROM instead of magic formula */ /* TODO: on BCMA we use address from EROM instead of magic formula */
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
* R/W ops. * R/W ops.
**************************************************/ **************************************************/
static void bcma_sprom_read(struct bcma_bus *bus, u16 *sprom) static void bcma_sprom_read(struct bcma_bus *bus, u16 offset, u16 *sprom)
{ {
int i; int i;
for (i = 0; i < SSB_SPROMSIZE_WORDS_R4; i++) for (i = 0; i < SSB_SPROMSIZE_WORDS_R4; i++)
sprom[i] = bcma_read16(bus->drv_cc.core, sprom[i] = bcma_read16(bus->drv_cc.core,
BCMA_CC_SPROM + (i * 2)); offset + (i * 2));
} }
/************************************************** /**************************************************
...@@ -112,7 +112,7 @@ static int bcma_sprom_valid(const u16 *sprom) ...@@ -112,7 +112,7 @@ static int bcma_sprom_valid(const u16 *sprom)
return err; return err;
revision = sprom[SSB_SPROMSIZE_WORDS_R4 - 1] & SSB_SPROM_REVISION_REV; revision = sprom[SSB_SPROMSIZE_WORDS_R4 - 1] & SSB_SPROM_REVISION_REV;
if (revision != 8) { if (revision != 8 && revision != 9) {
pr_err("Unsupported SPROM revision: %d\n", revision); pr_err("Unsupported SPROM revision: %d\n", revision);
return -ENOENT; return -ENOENT;
} }
...@@ -137,6 +137,7 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) ...@@ -137,6 +137,7 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom)
int bcma_sprom_get(struct bcma_bus *bus) int bcma_sprom_get(struct bcma_bus *bus)
{ {
u16 offset;
u16 *sprom; u16 *sprom;
int err = 0; int err = 0;
...@@ -151,7 +152,12 @@ int bcma_sprom_get(struct bcma_bus *bus) ...@@ -151,7 +152,12 @@ int bcma_sprom_get(struct bcma_bus *bus)
if (!sprom) if (!sprom)
return -ENOMEM; return -ENOMEM;
bcma_sprom_read(bus, sprom); /* Most cards have SPROM moved by additional offset 0x30 (48 dwords).
* According to brcm80211 this applies to cards with PCIe rev >= 6
* TODO: understand this condition and use it */
offset = (bus->chipinfo.id == 0x4331) ? BCMA_CC_SPROM :
BCMA_CC_SPROM_PCIE6;
bcma_sprom_read(bus, offset, sprom);
err = bcma_sprom_valid(sprom); err = bcma_sprom_valid(sprom);
if (err) if (err)
......
...@@ -35,8 +35,8 @@ static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz) ...@@ -35,8 +35,8 @@ static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz)
static bool static bool
ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data) ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
{ {
struct ath5k_softc *sc = common->priv; struct ath5k_hw *ah = common->priv;
struct platform_device *pdev = to_platform_device(sc->dev); struct platform_device *pdev = to_platform_device(ah->dev);
struct ar231x_board_config *bcfg = pdev->dev.platform_data; struct ar231x_board_config *bcfg = pdev->dev.platform_data;
u16 *eeprom, *eeprom_end; u16 *eeprom, *eeprom_end;
...@@ -56,8 +56,7 @@ ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data) ...@@ -56,8 +56,7 @@ ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
int ath5k_hw_read_srev(struct ath5k_hw *ah) int ath5k_hw_read_srev(struct ath5k_hw *ah)
{ {
struct ath5k_softc *sc = ah->ah_sc; struct platform_device *pdev = to_platform_device(ah->dev);
struct platform_device *pdev = to_platform_device(sc->dev);
struct ar231x_board_config *bcfg = pdev->dev.platform_data; struct ar231x_board_config *bcfg = pdev->dev.platform_data;
ah->ah_mac_srev = bcfg->devid; ah->ah_mac_srev = bcfg->devid;
return 0; return 0;
...@@ -65,12 +64,11 @@ int ath5k_hw_read_srev(struct ath5k_hw *ah) ...@@ -65,12 +64,11 @@ int ath5k_hw_read_srev(struct ath5k_hw *ah)
static int ath5k_ahb_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac) static int ath5k_ahb_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
{ {
struct ath5k_softc *sc = ah->ah_sc; struct platform_device *pdev = to_platform_device(ah->dev);
struct platform_device *pdev = to_platform_device(sc->dev);
struct ar231x_board_config *bcfg = pdev->dev.platform_data; struct ar231x_board_config *bcfg = pdev->dev.platform_data;
u8 *cfg_mac; u8 *cfg_mac;
if (to_platform_device(sc->dev)->id == 0) if (to_platform_device(ah->dev)->id == 0)
cfg_mac = bcfg->config->wlan0_mac; cfg_mac = bcfg->config->wlan0_mac;
else else
cfg_mac = bcfg->config->wlan1_mac; cfg_mac = bcfg->config->wlan1_mac;
...@@ -90,7 +88,7 @@ static const struct ath_bus_ops ath_ahb_bus_ops = { ...@@ -90,7 +88,7 @@ static const struct ath_bus_ops ath_ahb_bus_ops = {
static int ath_ahb_probe(struct platform_device *pdev) static int ath_ahb_probe(struct platform_device *pdev)
{ {
struct ar231x_board_config *bcfg = pdev->dev.platform_data; struct ar231x_board_config *bcfg = pdev->dev.platform_data;
struct ath5k_softc *sc; struct ath5k_hw *ah;
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
struct resource *res; struct resource *res;
void __iomem *mem; void __iomem *mem;
...@@ -127,19 +125,19 @@ static int ath_ahb_probe(struct platform_device *pdev) ...@@ -127,19 +125,19 @@ static int ath_ahb_probe(struct platform_device *pdev)
irq = res->start; irq = res->start;
hw = ieee80211_alloc_hw(sizeof(struct ath5k_softc), &ath5k_hw_ops); hw = ieee80211_alloc_hw(sizeof(struct ath5k_hw), &ath5k_hw_ops);
if (hw == NULL) { if (hw == NULL) {
dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_out; goto err_out;
} }
sc = hw->priv; ah = hw->priv;
sc->hw = hw; ah->hw = hw;
sc->dev = &pdev->dev; ah->dev = &pdev->dev;
sc->iobase = mem; ah->iobase = mem;
sc->irq = irq; ah->irq = irq;
sc->devid = bcfg->devid; ah->devid = bcfg->devid;
if (bcfg->devid >= AR5K_SREV_AR2315_R6) { if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
/* Enable WMAC AHB arbitration */ /* Enable WMAC AHB arbitration */
...@@ -155,7 +153,7 @@ static int ath_ahb_probe(struct platform_device *pdev) ...@@ -155,7 +153,7 @@ static int ath_ahb_probe(struct platform_device *pdev)
/* Enable WMAC DMA access (assuming 5312 or 231x*/ /* Enable WMAC DMA access (assuming 5312 or 231x*/
/* TODO: check other platforms */ /* TODO: check other platforms */
reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE); reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE);
if (to_platform_device(sc->dev)->id == 0) if (to_platform_device(ah->dev)->id == 0)
reg |= AR5K_AR5312_ENABLE_WLAN0; reg |= AR5K_AR5312_ENABLE_WLAN0;
else else
reg |= AR5K_AR5312_ENABLE_WLAN1; reg |= AR5K_AR5312_ENABLE_WLAN1;
...@@ -166,13 +164,13 @@ static int ath_ahb_probe(struct platform_device *pdev) ...@@ -166,13 +164,13 @@ static int ath_ahb_probe(struct platform_device *pdev)
* used as pass-through. Disable 2 GHz support in the * used as pass-through. Disable 2 GHz support in the
* driver for it * driver for it
*/ */
if (to_platform_device(sc->dev)->id == 0 && if (to_platform_device(ah->dev)->id == 0 &&
(bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) == (bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) ==
(BD_WLAN1 | BD_WLAN0)) (BD_WLAN1 | BD_WLAN0))
__set_bit(ATH_STAT_2G_DISABLED, sc->status); __set_bit(ATH_STAT_2G_DISABLED, ah->status);
} }
ret = ath5k_init_softc(sc, &ath_ahb_bus_ops); ret = ath5k_init_softc(ah, &ath_ahb_bus_ops);
if (ret != 0) { if (ret != 0) {
dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret); dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret);
ret = -ENODEV; ret = -ENODEV;
...@@ -194,13 +192,13 @@ static int ath_ahb_remove(struct platform_device *pdev) ...@@ -194,13 +192,13 @@ static int ath_ahb_remove(struct platform_device *pdev)
{ {
struct ar231x_board_config *bcfg = pdev->dev.platform_data; struct ar231x_board_config *bcfg = pdev->dev.platform_data;
struct ieee80211_hw *hw = platform_get_drvdata(pdev); struct ieee80211_hw *hw = platform_get_drvdata(pdev);
struct ath5k_softc *sc; struct ath5k_hw *ah;
u32 reg; u32 reg;
if (!hw) if (!hw)
return 0; return 0;
sc = hw->priv; ah = hw->priv;
if (bcfg->devid >= AR5K_SREV_AR2315_R6) { if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
/* Disable WMAC AHB arbitration */ /* Disable WMAC AHB arbitration */
...@@ -210,14 +208,14 @@ static int ath_ahb_remove(struct platform_device *pdev) ...@@ -210,14 +208,14 @@ static int ath_ahb_remove(struct platform_device *pdev)
} else { } else {
/*Stop DMA access */ /*Stop DMA access */
reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE); reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE);
if (to_platform_device(sc->dev)->id == 0) if (to_platform_device(ah->dev)->id == 0)
reg &= ~AR5K_AR5312_ENABLE_WLAN0; reg &= ~AR5K_AR5312_ENABLE_WLAN0;
else else
reg &= ~AR5K_AR5312_ENABLE_WLAN1; reg &= ~AR5K_AR5312_ENABLE_WLAN1;
__raw_writel(reg, (void __iomem *) AR5K_AR5312_ENABLE); __raw_writel(reg, (void __iomem *) AR5K_AR5312_ENABLE);
} }
ath5k_deinit_softc(sc); ath5k_deinit_softc(ah);
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
ieee80211_free_hw(hw); ieee80211_free_hw(hw);
......
This diff is collapsed.
This diff is collapsed.
...@@ -59,7 +59,7 @@ static int ath5k_hw_post(struct ath5k_hw *ah) ...@@ -59,7 +59,7 @@ static int ath5k_hw_post(struct ath5k_hw *ah)
cur_val = ath5k_hw_reg_read(ah, cur_reg); cur_val = ath5k_hw_reg_read(ah, cur_reg);
if (cur_val != var_pattern) { if (cur_val != var_pattern) {
ATH5K_ERR(ah->ah_sc, "POST Failed !!!\n"); ATH5K_ERR(ah, "POST Failed !!!\n");
return -EAGAIN; return -EAGAIN;
} }
...@@ -74,7 +74,7 @@ static int ath5k_hw_post(struct ath5k_hw *ah) ...@@ -74,7 +74,7 @@ static int ath5k_hw_post(struct ath5k_hw *ah)
cur_val = ath5k_hw_reg_read(ah, cur_reg); cur_val = ath5k_hw_reg_read(ah, cur_reg);
if (cur_val != var_pattern) { if (cur_val != var_pattern) {
ATH5K_ERR(ah->ah_sc, "POST Failed !!!\n"); ATH5K_ERR(ah, "POST Failed !!!\n");
return -EAGAIN; return -EAGAIN;
} }
...@@ -95,19 +95,18 @@ static int ath5k_hw_post(struct ath5k_hw *ah) ...@@ -95,19 +95,18 @@ static int ath5k_hw_post(struct ath5k_hw *ah)
/** /**
* ath5k_hw_init - Check if hw is supported and init the needed structs * ath5k_hw_init - Check if hw is supported and init the needed structs
* *
* @sc: The &struct ath5k_softc we got from the driver's init_softc function * @ah: The &struct ath5k_hw we got from the driver's init_softc function
* *
* Check if the device is supported, perform a POST and initialize the needed * Check if the device is supported, perform a POST and initialize the needed
* structs. Returns -ENOMEM if we don't have memory for the needed structs, * structs. Returns -ENOMEM if we don't have memory for the needed structs,
* -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.
*/ */
int ath5k_hw_init(struct ath5k_softc *sc) int ath5k_hw_init(struct ath5k_hw *ah)
{ {
static const u8 zero_mac[ETH_ALEN] = { }; static const u8 zero_mac[ETH_ALEN] = { };
struct ath5k_hw *ah = sc->ah;
struct ath_common *common = ath5k_hw_common(ah); struct ath_common *common = ath5k_hw_common(ah);
struct pci_dev *pdev = sc->pdev; struct pci_dev *pdev = ah->pdev;
struct ath5k_eeprom_info *ee; struct ath5k_eeprom_info *ee;
int ret; int ret;
u32 srev; u32 srev;
...@@ -123,8 +122,8 @@ int ath5k_hw_init(struct ath5k_softc *sc) ...@@ -123,8 +122,8 @@ int ath5k_hw_init(struct ath5k_softc *sc)
ah->ah_retry_long = AR5K_INIT_RETRY_LONG; ah->ah_retry_long = AR5K_INIT_RETRY_LONG;
ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT; ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT;
ah->ah_noise_floor = -95; /* until first NF calibration is run */ ah->ah_noise_floor = -95; /* until first NF calibration is run */
sc->ani_state.ani_mode = ATH5K_ANI_MODE_AUTO; ah->ani_state.ani_mode = ATH5K_ANI_MODE_AUTO;
ah->ah_current_channel = &sc->channels[0]; ah->ah_current_channel = &ah->channels[0];
/* /*
* Find the mac version * Find the mac version
...@@ -237,7 +236,7 @@ int ath5k_hw_init(struct ath5k_softc *sc) ...@@ -237,7 +236,7 @@ int ath5k_hw_init(struct ath5k_softc *sc)
ah->ah_single_chip = true; ah->ah_single_chip = true;
ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2413; ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2413;
} else { } else {
ATH5K_ERR(sc, "Couldn't identify radio revision.\n"); ATH5K_ERR(ah, "Couldn't identify radio revision.\n");
ret = -ENODEV; ret = -ENODEV;
goto err; goto err;
} }
...@@ -246,7 +245,7 @@ int ath5k_hw_init(struct ath5k_softc *sc) ...@@ -246,7 +245,7 @@ int ath5k_hw_init(struct ath5k_softc *sc)
/* Return on unsupported chips (unsupported eeprom etc) */ /* Return on unsupported chips (unsupported eeprom etc) */
if ((srev >= AR5K_SREV_AR5416) && (srev < AR5K_SREV_AR2425)) { if ((srev >= AR5K_SREV_AR5416) && (srev < AR5K_SREV_AR2425)) {
ATH5K_ERR(sc, "Device not yet supported.\n"); ATH5K_ERR(ah, "Device not yet supported.\n");
ret = -ENODEV; ret = -ENODEV;
goto err; goto err;
} }
...@@ -268,7 +267,7 @@ int ath5k_hw_init(struct ath5k_softc *sc) ...@@ -268,7 +267,7 @@ int ath5k_hw_init(struct ath5k_softc *sc)
*/ */
ret = ath5k_eeprom_init(ah); ret = ath5k_eeprom_init(ah);
if (ret) { if (ret) {
ATH5K_ERR(sc, "unable to init EEPROM\n"); ATH5K_ERR(ah, "unable to init EEPROM\n");
goto err; goto err;
} }
...@@ -309,17 +308,17 @@ int ath5k_hw_init(struct ath5k_softc *sc) ...@@ -309,17 +308,17 @@ int ath5k_hw_init(struct ath5k_softc *sc)
/* Get misc capabilities */ /* Get misc capabilities */
ret = ath5k_hw_set_capabilities(ah); ret = ath5k_hw_set_capabilities(ah);
if (ret) { if (ret) {
ATH5K_ERR(sc, "unable to get device capabilities\n"); ATH5K_ERR(ah, "unable to get device capabilities\n");
goto err; goto err;
} }
if (test_bit(ATH_STAT_2G_DISABLED, sc->status)) { if (test_bit(ATH_STAT_2G_DISABLED, ah->status)) {
__clear_bit(AR5K_MODE_11B, ah->ah_capabilities.cap_mode); __clear_bit(AR5K_MODE_11B, ah->ah_capabilities.cap_mode);
__clear_bit(AR5K_MODE_11G, ah->ah_capabilities.cap_mode); __clear_bit(AR5K_MODE_11G, ah->ah_capabilities.cap_mode);
} }
/* Crypto settings */ /* Crypto settings */
common->keymax = (sc->ah->ah_version == AR5K_AR5210 ? common->keymax = (ah->ah_version == AR5K_AR5210 ?
AR5K_KEYTABLE_SIZE_5210 : AR5K_KEYTABLE_SIZE_5211); AR5K_KEYTABLE_SIZE_5210 : AR5K_KEYTABLE_SIZE_5211);
if (srev >= AR5K_SREV_AR5212_V4 && if (srev >= AR5K_SREV_AR5212_V4 &&
...@@ -339,7 +338,7 @@ int ath5k_hw_init(struct ath5k_softc *sc) ...@@ -339,7 +338,7 @@ int ath5k_hw_init(struct ath5k_softc *sc)
/* 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 */
memcpy(common->curbssid, ath_bcast_mac, ETH_ALEN); memcpy(common->curbssid, ath_bcast_mac, ETH_ALEN);
ath5k_hw_set_bssid(ah); ath5k_hw_set_bssid(ah);
ath5k_hw_set_opmode(ah, sc->opmode); ath5k_hw_set_opmode(ah, ah->opmode);
ath5k_hw_rfgain_opt_init(ah); ath5k_hw_rfgain_opt_init(ah);
...@@ -360,7 +359,7 @@ int ath5k_hw_init(struct ath5k_softc *sc) ...@@ -360,7 +359,7 @@ int ath5k_hw_init(struct ath5k_softc *sc)
*/ */
void ath5k_hw_deinit(struct ath5k_hw *ah) void ath5k_hw_deinit(struct ath5k_hw *ah)
{ {
__set_bit(ATH_STAT_INVALID, ah->ah_sc->status); __set_bit(ATH_STAT_INVALID, ah->status);
if (ah->ah_rf_banks != NULL) if (ah->ah_rf_banks != NULL)
kfree(ah->ah_rf_banks); kfree(ah->ah_rf_banks);
......
This diff is collapsed.
...@@ -45,23 +45,13 @@ ...@@ -45,23 +45,13 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/wireless.h> #include <linux/wireless.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/leds.h>
#include <linux/rfkill.h> #include <linux/rfkill.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include "ath5k.h" #include "ath5k.h"
#include "debug.h"
#include "ani.h"
#include "../regd.h" #include "../regd.h"
#include "../ath.h" #include "../ath.h"
#define ATH_RXBUF 40 /* number of RX buffers */
#define ATH_TXBUF 200 /* number of TX buffers */
#define ATH_BCBUF 4 /* number of beacon buffers */
#define ATH5K_TXQ_LEN_MAX (ATH_TXBUF / 4) /* bufs per queue */
#define ATH5K_TXQ_LEN_LOW (ATH5K_TXQ_LEN_MAX / 2) /* low mark */
struct ath5k_buf { struct ath5k_buf {
struct list_head list; struct list_head list;
struct ath5k_desc *desc; /* virtual addr of desc */ struct ath5k_desc *desc; /* virtual addr of desc */
...@@ -70,94 +60,6 @@ struct ath5k_buf { ...@@ -70,94 +60,6 @@ struct ath5k_buf {
dma_addr_t skbaddr;/* physical addr of skb data */ dma_addr_t skbaddr;/* physical addr of skb data */
}; };
/*
* Data transmit queue state. One of these exists for each
* hardware transmit queue. Packets sent to us from above
* are assigned to queues based on their priority. Not all
* devices support a complete set of hardware transmit queues.
* For those devices the array sc_ac2q will map multiple
* priorities to fewer hardware queues (typically all to one
* hardware queue).
*/
struct ath5k_txq {
unsigned int qnum; /* hardware q number */
u32 *link; /* link ptr in last TX desc */
struct list_head q; /* transmit queue */
spinlock_t lock; /* lock on q and link */
bool setup;
int txq_len; /* number of queued buffers */
int txq_max; /* max allowed num of queued buffers */
bool txq_poll_mark;
unsigned int txq_stuck; /* informational counter */
};
#define ATH5K_LED_MAX_NAME_LEN 31
/*
* State for LED triggers
*/
struct ath5k_led {
char name[ATH5K_LED_MAX_NAME_LEN + 1]; /* name of the LED in sysfs */
struct ath5k_softc *sc; /* driver state */
struct led_classdev led_dev; /* led classdev */
};
/* Rfkill */
struct ath5k_rfkill {
/* GPIO PIN for rfkill */
u16 gpio;
/* polarity of rfkill GPIO PIN */
bool polarity;
/* RFKILL toggle tasklet */
struct tasklet_struct toggleq;
};
/* statistics */
struct ath5k_statistics {
/* antenna use */
unsigned int antenna_rx[5]; /* frames count per antenna RX */
unsigned int antenna_tx[5]; /* frames count per antenna TX */
/* frame errors */
unsigned int rx_all_count; /* all RX frames, including errors */
unsigned int tx_all_count; /* all TX frames, including errors */
unsigned int rx_bytes_count; /* all RX bytes, including errored pkts
* and the MAC headers for each packet
*/
unsigned int tx_bytes_count; /* all TX bytes, including errored pkts
* and the MAC headers and padding for
* each packet.
*/
unsigned int rxerr_crc;
unsigned int rxerr_phy;
unsigned int rxerr_phy_code[32];
unsigned int rxerr_fifo;
unsigned int rxerr_decrypt;
unsigned int rxerr_mic;
unsigned int rxerr_proc;
unsigned int rxerr_jumbo;
unsigned int txerr_retry;
unsigned int txerr_fifo;
unsigned int txerr_filt;
/* MIB counters */
unsigned int ack_fail;
unsigned int rts_fail;
unsigned int rts_ok;
unsigned int fcs_error;
unsigned int beacons;
unsigned int mib_intr;
unsigned int rxorn_intr;
unsigned int rxeol_intr;
};
#if CHAN_DEBUG
#define ATH_CHAN_MAX (26 + 26 + 26 + 200 + 200)
#else
#define ATH_CHAN_MAX (14 + 14 + 14 + 252 + 20)
#endif
struct ath5k_vif { struct ath5k_vif {
bool assoc; /* are we associated or not */ bool assoc; /* are we associated or not */
enum nl80211_iftype opmode; enum nl80211_iftype opmode;
...@@ -166,104 +68,6 @@ struct ath5k_vif { ...@@ -166,104 +68,6 @@ struct ath5k_vif {
u8 lladdr[ETH_ALEN]; u8 lladdr[ETH_ALEN];
}; };
/* Software Carrier, keeps track of the driver state
* associated with an instance of a device */
struct ath5k_softc {
struct pci_dev *pdev;
struct device *dev; /* for dma mapping */
int irq;
u16 devid;
void __iomem *iobase; /* address of the device */
struct mutex lock; /* dev-level lock */
struct ieee80211_hw *hw; /* IEEE 802.11 common */
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
struct ieee80211_channel channels[ATH_CHAN_MAX];
struct ieee80211_rate rates[IEEE80211_NUM_BANDS][AR5K_MAX_RATES];
s8 rate_idx[IEEE80211_NUM_BANDS][AR5K_MAX_RATES];
enum nl80211_iftype opmode;
struct ath5k_hw *ah; /* Atheros HW */
#ifdef CONFIG_ATH5K_DEBUG
struct ath5k_dbg_info debug; /* debug info */
#endif /* CONFIG_ATH5K_DEBUG */
struct ath5k_buf *bufptr; /* allocated buffer ptr */
struct ath5k_desc *desc; /* TX/RX descriptors */
dma_addr_t desc_daddr; /* DMA (physical) address */
size_t desc_len; /* size of TX/RX descriptors */
DECLARE_BITMAP(status, 6);
#define ATH_STAT_INVALID 0 /* disable hardware accesses */
#define ATH_STAT_MRRETRY 1 /* multi-rate retry support */
#define ATH_STAT_PROMISC 2
#define ATH_STAT_LEDSOFT 3 /* enable LED gpio status */
#define ATH_STAT_STARTED 4 /* opened & irqs enabled */
#define ATH_STAT_2G_DISABLED 5 /* multiband radio without 2G */
unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
struct ieee80211_channel *curchan; /* current h/w channel */
u16 nvifs;
enum ath5k_int imask; /* interrupt mask copy */
spinlock_t irqlock;
bool rx_pending; /* rx tasklet pending */
bool tx_pending; /* tx tasklet pending */
u8 lladdr[ETH_ALEN];
u8 bssidmask[ETH_ALEN];
unsigned int led_pin, /* GPIO pin for driving LED */
led_on; /* pin setting for LED on */
struct work_struct reset_work; /* deferred chip reset */
unsigned int rxbufsize; /* rx size based on mtu */
struct list_head rxbuf; /* receive buffer */
spinlock_t rxbuflock;
u32 *rxlink; /* link ptr in last RX desc */
struct tasklet_struct rxtq; /* rx intr tasklet */
struct ath5k_led rx_led; /* rx led */
struct list_head txbuf; /* transmit buffer */
spinlock_t txbuflock;
unsigned int txbuf_len; /* buf count in txbuf list */
struct ath5k_txq txqs[AR5K_NUM_TX_QUEUES]; /* tx queues */
struct tasklet_struct txtq; /* tx intr tasklet */
struct ath5k_led tx_led; /* tx led */
struct ath5k_rfkill rf_kill;
struct tasklet_struct calib; /* calibration tasklet */
spinlock_t block; /* protects beacon */
struct tasklet_struct beacontq; /* beacon intr tasklet */
struct list_head bcbuf; /* beacon buffer */
struct ieee80211_vif *bslot[ATH_BCBUF];
u16 num_ap_vifs;
u16 num_adhoc_vifs;
unsigned int bhalq, /* SW q for outgoing beacons */
bmisscount, /* missed beacon transmits */
bintval, /* beacon interval in TU */
bsent;
unsigned int nexttbtt; /* next beacon time in TU */
struct ath5k_txq *cabq; /* content after beacon */
int power_level; /* Requested tx power in dBm */
bool assoc; /* associate state */
bool enable_beacon; /* true if beacons are on */
struct ath5k_statistics stats;
struct ath5k_ani_state ani_state;
struct tasklet_struct ani_tasklet; /* ANI calibration */
struct delayed_work tx_complete_work;
struct survey_info survey; /* collected survey info */
};
struct ath5k_vif_iter_data { struct ath5k_vif_iter_data {
const u8 *hw_macaddr; const u8 *hw_macaddr;
u8 mask[ETH_ALEN]; u8 mask[ETH_ALEN];
...@@ -277,9 +81,10 @@ struct ath5k_vif_iter_data { ...@@ -277,9 +81,10 @@ struct ath5k_vif_iter_data {
void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif); void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif);
#define ath5k_hw_hasbssidmask(_ah) \ /* Check whether BSSID mask is supported */
(ath5k_hw_get_capability(_ah, AR5K_CAP_BSSIDMASK, 0, NULL) == 0) #define ath5k_hw_hasbssidmask(_ah) (ah->ah_version == AR5K_AR5212)
#define ath5k_hw_hasveol(_ah) \
(ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0) /* Check whether virtual EOL is supported */
#define ath5k_hw_hasveol(_ah) (ah->ah_version != AR5K_AR5210)
#endif #endif
...@@ -112,51 +112,6 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah) ...@@ -112,51 +112,6 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
return 0; return 0;
} }
/* Main function used by the driver part to check caps */
int ath5k_hw_get_capability(struct ath5k_hw *ah,
enum ath5k_capability_type cap_type,
u32 capability, u32 *result)
{
switch (cap_type) {
case AR5K_CAP_NUM_TXQUEUES:
if (result) {
if (ah->ah_version == AR5K_AR5210)
*result = AR5K_NUM_TX_QUEUES_NOQCU;
else
*result = AR5K_NUM_TX_QUEUES;
goto yes;
}
case AR5K_CAP_VEOL:
goto yes;
case AR5K_CAP_COMPRESSION:
if (ah->ah_version == AR5K_AR5212)
goto yes;
else
goto no;
case AR5K_CAP_BURST:
goto yes;
case AR5K_CAP_TPC:
goto yes;
case AR5K_CAP_BSSIDMASK:
if (ah->ah_version == AR5K_AR5212)
goto yes;
else
goto no;
case AR5K_CAP_XR:
if (ah->ah_version == AR5K_AR5212)
goto yes;
else
goto no;
default:
goto no;
}
no:
return -EINVAL;
yes:
return 0;
}
/* /*
* TODO: Following functions should be part of a new function * TODO: Following functions should be part of a new function
* set_capability * set_capability
......
This diff is collapsed.
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
#ifndef _ATH5K_DEBUG_H #ifndef _ATH5K_DEBUG_H
#define _ATH5K_DEBUG_H #define _ATH5K_DEBUG_H
struct ath5k_softc;
struct ath5k_hw; struct ath5k_hw;
struct sk_buff; struct sk_buff;
struct ath5k_buf; struct ath5k_buf;
...@@ -127,39 +126,39 @@ enum ath5k_debug_level { ...@@ -127,39 +126,39 @@ enum ath5k_debug_level {
} while (0) } while (0)
void void
ath5k_debug_init_device(struct ath5k_softc *sc); ath5k_debug_init_device(struct ath5k_hw *ah);
void void
ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah); ath5k_debug_printrxbuffs(struct ath5k_hw *ah);
void void
ath5k_debug_dump_bands(struct ath5k_softc *sc); ath5k_debug_dump_bands(struct ath5k_hw *ah);
void void
ath5k_debug_printtxbuf(struct ath5k_softc *sc, struct ath5k_buf *bf); ath5k_debug_printtxbuf(struct ath5k_hw *ah, struct ath5k_buf *bf);
#else /* no debugging */ #else /* no debugging */
#include <linux/compiler.h> #include <linux/compiler.h>
static inline void __attribute__ ((format (printf, 3, 4))) static inline void __attribute__ ((format (printf, 3, 4)))
ATH5K_DBG(struct ath5k_softc *sc, unsigned int m, const char *fmt, ...) {} ATH5K_DBG(struct ath5k_hw *ah, unsigned int m, const char *fmt, ...) {}
static inline void __attribute__ ((format (printf, 3, 4))) static inline void __attribute__ ((format (printf, 3, 4)))
ATH5K_DBG_UNLIMIT(struct ath5k_softc *sc, unsigned int m, const char *fmt, ...) ATH5K_DBG_UNLIMIT(struct ath5k_hw *ah, unsigned int m, const char *fmt, ...)
{} {}
static inline void static inline void
ath5k_debug_init_device(struct ath5k_softc *sc) {} ath5k_debug_init_device(struct ath5k_hw *ah) {}
static inline void static inline void
ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah) {} ath5k_debug_printrxbuffs(struct ath5k_hw *ah) {}
static inline void static inline void
ath5k_debug_dump_bands(struct ath5k_softc *sc) {} ath5k_debug_dump_bands(struct ath5k_hw *ah) {}
static inline void static inline void
ath5k_debug_printtxbuf(struct ath5k_softc *sc, struct ath5k_buf *bf) {} ath5k_debug_printtxbuf(struct ath5k_hw *ah, struct ath5k_buf *bf) {}
#endif /* ifdef CONFIG_ATH5K_DEBUG */ #endif /* ifdef CONFIG_ATH5K_DEBUG */
......
...@@ -55,12 +55,12 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc, ...@@ -55,12 +55,12 @@ ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
* noise on the channel, so it is important to avoid this. * noise on the channel, so it is important to avoid this.
*/ */
if (unlikely(tx_tries0 == 0)) { if (unlikely(tx_tries0 == 0)) {
ATH5K_ERR(ah->ah_sc, "zero retries\n"); ATH5K_ERR(ah, "zero retries\n");
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
if (unlikely(tx_rate0 == 0)) { if (unlikely(tx_rate0 == 0)) {
ATH5K_ERR(ah->ah_sc, "zero rate\n"); ATH5K_ERR(ah, "zero rate\n");
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
...@@ -203,12 +203,12 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah, ...@@ -203,12 +203,12 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
* noise on the channel, so it is important to avoid this. * noise on the channel, so it is important to avoid this.
*/ */
if (unlikely(tx_tries0 == 0)) { if (unlikely(tx_tries0 == 0)) {
ATH5K_ERR(ah->ah_sc, "zero retries\n"); ATH5K_ERR(ah, "zero retries\n");
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
if (unlikely(tx_rate0 == 0)) { if (unlikely(tx_rate0 == 0)) {
ATH5K_ERR(ah->ah_sc, "zero rate\n"); ATH5K_ERR(ah, "zero rate\n");
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
...@@ -316,7 +316,7 @@ ath5k_hw_setup_mrr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc, ...@@ -316,7 +316,7 @@ ath5k_hw_setup_mrr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
if (unlikely((tx_rate1 == 0 && tx_tries1 != 0) || if (unlikely((tx_rate1 == 0 && tx_tries1 != 0) ||
(tx_rate2 == 0 && tx_tries2 != 0) || (tx_rate2 == 0 && tx_tries2 != 0) ||
(tx_rate3 == 0 && tx_tries3 != 0))) { (tx_rate3 == 0 && tx_tries3 != 0))) {
ATH5K_ERR(ah->ah_sc, "zero rate\n"); ATH5K_ERR(ah, "zero rate\n");
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
} }
......
...@@ -73,7 +73,7 @@ static int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah) ...@@ -73,7 +73,7 @@ static int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah)
udelay(100); udelay(100);
if (!i) if (!i)
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, ATH5K_DBG(ah, ATH5K_DEBUG_DMA,
"failed to stop RX DMA !\n"); "failed to stop RX DMA !\n");
return i ? 0 : -EBUSY; return i ? 0 : -EBUSY;
...@@ -100,7 +100,7 @@ u32 ath5k_hw_get_rxdp(struct ath5k_hw *ah) ...@@ -100,7 +100,7 @@ u32 ath5k_hw_get_rxdp(struct ath5k_hw *ah)
int ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr) int ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr)
{ {
if (ath5k_hw_reg_read(ah, AR5K_CR) & AR5K_CR_RXE) { if (ath5k_hw_reg_read(ah, AR5K_CR) & AR5K_CR_RXE) {
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, ATH5K_DBG(ah, ATH5K_DEBUG_DMA,
"tried to set RXDP while rx was active !\n"); "tried to set RXDP while rx was active !\n");
return -EIO; return -EIO;
} }
...@@ -243,7 +243,7 @@ static int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue) ...@@ -243,7 +243,7 @@ static int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
udelay(100); udelay(100);
if (AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue)) if (AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue))
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, ATH5K_DBG(ah, ATH5K_DEBUG_DMA,
"queue %i didn't stop !\n", queue); "queue %i didn't stop !\n", queue);
/* Check for pending frames */ /* Check for pending frames */
...@@ -295,7 +295,7 @@ static int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue) ...@@ -295,7 +295,7 @@ static int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
AR5K_DIAG_SW_CHANNEL_IDLE_HIGH); AR5K_DIAG_SW_CHANNEL_IDLE_HIGH);
if (pending) if (pending)
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, ATH5K_DBG(ah, ATH5K_DEBUG_DMA,
"quiet mechanism didn't work q:%i !\n", "quiet mechanism didn't work q:%i !\n",
queue); queue);
} }
...@@ -309,7 +309,7 @@ static int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue) ...@@ -309,7 +309,7 @@ static int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
/* Clear register */ /* Clear register */
ath5k_hw_reg_write(ah, 0, AR5K_QCU_TXD); ath5k_hw_reg_write(ah, 0, AR5K_QCU_TXD);
if (pending) { if (pending) {
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, ATH5K_DBG(ah, ATH5K_DEBUG_DMA,
"tx dma didn't stop (q:%i, frm:%i) !\n", "tx dma didn't stop (q:%i, frm:%i) !\n",
queue, pending); queue, pending);
return -EBUSY; return -EBUSY;
...@@ -333,7 +333,7 @@ int ath5k_hw_stop_beacon_queue(struct ath5k_hw *ah, unsigned int queue) ...@@ -333,7 +333,7 @@ int ath5k_hw_stop_beacon_queue(struct ath5k_hw *ah, unsigned int queue)
int ret; int ret;
ret = ath5k_hw_stop_tx_dma(ah, queue); ret = ath5k_hw_stop_tx_dma(ah, queue);
if (ret) { if (ret) {
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, ATH5K_DBG(ah, ATH5K_DEBUG_DMA,
"beacon queue didn't stop !\n"); "beacon queue didn't stop !\n");
return -EIO; return -EIO;
} }
......
...@@ -105,7 +105,7 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah) ...@@ -105,7 +105,7 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
* big still, waiting on a better value. * big still, waiting on a better value.
*/ */
if (eep_max > (3 * AR5K_EEPROM_INFO_MAX)) { if (eep_max > (3 * AR5K_EEPROM_INFO_MAX)) {
ATH5K_ERR(ah->ah_sc, "Invalid max custom EEPROM size: " ATH5K_ERR(ah, "Invalid max custom EEPROM size: "
"%d (0x%04x) max expected: %d (0x%04x)\n", "%d (0x%04x) max expected: %d (0x%04x)\n",
eep_max, eep_max, eep_max, eep_max,
3 * AR5K_EEPROM_INFO_MAX, 3 * AR5K_EEPROM_INFO_MAX,
...@@ -119,7 +119,7 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah) ...@@ -119,7 +119,7 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
cksum ^= val; cksum ^= val;
} }
if (cksum != AR5K_EEPROM_INFO_CKSUM) { if (cksum != AR5K_EEPROM_INFO_CKSUM) {
ATH5K_ERR(ah->ah_sc, "Invalid EEPROM " ATH5K_ERR(ah, "Invalid EEPROM "
"checksum: 0x%04x eep_max: 0x%04x (%s)\n", "checksum: 0x%04x eep_max: 0x%04x (%s)\n",
cksum, eep_max, cksum, eep_max,
eep_max == AR5K_EEPROM_INFO_MAX ? eep_max == AR5K_EEPROM_INFO_MAX ?
......
...@@ -1542,7 +1542,7 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool skip_pcu) ...@@ -1542,7 +1542,7 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool skip_pcu)
/* AR5K_MODE_11B */ /* AR5K_MODE_11B */
if (mode > 2) { if (mode > 2) {
ATH5K_ERR(ah->ah_sc, ATH5K_ERR(ah,
"unsupported channel mode: %d\n", mode); "unsupported channel mode: %d\n", mode);
return -EINVAL; return -EINVAL;
} }
......
...@@ -86,26 +86,26 @@ static DEFINE_PCI_DEVICE_TABLE(ath5k_led_devices) = { ...@@ -86,26 +86,26 @@ static DEFINE_PCI_DEVICE_TABLE(ath5k_led_devices) = {
{ } { }
}; };
void ath5k_led_enable(struct ath5k_softc *sc) void ath5k_led_enable(struct ath5k_hw *ah)
{ {
if (test_bit(ATH_STAT_LEDSOFT, sc->status)) { if (test_bit(ATH_STAT_LEDSOFT, ah->status)) {
ath5k_hw_set_gpio_output(sc->ah, sc->led_pin); ath5k_hw_set_gpio_output(ah, ah->led_pin);
ath5k_led_off(sc); ath5k_led_off(ah);
} }
} }
static void ath5k_led_on(struct ath5k_softc *sc) static void ath5k_led_on(struct ath5k_hw *ah)
{ {
if (!test_bit(ATH_STAT_LEDSOFT, sc->status)) if (!test_bit(ATH_STAT_LEDSOFT, ah->status))
return; return;
ath5k_hw_set_gpio(sc->ah, sc->led_pin, sc->led_on); ath5k_hw_set_gpio(ah, ah->led_pin, ah->led_on);
} }
void ath5k_led_off(struct ath5k_softc *sc) void ath5k_led_off(struct ath5k_hw *ah)
{ {
if (!test_bit(ATH_STAT_LEDSOFT, sc->status)) if (!test_bit(ATH_STAT_LEDSOFT, ah->status))
return; return;
ath5k_hw_set_gpio(sc->ah, sc->led_pin, !sc->led_on); ath5k_hw_set_gpio(ah, ah->led_pin, !ah->led_on);
} }
static void static void
...@@ -116,27 +116,27 @@ ath5k_led_brightness_set(struct led_classdev *led_dev, ...@@ -116,27 +116,27 @@ ath5k_led_brightness_set(struct led_classdev *led_dev,
led_dev); led_dev);
if (brightness == LED_OFF) if (brightness == LED_OFF)
ath5k_led_off(led->sc); ath5k_led_off(led->ah);
else else
ath5k_led_on(led->sc); ath5k_led_on(led->ah);
} }
static int static int
ath5k_register_led(struct ath5k_softc *sc, struct ath5k_led *led, ath5k_register_led(struct ath5k_hw *ah, struct ath5k_led *led,
const char *name, char *trigger) const char *name, char *trigger)
{ {
int err; int err;
led->sc = sc; led->ah = ah;
strncpy(led->name, name, sizeof(led->name)); strncpy(led->name, name, sizeof(led->name));
led->led_dev.name = led->name; led->led_dev.name = led->name;
led->led_dev.default_trigger = trigger; led->led_dev.default_trigger = trigger;
led->led_dev.brightness_set = ath5k_led_brightness_set; led->led_dev.brightness_set = ath5k_led_brightness_set;
err = led_classdev_register(sc->dev, &led->led_dev); err = led_classdev_register(ah->dev, &led->led_dev);
if (err) { if (err) {
ATH5K_WARN(sc, "could not register LED %s\n", name); ATH5K_WARN(ah, "could not register LED %s\n", name);
led->sc = NULL; led->ah = NULL;
} }
return err; return err;
} }
...@@ -144,30 +144,30 @@ ath5k_register_led(struct ath5k_softc *sc, struct ath5k_led *led, ...@@ -144,30 +144,30 @@ ath5k_register_led(struct ath5k_softc *sc, struct ath5k_led *led,
static void static void
ath5k_unregister_led(struct ath5k_led *led) ath5k_unregister_led(struct ath5k_led *led)
{ {
if (!led->sc) if (!led->ah)
return; return;
led_classdev_unregister(&led->led_dev); led_classdev_unregister(&led->led_dev);
ath5k_led_off(led->sc); ath5k_led_off(led->ah);
led->sc = NULL; led->ah = NULL;
} }
void ath5k_unregister_leds(struct ath5k_softc *sc) void ath5k_unregister_leds(struct ath5k_hw *ah)
{ {
ath5k_unregister_led(&sc->rx_led); ath5k_unregister_led(&ah->rx_led);
ath5k_unregister_led(&sc->tx_led); ath5k_unregister_led(&ah->tx_led);
} }
int __devinit ath5k_init_leds(struct ath5k_softc *sc) int __devinit ath5k_init_leds(struct ath5k_hw *ah)
{ {
int ret = 0; int ret = 0;
struct ieee80211_hw *hw = sc->hw; struct ieee80211_hw *hw = ah->hw;
#ifndef CONFIG_ATHEROS_AR231X #ifndef CONFIG_ATHEROS_AR231X
struct pci_dev *pdev = sc->pdev; struct pci_dev *pdev = ah->pdev;
#endif #endif
char name[ATH5K_LED_MAX_NAME_LEN + 1]; char name[ATH5K_LED_MAX_NAME_LEN + 1];
const struct pci_device_id *match; const struct pci_device_id *match;
if (!sc->pdev) if (!ah->pdev)
return 0; return 0;
#ifdef CONFIG_ATHEROS_AR231X #ifdef CONFIG_ATHEROS_AR231X
...@@ -176,24 +176,24 @@ int __devinit ath5k_init_leds(struct ath5k_softc *sc) ...@@ -176,24 +176,24 @@ int __devinit ath5k_init_leds(struct ath5k_softc *sc)
match = pci_match_id(&ath5k_led_devices[0], pdev); match = pci_match_id(&ath5k_led_devices[0], pdev);
#endif #endif
if (match) { if (match) {
__set_bit(ATH_STAT_LEDSOFT, sc->status); __set_bit(ATH_STAT_LEDSOFT, ah->status);
sc->led_pin = ATH_PIN(match->driver_data); ah->led_pin = ATH_PIN(match->driver_data);
sc->led_on = ATH_POLARITY(match->driver_data); ah->led_on = ATH_POLARITY(match->driver_data);
} }
if (!test_bit(ATH_STAT_LEDSOFT, sc->status)) if (!test_bit(ATH_STAT_LEDSOFT, ah->status))
goto out; goto out;
ath5k_led_enable(sc); ath5k_led_enable(ah);
snprintf(name, sizeof(name), "ath5k-%s::rx", wiphy_name(hw->wiphy)); snprintf(name, sizeof(name), "ath5k-%s::rx", wiphy_name(hw->wiphy));
ret = ath5k_register_led(sc, &sc->rx_led, name, ret = ath5k_register_led(ah, &ah->rx_led, name,
ieee80211_get_rx_led_name(hw)); ieee80211_get_rx_led_name(hw));
if (ret) if (ret)
goto out; goto out;
snprintf(name, sizeof(name), "ath5k-%s::tx", wiphy_name(hw->wiphy)); snprintf(name, sizeof(name), "ath5k-%s::tx", wiphy_name(hw->wiphy));
ret = ath5k_register_led(sc, &sc->tx_led, name, ret = ath5k_register_led(ah, &ah->tx_led, name,
ieee80211_get_tx_led_name(hw)); ieee80211_get_tx_led_name(hw));
out: out:
return ret; return ret;
......
...@@ -51,10 +51,10 @@ MODULE_DEVICE_TABLE(pci, ath5k_pci_id_table); ...@@ -51,10 +51,10 @@ MODULE_DEVICE_TABLE(pci, ath5k_pci_id_table);
/* return bus cachesize in 4B word units */ /* return bus cachesize in 4B word units */
static void ath5k_pci_read_cachesize(struct ath_common *common, int *csz) static void ath5k_pci_read_cachesize(struct ath_common *common, int *csz)
{ {
struct ath5k_softc *sc = (struct ath5k_softc *) common->priv; struct ath5k_hw *ah = (struct ath5k_hw *) common->priv;
u8 u8tmp; u8 u8tmp;
pci_read_config_byte(sc->pdev, PCI_CACHE_LINE_SIZE, &u8tmp); pci_read_config_byte(ah->pdev, PCI_CACHE_LINE_SIZE, &u8tmp);
*csz = (int)u8tmp; *csz = (int)u8tmp;
/* /*
...@@ -156,7 +156,7 @@ ath5k_pci_probe(struct pci_dev *pdev, ...@@ -156,7 +156,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id) const struct pci_device_id *id)
{ {
void __iomem *mem; void __iomem *mem;
struct ath5k_softc *sc; struct ath5k_hw *ah;
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
int ret; int ret;
u8 csz; u8 csz;
...@@ -243,7 +243,7 @@ ath5k_pci_probe(struct pci_dev *pdev, ...@@ -243,7 +243,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
* Allocate hw (mac80211 main struct) * Allocate hw (mac80211 main struct)
* and hw->priv (driver private data) * and hw->priv (driver private data)
*/ */
hw = ieee80211_alloc_hw(sizeof(*sc), &ath5k_hw_ops); hw = ieee80211_alloc_hw(sizeof(*ah), &ath5k_hw_ops);
if (hw == NULL) { if (hw == NULL) {
dev_err(&pdev->dev, "cannot allocate ieee80211_hw\n"); dev_err(&pdev->dev, "cannot allocate ieee80211_hw\n");
ret = -ENOMEM; ret = -ENOMEM;
...@@ -252,16 +252,16 @@ ath5k_pci_probe(struct pci_dev *pdev, ...@@ -252,16 +252,16 @@ ath5k_pci_probe(struct pci_dev *pdev,
dev_info(&pdev->dev, "registered as '%s'\n", wiphy_name(hw->wiphy)); dev_info(&pdev->dev, "registered as '%s'\n", wiphy_name(hw->wiphy));
sc = hw->priv; ah = hw->priv;
sc->hw = hw; ah->hw = hw;
sc->pdev = pdev; ah->pdev = pdev;
sc->dev = &pdev->dev; ah->dev = &pdev->dev;
sc->irq = pdev->irq; ah->irq = pdev->irq;
sc->devid = id->device; ah->devid = id->device;
sc->iobase = mem; /* So we can unmap it on detach */ ah->iobase = mem; /* So we can unmap it on detach */
/* Initialize */ /* Initialize */
ret = ath5k_init_softc(sc, &ath_pci_bus_ops); ret = ath5k_init_softc(ah, &ath_pci_bus_ops);
if (ret) if (ret)
goto err_free; goto err_free;
...@@ -285,10 +285,10 @@ static void __devexit ...@@ -285,10 +285,10 @@ static void __devexit
ath5k_pci_remove(struct pci_dev *pdev) ath5k_pci_remove(struct pci_dev *pdev)
{ {
struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct ieee80211_hw *hw = pci_get_drvdata(pdev);
struct ath5k_softc *sc = hw->priv; struct ath5k_hw *ah = hw->priv;
ath5k_deinit_softc(sc); ath5k_deinit_softc(ah);
pci_iounmap(pdev, sc->iobase); pci_iounmap(pdev, ah->iobase);
pci_release_region(pdev, 0); pci_release_region(pdev, 0);
pci_disable_device(pdev); pci_disable_device(pdev);
ieee80211_free_hw(hw); ieee80211_free_hw(hw);
...@@ -299,9 +299,9 @@ static int ath5k_pci_suspend(struct device *dev) ...@@ -299,9 +299,9 @@ static int ath5k_pci_suspend(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); 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_hw *ah = hw->priv;
ath5k_led_off(sc); ath5k_led_off(ah);
return 0; return 0;
} }
...@@ -309,7 +309,7 @@ static int ath5k_pci_resume(struct device *dev) ...@@ -309,7 +309,7 @@ static int ath5k_pci_resume(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); 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_hw *ah = hw->priv;
/* /*
* Suspend/Resume resets the PCI configuration space, so we have to * Suspend/Resume resets the PCI configuration space, so we have to
...@@ -318,7 +318,7 @@ static int ath5k_pci_resume(struct device *dev) ...@@ -318,7 +318,7 @@ static int ath5k_pci_resume(struct device *dev)
*/ */
pci_write_config_byte(pdev, 0x41, 0); pci_write_config_byte(pdev, 0x41, 0);
ath5k_led_enable(sc); ath5k_led_enable(ah);
return 0; return 0;
} }
......
...@@ -77,14 +77,13 @@ static const unsigned int ack_rates_high[] = ...@@ -77,14 +77,13 @@ static const unsigned int ack_rates_high[] =
int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, int ath5k_hw_get_frame_duration(struct ath5k_hw *ah,
int len, struct ieee80211_rate *rate, bool shortpre) int len, struct ieee80211_rate *rate, bool shortpre)
{ {
struct ath5k_softc *sc = ah->ah_sc;
int sifs, preamble, plcp_bits, sym_time; int sifs, preamble, plcp_bits, sym_time;
int bitrate, bits, symbols, symbol_bits; int bitrate, bits, symbols, symbol_bits;
int dur; int dur;
/* Fallback */ /* Fallback */
if (!ah->ah_bwmode) { if (!ah->ah_bwmode) {
__le16 raw_dur = ieee80211_generic_frame_duration(sc->hw, __le16 raw_dur = ieee80211_generic_frame_duration(ah->hw,
NULL, len, rate); NULL, len, rate);
/* subtract difference between long and short preamble */ /* subtract difference between long and short preamble */
...@@ -205,7 +204,7 @@ unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah) ...@@ -205,7 +204,7 @@ unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah)
*/ */
void ath5k_hw_update_mib_counters(struct ath5k_hw *ah) void ath5k_hw_update_mib_counters(struct ath5k_hw *ah)
{ {
struct ath5k_statistics *stats = &ah->ah_sc->stats; struct ath5k_statistics *stats = &ah->stats;
/* Read-And-Clear */ /* Read-And-Clear */
stats->ack_fail += ath5k_hw_reg_read(ah, AR5K_ACK_FAIL); stats->ack_fail += ath5k_hw_reg_read(ah, AR5K_ACK_FAIL);
...@@ -240,25 +239,24 @@ void ath5k_hw_update_mib_counters(struct ath5k_hw *ah) ...@@ -240,25 +239,24 @@ void ath5k_hw_update_mib_counters(struct ath5k_hw *ah)
*/ */
static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah) static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah)
{ {
struct ath5k_softc *sc = ah->ah_sc;
struct ieee80211_rate *rate; struct ieee80211_rate *rate;
unsigned int i; unsigned int i;
/* 802.11g covers both OFDM and CCK */ /* 802.11g covers both OFDM and CCK */
u8 band = IEEE80211_BAND_2GHZ; u8 band = IEEE80211_BAND_2GHZ;
/* Write rate duration table */ /* Write rate duration table */
for (i = 0; i < sc->sbands[band].n_bitrates; i++) { for (i = 0; i < ah->sbands[band].n_bitrates; i++) {
u32 reg; u32 reg;
u16 tx_time; u16 tx_time;
if (ah->ah_ack_bitrate_high) if (ah->ah_ack_bitrate_high)
rate = &sc->sbands[band].bitrates[ack_rates_high[i]]; rate = &ah->sbands[band].bitrates[ack_rates_high[i]];
/* CCK -> 1Mb */ /* CCK -> 1Mb */
else if (i < 4) else if (i < 4)
rate = &sc->sbands[band].bitrates[0]; rate = &ah->sbands[band].bitrates[0];
/* OFDM -> 6Mb */ /* OFDM -> 6Mb */
else else
rate = &sc->sbands[band].bitrates[4]; rate = &ah->sbands[band].bitrates[4];
/* Set ACK timeout */ /* Set ACK timeout */
reg = AR5K_RATE_DUR(rate->hw_value); reg = AR5K_RATE_DUR(rate->hw_value);
...@@ -586,7 +584,7 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval) ...@@ -586,7 +584,7 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)
/* /*
* Set the additional timers by mode * Set the additional timers by mode
*/ */
switch (ah->ah_sc->opmode) { switch (ah->opmode) {
case NL80211_IFTYPE_MONITOR: case NL80211_IFTYPE_MONITOR:
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
/* In STA mode timer1 is used as next wakeup /* In STA mode timer1 is used as next wakeup
...@@ -623,8 +621,8 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval) ...@@ -623,8 +621,8 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)
* Set the beacon register and enable all timers. * Set the beacon register and enable all timers.
*/ */
/* When in AP or Mesh Point mode zero timer0 to start TSF */ /* When in AP or Mesh Point mode zero timer0 to start TSF */
if (ah->ah_sc->opmode == NL80211_IFTYPE_AP || if (ah->opmode == NL80211_IFTYPE_AP ||
ah->ah_sc->opmode == NL80211_IFTYPE_MESH_POINT) ah->opmode == NL80211_IFTYPE_MESH_POINT)
ath5k_hw_reg_write(ah, 0, AR5K_TIMER0); ath5k_hw_reg_write(ah, 0, AR5K_TIMER0);
ath5k_hw_reg_write(ah, next_beacon, AR5K_TIMER0); ath5k_hw_reg_write(ah, next_beacon, AR5K_TIMER0);
...@@ -814,7 +812,7 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype op_mode) ...@@ -814,7 +812,7 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype op_mode)
struct ath_common *common = ath5k_hw_common(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;
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_MODE, "mode %d\n", op_mode); ATH5K_DBG(ah, ATH5K_DEBUG_MODE, "mode %d\n", op_mode);
/* Preserve rest settings */ /* Preserve rest settings */
pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000;
...@@ -890,7 +888,7 @@ void ath5k_hw_pcu_init(struct ath5k_hw *ah, enum nl80211_iftype op_mode, ...@@ -890,7 +888,7 @@ void ath5k_hw_pcu_init(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
* XXX: rethink this after new mode changes to * XXX: rethink this after new mode changes to
* mac80211 are integrated */ * mac80211 are integrated */
if (ah->ah_version == AR5K_AR5212 && if (ah->ah_version == AR5K_AR5212 &&
ah->ah_sc->nvifs) ah->nvifs)
ath5k_hw_write_rate_duration(ah); ath5k_hw_write_rate_duration(ah);
/* Set RSSI/BRSSI thresholds /* Set RSSI/BRSSI thresholds
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <asm/unaligned.h>
#include "ath5k.h" #include "ath5k.h"
#include "reg.h" #include "reg.h"
...@@ -561,7 +562,7 @@ static s8 ath5k_hw_rf_gainf_adjust(struct ath5k_hw *ah) ...@@ -561,7 +562,7 @@ static s8 ath5k_hw_rf_gainf_adjust(struct ath5k_hw *ah)
} }
done: done:
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_CALIBRATE, ATH5K_DBG(ah, ATH5K_DEBUG_CALIBRATE,
"ret %d, gain step %u, current gain %u, target gain %u\n", "ret %d, gain step %u, current gain %u, target gain %u\n",
ret, ah->ah_gain.g_step_idx, ah->ah_gain.g_current, ret, ah->ah_gain.g_step_idx, ah->ah_gain.g_current,
ah->ah_gain.g_target); ah->ah_gain.g_target);
...@@ -773,7 +774,7 @@ static int ath5k_hw_rfregs_init(struct ath5k_hw *ah, ...@@ -773,7 +774,7 @@ static int ath5k_hw_rfregs_init(struct ath5k_hw *ah,
ah->ah_rf_banks = kmalloc(sizeof(u32) * ah->ah_rf_banks_size, ah->ah_rf_banks = kmalloc(sizeof(u32) * ah->ah_rf_banks_size,
GFP_KERNEL); GFP_KERNEL);
if (ah->ah_rf_banks == NULL) { if (ah->ah_rf_banks == NULL) {
ATH5K_ERR(ah->ah_sc, "out of memory\n"); ATH5K_ERR(ah, "out of memory\n");
return -ENOMEM; return -ENOMEM;
} }
} }
...@@ -783,7 +784,7 @@ static int ath5k_hw_rfregs_init(struct ath5k_hw *ah, ...@@ -783,7 +784,7 @@ static int ath5k_hw_rfregs_init(struct ath5k_hw *ah,
for (i = 0; i < ah->ah_rf_banks_size; i++) { for (i = 0; i < ah->ah_rf_banks_size; i++) {
if (ini_rfb[i].rfb_bank >= AR5K_MAX_RF_BANKS) { if (ini_rfb[i].rfb_bank >= AR5K_MAX_RF_BANKS) {
ATH5K_ERR(ah->ah_sc, "invalid bank\n"); ATH5K_ERR(ah, "invalid bank\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1268,7 +1269,7 @@ static int ath5k_hw_channel(struct ath5k_hw *ah, ...@@ -1268,7 +1269,7 @@ static int ath5k_hw_channel(struct ath5k_hw *ah,
* (CHANNEL_2GHZ, or CHANNEL_5GHZ) so we inform ath5k_channel_ok() * (CHANNEL_2GHZ, or CHANNEL_5GHZ) so we inform ath5k_channel_ok()
* of the band by that */ * of the band by that */
if (!ath5k_channel_ok(ah, channel->center_freq, channel->hw_value)) { if (!ath5k_channel_ok(ah, channel->center_freq, channel->hw_value)) {
ATH5K_ERR(ah->ah_sc, ATH5K_ERR(ah,
"channel frequency (%u MHz) out of supported " "channel frequency (%u MHz) out of supported "
"band range\n", "band range\n",
channel->center_freq); channel->center_freq);
...@@ -1356,7 +1357,7 @@ static s16 ath5k_hw_get_median_noise_floor(struct ath5k_hw *ah) ...@@ -1356,7 +1357,7 @@ static s16 ath5k_hw_get_median_noise_floor(struct ath5k_hw *ah)
} }
} }
for (i = 0; i < ATH5K_NF_CAL_HIST_MAX; i++) { for (i = 0; i < ATH5K_NF_CAL_HIST_MAX; i++) {
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_CALIBRATE, ATH5K_DBG(ah, ATH5K_DEBUG_CALIBRATE,
"cal %d:%d\n", i, sort[i]); "cal %d:%d\n", i, sort[i]);
} }
return sort[(ATH5K_NF_CAL_HIST_MAX - 1) / 2]; return sort[(ATH5K_NF_CAL_HIST_MAX - 1) / 2];
...@@ -1382,7 +1383,7 @@ void ath5k_hw_update_noise_floor(struct ath5k_hw *ah) ...@@ -1382,7 +1383,7 @@ void ath5k_hw_update_noise_floor(struct ath5k_hw *ah)
/* keep last value if calibration hasn't completed */ /* keep last value if calibration hasn't completed */
if (ath5k_hw_reg_read(ah, AR5K_PHY_AGCCTL) & AR5K_PHY_AGCCTL_NF) { if (ath5k_hw_reg_read(ah, AR5K_PHY_AGCCTL) & AR5K_PHY_AGCCTL_NF) {
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_CALIBRATE, ATH5K_DBG(ah, ATH5K_DEBUG_CALIBRATE,
"NF did not complete in calibration window\n"); "NF did not complete in calibration window\n");
return; return;
...@@ -1395,7 +1396,7 @@ void ath5k_hw_update_noise_floor(struct ath5k_hw *ah) ...@@ -1395,7 +1396,7 @@ void ath5k_hw_update_noise_floor(struct ath5k_hw *ah)
threshold = ee->ee_noise_floor_thr[ee_mode]; threshold = ee->ee_noise_floor_thr[ee_mode];
if (nf > threshold) { if (nf > threshold) {
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_CALIBRATE, ATH5K_DBG(ah, ATH5K_DEBUG_CALIBRATE,
"noise floor failure detected; " "noise floor failure detected; "
"read %d, threshold %d\n", "read %d, threshold %d\n",
nf, threshold); nf, threshold);
...@@ -1432,7 +1433,7 @@ void ath5k_hw_update_noise_floor(struct ath5k_hw *ah) ...@@ -1432,7 +1433,7 @@ void ath5k_hw_update_noise_floor(struct ath5k_hw *ah)
ah->ah_noise_floor = nf; ah->ah_noise_floor = nf;
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_CALIBRATE, ATH5K_DBG(ah, ATH5K_DEBUG_CALIBRATE,
"noise floor calibrated: %d\n", nf); "noise floor calibrated: %d\n", nf);
} }
...@@ -1520,7 +1521,7 @@ static int ath5k_hw_rf5110_calibrate(struct ath5k_hw *ah, ...@@ -1520,7 +1521,7 @@ static int ath5k_hw_rf5110_calibrate(struct ath5k_hw *ah,
ath5k_hw_reg_write(ah, phy_sat, AR5K_PHY_ADCSAT); ath5k_hw_reg_write(ah, phy_sat, AR5K_PHY_ADCSAT);
if (ret) { if (ret) {
ATH5K_ERR(ah->ah_sc, "calibration timeout (%uMHz)\n", ATH5K_ERR(ah, "calibration timeout (%uMHz)\n",
channel->center_freq); channel->center_freq);
return ret; return ret;
} }
...@@ -1555,7 +1556,7 @@ ath5k_hw_rf511x_iq_calibrate(struct ath5k_hw *ah) ...@@ -1555,7 +1556,7 @@ ath5k_hw_rf511x_iq_calibrate(struct ath5k_hw *ah)
iq_corr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_CORR); iq_corr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_CORR);
i_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_I); i_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_I);
q_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_Q); q_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_Q);
ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_CALIBRATE, ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_CALIBRATE,
"iq_corr:%x i_pwr:%x q_pwr:%x", iq_corr, i_pwr, q_pwr); "iq_corr:%x i_pwr:%x q_pwr:%x", iq_corr, i_pwr, q_pwr);
if (i_pwr && q_pwr) if (i_pwr && q_pwr)
break; break;
...@@ -1581,7 +1582,7 @@ ath5k_hw_rf511x_iq_calibrate(struct ath5k_hw *ah) ...@@ -1581,7 +1582,7 @@ ath5k_hw_rf511x_iq_calibrate(struct ath5k_hw *ah)
q_coff = (i_pwr / q_coffd) - 128; q_coff = (i_pwr / q_coffd) - 128;
q_coff = clamp(q_coff, -16, 15); /* signed 5 bit */ q_coff = clamp(q_coff, -16, 15); /* signed 5 bit */
ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_CALIBRATE, ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_CALIBRATE,
"new I:%d Q:%d (i_coffd:%x q_coffd:%x)", "new I:%d Q:%d (i_coffd:%x q_coffd:%x)",
i_coff, q_coff, i_coffd, q_coffd); i_coff, q_coff, i_coffd, q_coffd);
...@@ -1966,7 +1967,7 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode) ...@@ -1966,7 +1967,7 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode)
ee_mode = ath5k_eeprom_mode_from_channel(channel); ee_mode = ath5k_eeprom_mode_from_channel(channel);
if (ee_mode < 0) { if (ee_mode < 0) {
ATH5K_ERR(ah->ah_sc, ATH5K_ERR(ah,
"invalid channel: %d\n", channel->center_freq); "invalid channel: %d\n", channel->center_freq);
return; return;
} }
...@@ -2794,12 +2795,8 @@ ath5k_write_pwr_to_pdadc_table(struct ath5k_hw *ah, u8 ee_mode) ...@@ -2794,12 +2795,8 @@ ath5k_write_pwr_to_pdadc_table(struct ath5k_hw *ah, u8 ee_mode)
* Write TX power values * Write TX power values
*/ */
for (i = 0; i < (AR5K_EEPROM_POWER_TABLE_SIZE / 2); i++) { for (i = 0; i < (AR5K_EEPROM_POWER_TABLE_SIZE / 2); i++) {
ath5k_hw_reg_write(ah, u32 val = get_unaligned_le32(&pdadc_out[4 * i]);
((pdadc_out[4 * i + 0] & 0xff) << 0) | ath5k_hw_reg_write(ah, val, AR5K_PHY_PDADC_TXPOWER(i));
((pdadc_out[4 * i + 1] & 0xff) << 8) |
((pdadc_out[4 * i + 2] & 0xff) << 16) |
((pdadc_out[4 * i + 3] & 0xff) << 24),
AR5K_PHY_PDADC_TXPOWER(i));
} }
} }
...@@ -3122,13 +3119,13 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, ...@@ -3122,13 +3119,13 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
int ret; int ret;
if (txpower > AR5K_TUNE_MAX_TXPOWER) { if (txpower > AR5K_TUNE_MAX_TXPOWER) {
ATH5K_ERR(ah->ah_sc, "invalid tx power: %u\n", txpower); ATH5K_ERR(ah, "invalid tx power: %u\n", txpower);
return -EINVAL; return -EINVAL;
} }
ee_mode = ath5k_eeprom_mode_from_channel(channel); ee_mode = ath5k_eeprom_mode_from_channel(channel);
if (ee_mode < 0) { if (ee_mode < 0) {
ATH5K_ERR(ah->ah_sc, ATH5K_ERR(ah,
"invalid channel: %d\n", channel->center_freq); "invalid channel: %d\n", channel->center_freq);
return -EINVAL; return -EINVAL;
} }
...@@ -3229,7 +3226,7 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, ...@@ -3229,7 +3226,7 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower) int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower)
{ {
ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_TXPOWER, ATH5K_DBG(ah, ATH5K_DEBUG_TXPOWER,
"changing txpower to %d\n", txpower); "changing txpower to %d\n", txpower);
return ath5k_hw_txpower(ah, ah->ah_current_channel, txpower); return ath5k_hw_txpower(ah, ah->ah_current_channel, txpower);
...@@ -3440,7 +3437,7 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, ...@@ -3440,7 +3437,7 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
* during ath5k_phy_calibrate) */ * during ath5k_phy_calibrate) */
if (ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL, if (ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL,
AR5K_PHY_AGCCTL_CAL, 0, false)) { AR5K_PHY_AGCCTL_CAL, 0, false)) {
ATH5K_ERR(ah->ah_sc, "gain calibration timeout (%uMHz)\n", ATH5K_ERR(ah, "gain calibration timeout (%uMHz)\n",
channel->center_freq); channel->center_freq);
} }
......
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.
...@@ -623,11 +623,8 @@ static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, ...@@ -623,11 +623,8 @@ static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf,
pBase9287->openLoopPwrCntl); pBase9287->openLoopPwrCntl);
} }
len += snprintf(buf + len, size - len, len += snprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress",
"%20s : %02X:%02X:%02X:%02X:%02X:%02X\n", pBase->macAddr);
"MacAddress",
pBase->macAddr[0], pBase->macAddr[1], pBase->macAddr[2],
pBase->macAddr[3], pBase->macAddr[4], pBase->macAddr[5]);
if (len > size) if (len > size)
len = size; len = size;
......
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.
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