mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: mt7915: introduce __mt7915_get_tsf routine
Introduce an unlocked verion of mt7915_get_tsf routine. This is a preliminary patch to add TWT support to mt7915. Tested-by: Peter Chiu <[email protected]> Tested-by: Evelyn Tsai <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
e8e2eae41f
commit
4c455e8b1a
+15
-5
@@ -819,10 +819,8 @@ mt7915_get_stats(struct ieee80211_hw *hw,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u64
|
||||
mt7915_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
u64 __mt7915_get_tsf(struct ieee80211_hw *hw, struct mt7915_vif *mvif)
|
||||
{
|
||||
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
|
||||
struct mt7915_dev *dev = mt7915_hw_dev(hw);
|
||||
struct mt7915_phy *phy = mt7915_hw_phy(hw);
|
||||
bool band = phy != &dev->phy;
|
||||
@@ -832,7 +830,7 @@ mt7915_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
} tsf;
|
||||
u16 n;
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
lockdep_assert_held(&dev->mt76.mutex);
|
||||
|
||||
n = mvif->omac_idx > HW_BSSID_MAX ? HW_BSSID_0 : mvif->omac_idx;
|
||||
/* TSF software read */
|
||||
@@ -841,9 +839,21 @@ mt7915_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
tsf.t32[0] = mt76_rr(dev, MT_LPON_UTTR0(band));
|
||||
tsf.t32[1] = mt76_rr(dev, MT_LPON_UTTR1(band));
|
||||
|
||||
return tsf.t64;
|
||||
}
|
||||
|
||||
static u64
|
||||
mt7915_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
{
|
||||
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
|
||||
struct mt7915_dev *dev = mt7915_hw_dev(hw);
|
||||
u64 ret;
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
ret = __mt7915_get_tsf(hw, mvif);
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
|
||||
return tsf.t64;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+1
-1
@@ -329,7 +329,7 @@ extern const struct ieee80211_ops mt7915_ops;
|
||||
extern const struct mt76_testmode_ops mt7915_testmode_ops;
|
||||
|
||||
u32 mt7915_reg_map(struct mt7915_dev *dev, u32 addr);
|
||||
|
||||
u64 __mt7915_get_tsf(struct ieee80211_hw *hw, struct mt7915_vif *mvif);
|
||||
int mt7915_register_device(struct mt7915_dev *dev);
|
||||
void mt7915_unregister_device(struct mt7915_dev *dev);
|
||||
int mt7915_eeprom_init(struct mt7915_dev *dev);
|
||||
|
||||
Reference in New Issue
Block a user