aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath5k/rfbuffer.h
diff options
context:
space:
mode:
authorNick Kossifidis <mick@madwifi-project.org>2009-02-08 23:06:34 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-13 13:44:45 -0500
commit8892e4ec62f1553d36c88e613890aa4d7c5a372e (patch)
tree3f7976379576a11d05d1723f3bcf8a03f821413a /drivers/net/wireless/ath5k/rfbuffer.h
parent6f3b414aca060a847e243f676b8601731938eb48 (diff)
ath5k: Update RF Buffer handling
* Use the new way to modify rf buffer and put some rf buffer documentation on rfbufer.h * Merge all rf regs functions to one * Sync with legacy HAL and Sam's HAL * Set gain_F settings so that gain_F optimization engine works on RF5111/RF5112 (note that both HALs only use step 0 for RF5111 and they don't use gain_F optimization for this chip, code is there but is never used) Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath5k/rfbuffer.h')
-rw-r--r--drivers/net/wireless/ath5k/rfbuffer.h88
1 files changed, 74 insertions, 14 deletions
diff --git a/drivers/net/wireless/ath5k/rfbuffer.h b/drivers/net/wireless/ath5k/rfbuffer.h
index 28b30163c0ee..e50baff66175 100644
--- a/drivers/net/wireless/ath5k/rfbuffer.h
+++ b/drivers/net/wireless/ath5k/rfbuffer.h
@@ -17,6 +17,33 @@
17 * 17 *
18 */ 18 */
19 19
20
21/*
22 * There are some special registers on the RF chip
23 * that control various operation settings related mostly to
24 * the analog parts (channel, gain adjustment etc).
25 *
26 * We don't write on those registers directly but
27 * we send a data packet on the chip, using a special register,
28 * that holds all the settings we need. After we 've sent the
29 * data packet, we write on another special register to notify hw
30 * to apply the settings. This is done so that control registers
31 * can be dynamicaly programmed during operation and the settings
32 * are applied faster on the hw.
33 *
34 * We call each data packet an "RF Bank" and all the data we write
35 * (all RF Banks) "RF Buffer". This file holds initial RF Buffer
36 * data for the different RF chips, and various info to match RF
37 * Buffer offsets with specific RF registers so that we can access
38 * them. We tweak these settings on rfregs_init function.
39 *
40 * Also check out reg.h and U.S. Patent 6677779 B1 (about buffer
41 * registers and control registers):
42 *
43 * http://www.google.com/patents?id=qNURAAAAEBAJ
44 */
45
46
20/* 47/*
21 * Struct to hold default mode specific RF 48 * Struct to hold default mode specific RF
22 * register values (RF Banks) 49 * register values (RF Banks)
@@ -72,15 +99,28 @@ enum ath5k_rf_regs_idx {
72 AR5K_RF_XB2_LVL, 99 AR5K_RF_XB2_LVL,
73 AR5K_RF_XB5_LVL, 100 AR5K_RF_XB5_LVL,
74 AR5K_RF_PWD_ICLOBUF_2G, 101 AR5K_RF_PWD_ICLOBUF_2G,
102 AR5K_RF_PWD_84,
103 AR5K_RF_PWD_90,
104 AR5K_RF_PWD_130,
105 AR5K_RF_PWD_131,
106 AR5K_RF_PWD_132,
107 AR5K_RF_PWD_136,
108 AR5K_RF_PWD_137,
109 AR5K_RF_PWD_138,
110 AR5K_RF_PWD_166,
111 AR5K_RF_PWD_167,
75 AR5K_RF_DERBY_CHAN_SEL_MODE, 112 AR5K_RF_DERBY_CHAN_SEL_MODE,
76 /* BANK 7 */ 113 /* BANK 7 */
77 AR5K_RF_GAIN_I, 114 AR5K_RF_GAIN_I,
78 AR5K_RF_PLO_SEL, 115 AR5K_RF_PLO_SEL,
79 AR5K_RF_RFGAIN_SEL, 116 AR5K_RF_RFGAIN_SEL,
117 AR5K_RF_RFGAIN_STEP,
80 AR5K_RF_WAIT_S, 118 AR5K_RF_WAIT_S,
81 AR5K_RF_WAIT_I, 119 AR5K_RF_WAIT_I,
82 AR5K_RF_MAX_TIME, 120 AR5K_RF_MAX_TIME,
121 AR5K_RF_MIXVGA_OVR,
83 AR5K_RF_MIXGAIN_OVR, 122 AR5K_RF_MIXGAIN_OVR,
123 AR5K_RF_MIXGAIN_STEP,
84 AR5K_RF_PD_DELAY_A, 124 AR5K_RF_PD_DELAY_A,
85 AR5K_RF_PD_DELAY_B, 125 AR5K_RF_PD_DELAY_B,
86 AR5K_RF_PD_DELAY_XR, 126 AR5K_RF_PD_DELAY_XR,
@@ -118,19 +158,21 @@ enum ath5k_rf_regs_idx {
118#define AR5K_RF5111_MAX_TIME { 2, 49, 0 } 158#define AR5K_RF5111_MAX_TIME { 2, 49, 0 }
119 159
120static const struct ath5k_rf_reg rf_regs_5111[] = { 160static const struct ath5k_rf_reg rf_regs_5111[] = {
121 {6, AR5K_RF_OB_2GHZ, AR5K_RF5111_OB_2GHZ}, 161 {6, AR5K_RF_OB_2GHZ, AR5K_RF5111_OB_2GHZ},
122 {6, AR5K_RF_DB_2GHZ, AR5K_RF5111_DB_2GHZ}, 162 {6, AR5K_RF_DB_2GHZ, AR5K_RF5111_DB_2GHZ},
123 {6, AR5K_RF_OB_5GHZ, AR5K_RF5111_OB_5GHZ}, 163 {6, AR5K_RF_OB_5GHZ, AR5K_RF5111_OB_5GHZ},
124 {6, AR5K_RF_DB_5GHZ, AR5K_RF5111_DB_5GHZ}, 164 {6, AR5K_RF_DB_5GHZ, AR5K_RF5111_DB_5GHZ},
125 {6, AR5K_RF_PWD_XPD, AR5K_RF5111_PWD_XPD}, 165 {6, AR5K_RF_PWD_XPD, AR5K_RF5111_PWD_XPD},
126 {6, AR5K_RF_XPD_GAIN, AR5K_RF5111_XPD_GAIN}, 166 {6, AR5K_RF_XPD_GAIN, AR5K_RF5111_XPD_GAIN},
127 {7, AR5K_RF_GAIN_I, AR5K_RF5111_GAIN_I}, 167 {6, AR5K_RF_PWD_84, AR5K_RF5111_PWD(84)},
128 {7, AR5K_RF_PLO_SEL, AR5K_RF5111_PLO_SEL}, 168 {6, AR5K_RF_PWD_90, AR5K_RF5111_PWD(90)},
129 {7, AR5K_RF_RFGAIN_SEL, AR5K_RF5111_RFGAIN_SEL}, 169 {7, AR5K_RF_GAIN_I, AR5K_RF5111_GAIN_I},
130 {7, AR5K_RF_WAIT_S, AR5K_RF5111_WAIT_S}, 170 {7, AR5K_RF_PLO_SEL, AR5K_RF5111_PLO_SEL},
131 {7, AR5K_RF_WAIT_I, AR5K_RF5111_WAIT_I}, 171 {7, AR5K_RF_RFGAIN_SEL, AR5K_RF5111_RFGAIN_SEL},
132 {7, AR5K_RF_MAX_TIME, AR5K_RF5111_MAX_TIME} 172 {7, AR5K_RF_RFGAIN_STEP, AR5K_RF5111_RFGAIN_STEP},
133 173 {7, AR5K_RF_WAIT_S, AR5K_RF5111_WAIT_S},
174 {7, AR5K_RF_WAIT_I, AR5K_RF5111_WAIT_I},
175 {7, AR5K_RF_MAX_TIME, AR5K_RF5111_MAX_TIME}
134}; 176};
135 177
136/* Default mode specific settings */ 178/* Default mode specific settings */
@@ -273,8 +315,16 @@ static const struct ath5k_rf_reg rf_regs_5112[] = {
273 {6, AR5K_RF_FIXED_BIAS_B, AR5K_RF5112_FIXED_BIAS_B}, 315 {6, AR5K_RF_FIXED_BIAS_B, AR5K_RF5112_FIXED_BIAS_B},
274 {6, AR5K_RF_XPD_SEL, AR5K_RF5112_XPD_SEL}, 316 {6, AR5K_RF_XPD_SEL, AR5K_RF5112_XPD_SEL},
275 {6, AR5K_RF_XPD_GAIN, AR5K_RF5112_XPD_GAIN}, 317 {6, AR5K_RF_XPD_GAIN, AR5K_RF5112_XPD_GAIN},
318 {6, AR5K_RF_PWD_130, AR5K_RF5112_PWD(130)},
319 {6, AR5K_RF_PWD_131, AR5K_RF5112_PWD(131)},
320 {6, AR5K_RF_PWD_132, AR5K_RF5112_PWD(132)},
321 {6, AR5K_RF_PWD_136, AR5K_RF5112_PWD(136)},
322 {6, AR5K_RF_PWD_137, AR5K_RF5112_PWD(137)},
323 {6, AR5K_RF_PWD_138, AR5K_RF5112_PWD(138)},
276 {7, AR5K_RF_GAIN_I, AR5K_RF5112X_GAIN_I}, 324 {7, AR5K_RF_GAIN_I, AR5K_RF5112X_GAIN_I},
325 {7, AR5K_RF_MIXVGA_OVR, AR5K_RF5112X_MIXVGA_OVR},
277 {7, AR5K_RF_MIXGAIN_OVR, AR5K_RF5112X_MIXGAIN_OVR}, 326 {7, AR5K_RF_MIXGAIN_OVR, AR5K_RF5112X_MIXGAIN_OVR},
327 {7, AR5K_RF_MIXGAIN_STEP, AR5K_RF5112X_MIXGAIN_STEP},
278 {7, AR5K_RF_PD_DELAY_A, AR5K_RF5112X_PD_DELAY_A}, 328 {7, AR5K_RF_PD_DELAY_A, AR5K_RF5112X_PD_DELAY_A},
279 {7, AR5K_RF_PD_DELAY_B, AR5K_RF5112X_PD_DELAY_B}, 329 {7, AR5K_RF_PD_DELAY_B, AR5K_RF5112X_PD_DELAY_B},
280 {7, AR5K_RF_PD_DELAY_XR, AR5K_RF5112X_PD_DELAY_XR}, 330 {7, AR5K_RF_PD_DELAY_XR, AR5K_RF5112X_PD_DELAY_XR},
@@ -419,7 +469,7 @@ static const struct ath5k_ini_rfbuffer rfb_5112[] = {
419#define AR5K_RF5112A_HIGH_VC_CP { 2, 90, 2 } 469#define AR5K_RF5112A_HIGH_VC_CP { 2, 90, 2 }
420#define AR5K_RF5112A_MID_VC_CP { 2, 92, 2 } 470#define AR5K_RF5112A_MID_VC_CP { 2, 92, 2 }
421#define AR5K_RF5112A_LOW_VC_CP { 2, 94, 2 } 471#define AR5K_RF5112A_LOW_VC_CP { 2, 94, 2 }
422#define AR5K_RF5112A_PUSH_UP { 2, 94, 2 } 472#define AR5K_RF5112A_PUSH_UP { 1, 254, 2 }
423 473
424/* Power consumption */ 474/* Power consumption */
425#define AR5K_RF5112A_PAD2GND { 1, 281, 1 } 475#define AR5K_RF5112A_PAD2GND { 1, 281, 1 }
@@ -436,6 +486,14 @@ static const struct ath5k_rf_reg rf_regs_5112a[] = {
436 {6, AR5K_RF_XPD_SEL, AR5K_RF5112A_XPD_SEL}, 486 {6, AR5K_RF_XPD_SEL, AR5K_RF5112A_XPD_SEL},
437 {6, AR5K_RF_PD_GAIN_LO, AR5K_RF5112A_PDGAINLO}, 487 {6, AR5K_RF_PD_GAIN_LO, AR5K_RF5112A_PDGAINLO},
438 {6, AR5K_RF_PD_GAIN_HI, AR5K_RF5112A_PDGAINHI}, 488 {6, AR5K_RF_PD_GAIN_HI, AR5K_RF5112A_PDGAINHI},
489 {6, AR5K_RF_PWD_130, AR5K_RF5112A_PWD(130)},
490 {6, AR5K_RF_PWD_131, AR5K_RF5112A_PWD(131)},
491 {6, AR5K_RF_PWD_132, AR5K_RF5112A_PWD(132)},
492 {6, AR5K_RF_PWD_136, AR5K_RF5112A_PWD(136)},
493 {6, AR5K_RF_PWD_137, AR5K_RF5112A_PWD(137)},
494 {6, AR5K_RF_PWD_138, AR5K_RF5112A_PWD(138)},
495 {6, AR5K_RF_PWD_166, AR5K_RF5112A_PWD(166)},
496 {6, AR5K_RF_PWD_167, AR5K_RF5112A_PWD(167)},
439 {6, AR5K_RF_HIGH_VC_CP, AR5K_RF5112A_HIGH_VC_CP}, 497 {6, AR5K_RF_HIGH_VC_CP, AR5K_RF5112A_HIGH_VC_CP},
440 {6, AR5K_RF_MID_VC_CP, AR5K_RF5112A_MID_VC_CP}, 498 {6, AR5K_RF_MID_VC_CP, AR5K_RF5112A_MID_VC_CP},
441 {6, AR5K_RF_LOW_VC_CP, AR5K_RF5112A_LOW_VC_CP}, 499 {6, AR5K_RF_LOW_VC_CP, AR5K_RF5112A_LOW_VC_CP},
@@ -444,7 +502,9 @@ static const struct ath5k_rf_reg rf_regs_5112a[] = {
444 {6, AR5K_RF_XB2_LVL, AR5K_RF5112A_XB2_LVL}, 502 {6, AR5K_RF_XB2_LVL, AR5K_RF5112A_XB2_LVL},
445 {6, AR5K_RF_XB5_LVL, AR5K_RF5112A_XB5_LVL}, 503 {6, AR5K_RF_XB5_LVL, AR5K_RF5112A_XB5_LVL},
446 {7, AR5K_RF_GAIN_I, AR5K_RF5112X_GAIN_I}, 504 {7, AR5K_RF_GAIN_I, AR5K_RF5112X_GAIN_I},
505 {7, AR5K_RF_MIXVGA_OVR, AR5K_RF5112X_MIXVGA_OVR},
447 {7, AR5K_RF_MIXGAIN_OVR, AR5K_RF5112X_MIXGAIN_OVR}, 506 {7, AR5K_RF_MIXGAIN_OVR, AR5K_RF5112X_MIXGAIN_OVR},
507 {7, AR5K_RF_MIXGAIN_STEP, AR5K_RF5112X_MIXGAIN_STEP},
448 {7, AR5K_RF_PD_DELAY_A, AR5K_RF5112X_PD_DELAY_A}, 508 {7, AR5K_RF_PD_DELAY_A, AR5K_RF5112X_PD_DELAY_A},
449 {7, AR5K_RF_PD_DELAY_B, AR5K_RF5112X_PD_DELAY_B}, 509 {7, AR5K_RF_PD_DELAY_B, AR5K_RF5112X_PD_DELAY_B},
450 {7, AR5K_RF_PD_DELAY_XR, AR5K_RF5112X_PD_DELAY_XR}, 510 {7, AR5K_RF_PD_DELAY_XR, AR5K_RF5112X_PD_DELAY_XR},