commit 7e43a7f43d522eb484098ea858e0d33eeb4f0d6e Author: Jiri Slaby Date: Tue Jun 19 22:59:46 2007 +0200 functions move and cleanup diff --git a/openhal/ath5k.h b/openhal/ath5k.h index 2b93265..451c3cc 100644 --- a/openhal/ath5k.h +++ b/openhal/ath5k.h @@ -456,7 +456,6 @@ enum ath5k_dmasize { }; - /****************\ RX DEFINITIONS \****************/ @@ -952,14 +951,6 @@ struct ath5k_capabilities { \***************************************/ /* - * Regulation stuff - */ - -/* Default regulation domain if stored value EEPROM value is invalid */ -#define AR5K_TUNE_REGDOMAIN DMN_FCC2_FCCA /* Canada */ -#define AR5K_TUNE_CTRY CTRY_DEFAULT - -/* * Misc defines */ @@ -1080,13 +1071,13 @@ u16 ath_hal_computetxtime(struct ath_hal *hal, const struct ath5k_rate_table *ra unsigned int ath_hal_getwirelessmodes(struct ath_hal *hal, enum ieee80211_countrycode country) ; /* Attach/Detach Functions */ struct ath_hal *ath5k_hw_init(u16 device, void *sc, void __iomem *sh, enum ath5k_status *status); -bool ath5k_hw_nic_wakeup(struct ath_hal *hal, u16 flags, bool initial); -u16 ath5k_hw_radio_revision(struct ath_hal *hal, enum ath5k_chip chip); +//bool ath5k_hw_nic_wakeup(struct ath_hal *hal, u16 flags, bool initial); +//u16 ath5k_hw_radio_revision(struct ath_hal *hal, enum ath5k_chip chip); const struct ath5k_rate_table *ath5k_hw_get_rate_table(struct ath_hal *hal, unsigned int mode); void ath5k_hw_detach(struct ath_hal *hal); /* Reset Functions */ bool ath5k_hw_reset(struct ath_hal *hal, enum ieee80211_if_types op_mode, struct ath5k_channel *channel, bool change_channel, enum ath5k_status *status); -bool ath5k_hw_nic_reset(struct ath_hal *hal, u32 val); +//bool ath5k_hw_nic_reset(struct ath_hal *hal, u32 val); /* Power management functions */ bool ath5k_hw_set_power(struct ath_hal *hal, enum ath5k_power_mode mode, bool set_chip, u16 sleep_duration); enum ath5k_power_mode ath5k_hw_get_power_mode(struct ath_hal *hal); @@ -1181,10 +1172,7 @@ unsigned int ath_hal_mhz2ieee(unsigned int freq, u_int flags); unsigned int ath_hal_ieee2mhz(unsigned int chan, u_int flags); bool ath5k_check_channel(struct ath_hal *hal, u16 freq, unsigned int flags); bool ath_hal_init_channels(struct ath_hal *hal, struct ath5k_channel *channels, unsigned int max_channels, u_int *channels_size, enum ieee80211_countrycode country, u16 mode, bool outdoor, bool extended); -u16 ath5k_regdomain_from_ieee(enum ieee80211_regdomain ieee); -enum ieee80211_regdomain ath5k_regdomain_to_ieee(u16 regdomain); u16 ath5k_get_regdomain(struct ath_hal *hal); -u16 ath5k_hw_get_regdomain(struct ath_hal *hal); /* PHY/RF access functions */ bool ath5k_hw_channel(struct ath_hal *hal, struct ath5k_channel *channel); u32 ath5k_hw_rf5110_chan2athchan(struct ath5k_channel *channel); @@ -1208,21 +1196,11 @@ bool ath5k_hw_rf5112_rfregs(struct ath_hal *hal, struct ath5k_channel *channel, void ath5k_hw_ar5211_rfregs(struct ath_hal *hal, struct ath5k_channel *channel, unsigned int freq, unsigned int ee_mode); bool ath5k_hw_rfgain(struct ath_hal *hal, unsigned int phy, u_int freq); enum ath5k_rfgain ath5k_hw_get_rf_gain(struct ath_hal *hal); -/* TX power setup */ /* Misc functions */ void ath5k_hw_dump_state(struct ath_hal *hal); -bool ath5k_hw_has_veol(struct ath_hal *hal); -void ath5k_hw_get_tx_inter_queue(struct ath_hal *hal, u32 *i); -void ath5k_hw_set_rx_signal(struct ath_hal *hal, const struct ath5k_node_stats *stats); -bool ath5k_hw_get_diag_state(struct ath_hal *hal, int request, const void *args, u32 argsize, void **result, u32 *resultsize); -bool ath5k_hw_detect_card_present(struct ath_hal *hal); enum ath5k_status ath5k_hw_get_capability(struct ath_hal *hal, enum ath5k_capability_type cap_type,u32 capability, u32 *result) ; bool ath5k_hw_set_capability(struct ath_hal *hal, enum ath5k_capability_type cap_type, u32 capability, u32 setting, enum ath5k_status *status) ; bool ath5k_hw_query_pspoll_support(struct ath_hal *hal); -bool ath5k_hw_init_pspoll(struct ath_hal *hal); bool ath5k_hw_enable_pspoll(struct ath_hal *hal, u8 *bssid, u16 assoc_id); bool ath5k_hw_disable_pspoll(struct ath_hal *hal); -const char *ath5k_printver(enum ath5k_srev_type type, u32 val); -void ath5k_radar_alert(struct ath_hal *hal); -void ath5k_hw_fill(struct ath_hal *hal); #endif /* _AR5K_H */ diff --git a/openhal/ath5k_hw.c b/openhal/ath5k_hw.c index c384231..a56d14e 100644 --- a/openhal/ath5k_hw.c +++ b/openhal/ath5k_hw.c @@ -78,11 +78,34 @@ static const struct ath5k_rate_table ath5k_rt_turbo = AR5K_RATES_TURBO; static const struct ath5k_rate_table ath5k_rt_xr = AR5K_RATES_XR; /*Prototypes*/ -bool ath5k_hw_nic_reset(struct ath_hal *, u32); -bool ath5k_hw_nic_wakeup(struct ath_hal *, u16, bool); -u16 ath5k_hw_radio_revision(struct ath_hal *, enum ath5k_chip); -void ath5k_hw_fill(struct ath_hal *); -bool ath5k_hw_txpower(struct ath_hal *, struct ath5k_channel *, unsigned int); +static bool ath5k_hw_nic_reset(struct ath_hal *, u32); +static bool ath5k_hw_nic_wakeup(struct ath_hal *, u16, bool); +static u16 ath5k_hw_radio_revision(struct ath_hal *, enum ath5k_chip); +static bool ath5k_hw_txpower(struct ath_hal *, struct ath5k_channel *, + unsigned int); +static bool ath5k_hw_setup_4word_tx_desc(struct ath_hal *, struct ath_desc *, + unsigned int, unsigned int, enum ath5k_pkt_type, unsigned int, + unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, + unsigned int, unsigned int); +static bool ath5k_hw_setup_xr_tx_desc(struct ath_hal *, struct ath_desc *, + unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, + unsigned int); +static bool ath5k_hw_fill_4word_tx_desc(struct ath_hal *, struct ath_desc *, + unsigned int, bool, bool, const struct ath_desc *); +static enum ath5k_status ath5k_hw_proc_4word_tx_status(struct ath_hal *, + struct ath_desc *); +static bool ath5k_hw_setup_2word_tx_desc(struct ath_hal *, struct ath_desc *, + unsigned int, unsigned int, enum ath5k_pkt_type, unsigned int, + unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, + unsigned int, unsigned int); +static bool ath5k_hw_fill_2word_tx_desc(struct ath_hal *, struct ath_desc *, + unsigned int, bool, bool, const struct ath_desc *); +static enum ath5k_status ath5k_hw_proc_2word_tx_status(struct ath_hal *, + struct ath_desc *); +static enum ath5k_status ath5k_hw_proc_new_rx_status(struct ath_hal *, + struct ath_desc *, u32, struct ath_desc *); +static enum ath5k_status ath5k_hw_proc_old_rx_status(struct ath_hal *, + struct ath_desc *, u32, struct ath_desc *); /* * Supported channels @@ -435,7 +458,27 @@ ath5k_hw_init(u16 device, void *sc, void __iomem *sh, enum ath5k_status *status) hal->ah_version = mac_version; /*Fill the hal struct with the needed functions*/ - ath5k_hw_fill(hal); + if (hal->ah_version == AR5K_AR5212) + hal->ah_magic = AR5K_EEPROM_MAGIC_5212; + else if (hal->ah_version == AR5K_AR5211) + hal->ah_magic = AR5K_EEPROM_MAGIC_5211; + + if (hal->ah_version == AR5K_AR5212) { + hal->ah_setup_tx_desc = ath5k_hw_setup_4word_tx_desc; + hal->ah_setup_xtx_desc = ath5k_hw_setup_xr_tx_desc; + hal->ah_fill_tx_desc = ath5k_hw_fill_4word_tx_desc; + hal->ah_proc_tx_desc = ath5k_hw_proc_4word_tx_status; + } else { + hal->ah_setup_tx_desc = ath5k_hw_setup_2word_tx_desc; + hal->ah_setup_xtx_desc = ath5k_hw_setup_xr_tx_desc; + hal->ah_fill_tx_desc = ath5k_hw_fill_2word_tx_desc; + hal->ah_proc_tx_desc = ath5k_hw_proc_2word_tx_status; + } + + if (hal->ah_version == AR5K_AR5212) + hal->ah_proc_rx_desc = ath5k_hw_proc_new_rx_status; + else if (hal->ah_version <= AR5K_AR5211) + hal->ah_proc_rx_desc = ath5k_hw_proc_old_rx_status; /* Bring device out of sleep and reset it's units */ if (ath5k_hw_nic_wakeup(hal, AR5K_INIT_MODE, true) != true) @@ -555,7 +598,7 @@ ath5k_hw_init(u16 device, void *sc, void __iomem *sh, enum ath5k_status *status) /* * Bring up MAC + PHY Chips */ -bool +static bool ath5k_hw_nic_wakeup(struct ath_hal *hal, u16 flags, bool initial) { u32 turbo, mode, clock; @@ -686,7 +729,7 @@ ath5k_hw_nic_wakeup(struct ath_hal *hal, u16 flags, bool initial) /* * Get the PHY Chip revision */ -u16 +static u16 ath5k_hw_radio_revision(struct ath_hal *hal, enum ath5k_chip chip) { int i; @@ -1370,7 +1413,7 @@ ath5k_hw_reset(struct ath_hal *hal, enum ieee80211_if_types op_mode, /* * Reset chipset */ -bool +static bool ath5k_hw_nic_reset(struct ath_hal *hal, u32 val) { bool ret = false; @@ -1870,13 +1913,6 @@ ath5k_hw_get_isr(struct ath_hal *hal, u32 *interrupt_mask) *interrupt_mask |= AR5K_INT_BNR; } - /* - * Special interrupt handling (not caught by the driver) - */ - if (((*interrupt_mask) & AR5K_ISR_RXPHY) && - hal->ah_radar.r_enabled == true) - ath5k_radar_alert(hal); - /* * XXX: BMISS interrupts may occur after association. * I found this on 5210 code but it needs testing @@ -3882,8 +3918,6 @@ ath5k_hw_get_slot_time(struct ath_hal *hal) } - - /******************************\ Hardware Descriptor Functions \******************************/ @@ -4907,35 +4941,6 @@ for loop starts from 1 and all channels are marked as 5GHz M.F.*/ return true; } -/* - * Regdomain stuff, these also don't belong here etc - */ - -u16 -ath5k_regdomain_from_ieee(enum ieee80211_regdomain ieee) -{ - u32 regdomain = (u32)ieee; - - /* - * Use the default regulation domain if the value is empty - * or not supported by the net80211 regulation code. - */ - if (ieee80211_regdomain2flag(regdomain, - IEEE80211_CHANNELS_5GHZ_MIN) == DMN_DEBUG) - return (u16)AR5K_TUNE_REGDOMAIN; - - /* It is supported, just return the value */ - return regdomain; -} - -enum ieee80211_regdomain -ath5k_regdomain_to_ieee(u16 regdomain) -{ - enum ieee80211_regdomain ieee = (enum ieee80211_regdomain)regdomain; - - return ieee; -} - u16 ath5k_get_regdomain(struct ath_hal *hal) { @@ -4963,16 +4968,6 @@ ath5k_get_regdomain(struct ath_hal *hal) return regdomain; } -u16 /*TODO:Get rid of this*/ -ath5k_hw_get_regdomain(struct ath_hal *hal) -{ - AR5K_TRACE; - return ath5k_get_regdomain(hal); -} - - - - /*************************\ PHY/RF access functions \*************************/ @@ -5978,7 +5973,7 @@ ath5k_hw_get_rf_gain(struct ath_hal *hal) /* * Initialize the tx power table (not fully implemented) */ -void +static void ath5k_txpower_table(struct ath_hal *hal, struct ath5k_channel *channel, s16 max_power) { u16 txpower, *rates; @@ -6016,7 +6011,7 @@ ath5k_txpower_table(struct ath_hal *hal, struct ath5k_channel *channel, s16 max_ /* * Set transmition power */ -bool /*O.K. - txpower_table is unimplemented so this doesn't work*/ +static bool /*O.K. - txpower_table is unimplemented so this doesn't work*/ ath5k_hw_txpower(struct ath_hal *hal, struct ath5k_channel *channel, unsigned int txpower) { bool tpc = hal->ah_txpower.txp_tpc; @@ -6196,54 +6191,6 @@ ath5k_hw_dump_state(struct ath_hal *hal) #endif } -bool /*what about VEOL cap ?*/ -ath5k_hw_has_veol(struct ath_hal *hal) -{ - return true; -} - -void /*Unimplemented*/ -ath5k_hw_get_tx_inter_queue(struct ath_hal *hal, u32 *i) -{ - AR5K_TRACE; - /* XXX */ -} - -void /*Added struct ath5k_node_stats argument*/ -ath5k_hw_set_rx_signal(struct ath_hal *hal, const struct ath5k_node_stats *stats) -{ - AR5K_TRACE; - /* Signal state monitoring is not yet supported */ -} - -bool /*Added arguments*/ -ath5k_hw_get_diag_state(struct ath_hal *hal, int request, - const void *args, u32 argsize, void **result, u32 *resultsize) -{ - AR5K_TRACE; - /* - * We'll ignore this right now. This seems to be some kind of an obscure - * debugging interface for the binary-only HAL. - */ - return false; -} - -bool /*TODO:Is this realy needed ? We have get_isr that will return 0xfff.. on removal*/ -ath5k_hw_detect_card_present(struct ath_hal *hal) -{ - u16 magic; - AR5K_TRACE; - /* - * Checking the EEPROM's magic value could be an indication - * if the card is still present. I didn't find another suitable - * way to do this. - */ - if (ath5k_hw_eeprom_read(hal, AR5K_EEPROM_MAGIC, &magic) != 0) - return false; - - return magic == AR5K_EEPROM_MAGIC_VALUE ? true : false; -} - enum ath5k_status ath5k_hw_get_capability(struct ath_hal *hal, enum ath5k_capability_type cap_type, u32 capability, u32 *result) @@ -6327,16 +6274,6 @@ ath5k_hw_query_pspoll_support(struct ath_hal *hal) } bool -ath5k_hw_init_pspoll(struct ath_hal *hal) -{ - AR5K_TRACE; - /* - * Not used - */ - return false; -} - -bool ath5k_hw_enable_pspoll(struct ath_hal *hal, u8 *bssid, u16 assoc_id) { @@ -6364,82 +6301,3 @@ ath5k_hw_disable_pspoll(struct ath_hal *hal) return false; } - -const char * /*O.K. - TODO:Get rid of this*/ -ath5k_printver(enum ath5k_srev_type type, u32 val) -{ - struct ath5k_srev_name names[] = AR5K_SREV_NAME; - const char *name = "xxxx"; - int i; - - for (i = 0; i < ARRAY_SIZE(names); i++) { - if (type == AR5K_VERSION_DEV) { - if (names[i].sr_type == type && - names[i].sr_val == val) { - name = names[i].sr_name; - break; - } - continue; - } - if (names[i].sr_type != type || - names[i].sr_val == AR5K_SREV_UNKNOWN) - continue; - if ((val & 0xff) < names[i + 1].sr_val) { - name = names[i].sr_name; - break; - } - } - - return name; -} - -void /*O.K. - TODO: Implement this in if_ath.c (ath_intr)*/ -ath5k_radar_alert(struct ath_hal *hal) -{ - /* - * Limit ~1/s - */ - -// if (hal->ah_radar.r_last_channel.freq == -// hal->ah_current_channel.freq && -// tick < (hal->ah_radar.r_last_alert + hz)) - return; - -/* hal->ah_radar.r_last_channel.freq = - hal->ah_current_channel.freq; - hal->ah_radar.r_last_channel.channel_flags = - hal->ah_current_channel.channel_flags; - hal->ah_radar.r_last_alert = tick; - - AR5K_PRINTF("Possible radar activity detected at %u MHz (tick %u)\n", - hal->ah_radar.r_last_alert, hal->ah_current_channel.freq);*/ -} - -/* - * Fill the hal struct, left here for combatibility - */ -void /*Functions added*/ -ath5k_hw_fill(struct ath_hal *hal) -{ - if (hal->ah_version == AR5K_AR5212) - hal->ah_magic = AR5K_EEPROM_MAGIC_5212; - else if (hal->ah_version == AR5K_AR5211) - hal->ah_magic = AR5K_EEPROM_MAGIC_5211; - - if (hal->ah_version == AR5K_AR5212) { - hal->ah_setup_tx_desc = ath5k_hw_setup_4word_tx_desc; - hal->ah_setup_xtx_desc = ath5k_hw_setup_xr_tx_desc; - hal->ah_fill_tx_desc = ath5k_hw_fill_4word_tx_desc; - hal->ah_proc_tx_desc = ath5k_hw_proc_4word_tx_status; - } else { - hal->ah_setup_tx_desc = ath5k_hw_setup_2word_tx_desc; - hal->ah_setup_xtx_desc = ath5k_hw_setup_xr_tx_desc; - hal->ah_fill_tx_desc = ath5k_hw_fill_2word_tx_desc; - hal->ah_proc_tx_desc = ath5k_hw_proc_2word_tx_status; - } - - if (hal->ah_version == AR5K_AR5212) - hal->ah_proc_rx_desc = ath5k_hw_proc_new_rx_status; - else if (hal->ah_version <= AR5K_AR5211) - hal->ah_proc_rx_desc = ath5k_hw_proc_old_rx_status; -} diff --git a/openhal/ieee80211_regdomain.c b/openhal/ieee80211_regdomain.c index a2fd25a..f600604 100644 --- a/openhal/ieee80211_regdomain.c +++ b/openhal/ieee80211_regdomain.c @@ -87,3 +87,27 @@ u32 ieee80211_regdomain2flag(u16 regdomain, u16 mhz) return (u32)DMN_DEBUG; } + +u16 ath5k_regdomain_from_ieee(enum ieee80211_regdomain ieee) +{ + u32 regdomain = (u32)ieee; + + /* + * Use the default regulation domain if the value is empty + * or not supported by the net80211 regulation code. + */ + if (ieee80211_regdomain2flag(regdomain, + IEEE80211_CHANNELS_5GHZ_MIN) == DMN_DEBUG) + return (u16)AR5K_TUNE_REGDOMAIN; + + /* It is supported, just return the value */ + return regdomain; +} + +enum ieee80211_regdomain ath5k_regdomain_to_ieee(u16 regdomain) +{ + enum ieee80211_regdomain ieee = (enum ieee80211_regdomain)regdomain; + + return ieee; +} + diff --git a/openhal/ieee80211_regdomain.h b/openhal/ieee80211_regdomain.h index 8d9ad74..1f1ed97 100644 --- a/openhal/ieee80211_regdomain.h +++ b/openhal/ieee80211_regdomain.h @@ -6,11 +6,16 @@ * copyright notice and this permission notice appear in all copies. */ -#ifndef _NET80211_IEEE80211_REGDOMAIN_H_ -#define _NET80211_IEEE80211_REGDOMAIN_H_ +#ifndef _IEEE80211_REGDOMAIN_H_ +#define _IEEE80211_REGDOMAIN_H_ #include +/* Default regulation domain if stored value EEPROM value is invalid */ +#define AR5K_TUNE_REGDOMAIN DMN_FCC2_FCCA /* Canada */ +#define AR5K_TUNE_CTRY CTRY_DEFAULT + + enum ieee80211_regdomain { DMN_DEFAULT = 0x00, DMN_NULL_WORLD = 0x03, @@ -482,5 +487,7 @@ struct ieee80211_regchannel { } u32 ieee80211_regdomain2flag(u16, u16); +u16 ath5k_regdomain_from_ieee(enum ieee80211_regdomain ieee); +enum ieee80211_regdomain ath5k_regdomain_to_ieee(u16 regdomain); #endif /* _NET80211_IEEE80211_REGDOMAIN_H_ */