summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath5k/hw.c
AgeCommit message (Collapse)Author
2008-09-05ath5k: HW code cleanupNick Kossifidis
* No code changes... * Split hw.c to multiple files for better maintenance and add some documentation on each file code is going to grow soon (eeprom.c for example is going to get much stuff currently developed on ath_info) so it's better this way. * Rename following functions to maintain naming scheme: ah_setup_xtx_desc -> ah_setup_mrr_tx_desc (Because xtx doesn't say much, it's actually a multi-rate-retry tx descriptor) ath5k_hw_put_tx/rx_buf - > ath5k_hw_set_tx/rxdp ath5k_hw_get_tx/rx_buf -> ath5k_hw_get_tx/rxdp (We don't put any "buf" we set descriptor pointers on hw) ath5k_hw_tx_start -> ath5k_hw_start_tx_dma ath5k_hw_start_rx -> ath5k_hw_start_rx_dma ath5k_hw_stop_pcu_recv -> ath5k_hw_stop_rx_pcu (It's easier this way to identify them, we also have ath5k_hw_start_rx_pcu which completes the set) ath5k_hw_set_intr -> ath5k_hw_set_imr (As in get_isr we set imr here, not "intr") * Move ath5k_hw_setup_rx_desc on ah->ah_setup_rx_desc so we can include support for different rx descriptors in the future * Further cleanups so that checkpatch doesn't complain (only some > 80 col warnings for eeprom.h and reg.h as usual due to comments) Tested on 5211 and 5213 cards and works ok. Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Acked-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-08-22ath5k: rates cleanupBruno Randolf
cleanup the rates structures used by ath5k. instead of separate driver and mac80211 rate structures we now setup a static ieee80211_rate array and use it directly. no conversion between two different rate structures has to be done any more. a lot of unused and confusing junk was deleted. renamed ath5k_getchannels into ath5k_setup_bands because this is what it does. rewrote it to copy the bitrates correctly for each band. this is necessary for running different hardware with the same driver (e.g. 5211 and 5212 based cards). add special handling of rates for AR5211 chipsets: it uses different rate codes for CCK rates (which are actually like the other chips but with a 0xF mask). setup a hardware code to rate index reverse mapping table for getting the rate index of received frames. the rates for control frames which have to be set in ath5k_hw_write_rate_duration are now in one single array. drivers/net/wireless/ath5k/ath5k.h: Changes-licensed-under: ISC drivers/net/wireless/ath5k/base.c: Changes-licensed-under: 3-Clause-BSD drivers/net/wireless/ath5k/base.h: Changes-licensed-under: 3-Clause-BSD drivers/net/wireless/ath5k/hw.c: Changes-licensed-under: ISC Signed-off-by: Bruno Randolf <br1@einfach.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-08-22ath5k: add Mesh Point supportAndrey Yurovsky
This enables draft-802.11s Mesh Point operation. For that we need mesh beaconing. Tested with AR5212/AR5213 PCI card against Zydas and b43 mesh nodes. Signed-off-by: Andrey Yurovsky <andrey@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-08-01ath5k: Reorder calibration calls during reset and update hw_set_powerNick Kossifidis
* Update ath5k_hw_reset and add some more documentation about PHY calibration * Fix ath5k_hw_set_power to use AR5K_SLEEP_CTL_SLE_ALLOW for Network sleep * Preserve sleep duration field while setting AR5K_SLEEP_CTL and reduce delays & checks for register's status (got this from decompiling & dumps, it works for me but it needs testing) Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-08-01ath5k: Do ADC test during resetNick Kossifidis
* Do an ADC test during reset to match recent regdumps Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-08-01ath5k: Misc hw_reset updatesNick Kossifidis
* Update hw_reset to calculate some of the values we were using as static * Increase activation to rx delay Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-08-01ath5k: Misc hw_attach fixesNick Kossifidis
* Correctly attach RF2425 * Update SREV values for Radio chips * Update hw_attach to use new SPENDING values * Write a bit after POST for some chips Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-08-01ath5k: Restore saved initval after POSTNick Kossifidis
* Restore saved initial value after POST Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-08-01ath5k: Update register listNick Kossifidis
* Update list of registers * Use updated register macros inside hw.c, initvals.c and debug.c Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-07-29Ath5k: flush workJiri Slaby
Make sure that the irq is not in progress after stop. This means two things: - ensure the intr setting register is set by flushing posted values - call synchronize_irq() after that Also flush stop tx write, inform callers of the tx stop about still pending transfers (unsuccessful stop) and finally don't wait another 3ms in ath5k_rx_stop, since ath5k_hw_stop_rx_dma ensures transfer to be finished. Make sure all writes will be ordered in respect to locks by mmiowb(). Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Cc: Luis R. Rodriguez <mcgrof@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-06-27wireless: Small cleanupsPavel Machek
Small whitespace cleanups for wireless drivers Signed-off-by: Pavel Machek <pavel@suse.cz> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-05-14ath5k: Fix loop variable initializationsBob Copeland
In ath5k_tasklet_rx, both status structures 'rxs' and 'rs' are initialized at the top of the tasklet, but not within the loop. If the loop is executed multiple times in the tasklet then the variables may see changes from previous packets. For TKIP, this results in 'Invalid Michael MIC' errors if two packets are processed in the tasklet: rxs.flag gets set to RX_DECRYPTED by mac80211 when it decrypts the first encrypted packet. The subsequent packet will have RX_DECRYPTED set upon entry to mac80211, so mac80211 will not try to decrypt it. We currently initialize all but two fields in the structures, so fix the other two. Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-04-23ath5k: Fix radio identification on AR5424/2424Nick Kossifidis
*Fix radio chip identification on AR5424/2424 during ath5k_hw_attach *Try to assign an RF2413 radio on AR2424 for testing Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-04-16ath5k: Misc fixes/cleanupsNick Kossifidis
*Handle MIB interrupts and pass low level stats to mac80211 *Add Power On Self Test function *Update to match recent dumps *Let RF2425 attach so we can further test it *Remove unused files regdom.c and regdom.h base.c Changes-licensed-under: 3-clause-BSD rest Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-04-16ath5k: Add RF2425 initvalsNick Kossifidis
*Add RF2425 initvals (still no rx/tx) This was on my laptop for a long time so it has to go out even if it still doesn't work, i hope i'll get my hands on an eeepc so i can work this out. base.c Changes-licensed-under: 3-clause-BSD rest Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-03-18Merge branch 'master' of ↵David S. Miller
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 Conflicts: drivers/net/wireless/rt2x00/rt2x00dev.c net/8021q/vlan_dev.c
2008-03-13drivers/net/wireless/ath5k - convert == (true|false) to simple logical testsJoe Perches
(test == true) is not nice. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-03-13ath5k: disable irq handling in ath5k_hw_detach()Pavel Roskin
Once ah has been freed, it may not be accessed. Set ATH_STAT_INVALID bit to make the interrupt handler return IRQ_NONE without accessing ah. This fixes oops on unload with CONFIG_DEBUG_SHIRQ enabled. Signed-off-by: Pavel Roskin <proski@gnu.org> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-03-07ath5k: move rx and tx status structures out of hardware descriptorBruno Randolf
move ath5k_tx_status and ath5k_rx_status structures out of the hardware descriptor since they are not accessed by the hardware at all. they just contain converted information from the hardware descriptor. since they are only used in the rx and tx tasklets there is also no use to keep them for each descriptor. drivers/net/wireless/ath5k/ath5k.h: Changes-licensed-under: ISC drivers/net/wireless/ath5k/base.c: Changes-licensed-under: 3-Clause-BSD drivers/net/wireless/ath5k/debug.c: Changes-licensed-under: GPL drivers/net/wireless/ath5k/debug.h: Changes-licensed-under: GPL drivers/net/wireless/ath5k/hw.c: Changes-licensed-under: ISC Signed-off-by: Bruno Randolf <bruno@thinktube.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-03-07ath5k: struct ath5k_desc cleanupsBruno Randolf
* make struct ath5k_desc clearer by directly including unions of structures, which correspond to the hardware descriptors of different HW versions (5210 and 5212). before they were casted at onto ath5k_desc at different points (e.g. ds_hw[2]). * rename some structures and variable names to make their use clearer, e.g. struct ath5k_hw_4w_tx_desc to ath5k_hw_4w_tx_ctl. * substitute "old" with "5210" and "new" with "5212" (eg. rename ath5k_hw_proc_new_rx_status() to ath5k_hw_proc_5212_rx_status()) because old and new are relative and we might have a newer structure at some point. * unify structs ath5k_hw_old_rx_status and ath5k_hw_new_rx_status into one ath5k_hw_rx_status, because they only differ in the flags and masks. drivers/net/wireless/ath5k/ath5k.h: Changes-licensed-under: ISC drivers/net/wireless/ath5k/debug.c: Changes-licensed-under: GPL drivers/net/wireless/ath5k/hw.c: Changes-licensed-under: ISC drivers/net/wireless/ath5k/hw.h: Changes-licensed-under: ISC Signed-off-by: Bruno Randolf <bruno@thinktube.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-03-07ath5k: Make some changes to follow register dumps.Nick Kossifidis
Make some changes which mimic what we see in register dumps. This patch does not add a helper to ath5k_hw_reset(). It does seem clear we need a re-shuffle around ath5k_hw_reset() though as code in there is lengthy and already hitting 80-char limit. This can be dealt with later though. Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-03-07ath5k: Fixes for PCI-E cardsNick Kossifidis
* Fix nic_wakeup for PCI-E chips (don't set AR5K_RESET_CTL_PCI bit) * Fix dma size setting for PCI-E chips (thanx to Bob Copeland). Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-03-07ath5k: more RF2413 stuffNick Kossifidis
* Add AR5K_RF2413 to radio check during hw_reset so it doesn't complain * Write ah_phy_spending value we set during attach instead of checking each time for radio revision * Skip txpower setup for RF2413 because it can't transmit with it (weird thing is that RF5413 has no problem with it). Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-03-07ath5k: Identify RF2413 and deal with PHY_SPENDINGNick Kossifidis
* Attach RF2413. * Propertly handle different AR5K_PHY_SPENDING settings for each RF chip by adding a field in ath5k_hw. This way we won't have to check inside hw_reset (see next patch). Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-29ath5k: fix all endian issues reported by sparsePavel Roskin
Changes-licensed-under: ISC Signed-off-by: Pavel Roskin <proski@gnu.org> Acked-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> Acked-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-29ath5k: Port to new bitrate/channel APILuis R. Rodriguez
Author: Nick Kossifidis <mickflemm@gmail.com> Tested on 5211, 5213+5112, 5213A+2112A and it wors fine. Also i figured out a way to process rate vallue found on status descriptors, it's still buggy but we are getting closer (i think it improved stability a little). Changes to hw.c, initvals.c, phy.c Changes-licensed-under: ISC Changes to ath5k.h, base.c, base.h Changes-licensed-under: 3-Clause-BSD Acked-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-20WDEV, ath5k, don't return int from bool functionJiri Slaby
sparse sees int -> bool cast as an error: hw.c:3754:10: warning: cast truncates bits from constant value (ffffffea becomes 0) Fix it by converting the rettype to int and check appropriately. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Cc: Nick Kossifidis <mickflemm@gmail.com> Cc: Luis R. Rodriguez <mcgrof@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-02-15ath5k: correct padding in tx descriptorsBruno Randolf
when setting up the tx descriptors for the hardware we must account for any padding between the header and the data we might have added previously. frame len is the length of the frame in the air (including FCS but no padding) and buffer len is the length of the buffer (including padding, but without FCS). changing the way ah_setup_tx_desc is called: now excluding the FCS, since it's easier to add that in the function where we need it. before this fix we sent trailing zero bytes after the packet (because frame len included the padding) which was not a big problem without WEP, but with WEP this resultes in a wrong WEP checksum and the packet is discarded - which is how i noticed at all ;) an easy way to run into header padding problems, btw, is to connect to a QoS (WME) enabled access point (eg. madwifi) - QoS data frames are 2 byte longer and will require padding. this patch applies on top of luis latest patch series from 04.02.2008. drivers/net/wireless/ath5k/base.c: Changes-licensed-under: 3-Clause-BSD drivers/net/wireless/ath5k/hw.c: Changes-licensed-under: ISC Signed-off-by: Bruno Randolf <bruno@thinktube.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28ath5k: use 3 instead of 0x00000003Bruno Randolf
reviewed beacon timer initialization with register traces from madwifi: what we are doing is correct :). one minor fix: use 3 instead of 0x00000003 - it's more readable. drivers/net/wireless/ath5k/hw.c: Changes-licensed-under: ISC Signed-off-by: Bruno Randolf <bruno@thinktube.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28ath5k: Fix frame duration oopsLuis R. Rodriguez
This patch fixes an oops which was introduced as a regression by commit fd640775bd16e1df50c867cc547af0, on the patch titled, "mac80211: dont use interface indices in drivers". ieee80211_generic_frame_duration() now relies on sdata->flags which itself gets set upon bringing the interface up. We check for the virtual interface now before setting the rate duration registers. After the mode changes are introduced onto mac80211 we should revisit these changes. This patch was tested on the following cards: 1) BG card: Atheros AR5213A chip found (MAC: 0x59, PHY: 0x43) RF2112A 2GHz radio found (0x46) 2) ABG card: Atheros AR5213A chip found (MAC: 0x59,PHY: 0x43) RF5112A multiband radio found (0x36) Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28mac80211: dont use interface indices in driversJohannes Berg
This patch gets rid of the if_id stuff where possible in favour of a new per-virtual-interface structure "struct ieee80211_vif". This structure is located at the end of the per-interface structure and contains a variable length driver-use data area. This has two advantages: * removes the need to look up interfaces by if_id, this is better for working with network namespaces and performance * allows drivers to store and retrieve per-interface data without having to allocate own lists/hash tables Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28[PATCH] Net: add ath5k wireless driverJiri Slaby
add ath5k wireless driver Portions of this driver are covered by one or both of the ISC and 3-clause BSD licenses. Specific license information is cited at the top of each file. Acked-by and Signed-off-by information is collected from individual patches as collected in the wireless-2.6 tree prior to upstream submission. Acked-by: Matthew W. S. Bell <mentor@madwifi.org> Acked-by: Michael Taylor <mike.taylor@apprion.com> Acked-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Bradley M. Kuhn <bkuhn@softwarefreedom.org> Signed-off-by: Bruno Randolf <bruno@thinktube.com> Signed-off-by: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Francesco Gringoli <francesco.gringoli@ing.unibs.it> Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Karen Sandler <karen@softwarefreedom.org> Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl> Signed-off-by: Luis R. Rodriguez <mcgrof@gmail.com> Signed-off-by: Matt Norwood <norwood@softwarefreedom.org> Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: Richard Fontana <fontana@softwarefreedom.org> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Ulrich Meis <meis@nets.rwth-aachen.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>