Path: blob/main/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_radar.c
48525 views
/*1* Copyright (c) 2013 Qualcomm Atheros, Inc.2*3* Permission to use, copy, modify, and/or distribute this software for any4* purpose with or without fee is hereby granted, provided that the above5* copyright notice and this permission notice appear in all copies.6*7* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH8* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY9* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,10* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM11* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR12* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR13* PERFORMANCE OF THIS SOFTWARE.14*/151617#include "opt_ah.h"1819#include "ah.h"20#include "ah_desc.h"21#include "ah_internal.h"2223#include "ar9300/ar9300.h"24#include "ar9300/ar9300phy.h"25#include "ar9300/ar9300reg.h"2627/*28* Default 5413/9300 radar phy parameters29* Values adjusted to fix EV76432/EV7632030*/31#define AR9300_DFS_FIRPWR -2832#define AR9300_DFS_RRSSI 033#define AR9300_DFS_HEIGHT 1034#define AR9300_DFS_PRSSI 635#define AR9300_DFS_INBAND 836#define AR9300_DFS_RELPWR 837#define AR9300_DFS_RELSTEP 1238#define AR9300_DFS_MAXLEN 2553940/*41* This PRSSI value should be used during CAC.42*/43#define AR9300_DFS_PRSSI_CAC 104445/*46* make sure that value matches value in ar9300_osprey_2p2_mac_core[][2]47* for register 0x1040 to 0x104c48*/49#define AR9300_DEFAULT_DIFS 0x002ffc0f50#define AR9300_FCC_RADARS_FCC_OFFSET 45152struct dfs_pulse ar9300_etsi_radars[] = {5354/* for short pulses, RSSI threshold should be smaller than55* Kquick-drop. The chip has only one chance to drop the gain which56* will be reported as the estimated RSSI */5758/* TYPE staggered pulse */59/* 0.8-2us, 2-3 bursts,300-400 PRF, 10 pulses each */60{30, 2, 300, 400, 2, 30, 3, 0, 5, 15, 0, 0, 1, 31}, /* Type 5*/61/* 0.8-2us, 2-3 bursts, 400-1200 PRF, 15 pulses each */62{30, 2, 400, 1200, 2, 30, 7, 0, 5, 15, 0, 0, 0, 32}, /* Type 6 */6364/* constant PRF based */65/* 0.8-5us, 200 300 PRF, 10 pulses */66{10, 5, 200, 400, 0, 24, 5, 0, 8, 15, 0, 0, 2, 33}, /* Type 1 */67{10, 5, 400, 600, 0, 24, 5, 0, 8, 15, 0, 0, 2, 37}, /* Type 1 */68{10, 5, 600, 800, 0, 24, 5, 0, 8, 15, 0, 0, 2, 38}, /* Type 1 */69{10, 5, 800, 1000, 0, 24, 5, 0, 8, 15, 0, 0, 2, 39}, /* Type 1 */70// {10, 5, 200, 1000, 0, 24, 5, 0, 8, 15, 0, 0, 2, 33},7172/* 0.8-15us, 200-1600 PRF, 15 pulses */73{15, 15, 200, 1600, 0, 24, 8, 0, 18, 24, 0, 0, 0, 34}, /* Type 2 */7475/* 0.8-15us, 2300-4000 PRF, 25 pulses*/76{25, 15, 2300, 4000, 0, 24, 10, 0, 18, 24, 0, 0, 0, 35}, /* Type 3 */7778/* 20-30us, 2000-4000 PRF, 20 pulses*/79{20, 30, 2000, 4000, 0, 24, 8, 19, 33, 24, 0, 0, 0, 36}, /* Type 4 */80};818283/* The following are for FCC Bin 1-4 pulses */84struct dfs_pulse ar9300_fcc_radars[] = {8586/* following two filters are specific to Japan/MKK4 */87// {18, 1, 720, 720, 1, 6, 6, 0, 1, 18, 0, 3, 0, 17}, // 1389 +/- 6 us88// {18, 4, 250, 250, 1, 10, 5, 1, 6, 18, 0, 3, 0, 18}, // 4000 +/- 6 us89// {18, 5, 260, 260, 1, 10, 6, 1, 6, 18, 0, 3, 0, 19}, // 3846 +/- 7 us90{18, 1, 720, 720, 0, 6, 6, 0, 1, 18, 0, 3, 0, 17}, // 1389 +/- 6 us91{18, 4, 250, 250, 0, 10, 5, 1, 6, 18, 0, 3, 0, 18}, // 4000 +/- 6 us92{18, 5, 260, 260, 0, 10, 6, 1, 6, 18, 0, 3, 1, 19}, // 3846 +/- 7 us93// {18, 5, 260, 260, 1, 10, 6, 1, 6, 18, 0, 3, 1, 20}, // 3846 +/- 7 us9495{18, 5, 260, 260, 1, 10, 6, 1, 6, 18, 0, 3, 1, 20}, // 3846 +/- 7 us969798/* following filters are common to both FCC and JAPAN */99100// FCC TYPE 1101// {18, 1, 325, 1930, 0, 6, 7, 0, 1, 18, 0, 3, 0, 0}, // 518 to 3066102{18, 1, 700, 700, 0, 6, 5, 0, 1, 18, 0, 3, 1, 8},103{18, 1, 350, 350, 0, 6, 5, 0, 1, 18, 0, 3, 0, 0},104105106// FCC TYPE 6107// {9, 1, 3003, 3003, 1, 7, 5, 0, 1, 18, 0, 0, 0, 1}, // 333 +/- 7 us108//{9, 1, 3003, 3003, 1, 7, 5, 0, 1, 18, 0, 0, 0, 1},109{9, 1, 3003, 3003, 0, 7, 5, 0, 1, 18, 0, 0, 1, 1},110111// FCC TYPE 2112{23, 5, 4347, 6666, 0, 18, 11, 0, 7, 22, 0, 3, 0, 2},113114// FCC TYPE 3115{18, 10, 2000, 5000, 0, 23, 8, 6, 13, 22, 0, 3, 0, 5},116117// FCC TYPE 4118{16, 15, 2000, 5000, 0, 25, 7, 11, 23, 22, 0, 3, 0, 11},119120};121122struct dfs_bin5pulse ar9300_bin5pulses[] = {123{2, 28, 105, 12, 22, 5},124};125126127#if 0128/*129* Find the internal HAL channel corresponding to the130* public HAL channel specified in c131*/132133static HAL_CHANNEL_INTERNAL *134getchannel(struct ath_hal *ah, const struct ieee80211_channel *c)135{136#define CHAN_FLAGS (CHANNEL_ALL | CHANNEL_HALF | CHANNEL_QUARTER)137HAL_CHANNEL_INTERNAL *base, *cc;138int flags = c->channel_flags & CHAN_FLAGS;139int n, lim;140141/*142* Check current channel to avoid the lookup.143*/144cc = AH_PRIVATE(ah)->ah_curchan;145if (cc != AH_NULL && cc->channel == c->channel &&146(cc->channel_flags & CHAN_FLAGS) == flags) {147return cc;148}149150/* binary search based on known sorting order */151base = AH_TABLES(ah)->ah_channels;152n = AH_PRIVATE(ah)->ah_nchan;153/* binary search based on known sorting order */154for (lim = n; lim != 0; lim >>= 1) {155int d;156cc = &base[lim >> 1];157d = c->channel - cc->channel;158if (d == 0) {159if ((cc->channel_flags & CHAN_FLAGS) == flags) {160return cc;161}162d = flags - (cc->channel_flags & CHAN_FLAGS);163}164HALDEBUG(ah, HAL_DEBUG_DFS, "%s: channel %u/0x%x d %d\n", __func__,165cc->channel, cc->channel_flags, d);166if (d > 0) {167base = cc + 1;168lim--;169}170}171HALDEBUG(ah, HAL_DEBUG_DFS, "%s: no match for %u/0x%x\n",172__func__, c->channel, c->channel_flags);173return AH_NULL;174#undef CHAN_FLAGS175}176177/*178* Check the internal channel list to see if the desired channel179* is ok to release from the NOL. If not, then do nothing. If so,180* mark the channel as clear and reset the internal tsf time181*/182void183ar9300_check_dfs(struct ath_hal *ah, struct ieee80211_channel *chan)184{185HAL_CHANNEL_INTERNAL *ichan = AH_NULL;186187ichan = getchannel(ah, chan);188if (ichan == AH_NULL) {189return;190}191if (!(ichan->priv_flags & CHANNEL_INTERFERENCE)) {192return;193}194195ichan->priv_flags &= ~CHANNEL_INTERFERENCE;196ichan->dfs_tsf = 0;197}198199/*200* This function marks the channel as having found a dfs event201* It also marks the end time that the dfs event should be cleared202* If the channel is already marked, then tsf end time can only203* be increased204*/205void206ar9300_dfs_found(struct ath_hal *ah, struct ieee80211_channel *chan, u_int64_t nol_time)207{208HAL_CHANNEL_INTERNAL *ichan;209210ichan = getchannel(ah, chan);211if (ichan == AH_NULL) {212return;213}214if (!(ichan->priv_flags & CHANNEL_INTERFERENCE)) {215ichan->dfs_tsf = ar9300_get_tsf64(ah);216}217ichan->dfs_tsf += nol_time;218ichan->priv_flags |= CHANNEL_INTERFERENCE;219chan->priv_flags |= CHANNEL_INTERFERENCE;220}221#endif222223/*224* Enable radar detection and set the radar parameters per the225* values in pe226*/227void228ar9300_enable_dfs(struct ath_hal *ah, HAL_PHYERR_PARAM *pe)229{230u_int32_t val;231struct ath_hal_private *ahp = AH_PRIVATE(ah);232const struct ieee80211_channel *chan = ahp->ah_curchan;233struct ath_hal_9300 *ah9300 = AH9300(ah);234int reg_writes = 0;235236val = OS_REG_READ(ah, AR_PHY_RADAR_0);237val |= AR_PHY_RADAR_0_FFT_ENA;238239240if (pe->pe_enabled != HAL_PHYERR_PARAM_NOVAL) {241val &= ~AR_PHY_RADAR_0_ENA;242val |= SM(pe->pe_enabled, AR_PHY_RADAR_0_ENA);243}244245if (pe->pe_firpwr != HAL_PHYERR_PARAM_NOVAL) {246val &= ~AR_PHY_RADAR_0_FIRPWR;247val |= SM(pe->pe_firpwr, AR_PHY_RADAR_0_FIRPWR);248}249if (pe->pe_rrssi != HAL_PHYERR_PARAM_NOVAL) {250val &= ~AR_PHY_RADAR_0_RRSSI;251val |= SM(pe->pe_rrssi, AR_PHY_RADAR_0_RRSSI);252}253if (pe->pe_height != HAL_PHYERR_PARAM_NOVAL) {254val &= ~AR_PHY_RADAR_0_HEIGHT;255val |= SM(pe->pe_height, AR_PHY_RADAR_0_HEIGHT);256}257if (pe->pe_prssi != HAL_PHYERR_PARAM_NOVAL) {258val &= ~AR_PHY_RADAR_0_PRSSI;259if (AR_SREV_AR9580(ah) || AR_SREV_WASP(ah) || AR_SREV_SCORPION(ah)) {260#if 0261if (ah->ah_use_cac_prssi) {262val |= SM(AR9300_DFS_PRSSI_CAC, AR_PHY_RADAR_0_PRSSI);263} else {264#endif265val |= SM(pe->pe_prssi, AR_PHY_RADAR_0_PRSSI);266// }267} else {268val |= SM(pe->pe_prssi, AR_PHY_RADAR_0_PRSSI);269}270}271if (pe->pe_inband != HAL_PHYERR_PARAM_NOVAL) {272val &= ~AR_PHY_RADAR_0_INBAND;273val |= SM(pe->pe_inband, AR_PHY_RADAR_0_INBAND);274}275OS_REG_WRITE(ah, AR_PHY_RADAR_0, val);276277val = OS_REG_READ(ah, AR_PHY_RADAR_1);278val |= AR_PHY_RADAR_1_MAX_RRSSI | AR_PHY_RADAR_1_BLOCK_CHECK;279if (pe->pe_maxlen != HAL_PHYERR_PARAM_NOVAL) {280val &= ~AR_PHY_RADAR_1_MAXLEN;281val |= SM(pe->pe_maxlen, AR_PHY_RADAR_1_MAXLEN);282}283if (pe->pe_relstep != HAL_PHYERR_PARAM_NOVAL) {284val &= ~AR_PHY_RADAR_1_RELSTEP_THRESH;285val |= SM(pe->pe_relstep, AR_PHY_RADAR_1_RELSTEP_THRESH);286}287if (pe->pe_relpwr != HAL_PHYERR_PARAM_NOVAL) {288val &= ~AR_PHY_RADAR_1_RELPWR_THRESH;289val |= SM(pe->pe_relpwr, AR_PHY_RADAR_1_RELPWR_THRESH);290}291OS_REG_WRITE(ah, AR_PHY_RADAR_1, val);292293if (ath_hal_getcapability(ah, HAL_CAP_EXT_CHAN_DFS, 0, 0) == HAL_OK) {294val = OS_REG_READ(ah, AR_PHY_RADAR_EXT);295if (IEEE80211_IS_CHAN_HT40(chan)) {296/* Enable extension channel radar detection */297OS_REG_WRITE(ah, AR_PHY_RADAR_EXT, val | AR_PHY_RADAR_EXT_ENA);298} else {299/* HT20 mode, disable extension channel radar detect */300OS_REG_WRITE(ah, AR_PHY_RADAR_EXT, val & ~AR_PHY_RADAR_EXT_ENA);301}302}303/*304apply DFS postamble array from INI305column 0 is register ID, column 1 is HT20 value, colum2 is HT40 value306*/307308if (AR_SREV_AR9580(ah) || AR_SREV_WASP(ah) || AR_SREV_OSPREY_22(ah) || AR_SREV_SCORPION(ah)) {309REG_WRITE_ARRAY(&ah9300->ah_ini_dfs, IEEE80211_IS_CHAN_HT40(chan)? 2:1, reg_writes);310}311#ifdef ATH_HAL_DFS_CHIRPING_FIX_APH128312ath_hal_printf(ah, "DFS change the timing value\n");313if (AR_SREV_AR9580(ah) && IEEE80211_IS_CHAN_HT40(chan)) {314OS_REG_WRITE(ah, AR_PHY_TIMING6, 0x3140c00a);315}316#endif317318}319320/*321* Get the radar parameter values and return them in the pe322* structure323*/324void325ar9300_get_dfs_thresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe)326{327u_int32_t val, temp;328329val = OS_REG_READ(ah, AR_PHY_RADAR_0);330temp = MS(val, AR_PHY_RADAR_0_FIRPWR);331temp |= ~(AR_PHY_RADAR_0_FIRPWR >> AR_PHY_RADAR_0_FIRPWR_S);332pe->pe_firpwr = temp;333pe->pe_rrssi = MS(val, AR_PHY_RADAR_0_RRSSI);334pe->pe_height = MS(val, AR_PHY_RADAR_0_HEIGHT);335pe->pe_prssi = MS(val, AR_PHY_RADAR_0_PRSSI);336pe->pe_inband = MS(val, AR_PHY_RADAR_0_INBAND);337pe->pe_enabled = !! MS(val, AR_PHY_RADAR_0_ENA);338339val = OS_REG_READ(ah, AR_PHY_RADAR_1);340341pe->pe_relpwr = MS(val, AR_PHY_RADAR_1_RELPWR_THRESH);342pe->pe_enrelpwr = !! (val & AR_PHY_RADAR_1_RELPWR_ENA);343344pe->pe_relstep = MS(val, AR_PHY_RADAR_1_RELSTEP_THRESH);345pe->pe_en_relstep_check = !! (val & AR_PHY_RADAR_1_RELSTEP_CHECK);346347pe->pe_maxlen = MS(val, AR_PHY_RADAR_1_MAXLEN);348}349350#if 0351HAL_BOOL352ar9300_radar_wait(struct ath_hal *ah, struct ieee80211_channel *chan)353{354struct ath_hal_private *ahp = AH_PRIVATE(ah);355356if (!ahp->ah_curchan) {357return AH_TRUE;358}359360/*361* Rely on the upper layers to determine that we have spent362* enough time waiting.363*/364chan->channel = ahp->ah_curchan->channel;365chan->channel_flags = ahp->ah_curchan->channel_flags;366chan->max_reg_tx_power = ahp->ah_curchan->max_reg_tx_power;367368ahp->ah_curchan->priv_flags |= CHANNEL_DFS_CLEAR;369chan->priv_flags = ahp->ah_curchan->priv_flags;370return AH_FALSE;371372}373#endif374375struct dfs_pulse *376ar9300_get_dfs_radars(377struct ath_hal *ah,378u_int32_t dfsdomain,379int *numradars,380struct dfs_bin5pulse **bin5pulses,381int *numb5radars,382HAL_PHYERR_PARAM *pe)383{384struct dfs_pulse *dfs_radars = AH_NULL;385switch (dfsdomain) {386case HAL_DFS_FCC_DOMAIN:387dfs_radars = &ar9300_fcc_radars[AR9300_FCC_RADARS_FCC_OFFSET];388*numradars =389ARRAY_LENGTH(ar9300_fcc_radars) - AR9300_FCC_RADARS_FCC_OFFSET;390*bin5pulses = &ar9300_bin5pulses[0];391*numb5radars = ARRAY_LENGTH(ar9300_bin5pulses);392HALDEBUG(ah, HAL_DEBUG_DFS, "%s: DFS_FCC_DOMAIN_9300\n", __func__);393break;394case HAL_DFS_ETSI_DOMAIN:395dfs_radars = &ar9300_etsi_radars[0];396*numradars = ARRAY_LENGTH(ar9300_etsi_radars);397*bin5pulses = &ar9300_bin5pulses[0];398*numb5radars = ARRAY_LENGTH(ar9300_bin5pulses);399HALDEBUG(ah, HAL_DEBUG_DFS, "%s: DFS_ETSI_DOMAIN_9300\n", __func__);400break;401case HAL_DFS_MKK4_DOMAIN:402dfs_radars = &ar9300_fcc_radars[0];403*numradars = ARRAY_LENGTH(ar9300_fcc_radars);404*bin5pulses = &ar9300_bin5pulses[0];405*numb5radars = ARRAY_LENGTH(ar9300_bin5pulses);406HALDEBUG(ah, HAL_DEBUG_DFS, "%s: DFS_MKK4_DOMAIN_9300\n", __func__);407break;408default:409HALDEBUG(ah, HAL_DEBUG_DFS, "%s: no domain\n", __func__);410return AH_NULL;411}412/* Set the default phy parameters per chip */413pe->pe_firpwr = AR9300_DFS_FIRPWR;414pe->pe_rrssi = AR9300_DFS_RRSSI;415pe->pe_height = AR9300_DFS_HEIGHT;416pe->pe_prssi = AR9300_DFS_PRSSI;417/*418we have an issue with PRSSI.419For normal operation we use AR9300_DFS_PRSSI, which is set to 6.420Please refer to EV91563, 94164.421However, this causes problem during CAC as no radar is detected422during that period with PRSSI=6. Only PRSSI= 10 seems to fix this.423We use this flag to keep track of change in PRSSI.424*/425426// ah->ah_use_cac_prssi = 0;427428pe->pe_inband = AR9300_DFS_INBAND;429pe->pe_relpwr = AR9300_DFS_RELPWR;430pe->pe_relstep = AR9300_DFS_RELSTEP;431pe->pe_maxlen = AR9300_DFS_MAXLEN;432return dfs_radars;433}434435HAL_BOOL436ar9300_get_default_dfs_thresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe)437{438439pe->pe_firpwr = AR9300_DFS_FIRPWR;440pe->pe_rrssi = AR9300_DFS_RRSSI;441pe->pe_height = AR9300_DFS_HEIGHT;442pe->pe_prssi = AR9300_DFS_PRSSI;443/* see prssi comment above */444445pe->pe_inband = AR9300_DFS_INBAND;446pe->pe_relpwr = AR9300_DFS_RELPWR;447pe->pe_relstep = AR9300_DFS_RELSTEP;448pe->pe_maxlen = AR9300_DFS_MAXLEN;449return (AH_TRUE);450}451452void ar9300_adjust_difs(struct ath_hal *ah, u_int32_t val)453{454if (val == 0) {455/*456* EV 116936:457* Restore the register values with that of the HAL structure.458* Do not assume and overwrite these values to whatever459* is in ar9300_osprey22.ini.460*/461struct ath_hal_9300 *ahp = AH9300(ah);462HAL_TX_QUEUE_INFO *qi;463int q;464465AH9300(ah)->ah_fccaifs = 0;466HALDEBUG(ah, HAL_DEBUG_DFS, "%s: restore DIFS \n", __func__);467for (q = 0; q < 4; q++) {468qi = &ahp->ah_txq[q];469OS_REG_WRITE(ah, AR_DLCL_IFS(q),470SM(qi->tqi_cwmin, AR_D_LCL_IFS_CWMIN)471| SM(qi->tqi_cwmax, AR_D_LCL_IFS_CWMAX)472| SM(qi->tqi_aifs, AR_D_LCL_IFS_AIFS));473}474} else {475/*476* These are values from George Lai and are specific to477* FCC domain. They are yet to be determined for other domains.478*/479480AH9300(ah)->ah_fccaifs = 1;481HALDEBUG(ah, HAL_DEBUG_DFS, "%s: set DIFS to default\n", __func__);482/*printk("%s: modify DIFS\n", __func__);*/483484OS_REG_WRITE(ah, AR_DLCL_IFS(0), 0x05fffc0f);485OS_REG_WRITE(ah, AR_DLCL_IFS(1), 0x05f0fc0f);486OS_REG_WRITE(ah, AR_DLCL_IFS(2), 0x05f03c07);487OS_REG_WRITE(ah, AR_DLCL_IFS(3), 0x05f01c03);488}489}490491u_int32_t ar9300_dfs_config_fft(struct ath_hal *ah, HAL_BOOL is_enable)492{493u_int32_t val;494495val = OS_REG_READ(ah, AR_PHY_RADAR_0);496497if (is_enable) {498val |= AR_PHY_RADAR_0_FFT_ENA;499} else {500val &= ~AR_PHY_RADAR_0_FFT_ENA;501}502503OS_REG_WRITE(ah, AR_PHY_RADAR_0, val);504val = OS_REG_READ(ah, AR_PHY_RADAR_0);505return val;506}507/*508function to adjust PRSSI value for CAC problem509510*/511void512ar9300_dfs_cac_war(struct ath_hal *ah, u_int32_t start)513{514u_int32_t val;515516if (AR_SREV_AR9580(ah) || AR_SREV_WASP(ah) || AR_SREV_SCORPION(ah)) {517val = OS_REG_READ(ah, AR_PHY_RADAR_0);518if (start) {519val &= ~AR_PHY_RADAR_0_PRSSI;520val |= SM(AR9300_DFS_PRSSI_CAC, AR_PHY_RADAR_0_PRSSI);521} else {522val &= ~AR_PHY_RADAR_0_PRSSI;523val |= SM(AR9300_DFS_PRSSI, AR_PHY_RADAR_0_PRSSI);524}525OS_REG_WRITE(ah, AR_PHY_RADAR_0, val | AR_PHY_RADAR_0_ENA);526// ah->ah_use_cac_prssi = start;527}528}529530#if 0531struct ieee80211_channel *532ar9300_get_extension_channel(struct ath_hal *ah)533{534struct ath_hal_private *ahp = AH_PRIVATE(ah);535struct ath_hal_private_tables *aht = AH_TABLES(ah);536int i = 0;537538HAL_CHANNEL_INTERNAL *ichan = AH_NULL;539CHAN_CENTERS centers;540541ichan = ahp->ah_curchan;542ar9300_get_channel_centers(ah, ichan, ¢ers);543if (centers.ctl_center == centers.ext_center) {544return AH_NULL;545}546for (i = 0; i < ahp->ah_nchan; i++) {547ichan = &aht->ah_channels[i];548if (ichan->channel == centers.ext_center) {549return (struct ieee80211_channel*)ichan;550}551}552return AH_NULL;553}554#endif555556HAL_BOOL557ar9300_is_fast_clock_enabled(struct ath_hal *ah)558{559struct ath_hal_private *ahp = AH_PRIVATE(ah);560561if (IS_5GHZ_FAST_CLOCK_EN(ah, ahp->ah_curchan)) {562return AH_TRUE;563}564return AH_FALSE;565}566567/*568* This should be enabled and linked into the build once569* radar support is enabled.570*/571#if 0572HAL_BOOL573ar9300_handle_radar_bb_panic(struct ath_hal *ah)574{575u_int32_t status;576u_int32_t val;577#ifdef AH_DEBUG578struct ath_hal_9300 *ahp = AH9300(ah);579#endif580581status = AH_PRIVATE(ah)->ah_bb_panic_last_status;582583if ( status == 0x04000539 ) {584/* recover from this BB panic without reset*/585/* set AR9300_DFS_FIRPWR to -1 */586val = OS_REG_READ(ah, AR_PHY_RADAR_0);587val &= (~AR_PHY_RADAR_0_FIRPWR);588val |= SM( 0x7f, AR_PHY_RADAR_0_FIRPWR);589OS_REG_WRITE(ah, AR_PHY_RADAR_0, val);590OS_DELAY(1);591/* set AR9300_DFS_FIRPWR to its default value */592val = OS_REG_READ(ah, AR_PHY_RADAR_0);593val &= ~AR_PHY_RADAR_0_FIRPWR;594val |= SM( AR9300_DFS_FIRPWR, AR_PHY_RADAR_0_FIRPWR);595OS_REG_WRITE(ah, AR_PHY_RADAR_0, val);596return AH_TRUE;597} else if (status == 0x0400000a) {598/* EV 92527 : reset required if we see this signature */599HALDEBUG(ah, HAL_DEBUG_DFS, "%s: BB Panic -- 0x0400000a\n", __func__);600return AH_FALSE;601} else if (status == 0x1300000a) {602/* EV92527: we do not need a reset if we see this signature */603HALDEBUG(ah, HAL_DEBUG_DFS, "%s: BB Panic -- 0x1300000a\n", __func__);604return AH_TRUE;605} else if ((AR_SREV_WASP(ah) || AR_SREV_HONEYBEE(ah)) && (status == 0x04000409)) {606return AH_TRUE;607} else {608if (ar9300_get_capability(ah, HAL_CAP_LDPCWAR, 0, AH_NULL) == HAL_OK &&609(status & 0xff00000f) == 0x04000009 &&610status != 0x04000409 &&611status != 0x04000b09 &&612status != 0x04000e09 &&613(status & 0x0000ff00))614{615/* disable RIFS Rx */616#ifdef AH_DEBUG617HALDEBUG(ah, HAL_DEBUG_UNMASKABLE, "%s: BB status=0x%08x rifs=%d - disable\n",618__func__, status, ahp->ah_rifs_enabled);619ar9300_set_rifs_delay(ah, AH_FALSE);620}621return AH_FALSE;622}623}624#endif625#endif626627628