0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef P54_H
0012 #define P54_H
0013
0014 #ifdef CONFIG_P54_LEDS
0015 #include <linux/leds.h>
0016 #endif
0017
0018 #define ISL38XX_DEV_FIRMWARE_ADDR 0x20000
0019
0020 #define BR_CODE_MIN 0x80000000
0021 #define BR_CODE_COMPONENT_ID 0x80000001
0022 #define BR_CODE_COMPONENT_VERSION 0x80000002
0023 #define BR_CODE_DEPENDENT_IF 0x80000003
0024 #define BR_CODE_EXPOSED_IF 0x80000004
0025 #define BR_CODE_DESCR 0x80000101
0026 #define BR_CODE_MAX 0x8FFFFFFF
0027 #define BR_CODE_END_OF_BRA 0xFF0000FF
0028 #define LEGACY_BR_CODE_END_OF_BRA 0xFFFFFFFF
0029
0030 struct bootrec {
0031 __le32 code;
0032 __le32 len;
0033 u32 data[10];
0034 } __packed;
0035
0036
0037 #define BR_INTERFACE_ROLE_SERVER 0x0000
0038 #define BR_INTERFACE_ROLE_CLIENT 0x8000
0039
0040 #define BR_DESC_PRIV_CAP_WEP BIT(0)
0041 #define BR_DESC_PRIV_CAP_TKIP BIT(1)
0042 #define BR_DESC_PRIV_CAP_MICHAEL BIT(2)
0043 #define BR_DESC_PRIV_CAP_CCX_CP BIT(3)
0044 #define BR_DESC_PRIV_CAP_CCX_MIC BIT(4)
0045 #define BR_DESC_PRIV_CAP_AESCCMP BIT(5)
0046
0047 struct bootrec_desc {
0048 __le16 modes;
0049 __le16 flags;
0050 __le32 rx_start;
0051 __le32 rx_end;
0052 u8 headroom;
0053 u8 tailroom;
0054 u8 tx_queues;
0055 u8 tx_depth;
0056 u8 privacy_caps;
0057 u8 rx_keycache_size;
0058 u8 time_size;
0059 u8 padding;
0060 u8 rates[16];
0061 u8 padding2[4];
0062 __le16 rx_mtu;
0063 } __packed;
0064
0065 #define FW_FMAC 0x464d4143
0066 #define FW_LM86 0x4c4d3836
0067 #define FW_LM87 0x4c4d3837
0068 #define FW_LM20 0x4c4d3230
0069
0070 struct bootrec_comp_id {
0071 __le32 fw_variant;
0072 } __packed;
0073
0074 struct bootrec_comp_ver {
0075 char fw_version[24];
0076 } __packed;
0077
0078 struct bootrec_end {
0079 __le16 crc;
0080 u8 padding[2];
0081 u8 md5[16];
0082 } __packed;
0083
0084
0085 #define P54_TX_INFO_DATA_SIZE 16
0086
0087
0088 struct p54_tx_info {
0089 u32 start_addr;
0090 u32 end_addr;
0091 union {
0092 void *data[P54_TX_INFO_DATA_SIZE / sizeof(void *)];
0093 struct {
0094 u32 extra_len;
0095 };
0096 };
0097 };
0098
0099 #define P54_MAX_CTRL_FRAME_LEN 0x1000
0100
0101 #define P54_SET_QUEUE(queue, ai_fs, cw_min, cw_max, _txop) \
0102 do { \
0103 queue.aifs = cpu_to_le16(ai_fs); \
0104 queue.cwmin = cpu_to_le16(cw_min); \
0105 queue.cwmax = cpu_to_le16(cw_max); \
0106 queue.txop = cpu_to_le16(_txop); \
0107 } while (0)
0108
0109 struct p54_edcf_queue_param {
0110 __le16 aifs;
0111 __le16 cwmin;
0112 __le16 cwmax;
0113 __le16 txop;
0114 } __packed;
0115
0116 struct p54_rssi_db_entry {
0117 u16 freq;
0118 s16 mul;
0119 s16 add;
0120 s16 longbow_unkn;
0121 s16 longbow_unk2;
0122 };
0123
0124 struct p54_cal_database {
0125 size_t entries;
0126 size_t entry_size;
0127 size_t offset;
0128 size_t len;
0129 u8 data[];
0130 };
0131
0132 #define EEPROM_READBACK_LEN 0x3fc
0133
0134 enum fw_state {
0135 FW_STATE_OFF,
0136 FW_STATE_BOOTING,
0137 FW_STATE_READY,
0138 FW_STATE_RESET,
0139 FW_STATE_RESETTING,
0140 };
0141
0142 #ifdef CONFIG_P54_LEDS
0143
0144 #define P54_LED_MAX_NAME_LEN 31
0145
0146 struct p54_led_dev {
0147 struct ieee80211_hw *hw_dev;
0148 struct led_classdev led_dev;
0149 char name[P54_LED_MAX_NAME_LEN + 1];
0150
0151 unsigned int toggled;
0152 unsigned int index;
0153 unsigned int registered;
0154 };
0155
0156 #endif
0157
0158 struct p54_tx_queue_stats {
0159 unsigned int len;
0160 unsigned int limit;
0161 unsigned int count;
0162 };
0163
0164 struct p54_common {
0165 struct ieee80211_hw *hw;
0166 struct ieee80211_vif *vif;
0167 void (*tx)(struct ieee80211_hw *dev, struct sk_buff *skb);
0168 int (*open)(struct ieee80211_hw *dev);
0169 void (*stop)(struct ieee80211_hw *dev);
0170 struct sk_buff_head tx_pending;
0171 struct sk_buff_head tx_queue;
0172 struct mutex conf_mutex;
0173 bool registered;
0174
0175
0176 u32 rx_start;
0177 u32 rx_end;
0178 u16 rx_mtu;
0179 u8 headroom;
0180 u8 tailroom;
0181
0182
0183 unsigned int tx_hdr_len;
0184 unsigned int fw_var;
0185 unsigned int fw_interface;
0186 u8 version;
0187
0188
0189 bool use_short_slot;
0190 spinlock_t tx_stats_lock;
0191 struct p54_tx_queue_stats tx_stats[8];
0192 struct p54_edcf_queue_param qos_params[8];
0193
0194
0195 u16 rxhw;
0196 u8 rx_diversity_mask;
0197 u8 tx_diversity_mask;
0198 unsigned int output_power;
0199 struct p54_rssi_db_entry *cur_rssi;
0200 struct ieee80211_channel *curchan;
0201 struct survey_info *survey;
0202 unsigned int chan_num;
0203 struct completion stat_comp;
0204 bool update_stats;
0205 struct {
0206 unsigned int timestamp;
0207 unsigned int cached_cca;
0208 unsigned int cached_tx;
0209 unsigned int cached_rssi;
0210 u64 active;
0211 u64 cca;
0212 u64 tx;
0213 u64 rssi;
0214 } survey_raw;
0215
0216 int noise;
0217
0218 struct pda_iq_autocal_entry *iq_autocal;
0219 unsigned int iq_autocal_len;
0220 struct p54_cal_database *curve_data;
0221 struct p54_cal_database *output_limit;
0222 struct p54_cal_database *rssi_db;
0223 struct ieee80211_supported_band *band_table[NUM_NL80211_BANDS];
0224
0225
0226 u8 mac_addr[ETH_ALEN];
0227 u8 bssid[ETH_ALEN];
0228 u8 mc_maclist[4][ETH_ALEN];
0229 u16 wakeup_timer;
0230 unsigned int filter_flags;
0231 int mc_maclist_num;
0232 int mode;
0233 u32 tsf_low32, tsf_high32;
0234 u32 basic_rate_mask;
0235 u16 aid;
0236 u8 coverage_class;
0237 bool phy_idle;
0238 bool phy_ps;
0239 bool powersave_override;
0240 __le32 beacon_req_id;
0241 struct completion beacon_comp;
0242
0243
0244 u8 privacy_caps;
0245 u8 rx_keycache_size;
0246 unsigned long *used_rxkeys;
0247
0248
0249 #ifdef CONFIG_P54_LEDS
0250 struct p54_led_dev leds[4];
0251 struct delayed_work led_work;
0252 #endif
0253 u16 softled_state;
0254
0255
0256 struct ieee80211_low_level_stats stats;
0257 struct delayed_work work;
0258
0259
0260 void *eeprom;
0261 struct completion eeprom_comp;
0262 struct mutex eeprom_mutex;
0263 };
0264
0265
0266 int p54_rx(struct ieee80211_hw *dev, struct sk_buff *skb);
0267 void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb);
0268 int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw);
0269 int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len);
0270 int p54_read_eeprom(struct ieee80211_hw *dev);
0271
0272 struct ieee80211_hw *p54_init_common(size_t priv_data_len);
0273 int p54_register_common(struct ieee80211_hw *dev, struct device *pdev);
0274 void p54_free_common(struct ieee80211_hw *dev);
0275
0276 void p54_unregister_common(struct ieee80211_hw *dev);
0277
0278 #endif