From: Kalle Valo Date: Thu, 13 Dec 2018 14:02:19 +0000 (+0200) Subject: Merge tag 'mt76-for-kvalo-2018-11-30' of https://github.com/nbd168/wireless X-Git-Tag: v5.4-rc1~1957^2~19^2~45 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=074b145a05835e9f93a52323a4770b70b4b782fd;p=platform%2Fkernel%2Flinux-rpi.git Merge tag 'mt76-for-kvalo-2018-11-30' of https://github.com/nbd168/wireless first batch of mt76 patches for 4.21 * use the same firmware for mt76x2e and mt76x2u * mt76x2 fixes * mt76x0 fixes * mt76x0e survey support * more unification between mt76x2 and mt76x0 * mt76x0e AP mode support * mt76x0e DFS support * rework and fix tx status handling for mt76x0 and mt76x2 kvalo: fixed a conflict in drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c and a build problem in drivers/net/wireless/mediatek/mt76/mt76x02_util.c --- 074b145a05835e9f93a52323a4770b70b4b782fd diff --cc drivers/net/wireless/mediatek/mt76/mt76x02_util.c index ca05332,3a70e5b..38bd466 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c @@@ -357,6 -425,51 +425,51 @@@ int mt76x02_conf_tx(struct ieee80211_h } EXPORT_SYMBOL_GPL(mt76x02_conf_tx); + void mt76x02_set_tx_ackto(struct mt76x02_dev *dev) + { + u8 ackto, sifs, slottime = dev->slottime; + + /* As defined by IEEE 802.11-2007 17.3.8.6 */ + slottime += 3 * dev->coverage_class; + mt76_rmw_field(dev, MT_BKOFF_SLOT_CFG, + MT_BKOFF_SLOT_CFG_SLOTTIME, slottime); + + sifs = mt76_get_field(dev, MT_XIFS_TIME_CFG, + MT_XIFS_TIME_CFG_OFDM_SIFS); + + ackto = slottime + sifs; + mt76_rmw_field(dev, MT_TX_TIMEOUT_CFG, + MT_TX_TIMEOUT_CFG_ACKTO, ackto); + } + EXPORT_SYMBOL_GPL(mt76x02_set_tx_ackto); + + void mt76x02_set_coverage_class(struct ieee80211_hw *hw, + s16 coverage_class) + { + struct mt76x02_dev *dev = hw->priv; + + mutex_lock(&dev->mt76.mutex); + dev->coverage_class = coverage_class; + mt76x02_set_tx_ackto(dev); + mutex_unlock(&dev->mt76.mutex); + } + EXPORT_SYMBOL_GPL(mt76x02_set_coverage_class); + + int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u32 val) + { + struct mt76x02_dev *dev = hw->priv; + + if (val != ~0 && val > 0xffff) + return -EINVAL; + - mutex_lock(&dev->mutex); ++ mutex_lock(&dev->mt76.mutex); + mt76x02_mac_set_tx_protection(dev, val); - mutex_unlock(&dev->mutex); ++ mutex_unlock(&dev->mt76.mutex); + + return 0; + } + EXPORT_SYMBOL_GPL(mt76x02_set_rts_threshold); + void mt76x02_sta_rate_tbl_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta) diff --cc drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c index fd12572,6eaab15..7f4ea2d --- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c @@@ -475,42 -400,11 +400,13 @@@ int mt76x2_register_device(struct mt76x if (ret) return ret; - for (i = 0; i < ARRAY_SIZE(dev->macaddr_list); i++) { - u8 *addr = dev->macaddr_list[i].addr; - - memcpy(addr, dev->mt76.macaddr, ETH_ALEN); - - if (!i) - continue; - - addr[0] |= BIT(1); - addr[0] ^= ((i - 1) << 2); - } - wiphy->addresses = dev->macaddr_list; - wiphy->n_addresses = ARRAY_SIZE(dev->macaddr_list); - - wiphy->iface_combinations = if_comb; - wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); - - wiphy->reg_notifier = mt76x2_regd_notifier; - - wiphy->interface_modes = - BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_AP) | - #ifdef CONFIG_MAC80211_MESH - BIT(NL80211_IFTYPE_MESH_POINT) | - #endif - BIT(NL80211_IFTYPE_ADHOC); - - wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS); - - mt76x2_dfs_init_detector(dev); + mt76x02_config_mac_addr_list(dev); /* init led callbacks */ - dev->mt76.led_cdev.brightness_set = mt76x2_led_set_brightness; - dev->mt76.led_cdev.blink_set = mt76x2_led_set_blink; + if (IS_ENABLED(CONFIG_MT76_LEDS)) { + dev->mt76.led_cdev.brightness_set = mt76x2_led_set_brightness; + dev->mt76.led_cdev.blink_set = mt76x2_led_set_blink; + } ret = mt76_register_device(&dev->mt76, true, mt76x02_rates, ARRAY_SIZE(mt76x02_rates));