summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/zd1211rw/zd_chip.c
diff options
context:
space:
mode:
authorAlina Friedrichsen <x-alina@gmx.net>2009-02-25 00:49:18 +0100
committerJohn W. Linville <linville@tuxdriver.com>2009-03-05 20:39:30 +0100
commit5fe73197d359248cbf32dfd3280540d6a0dfd31c (patch)
tree87ae431ca5bea9e5874b2f7cfd50b632b4845ab5 /drivers/net/wireless/zd1211rw/zd_chip.c
parentath9k: Add module parameter to disable hardware crypto (diff)
downloadlinux-5fe73197d359248cbf32dfd3280540d6a0dfd31c.tar.xz
linux-5fe73197d359248cbf32dfd3280540d6a0dfd31c.zip
zd1211rw: Implement get_tsf()
This patch implements get_tsf() of ieee80211_ops in the zd1211rw driver. Signed-off-by: Alina Friedrichsen <x-alina@gmx.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/zd1211rw/zd_chip.c')
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index f1519143f8a6..2c813d87092c 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -1616,3 +1616,24 @@ int zd_chip_set_multicast_hash(struct zd_chip *chip,
return zd_iowrite32a(chip, ioreqs, ARRAY_SIZE(ioreqs));
}
+
+u64 zd_chip_get_tsf(struct zd_chip *chip)
+{
+ int r;
+ static const zd_addr_t aw_pt_bi_addr[] =
+ { CR_TSF_LOW_PART, CR_TSF_HIGH_PART };
+ u32 values[2];
+ u64 tsf;
+
+ mutex_lock(&chip->mutex);
+ r = zd_ioread32v_locked(chip, values, (const zd_addr_t *)aw_pt_bi_addr,
+ ARRAY_SIZE(aw_pt_bi_addr));
+ mutex_unlock(&chip->mutex);
+ if (r)
+ return 0;
+
+ tsf = values[1];
+ tsf = (tsf << 32) | values[0];
+
+ return tsf;
+}