Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 194428
b: refs/heads/master
c: ebd5a14
h: refs/heads/master
v: v3
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Apr 16, 2010
1 parent e9f1399 commit 08ab05a
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 47 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: 57b98384e5450996300d77ece61739b58325a84f
refs/heads/master: ebd5a14a450e31611696dfe96781a3b8915d835c
43 changes: 43 additions & 0 deletions trunk/drivers/net/wireless/ath/ath9k/ar9002_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,49 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah,
}
}

static int ar9002_hw_get_radiorev(struct ath_hw *ah)
{
u32 val;
int i;

REG_WRITE(ah, AR_PHY(0x36), 0x00007058);

for (i = 0; i < 8; i++)
REG_WRITE(ah, AR_PHY(0x20), 0x00010000);
val = (REG_READ(ah, AR_PHY(256)) >> 24) & 0xff;
val = ((val & 0xf0) >> 4) | ((val & 0x0f) << 4);

return ath9k_hw_reverse_bits(val, 8);
}

int ar9002_hw_rf_claim(struct ath_hw *ah)
{
u32 val;

REG_WRITE(ah, AR_PHY(0), 0x00000007);

val = ar9002_hw_get_radiorev(ah);
switch (val & AR_RADIO_SREV_MAJOR) {
case 0:
val = AR_RAD5133_SREV_MAJOR;
break;
case AR_RAD5133_SREV_MAJOR:
case AR_RAD5122_SREV_MAJOR:
case AR_RAD2133_SREV_MAJOR:
case AR_RAD2122_SREV_MAJOR:
break;
default:
ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
"Radio Chip Rev 0x%02X not supported\n",
val & AR_RADIO_SREV_MAJOR);
return -EOPNOTSUPP;
}

ah->hw_version.analog5GhzRev = val;

return 0;
}

/* Sets up the AR5008/AR9001/AR9002 hardware familiy callbacks */
void ar9002_hw_attach_ops(struct ath_hw *ah)
{
Expand Down
51 changes: 5 additions & 46 deletions trunk/drivers/net/wireless/ath/ath9k/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,6 @@ static void ath9k_hw_read_revisions(struct ath_hw *ah)
}
}

static int ath9k_hw_get_radiorev(struct ath_hw *ah)
{
u32 val;
int i;

REG_WRITE(ah, AR_PHY(0x36), 0x00007058);

for (i = 0; i < 8; i++)
REG_WRITE(ah, AR_PHY(0x20), 0x00010000);
val = (REG_READ(ah, AR_PHY(256)) >> 24) & 0xff;
val = ((val & 0xf0) >> 4) | ((val & 0x0f) << 4);

return ath9k_hw_reverse_bits(val, 8);
}

/************************************/
/* HW Attach, Detach, Init Routines */
/************************************/
Expand Down Expand Up @@ -438,34 +423,6 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah)
ah->power_mode = ATH9K_PM_UNDEFINED;
}

static int ath9k_hw_rf_claim(struct ath_hw *ah)
{
u32 val;

REG_WRITE(ah, AR_PHY(0), 0x00000007);

val = ath9k_hw_get_radiorev(ah);
switch (val & AR_RADIO_SREV_MAJOR) {
case 0:
val = AR_RAD5133_SREV_MAJOR;
break;
case AR_RAD5133_SREV_MAJOR:
case AR_RAD5122_SREV_MAJOR:
case AR_RAD2133_SREV_MAJOR:
case AR_RAD2122_SREV_MAJOR:
break;
default:
ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
"Radio Chip Rev 0x%02X not supported\n",
val & AR_RADIO_SREV_MAJOR);
return -EOPNOTSUPP;
}

ah->hw_version.analog5GhzRev = val;

return 0;
}

static int ath9k_hw_init_macaddr(struct ath_hw *ah)
{
struct ath_common *common = ath9k_hw_common(ah);
Expand Down Expand Up @@ -496,9 +453,11 @@ static int ath9k_hw_post_init(struct ath_hw *ah)
return -ENODEV;
}

ecode = ath9k_hw_rf_claim(ah);
if (ecode != 0)
return ecode;
if (!AR_SREV_9300_20_OR_LATER(ah)) {
ecode = ar9002_hw_rf_claim(ah);
if (ecode != 0)
return ecode;
}

ecode = ath9k_hw_eeprom_init(ah);
if (ecode != 0)
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/net/wireless/ath/ath9k/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,12 @@ void ath9k_hw_htc_resetinit(struct ath_hw *ah);
void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled,
u32 *coef_mantissa, u32 *coef_exponent);

/*
* Code Specific to AR5008, AR9001 or AR9002,
* we stuff these here to avoid callbacks for AR9003.
*/
void ar9002_hw_cck_chan14_spread(struct ath_hw *ah);
int ar9002_hw_rf_claim(struct ath_hw *ah);

/*
* Code specifric to AR9003, we stuff these here to avoid callbacks
Expand Down

0 comments on commit 08ab05a

Please sign in to comment.