initvals.c 52.4 KB
Newer Older
1 2 3
/*
 * Initial register settings functions
 *
N
Nick Kossifidis 已提交
4
 * Copyright (c) 2004-2007 Reyk Floeter <reyk@openbsd.org>
N
Nick Kossifidis 已提交
5
 * Copyright (c) 2006-2009 Nick Kossifidis <mickflemm@gmail.com>
N
Nick Kossifidis 已提交
6
 * Copyright (c) 2007-2008 Jiri Slaby <jirislaby@gmail.com>
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */

#include "ath5k.h"
#include "reg.h"
N
Nick Kossifidis 已提交
24 25
#include "debug.h"
#include "base.h"
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

/*
 * Mode-independent initial register writes
 */

struct ath5k_ini {
	u16	ini_register;
	u32	ini_value;

	enum {
		AR5K_INI_WRITE = 0,	/* Default */
		AR5K_INI_READ = 1,	/* Cleared on read */
	} ini_mode;
};

/*
 * Mode specific initial register values
 */

struct ath5k_ini_mode {
	u16	mode_register;
	u32	mode_value[5];
};

/* Initial register settings for AR5210 */
static const struct ath5k_ini ar5210_ini[] = {
	/* PCU and MAC registers */
	{ AR5K_NOQCU_TXDP0,	0 },
	{ AR5K_NOQCU_TXDP1,	0 },
	{ AR5K_RXDP,		0 },
	{ AR5K_CR,		0 },
	{ AR5K_ISR,		0, AR5K_INI_READ },
	{ AR5K_IMR,		0 },
	{ AR5K_IER,		AR5K_IER_DISABLE },
	{ AR5K_BSR,		0, AR5K_INI_READ },
	{ AR5K_TXCFG,		AR5K_DMASIZE_128B },
	{ AR5K_RXCFG,		AR5K_DMASIZE_128B },
	{ AR5K_CFG,		AR5K_INIT_CFG },
N
Nick Kossifidis 已提交
64 65 66 67
	{ AR5K_TOPS,		8 },
	{ AR5K_RXNOFRM,		8 },
	{ AR5K_RPGTO,		0 },
	{ AR5K_TXNOFRM,		0 },
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
	{ AR5K_SFR,		0 },
	{ AR5K_MIBC,		0 },
	{ AR5K_MISC,		0 },
	{ AR5K_RX_FILTER_5210,	0 },
	{ AR5K_MCAST_FILTER0_5210, 0 },
	{ AR5K_MCAST_FILTER1_5210, 0 },
	{ AR5K_TX_MASK0,	0 },
	{ AR5K_TX_MASK1,	0 },
	{ AR5K_CLR_TMASK,	0 },
	{ AR5K_TRIG_LVL,	AR5K_TUNE_MIN_TX_FIFO_THRES },
	{ AR5K_DIAG_SW_5210,	0 },
	{ AR5K_RSSI_THR,	AR5K_TUNE_RSSI_THRES },
	{ AR5K_TSF_L32_5210,	0 },
	{ AR5K_TIMER0_5210,	0 },
	{ AR5K_TIMER1_5210,	0xffffffff },
	{ AR5K_TIMER2_5210,	0xffffffff },
	{ AR5K_TIMER3_5210,	1 },
	{ AR5K_CFP_DUR_5210,	0 },
	{ AR5K_CFP_PERIOD_5210,	0 },
	/* PHY registers */
	{ AR5K_PHY(0),	0x00000047 },
	{ AR5K_PHY_AGC,	0x00000000 },
	{ AR5K_PHY(3),	0x09848ea6 },
	{ AR5K_PHY(4),	0x3d32e000 },
	{ AR5K_PHY(5),	0x0000076b },
	{ AR5K_PHY_ACT,	AR5K_PHY_ACT_DISABLE },
	{ AR5K_PHY(8),	0x02020200 },
	{ AR5K_PHY(9),	0x00000e0e },
	{ AR5K_PHY(10),	0x0a020201 },
	{ AR5K_PHY(11),	0x00036ffc },
	{ AR5K_PHY(12),	0x00000000 },
	{ AR5K_PHY(13),	0x00000e0e },
	{ AR5K_PHY(14),	0x00000007 },
	{ AR5K_PHY(15),	0x00020100 },
	{ AR5K_PHY(16),	0x89630000 },
	{ AR5K_PHY(17),	0x1372169c },
	{ AR5K_PHY(18),	0x0018b633 },
	{ AR5K_PHY(19),	0x1284613c },
	{ AR5K_PHY(20),	0x0de8b8e0 },
	{ AR5K_PHY(21),	0x00074859 },
	{ AR5K_PHY(22),	0x7e80beba },
	{ AR5K_PHY(23),	0x313a665e },
	{ AR5K_PHY_AGCCTL, 0x00001d08 },
	{ AR5K_PHY(25),	0x0001ce00 },
	{ AR5K_PHY(26),	0x409a4190 },
	{ AR5K_PHY(28),	0x0000000f },
	{ AR5K_PHY(29),	0x00000080 },
	{ AR5K_PHY(30),	0x00000004 },
	{ AR5K_PHY(31),	0x00000018 }, 	/* 0x987c */
	{ AR5K_PHY(64),	0x00000000 }, 	/* 0x9900 */
	{ AR5K_PHY(65),	0x00000000 },
	{ AR5K_PHY(66),	0x00000000 },
	{ AR5K_PHY(67),	0x00800000 },
	{ AR5K_PHY(68),	0x00000003 },
	/* BB gain table (64bytes) */
	{ AR5K_BB_GAIN(0), 0x00000000 },
	{ AR5K_BB_GAIN(1), 0x00000020 },
	{ AR5K_BB_GAIN(2), 0x00000010 },
	{ AR5K_BB_GAIN(3), 0x00000030 },
	{ AR5K_BB_GAIN(4), 0x00000008 },
	{ AR5K_BB_GAIN(5), 0x00000028 },
	{ AR5K_BB_GAIN(6), 0x00000028 },
	{ AR5K_BB_GAIN(7), 0x00000004 },
	{ AR5K_BB_GAIN(8), 0x00000024 },
	{ AR5K_BB_GAIN(9), 0x00000014 },
	{ AR5K_BB_GAIN(10), 0x00000034 },
	{ AR5K_BB_GAIN(11), 0x0000000c },
	{ AR5K_BB_GAIN(12), 0x0000002c },
	{ AR5K_BB_GAIN(13), 0x00000002 },
	{ AR5K_BB_GAIN(14), 0x00000022 },
	{ AR5K_BB_GAIN(15), 0x00000012 },
	{ AR5K_BB_GAIN(16), 0x00000032 },
	{ AR5K_BB_GAIN(17), 0x0000000a },
	{ AR5K_BB_GAIN(18), 0x0000002a },
	{ AR5K_BB_GAIN(19), 0x00000001 },
	{ AR5K_BB_GAIN(20), 0x00000021 },
	{ AR5K_BB_GAIN(21), 0x00000011 },
	{ AR5K_BB_GAIN(22), 0x00000031 },
	{ AR5K_BB_GAIN(23), 0x00000009 },
	{ AR5K_BB_GAIN(24), 0x00000029 },
	{ AR5K_BB_GAIN(25), 0x00000005 },
	{ AR5K_BB_GAIN(26), 0x00000025 },
	{ AR5K_BB_GAIN(27), 0x00000015 },
	{ AR5K_BB_GAIN(28), 0x00000035 },
	{ AR5K_BB_GAIN(29), 0x0000000d },
	{ AR5K_BB_GAIN(30), 0x0000002d },
	{ AR5K_BB_GAIN(31), 0x00000003 },
	{ AR5K_BB_GAIN(32), 0x00000023 },
	{ AR5K_BB_GAIN(33), 0x00000013 },
	{ AR5K_BB_GAIN(34), 0x00000033 },
	{ AR5K_BB_GAIN(35), 0x0000000b },
	{ AR5K_BB_GAIN(36), 0x0000002b },
	{ AR5K_BB_GAIN(37), 0x00000007 },
	{ AR5K_BB_GAIN(38), 0x00000027 },
	{ AR5K_BB_GAIN(39), 0x00000017 },
	{ AR5K_BB_GAIN(40), 0x00000037 },
	{ AR5K_BB_GAIN(41), 0x0000000f },
	{ AR5K_BB_GAIN(42), 0x0000002f },
	{ AR5K_BB_GAIN(43), 0x0000002f },
	{ AR5K_BB_GAIN(44), 0x0000002f },
	{ AR5K_BB_GAIN(45), 0x0000002f },
	{ AR5K_BB_GAIN(46), 0x0000002f },
	{ AR5K_BB_GAIN(47), 0x0000002f },
	{ AR5K_BB_GAIN(48), 0x0000002f },
	{ AR5K_BB_GAIN(49), 0x0000002f },
	{ AR5K_BB_GAIN(50), 0x0000002f },
	{ AR5K_BB_GAIN(51), 0x0000002f },
	{ AR5K_BB_GAIN(52), 0x0000002f },
	{ AR5K_BB_GAIN(53), 0x0000002f },
	{ AR5K_BB_GAIN(54), 0x0000002f },
	{ AR5K_BB_GAIN(55), 0x0000002f },
	{ AR5K_BB_GAIN(56), 0x0000002f },
	{ AR5K_BB_GAIN(57), 0x0000002f },
	{ AR5K_BB_GAIN(58), 0x0000002f },
	{ AR5K_BB_GAIN(59), 0x0000002f },
	{ AR5K_BB_GAIN(60), 0x0000002f },
	{ AR5K_BB_GAIN(61), 0x0000002f },
	{ AR5K_BB_GAIN(62), 0x0000002f },
	{ AR5K_BB_GAIN(63), 0x0000002f },
	/* 5110 RF gain table (64btes) */
	{ AR5K_RF_GAIN(0), 0x0000001d },
	{ AR5K_RF_GAIN(1), 0x0000005d },
	{ AR5K_RF_GAIN(2), 0x0000009d },
	{ AR5K_RF_GAIN(3), 0x000000dd },
	{ AR5K_RF_GAIN(4), 0x0000011d },
	{ AR5K_RF_GAIN(5), 0x00000021 },
	{ AR5K_RF_GAIN(6), 0x00000061 },
	{ AR5K_RF_GAIN(7), 0x000000a1 },
	{ AR5K_RF_GAIN(8), 0x000000e1 },
	{ AR5K_RF_GAIN(9), 0x00000031 },
	{ AR5K_RF_GAIN(10), 0x00000071 },
	{ AR5K_RF_GAIN(11), 0x000000b1 },
	{ AR5K_RF_GAIN(12), 0x0000001c },
	{ AR5K_RF_GAIN(13), 0x0000005c },
	{ AR5K_RF_GAIN(14), 0x00000029 },
	{ AR5K_RF_GAIN(15), 0x00000069 },
	{ AR5K_RF_GAIN(16), 0x000000a9 },
	{ AR5K_RF_GAIN(17), 0x00000020 },
	{ AR5K_RF_GAIN(18), 0x00000019 },
	{ AR5K_RF_GAIN(19), 0x00000059 },
	{ AR5K_RF_GAIN(20), 0x00000099 },
	{ AR5K_RF_GAIN(21), 0x00000030 },
	{ AR5K_RF_GAIN(22), 0x00000005 },
	{ AR5K_RF_GAIN(23), 0x00000025 },
	{ AR5K_RF_GAIN(24), 0x00000065 },
	{ AR5K_RF_GAIN(25), 0x000000a5 },
	{ AR5K_RF_GAIN(26), 0x00000028 },
	{ AR5K_RF_GAIN(27), 0x00000068 },
	{ AR5K_RF_GAIN(28), 0x0000001f },
	{ AR5K_RF_GAIN(29), 0x0000001e },
	{ AR5K_RF_GAIN(30), 0x00000018 },
	{ AR5K_RF_GAIN(31), 0x00000058 },
	{ AR5K_RF_GAIN(32), 0x00000098 },
	{ AR5K_RF_GAIN(33), 0x00000003 },
	{ AR5K_RF_GAIN(34), 0x00000004 },
	{ AR5K_RF_GAIN(35), 0x00000044 },
	{ AR5K_RF_GAIN(36), 0x00000084 },
	{ AR5K_RF_GAIN(37), 0x00000013 },
	{ AR5K_RF_GAIN(38), 0x00000012 },
	{ AR5K_RF_GAIN(39), 0x00000052 },
	{ AR5K_RF_GAIN(40), 0x00000092 },
	{ AR5K_RF_GAIN(41), 0x000000d2 },
	{ AR5K_RF_GAIN(42), 0x0000002b },
	{ AR5K_RF_GAIN(43), 0x0000002a },
	{ AR5K_RF_GAIN(44), 0x0000006a },
	{ AR5K_RF_GAIN(45), 0x000000aa },
	{ AR5K_RF_GAIN(46), 0x0000001b },
	{ AR5K_RF_GAIN(47), 0x0000001a },
	{ AR5K_RF_GAIN(48), 0x0000005a },
	{ AR5K_RF_GAIN(49), 0x0000009a },
	{ AR5K_RF_GAIN(50), 0x000000da },
	{ AR5K_RF_GAIN(51), 0x00000006 },
	{ AR5K_RF_GAIN(52), 0x00000006 },
	{ AR5K_RF_GAIN(53), 0x00000006 },
	{ AR5K_RF_GAIN(54), 0x00000006 },
	{ AR5K_RF_GAIN(55), 0x00000006 },
	{ AR5K_RF_GAIN(56), 0x00000006 },
	{ AR5K_RF_GAIN(57), 0x00000006 },
	{ AR5K_RF_GAIN(58), 0x00000006 },
	{ AR5K_RF_GAIN(59), 0x00000006 },
	{ AR5K_RF_GAIN(60), 0x00000006 },
	{ AR5K_RF_GAIN(61), 0x00000006 },
	{ AR5K_RF_GAIN(62), 0x00000006 },
	{ AR5K_RF_GAIN(63), 0x00000006 },
	/* PHY activation */
	{ AR5K_PHY(53), 0x00000020 },
	{ AR5K_PHY(51), 0x00000004 },
	{ AR5K_PHY(50), 0x00060106 },
	{ AR5K_PHY(39), 0x0000006d },
	{ AR5K_PHY(48), 0x00000000 },
	{ AR5K_PHY(52), 0x00000014 },
	{ AR5K_PHY_ACT, AR5K_PHY_ACT_ENABLE },
};

