aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/eeprom_4k.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-09-13 05:42:02 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-07 16:39:29 -0400
commitc46917bb53a546f60c7d3103407fe953c418dd5b (patch)
tree5598017157d88b70d3ec9905acb020303913c0e8 /drivers/net/wireless/ath/ath9k/eeprom_4k.c
parentcd9bf689600e62d84449d65b3d25fb6d2757589e (diff)
atheros: add common debug printing
ath9k uses this for now, ath9k_htc is expected to re-use this as well. We lave ath5k as is, but it certainly can also be converted later. The ath9k module parameter and debugfs entry is kept. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/eeprom_4k.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_4k.c81
1 files changed, 43 insertions, 38 deletions
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
index 0675cd5edf0d..079dd201a2d8 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include "ath9k.h" 17#include "ath9k.h"
18#include "hw.h"
18 19
19static int ath9k_hw_4k_get_eeprom_ver(struct ath_hw *ah) 20static int ath9k_hw_4k_get_eeprom_ver(struct ath_hw *ah)
20{ 21{
@@ -29,20 +30,21 @@ static int ath9k_hw_4k_get_eeprom_rev(struct ath_hw *ah)
29static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah) 30static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
30{ 31{
31#define SIZE_EEPROM_4K (sizeof(struct ar5416_eeprom_4k) / sizeof(u16)) 32#define SIZE_EEPROM_4K (sizeof(struct ar5416_eeprom_4k) / sizeof(u16))
33 struct ath_common *common = ath9k_hw_common(ah);
32 u16 *eep_data = (u16 *)&ah->eeprom.map4k; 34 u16 *eep_data = (u16 *)&ah->eeprom.map4k;
33 int addr, eep_start_loc = 0; 35 int addr, eep_start_loc = 0;
34 36
35 eep_start_loc = 64; 37 eep_start_loc = 64;
36 38
37 if (!ath9k_hw_use_flash(ah)) { 39 if (!ath9k_hw_use_flash(ah)) {
38 DPRINTF(ah, ATH_DBG_EEPROM, 40 ath_print(common, ATH_DBG_EEPROM,
39 "Reading from EEPROM, not flash\n"); 41 "Reading from EEPROM, not flash\n");
40 } 42 }
41 43
42 for (addr = 0; addr < SIZE_EEPROM_4K; addr++) { 44 for (addr = 0; addr < SIZE_EEPROM_4K; addr++) {
43 if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) { 45 if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) {
44 DPRINTF(ah, ATH_DBG_EEPROM, 46 ath_print(common, ATH_DBG_EEPROM,
45 "Unable to read eeprom region \n"); 47 "Unable to read eeprom region \n");
46 return false; 48 return false;
47 } 49 }
48 eep_data++; 50 eep_data++;
@@ -55,6 +57,7 @@ static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
55static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah) 57static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
56{ 58{
57#define EEPROM_4K_SIZE (sizeof(struct ar5416_eeprom_4k) / sizeof(u16)) 59#define EEPROM_4K_SIZE (sizeof(struct ar5416_eeprom_4k) / sizeof(u16))
60 struct ath_common *common = ath9k_hw_common(ah);
58 struct ar5416_eeprom_4k *eep = 61 struct ar5416_eeprom_4k *eep =
59 (struct ar5416_eeprom_4k *) &ah->eeprom.map4k; 62 (struct ar5416_eeprom_4k *) &ah->eeprom.map4k;
60 u16 *eepdata, temp, magic, magic2; 63 u16 *eepdata, temp, magic, magic2;
@@ -66,13 +69,13 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
66 if (!ath9k_hw_use_flash(ah)) { 69 if (!ath9k_hw_use_flash(ah)) {
67 if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, 70 if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET,
68 &magic)) { 71 &magic)) {
69 DPRINTF(ah, ATH_DBG_FATAL, 72 ath_print(common, ATH_DBG_FATAL,
70 "Reading Magic # failed\n"); 73 "Reading Magic # failed\n");
71 return false; 74 return false;
72 } 75 }
73 76
74 DPRINTF(ah, ATH_DBG_EEPROM, 77 ath_print(common, ATH_DBG_EEPROM,
75 "Read Magic = 0x%04X\n", magic); 78 "Read Magic = 0x%04X\n", magic);
76 79
77 if (magic != AR5416_EEPROM_MAGIC) { 80 if (magic != AR5416_EEPROM_MAGIC) {
78 magic2 = swab16(magic); 81 magic2 = swab16(magic);
@@ -87,16 +90,16 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
87 eepdata++; 90 eepdata++;
88 } 91 }
89 } else { 92 } else {
90 DPRINTF(ah, ATH_DBG_FATAL, 93 ath_print(common, ATH_DBG_FATAL,
91 "Invalid EEPROM Magic. " 94 "Invalid EEPROM Magic. "
92 "endianness mismatch.\n"); 95 "endianness mismatch.\n");
93 return -EINVAL; 96 return -EINVAL;
94 } 97 }
95 } 98 }
96 } 99 }
97 100
98 DPRINTF(ah, ATH_DBG_EEPROM, "need_swap = %s.\n", 101 ath_print(common, ATH_DBG_EEPROM, "need_swap = %s.\n",
99 need_swap ? "True" : "False"); 102 need_swap ? "True" : "False");
100 103
101 if (need_swap) 104 if (need_swap)
102 el = swab16(ah->eeprom.map4k.baseEepHeader.length); 105 el = swab16(ah->eeprom.map4k.baseEepHeader.length);
@@ -117,8 +120,8 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
117 u32 integer; 120 u32 integer;
118 u16 word; 121 u16 word;
119 122
120 DPRINTF(ah, ATH_DBG_EEPROM, 123 ath_print(common, ATH_DBG_EEPROM,
121 "EEPROM Endianness is not native.. Changing\n"); 124 "EEPROM Endianness is not native.. Changing\n");
122 125
123 word = swab16(eep->baseEepHeader.length); 126 word = swab16(eep->baseEepHeader.length);
124 eep->baseEepHeader.length = word; 127 eep->baseEepHeader.length = word;
@@ -160,9 +163,9 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
160 163
161 if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER || 164 if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER ||
162 ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) { 165 ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) {
163 DPRINTF(ah, ATH_DBG_FATAL, 166 ath_print(common, ATH_DBG_FATAL,
164 "Bad EEPROM checksum 0x%x or revision 0x%04x\n", 167 "Bad EEPROM checksum 0x%x or revision 0x%04x\n",
165 sum, ah->eep_ops->get_eeprom_ver(ah)); 168 sum, ah->eep_ops->get_eeprom_ver(ah));
166 return -EINVAL; 169 return -EINVAL;
167 } 170 }
168 171
@@ -385,6 +388,7 @@ static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah,
385 struct ath9k_channel *chan, 388 struct ath9k_channel *chan,
386 int16_t *pTxPowerIndexOffset) 389 int16_t *pTxPowerIndexOffset)
387{ 390{
391 struct ath_common *common = ath9k_hw_common(ah);
388 struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k; 392 struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k;
389 struct cal_data_per_freq_4k *pRawDataset; 393 struct cal_data_per_freq_4k *pRawDataset;
390 u8 *pCalBChans = NULL; 394 u8 *pCalBChans = NULL;
@@ -470,21 +474,21 @@ static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah,
470 ((pdadcValues[4 * j + 3] & 0xFF) << 24); 474 ((pdadcValues[4 * j + 3] & 0xFF) << 24);
471 REG_WRITE(ah, regOffset, reg32); 475 REG_WRITE(ah, regOffset, reg32);
472 476
473 DPRINTF(ah, ATH_DBG_EEPROM, 477 ath_print(common, ATH_DBG_EEPROM,
474 "PDADC (%d,%4x): %4.4x %8.8x\n", 478 "PDADC (%d,%4x): %4.4x %8.8x\n",
475 i, regChainOffset, regOffset, 479 i, regChainOffset, regOffset,
476 reg32); 480 reg32);
477 DPRINTF(ah, ATH_DBG_EEPROM, 481 ath_print(common, ATH_DBG_EEPROM,
478 "PDADC: Chain %d | " 482 "PDADC: Chain %d | "
479 "PDADC %3d Value %3d | " 483 "PDADC %3d Value %3d | "
480 "PDADC %3d Value %3d | " 484 "PDADC %3d Value %3d | "
481 "PDADC %3d Value %3d | " 485 "PDADC %3d Value %3d | "
482 "PDADC %3d Value %3d |\n", 486 "PDADC %3d Value %3d |\n",
483 i, 4 * j, pdadcValues[4 * j], 487 i, 4 * j, pdadcValues[4 * j],
484 4 * j + 1, pdadcValues[4 * j + 1], 488 4 * j + 1, pdadcValues[4 * j + 1],
485 4 * j + 2, pdadcValues[4 * j + 2], 489 4 * j + 2, pdadcValues[4 * j + 2],
486 4 * j + 3, 490 4 * j + 3,
487 pdadcValues[4 * j + 3]); 491 pdadcValues[4 * j + 3]);
488 492
489 regOffset += 4; 493 regOffset += 4;
490 } 494 }
@@ -1148,20 +1152,21 @@ static u16 ath9k_hw_4k_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz)
1148{ 1152{
1149#define EEP_MAP4K_SPURCHAN \ 1153#define EEP_MAP4K_SPURCHAN \
1150 (ah->eeprom.map4k.modalHeader.spurChans[i].spurChan) 1154 (ah->eeprom.map4k.modalHeader.spurChans[i].spurChan)
1155 struct ath_common *common = ath9k_hw_common(ah);
1151 1156
1152 u16 spur_val = AR_NO_SPUR; 1157 u16 spur_val = AR_NO_SPUR;
1153 1158
1154 DPRINTF(ah, ATH_DBG_ANI, 1159 ath_print(common, ATH_DBG_ANI,
1155 "Getting spur idx %d is2Ghz. %d val %x\n", 1160 "Getting spur idx %d is2Ghz. %d val %x\n",
1156 i, is2GHz, ah->config.spurchans[i][is2GHz]); 1161 i, is2GHz, ah->config.spurchans[i][is2GHz]);
1157 1162
1158 switch (ah->config.spurmode) { 1163 switch (ah->config.spurmode) {
1159 case SPUR_DISABLE: 1164 case SPUR_DISABLE:
1160 break; 1165 break;
1161 case SPUR_ENABLE_IOCTL: 1166 case SPUR_ENABLE_IOCTL:
1162 spur_val = ah->config.spurchans[i][is2GHz]; 1167 spur_val = ah->config.spurchans[i][is2GHz];
1163 DPRINTF(ah, ATH_DBG_ANI, 1168 ath_print(common, ATH_DBG_ANI,
1164 "Getting spur val from new loc. %d\n", spur_val); 1169 "Getting spur val from new loc. %d\n", spur_val);
1165 break; 1170 break;
1166 case SPUR_ENABLE_EEPROM: 1171 case SPUR_ENABLE_EEPROM:
1167 spur_val = EEP_MAP4K_SPURCHAN; 1172 spur_val = EEP_MAP4K_SPURCHAN;