aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath5k/ath5k.h
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@winlab.rutgers.edu>2008-02-03 21:51:04 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-29 15:19:35 -0500
commitd8ee398d183df36083e41e9162b0cf014f38f482 (patch)
treeee5c10f61aadd7ef8d78a06c3a48151b00ff0945 /drivers/net/wireless/ath5k/ath5k.h
parent406f2388cc1f6e6c176305bd325cef230ce1afdd (diff)
ath5k: Port to new bitrate/channel API
Author: Nick Kossifidis <mickflemm@gmail.com> Tested on 5211, 5213+5112, 5213A+2112A and it wors fine. Also i figured out a way to process rate vallue found on status descriptors, it's still buggy but we are getting closer (i think it improved stability a little). Changes to hw.c, initvals.c, phy.c Changes-licensed-under: ISC Changes to ath5k.h, base.c, base.h Changes-licensed-under: 3-Clause-BSD Acked-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath5k/ath5k.h')
-rw-r--r--drivers/net/wireless/ath5k/ath5k.h100
1 files changed, 46 insertions, 54 deletions
diff --git a/drivers/net/wireless/ath5k/ath5k.h b/drivers/net/wireless/ath5k/ath5k.h
index 69dea3392612..9ea8c549b781 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 */
@@ -251,18 +250,20 @@ struct ath5k_srev_name {
251 */ 250 */
252#define MODULATION_TURBO 0x00000080 251#define MODULATION_TURBO 0x00000080
253 252
254enum ath5k_vendor_mode { 253enum ath5k_driver_mode {
255 MODE_ATHEROS_TURBO = NUM_IEEE80211_MODES+1, 254 AR5K_MODE_11A = 0,
256 MODE_ATHEROS_TURBOG 255 AR5K_MODE_11A_TURBO = 1,
256 AR5K_MODE_11B = 2,
257 AR5K_MODE_11G = 3,
258 AR5K_MODE_11G_TURBO = 4,
259 AR5K_MODE_XR = 0,
260 AR5K_MODE_MAX = 5
257}; 261};
258 262
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 */ 263/* adding this flag to rate_code enables short preamble, see ar5212_reg.h */
263#define AR5K_SET_SHORT_PREAMBLE 0x04 264#define AR5K_SET_SHORT_PREAMBLE 0x04
264 265
265#define HAS_SHPREAMBLE(_ix) (rt->rates[_ix].modulation == IEEE80211_RATE_CCK_2) 266#define HAS_SHPREAMBLE(_ix) (rt->rates[_ix].modulation == IEEE80211_RATE_SHORT_PREAMBLE)
266#define SHPREAMBLE_FLAG(_ix) (HAS_SHPREAMBLE(_ix) ? AR5K_SET_SHORT_PREAMBLE : 0) 267#define SHPREAMBLE_FLAG(_ix) (HAS_SHPREAMBLE(_ix) ? AR5K_SET_SHORT_PREAMBLE : 0)
267 268
268/****************\ 269/****************\
@@ -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/*
@@ -895,7 +897,7 @@ struct ath5k_capabilities {
895 * Supported PHY modes 897 * Supported PHY modes
896 * (ie. CHANNEL_A, CHANNEL_B, ...) 898 * (ie. CHANNEL_A, CHANNEL_B, ...)
897 */ 899 */
898 DECLARE_BITMAP(cap_mode, NUM_DRIVER_MODES); 900 DECLARE_BITMAP(cap_mode, AR5K_MODE_MAX);
899 901
900 /* 902 /*
901 * Frequency range (without regulation restrictions) 903 * Frequency range (without regulation restrictions)
@@ -908,14 +910,6 @@ struct ath5k_capabilities {
908 } cap_range; 910 } cap_range;
909 911
910 /* 912 /*
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...) 913 * Values stored in the EEPROM (some of them...)
920 */ 914 */
921 struct ath5k_eeprom_info cap_eeprom; 915 struct ath5k_eeprom_info cap_eeprom;
@@ -1129,8 +1123,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); 1123extern 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); 1124extern 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); 1125extern 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 */ 1126/* Misc functions */
1135extern int ath5k_hw_get_capability(struct ath5k_hw *ah, enum ath5k_capability_type cap_type, u32 capability, u32 *result); 1127extern int ath5k_hw_get_capability(struct ath5k_hw *ah, enum ath5k_capability_type cap_type, u32 capability, u32 *result);
1136 1128