From a2d894e2de283029078ff4336031c7b68435b9ae Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 20 Feb 2016 15:07:03 +0100 Subject: [PATCH] mt7603: set sta ht capabilities in WTBL1 Signed-off-by: Felix Fietkau --- mt7603_mac.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/mt7603_mac.c b/mt7603_mac.c index 4a0d3998..f18c07e5 100644 --- a/mt7603_mac.c +++ b/mt7603_mac.c @@ -86,10 +86,16 @@ mt7603_wtbl2_addr(int idx) return MT_PCIE_REMAP_BASE_1 + idx * MT_WTBL2_SIZE; } +static u32 +mt7603_wtbl1_addr(int idx) +{ + return MT_WTBL1_BASE + idx * MT_WTBL1_SIZE; +} + void mt7603_wtbl_init(struct mt7603_dev *dev, int idx, const u8 *mac_addr) { const void *_mac = mac_addr; - u32 addr = MT_WTBL1_BASE + idx * MT_WTBL1_SIZE; + u32 addr = mt7603_wtbl1_addr(idx); mt76_set(dev, addr + 0 * 4, MT76_SET(MT_WTBL1_W0_ADDR_HI, get_unaligned_le16(_mac + 4))); @@ -147,9 +153,26 @@ void mt7603_wtbl_clear(struct mt7603_dev *dev, int idx) void mt7603_wtbl_update_cap(struct mt7603_dev *dev, struct ieee80211_sta *sta) { struct mt7603_sta *msta = (struct mt7603_sta *) sta->drv_priv; - u32 addr = mt7603_wtbl2_addr(msta->wcid.idx); + int idx = msta->wcid.idx; + u32 addr; u32 val; + addr = mt7603_wtbl1_addr(idx); + + val = MT76_SET(MT_WTBL1_W2_AMPDU_FACTOR, sta->ht_cap.ampdu_factor) | + MT76_SET(MT_WTBL1_W2_MPDU_DENSITY, sta->ht_cap.ampdu_density) | + MT_WTBL1_W2_TXS_BAF_REPORT; + + if (sta->ht_cap.cap) + val |= MT_WTBL1_W2_HT; + if (sta->vht_cap.cap) + val |= MT_WTBL1_W2_VHT; + if (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING) + val |= MT_WTBL1_W2_LDPC; + + mt76_wr(dev, addr + 2 * 4, val); + + addr = mt7603_wtbl2_addr(idx); val = mt76_rr(dev, addr + 9 * 4); val &= ~(MT_WTBL2_W9_SHORT_GI_20 | MT_WTBL2_W9_SHORT_GI_40 | MT_WTBL2_W9_SHORT_GI_80);