init.c (20249e1a853c412f452aa6ee0beb752360e69f17) | init.c (c74df1c067f2af0a3758a5ab02806f501473797c) |
---|---|
1// SPDX-License-Identifier: ISC 2/* Copyright (C) 2020 MediaTek Inc. */ 3 4#include <linux/etherdevice.h> 5#include <linux/hwmon.h> 6#include <linux/hwmon-sysfs.h> 7#include <linux/thermal.h> 8#include <linux/firmware.h> 9#include "mt7921.h" 10#include "../mt76_connac2_mac.h" 11#include "mcu.h" 12 13static const struct ieee80211_iface_limit if_limits[] = { 14 { | 1// SPDX-License-Identifier: ISC 2/* Copyright (C) 2020 MediaTek Inc. */ 3 4#include <linux/etherdevice.h> 5#include <linux/hwmon.h> 6#include <linux/hwmon-sysfs.h> 7#include <linux/thermal.h> 8#include <linux/firmware.h> 9#include "mt7921.h" 10#include "../mt76_connac2_mac.h" 11#include "mcu.h" 12 13static const struct ieee80211_iface_limit if_limits[] = { 14 { |
15 .max = MT7921_MAX_INTERFACES, | 15 .max = MT792x_MAX_INTERFACES, |
16 .types = BIT(NL80211_IFTYPE_STATION) 17 }, 18 { 19 .max = 1, 20 .types = BIT(NL80211_IFTYPE_AP) 21 } 22}; 23 24static const struct ieee80211_iface_combination if_comb[] = { 25 { 26 .limits = if_limits, 27 .n_limits = ARRAY_SIZE(if_limits), | 16 .types = BIT(NL80211_IFTYPE_STATION) 17 }, 18 { 19 .max = 1, 20 .types = BIT(NL80211_IFTYPE_AP) 21 } 22}; 23 24static const struct ieee80211_iface_combination if_comb[] = { 25 { 26 .limits = if_limits, 27 .n_limits = ARRAY_SIZE(if_limits), |
28 .max_interfaces = MT7921_MAX_INTERFACES, | 28 .max_interfaces = MT792x_MAX_INTERFACES, |
29 .num_different_channels = 1, 30 .beacon_int_infra_match = true, 31 }, 32}; 33 34static const struct ieee80211_iface_limit if_limits_chanctx[] = { 35 { 36 .max = 2, --- 84 unchanged lines hidden (view full) --- 121 mt76_connac_mcu_set_channel_domain(hw->priv); 122 mt7921_set_tx_sar_pwr(hw, NULL); 123 mt792x_mutex_release(dev); 124} 125 126static int 127mt7921_init_wiphy(struct ieee80211_hw *hw) 128{ | 29 .num_different_channels = 1, 30 .beacon_int_infra_match = true, 31 }, 32}; 33 34static const struct ieee80211_iface_limit if_limits_chanctx[] = { 35 { 36 .max = 2, --- 84 unchanged lines hidden (view full) --- 121 mt76_connac_mcu_set_channel_domain(hw->priv); 122 mt7921_set_tx_sar_pwr(hw, NULL); 123 mt792x_mutex_release(dev); 124} 125 126static int 127mt7921_init_wiphy(struct ieee80211_hw *hw) 128{ |
129 struct mt792x_phy *phy = mt7921_hw_phy(hw); | 129 struct mt792x_phy *phy = mt792x_hw_phy(hw); |
130 struct mt792x_dev *dev = phy->dev; 131 struct wiphy *wiphy = hw->wiphy; 132 133 hw->queues = 4; 134 hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE; 135 hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE; 136 hw->netdev_features = NETIF_F_RXCSUM; 137 --- 176 unchanged lines hidden (view full) --- 314 int i; 315 316 mt76_rmw_field(dev, MT_MDP_DCR1, MT_MDP_DCR1_MAX_RX_LEN, 1536); 317 /* enable hardware de-agg */ 318 mt76_set(dev, MT_MDP_DCR0, MT_MDP_DCR0_DAMSDU_EN); 319 /* enable hardware rx header translation */ 320 mt76_set(dev, MT_MDP_DCR0, MT_MDP_DCR0_RX_HDR_TRANS_EN); 321 | 130 struct mt792x_dev *dev = phy->dev; 131 struct wiphy *wiphy = hw->wiphy; 132 133 hw->queues = 4; 134 hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE; 135 hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE; 136 hw->netdev_features = NETIF_F_RXCSUM; 137 --- 176 unchanged lines hidden (view full) --- 314 int i; 315 316 mt76_rmw_field(dev, MT_MDP_DCR1, MT_MDP_DCR1_MAX_RX_LEN, 1536); 317 /* enable hardware de-agg */ 318 mt76_set(dev, MT_MDP_DCR0, MT_MDP_DCR0_DAMSDU_EN); 319 /* enable hardware rx header translation */ 320 mt76_set(dev, MT_MDP_DCR0, MT_MDP_DCR0_RX_HDR_TRANS_EN); 321 |
322 for (i = 0; i < MT7921_WTBL_SIZE; i++) | 322 for (i = 0; i < MT792x_WTBL_SIZE; i++) |
323 mt7921_mac_wtbl_update(dev, i, 324 MT_WTBL_UPDATE_ADM_COUNT_CLEAR); 325 for (i = 0; i < 2; i++) 326 mt7921_mac_init_band(dev, i); 327 328 return mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b, 0); 329} 330EXPORT_SYMBOL_GPL(mt7921_mac_init); --- 43 unchanged lines hidden (view full) --- 374 return 0; 375} 376 377static int mt7921_init_wcid(struct mt792x_dev *dev) 378{ 379 int idx; 380 381 /* Beacon and mgmt frames should occupy wcid 0 */ | 323 mt7921_mac_wtbl_update(dev, i, 324 MT_WTBL_UPDATE_ADM_COUNT_CLEAR); 325 for (i = 0; i < 2; i++) 326 mt7921_mac_init_band(dev, i); 327 328 return mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b, 0); 329} 330EXPORT_SYMBOL_GPL(mt7921_mac_init); --- 43 unchanged lines hidden (view full) --- 374 return 0; 375} 376 377static int mt7921_init_wcid(struct mt792x_dev *dev) 378{ 379 int idx; 380 381 /* Beacon and mgmt frames should occupy wcid 0 */ |
382 idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7921_WTBL_STA - 1); | 382 idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT792x_WTBL_STA - 1); |
383 if (idx) 384 return -ENOSPC; 385 386 dev->mt76.global_wcid.idx = idx; 387 dev->mt76.global_wcid.hw_key_idx = -1; 388 dev->mt76.global_wcid.tx_info |= MT_WCID_TX_INFO_SET; 389 rcu_assign_pointer(dev->mt76.wcid[idx], &dev->mt76.global_wcid); 390 --- 41 unchanged lines hidden (view full) --- 432int mt7921_register_device(struct mt792x_dev *dev) 433{ 434 struct ieee80211_hw *hw = mt76_hw(dev); 435 int ret; 436 437 dev->phy.dev = dev; 438 dev->phy.mt76 = &dev->mt76.phy; 439 dev->mt76.phy.priv = &dev->phy; | 383 if (idx) 384 return -ENOSPC; 385 386 dev->mt76.global_wcid.idx = idx; 387 dev->mt76.global_wcid.hw_key_idx = -1; 388 dev->mt76.global_wcid.tx_info |= MT_WCID_TX_INFO_SET; 389 rcu_assign_pointer(dev->mt76.wcid[idx], &dev->mt76.global_wcid); 390 --- 41 unchanged lines hidden (view full) --- 432int mt7921_register_device(struct mt792x_dev *dev) 433{ 434 struct ieee80211_hw *hw = mt76_hw(dev); 435 int ret; 436 437 dev->phy.dev = dev; 438 dev->phy.mt76 = &dev->mt76.phy; 439 dev->mt76.phy.priv = &dev->phy; |
440 dev->mt76.tx_worker.fn = mt7921_tx_worker; | 440 dev->mt76.tx_worker.fn = mt792x_tx_worker; |
441 442 INIT_DELAYED_WORK(&dev->pm.ps_work, mt7921_pm_power_save_work); 443 INIT_WORK(&dev->pm.wake_work, mt7921_pm_wake_work); 444 spin_lock_init(&dev->pm.wake.lock); 445 mutex_init(&dev->pm.mutex); 446 init_waitqueue_head(&dev->pm.wait); 447 if (mt76_is_sdio(&dev->mt76)) 448 init_waitqueue_head(&dev->mt76.sdio.wait); 449 spin_lock_init(&dev->pm.txq_lock); | 441 442 INIT_DELAYED_WORK(&dev->pm.ps_work, mt7921_pm_power_save_work); 443 INIT_WORK(&dev->pm.wake_work, mt7921_pm_wake_work); 444 spin_lock_init(&dev->pm.wake.lock); 445 mutex_init(&dev->pm.mutex); 446 init_waitqueue_head(&dev->pm.wait); 447 if (mt76_is_sdio(&dev->mt76)) 448 init_waitqueue_head(&dev->mt76.sdio.wait); 449 spin_lock_init(&dev->pm.txq_lock); |
450 INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7921_mac_work); | 450 INIT_DELAYED_WORK(&dev->mphy.mac_work, mt792x_mac_work); |
451 INIT_DELAYED_WORK(&dev->phy.scan_work, mt7921_scan_work); 452 INIT_DELAYED_WORK(&dev->coredump.work, mt7921_coredump_work); 453#if IS_ENABLED(CONFIG_IPV6) 454 INIT_WORK(&dev->ipv6_ns_work, mt7921_set_ipv6_ns_work); 455 skb_queue_head_init(&dev->ipv6_ns_list); 456#endif 457 skb_queue_head_init(&dev->phy.scan_event_list); 458 skb_queue_head_init(&dev->coredump.msg_list); 459 460 INIT_WORK(&dev->reset_work, mt7921_mac_reset_work); 461 INIT_WORK(&dev->init_work, mt7921_init_work); 462 463 INIT_WORK(&dev->phy.roc_work, mt7921_roc_work); | 451 INIT_DELAYED_WORK(&dev->phy.scan_work, mt7921_scan_work); 452 INIT_DELAYED_WORK(&dev->coredump.work, mt7921_coredump_work); 453#if IS_ENABLED(CONFIG_IPV6) 454 INIT_WORK(&dev->ipv6_ns_work, mt7921_set_ipv6_ns_work); 455 skb_queue_head_init(&dev->ipv6_ns_list); 456#endif 457 skb_queue_head_init(&dev->phy.scan_event_list); 458 skb_queue_head_init(&dev->coredump.msg_list); 459 460 INIT_WORK(&dev->reset_work, mt7921_mac_reset_work); 461 INIT_WORK(&dev->init_work, mt7921_init_work); 462 463 INIT_WORK(&dev->phy.roc_work, mt7921_roc_work); |
464 timer_setup(&dev->phy.roc_timer, mt7921_roc_timer, 0); | 464 timer_setup(&dev->phy.roc_timer, mt792x_roc_timer, 0); |
465 init_waitqueue_head(&dev->phy.roc_wait); 466 467 dev->pm.idle_timeout = MT7921_PM_TIMEOUT; 468 dev->pm.stats.last_wake_event = jiffies; 469 dev->pm.stats.last_doze_event = jiffies; 470 if (!mt76_is_usb(&dev->mt76)) { 471 dev->pm.enable_user = true; 472 dev->pm.enable = true; --- 42 unchanged lines hidden --- | 465 init_waitqueue_head(&dev->phy.roc_wait); 466 467 dev->pm.idle_timeout = MT7921_PM_TIMEOUT; 468 dev->pm.stats.last_wake_event = jiffies; 469 dev->pm.stats.last_doze_event = jiffies; 470 if (!mt76_is_usb(&dev->mt76)) { 471 dev->pm.enable_user = true; 472 dev->pm.enable = true; --- 42 unchanged lines hidden --- |