/* Initial register settings for AR5211 */
static const struct ath5k_ini ar5211_ini[] = {
	{ AR5K_RXDP,		0x00000000 },
	{ AR5K_RTSD0,		0x84849c9c },
	{ AR5K_RTSD1,		0x7c7c7c7c },
	{ AR5K_RXCFG,		0x00000005 },
	{ AR5K_MIBC,		0x00000000 },
	{ AR5K_TOPS,		0x00000008 },
	{ AR5K_RXNOFRM,		0x00000008 },
	{ AR5K_TXNOFRM,		0x00000010 },
	{ AR5K_RPGTO,		0x00000000 },
	{ AR5K_RFCNT,		0x0000001f },
	{ AR5K_QUEUE_TXDP(0),	0x00000000 },
	{ AR5K_QUEUE_TXDP(1),	0x00000000 },
	{ AR5K_QUEUE_TXDP(2),	0x00000000 },
	{ AR5K_QUEUE_TXDP(3),	0x00000000 },
	{ AR5K_QUEUE_TXDP(4),	0x00000000 },
	{ AR5K_QUEUE_TXDP(5),	0x00000000 },
	{ AR5K_QUEUE_TXDP(6),	0x00000000 },
	{ AR5K_QUEUE_TXDP(7),	0x00000000 },
	{ AR5K_QUEUE_TXDP(8),	0x00000000 },
	{ AR5K_QUEUE_TXDP(9),	0x00000000 },
	{ AR5K_DCU_FP,		0x00000000 },
	{ AR5K_STA_ID1,		0x00000000 },
	{ AR5K_BSS_ID0,		0x00000000 },
	{ AR5K_BSS_ID1,		0x00000000 },
	{ AR5K_RSSI_THR,	0x00000000 },
	{ AR5K_CFP_PERIOD_5211,	0x00000000 },
	{ AR5K_TIMER0_5211,	0x00000030 },
	{ AR5K_TIMER1_5211,	0x0007ffff },
	{ AR5K_TIMER2_5211,	0x01ffffff },
	{ AR5K_TIMER3_5211,	0x00000031 },
	{ AR5K_CFP_DUR_5211,	0x00000000 },
	{ AR5K_RX_FILTER_5211,	0x00000000 },
	{ AR5K_MCAST_FILTER0_5211, 0x00000000 },
	{ AR5K_MCAST_FILTER1_5211, 0x00000002 },
	{ AR5K_DIAG_SW_5211,	0x00000000 },
	{ AR5K_ADDAC_TEST,	0x00000000 },
	{ AR5K_DEFAULT_ANTENNA,	0x00000000 },
	/* PHY registers */
	{ AR5K_PHY_AGC,	0x00000000 },
	{ AR5K_PHY(3),	0x2d849093 },
	{ AR5K_PHY(4),	0x7d32e000 },
	{ AR5K_PHY(5),	0x00000f6b },
	{ AR5K_PHY_ACT,	0x00000000 },
	{ AR5K_PHY(11),	0x00026ffe },
	{ AR5K_PHY(12),	0x00000000 },
	{ AR5K_PHY(15),	0x00020100 },
	{ AR5K_PHY(16),	0x206a017a },
	{ AR5K_PHY(19),	0x1284613c },
	{ AR5K_PHY(21),	0x00000859 },
	{ AR5K_PHY(26),	0x409a4190 },	/* 0x9868 */
	{ AR5K_PHY(27),	0x050cb081 },
	{ AR5K_PHY(28),	0x0000000f },
	{ AR5K_PHY(29),	0x00000080 },
	{ AR5K_PHY(30),	0x0000000c },
	{ AR5K_PHY(64),	0x00000000 },
	{ AR5K_PHY(65),	0x00000000 },
	{ AR5K_PHY(66),	0x00000000 },
	{ AR5K_PHY(67),	0x00800000 },
	{ AR5K_PHY(68),	0x00000001 },
	{ AR5K_PHY(71),	0x0000092a },
	{ AR5K_PHY_IQ,	0x00000000 },
	{ AR5K_PHY(73),	0x00058a05 },
	{ AR5K_PHY(74),	0x00000001 },
	{ AR5K_PHY(75),	0x00000000 },
	{ AR5K_PHY_PAPD_PROBE, 0x00000000 },
	{ AR5K_PHY(77),	0x00000000 },	/* 0x9934 */
	{ AR5K_PHY(78),	0x00000000 },	/* 0x9938 */
	{ AR5K_PHY(79),	0x0000003f },	/* 0x993c */
	{ AR5K_PHY(80),	0x00000004 },
	{ AR5K_PHY(82),	0x00000000 },
	{ AR5K_PHY(83),	0x00000000 },
	{ AR5K_PHY(84),	0x00000000 },
	{ AR5K_PHY_RADAR, 0x5d50f14c },
	{ AR5K_PHY(86),	0x00000018 },
	{ AR5K_PHY(87),	0x004b6a8e },
	/* Initial Power table (32bytes)
	 * common on all cards/modes.
	 * Note: Table is rewritten during
	 * txpower setup later using calibration
N
Nick Kossifidis 已提交
343
	 * data etc. so next write is non-common */
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
	{ AR5K_PHY_PCDAC_TXPOWER(1), 0x06ff05ff },
	{ AR5K_PHY_PCDAC_TXPOWER(2), 0x07ff07ff },
	{ AR5K_PHY_PCDAC_TXPOWER(3), 0x08ff08ff },
	{ AR5K_PHY_PCDAC_TXPOWER(4), 0x09ff09ff },
	{ AR5K_PHY_PCDAC_TXPOWER(5), 0x0aff0aff },
	{ AR5K_PHY_PCDAC_TXPOWER(6), 0x0bff0bff },
	{ AR5K_PHY_PCDAC_TXPOWER(7), 0x0cff0cff },
	{ AR5K_PHY_PCDAC_TXPOWER(8), 0x0dff0dff },
	{ AR5K_PHY_PCDAC_TXPOWER(9), 0x0fff0eff },
	{ AR5K_PHY_PCDAC_TXPOWER(10), 0x12ff12ff },
	{ AR5K_PHY_PCDAC_TXPOWER(11), 0x14ff13ff },
	{ AR5K_PHY_PCDAC_TXPOWER(12), 0x16ff15ff },
	{ AR5K_PHY_PCDAC_TXPOWER(13), 0x19ff17ff },
	{ AR5K_PHY_PCDAC_TXPOWER(14), 0x1bff1aff },
	{ AR5K_PHY_PCDAC_TXPOWER(15), 0x1eff1dff },
	{ AR5K_PHY_PCDAC_TXPOWER(16), 0x23ff20ff },
	{ AR5K_PHY_PCDAC_TXPOWER(17), 0x27ff25ff },
	{ AR5K_PHY_PCDAC_TXPOWER(18), 0x2cff29ff },
	{ AR5K_PHY_PCDAC_TXPOWER(19), 0x31ff2fff },
	{ AR5K_PHY_PCDAC_TXPOWER(20), 0x37ff34ff },
	{ AR5K_PHY_PCDAC_TXPOWER(21), 0x3aff3aff },
	{ AR5K_PHY_PCDAC_TXPOWER(22), 0x3aff3aff },
	{ AR5K_PHY_PCDAC_TXPOWER(23), 0x3aff3aff },
	{ AR5K_PHY_PCDAC_TXPOWER(24), 0x3aff3aff },
	{ AR5K_PHY_PCDAC_TXPOWER(25), 0x3aff3aff },
	{ AR5K_PHY_PCDAC_TXPOWER(26), 0x3aff3aff },
	{ AR5K_PHY_PCDAC_TXPOWER(27), 0x3aff3aff },
	{ AR5K_PHY_PCDAC_TXPOWER(28), 0x3aff3aff },
	{ AR5K_PHY_PCDAC_TXPOWER(29), 0x3aff3aff },
	{ AR5K_PHY_PCDAC_TXPOWER(30), 0x3aff3aff },
N
Nick Kossifidis 已提交
374
	{ AR5K_PHY_PCDAC_TXPOWER(31), 0x3aff3aff },
375 376 377 378 379 380 381 382 383 384 385 386 387 388
	{ AR5K_PHY_CCKTXCTL, 0x00000000 },
	{ AR5K_PHY(642), 0x503e4646 },
	{ AR5K_PHY_GAIN_2GHZ, 0x6480416c },
	{ AR5K_PHY(644), 0x0199a003 },
	{ AR5K_PHY(645), 0x044cd610 },
	{ AR5K_PHY(646), 0x13800040 },
	{ AR5K_PHY(647), 0x1be00060 },
	{ AR5K_PHY(648), 0x0c53800a },
	{ AR5K_PHY(649), 0x0014df3b },
	{ AR5K_PHY(650), 0x000001b5 },
	{ AR5K_PHY(651), 0x00000020 },
};

/* Initial mode-specific settings for AR5211
N
Nick Kossifidis 已提交
389 390
 * 5211 supports OFDM-only g (draft g) but we
 * need to test it !
391 392 393
 */
