diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2010-04-15 17:39:13 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-04-16 15:43:36 -0400 |
commit | 49101676b2f1a66e0043509423e876414c73b5aa (patch) | |
tree | 4a35128306c6c402d026db3adc0bf95ee5da60da /drivers/net/wireless | |
parent | 0b8f6f2b1b18c7a3cb70fbb44ab5f4883d59f738 (diff) |
ath9k_hw: restore mac address reading logic
Once upon a time the AR_EEPROM_MAC macro was added to let us
add a random attribute to the three 4-bytes of MAC addresses
entries we read from the EEPROM. This was good while a random
high-enough value was used which did not conflict with any
of the already existing enum eeprom_param values. With AR9003
support the enums overlap and it means we either increment
the random offset or just restore the reading logic to match
what the HAL has. I choose to do the later to synchronize
the logic on both code bases.
This should fix reading the MAC address from the EEPROM
on AR9003 hardware.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_4k.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_9287.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_def.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 3 |
5 files changed, 11 insertions, 11 deletions
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h index 60fd5b6f3523..289084c71527 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.h +++ b/drivers/net/wireless/ath/ath9k/eeprom.h | |||
@@ -93,7 +93,6 @@ | |||
93 | */ | 93 | */ |
94 | #define AR9285_RDEXT_DEFAULT 0x1F | 94 | #define AR9285_RDEXT_DEFAULT 0x1F |
95 | 95 | ||
96 | #define AR_EEPROM_MAC(i) (0x1d+(i)) | ||
97 | #define ATH9K_POW_SM(_r, _s) (((_r) & 0x3f) << (_s)) | 96 | #define ATH9K_POW_SM(_r, _s) (((_r) & 0x3f) << (_s)) |
98 | #define FREQ2FBIN(x, y) ((y) ? ((x) - 2300) : (((x) - 4800) / 5)) | 97 | #define FREQ2FBIN(x, y) ((y) ? ((x) - 2300) : (((x) - 4800) / 5)) |
99 | #define ath9k_hw_use_flash(_ah) (!(_ah->ah_flags & AH_USE_EEPROM)) | 98 | #define ath9k_hw_use_flash(_ah) (!(_ah->ah_flags & AH_USE_EEPROM)) |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c index 97279a5e01e8..2384a9f4f5fb 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c | |||
@@ -183,11 +183,11 @@ static u32 ath9k_hw_4k_get_eeprom(struct ath_hw *ah, | |||
183 | switch (param) { | 183 | switch (param) { |
184 | case EEP_NFTHRESH_2: | 184 | case EEP_NFTHRESH_2: |
185 | return pModal->noiseFloorThreshCh[0]; | 185 | return pModal->noiseFloorThreshCh[0]; |
186 | case AR_EEPROM_MAC(0): | 186 | case EEP_MAC_LSW: |
187 | return pBase->macAddr[0] << 8 | pBase->macAddr[1]; | 187 | return pBase->macAddr[0] << 8 | pBase->macAddr[1]; |
188 | case AR_EEPROM_MAC(1): | 188 | case EEP_MAC_MID: |
189 | return pBase->macAddr[2] << 8 | pBase->macAddr[3]; | 189 | return pBase->macAddr[2] << 8 | pBase->macAddr[3]; |
190 | case AR_EEPROM_MAC(2): | 190 | case EEP_MAC_MSW: |
191 | return pBase->macAddr[4] << 8 | pBase->macAddr[5]; | 191 | return pBase->macAddr[4] << 8 | pBase->macAddr[5]; |
192 | case EEP_REG_0: | 192 | case EEP_REG_0: |
193 | return pBase->regDmn[0]; | 193 | return pBase->regDmn[0]; |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index 0b1e885c961b..b471db5fb82d 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
@@ -173,11 +173,11 @@ static u32 ath9k_hw_AR9287_get_eeprom(struct ath_hw *ah, | |||
173 | switch (param) { | 173 | switch (param) { |
174 | case EEP_NFTHRESH_2: | 174 | case EEP_NFTHRESH_2: |
175 | return pModal->noiseFloorThreshCh[0]; | 175 | return pModal->noiseFloorThreshCh[0]; |
176 | case AR_EEPROM_MAC(0): | 176 | case EEP_MAC_LSW: |
177 | return pBase->macAddr[0] << 8 | pBase->macAddr[1]; | 177 | return pBase->macAddr[0] << 8 | pBase->macAddr[1]; |
178 | case AR_EEPROM_MAC(1): | 178 | case EEP_MAC_MID: |
179 | return pBase->macAddr[2] << 8 | pBase->macAddr[3]; | 179 | return pBase->macAddr[2] << 8 | pBase->macAddr[3]; |
180 | case AR_EEPROM_MAC(2): | 180 | case EEP_MAC_MSW: |
181 | return pBase->macAddr[4] << 8 | pBase->macAddr[5]; | 181 | return pBase->macAddr[4] << 8 | pBase->macAddr[5]; |
182 | case EEP_REG_0: | 182 | case EEP_REG_0: |
183 | return pBase->regDmn[0]; | 183 | return pBase->regDmn[0]; |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c index 99f16a3a5be8..3d1b86bd07df 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c | |||
@@ -238,11 +238,11 @@ static u32 ath9k_hw_def_get_eeprom(struct ath_hw *ah, | |||
238 | return pModal[0].noiseFloorThreshCh[0]; | 238 | return pModal[0].noiseFloorThreshCh[0]; |
239 | case EEP_NFTHRESH_2: | 239 | case EEP_NFTHRESH_2: |
240 | return pModal[1].noiseFloorThreshCh[0]; | 240 | return pModal[1].noiseFloorThreshCh[0]; |
241 | case AR_EEPROM_MAC(0): | 241 | case EEP_MAC_LSW: |
242 | return pBase->macAddr[0] << 8 | pBase->macAddr[1]; | 242 | return pBase->macAddr[0] << 8 | pBase->macAddr[1]; |
243 | case AR_EEPROM_MAC(1): | 243 | case EEP_MAC_MID: |
244 | return pBase->macAddr[2] << 8 | pBase->macAddr[3]; | 244 | return pBase->macAddr[2] << 8 | pBase->macAddr[3]; |
245 | case AR_EEPROM_MAC(2): | 245 | case EEP_MAC_MSW: |
246 | return pBase->macAddr[4] << 8 | pBase->macAddr[5]; | 246 | return pBase->macAddr[4] << 8 | pBase->macAddr[5]; |
247 | case EEP_REG_0: | 247 | case EEP_REG_0: |
248 | return pBase->regDmn[0]; | 248 | return pBase->regDmn[0]; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index d074cc0a2319..01706d9cfc56 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -472,10 +472,11 @@ static int ath9k_hw_init_macaddr(struct ath_hw *ah) | |||
472 | u32 sum; | 472 | u32 sum; |
473 | int i; | 473 | int i; |
474 | u16 eeval; | 474 | u16 eeval; |
475 | u32 EEP_MAC[] = { EEP_MAC_LSW, EEP_MAC_MID, EEP_MAC_MSW }; | ||
475 | 476 | ||
476 | sum = 0; | 477 | sum = 0; |
477 | for (i = 0; i < 3; i++) { | 478 | for (i = 0; i < 3; i++) { |
478 | eeval = ah->eep_ops->get_eeprom(ah, AR_EEPROM_MAC(i)); | 479 | eeval = ah->eep_ops->get_eeprom(ah, EEP_MAC[i]); |
479 | sum += eeval; | 480 | sum += eeval; |
480 | common->macaddr[2 * i] = eeval >> 8; | 481 | common->macaddr[2 * i] = eeval >> 8; |
481 | common->macaddr[2 * i + 1] = eeval & 0xff; | 482 | common->macaddr[2 * i + 1] = eeval & 0xff; |