summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath/ath5k/phy.c
AgeCommit message (Collapse)Author
2016-04-12cfg80211: remove enum ieee80211_bandJohannes Berg
This enum is already perfectly aliased to enum nl80211_band, and the only reason for it is that we get IEEE80211_NUM_BANDS out of it. There's no really good reason to not declare the number of bands in nl80211 though, so do that and remove the cfg80211 one. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2016-03-11ath5k: fix incorrect indentationBob Copeland
smatch said: drivers/net/wireless/ath/ath5k/phy.c:1449 ath5k_hw_channel() warn: inconsistent indenting drivers/net/wireless/ath/ath5k/reset.c:637 ath5k_hw_on_hold() warn: inconsistent indenting drivers/net/wireless/ath/ath5k/reset.c:702 ath5k_hw_nic_wakeup() warn: inconsistent indenting All of these lines were indented a tabstop too far. Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-04-30ath5k: Fix AR5K_PHY_TXPOWER_RATE_MAX register value setting.Nickolay Ledovskikh
I was reading ath5k power setting code and noticed typing error in ath5k_hw_txpower function. Invalid value was written to AR5K_PHY_TXPOWER_RATE_MAX register. Signed-off-by: Nikolay Ledovskikh <nledovskikh@gmail.com> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-02-13ath5k: shifting the wrong variable for AR5K_AR5210Dan Carpenter
In the original code we shift "AR5K_PHY(256) >> 28" which is zero but the intent was to shift the return value of ath5k_hw_reg_read() like we do a couple lines later. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-03-06ath5k: cleanup channel to eprom_mode functionJiri Slaby
Stop returning negative values from ath5k_eeprom_mode_from_channel. Yell loudly about that case in that function instead and return the default/zero/mode A. This cleans up the callers, but needs to pass ah down to ath5k_eeprom_mode_from_channel for ATH5K_WARN. For that purpose we also need the declaration to be moved to ath5k.h. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-02-08NET: ath5k, check ath5k_eeprom_mode_from_channel retvalJiri Slaby
It can, if invalid argument given, return a negative value. In that case we would access arrays out-of-bounds and such. Check the value and yell loudly if that happened as it would be a bug in the implementation. (Instead of silently corrupting memory.) Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Nick Kossifidis <mickflemm@gmail.com> Cc: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-09-25ath5k: add missing breaks in ath5k_hw_set_spur_mitigation_filterJohn W. Linville
https://bugzilla.kernel.org/show_bug.cgi?id=47681 Reported-by: David Binderman <dcb314@hotmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-08-10ath5k: Put power_level where it belongs and rename itNick Kossifidis
Put power_level to ah_txpower struct with the rest tx power infos and also rename it to txp_requested to make more sense. v2 make sure we don't memset it to zero on reset Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-08-10ath5k: Preserve tx power level requested from above on phy_initNick Kossifidis
By using cur_pwr on phy_init we re-use the power level previously set by the driver, not the one we got from above. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-08-10ath5k: Fix range scaling when setting rate power tableNick Kossifidis
rates[i] is unsigned but txp_offset can be negative for newer parts with PDADC table. We cover the case when rates[i] + txp_offset > 63 but we must also cover the case when its < 0 or else rates[i] will overflow. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-08-10ath5k: Use correct value for min_pwr and cur_pwrNick Kossifidis
Make sure we don't store the table offsets for min and cur power levels, store the 0.25dB values instead. This way we don't clamp the tx power level to max (because now cur_pwr holds the 0.25dB value, not the table offset) after re-using cur_pwr on reset. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-10ath: Add and use pr_fmt, convert printks to pr_<level>Joe Perches
Use a more current logging style. Make sure all output is prefixed appropriately. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-06ath5k: do not re-run AGC calibration periodicallyFelix Fietkau
All other Atheros drivers run the AGC gain calibration and DC offset calibration only after reset. Running them periodically has caused stability issues on some (primarily AR2315/2413/5413/5414 based) devices, leading to messages such as: ath5k phy0: gain calibration timeout (2462MHz) ath5k phy0: calibration of channel 11 failed Related bug reports: https://dev.openwrt.org/ticket/10574 https://bugzilla.redhat.com/show_bug.cgi?id=795141 Signed-off-by: Felix Fietkau <nbd@openwrt.org> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-11-28ath5k: We always do full calibration on AR5210Nick Kossifidis
There is no short calibration on AR5210, make sure we treat it always as full calibration. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-11-28ath5k: Cleanups v2 + add kerneldoc on all hw functionsNick Kossifidis
No functional changes Add kernel doc for all ath5k_hw_* functions and strcucts. Also do some cleanup, rename ath5k_hw_init_beacon to ath5k_hw_init_beacon_timers, remove an unused variable from ath5k_hw_pcu_init and a few obsolete macros, mostly related to XR. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-11-28ath5k: Use usleep_range where possibleNick Kossifidis
Use usleep_range where possible to reduce busy waits Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-11-28ath5k: Calibration re-workNick Kossifidis
Noise floor calibration does not interfere with traffic and should run more often as part of our "short calibration". The full calibration is not the noise floor calibration but the AGC + Gain_F (on RF5111 and RF5112) calibration and should run less often because it does interfere with traffic. So Short calibration -> I/Q & NF Calibration Long calibration -> Short + AGC + Gain_F This patch was for some time on my pub/ dir on www.kernel.org and has been tested by a few people and me. I think it's O.K. to go in. I also changed ah_calibration to ah_iq_cal_needed to make more sense. v2 Use a workqueue instead of a tasklet for calibration Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-08-08ath5k: clean up base.h and its usePavel Roskin
Remove unnecessary includes from base.h. Add includes to other files as necessary. Don't include base.h unless needed. Move declarations for functions in base.c from ath5k.h to base.h. Use a better named define to protect base.h against double inclusion. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-08-08ath5k: eliminate CHANNEL_* macros, use AR5K_MODE_* in channel->hw_valuePavel Roskin
When checking for the band, use channel->band. Change ath5k_hw_nic_wakeup() and ath5k_channel_ok() to take ieee80211_channel. Change ath5k_hw_radio_revision() to take ieee80211_band. Signed-off-by: Pavel Roskin <proski@gnu.org> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-08-08ath5k: remove most references to XRPavel Roskin
XR is a proprietary feature of the chipset. It's not supported and should not be supported. Signed-off-by: Pavel Roskin <proski@gnu.org> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-07-22ath5k: use get_unaligned_le32() in ath5k_write_pwr_to_pdadc_table()Pavel Roskin
Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-07-20ath5k: merge ath5k_hw and ath5k_softcPavel Roskin
Both ath5k_hw and ath5k_softc represent one instance of the hardware. This duplication is historical and is not needed anymore. Keep the name "ath5k_hw" for the merged structure and "ah" for the variable pointing to it. "ath5k_hw" is shorter than "ath5k_softc", more descriptive and more widely used. Put the combined structure to ath5k.h where the old ath5k_softc used to be. Move some code from base.h to ath5k.h as needed. Remove memory allocation for struct ath5k_hw and the corresponding error handling. Merge iobase and ah_iobase fields. Signed-off-by: Pavel Roskin <proski@gnu.org> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-07-13ath5k: fix reference clock frequency for spur mitigation on AR2413Felix Fietkau
AR2413 uses the same reference clock as AR5413 Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-07-13ath5k: apply the synth voltage tweak only on AR5112 rev 2Felix Fietkau
Might fix some stability issues on newer chips Signed-off-by: Felix Fietkau <nbd@openwrt.org> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-07-13ath5k: add missing checks for rfgain probeFelix Fietkau
rfgain probe is only necessary for OFDM operation on AR5111 and AR5112. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-07-11ath5k: fix typos, bad comment formatting and GHz in place of MHzPavel Roskin
Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-07-08ath5k: fix formatting errors found by checkpatch.plPavel Roskin
Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-07-08ath5k: replace spaces with tabs as suggested by checkpatch.plPavel Roskin
Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-02-21ath5k: Fix fast channel switchingNick Kossifidis
Fast channel change fixes: a) Always set OFDM timings b) Don't re-activate PHY c) Enable only NF calibration, not AGC https://bugzilla.kernel.org/show_bug.cgi?id=27382 Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-02-18ath5k: Correct channel setting for AR2317 chipNikolay Ledovskikh
Correct channel setting function must be used for AR2317. When I tested ahb patch on bullet2 all seemed to work fine, but it couldn't connect another host (using ibss for example). During an analysis I observed that it's transmitting on another channel. I looked into madwifi code and understood that the problem is in channel setting function. So atheros RF2317 not fully handled in the current ath5k version and must be patched. Signed-off-by: Nikolay Ledovskikh <nledovskikh@gmail.com> Acked-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-01-04ath5k: ath5k_eeprom_mode_from_channel() returns signedDan Carpenter
ath5k_eeprom_mode_from_channel() returns -1 on error but we're storing the result in "ee_mode" which is an unsigned char. This breaks the error handling. This patch makes "ee_mode" an int. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-12-22ath5k: Use helper function to get eeprom mode from channelBruno Randolf
Introduce a helper function to get the EEPROM mode from channel and remove multiple similar switch statements. Also since it's now easy to get the EEPROM mode from the channel, use them inside the functions which need it, instead of passing a redundant ee_mode parameter. Signed-off-by: Bruno Randolf <br1@einfach.org> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-12-22ath5k: Remove ATH5K_INI_RFGAIN defines, use band insteadBruno Randolf
Remove redundant defines. Signed-off-by: Bruno Randolf <br1@einfach.org> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-12-22ath5k: Track current TX power separately from max TX powerBruno Randolf
Add a new variable to keep track of the currently configured tx power. Before max_pwr was re-used for keeping the maximum allowed power as well as the current configuration. Doing a min() on it allows you to lower the txpower, but how would you be able to make it higher again? This patch fixes that by adding a new variable ah_cur_pwr which is used instead of txp_max_pwr to keep the current configuration. txp_max_pwr is used to check if we are within the limits. Another problem fixed by this patch is that it avoids setting a zero txpower when things are initialized first and the current power is not yet set. Signed-off-by: Bruno Randolf <br1@einfach.org> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-12-22ath5k: Separate powertable setup and writingBruno Randolf
And rename functions which write the powertable to make it clearer. Signed-off-by: Bruno Randolf <br1@einfach.org> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-12-22ath5k: Simplify powertable recalculationBruno Randolf
Let ath5k_hw_txpower() decide if it can re-use the powertable or if it has to be recalculated instead of passing a 'fast' flag from the outside. Signed-off-by: Bruno Randolf <br1@einfach.org> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-12-06ath5k: Always write tx powertable on hwNick Kossifidis
* By skipping tx power table calibration we also skip setting tx power table on hw. Make sure we always write tx power table on hw since it gets cleared on reset. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-30ath5k: Set turbo bit on rf bank 2Nick Kossifidis
* A diff between rfbuffer settings of turbo and non-turbo modes indicates there is a bit on bank 2 related to turbo operation (it's set on turbo modes). This bit is present on all radios except RF5413 that seems to have a completely different bank 2. Also since 2317 has the same rf-registers locations with 2425 and since the bit exists on 2317 I assume it also exists on 2425/2417). So in case we use turbo mode (40MHz) enable it on bank modification. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-30ath5k: Cleanup turbo channel flagsNick Kossifidis
* Clean up CHANNEL_T(URBO), use AR5K_BWMODE_40MHZ instead Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-30ath5k: Use correct clock when setting ofdm timingsNick Kossifidis
* Use correct clock value when setting OFDM timings on non-default bwmodes. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-30ath5k: Skip tx power setting on AR5210 for nowNick Kossifidis
* Don't return -EINVAL when trying to set tx power on RF5110 because AR5210 reset will fail. We need to add support for RF5110 and AR5210 eeprom in the future but for now just skip it. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-30ath5k: Tweak phy activate to rx start delay based on bwmodeNick Kossifidis
* Tweak phy activation -> rx delay for different bwmodes Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-30ath5k: Support synth-only channel change for AR2413/AR5413Nick Kossifidis
* Add synth-only channel change for AR2413/5413. When we call ath5k_reset with a channel ath5k_hw_reset will first try to set channel on PHY while PHY is running instead of doing a normal full reset. To do this phy_init has to change to implement this functionality. * Clean up change_channel flag, what it really did was skip PCU registers when setting initvals. This is done because on reset PCU registers are not affected (except the registers we set in pcu init and -due to hw problems- TSF). Use a new skip_pcu flag that's not misleading instead. In the future we might use that to also skip PCU reset and save us the TSF etc problems (needs testing because standard practice is to reset everything). * Use fast channel change only when setting channel, and set skip_pcu to false only on init. When we reset the card due to DMA or PHY problems skip pcu but never do a fast channel change. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-30ath5k: Skip powertable setting when we are on the same channelNick Kossifidis
* Only set power table if we are changing channel/mode there is no need to recalculate and reset the power table all the time. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-30ath5k: Update spur mitigation filter for turbo/half/quarterNick Kossifidis
* Add spur mitigation filter support for half/quarter and turbo. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-30ath5k: Tweak power detector delays on RF5111/RF5112Nick Kossifidis
* Tweak power detector delays on AR5111/AR5112 when using half/quarter modes. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-30ath5k: Put core clock initialization on a new functionNick Kossifidis
* Handle all usec parameters in one function. It's much cleaner this way. Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-30ath5k: Add new field on ath5k_hw to track bandwidth modesNick Kossifidis
* Prepare for half/quarter/turbo support, introduce a new ah_bwmode parameter and get rid of ah_turbo. Bwmode stands for "bandwidth mode" and can have 4 values, default (20MHz), turbo (40MHz), half rate (10MHz), and quarter rate (5MHz). Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-30ath5k: Reset cleanup and generic cleanupNick Kossifidis
* No functional changes * Clean up reset: Introduce init functions for each unit and call them instead of having everything inside ath5k_hw_reset (it's just c/p for now so nothing changes except calling order -I tested it with various cards and it's ok-) * Further cleanups: ofdm_timings belongs to phy.c rate_duration belongs to pcu.c clock functions are general and belong to reset.c (more to follow) * Reorder functions for better organization: We start with helpers and other functions follow in categories, init functions are last Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>