static const struct ath5k_ini_mode ar5211_ini_mode[] = {
	{ AR5K_TXCFG,
N
Nick Kossifidis 已提交
394 395
	/*	  a	    aTurbo	  b	  g (OFDM)    */
	   { 0x00000015, 0x00000015, 0x0000001d, 0x00000015 } },
396
	{ AR5K_QUEUE_DFS_LOCAL_IFS(0),
N
Nick Kossifidis 已提交
397
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
398
	{ AR5K_QUEUE_DFS_LOCAL_IFS(1),
N
Nick Kossifidis 已提交
399
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
400
	{ AR5K_QUEUE_DFS_LOCAL_IFS(2),
N
Nick Kossifidis 已提交
401
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
402
	{ AR5K_QUEUE_DFS_LOCAL_IFS(3),
N
Nick Kossifidis 已提交
403
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
404
	{ AR5K_QUEUE_DFS_LOCAL_IFS(4),
N
Nick Kossifidis 已提交
405
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
406
	{ AR5K_QUEUE_DFS_LOCAL_IFS(5),
N
Nick Kossifidis 已提交
407
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
408
	{ AR5K_QUEUE_DFS_LOCAL_IFS(6),
N
Nick Kossifidis 已提交
409
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
410
	{ AR5K_QUEUE_DFS_LOCAL_IFS(7),
N
Nick Kossifidis 已提交
411
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
412
	{ AR5K_QUEUE_DFS_LOCAL_IFS(8),
N
Nick Kossifidis 已提交
413
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
414
	{ AR5K_QUEUE_DFS_LOCAL_IFS(9),
N
Nick Kossifidis 已提交
415
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
416
	{ AR5K_DCU_GBL_IFS_SLOT,
N
Nick Kossifidis 已提交
417
	   { 0x00000168, 0x000001e0, 0x000001b8, 0x00000168 } },
418
	{ AR5K_DCU_GBL_IFS_SIFS,
N
Nick Kossifidis 已提交
419
	   { 0x00000230, 0x000001e0, 0x000000b0, 0x00000230 } },
420
	{ AR5K_DCU_GBL_IFS_EIFS,
N
Nick Kossifidis 已提交
421
	   { 0x00000d98, 0x00001180, 0x00001f48, 0x00000d98 } },
422
	{ AR5K_DCU_GBL_IFS_MISC,
N
Nick Kossifidis 已提交
423
	   { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000a0e0 } },
424
	{ AR5K_TIME_OUT,
N
Nick Kossifidis 已提交
425
	   { 0x04000400, 0x08000800, 0x20003000, 0x04000400 } },
426
	{ AR5K_USEC_5211,
N
Nick Kossifidis 已提交
427
	   { 0x0e8d8fa7, 0x0e8d8fcf, 0x01608f95, 0x0e8d8fa7 } },
428
	{ AR5K_PHY_TURBO,
N
Nick Kossifidis 已提交
429
	   { 0x00000000, 0x00000003, 0x00000000, 0x00000000 } },
430
	{ AR5K_PHY(8),
N
Nick Kossifidis 已提交
431
	   { 0x02020200, 0x02020200, 0x02010200, 0x02020200 } },
432
	{ AR5K_PHY(9),
N
Nick Kossifidis 已提交
433
	   { 0x00000e0e, 0x00000e0e, 0x00000707, 0x00000e0e } },
434
	{ AR5K_PHY(10),
N
Nick Kossifidis 已提交
435
	   { 0x0a020001, 0x0a020001, 0x05010000, 0x0a020001 } },
436
	{ AR5K_PHY(13),
N
Nick Kossifidis 已提交
437
	   { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
438
	{ AR5K_PHY(14),
N
Nick Kossifidis 已提交
439
	   { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b } },
440
	{ AR5K_PHY(17),
N
Nick Kossifidis 已提交
441
	   { 0x1372169c, 0x137216a5, 0x137216a8, 0x1372169c } },
442
	{ AR5K_PHY(18),
N
Nick Kossifidis 已提交
443
	   { 0x0018ba67, 0x0018ba67, 0x0018ba69, 0x0018ba69 } },
444
	{ AR5K_PHY(20),
N
Nick Kossifidis 已提交
445
	   { 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0 } },
446
	{ AR5K_PHY_SIG,
N
Nick Kossifidis 已提交
447
	   { 0x7e800d2e, 0x7e800d2e, 0x7ec00d2e, 0x7e800d2e } },
448
	{ AR5K_PHY_AGCCOARSE,
N
Nick Kossifidis 已提交
449
	   { 0x31375d5e, 0x31375d5e, 0x313a5d5e, 0x31375d5e } },
450
	{ AR5K_PHY_AGCCTL,
N
Nick Kossifidis 已提交
451
	   { 0x0000bd10, 0x0000bd10, 0x0000bd38, 0x0000bd10 } },
452
	{ AR5K_PHY_NF,
N
Nick Kossifidis 已提交
453
	   { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } },
454
	{ AR5K_PHY_RX_DELAY,
N
Nick Kossifidis 已提交
455
	   { 0x00002710, 0x00002710, 0x0000157c, 0x00002710 } },
456
	{ AR5K_PHY(70),
N
Nick Kossifidis 已提交
457
	   { 0x00000190, 0x00000190, 0x00000084, 0x00000190 } },
458
	{ AR5K_PHY_FRAME_CTL_5211,
N
Nick Kossifidis 已提交
459 460 461
	   { 0x6fe01020, 0x6fe01020, 0x6fe00920, 0x6fe01020 } },
	{ AR5K_PHY_PCDAC_TXPOWER_BASE,
	   { 0x05ff14ff, 0x05ff14ff, 0x05ff14ff, 0x05ff19ff } },
462
	{ AR5K_RF_BUFFER_CONTROL_4,
N
Nick Kossifidis 已提交
463
	   { 0x00000010, 0x00000014, 0x00000010, 0x00000010 } },
464 465 466
};

/* Initial register settings for AR5212 */
N
Nick Kossifidis 已提交
467
static const struct ath5k_ini ar5212_ini_common_start[] = {
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487
	{ AR5K_RXDP,		0x00000000 },
	{ AR5K_RXCFG,		0x00000005 },
	{ AR5K_MIBC,		0x00000000 },
	{ AR5K_TOPS,		0x00000008 },
	{ AR5K_RXNOFRM,		0x00000008 },
	{ AR5K_TXNOFRM,		0x00000010 },
	{ AR5K_RPGTO,		0x00000000 },
	{ AR5K_RFCNT,		0x0000001f },
	{ AR5K_QUEUE_TXDP(0),	0x00000000 },
	{ AR5K_QUEUE_TXDP(1),	0x00000000 },
	{ AR5K_QUEUE_TXDP(2),	0x00000000 },
	{ AR5K_QUEUE_TXDP(3),	0x00000000 },
	{ AR5K_QUEUE_TXDP(4),	0x00000000 },
	{ AR5K_QUEUE_TXDP(5),	0x00000000 },
	{ AR5K_QUEUE_TXDP(6),	0x00000000 },
	{ AR5K_QUEUE_TXDP(7),	0x00000000 },
	{ AR5K_QUEUE_TXDP(8),	0x00000000 },
	{ AR5K_QUEUE_TXDP(9),	0x00000000 },
	{ AR5K_DCU_FP,		0x00000000 },
	{ AR5K_DCU_TXP,		0x00000000 },
N
Nick Kossifidis 已提交
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
	/* Tx filter table 0 (32 entries) */
	{ AR5K_DCU_TX_FILTER_0(0),  0x00000000 }, /* DCU 0 */
	{ AR5K_DCU_TX_FILTER_0(1),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(2),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(3),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(4),  0x00000000 }, /* DCU 1 */
	{ AR5K_DCU_TX_FILTER_0(5),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(6),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(7),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(8),  0x00000000 }, /* DCU 2 */
	{ AR5K_DCU_TX_FILTER_0(9),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(10), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(11), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(12), 0x00000000 }, /* DCU 3 */
	{ AR5K_DCU_TX_FILTER_0(13), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(14), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(15), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(16), 0x00000000 }, /* DCU 4 */
	{ AR5K_DCU_TX_FILTER_0(17), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(18), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(19), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(20), 0x00000000 }, /* DCU 5 */
	{ AR5K_DCU_TX_FILTER_0(21), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(22), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(23), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(24), 0x00000000 }, /* DCU 6 */
	{ AR5K_DCU_TX_FILTER_0(25), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(26), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(27), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(28), 0x00000000 }, /* DCU 7 */
	{ AR5K_DCU_TX_FILTER_0(29), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(30), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_0(31), 0x00000000 },
	/* Tx filter table 1 (16 entries) */
	{ AR5K_DCU_TX_FILTER_1(0),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(1),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(2),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(3),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(4),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(5),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(6),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(7),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(8),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(9),  0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(10), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(11), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(12), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(13), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(14), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_1(15), 0x00000000 },
	{ AR5K_DCU_TX_FILTER_CLR, 0x00000000 },
	{ AR5K_DCU_TX_FILTER_SET, 0x00000000 },
540 541 542 543 544
	{ AR5K_DCU_TX_FILTER_CLR, 0x00000000 },
	{ AR5K_DCU_TX_FILTER_SET, 0x00000000 },
	{ AR5K_STA_ID1,		0x00000000 },
	{ AR5K_BSS_ID0,		0x00000000 },
	{ AR5K_BSS_ID1,		0x00000000 },
N
Nick Kossifidis 已提交
545 546 547 548 549 550 551
	{ AR5K_BEACON_5211,	0x00000000 },
	{ AR5K_CFP_PERIOD_5211, 0x00000000 },
	{ AR5K_TIMER0_5211,	0x00000030 },
	{ AR5K_TIMER1_5211,	0x0007ffff },
	{ AR5K_TIMER2_5211,	0x01ffffff },
	{ AR5K_TIMER3_5211,	0x00000031 },
	{ AR5K_CFP_DUR_5211,	0x00000000 },
552 553 554 555
	{ AR5K_RX_FILTER_5211,	0x00000000 },
	{ AR5K_DIAG_SW_5211,	0x00000000 },
	{ AR5K_ADDAC_TEST,	0x00000000 },
	{ AR5K_DEFAULT_ANTENNA,	0x00000000 },
N
Nick Kossifidis 已提交
556
	{ AR5K_FRAME_CTL_QOSM, 	0x000fc78f },
557 558 559 560 561
	{ AR5K_XRMODE,		0x2a82301a },
	{ AR5K_XRDELAY,		0x05dc01e0 },
	{ AR5K_XRTIMEOUT,	0x1f402710 },
	{ AR5K_XRCHIRP,		0x01f40000 },
	{ AR5K_XRSTOMP,		0x00001e1c },
N
Nick Kossifidis 已提交
562 563 564
	{ AR5K_SLEEP0,		0x0002aaaa },
	{ AR5K_SLEEP1,		0x02005555 },
	{ AR5K_SLEEP2,		0x00000000 },
565 566 567 568 569 570 571
	{ AR5K_BSS_IDM0,	0xffffffff },
	{ AR5K_BSS_IDM1,	0x0000ffff },
	{ AR5K_TXPC,		0x00000000 },
	{ AR5K_PROFCNT_TX,	0x00000000 },
	{ AR5K_PROFCNT_RX,	0x00000000 },
	{ AR5K_PROFCNT_RXCLR,	0x00000000 },
	{ AR5K_PROFCNT_CYCLE,	0x00000000 },
N
Nick Kossifidis 已提交
572 573
	{ AR5K_QUIET_CTL1,	0x00000088 },
	/* Initial rate duration table (32 entries )*/
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
	{ AR5K_RATE_DUR(0),	0x00000000 },
	{ AR5K_RATE_DUR(1),	0x0000008c },
	{ AR5K_RATE_DUR(2),	0x000000e4 },
	{ AR5K_RATE_DUR(3),	0x000002d5 },
	{ AR5K_RATE_DUR(4),	0x00000000 },
	{ AR5K_RATE_DUR(5),	0x00000000 },
	{ AR5K_RATE_DUR(6),	0x000000a0 },
	{ AR5K_RATE_DUR(7),	0x000001c9 },
	{ AR5K_RATE_DUR(8),	0x0000002c },
	{ AR5K_RATE_DUR(9),	0x0000002c },
	{ AR5K_RATE_DUR(10),	0x00000030 },
	{ AR5K_RATE_DUR(11),	0x0000003c },
	{ AR5K_RATE_DUR(12),	0x0000002c },
	{ AR5K_RATE_DUR(13),	0x0000002c },
	{ AR5K_RATE_DUR(14),	0x00000030 },
	{ AR5K_RATE_DUR(15),	0x0000003c },
	{ AR5K_RATE_DUR(16),	0x00000000 },
	{ AR5K_RATE_DUR(17),	0x00000000 },
	{ AR5K_RATE_DUR(18),	0x00000000 },
	{ AR5K_RATE_DUR(19),	0x00000000 },
	{ AR5K_RATE_DUR(20),	0x00000000 },
	{ AR5K_RATE_DUR(21),	0x00000000 },
	{ AR5K_RATE_DUR(22),	0x00000000 },
	{ AR5K_RATE_DUR(23),	0x00000000 },
	{ AR5K_RATE_DUR(24),	0x000000d5 },
	{ AR5K_RATE_DUR(25),	0x000000df },
	{ AR5K_RATE_DUR(26),	0x00000102 },
	{ AR5K_RATE_DUR(27),	0x0000013a },
	{ AR5K_RATE_DUR(28),	0x00000075 },
	{ AR5K_RATE_DUR(29),	0x0000007f },
	{ AR5K_RATE_DUR(30),	0x000000a2 },
	{ AR5K_RATE_DUR(31),	0x00000000 },
N
Nick Kossifidis 已提交
606
	{ AR5K_QUIET_CTL2,	0x00010002 },
607
	{ AR5K_TSF_PARM,	0x00000001 },
N
Nick Kossifidis 已提交
608
	{ AR5K_QOS_NOACK,	0x000000c0 },
609
	{ AR5K_PHY_ERR_FIL,	0x00000000 },
N
Nick Kossifidis 已提交
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643
	{ AR5K_XRLAT_TX,	0x00000168 },
	{ AR5K_ACKSIFS,		0x00000000 },
	/* Rate -> db table
	 * notice ...03<-02<-01<-00 ! */
	{ AR5K_RATE2DB(0),	0x03020100 },
	{ AR5K_RATE2DB(1),	0x07060504 },
	{ AR5K_RATE2DB(2),	0x0b0a0908 },
	{ AR5K_RATE2DB(3),	0x0f0e0d0c },
	{ AR5K_RATE2DB(4),	0x13121110 },
	{ AR5K_RATE2DB(5),	0x17161514 },
	{ AR5K_RATE2DB(6),	0x1b1a1918 },
	{ AR5K_RATE2DB(7),	0x1f1e1d1c },
	/* Db -> Rate table */
	{ AR5K_DB2RATE(0),	0x03020100 },
	{ AR5K_DB2RATE(1),	0x07060504 },
	{ AR5K_DB2RATE(2),	0x0b0a0908 },
	{ AR5K_DB2RATE(3),	0x0f0e0d0c },
	{ AR5K_DB2RATE(4),	0x13121110 },
	{ AR5K_DB2RATE(5),	0x17161514 },
	{ AR5K_DB2RATE(6),	0x1b1a1918 },
	{ AR5K_DB2RATE(7),	0x1f1e1d1c },
	/* PHY registers (Common settings
	 * for all chips/modes) */
	{ AR5K_PHY(3),		0xad848e19 },
	{ AR5K_PHY(4),		0x7d28e000 },
	{ AR5K_PHY_TIMING_3,	0x9c0a9f6b },
	{ AR5K_PHY_ACT,		0x00000000 },
	{ AR5K_PHY(16),		0x206a017a },
	{ AR5K_PHY(21),		0x00000859 },
	{ AR5K_PHY_BIN_MASK_1,	0x00000000 },
	{ AR5K_PHY_BIN_MASK_2,	0x00000000 },
	{ AR5K_PHY_BIN_MASK_3,	0x00000000 },
	{ AR5K_PHY_BIN_MASK_CTL, 0x00800000 },
	{ AR5K_PHY_ANT_CTL,	0x00000001 },
644
	/*{ AR5K_PHY(71), 0x0000092a },*/ /* Old value */
N
Nick Kossifidis 已提交
645 646 647 648
	{ AR5K_PHY_MAX_RX_LEN,	0x00000c80 },
	{ AR5K_PHY_IQ,		0x05100000 },
	{ AR5K_PHY_WARM_RESET,	0x00000001 },
	{ AR5K_PHY_CTL,		0x00000004 },
649 650 651
	{ AR5K_PHY_TXPOWER_RATE1, 0x1e1f2022 },
	{ AR5K_PHY_TXPOWER_RATE2, 0x0a0b0c0d },
	{ AR5K_PHY_TXPOWER_RATE_MAX, 0x0000003f },
N
Nick Kossifidis 已提交
652 653
	{ AR5K_PHY(82),		0x9280b212 },
	{ AR5K_PHY_RADAR,	0x5d50e188 },
654
	/*{ AR5K_PHY(86), 0x000000ff },*/
N
Nick Kossifidis 已提交
655 656 657 658 659
	{ AR5K_PHY(87),		0x004b6a8e },
	{ AR5K_PHY_NFTHRES,	0x000003ce },
	{ AR5K_PHY_RESTART,	0x192fb515 },
	{ AR5K_PHY(94),		0x00000001 },
	{ AR5K_PHY_RFBUS_REQ,	0x00000000 },
660 661
	/*{ AR5K_PHY(644), 0x0080a333 },*/ /* Old value */
	/*{ AR5K_PHY(645), 0x00206c10 },*/ /* Old value */
N
Nick Kossifidis 已提交
662 663 664 665 666 667 668
	{ AR5K_PHY(644),	0x00806333 },
	{ AR5K_PHY(645),	0x00106c10 },
	{ AR5K_PHY(646),	0x009c4060 },
	/* { AR5K_PHY(647), 0x1483800a }, */
	/* { AR5K_PHY(648), 0x01831061 }, */ /* Old value */
	{ AR5K_PHY(648),	0x018830c6 },
	{ AR5K_PHY(649),	0x00000400 },
669
	/*{ AR5K_PHY(650), 0x000001b5 },*/
N
Nick Kossifidis 已提交
670
	{ AR5K_PHY(651),	0x00000000 },
671 672 673
	{ AR5K_PHY_TXPOWER_RATE3, 0x20202020 },
	{ AR5K_PHY_TXPOWER_RATE2, 0x20202020 },
	/*{ AR5K_PHY(655), 0x13c889af },*/
N
Nick Kossifidis 已提交
674 675 676
	{ AR5K_PHY(656),	0x38490a20 },
	{ AR5K_PHY(657),	0x00007bb6 },
	{ AR5K_PHY(658),	0x0fff3ffc },
677 678 679 680 681
};

/* Initial mode-specific settings for AR5212 (Written before ar5212_ini) */
static const struct ath5k_ini_mode ar5212_ini_mode_start[] = {
	{ AR5K_QUEUE_DFS_LOCAL_IFS(0),
N
Nick Kossifidis 已提交
682 683
	/*	a/XR	   aTurbo	  b	   g (DYN)     gTurbo     */
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
684
	{ AR5K_QUEUE_DFS_LOCAL_IFS(1),
N
Nick Kossifidis 已提交
685
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
686
	{ AR5K_QUEUE_DFS_LOCAL_IFS(2),
N
Nick Kossifidis 已提交
687
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
688
	{ AR5K_QUEUE_DFS_LOCAL_IFS(3),
N
Nick Kossifidis 已提交
689
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
690
	{ AR5K_QUEUE_DFS_LOCAL_IFS(4),
N
Nick Kossifidis 已提交
691
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
692
	{ AR5K_QUEUE_DFS_LOCAL_IFS(5),
N
Nick Kossifidis 已提交
693
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
694
	{ AR5K_QUEUE_DFS_LOCAL_IFS(6),
N
Nick Kossifidis 已提交
695
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
696
	{ AR5K_QUEUE_DFS_LOCAL_IFS(7),
N
Nick Kossifidis 已提交
697
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
698
	{ AR5K_QUEUE_DFS_LOCAL_IFS(8),
N
Nick Kossifidis 已提交
699
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
700
	{ AR5K_QUEUE_DFS_LOCAL_IFS(9),
N
Nick Kossifidis 已提交
701
	   { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
702
	{ AR5K_DCU_GBL_IFS_SIFS,
N
Nick Kossifidis 已提交
703
	   { 0x00000230, 0x000001e0, 0x000000b0, 0x00000160, 0x000001e0 } },
704
	{ AR5K_DCU_GBL_IFS_SLOT,
N
Nick Kossifidis 已提交
705
	   { 0x00000168, 0x000001e0, 0x000001b8, 0x0000018c, 0x000001e0 } },
706
	{ AR5K_DCU_GBL_IFS_EIFS,
N
Nick Kossifidis 已提交
707
	   { 0x00000e60, 0x00001180, 0x00001f1c, 0x00003e38, 0x00001180 } },
708
	{ AR5K_DCU_GBL_IFS_MISC,
N
Nick Kossifidis 已提交
709
	   { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000b0e0, 0x00014068 } },
710
	{ AR5K_TIME_OUT,
N
Nick Kossifidis 已提交
711
	   { 0x03e803e8, 0x06e006e0, 0x04200420, 0x08400840, 0x06e006e0 } },
712
	{ AR5K_PHY_TURBO,
N
Nick Kossifidis 已提交
713
	   { 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000003 } },
714
	{ AR5K_PHY(8),
N
Nick Kossifidis 已提交
715 716 717 718 719
	   { 0x02020200, 0x02020200, 0x02010200, 0x02020200, 0x02020200 } },
	{ AR5K_PHY_RF_CTL2,
	   { 0x00000e0e, 0x00000e0e, 0x00000707, 0x00000e0e, 0x00000e0e } },
	{ AR5K_PHY_SETTLING,
	   { 0x1372161c, 0x13721c25, 0x13721722, 0x137216a2, 0x13721c25 } },
720
	{ AR5K_PHY_AGCCTL,
N
Nick Kossifidis 已提交
721
	   { 0x00009d10, 0x00009d10, 0x00009d18, 0x00009d18, 0x00009d18 } },
722
	{ AR5K_PHY_NF,
N
Nick Kossifidis 已提交
723 724 725
	   { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } },
	{ AR5K_PHY_WEAK_OFDM_HIGH_THR,
	   { 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190 } },
726
	{ AR5K_PHY(70),
N
Nick Kossifidis 已提交
727 728 729
	   { 0x000001b8, 0x000001b8, 0x00000084, 0x00000108, 0x000001b8 } },
	{ AR5K_PHY_OFDM_SELFCORR,
	   { 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05 } },
730
	{ 0xa230,
N
Nick Kossifidis 已提交
731
	   { 0x00000000, 0x00000000, 0x00000000, 0x00000108, 0x00000000 } },
732 733 734
};

/* Initial mode-specific settings for AR5212 + RF5111 (Written after ar5212_ini) */
N
Nick Kossifidis 已提交
735
static const struct ath5k_ini_mode rf5111_ini_mode_end[] = {
736
	{ AR5K_TXCFG,
N
Nick Kossifidis 已提交
737 738
	/*	a/XR	   aTurbo	  b	   g (DYN)     gTurbo     */
	   { 0x00008015, 0x00008015, 0x00008015, 0x00008015, 0x00008015 } },
739
	{ AR5K_USEC_5211,
N
Nick Kossifidis 已提交
740 741 742 743 744 745 746 747 748 749 750
	   { 0x128d8fa7, 0x09880fcf, 0x04e00f95, 0x12e00fab, 0x09880fcf } },
	{ AR5K_PHY_RF_CTL3,
	   { 0x0a020001, 0x0a020001, 0x05010100, 0x0a020001, 0x0a020001 } },
	{ AR5K_PHY_RF_CTL4,
	   { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
	{ AR5K_PHY_PA_CTL,
	   { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } },
	{ AR5K_PHY_GAIN,
	   { 0x0018da5a, 0x0018da5a, 0x0018ca69, 0x0018ca69, 0x0018ca69 } },
	{ AR5K_PHY_DESIRED_SIZE,
	   { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },
751
	{ AR5K_PHY_SIG,
N
Nick Kossifidis 已提交
752
	   { 0x7e800d2e, 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e, 0x7e800d2e } },
753
	{ AR5K_PHY_AGCCOARSE,
N
Nick Kossifidis 已提交
754 755 756
	   { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137615e } },
	{ AR5K_PHY_WEAK_OFDM_LOW_THR,
	   { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb080, 0x050cb080 } },
757
	{ AR5K_PHY_RX_DELAY,
N
Nick Kossifidis 已提交
758
	   { 0x00002710, 0x00002710, 0x0000157c, 0x00002af8, 0x00002710 } },
759
	{ AR5K_PHY_FRAME_CTL_5211,
N
Nick Kossifidis 已提交
760
	   { 0xf7b81020, 0xf7b81020, 0xf7b80d20, 0xf7b81020, 0xf7b81020 } },
761
	{ AR5K_PHY_GAIN_2GHZ,
N
Nick Kossifidis 已提交
762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781
	   { 0x642c416a, 0x642c416a, 0x6440416a, 0x6440416a, 0x6440416a } },
	{ AR5K_PHY_CCK_RX_CTL_4,
	   { 0x1883800a, 0x1883800a, 0x1873800a, 0x1883800a, 0x1883800a } },
};

static const struct ath5k_ini rf5111_ini_common_end[] = {
	{ AR5K_DCU_FP,		0x00000000 },
	{ AR5K_PHY_AGC, 	0x00000000 },
	{ AR5K_PHY_ADC_CTL, 	0x00022ffe },
	{ 0x983c, 		0x00020100 },
	{ AR5K_PHY_GAIN_OFFSET,	0x1284613c },
	{ AR5K_PHY_PAPD_PROBE,	0x00004883 },
	{ 0x9940,		0x00000004 },
	{ 0x9958,		0x000000ff },
	{ 0x9974,		0x00000000 },
	{ AR5K_PHY_SPENDING,	0x00000018 },
	{ AR5K_PHY_CCKTXCTL,	0x00000000 },
	{ AR5K_PHY_CCK_CROSSCORR, 0xd03e6788 },
	{ AR5K_PHY_DAG_CCK_CTL,	0x000001b5 },
	{ 0xa23c,		0x13c889af },
782 783 784
};

/* Initial mode-specific settings for AR5212 + RF5112 (Written after ar5212_ini) */
N
Nick Kossifidis 已提交
785
static const struct ath5k_ini_mode rf5112_ini_mode_end[] = {
786
	{ AR5K_TXCFG,
N
Nick Kossifidis 已提交
787 788
	/*	a/XR	   aTurbo	  b	   g (DYN)     gTurbo     */
	   { 0x00008015, 0x00008015, 0x00008015, 0x00008015, 0x00008015 } },
789
	{ AR5K_USEC_5211,
N
Nick Kossifidis 已提交
790 791 792 793 794 795 796 797 798 799 800
	   { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } },
	{ AR5K_PHY_RF_CTL3,
	   { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } },
	{ AR5K_PHY_RF_CTL4,
	   { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
	{ AR5K_PHY_PA_CTL,
	   { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } },
	{ AR5K_PHY_GAIN,
	   { 0x0018da6d, 0x0018da6d, 0x0018ca75, 0x0018ca75, 0x0018ca75 } },
	{ AR5K_PHY_DESIRED_SIZE,
	   { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },
801
	{ AR5K_PHY_SIG,
N
Nick Kossifidis 已提交
802
	   { 0x7e800d2e, 0x7e800d2e, 0x7ee80d2e, 0x7ee80d2e, 0x7ee80d2e } },
803
	{ AR5K_PHY_AGCCOARSE,
N
Nick Kossifidis 已提交
804 805 806
	   { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e } },
	{ AR5K_PHY_WEAK_OFDM_LOW_THR,
	   { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } },
807
	{ AR5K_PHY_RX_DELAY,
N
Nick Kossifidis 已提交
808
	   { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } },
809
	{ AR5K_PHY_FRAME_CTL_5211,
N
Nick Kossifidis 已提交
810
	   { 0xf7b81020, 0xf7b81020, 0xf7b80d10, 0xf7b81010, 0xf7b81010 } },
811
	{ AR5K_PHY_CCKTXCTL,
N
Nick Kossifidis 已提交
812 813 814
	   { 0x00000000, 0x00000000, 0x00000008, 0x00000008, 0x00000008 } },
	{ AR5K_PHY_CCK_CROSSCORR,
	   { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
815
	{ AR5K_PHY_GAIN_2GHZ,
N
Nick Kossifidis 已提交
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832
	   { 0x642c0140, 0x642c0140, 0x6442c160, 0x6442c160, 0x6442c160 } },
	{ AR5K_PHY_CCK_RX_CTL_4,
	   { 0x1883800a, 0x1883800a, 0x1873800a, 0x1883800a, 0x1883800a } },
};

static const struct ath5k_ini rf5112_ini_common_end[] = {
	{ AR5K_DCU_FP,		0x00000000 },
	{ AR5K_PHY_AGC,		0x00000000 },
	{ AR5K_PHY_ADC_CTL,	0x00022ffe },
	{ 0x983c,		0x00020100 },
	{ AR5K_PHY_GAIN_OFFSET,	0x1284613c },
	{ AR5K_PHY_PAPD_PROBE,	0x00004882 },
	{ 0x9940,		0x00000004 },
	{ 0x9958,		0x000000ff },
	{ 0x9974,		0x00000000 },
	{ AR5K_PHY_DAG_CCK_CTL,	0x000001b5 },
	{ 0xa23c,		0x13c889af },
833 834 835 836 837
};

/* Initial mode-specific settings for RF5413/5414 (Written after ar5212_ini) */
static const struct ath5k_ini_mode rf5413_ini_mode_end[] = {
	{ AR5K_TXCFG,
N
Nick Kossifidis 已提交
838 839
	/*	a/XR	   aTurbo	  b	   g (DYN)     gTurbo     */
	   { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } },
840
	{ AR5K_USEC_5211,
N
Nick Kossifidis 已提交
841 842 843 844 845 846 847 848 849 850 851
	   { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } },
	{ AR5K_PHY_RF_CTL3,
	   { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } },
	{ AR5K_PHY_RF_CTL4,
	   { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
	{ AR5K_PHY_PA_CTL,
	   { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } },
	{ AR5K_PHY_GAIN,
	   { 0x0018fa61, 0x0018fa61, 0x001a1a63, 0x001a1a63, 0x001a1a63 } },
	{ AR5K_PHY_DESIRED_SIZE,
	   { 0x0c98b4e0, 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da, 0x0c98b0da } },
852
	{ AR5K_PHY_SIG,
N
Nick Kossifidis 已提交
853
	   { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } },
854
	{ AR5K_PHY_AGCCOARSE,
N
Nick Kossifidis 已提交
855 856 857
	   { 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e } },
	{ AR5K_PHY_WEAK_OFDM_LOW_THR,
	   { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } },
858
	{ AR5K_PHY_RX_DELAY,
N
Nick Kossifidis 已提交
859
	   { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } },
860
	{ AR5K_PHY_FRAME_CTL_5211,
N
Nick Kossifidis 已提交
861
	   { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } },
862
	{ AR5K_PHY_CCKTXCTL,
N
Nick Kossifidis 已提交
863 864 865
	   { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
	{ AR5K_PHY_CCK_CROSSCORR,
	   { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
866
	{ AR5K_PHY_GAIN_2GHZ,
N
Nick Kossifidis 已提交
867 868 869
	   { 0x002ec1e0, 0x002ec1e0, 0x002ac120, 0x002ac120, 0x002ac120 } },
	{ AR5K_PHY_CCK_RX_CTL_4,
	   { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } },
870
	{ 0xa300,
N
Nick Kossifidis 已提交
871
	   { 0x18010000, 0x18010000, 0x18010000, 0x18010000, 0x18010000 } },
872
	{ 0xa304,
N
Nick Kossifidis 已提交
873
	   { 0x30032602, 0x30032602, 0x30032602, 0x30032602, 0x30032602 } },
874
	{ 0xa308,
N
Nick Kossifidis 已提交
875
	   { 0x48073e06, 0x48073e06, 0x48073e06, 0x48073e06, 0x48073e06 } },
876
	{ 0xa30c,
N
Nick Kossifidis 已提交
877
	   { 0x560b4c0a, 0x560b4c0a, 0x560b4c0a, 0x560b4c0a, 0x560b4c0a } },
878
	{ 0xa310,
N
Nick Kossifidis 已提交
879
	   { 0x641a600f, 0x641a600f, 0x641a600f, 0x641a600f, 0x641a600f } },
880
	{ 0xa314,
N
Nick Kossifidis 已提交
881
	   { 0x784f6e1b, 0x784f6e1b, 0x784f6e1b, 0x784f6e1b, 0x784f6e1b } },
882
	{ 0xa318,
N
Nick Kossifidis 已提交
883
	   { 0x868f7c5a, 0x868f7c5a, 0x868f7c5a, 0x868f7c5a, 0x868f7c5a } },
884
	{ 0xa31c,
N
Nick Kossifidis 已提交
885
	   { 0x90cf865b, 0x90cf865b, 0x8ecf865b, 0x8ecf865b, 0x8ecf865b } },
886
	{ 0xa320,
N
Nick Kossifidis 已提交
887
	   { 0x9d4f970f, 0x9d4f970f, 0x9b4f970f, 0x9b4f970f, 0x9b4f970f } },
888
	{ 0xa324,
N
Nick Kossifidis 已提交
889
	   { 0xa7cfa38f, 0xa7cfa38f, 0xa3cf9f8f, 0xa3cf9f8f, 0xa3cf9f8f } },
890
	{ 0xa328,
N
Nick Kossifidis 已提交
891
	   { 0xb55faf1f, 0xb55faf1f, 0xb35faf1f, 0xb35faf1f, 0xb35faf1f } },
892
	{ 0xa32c,
N
Nick Kossifidis 已提交
893
	   { 0xbddfb99f, 0xbddfb99f, 0xbbdfb99f, 0xbbdfb99f, 0xbbdfb99f } },
894
	{ 0xa330,
N
Nick Kossifidis 已提交
895
	   { 0xcb7fc53f, 0xcb7fc53f, 0xcb7fc73f, 0xcb7fc73f, 0xcb7fc73f } },
896
	{ 0xa334,
N
Nick Kossifidis 已提交
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970
	   { 0xd5ffd1bf, 0xd5ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf } },
};

static const struct ath5k_ini rf5413_ini_common_end[] = {
	{ AR5K_DCU_FP,		0x000003e0 },
	{ AR5K_5414_CBCFG,	0x00000010 },
	{ AR5K_SEQ_MASK,	0x0000000f },
	{ 0x809c,		0x00000000 },
	{ 0x80a0,		0x00000000 },
	{ AR5K_MIC_QOS_CTL,	0x00000000 },
	{ AR5K_MIC_QOS_SEL,	0x00000000 },
	{ AR5K_MISC_MODE,	0x00000000 },
	{ AR5K_OFDM_FIL_CNT,	0x00000000 },
	{ AR5K_CCK_FIL_CNT,	0x00000000 },
	{ AR5K_PHYERR_CNT1,	0x00000000 },
	{ AR5K_PHYERR_CNT1_MASK, 0x00000000 },
	{ AR5K_PHYERR_CNT2,	0x00000000 },
	{ AR5K_PHYERR_CNT2_MASK, 0x00000000 },
	{ AR5K_TSF_THRES,	0x00000000 },
	{ 0x8140,		0x800003f9 },
	{ 0x8144,		0x00000000 },
	{ AR5K_PHY_AGC,		0x00000000 },
	{ AR5K_PHY_ADC_CTL,	0x0000a000 },
	{ 0x983c,		0x00200400 },
	{ AR5K_PHY_GAIN_OFFSET, 0x1284233c },
	{ AR5K_PHY_SCR,		0x0000001f },
	{ AR5K_PHY_SLMT,	0x00000080 },
	{ AR5K_PHY_SCAL,	0x0000000e },
	{ 0x9958,		0x00081fff },
	{ AR5K_PHY_TIMING_7,	0x00000000 },
	{ AR5K_PHY_TIMING_8,	0x02800000 },
	{ AR5K_PHY_TIMING_11,	0x00000000 },
	{ AR5K_PHY_HEAVY_CLIP_ENABLE, 0x00000000 },
	{ 0x99e4,		0xaaaaaaaa },
	{ 0x99e8,		0x3c466478 },
	{ 0x99ec,		0x000000aa },
	{ AR5K_PHY_SCLOCK,	0x0000000c },
	{ AR5K_PHY_SDELAY,	0x000000ff },
	{ AR5K_PHY_SPENDING,	0x00000014 },
	{ AR5K_PHY_DAG_CCK_CTL, 0x000009b5 },
	{ 0xa23c,		0x93c889af },
	{ AR5K_PHY_FAST_ADC,	0x00000001 },
	{ 0xa250,		0x0000a000 },
	{ AR5K_PHY_BLUETOOTH,	0x00000000 },
	{ AR5K_PHY_TPC_RG1,	0x0cc75380 },
	{ 0xa25c,		0x0f0f0f01 },
	{ 0xa260,		0x5f690f01 },
	{ 0xa264,		0x00418a11 },
	{ 0xa268,		0x00000000 },
	{ AR5K_PHY_TPC_RG5,	0x0c30c16a },
	{ 0xa270, 0x00820820 },
	{ 0xa274, 0x081b7caa },
	{ 0xa278, 0x1ce739ce },
	{ 0xa27c, 0x051701ce },
	{ 0xa338, 0x00000000 },
	{ 0xa33c, 0x00000000 },
	{ 0xa340, 0x00000000 },
	{ 0xa344, 0x00000000 },
	{ 0xa348, 0x3fffffff },
	{ 0xa34c, 0x3fffffff },
	{ 0xa350, 0x3fffffff },
	{ 0xa354, 0x0003ffff },
	{ 0xa358, 0x79a8aa1f },
	{ 0xa35c, 0x066c420f },
	{ 0xa360, 0x0f282207 },
	{ 0xa364, 0x17601685 },
	{ 0xa368, 0x1f801104 },
	{ 0xa36c, 0x37a00c03 },
	{ 0xa370, 0x3fc40883 },
	{ 0xa374, 0x57c00803 },
	{ 0xa378, 0x5fd80682 },
	{ 0xa37c, 0x7fe00482 },
	{ 0xa380, 0x7f3c7bba },
	{ 0xa384, 0xf3307ff0 },
971 972
};

973
/* Initial mode-specific settings for RF2413/2414 (Written after ar5212_ini) */
N
Nick Kossifidis 已提交
974
/* XXX: a mode ? */
975 976
static const struct ath5k_ini_mode rf2413_ini_mode_end[] = {
	{ AR5K_TXCFG,
N
Nick Kossifidis 已提交
977 978
	/*	a/XR	   aTurbo	  b	   g (DYN)     gTurbo     */
	   { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } },
979
	{ AR5K_USEC_5211,
N
Nick Kossifidis 已提交
980 981 982 983 984 985 986 987 988 989 990
	   { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } },
	{ AR5K_PHY_RF_CTL3,
	   { 0x0a020001, 0x0a020001, 0x05020000, 0x0a020001, 0x0a020001 } },
	{ AR5K_PHY_RF_CTL4,
	   { 0x00000e00, 0x00000e00, 0x00000e00, 0x00000e00, 0x00000e00 } },
	{ AR5K_PHY_PA_CTL,
	   { 0x00000002, 0x00000002, 0x0000000a, 0x0000000a, 0x0000000a } },
	{ AR5K_PHY_GAIN,
	   { 0x0018da6d, 0x0018da6d, 0x001a6a64, 0x001a6a64, 0x001a6a64 } },
	{ AR5K_PHY_DESIRED_SIZE,
	   { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b0da, 0x0c98b0da, 0x0de8b0da } },
991
	{ AR5K_PHY_SIG,
N
Nick Kossifidis 已提交
992
	   { 0x7e800d2e, 0x7e800d2e, 0x7ee80d2e, 0x7ec80d2e, 0x7e800d2e } },
993
	{ AR5K_PHY_AGCCOARSE,
N
Nick Kossifidis 已提交
994 995 996
	   { 0x3137665e, 0x3137665e, 0x3137665e, 0x3139605e, 0x3137665e } },
	{ AR5K_PHY_WEAK_OFDM_LOW_THR,
	   { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } },
997
	{ AR5K_PHY_RX_DELAY,
N
Nick Kossifidis 已提交
998
	   { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } },
999
	{ AR5K_PHY_FRAME_CTL_5211,
N
Nick Kossifidis 已提交
1000
	   { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } },
1001
	{ AR5K_PHY_CCKTXCTL,
N
Nick Kossifidis 已提交
1002 1003 1004
	   { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
	{ AR5K_PHY_CCK_CROSSCORR,
	   { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
1005
	{ AR5K_PHY_GAIN_2GHZ,
N
Nick Kossifidis 已提交
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092
	   { 0x002c0140, 0x002c0140, 0x0042c140, 0x0042c140, 0x0042c140 } },
	{ AR5K_PHY_CCK_RX_CTL_4,
	   { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } },
};

static const struct ath5k_ini rf2413_ini_common_end[] = {
	{ AR5K_DCU_FP,		0x000003e0 },
	{ AR5K_SEQ_MASK,	0x0000000f },
	{ AR5K_MIC_QOS_CTL,	0x00000000 },
	{ AR5K_MIC_QOS_SEL,	0x00000000 },
	{ AR5K_MISC_MODE,	0x00000000 },
	{ AR5K_OFDM_FIL_CNT,	0x00000000 },
	{ AR5K_CCK_FIL_CNT,	0x00000000 },
	{ AR5K_PHYERR_CNT1,	0x00000000 },
	{ AR5K_PHYERR_CNT1_MASK, 0x00000000 },
	{ AR5K_PHYERR_CNT2,	0x00000000 },
	{ AR5K_PHYERR_CNT2_MASK, 0x00000000 },
	{ AR5K_TSF_THRES,	0x00000000 },
	{ 0x8140,		0x800000a8 },
	{ 0x8144,		0x00000000 },
	{ AR5K_PHY_AGC,		0x00000000 },
	{ AR5K_PHY_ADC_CTL,	0x0000a000 },
	{ 0x983c,		0x00200400 },
	{ AR5K_PHY_GAIN_OFFSET,	0x1284233c },
	{ AR5K_PHY_SCR,		0x0000001f },
	{ AR5K_PHY_SLMT,	0x00000080 },
	{ AR5K_PHY_SCAL,	0x0000000e },
	{ 0x9958,		0x000000ff },
	{ AR5K_PHY_TIMING_7,	0x00000000 },
	{ AR5K_PHY_TIMING_8,	0x02800000 },
	{ AR5K_PHY_TIMING_11,	0x00000000 },
	{ AR5K_PHY_HEAVY_CLIP_ENABLE, 0x00000000 },
	{ 0x99e4,		0xaaaaaaaa },
	{ 0x99e8,		0x3c466478 },
	{ 0x99ec,		0x000000aa },
	{ AR5K_PHY_SCLOCK,	0x0000000c },
	{ AR5K_PHY_SDELAY,	0x000000ff },
	{ AR5K_PHY_SPENDING,	0x00000014 },
	{ AR5K_PHY_DAG_CCK_CTL,	0x000009b5 },
	{ 0xa23c,		0x93c889af },
	{ AR5K_PHY_FAST_ADC,	0x00000001 },
	{ 0xa250,		0x0000a000 },
	{ AR5K_PHY_BLUETOOTH,	0x00000000 },
	{ AR5K_PHY_TPC_RG1,	0x0cc75380 },
	{ 0xa25c,		0x0f0f0f01 },
	{ 0xa260,		0x5f690f01 },
	{ 0xa264,		0x00418a11 },
	{ 0xa268,		0x00000000 },
	{ AR5K_PHY_TPC_RG5,	0x0c30c16a },
	{ 0xa270, 0x00820820 },
	{ 0xa274, 0x001b7caa },
	{ 0xa278, 0x1ce739ce },
	{ 0xa27c, 0x051701ce },
	{ 0xa300, 0x18010000 },
	{ 0xa304, 0x30032602 },
	{ 0xa308, 0x48073e06 },
	{ 0xa30c, 0x560b4c0a },
	{ 0xa310, 0x641a600f },
	{ 0xa314, 0x784f6e1b },
	{ 0xa318, 0x868f7c5a },
	{ 0xa31c, 0x8ecf865b },
	{ 0xa320, 0x9d4f970f },
	{ 0xa324, 0xa5cfa18f },
	{ 0xa328, 0xb55faf1f },
	{ 0xa32c, 0xbddfb99f },
	{ 0xa330, 0xcd7fc73f },
	{ 0xa334, 0xd5ffd1bf },
	{ 0xa338, 0x00000000 },
	{ 0xa33c, 0x00000000 },
	{ 0xa340, 0x00000000 },
	{ 0xa344, 0x00000000 },
	{ 0xa348, 0x3fffffff },
	{ 0xa34c, 0x3fffffff },
	{ 0xa350, 0x3fffffff },
	{ 0xa354, 0x0003ffff },
	{ 0xa358, 0x79a8aa1f },
	{ 0xa35c, 0x066c420f },
	{ 0xa360, 0x0f282207 },
	{ 0xa364, 0x17601685 },
	{ 0xa368, 0x1f801104 },
	{ 0xa36c, 0x37a00c03 },
	{ 0xa370, 0x3fc40883 },
	{ 0xa374, 0x57c00803 },
	{ 0xa378, 0x5fd80682 },
	{ 0xa37c, 0x7fe00482 },
	{ 0xa380, 0x7f3c7bba },
	{ 0xa384, 0xf3307ff0 },
1093 1094
};

N
Nick Kossifidis 已提交
1095
/* Initial mode-specific settings for RF2425 (Written after ar5212_ini) */
N
Nick Kossifidis 已提交
1096
/* XXX: a mode ? */
N
Nick Kossifidis 已提交
1097 1098
static const struct ath5k_ini_mode rf2425_ini_mode_end[] = {
	{ AR5K_TXCFG,
N
Nick Kossifidis 已提交
1099 1100
	/*	a/XR	   aTurbo	  b	   g (DYN)     gTurbo     */
	   { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } },
N
Nick Kossifidis 已提交
1101
	{ AR5K_USEC_5211,
N
Nick Kossifidis 已提交
1102
	   { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } },
N
Nick Kossifidis 已提交
1103
	{ AR5K_PHY_TURBO,
N
Nick Kossifidis 已提交
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116
	   { 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000001 } },
	{ AR5K_PHY_RF_CTL3,
	   { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } },
	{ AR5K_PHY_RF_CTL4,
	   { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
	{ AR5K_PHY_PA_CTL,
	   { 0x00000003, 0x00000003, 0x0000000b, 0x0000000b, 0x0000000b } },
	{ AR5K_PHY_SETTLING,
	   { 0x1372161c, 0x13721c25, 0x13721722, 0x13721422, 0x13721c25 } },
	{ AR5K_PHY_GAIN,
	   { 0x0018fa61, 0x0018fa61, 0x00199a65, 0x00199a65, 0x00199a65 } },
	{ AR5K_PHY_DESIRED_SIZE,
	   { 0x0c98b4e0, 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da, 0x0c98b0da } },
N
Nick Kossifidis 已提交
1117
	{ AR5K_PHY_SIG,
N
Nick Kossifidis 已提交
1118
	   { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } },
N
Nick Kossifidis 已提交
1119
	{ AR5K_PHY_AGCCOARSE,
N
Nick Kossifidis 已提交
1120 1121 1122
	   { 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e } },
	{ AR5K_PHY_WEAK_OFDM_LOW_THR,
	   { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } },
N
Nick Kossifidis 已提交
1123
	{ AR5K_PHY_RX_DELAY,
N
Nick Kossifidis 已提交
1124
	   { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } },
N
Nick Kossifidis 已提交
1125
	{ AR5K_PHY_FRAME_CTL_5211,
N
Nick Kossifidis 已提交
1126
	   { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } },
N
Nick Kossifidis 已提交
1127
	{ AR5K_PHY_CCKTXCTL,
N
Nick Kossifidis 已提交
1128 1129 1130
	   { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
	{ AR5K_PHY_CCK_CROSSCORR,
	   { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
N
Nick Kossifidis 已提交
1131
	{ AR5K_PHY_GAIN_2GHZ,
N
Nick Kossifidis 已提交
1132 1133 1134
	   { 0x00000140, 0x00000140, 0x0052c140, 0x0052c140, 0x0052c140 } },
	{ AR5K_PHY_CCK_RX_CTL_4,
	   { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } },
N
Nick Kossifidis 已提交
1135
	{ 0xa324,
N
Nick Kossifidis 已提交
1136
	   { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
N
Nick Kossifidis 已提交
1137
	{ 0xa328,
N
Nick Kossifidis 已提交
1138
	   { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
N
Nick Kossifidis 已提交
1139
	{ 0xa32c,
N
Nick Kossifidis 已提交
1140
	   { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
N
Nick Kossifidis 已提交
1141
	{ 0xa330,
N
Nick Kossifidis 已提交
1142
	   { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
N
Nick Kossifidis 已提交
1143
	{ 0xa334,
N
Nick Kossifidis 已提交
1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224
	   { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
};

static const struct ath5k_ini rf2425_ini_common_end[] = {
	{ AR5K_DCU_FP,		0x000003e0 },
	{ AR5K_SEQ_MASK,	0x0000000f },
	{ 0x809c,		0x00000000 },
	{ 0x80a0,		0x00000000 },
	{ AR5K_MIC_QOS_CTL,	0x00000000 },
	{ AR5K_MIC_QOS_SEL,	0x00000000 },
	{ AR5K_MISC_MODE,	0x00000000 },
	{ AR5K_OFDM_FIL_CNT,	0x00000000 },
	{ AR5K_CCK_FIL_CNT,	0x00000000 },
	{ AR5K_PHYERR_CNT1,	0x00000000 },
	{ AR5K_PHYERR_CNT1_MASK, 0x00000000 },
	{ AR5K_PHYERR_CNT2,	0x00000000 },
	{ AR5K_PHYERR_CNT2_MASK, 0x00000000 },
	{ AR5K_TSF_THRES,	0x00000000 },
	{ 0x8140,		0x800003f9 },
	{ 0x8144,		0x00000000 },
	{ AR5K_PHY_AGC,		0x00000000 },
	{ AR5K_PHY_ADC_CTL,	0x0000a000 },
	{ 0x983c,		0x00200400 },
	{ AR5K_PHY_GAIN_OFFSET, 0x1284233c },
	{ AR5K_PHY_SCR,		0x0000001f },
	{ AR5K_PHY_SLMT,	0x00000080 },
	{ AR5K_PHY_SCAL,	0x0000000e },
	{ 0x9958,		0x00081fff },
	{ AR5K_PHY_TIMING_7,	0x00000000 },
	{ AR5K_PHY_TIMING_8,	0x02800000 },
	{ AR5K_PHY_TIMING_11,	0x00000000 },
	{ 0x99dc,		0xfebadbe8 },
	{ AR5K_PHY_HEAVY_CLIP_ENABLE, 0x00000000 },
	{ 0x99e4,		0xaaaaaaaa },
	{ 0x99e8,		0x3c466478 },
	{ 0x99ec,		0x000000aa },
	{ AR5K_PHY_SCLOCK,	0x0000000c },
	{ AR5K_PHY_SDELAY,	0x000000ff },
	{ AR5K_PHY_SPENDING,	0x00000014 },
	{ AR5K_PHY_DAG_CCK_CTL,	0x000009b5 },
	{ AR5K_PHY_TXPOWER_RATE3, 0x20202020 },
	{ AR5K_PHY_TXPOWER_RATE4, 0x20202020 },
	{ 0xa23c,		0x93c889af },
	{ AR5K_PHY_FAST_ADC,	0x00000001 },
	{ 0xa250,		0x0000a000 },
	{ AR5K_PHY_BLUETOOTH,	0x00000000 },
	{ AR5K_PHY_TPC_RG1,	0x0cc75380 },
	{ 0xa25c,		0x0f0f0f01 },
	{ 0xa260,		0x5f690f01 },
	{ 0xa264,		0x00418a11 },
	{ 0xa268,		0x00000000 },
	{ AR5K_PHY_TPC_RG5,	0x0c30c166 },
	{ 0xa270, 0x00820820 },
	{ 0xa274, 0x081a3caa },
	{ 0xa278, 0x1ce739ce },
	{ 0xa27c, 0x051701ce },
	{ 0xa300, 0x16010000 },
	{ 0xa304, 0x2c032402 },
	{ 0xa308, 0x48433e42 },
	{ 0xa30c, 0x5a0f500b },
	{ 0xa310, 0x6c4b624a },
	{ 0xa314, 0x7e8b748a },
	{ 0xa318, 0x96cf8ccb },
	{ 0xa31c, 0xa34f9d0f },
	{ 0xa320, 0xa7cfa58f },
	{ 0xa348, 0x3fffffff },
	{ 0xa34c, 0x3fffffff },
	{ 0xa350, 0x3fffffff },
	{ 0xa354, 0x0003ffff },
	{ 0xa358, 0x79a8aa1f },
	{ 0xa35c, 0x066c420f },
	{ 0xa360, 0x0f282207 },
	{ 0xa364, 0x17601685 },
	{ 0xa368, 0x1f801104 },
	{ 0xa36c, 0x37a00c03 },
	{ 0xa370, 0x3fc40883 },
	{ 0xa374, 0x57c00803 },
	{ 0xa378, 0x5fd80682 },
	{ 0xa37c, 0x7fe00482 },
	{ 0xa380, 0x7f3c7bba },
	{ 0xa384, 0xf3307ff0 },
N
Nick Kossifidis 已提交
1225 1226
};

1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299
/*
 * Initial BaseBand Gain settings for RF5111/5112 (AR5210 comes with
 * RF5110 only so initial BB Gain settings are included in AR5K_AR5210_INI)
 */

/* RF5111 Initial BaseBand Gain settings */
static const struct ath5k_ini rf5111_ini_bbgain[] = {
	{ AR5K_BB_GAIN(0), 0x00000000 },
	{ AR5K_BB_GAIN(1), 0x00000020 },
	{ AR5K_BB_GAIN(2), 0x00000010 },
	{ AR5K_BB_GAIN(3), 0x00000030 },
	{ AR5K_BB_GAIN(4), 0x00000008 },
	{ AR5K_BB_GAIN(5), 0x00000028 },
	{ AR5K_BB_GAIN(6), 0x00000004 },
	{ AR5K_BB_GAIN(7), 0x00000024 },
	{ AR5K_BB_GAIN(8), 0x00000014 },
	{ AR5K_BB_GAIN(9), 0x00000034 },
	{ AR5K_BB_GAIN(10), 0x0000000c },
	{ AR5K_BB_GAIN(11), 0x0000002c },
	{ AR5K_BB_GAIN(12), 0x00000002 },
	{ AR5K_BB_GAIN(13), 0x00000022 },
	{ AR5K_BB_GAIN(14), 0x00000012 },
	{ AR5K_BB_GAIN(15), 0x00000032 },
	{ AR5K_BB_GAIN(16), 0x0000000a },
	{ AR5K_BB_GAIN(17), 0x0000002a },
	{ AR5K_BB_GAIN(18), 0x00000006 },
	{ AR5K_BB_GAIN(19), 0x00000026 },
	{ AR5K_BB_GAIN(20), 0x00000016 },
	{ AR5K_BB_GAIN(21), 0x00000036 },
	{ AR5K_BB_GAIN(22), 0x0000000e },
	{ AR5K_BB_GAIN(23), 0x0000002e },
	{ AR5K_BB_GAIN(24), 0x00000001 },
	{ AR5K_BB_GAIN(25), 0x00000021 },
	{ AR5K_BB_GAIN(26), 0x00000011 },
	{ AR5K_BB_GAIN(27), 0x00000031 },
	{ AR5K_BB_GAIN(28), 0x00000009 },
	{ AR5K_BB_GAIN(29), 0x00000029 },
	{ AR5K_BB_GAIN(30), 0x00000005 },
	{ AR5K_BB_GAIN(31), 0x00000025 },
	{ AR5K_BB_GAIN(32), 0x00000015 },
	{ AR5K_BB_GAIN(33), 0x00000035 },
	{ AR5K_BB_GAIN(34), 0x0000000d },
	{ AR5K_BB_GAIN(35), 0x0000002d },
	{ AR5K_BB_GAIN(36), 0x00000003 },
	{ AR5K_BB_GAIN(37), 0x00000023 },
	{ AR5K_BB_GAIN(38), 0x00000013 },
	{ AR5K_BB_GAIN(39), 0x00000033 },
	{ AR5K_BB_GAIN(40), 0x0000000b },
	{ AR5K_BB_GAIN(41), 0x0000002b },
	{ AR5K_BB_GAIN(42), 0x0000002b },
	{ AR5K_BB_GAIN(43), 0x0000002b },
	{ AR5K_BB_GAIN(44), 0x0000002b },
	{ AR5K_BB_GAIN(45), 0x0000002b },
	{ AR5K_BB_GAIN(46), 0x0000002b },
	{ AR5K_BB_GAIN(47), 0x0000002b },
	{ AR5K_BB_GAIN(48), 0x0000002b },
	{ AR5K_BB_GAIN(49), 0x0000002b },
	{ AR5K_BB_GAIN(50), 0x0000002b },
	{ AR5K_BB_GAIN(51), 0x0000002b },
	{ AR5K_BB_GAIN(52), 0x0000002b },
	{ AR5K_BB_GAIN(53), 0x0000002b },
	{ AR5K_BB_GAIN(54), 0x0000002b },
	{ AR5K_BB_GAIN(55), 0x0000002b },
	{ AR5K_BB_GAIN(56), 0x0000002b },
	{ AR5K_BB_GAIN(57), 0x0000002b },
	{ AR5K_BB_GAIN(58), 0x0000002b },
	{ AR5K_BB_GAIN(59), 0x0000002b },
	{ AR5K_BB_GAIN(60), 0x0000002b },
	{ AR5K_BB_GAIN(61), 0x0000002b },
	{ AR5K_BB_GAIN(62), 0x00000002 },
	{ AR5K_BB_GAIN(63), 0x00000016 },
};

N
Nick Kossifidis 已提交
1300
/* RF5112 Initial BaseBand Gain settings (Same for RF5413/5414+) */
1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420
static const struct ath5k_ini rf5112_ini_bbgain[] = {
	{ AR5K_BB_GAIN(0), 0x00000000 },
	{ AR5K_BB_GAIN(1), 0x00000001 },
	{ AR5K_BB_GAIN(2), 0x00000002 },
	{ AR5K_BB_GAIN(3), 0x00000003 },
	{ AR5K_BB_GAIN(4), 0x00000004 },
	{ AR5K_BB_GAIN(5), 0x00000005 },
	{ AR5K_BB_GAIN(6), 0x00000008 },
	{ AR5K_BB_GAIN(7), 0x00000009 },
	{ AR5K_BB_GAIN(8), 0x0000000a },
	{ AR5K_BB_GAIN(9), 0x0000000b },
	{ AR5K_BB_GAIN(10), 0x0000000c },
	{ AR5K_BB_GAIN(11), 0x0000000d },
	{ AR5K_BB_GAIN(12), 0x00000010 },
	{ AR5K_BB_GAIN(13), 0x00000011 },
	{ AR5K_BB_GAIN(14), 0x00000012 },
	{ AR5K_BB_GAIN(15), 0x00000013 },
	{ AR5K_BB_GAIN(16), 0x00000014 },
	{ AR5K_BB_GAIN(17), 0x00000015 },
	{ AR5K_BB_GAIN(18), 0x00000018 },
	{ AR5K_BB_GAIN(19), 0x00000019 },
	{ AR5K_BB_GAIN(20), 0x0000001a },
	{ AR5K_BB_GAIN(21), 0x0000001b },
	{ AR5K_BB_GAIN(22), 0x0000001c },
	{ AR5K_BB_GAIN(23), 0x0000001d },
	{ AR5K_BB_GAIN(24), 0x00000020 },
	{ AR5K_BB_GAIN(25), 0x00000021 },
	{ AR5K_BB_GAIN(26), 0x00000022 },
	{ AR5K_BB_GAIN(27), 0x00000023 },
	{ AR5K_BB_GAIN(28), 0x00000024 },
	{ AR5K_BB_GAIN(29), 0x00000025 },
	{ AR5K_BB_GAIN(30), 0x00000028 },
	{ AR5K_BB_GAIN(31), 0x00000029 },
	{ AR5K_BB_GAIN(32), 0x0000002a },
	{ AR5K_BB_GAIN(33), 0x0000002b },
	{ AR5K_BB_GAIN(34), 0x0000002c },
	{ AR5K_BB_GAIN(35), 0x0000002d },
	{ AR5K_BB_GAIN(36), 0x00000030 },
	{ AR5K_BB_GAIN(37), 0x00000031 },
	{ AR5K_BB_GAIN(38), 0x00000032 },
	{ AR5K_BB_GAIN(39), 0x00000033 },
	{ AR5K_BB_GAIN(40), 0x00000034 },
	{ AR5K_BB_GAIN(41), 0x00000035 },
	{ AR5K_BB_GAIN(42), 0x00000035 },
	{ AR5K_BB_GAIN(43), 0x00000035 },
	{ AR5K_BB_GAIN(44), 0x00000035 },
	{ AR5K_BB_GAIN(45), 0x00000035 },
	{ AR5K_BB_GAIN(46), 0x00000035 },
	{ AR5K_BB_GAIN(47), 0x00000035 },
	{ AR5K_BB_GAIN(48), 0x00000035 },
	{ AR5K_BB_GAIN(49), 0x00000035 },
	{ AR5K_BB_GAIN(50), 0x00000035 },
	{ AR5K_BB_GAIN(51), 0x00000035 },
	{ AR5K_BB_GAIN(52), 0x00000035 },
	{ AR5K_BB_GAIN(53), 0x00000035 },
	{ AR5K_BB_GAIN(54), 0x00000035 },
	{ AR5K_BB_GAIN(55), 0x00000035 },
	{ AR5K_BB_GAIN(56), 0x00000035 },
	{ AR5K_BB_GAIN(57), 0x00000035 },
	{ AR5K_BB_GAIN(58), 0x00000035 },
	{ AR5K_BB_GAIN(59), 0x00000035 },
	{ AR5K_BB_GAIN(60), 0x00000035 },
	{ AR5K_BB_GAIN(61), 0x00000035 },
	{ AR5K_BB_GAIN(62), 0x00000010 },
	{ AR5K_BB_GAIN(63), 0x0000001a },
};


/*
 * Write initial register dump
 */
static void ath5k_hw_ini_registers(struct ath5k_hw *ah, unsigned int size,
		const struct ath5k_ini *ini_regs, bool change_channel)
{
	unsigned int i;

	/* Write initial registers */
	for (i = 0; i < size; i++) {
		/* On channel change there is
		 * no need to mess with PCU */
		if (change_channel &&
				ini_regs[i].ini_register >= AR5K_PCU_MIN &&
				ini_regs[i].ini_register <= AR5K_PCU_MAX)
			continue;

		switch (ini_regs[i].ini_mode) {
		case AR5K_INI_READ:
			/* Cleared on read */
			ath5k_hw_reg_read(ah, ini_regs[i].ini_register);
			break;
		case AR5K_INI_WRITE:
		default:
			AR5K_REG_WAIT(i);
			ath5k_hw_reg_write(ah, ini_regs[i].ini_value,
					ini_regs[i].ini_register);
		}
	}
}

static void ath5k_hw_ini_mode_registers(struct ath5k_hw *ah,
		unsigned int size, const struct ath5k_ini_mode *ini_mode,
		u8 mode)
{
	unsigned int i;

	for (i = 0; i < size; i++) {
		AR5K_REG_WAIT(i);
		ath5k_hw_reg_write(ah, ini_mode[i].mode_value[mode],
			(u32)ini_mode[i].mode_register);
	}

}

int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel)
{
	/*
	 * Write initial register settings
	 */

	/* For AR5212 and combatible */
J
John Daiker 已提交
1421
	if (ah->ah_version == AR5K_AR5212) {
1422 1423 1424 1425 1426 1427 1428 1429 1430

		/* First set of mode-specific settings */
		ath5k_hw_ini_mode_registers(ah,
			ARRAY_SIZE(ar5212_ini_mode_start),
			ar5212_ini_mode_start, mode);

		/*
		 * Write initial settings common for all modes
		 */
N
Nick Kossifidis 已提交
1431 1432
		ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5212_ini_common_start),
				ar5212_ini_common_start, change_channel);
1433 1434

		/* Second set of mode-specific settings */
N
Nick Kossifidis 已提交
1435 1436
		switch (ah->ah_radio) {
		case AR5K_RF5111:
1437

1438
			ath5k_hw_ini_mode_registers(ah,
N
Nick Kossifidis 已提交
1439 1440 1441 1442 1443 1444
					ARRAY_SIZE(rf5111_ini_mode_end),
					rf5111_ini_mode_end, mode);

			ath5k_hw_ini_registers(ah,
					ARRAY_SIZE(rf5111_ini_common_end),
					rf5111_ini_common_end, change_channel);
1445

1446 1447 1448 1449
			/* Baseband gain table */
			ath5k_hw_ini_registers(ah,
					ARRAY_SIZE(rf5111_ini_bbgain),
					rf5111_ini_bbgain, change_channel);
1450

N
Nick Kossifidis 已提交
1451 1452
			break;
		case AR5K_RF5112:
1453

1454
			ath5k_hw_ini_mode_registers(ah,
N
Nick Kossifidis 已提交
1455 1456 1457 1458 1459 1460
					ARRAY_SIZE(rf5112_ini_mode_end),
					rf5112_ini_mode_end, mode);

			ath5k_hw_ini_registers(ah,
					ARRAY_SIZE(rf5112_ini_common_end),
					rf5112_ini_common_end, change_channel);
1461

1462 1463 1464
			ath5k_hw_ini_registers(ah,
					ARRAY_SIZE(rf5112_ini_bbgain),
					rf5112_ini_bbgain, change_channel);
1465

N
Nick Kossifidis 已提交
1466 1467
			break;
		case AR5K_RF5413:
1468

1469 1470 1471
			ath5k_hw_ini_mode_registers(ah,
					ARRAY_SIZE(rf5413_ini_mode_end),
					rf5413_ini_mode_end, mode);
1472

N
Nick Kossifidis 已提交
1473 1474 1475 1476
			ath5k_hw_ini_registers(ah,
					ARRAY_SIZE(rf5413_ini_common_end),
					rf5413_ini_common_end, change_channel);

1477 1478 1479 1480
			ath5k_hw_ini_registers(ah,
					ARRAY_SIZE(rf5112_ini_bbgain),
					rf5112_ini_bbgain, change_channel);

N
Nick Kossifidis 已提交
1481 1482 1483
			break;
		case AR5K_RF2316:
		case AR5K_RF2413:
1484 1485 1486 1487 1488

			ath5k_hw_ini_mode_registers(ah,
					ARRAY_SIZE(rf2413_ini_mode_end),
					rf2413_ini_mode_end, mode);

1489
			ath5k_hw_ini_registers(ah,
N
Nick Kossifidis 已提交
1490 1491
					ARRAY_SIZE(rf2413_ini_common_end),
					rf2413_ini_common_end, change_channel);
N
Nick Kossifidis 已提交
1492

N
Nick Kossifidis 已提交
1493 1494 1495 1496 1497 1498
			/* Override settings from rf2413_ini_common_end */
			if (ah->ah_radio == AR5K_RF2316) {
				ath5k_hw_reg_write(ah, 0x00004000,
							AR5K_PHY_AGC);
				ath5k_hw_reg_write(ah, 0x081b7caa,
							0xa274);
N
Nick Kossifidis 已提交
1499 1500
			}

N
Nick Kossifidis 已提交
1501 1502 1503 1504 1505 1506
			ath5k_hw_ini_registers(ah,
					ARRAY_SIZE(rf5112_ini_bbgain),
					rf5112_ini_bbgain, change_channel);
			break;
		case AR5K_RF2317:
		case AR5K_RF2425:
N
Nick Kossifidis 已提交
1507 1508 1509 1510 1511

			ath5k_hw_ini_mode_registers(ah,
					ARRAY_SIZE(rf2425_ini_mode_end),
					rf2425_ini_mode_end, mode);

N
Nick Kossifidis 已提交
1512
			ath5k_hw_ini_registers(ah,
1513 1514
					ARRAY_SIZE(rf2425_ini_common_end),
					rf2425_ini_common_end, change_channel);
N
Nick Kossifidis 已提交
1515

N
Nick Kossifidis 已提交
1516 1517 1518
			ath5k_hw_ini_registers(ah,
					ARRAY_SIZE(rf5112_ini_bbgain),
					rf5112_ini_bbgain, change_channel);
N
Nick Kossifidis 已提交
1519 1520 1521
			break;
		default:
			return -EINVAL;
N
Nick Kossifidis 已提交
1522

1523
		}
N
Nick Kossifidis 已提交
1524

1525 1526 1527
	/* For AR5211 */
	} else if (ah->ah_version == AR5K_AR5211) {

1528 1529 1530 1531
		/* AR5K_MODE_11B */
		if (mode > 2) {
			ATH5K_ERR(ah->ah_sc,
				"unsupported channel mode: %d\n", mode);
1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557
			return -EINVAL;
		}

		/* Mode-specific settings */
		ath5k_hw_ini_mode_registers(ah, ARRAY_SIZE(ar5211_ini_mode),
				ar5211_ini_mode, mode);

		/*
		 * Write initial settings common for all modes
		 */
		ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5211_ini),
				ar5211_ini, change_channel);

		/* AR5211 only comes with 5111 */

		/* Baseband gain table */
		ath5k_hw_ini_registers(ah, ARRAY_SIZE(rf5111_ini_bbgain),
				rf5111_ini_bbgain, change_channel);
	/* For AR5210 (for mode settings check out ath5k_hw_reset_tx_queue) */
	} else if (ah->ah_version == AR5K_AR5210) {
		ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5210_ini),
				ar5210_ini, change_channel);
	}

	return 0;
}