aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath5k/initvals.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/initvals.c')
-rw-r--r--drivers/net/wireless/ath/ath5k/initvals.c75
1 files changed, 54 insertions, 21 deletions
diff --git a/drivers/net/wireless/ath/ath5k/initvals.c b/drivers/net/wireless/ath/ath5k/initvals.c
index 1ffecc0fd3ed..a1ea78e05b47 100644
--- a/drivers/net/wireless/ath/ath5k/initvals.c
+++ b/drivers/net/wireless/ath/ath5k/initvals.c
@@ -23,24 +23,27 @@
23#include "reg.h" 23#include "reg.h"
24#include "debug.h" 24#include "debug.h"
25 25
26/* 26/**
27 * Mode-independent initial register writes 27 * struct ath5k_ini - Mode-independent initial register writes
28 * @ini_register: Register address
29 * @ini_value: Default value
30 * @ini_mode: 0 to write 1 to read (and clear)
28 */ 31 */
29
30struct ath5k_ini { 32struct ath5k_ini {
31 u16 ini_register; 33 u16 ini_register;
32 u32 ini_value; 34 u32 ini_value;
33 35
34 enum { 36 enum {
35 AR5K_INI_WRITE = 0, /* Default */ 37 AR5K_INI_WRITE = 0, /* Default */
36 AR5K_INI_READ = 1, /* Cleared on read */ 38 AR5K_INI_READ = 1,
37 } ini_mode; 39 } ini_mode;
38}; 40};
39 41
40/* 42/**
41 * Mode specific initial register values 43 * struct ath5k_ini_mode - Mode specific initial register values
44 * @mode_register: Register address
45 * @mode_value: Set of values for each enum ath5k_driver_mode
42 */ 46 */
43
44struct ath5k_ini_mode { 47struct ath5k_ini_mode {
45 u16 mode_register; 48 u16 mode_register;
46 u32 mode_value[3]; 49 u32 mode_value[3];
@@ -386,11 +389,10 @@ static const struct ath5k_ini ar5211_ini[] = {
386 389
387/* Initial mode-specific settings for AR5211 390/* Initial mode-specific settings for AR5211
388 * 5211 supports OFDM-only g (draft g) but we 391 * 5211 supports OFDM-only g (draft g) but we
389 * need to test it ! 392 * need to test it ! */
390 */
391static const struct ath5k_ini_mode ar5211_ini_mode[] = { 393static const struct ath5k_ini_mode ar5211_ini_mode[] = {
392 { AR5K_TXCFG, 394 { AR5K_TXCFG,
393 /* A/XR B G */ 395 /* A B G */
394 { 0x00000015, 0x0000001d, 0x00000015 } }, 396 { 0x00000015, 0x0000001d, 0x00000015 } },
395 { AR5K_QUEUE_DFS_LOCAL_IFS(0), 397 { AR5K_QUEUE_DFS_LOCAL_IFS(0),
396 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 398 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
@@ -460,7 +462,7 @@ static const struct ath5k_ini_mode ar5211_ini_mode[] = {
460 { 0x00000010, 0x00000010, 0x00000010 } }, 462 { 0x00000010, 0x00000010, 0x00000010 } },
461}; 463};
462 464
463/* Initial register settings for AR5212 */ 465/* Initial register settings for AR5212 and newer chips */
464static const struct ath5k_ini ar5212_ini_common_start[] = { 466static const struct ath5k_ini ar5212_ini_common_start[] = {
465 { AR5K_RXDP, 0x00000000 }, 467 { AR5K_RXDP, 0x00000000 },
466 { AR5K_RXCFG, 0x00000005 }, 468 { AR5K_RXCFG, 0x00000005 },
@@ -724,7 +726,8 @@ static const struct ath5k_ini_mode ar5212_ini_mode_start[] = {
724 { 0x00000000, 0x00000000, 0x00000108 } }, 726 { 0x00000000, 0x00000000, 0x00000108 } },
725}; 727};
726 728
727/* Initial mode-specific settings for AR5212 + RF5111 (Written after ar5212_ini) */ 729/* Initial mode-specific settings for AR5212 + RF5111
730 * (Written after ar5212_ini) */
728static const struct ath5k_ini_mode rf5111_ini_mode_end[] = { 731static const struct ath5k_ini_mode rf5111_ini_mode_end[] = {
729 { AR5K_TXCFG, 732 { AR5K_TXCFG,
730 /* A/XR B G */ 733 /* A/XR B G */
@@ -757,6 +760,7 @@ static const struct ath5k_ini_mode rf5111_ini_mode_end[] = {
757 { 0x1883800a, 0x1873800a, 0x1883800a } }, 760 { 0x1883800a, 0x1873800a, 0x1883800a } },
758}; 761};
759 762
763/* Common for all modes */
760static const struct ath5k_ini rf5111_ini_common_end[] = { 764static const struct ath5k_ini rf5111_ini_common_end[] = {
761 { AR5K_DCU_FP, 0x00000000 }, 765 { AR5K_DCU_FP, 0x00000000 },
762 { AR5K_PHY_AGC, 0x00000000 }, 766 { AR5K_PHY_AGC, 0x00000000 },
@@ -774,7 +778,9 @@ static const struct ath5k_ini rf5111_ini_common_end[] = {
774 { 0xa23c, 0x13c889af }, 778 { 0xa23c, 0x13c889af },
775}; 779};
776 780
777/* Initial mode-specific settings for AR5212 + RF5112 (Written after ar5212_ini) */ 781
782/* Initial mode-specific settings for AR5212 + RF5112
783 * (Written after ar5212_ini) */
778static const struct ath5k_ini_mode rf5112_ini_mode_end[] = { 784static const struct ath5k_ini_mode rf5112_ini_mode_end[] = {
779 { AR5K_TXCFG, 785 { AR5K_TXCFG,
780 /* A/XR B G */ 786 /* A/XR B G */
@@ -825,7 +831,9 @@ static const struct ath5k_ini rf5112_ini_common_end[] = {
825 { 0xa23c, 0x13c889af }, 831 { 0xa23c, 0x13c889af },
826}; 832};
827 833
828/* Initial mode-specific settings for RF5413/5414 (Written after ar5212_ini) */ 834
835/* Initial mode-specific settings for RF5413/5414
836 * (Written after ar5212_ini) */
829static const struct ath5k_ini_mode rf5413_ini_mode_end[] = { 837static const struct ath5k_ini_mode rf5413_ini_mode_end[] = {
830 { AR5K_TXCFG, 838 { AR5K_TXCFG,
831 /* A/XR B G */ 839 /* A/XR B G */
@@ -963,7 +971,8 @@ static const struct ath5k_ini rf5413_ini_common_end[] = {
963 { 0xa384, 0xf3307ff0 }, 971 { 0xa384, 0xf3307ff0 },
964}; 972};
965 973
966/* Initial mode-specific settings for RF2413/2414 (Written after ar5212_ini) */ 974/* Initial mode-specific settings for RF2413/2414
975 * (Written after ar5212_ini) */
967/* XXX: a mode ? */ 976/* XXX: a mode ? */
968static const struct ath5k_ini_mode rf2413_ini_mode_end[] = { 977static const struct ath5k_ini_mode rf2413_ini_mode_end[] = {
969 { AR5K_TXCFG, 978 { AR5K_TXCFG,
@@ -1085,7 +1094,8 @@ static const struct ath5k_ini rf2413_ini_common_end[] = {
1085 { 0xa384, 0xf3307ff0 }, 1094 { 0xa384, 0xf3307ff0 },
1086}; 1095};
1087 1096
1088/* Initial mode-specific settings for RF2425 (Written after ar5212_ini) */ 1097/* Initial mode-specific settings for RF2425
1098 * (Written after ar5212_ini) */
1089/* XXX: a mode ? */ 1099/* XXX: a mode ? */
1090static const struct ath5k_ini_mode rf2425_ini_mode_end[] = { 1100static const struct ath5k_ini_mode rf2425_ini_mode_end[] = {
1091 { AR5K_TXCFG, 1101 { AR5K_TXCFG,
@@ -1357,10 +1367,15 @@ static const struct ath5k_ini rf5112_ini_bbgain[] = {
1357}; 1367};
1358 1368
1359 1369
1360/* 1370/**
1361 * Write initial register dump 1371 * ath5k_hw_ini_registers() - Write initial register dump common for all modes
1372 * @ah: The &struct ath5k_hw
1373 * @size: Dump size
1374 * @ini_regs: The array of &struct ath5k_ini
1375 * @skip_pcu: Skip PCU registers
1362 */ 1376 */
1363static void ath5k_hw_ini_registers(struct ath5k_hw *ah, unsigned int size, 1377static void
1378ath5k_hw_ini_registers(struct ath5k_hw *ah, unsigned int size,
1364 const struct ath5k_ini *ini_regs, bool skip_pcu) 1379 const struct ath5k_ini *ini_regs, bool skip_pcu)
1365{ 1380{
1366 unsigned int i; 1381 unsigned int i;
@@ -1388,7 +1403,15 @@ static void ath5k_hw_ini_registers(struct ath5k_hw *ah, unsigned int size,
1388 } 1403 }
1389} 1404}
1390 1405
1391static void ath5k_hw_ini_mode_registers(struct ath5k_hw *ah, 1406/**
1407 * ath5k_hw_ini_mode_registers() - Write initial mode-specific register dump
1408 * @ah: The &struct ath5k_hw
1409 * @size: Dump size
1410 * @ini_mode: The array of &struct ath5k_ini_mode
1411 * @mode: One of enum ath5k_driver_mode
1412 */
1413static void
1414ath5k_hw_ini_mode_registers(struct ath5k_hw *ah,
1392 unsigned int size, const struct ath5k_ini_mode *ini_mode, 1415 unsigned int size, const struct ath5k_ini_mode *ini_mode,
1393 u8 mode) 1416 u8 mode)
1394{ 1417{
@@ -1402,7 +1425,17 @@ static void ath5k_hw_ini_mode_registers(struct ath5k_hw *ah,
1402 1425
1403} 1426}
1404 1427
1405int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool skip_pcu) 1428/**
1429 * ath5k_hw_write_initvals() - Write initial chip-specific register dump
1430 * @ah: The &struct ath5k_hw
1431 * @mode: One of enum ath5k_driver_mode
1432 * @skip_pcu: Skip PCU registers
1433 *
1434 * Write initial chip-specific register dump, to get the chipset on a
1435 * clean and ready-to-work state after warm reset.
1436 */
1437int
1438ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool skip_pcu)
1406{ 1439{
1407 /* 1440 /*
1408 * Write initial register settings 1441 * Write initial register settings