Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 224621
b: refs/heads/master
c: a05b5d4
h: refs/heads/master
i:
  224619: a0e6ace
v: v3
  • Loading branch information
Felix Fietkau authored and John W. Linville committed Nov 18, 2010
1 parent 94cc67a commit 4e81b81
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 458fafdd579dcb58c8288c55c9cd92d6816ba094
refs/heads/master: a05b5d45049d60a06a1b12976150572304a51928
4 changes: 0 additions & 4 deletions trunk/drivers/net/wireless/ath/ath9k/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,6 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah)
ah->hw_version.magic = AR5416_MAGIC;
ah->hw_version.subvendorid = 0;

ah->ah_flags = 0;
if (!AR_SREV_9100(ah))
ah->ah_flags = AH_USE_EEPROM;

ah->atim_window = 0;
ah->sta_id1_defaults =
AR_STA_ID1_CRPT_MIC_ENABLE |
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/net/wireless/ath/ath9k/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
ah->hw_version.subsysid = subsysid;
sc->sc_ah = ah;

if (!sc->dev->platform_data)
ah->ah_flags |= AH_USE_EEPROM;

common = ath9k_hw_common(ah);
common->ops = &ath9k_common_ops;
common->bus_ops = bus_ops;
Expand Down
42 changes: 29 additions & 13 deletions trunk/drivers/net/wireless/ath/ath9k/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <linux/nl80211.h>
#include <linux/pci.h>
#include <linux/ath9k_platform.h>
#include "ath9k.h"

static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = {
Expand Down Expand Up @@ -53,21 +54,36 @@ static void ath_pci_read_cachesize(struct ath_common *common, int *csz)

static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data)
{
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,
AR_EEPROM_STATUS_DATA,
AR_EEPROM_STATUS_DATA_BUSY |
AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0,
AH_WAIT_TIMEOUT)) {
return false;
struct ath_softc *sc = (struct ath_softc *) common->priv;
struct ath9k_platform_data *pdata = sc->dev->platform_data;

if (pdata) {
if (off >= (ARRAY_SIZE(pdata->eeprom_data))) {
ath_print(common, ATH_DBG_FATAL,
"%s: eeprom read failed, offset %08x "
"is out of range\n",
__func__, off);
}

*data = pdata->eeprom_data[off];
} else {
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,
AR_EEPROM_STATUS_DATA,
AR_EEPROM_STATUS_DATA_BUSY |
AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0,
AH_WAIT_TIMEOUT)) {
return false;
}

*data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA),
AR_EEPROM_STATUS_DATA_VAL);
}

*data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA),
AR_EEPROM_STATUS_DATA_VAL);

return true;
}

Expand Down

0 comments on commit 4e81b81

Please sign in to comment.