2007-09-25 18:11:01 -07:00
/*
* Shared defines for all mac80211 Prism54 code
*
* Copyright ( c ) 2006 , Michael Wu < flamingice @ sourmilk . net >
*
* Based on the islsm ( softmac prism54 ) driver , which is :
* Copyright 2004 - 2006 Jean - Baptiste Note < jbnote @ gmail . com > , et al .
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation .
*/
2009-06-23 10:39:45 -05:00
# ifndef P54_H
# define P54_H
2009-03-25 03:11:44 +01:00
# ifdef CONFIG_P54_LEDS
2009-03-06 01:02:04 +01:00
# include <linux/leds.h>
2009-03-25 03:11:44 +01:00
# endif /* CONFIG_P54_LEDS */
2009-03-06 01:02:04 +01:00
2009-06-23 10:39:45 -05:00
# define ISL38XX_DEV_FIRMWARE_ADDR 0x20000
# define BR_CODE_MIN 0x80000000
# define BR_CODE_COMPONENT_ID 0x80000001
# define BR_CODE_COMPONENT_VERSION 0x80000002
# define BR_CODE_DEPENDENT_IF 0x80000003
# define BR_CODE_EXPOSED_IF 0x80000004
# define BR_CODE_DESCR 0x80000101
# define BR_CODE_MAX 0x8FFFFFFF
# define BR_CODE_END_OF_BRA 0xFF0000FF
# define LEGACY_BR_CODE_END_OF_BRA 0xFFFFFFFF
struct bootrec {
__le32 code ;
__le32 len ;
u32 data [ 10 ] ;
} __packed ;
/* Interface role definitions */
# define BR_INTERFACE_ROLE_SERVER 0x0000
# define BR_INTERFACE_ROLE_CLIENT 0x8000
# define BR_DESC_PRIV_CAP_WEP BIT(0)
# define BR_DESC_PRIV_CAP_TKIP BIT(1)
# define BR_DESC_PRIV_CAP_MICHAEL BIT(2)
# define BR_DESC_PRIV_CAP_CCX_CP BIT(3)
# define BR_DESC_PRIV_CAP_CCX_MIC BIT(4)
# define BR_DESC_PRIV_CAP_AESCCMP BIT(5)
struct bootrec_desc {
__le16 modes ;
__le16 flags ;
__le32 rx_start ;
__le32 rx_end ;
u8 headroom ;
u8 tailroom ;
u8 tx_queues ;
u8 tx_depth ;
u8 privacy_caps ;
u8 rx_keycache_size ;
u8 time_size ;
u8 padding ;
u8 rates [ 16 ] ;
u8 padding2 [ 4 ] ;
__le16 rx_mtu ;
} __packed ;
# define FW_FMAC 0x464d4143
# define FW_LM86 0x4c4d3836
# define FW_LM87 0x4c4d3837
# define FW_LM20 0x4c4d3230
struct bootrec_comp_id {
__le32 fw_variant ;
} __packed ;
struct bootrec_comp_ver {
char fw_version [ 24 ] ;
} __packed ;
struct bootrec_end {
__le16 crc ;
u8 padding [ 2 ] ;
u8 md5 [ 16 ] ;
} __packed ;
2007-09-25 18:11:01 -07:00
2009-01-09 21:06:06 +01:00
/* provide 16 bytes for the transport back-end */
# define P54_TX_INFO_DATA_SIZE 16
/* stored in ieee80211_tx_info's rate_driver_data */
struct p54_tx_info {
u32 start_addr ;
u32 end_addr ;
2009-06-23 10:39:45 -05:00
union {
void * data [ P54_TX_INFO_DATA_SIZE / sizeof ( void * ) ] ;
struct {
u32 extra_len ;
} ;
} ;
2009-01-09 21:06:06 +01:00
} ;
2009-01-09 21:05:31 +01:00
# define P54_MAX_CTRL_FRAME_LEN 0x1000
2009-06-23 10:39:45 -05:00
# define P54_SET_QUEUE(queue, ai_fs, cw_min, cw_max, _txop) \
do { \
queue . aifs = cpu_to_le16 ( ai_fs ) ; \
queue . cwmin = cpu_to_le16 ( cw_min ) ; \
queue . cwmax = cpu_to_le16 ( cw_max ) ; \
queue . txop = cpu_to_le16 ( _txop ) ; \
} while ( 0 )
2008-12-14 15:05:42 +01:00
2008-10-15 03:55:37 +02:00
struct p54_edcf_queue_param {
__le16 aifs ;
__le16 cwmin ;
__le16 cwmax ;
__le16 txop ;
2009-06-23 10:39:45 -05:00
} __packed ;
2008-10-15 03:55:37 +02:00
2008-12-14 14:45:30 +01:00
struct p54_rssi_linear_approximation {
s16 mul ;
s16 add ;
s16 longbow_unkn ;
s16 longbow_unk2 ;
} ;
2009-01-11 01:10:33 +01:00
struct p54_cal_database {
size_t entries ;
size_t entry_size ;
size_t offset ;
size_t len ;
u8 data [ 0 ] ;
} ;
2008-09-01 22:48:51 +02:00
# define EEPROM_READBACK_LEN 0x3fc
2007-09-25 18:11:01 -07:00
2009-01-11 01:18:38 +01:00
enum fw_state {
FW_STATE_OFF ,
FW_STATE_BOOTING ,
FW_STATE_READY ,
FW_STATE_RESET ,
FW_STATE_RESETTING ,
} ;
2009-03-25 03:11:44 +01:00
# ifdef CONFIG_P54_LEDS
2009-03-06 01:02:04 +01:00
# define P54_LED_MAX_NAME_LEN 31
struct p54_led_dev {
struct ieee80211_hw * hw_dev ;
struct led_classdev led_dev ;
char name [ P54_LED_MAX_NAME_LEN + 1 ] ;
2009-03-25 03:12:18 +01:00
unsigned int toggled ;
2009-03-06 01:02:04 +01:00
unsigned int index ;
unsigned int registered ;
} ;
2009-03-25 03:11:44 +01:00
# endif /* CONFIG_P54_LEDS */
2009-03-06 01:02:04 +01:00
2007-09-25 18:11:01 -07:00
struct p54_common {
2008-12-13 14:14:20 +01:00
struct ieee80211_hw * hw ;
2009-03-25 03:12:49 +01:00
struct ieee80211_vif * vif ;
2008-12-14 15:05:42 +01:00
void ( * tx ) ( struct ieee80211_hw * dev , struct sk_buff * skb ) ;
2007-09-25 18:11:01 -07:00
int ( * open ) ( struct ieee80211_hw * dev ) ;
void ( * stop ) ( struct ieee80211_hw * dev ) ;
2009-06-23 10:39:45 -05:00
struct sk_buff_head tx_pending ;
2009-03-25 03:11:58 +01:00
struct sk_buff_head tx_queue ;
struct mutex conf_mutex ;
/* memory management (as seen by the firmware) */
u32 rx_start ;
u32 rx_end ;
2008-09-01 22:48:41 +02:00
u16 rx_mtu ;
u8 headroom ;
u8 tailroom ;
2009-03-25 03:11:58 +01:00
/* firmware/hardware info */
unsigned int tx_hdr_len ;
unsigned int fw_var ;
unsigned int fw_interface ;
u8 version ;
/* (e)DCF / QOS state */
bool use_short_slot ;
2009-06-23 10:39:45 -05:00
spinlock_t tx_stats_lock ;
2009-03-25 03:11:58 +01:00
struct ieee80211_tx_queue_stats tx_stats [ 8 ] ;
struct p54_edcf_queue_param qos_params [ 8 ] ;
/* Radio data */
u16 rxhw ;
2008-12-30 13:48:19 +01:00
u8 rx_diversity_mask ;
u8 tx_diversity_mask ;
2009-03-25 03:11:58 +01:00
unsigned int output_power ;
int noise ;
/* calibration, output power limit and rssi<->dBm conversation data */
2007-09-25 18:11:01 -07:00
struct pda_iq_autocal_entry * iq_autocal ;
unsigned int iq_autocal_len ;
2009-01-11 01:10:33 +01:00
struct p54_cal_database * curve_data ;
2009-03-25 03:11:58 +01:00
struct p54_cal_database * output_limit ;
2008-12-14 14:45:30 +01:00
struct p54_rssi_linear_approximation rssical_db [ IEEE80211_NUM_BANDS ] ;
2009-07-11 01:22:26 +02:00
struct ieee80211_supported_band * band_table [ IEEE80211_NUM_BANDS ] ;
2009-03-25 03:11:58 +01:00
/* BBP/MAC state */
u8 mac_addr [ ETH_ALEN ] ;
u8 bssid [ ETH_ALEN ] ;
u16 wakeup_timer ;
2008-09-06 02:56:12 +02:00
unsigned int filter_flags ;
2009-03-25 03:11:58 +01:00
int mode ;
u32 tsf_low32 , tsf_high32 ;
2009-01-21 15:13:48 +01:00
u32 basic_rate_mask ;
2008-11-14 19:42:39 +01:00
u16 aid ;
2009-07-07 19:08:07 +02:00
bool powersave_override ;
2009-06-23 10:39:45 -05:00
__le32 beacon_req_id ;
2009-07-16 20:03:47 +02:00
struct completion beacon_comp ;
2009-03-25 03:11:58 +01:00
/* cryptographic engine information */
2008-11-29 22:34:37 +01:00
u8 privacy_caps ;
u8 rx_keycache_size ;
2009-04-11 03:58:01 +02:00
unsigned long * used_rxkeys ;
2009-03-25 03:11:58 +01:00
2009-03-06 01:02:04 +01:00
/* LED management */
2009-05-06 14:16:15 -04:00
# ifdef CONFIG_P54_LEDS
2009-03-25 03:12:18 +01:00
struct p54_led_dev leds [ 4 ] ;
struct delayed_work led_work ;
2009-05-06 14:16:15 -04:00
# endif /* CONFIG_P54_LEDS */
2009-03-06 01:02:04 +01:00
u16 softled_state ; /* bit field of glowing LEDs */
2009-03-25 03:11:58 +01:00
/* statistics */
struct ieee80211_low_level_stats stats ;
struct delayed_work work ;
/* eeprom handling */
void * eeprom ;
struct completion eeprom_comp ;
2009-06-23 10:39:45 -05:00
struct mutex eeprom_mutex ;
2007-09-25 18:11:01 -07:00
} ;
2009-06-23 10:39:45 -05:00
/* interfaces for the drivers */
2007-09-25 18:11:01 -07:00
int p54_rx ( struct ieee80211_hw * dev , struct sk_buff * skb ) ;
2008-10-15 04:07:16 +02:00
void p54_free_skb ( struct ieee80211_hw * dev , struct sk_buff * skb ) ;
2008-09-01 22:48:41 +02:00
int p54_parse_firmware ( struct ieee80211_hw * dev , const struct firmware * fw ) ;
2009-01-11 01:18:38 +01:00
int p54_parse_eeprom ( struct ieee80211_hw * dev , void * eeprom , int len ) ;
2008-09-01 22:48:51 +02:00
int p54_read_eeprom ( struct ieee80211_hw * dev ) ;
2009-06-23 10:39:45 -05:00
2007-09-25 18:11:01 -07:00
struct ieee80211_hw * p54_init_common ( size_t priv_data_len ) ;
2009-03-05 21:30:10 +01:00
int p54_register_common ( struct ieee80211_hw * dev , struct device * pdev ) ;
2007-09-25 18:11:01 -07:00
void p54_free_common ( struct ieee80211_hw * dev ) ;
2009-06-23 10:39:45 -05:00
void p54_unregister_common ( struct ieee80211_hw * dev ) ;
2008-08-08 21:17:37 +02:00
# endif /* P54_H */