aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath5k/ath5k.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath5k/ath5k.h')
-rw-r--r--drivers/net/wireless/ath5k/ath5k.h159
1 files changed, 78 insertions, 81 deletions
diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h
index 69dea3392612..b21830771ea5 100644
--- a/drivers/net/wireless/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath5k/ath5k.h
@@ -30,7 +30,6 @@
30#include <net/mac80211.h> 30#include <net/mac80211.h>
31 31
32#include "hw.h" 32#include "hw.h"
33#include "regdom.h"
34 33
35/* PCI IDs */ 34/* PCI IDs */
36#define PCI_DEVICE_ID_ATHEROS_AR5210 0x0007 /* AR5210 */ 35#define PCI_DEVICE_ID_ATHEROS_AR5210 0x0007 /* AR5210 */
@@ -141,7 +140,8 @@ enum ath5k_radio {
141 AR5K_RF5110 = 0, 140 AR5K_RF5110 = 0,
142 AR5K_RF5111 = 1, 141 AR5K_RF5111 = 1,
143 AR5K_RF5112 = 2, 142 AR5K_RF5112 = 2,
144 AR5K_RF5413 = 3, 143 AR5K_RF2413 = 3,
144 AR5K_RF5413 = 4,
145}; 145};
146 146
147/* 147/*
@@ -169,12 +169,15 @@ struct ath5k_srev_name {
169#define AR5K_SREV_VER_AR5212 0x50 169#define AR5K_SREV_VER_AR5212 0x50
170#define AR5K_SREV_VER_AR5213 0x55 170#define AR5K_SREV_VER_AR5213 0x55
171#define AR5K_SREV_VER_AR5213A 0x59 171#define AR5K_SREV_VER_AR5213A 0x59
172#define AR5K_SREV_VER_AR2424 0xa0 172#define AR5K_SREV_VER_AR2413 0x78
173#define AR5K_SREV_VER_AR5424 0xa3 173#define AR5K_SREV_VER_AR2414 0x79
174#define AR5K_SREV_VER_AR2424 0xa0 /* PCI-E */
175#define AR5K_SREV_VER_AR5424 0xa3 /* PCI-E */
174#define AR5K_SREV_VER_AR5413 0xa4 176#define AR5K_SREV_VER_AR5413 0xa4
175#define AR5K_SREV_VER_AR5414 0xa5 177#define AR5K_SREV_VER_AR5414 0xa5
176#define AR5K_SREV_VER_AR5416 0xc0 /* ? */ 178#define AR5K_SREV_VER_AR5416 0xc0 /* PCI-E */
177#define AR5K_SREV_VER_AR5418 0xca 179#define AR5K_SREV_VER_AR5418 0xca /* PCI-E */
180#define AR5K_SREV_VER_AR2425 0xe2 /* PCI-E */
178 181
179#define AR5K_SREV_RAD_5110 0x00 182#define AR5K_SREV_RAD_5110 0x00
180#define AR5K_SREV_RAD_5111 0x10 183#define AR5K_SREV_RAD_5111 0x10
@@ -184,8 +187,9 @@ struct ath5k_srev_name {
184#define AR5K_SREV_RAD_5112A 0x35 187#define AR5K_SREV_RAD_5112A 0x35
185#define AR5K_SREV_RAD_2112 0x40 188#define AR5K_SREV_RAD_2112 0x40
186#define AR5K_SREV_RAD_2112A 0x45 189#define AR5K_SREV_RAD_2112A 0x45
190#define AR5K_SREV_RAD_SC0 0x56 /* Found on 2413/2414 */
187#define AR5K_SREV_RAD_SC1 0x63 /* Found on 5413/5414 */ 191#define AR5K_SREV_RAD_SC1 0x63 /* Found on 5413/5414 */
188#define AR5K_SREV_RAD_SC2 0xa2 /* Found on 2424/5424 */ 192#define AR5K_SREV_RAD_SC2 0xa2 /* Found on 2424-5/5424 */
189#define AR5K_SREV_RAD_5133 0xc0 /* MIMO found on 5418 */ 193#define AR5K_SREV_RAD_5133 0xc0 /* MIMO found on 5418 */
190 194
191/* IEEE defs */ 195/* IEEE defs */
@@ -251,26 +255,31 @@ struct ath5k_srev_name {
251 */ 255 */
252#define MODULATION_TURBO 0x00000080 256#define MODULATION_TURBO 0x00000080
253 257
254enum ath5k_vendor_mode { 258enum ath5k_driver_mode {
255 MODE_ATHEROS_TURBO = NUM_IEEE80211_MODES+1, 259 AR5K_MODE_11A = 0,
256 MODE_ATHEROS_TURBOG 260 AR5K_MODE_11A_TURBO = 1,
261 AR5K_MODE_11B = 2,
262 AR5K_MODE_11G = 3,
263 AR5K_MODE_11G_TURBO = 4,
264 AR5K_MODE_XR = 0,
265 AR5K_MODE_MAX = 5
257}; 266};
258 267
259/* Number of supported mac80211 enum ieee80211_phymode modes by this driver */
260#define NUM_DRIVER_MODES 3
261
262/* adding this flag to rate_code enables short preamble, see ar5212_reg.h */ 268/* adding this flag to rate_code enables short preamble, see ar5212_reg.h */
263#define AR5K_SET_SHORT_PREAMBLE 0x04 269#define AR5K_SET_SHORT_PREAMBLE 0x04
264 270
265#define HAS_SHPREAMBLE(_ix) (rt->rates[_ix].modulation == IEEE80211_RATE_CCK_2) 271#define HAS_SHPREAMBLE(_ix) \
266#define SHPREAMBLE_FLAG(_ix) (HAS_SHPREAMBLE(_ix) ? AR5K_SET_SHORT_PREAMBLE : 0) 272 (rt->rates[_ix].modulation == IEEE80211_RATE_SHORT_PREAMBLE)
273#define SHPREAMBLE_FLAG(_ix) \
274 (HAS_SHPREAMBLE(_ix) ? AR5K_SET_SHORT_PREAMBLE : 0)
275
267 276
268/****************\ 277/****************\
269 TX DEFINITIONS 278 TX DEFINITIONS
270\****************/ 279\****************/
271 280
272/* 281/*
273 * Tx Descriptor 282 * TX Status
274 */ 283 */
275struct ath5k_tx_status { 284struct ath5k_tx_status {
276 u16 ts_seqnum; 285 u16 ts_seqnum;
@@ -418,7 +427,7 @@ enum ath5k_dmasize {
418\****************/ 427\****************/
419 428
420/* 429/*
421 * Rx Descriptor 430 * RX Status
422 */ 431 */
423struct ath5k_rx_status { 432struct ath5k_rx_status {
424 u16 rs_datalen; 433 u16 rs_datalen;
@@ -449,8 +458,6 @@ struct ath5k_mib_stats {
449}; 458};
450 459
451 460
452
453
454/**************************\ 461/**************************\
455 BEACON TIMERS DEFINITIONS 462 BEACON TIMERS DEFINITIONS
456\**************************/ 463\**************************/
@@ -492,29 +499,23 @@ struct ath5k_beacon_state {
492#define TSF_TO_TU(_tsf) (u32)((_tsf) >> 10) 499#define TSF_TO_TU(_tsf) (u32)((_tsf) >> 10)
493 500
494 501
495
496/********************\ 502/********************\
497 COMMON DEFINITIONS 503 COMMON DEFINITIONS
498\********************/ 504\********************/
499 505
500/* 506/*
501 * Atheros descriptor 507 * Atheros hardware descriptor
508 * This is read and written to by the hardware
502 */ 509 */
503struct ath5k_desc { 510struct ath5k_desc {
504 u32 ds_link; 511 u32 ds_link; /* physical address of the next descriptor */
505 u32 ds_data; 512 u32 ds_data; /* physical address of data buffer (skb) */
506 u32 ds_ctl0;
507 u32 ds_ctl1;
508 u32 ds_hw[4];
509 513
510 union { 514 union {
511 struct ath5k_rx_status rx; 515 struct ath5k_hw_5210_tx_desc ds_tx5210;
512 struct ath5k_tx_status tx; 516 struct ath5k_hw_5212_tx_desc ds_tx5212;
513 } ds_us; 517 struct ath5k_hw_all_rx_desc ds_rx;
514 518 } ud;
515#define ds_rxstat ds_us.rx
516#define ds_txstat ds_us.tx
517
518} __packed; 519} __packed;
519 520
520#define AR5K_RXDESC_INTREQ 0x0020 521#define AR5K_RXDESC_INTREQ 0x0020
@@ -560,8 +561,8 @@ struct ath5k_desc {
560 * Used internaly in OpenHAL (ar5211.c/ar5212.c 561 * Used internaly in OpenHAL (ar5211.c/ar5212.c
561 * for reset_tx_queue). Also see struct struct ieee80211_channel. 562 * for reset_tx_queue). Also see struct struct ieee80211_channel.
562 */ 563 */
563#define IS_CHAN_XR(_c) ((_c.val & CHANNEL_XR) != 0) 564#define IS_CHAN_XR(_c) ((_c.hw_value & CHANNEL_XR) != 0)
564#define IS_CHAN_B(_c) ((_c.val & CHANNEL_B) != 0) 565#define IS_CHAN_B(_c) ((_c.hw_value & CHANNEL_B) != 0)
565 566
566/* 567/*
567 * The following structure will be used to map 2GHz channels to 568 * The following structure will be used to map 2GHz channels to
@@ -584,7 +585,7 @@ struct ath5k_athchan_2ghz {
584 585
585/** 586/**
586 * struct ath5k_rate - rate structure 587 * struct ath5k_rate - rate structure
587 * @valid: is this a valid rate for the current mode 588 * @valid: is this a valid rate for rate control (remove)
588 * @modulation: respective mac80211 modulation 589 * @modulation: respective mac80211 modulation
589 * @rate_kbps: rate in kbit/s 590 * @rate_kbps: rate in kbit/s
590 * @rate_code: hardware rate value, used in &struct ath5k_desc, on RX on 591 * @rate_code: hardware rate value, used in &struct ath5k_desc, on RX on
@@ -643,47 +644,48 @@ struct ath5k_rate_table {
643 644
644/* 645/*
645 * Rate tables... 646 * Rate tables...
647 * TODO: CLEAN THIS !!!
646 */ 648 */
647#define AR5K_RATES_11A { 8, { \ 649#define AR5K_RATES_11A { 8, { \
648 255, 255, 255, 255, 255, 255, 255, 255, 6, 4, 2, 0, \ 650 255, 255, 255, 255, 255, 255, 255, 255, 6, 4, 2, 0, \
649 7, 5, 3, 1, 255, 255, 255, 255, 255, 255, 255, 255, \ 651 7, 5, 3, 1, 255, 255, 255, 255, 255, 255, 255, 255, \
650 255, 255, 255, 255, 255, 255, 255, 255 }, { \ 652 255, 255, 255, 255, 255, 255, 255, 255 }, { \
651 { 1, IEEE80211_RATE_OFDM, 6000, 11, 140, 0 }, \ 653 { 1, 0, 6000, 11, 140, 0 }, \
652 { 1, IEEE80211_RATE_OFDM, 9000, 15, 18, 0 }, \ 654 { 1, 0, 9000, 15, 18, 0 }, \
653 { 1, IEEE80211_RATE_OFDM, 12000, 10, 152, 2 }, \ 655 { 1, 0, 12000, 10, 152, 2 }, \
654 { 1, IEEE80211_RATE_OFDM, 18000, 14, 36, 2 }, \ 656 { 1, 0, 18000, 14, 36, 2 }, \
655 { 1, IEEE80211_RATE_OFDM, 24000, 9, 176, 4 }, \ 657 { 1, 0, 24000, 9, 176, 4 }, \
656 { 1, IEEE80211_RATE_OFDM, 36000, 13, 72, 4 }, \ 658 { 1, 0, 36000, 13, 72, 4 }, \
657 { 1, IEEE80211_RATE_OFDM, 48000, 8, 96, 4 }, \ 659 { 1, 0, 48000, 8, 96, 4 }, \
658 { 1, IEEE80211_RATE_OFDM, 54000, 12, 108, 4 } } \ 660 { 1, 0, 54000, 12, 108, 4 } } \
659} 661}
660 662
661#define AR5K_RATES_11B { 4, { \ 663#define AR5K_RATES_11B { 4, { \
662 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, \ 664 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, \
663 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, \ 665 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, \
664 3, 2, 1, 0, 255, 255, 255, 255 }, { \ 666 3, 2, 1, 0, 255, 255, 255, 255 }, { \
665 { 1, IEEE80211_RATE_CCK, 1000, 27, 130, 0 }, \ 667 { 1, 0, 1000, 27, 130, 0 }, \
666 { 1, IEEE80211_RATE_CCK_2, 2000, 26, 132, 1 }, \ 668 { 1, IEEE80211_RATE_SHORT_PREAMBLE, 2000, 26, 132, 1 }, \
667 { 1, IEEE80211_RATE_CCK_2, 5500, 25, 139, 1 }, \ 669 { 1, IEEE80211_RATE_SHORT_PREAMBLE, 5500, 25, 139, 1 }, \
668 { 1, IEEE80211_RATE_CCK_2, 11000, 24, 150, 1 } } \ 670 { 1, IEEE80211_RATE_SHORT_PREAMBLE, 11000, 24, 150, 1 } } \
669} 671}
670 672
671#define AR5K_RATES_11G { 12, { \ 673#define AR5K_RATES_11G { 12, { \
672 255, 255, 255, 255, 255, 255, 255, 255, 10, 8, 6, 4, \ 674 255, 255, 255, 255, 255, 255, 255, 255, 10, 8, 6, 4, \
673 11, 9, 7, 5, 255, 255, 255, 255, 255, 255, 255, 255, \ 675 11, 9, 7, 5, 255, 255, 255, 255, 255, 255, 255, 255, \
674 3, 2, 1, 0, 255, 255, 255, 255 }, { \ 676 3, 2, 1, 0, 255, 255, 255, 255 }, { \
675 { 1, IEEE80211_RATE_CCK, 1000, 27, 2, 0 }, \ 677 { 1, 0, 1000, 27, 2, 0 }, \
676 { 1, IEEE80211_RATE_CCK_2, 2000, 26, 4, 1 }, \ 678 { 1, IEEE80211_RATE_SHORT_PREAMBLE, 2000, 26, 4, 1 }, \
677 { 1, IEEE80211_RATE_CCK_2, 5500, 25, 11, 1 }, \ 679 { 1, IEEE80211_RATE_SHORT_PREAMBLE, 5500, 25, 11, 1 }, \
678 { 1, IEEE80211_RATE_CCK_2, 11000, 24, 22, 1 }, \ 680 { 1, IEEE80211_RATE_SHORT_PREAMBLE, 11000, 24, 22, 1 }, \
679 { 0, IEEE80211_RATE_OFDM, 6000, 11, 12, 4 }, \ 681 { 0, 0, 6000, 11, 12, 4 }, \
680 { 0, IEEE80211_RATE_OFDM, 9000, 15, 18, 4 }, \ 682 { 0, 0, 9000, 15, 18, 4 }, \
681 { 1, IEEE80211_RATE_OFDM, 12000, 10, 24, 6 }, \ 683 { 1, 0, 12000, 10, 24, 6 }, \
682 { 1, IEEE80211_RATE_OFDM, 18000, 14, 36, 6 }, \ 684 { 1, 0, 18000, 14, 36, 6 }, \
683 { 1, IEEE80211_RATE_OFDM, 24000, 9, 48, 8 }, \ 685 { 1, 0, 24000, 9, 48, 8 }, \
684 { 1, IEEE80211_RATE_OFDM, 36000, 13, 72, 8 }, \ 686 { 1, 0, 36000, 13, 72, 8 }, \
685 { 1, IEEE80211_RATE_OFDM, 48000, 8, 96, 8 }, \ 687 { 1, 0, 48000, 8, 96, 8 }, \
686 { 1, IEEE80211_RATE_OFDM, 54000, 12, 108, 8 } } \ 688 { 1, 0, 54000, 12, 108, 8 } } \
687} 689}
688 690
689#define AR5K_RATES_TURBO { 8, { \ 691#define AR5K_RATES_TURBO { 8, { \
@@ -708,14 +710,14 @@ struct ath5k_rate_table {
708 { 1, MODULATION_XR, 1000, 2, 139, 1 }, \ 710 { 1, MODULATION_XR, 1000, 2, 139, 1 }, \
709 { 1, MODULATION_XR, 2000, 6, 150, 2 }, \ 711 { 1, MODULATION_XR, 2000, 6, 150, 2 }, \
710 { 1, MODULATION_XR, 3000, 1, 150, 3 }, \ 712 { 1, MODULATION_XR, 3000, 1, 150, 3 }, \
711 { 1, IEEE80211_RATE_OFDM, 6000, 11, 140, 4 }, \ 713 { 1, 0, 6000, 11, 140, 4 }, \
712 { 1, IEEE80211_RATE_OFDM, 9000, 15, 18, 4 }, \ 714 { 1, 0, 9000, 15, 18, 4 }, \
713 { 1, IEEE80211_RATE_OFDM, 12000, 10, 152, 6 }, \ 715 { 1, 0, 12000, 10, 152, 6 }, \
714 { 1, IEEE80211_RATE_OFDM, 18000, 14, 36, 6 }, \ 716 { 1, 0, 18000, 14, 36, 6 }, \
715 { 1, IEEE80211_RATE_OFDM, 24000, 9, 176, 8 }, \ 717 { 1, 0, 24000, 9, 176, 8 }, \
716 { 1, IEEE80211_RATE_OFDM, 36000, 13, 72, 8 }, \ 718 { 1, 0, 36000, 13, 72, 8 }, \
717 { 1, IEEE80211_RATE_OFDM, 48000, 8, 96, 8 }, \ 719 { 1, 0, 48000, 8, 96, 8 }, \
718 { 1, IEEE80211_RATE_OFDM, 54000, 12, 108, 8 } } \ 720 { 1, 0, 54000, 12, 108, 8 } } \
719} 721}
720 722
721/* 723/*
@@ -890,12 +892,14 @@ enum ath5k_capability_type {
890 AR5K_CAP_RFSILENT = 20, /* Supports RFsilent */ 892 AR5K_CAP_RFSILENT = 20, /* Supports RFsilent */
891}; 893};
892 894
895
896/* XXX: we *may* move cap_range stuff to struct wiphy */
893struct ath5k_capabilities { 897struct ath5k_capabilities {
894 /* 898 /*
895 * Supported PHY modes 899 * Supported PHY modes
896 * (ie. CHANNEL_A, CHANNEL_B, ...) 900 * (ie. CHANNEL_A, CHANNEL_B, ...)
897 */ 901 */
898 DECLARE_BITMAP(cap_mode, NUM_DRIVER_MODES); 902 DECLARE_BITMAP(cap_mode, AR5K_MODE_MAX);
899 903
900 /* 904 /*
901 * Frequency range (without regulation restrictions) 905 * Frequency range (without regulation restrictions)
@@ -908,14 +912,6 @@ struct ath5k_capabilities {
908 } cap_range; 912 } cap_range;
909 913
910 /* 914 /*
911 * Active regulation domain settings
912 */
913 struct {
914 enum ath5k_regdom reg_current;
915 enum ath5k_regdom reg_hw;
916 } cap_regdomain;
917
918 /*
919 * Values stored in the EEPROM (some of them...) 915 * Values stored in the EEPROM (some of them...)
920 */ 916 */
921 struct ath5k_eeprom_info cap_eeprom; 917 struct ath5k_eeprom_info cap_eeprom;
@@ -963,6 +959,7 @@ struct ath5k_hw {
963 u16 ah_phy_revision; 959 u16 ah_phy_revision;
964 u16 ah_radio_5ghz_revision; 960 u16 ah_radio_5ghz_revision;
965 u16 ah_radio_2ghz_revision; 961 u16 ah_radio_2ghz_revision;
962 u32 ah_phy_spending;
966 963
967 enum ath5k_version ah_version; 964 enum ath5k_version ah_version;
968 enum ath5k_radio ah_radio; 965 enum ath5k_radio ah_radio;
@@ -1038,8 +1035,10 @@ struct ath5k_hw {
1038 int (*ah_setup_xtx_desc)(struct ath5k_hw *, struct ath5k_desc *, 1035 int (*ah_setup_xtx_desc)(struct ath5k_hw *, struct ath5k_desc *,
1039 unsigned int, unsigned int, unsigned int, unsigned int, 1036 unsigned int, unsigned int, unsigned int, unsigned int,
1040 unsigned int, unsigned int); 1037 unsigned int, unsigned int);
1041 int (*ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *); 1038 int (*ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *,
1042 int (*ah_proc_rx_desc)(struct ath5k_hw *, struct ath5k_desc *); 1039 struct ath5k_tx_status *);
1040 int (*ah_proc_rx_desc)(struct ath5k_hw *, struct ath5k_desc *,
1041 struct ath5k_rx_status *);
1043}; 1042};
1044 1043
1045/* 1044/*
@@ -1129,8 +1128,6 @@ extern int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio);
1129extern u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio); 1128extern u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio);
1130extern int ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val); 1129extern int ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val);
1131extern void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, u32 interrupt_level); 1130extern void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, u32 interrupt_level);
1132/* Regulatory Domain/Channels Setup */
1133extern u16 ath5k_get_regdomain(struct ath5k_hw *ah);
1134/* Misc functions */ 1131/* Misc functions */
1135extern int ath5k_hw_get_capability(struct ath5k_hw *ah, enum ath5k_capability_type cap_type, u32 capability, u32 *result); 1132extern int ath5k_hw_get_capability(struct ath5k_hw *ah, enum ath5k_capability_type cap_type, u32 capability, u32 *result);
1136 1133