diff options
author | Alina Friedrichsen <x-alina@gmx.net> | 2009-02-24 18:49:18 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-03-05 14:39:30 -0500 |
commit | 5fe73197d359248cbf32dfd3280540d6a0dfd31c (patch) | |
tree | 87ae431ca5bea9e5874b2f7cfd50b632b4845ab5 /drivers/net/wireless/zd1211rw | |
parent | b3bd89ce956c220fe52a003103f14af48f695fda (diff) |
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')
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_chip.c | 21 | ||||
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_chip.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_mac.c | 7 |
3 files changed, 30 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, | |||
1616 | 1616 | ||
1617 | return zd_iowrite32a(chip, ioreqs, ARRAY_SIZE(ioreqs)); | 1617 | return zd_iowrite32a(chip, ioreqs, ARRAY_SIZE(ioreqs)); |
1618 | } | 1618 | } |
1619 | |||
1620 | u64 zd_chip_get_tsf(struct zd_chip *chip) | ||
1621 | { | ||
1622 | int r; | ||
1623 | static const zd_addr_t aw_pt_bi_addr[] = | ||
1624 | { CR_TSF_LOW_PART, CR_TSF_HIGH_PART }; | ||
1625 | u32 values[2]; | ||
1626 | u64 tsf; | ||
1627 | |||
1628 | mutex_lock(&chip->mutex); | ||
1629 | r = zd_ioread32v_locked(chip, values, (const zd_addr_t *)aw_pt_bi_addr, | ||
1630 | ARRAY_SIZE(aw_pt_bi_addr)); | ||
1631 | mutex_unlock(&chip->mutex); | ||
1632 | if (r) | ||
1633 | return 0; | ||
1634 | |||
1635 | tsf = values[1]; | ||
1636 | tsf = (tsf << 32) | values[0]; | ||
1637 | |||
1638 | return tsf; | ||
1639 | } | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h index f8c061a9b6ec..ee42751d5cb0 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.h +++ b/drivers/net/wireless/zd1211rw/zd_chip.h | |||
@@ -950,4 +950,6 @@ static inline void zd_mc_add_addr(struct zd_mc_hash *hash, u8 *addr) | |||
950 | int zd_chip_set_multicast_hash(struct zd_chip *chip, | 950 | int zd_chip_set_multicast_hash(struct zd_chip *chip, |
951 | struct zd_mc_hash *hash); | 951 | struct zd_mc_hash *hash); |
952 | 952 | ||
953 | u64 zd_chip_get_tsf(struct zd_chip *chip); | ||
954 | |||
953 | #endif /* _ZD_CHIP_H */ | 955 | #endif /* _ZD_CHIP_H */ |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index da9214e33a5f..0b01ff036aac 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -935,6 +935,12 @@ static void zd_op_bss_info_changed(struct ieee80211_hw *hw, | |||
935 | } | 935 | } |
936 | } | 936 | } |
937 | 937 | ||
938 | static u64 zd_op_get_tsf(struct ieee80211_hw *hw) | ||
939 | { | ||
940 | struct zd_mac *mac = zd_hw_mac(hw); | ||
941 | return zd_chip_get_tsf(&mac->chip); | ||
942 | } | ||
943 | |||
938 | static const struct ieee80211_ops zd_ops = { | 944 | static const struct ieee80211_ops zd_ops = { |
939 | .tx = zd_op_tx, | 945 | .tx = zd_op_tx, |
940 | .start = zd_op_start, | 946 | .start = zd_op_start, |
@@ -945,6 +951,7 @@ static const struct ieee80211_ops zd_ops = { | |||
945 | .config_interface = zd_op_config_interface, | 951 | .config_interface = zd_op_config_interface, |
946 | .configure_filter = zd_op_configure_filter, | 952 | .configure_filter = zd_op_configure_filter, |
947 | .bss_info_changed = zd_op_bss_info_changed, | 953 | .bss_info_changed = zd_op_bss_info_changed, |
954 | .get_tsf = zd_op_get_tsf, | ||
948 | }; | 955 | }; |
949 | 956 | ||
950 | struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf) | 957 | struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf) |