mt76 patches for 5.7
* MT7663 support for the MT7615 driver * USB fixes * DBDC fixes for MT7615 * MT76x02 watchdog fixes * Injection fix for MT7615 * Sensitivity fix for MT7615 * MCU support code cleanup -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iEYEABECAAYFAl5xBlIACgkQ130UHQKnbvXo/wCghKwOD0Fwd0A3gQ2jBzEE8uPL crcAn0fKtayK1gUZXsLnl014p6a252JH =tqwb -----END PGP SIGNATURE----- Merge tag 'mt76-for-kvalo-2020-03-17' of https://github.com/nbd168/wireless mt76 patches for 5.7 * MT7663 support for the MT7615 driver * USB fixes * DBDC fixes for MT7615 * MT76x02 watchdog fixes * Injection fix for MT7615 * Sensitivity fix for MT7615 * MCU support code cleanup
This commit is contained in:
commit
48346a9557
|
@ -9,14 +9,16 @@ struct sk_buff *
|
|||
mt76_mcu_msg_alloc(const void *data, int head_len,
|
||||
int data_len, int tail_len)
|
||||
{
|
||||
int length = head_len + data_len + tail_len;
|
||||
struct sk_buff *skb;
|
||||
|
||||
skb = alloc_skb(head_len + data_len + tail_len,
|
||||
GFP_KERNEL);
|
||||
skb = alloc_skb(length, GFP_KERNEL);
|
||||
if (!skb)
|
||||
return NULL;
|
||||
|
||||
memset(skb->head, 0, length);
|
||||
skb_reserve(skb, head_len);
|
||||
|
||||
if (data && data_len)
|
||||
skb_put_data(skb, data, data_len);
|
||||
|
||||
|
|
|
@ -139,6 +139,8 @@ struct mt76_sw_queue {
|
|||
struct mt76_mcu_ops {
|
||||
int (*mcu_send_msg)(struct mt76_dev *dev, int cmd, const void *data,
|
||||
int len, bool wait_resp);
|
||||
int (*mcu_skb_send_msg)(struct mt76_dev *dev, struct sk_buff *skb,
|
||||
int cmd, bool wait_resp);
|
||||
int (*mcu_wr_rp)(struct mt76_dev *dev, u32 base,
|
||||
const struct mt76_reg_pair *rp, int len);
|
||||
int (*mcu_rd_rp)(struct mt76_dev *dev, u32 base,
|
||||
|
@ -403,7 +405,6 @@ struct mt76_mcu {
|
|||
#define MCU_RESP_URB_SIZE 1024
|
||||
struct mt76_usb {
|
||||
struct mutex usb_ctrl_mtx;
|
||||
__le32 reg_val;
|
||||
u8 *data;
|
||||
u16 data_len;
|
||||
|
||||
|
@ -589,7 +590,9 @@ enum mt76_phy_type {
|
|||
#define mt76_rd_rp(dev, ...) (dev)->mt76.bus->rd_rp(&((dev)->mt76), __VA_ARGS__)
|
||||
|
||||
#define mt76_mcu_send_msg(dev, ...) (dev)->mt76.mcu_ops->mcu_send_msg(&((dev)->mt76), __VA_ARGS__)
|
||||
|
||||
#define __mt76_mcu_send_msg(dev, ...) (dev)->mcu_ops->mcu_send_msg((dev), __VA_ARGS__)
|
||||
#define __mt76_mcu_skb_send_msg(dev, ...) (dev)->mcu_ops->mcu_skb_send_msg((dev), __VA_ARGS__)
|
||||
#define mt76_mcu_restart(dev, ...) (dev)->mt76.mcu_ops->mcu_restart(&((dev)->mt76))
|
||||
#define __mt76_mcu_restart(dev, ...) (dev)->mcu_ops->mcu_restart((dev))
|
||||
|
||||
|
|
|
@ -121,4 +121,8 @@ void mt7603_init_debugfs(struct mt7603_dev *dev)
|
|||
mt7603_reset_read);
|
||||
debugfs_create_devm_seqfile(dev->mt76.dev, "radio", dir,
|
||||
mt7603_radio_read);
|
||||
debugfs_create_u8("sensitivity_limit", 0600, dir,
|
||||
&dev->sensitivity_limit);
|
||||
debugfs_create_bool("dynamic_sensitivity", 0600, dir,
|
||||
&dev->dynamic_sensitivity);
|
||||
}
|
||||
|
|
|
@ -540,6 +540,8 @@ int mt7603_register_device(struct mt7603_dev *dev)
|
|||
dev->mphy.antenna_mask = 1;
|
||||
|
||||
dev->slottime = 9;
|
||||
dev->sensitivity_limit = 28;
|
||||
dev->dynamic_sensitivity = true;
|
||||
|
||||
ret = mt7603_init_hardware(dev);
|
||||
if (ret)
|
||||
|
|
|
@ -1727,6 +1727,9 @@ mt7603_false_cca_check(struct mt7603_dev *dev)
|
|||
int min_signal;
|
||||
u32 val;
|
||||
|
||||
if (!dev->dynamic_sensitivity)
|
||||
return;
|
||||
|
||||
val = mt76_rr(dev, MT_PHYCTRL_STAT_PD);
|
||||
pd_cck = FIELD_GET(MT_PHYCTRL_STAT_PD_CCK, val);
|
||||
pd_ofdm = FIELD_GET(MT_PHYCTRL_STAT_PD_OFDM, val);
|
||||
|
@ -1750,7 +1753,8 @@ mt7603_false_cca_check(struct mt7603_dev *dev)
|
|||
min_signal -= 15;
|
||||
|
||||
false_cca = dev->false_cca_ofdm + dev->false_cca_cck;
|
||||
if (false_cca > 600) {
|
||||
if (false_cca > 600 &&
|
||||
dev->sensitivity < -100 + dev->sensitivity_limit) {
|
||||
if (!dev->sensitivity)
|
||||
dev->sensitivity = -92;
|
||||
else
|
||||
|
|
|
@ -27,7 +27,6 @@ __mt7603_mcu_msg_send(struct mt7603_dev *dev, struct sk_buff *skb,
|
|||
seq = ++mdev->mcu.msg_seq & 0xf;
|
||||
|
||||
txd = (struct mt7603_mcu_txd *)skb_push(skb, hdrlen);
|
||||
memset(txd, 0, hdrlen);
|
||||
|
||||
txd->len = cpu_to_le16(skb->len);
|
||||
if (cmd == -MCU_CMD_FW_SCATTER)
|
||||
|
|
|
@ -142,7 +142,9 @@ struct mt7603_dev {
|
|||
u8 ed_strict_mode;
|
||||
u8 ed_strong_signal;
|
||||
|
||||
bool dynamic_sensitivity;
|
||||
s8 sensitivity;
|
||||
u8 sensitivity_limit;
|
||||
|
||||
u8 beacon_check;
|
||||
u8 tx_hang_check;
|
||||
|
|
|
@ -101,8 +101,12 @@ void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
|
|||
__le32 *rxd = (__le32 *)skb->data;
|
||||
__le32 *end = (__le32 *)&skb->data[skb->len];
|
||||
enum rx_pkt_type type;
|
||||
u16 flag;
|
||||
|
||||
type = FIELD_GET(MT_RXD0_PKT_TYPE, le32_to_cpu(rxd[0]));
|
||||
flag = FIELD_GET(MT_RXD0_PKT_FLAG, le32_to_cpu(rxd[0]));
|
||||
if (type == PKT_TYPE_RX_EVENT && flag == 0x1)
|
||||
type = PKT_TYPE_NORMAL_MCU;
|
||||
|
||||
switch (type) {
|
||||
case PKT_TYPE_TXS:
|
||||
|
@ -116,6 +120,7 @@ void mt7615_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
|
|||
case PKT_TYPE_RX_EVENT:
|
||||
mt7615_mcu_rx_event(dev, skb);
|
||||
break;
|
||||
case PKT_TYPE_NORMAL_MCU:
|
||||
case PKT_TYPE_NORMAL:
|
||||
if (!mt7615_mac_fill_rx(dev, skb)) {
|
||||
mt76_rx(&dev->mt76, q, skb);
|
||||
|
@ -186,6 +191,41 @@ static void mt7622_dma_sched_init(struct mt7615_dev *dev)
|
|||
mt76_wr(dev, reg + MT_DMASHDL_SCHED_SET1, 0xedcba987);
|
||||
}
|
||||
|
||||
static void mt7663_dma_sched_init(struct mt7615_dev *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
mt76_rmw(dev, MT_DMA_SHDL(MT_DMASHDL_PKT_MAX_SIZE),
|
||||
MT_DMASHDL_PKT_MAX_SIZE_PLE | MT_DMASHDL_PKT_MAX_SIZE_PSE,
|
||||
FIELD_PREP(MT_DMASHDL_PKT_MAX_SIZE_PLE, 1) |
|
||||
FIELD_PREP(MT_DMASHDL_PKT_MAX_SIZE_PSE, 8));
|
||||
|
||||
/* enable refill control group 0, 1, 2, 4, 5 */
|
||||
mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_REFILL), 0xffc80000);
|
||||
/* enable group 0, 1, 2, 4, 5, 15 */
|
||||
mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_OPTIONAL), 0x70068037);
|
||||
|
||||
/* each group min quota must larger then PLE_PKT_MAX_SIZE_NUM */
|
||||
for (i = 0; i < 5; i++)
|
||||
mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_GROUP_QUOTA(i)),
|
||||
FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MIN, 0x40) |
|
||||
FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MAX, 0x800));
|
||||
mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_GROUP_QUOTA(5)),
|
||||
FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MIN, 0x40) |
|
||||
FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MAX, 0x40));
|
||||
mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_GROUP_QUOTA(15)),
|
||||
FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MIN, 0x20) |
|
||||
FIELD_PREP(MT_DMASHDL_GROUP_QUOTA_MAX, 0x20));
|
||||
|
||||
mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_Q_MAP(0)), 0x42104210);
|
||||
mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_Q_MAP(1)), 0x42104210);
|
||||
mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_Q_MAP(2)), 0x00050005);
|
||||
mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_Q_MAP(3)), 0);
|
||||
/* ALTX0 and ALTX1 QID mapping to group 5 */
|
||||
mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_SCHED_SET0), 0x6012345f);
|
||||
mt76_wr(dev, MT_DMA_SHDL(MT_DMASHDL_SCHED_SET1), 0xedcba987);
|
||||
}
|
||||
|
||||
int mt7615_dma_init(struct mt7615_dev *dev)
|
||||
{
|
||||
int rx_ring_size = MT7615_RX_RING_SIZE;
|
||||
|
@ -198,10 +238,6 @@ int mt7615_dma_init(struct mt7615_dev *dev)
|
|||
MT_WPDMA_GLO_CFG_FIFO_LITTLE_ENDIAN |
|
||||
MT_WPDMA_GLO_CFG_OMIT_TX_INFO);
|
||||
|
||||
if (!is_mt7622(&dev->mt76))
|
||||
mt76_set(dev, MT_WPDMA_GLO_CFG,
|
||||
MT_WPDMA_GLO_CFG_FIRST_TOKEN_ONLY);
|
||||
|
||||
mt76_rmw_field(dev, MT_WPDMA_GLO_CFG,
|
||||
MT_WPDMA_GLO_CFG_TX_BT_SIZE_BIT0, 0x1);
|
||||
|
||||
|
@ -215,6 +251,9 @@ int mt7615_dma_init(struct mt7615_dev *dev)
|
|||
MT_WPDMA_GLO_CFG_MULTI_DMA_EN, 0x3);
|
||||
|
||||
if (is_mt7615(&dev->mt76)) {
|
||||
mt76_set(dev, MT_WPDMA_GLO_CFG,
|
||||
MT_WPDMA_GLO_CFG_FIRST_TOKEN_ONLY);
|
||||
|
||||
mt76_wr(dev, MT_WPDMA_GLO_CFG1, 0x1);
|
||||
mt76_wr(dev, MT_WPDMA_TX_PRE_CFG, 0xf0000);
|
||||
mt76_wr(dev, MT_WPDMA_RX_PRE_CFG, 0xf7f0000);
|
||||
|
@ -271,6 +310,9 @@ int mt7615_dma_init(struct mt7615_dev *dev)
|
|||
if (is_mt7622(&dev->mt76))
|
||||
mt7622_dma_sched_init(dev);
|
||||
|
||||
if (is_mt7663(&dev->mt76))
|
||||
mt7663_dma_sched_init(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,11 +91,23 @@ static int mt7615_check_eeprom(struct mt76_dev *dev)
|
|||
}
|
||||
}
|
||||
|
||||
static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev)
|
||||
static void
|
||||
mt7615_eeprom_parse_hw_band_cap(struct mt7615_dev *dev)
|
||||
{
|
||||
u8 *eeprom = dev->mt76.eeprom.data;
|
||||
u8 tx_mask, max_nss;
|
||||
u32 val;
|
||||
u8 val, *eeprom = dev->mt76.eeprom.data;
|
||||
|
||||
if (is_mt7663(&dev->mt76)) {
|
||||
/* dual band */
|
||||
dev->mt76.cap.has_2ghz = true;
|
||||
dev->mt76.cap.has_5ghz = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_mt7622(&dev->mt76)) {
|
||||
/* 2GHz only */
|
||||
dev->mt76.cap.has_2ghz = true;
|
||||
return;
|
||||
}
|
||||
|
||||
val = FIELD_GET(MT_EE_NIC_WIFI_CONF_BAND_SEL,
|
||||
eeprom[MT_EE_WIFI_CONF]);
|
||||
|
@ -111,18 +123,30 @@ static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev)
|
|||
dev->mt76.cap.has_5ghz = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_mt7622(&dev->mt76))
|
||||
dev->mt76.cap.has_5ghz = false;
|
||||
static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev)
|
||||
{
|
||||
u8 *eeprom = dev->mt76.eeprom.data;
|
||||
u8 tx_mask;
|
||||
|
||||
/* read tx-rx mask from eeprom */
|
||||
val = mt76_rr(dev, MT_TOP_STRAP_STA);
|
||||
max_nss = val & MT_TOP_3NSS ? 3 : 4;
|
||||
mt7615_eeprom_parse_hw_band_cap(dev);
|
||||
|
||||
tx_mask = FIELD_GET(MT_EE_NIC_CONF_TX_MASK,
|
||||
eeprom[MT_EE_NIC_CONF_0]);
|
||||
if (!tx_mask || tx_mask > max_nss)
|
||||
tx_mask = max_nss;
|
||||
if (is_mt7663(&dev->mt76)) {
|
||||
tx_mask = 2;
|
||||
} else {
|
||||
u8 max_nss;
|
||||
u32 val;
|
||||
|
||||
/* read tx-rx mask from eeprom */
|
||||
val = mt76_rr(dev, MT_TOP_STRAP_STA);
|
||||
max_nss = val & MT_TOP_3NSS ? 3 : 4;
|
||||
|
||||
tx_mask = FIELD_GET(MT_EE_NIC_CONF_TX_MASK,
|
||||
eeprom[MT_EE_NIC_CONF_0]);
|
||||
if (!tx_mask || tx_mask > max_nss)
|
||||
tx_mask = max_nss;
|
||||
}
|
||||
|
||||
dev->chainmask = BIT(tx_mask) - 1;
|
||||
dev->mphy.antenna_mask = dev->chainmask;
|
||||
|
@ -229,6 +253,18 @@ static void mt7622_apply_cal_free_data(struct mt7615_dev *dev)
|
|||
}
|
||||
}
|
||||
|
||||
static void mt7615_cal_free_data(struct mt7615_dev *dev)
|
||||
{
|
||||
switch (mt76_chip(&dev->mt76)) {
|
||||
case 0x7622:
|
||||
mt7622_apply_cal_free_data(dev);
|
||||
break;
|
||||
case 0x7615:
|
||||
mt7615_apply_cal_free_data(dev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int mt7615_eeprom_init(struct mt7615_dev *dev)
|
||||
{
|
||||
int ret;
|
||||
|
@ -241,10 +277,8 @@ int mt7615_eeprom_init(struct mt7615_dev *dev)
|
|||
if (ret && dev->mt76.otp.data)
|
||||
memcpy(dev->mt76.eeprom.data, dev->mt76.otp.data,
|
||||
MT7615_EEPROM_SIZE);
|
||||
else if (is_mt7622(&dev->mt76))
|
||||
mt7622_apply_cal_free_data(dev);
|
||||
else
|
||||
mt7615_apply_cal_free_data(dev);
|
||||
mt7615_cal_free_data(dev);
|
||||
|
||||
mt7615_eeprom_parse_hw_cap(dev);
|
||||
memcpy(dev->mt76.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR,
|
||||
|
|
|
@ -18,11 +18,13 @@ enum mt7615_eeprom_field {
|
|||
MT_EE_TX1_5G_G0_TARGET_POWER = 0x098,
|
||||
MT_EE_EXT_PA_2G_TARGET_POWER = 0x0f2,
|
||||
MT_EE_EXT_PA_5G_TARGET_POWER = 0x0f3,
|
||||
MT7663_EE_TX0_2G_TARGET_POWER = 0x123,
|
||||
MT_EE_TX2_5G_G0_TARGET_POWER = 0x142,
|
||||
MT_EE_TX3_5G_G0_TARGET_POWER = 0x16a,
|
||||
|
||||
MT7615_EE_MAX = 0x3bf,
|
||||
MT7622_EE_MAX = 0x3db,
|
||||
MT7663_EE_MAX = 0x400,
|
||||
};
|
||||
|
||||
#define MT_EE_NIC_CONF_TX_MASK GENMASK(7, 4)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* Author: Roy Luo <royluo@google.com>
|
||||
* Ryder Lee <ryder.lee@mediatek.com>
|
||||
* Felix Fietkau <nbd@nbd.name>
|
||||
* Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
*/
|
||||
|
||||
#include <linux/etherdevice.h>
|
||||
|
@ -18,27 +19,65 @@ static void mt7615_phy_init(struct mt7615_dev *dev)
|
|||
mt76_set(dev, MT_WF_PHY_WF2_RFCTRL0(1), MT_WF_PHY_WF2_RFCTRL0_LPBCN_EN);
|
||||
}
|
||||
|
||||
static void mt7615_mac_init(struct mt7615_dev *dev)
|
||||
static void
|
||||
mt7615_init_mac_chain(struct mt7615_dev *dev, int chain)
|
||||
{
|
||||
u32 val, mask, set;
|
||||
int i;
|
||||
|
||||
if (!chain)
|
||||
val = MT_CFG_CCR_MAC_D0_1X_GC_EN | MT_CFG_CCR_MAC_D0_2X_GC_EN;
|
||||
else
|
||||
val = MT_CFG_CCR_MAC_D1_1X_GC_EN | MT_CFG_CCR_MAC_D1_2X_GC_EN;
|
||||
|
||||
/* enable band 0/1 clk */
|
||||
mt76_set(dev, MT_CFG_CCR,
|
||||
MT_CFG_CCR_MAC_D0_1X_GC_EN | MT_CFG_CCR_MAC_D0_2X_GC_EN |
|
||||
MT_CFG_CCR_MAC_D1_1X_GC_EN | MT_CFG_CCR_MAC_D1_2X_GC_EN);
|
||||
mt76_set(dev, MT_CFG_CCR, val);
|
||||
|
||||
val = mt76_rmw(dev, MT_TMAC_TRCR(0),
|
||||
MT_TMAC_TRCR_CCA_SEL | MT_TMAC_TRCR_SEC_CCA_SEL,
|
||||
FIELD_PREP(MT_TMAC_TRCR_CCA_SEL, 2) |
|
||||
FIELD_PREP(MT_TMAC_TRCR_SEC_CCA_SEL, 0));
|
||||
mt76_wr(dev, MT_TMAC_TRCR(1), val);
|
||||
mt76_rmw(dev, MT_TMAC_TRCR(chain),
|
||||
MT_TMAC_TRCR_CCA_SEL | MT_TMAC_TRCR_SEC_CCA_SEL,
|
||||
FIELD_PREP(MT_TMAC_TRCR_CCA_SEL, 2) |
|
||||
FIELD_PREP(MT_TMAC_TRCR_SEC_CCA_SEL, 0));
|
||||
|
||||
val = MT_AGG_ACR_PKT_TIME_EN | MT_AGG_ACR_NO_BA_AR_RULE |
|
||||
FIELD_PREP(MT_AGG_ACR_CFEND_RATE, MT7615_CFEND_RATE_DEFAULT) |
|
||||
FIELD_PREP(MT_AGG_ACR_BAR_RATE, MT7615_BAR_RATE_DEFAULT);
|
||||
mt76_wr(dev, MT_AGG_ACR(0), val);
|
||||
mt76_wr(dev, MT_AGG_ACR(1), val);
|
||||
mt76_wr(dev, MT_AGG_ACR(chain),
|
||||
MT_AGG_ACR_PKT_TIME_EN | MT_AGG_ACR_NO_BA_AR_RULE |
|
||||
FIELD_PREP(MT_AGG_ACR_CFEND_RATE, MT7615_CFEND_RATE_DEFAULT) |
|
||||
FIELD_PREP(MT_AGG_ACR_BAR_RATE, MT7615_BAR_RATE_DEFAULT));
|
||||
|
||||
mt76_wr(dev, MT_AGG_ARUCR(chain),
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(0), 7) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(1), 2) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(2), 2) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(3), 2) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(4), 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(5), 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(6), 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(7), 1));
|
||||
|
||||
mt76_wr(dev, MT_AGG_ARDCR(chain),
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(0), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(1), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(2), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(3), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(4), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(5), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(6), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(7), MT7615_RATE_RETRY - 1));
|
||||
|
||||
mask = MT_DMA_RCFR0_MCU_RX_MGMT |
|
||||
MT_DMA_RCFR0_MCU_RX_CTL_NON_BAR |
|
||||
MT_DMA_RCFR0_MCU_RX_CTL_BAR |
|
||||
MT_DMA_RCFR0_MCU_RX_BYPASS |
|
||||
MT_DMA_RCFR0_RX_DROPPED_UCAST |
|
||||
MT_DMA_RCFR0_RX_DROPPED_MCAST;
|
||||
set = FIELD_PREP(MT_DMA_RCFR0_RX_DROPPED_UCAST, 2) |
|
||||
FIELD_PREP(MT_DMA_RCFR0_RX_DROPPED_MCAST, 2);
|
||||
mt76_rmw(dev, MT_DMA_RCFR0(chain), mask, set);
|
||||
}
|
||||
|
||||
static void mt7615_mac_init(struct mt7615_dev *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
mt7615_init_mac_chain(dev, 0);
|
||||
|
||||
mt76_rmw_field(dev, MT_TMAC_CTCR0,
|
||||
MT_TMAC_CTCR0_INS_DDLMT_REFTIME, 0x3f);
|
||||
|
@ -56,47 +95,11 @@ static void mt7615_mac_init(struct mt7615_dev *dev)
|
|||
mt76_rmw(dev, MT_AGG_SCR, MT_AGG_SCR_NLNAV_MID_PTEC_DIS,
|
||||
MT_AGG_SCR_NLNAV_MID_PTEC_DIS);
|
||||
|
||||
mt76_wr(dev, MT_DMA_DCR0, MT_DMA_DCR0_RX_VEC_DROP |
|
||||
FIELD_PREP(MT_DMA_DCR0_MAX_RX_LEN, 3072));
|
||||
|
||||
val = FIELD_PREP(MT_AGG_ARxCR_LIMIT(0), 7) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(1), 2) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(2), 2) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(3), 2) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(4), 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(5), 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(6), 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(7), 1);
|
||||
mt76_wr(dev, MT_AGG_ARUCR(0), val);
|
||||
mt76_wr(dev, MT_AGG_ARUCR(1), val);
|
||||
|
||||
val = FIELD_PREP(MT_AGG_ARxCR_LIMIT(0), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(1), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(2), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(3), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(4), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(5), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(6), MT7615_RATE_RETRY - 1) |
|
||||
FIELD_PREP(MT_AGG_ARxCR_LIMIT(7), MT7615_RATE_RETRY - 1);
|
||||
mt76_wr(dev, MT_AGG_ARDCR(0), val);
|
||||
mt76_wr(dev, MT_AGG_ARDCR(1), val);
|
||||
|
||||
mt76_wr(dev, MT_AGG_ARCR,
|
||||
(FIELD_PREP(MT_AGG_ARCR_RTS_RATE_THR, 2) |
|
||||
MT_AGG_ARCR_RATE_DOWN_RATIO_EN |
|
||||
FIELD_PREP(MT_AGG_ARCR_RATE_DOWN_RATIO, 1) |
|
||||
FIELD_PREP(MT_AGG_ARCR_RATE_UP_EXTRA_TH, 4)));
|
||||
|
||||
mask = MT_DMA_RCFR0_MCU_RX_MGMT |
|
||||
MT_DMA_RCFR0_MCU_RX_CTL_NON_BAR |
|
||||
MT_DMA_RCFR0_MCU_RX_CTL_BAR |
|
||||
MT_DMA_RCFR0_MCU_RX_BYPASS |
|
||||
MT_DMA_RCFR0_RX_DROPPED_UCAST |
|
||||
MT_DMA_RCFR0_RX_DROPPED_MCAST;
|
||||
set = FIELD_PREP(MT_DMA_RCFR0_RX_DROPPED_UCAST, 2) |
|
||||
FIELD_PREP(MT_DMA_RCFR0_RX_DROPPED_MCAST, 2);
|
||||
mt76_rmw(dev, MT_DMA_RCFR0(0), mask, set);
|
||||
mt76_rmw(dev, MT_DMA_RCFR0(1), mask, set);
|
||||
FIELD_PREP(MT_AGG_ARCR_RTS_RATE_THR, 2) |
|
||||
MT_AGG_ARCR_RATE_DOWN_RATIO_EN |
|
||||
FIELD_PREP(MT_AGG_ARCR_RATE_DOWN_RATIO, 1) |
|
||||
FIELD_PREP(MT_AGG_ARCR_RATE_UP_EXTRA_TH, 4));
|
||||
|
||||
for (i = 0; i < MT7615_WTBL_SIZE; i++)
|
||||
mt7615_mac_wtbl_update(dev, i,
|
||||
|
@ -104,6 +107,19 @@ static void mt7615_mac_init(struct mt7615_dev *dev)
|
|||
|
||||
mt76_set(dev, MT_WF_RMAC_MIB_TIME0, MT_WF_RMAC_MIB_RXTIME_EN);
|
||||
mt76_set(dev, MT_WF_RMAC_MIB_AIRTIME0, MT_WF_RMAC_MIB_RXTIME_EN);
|
||||
|
||||
/* disable hdr translation and hw AMSDU */
|
||||
mt76_wr(dev, MT_DMA_DCR0,
|
||||
FIELD_PREP(MT_DMA_DCR0_MAX_RX_LEN, 3072) |
|
||||
MT_DMA_DCR0_RX_VEC_DROP);
|
||||
if (is_mt7663(&dev->mt76)) {
|
||||
mt76_wr(dev, MT_CSR(0x010), 0x8208);
|
||||
mt76_wr(dev, 0x44064, 0x2000000);
|
||||
mt76_wr(dev, MT_WF_AGG(0x160), 0x5c341c02);
|
||||
mt76_wr(dev, MT_WF_AGG(0x164), 0x70708040);
|
||||
} else {
|
||||
mt7615_init_mac_chain(dev, 1);
|
||||
}
|
||||
}
|
||||
|
||||
bool mt7615_wait_for_mcu_init(struct mt7615_dev *dev)
|
||||
|
@ -350,6 +366,8 @@ mt7615_cap_dbdc_enable(struct mt7615_dev *dev)
|
|||
else
|
||||
dev->mphy.antenna_mask = dev->chainmask >> 1;
|
||||
dev->phy.chainmask = dev->mphy.antenna_mask;
|
||||
dev->mphy.hw->wiphy->available_antennas_rx = dev->phy.chainmask;
|
||||
dev->mphy.hw->wiphy->available_antennas_tx = dev->phy.chainmask;
|
||||
mt76_set_stream_caps(&dev->mt76, true);
|
||||
}
|
||||
|
||||
|
@ -361,6 +379,8 @@ mt7615_cap_dbdc_disable(struct mt7615_dev *dev)
|
|||
IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
|
||||
dev->mphy.antenna_mask = dev->chainmask;
|
||||
dev->phy.chainmask = dev->chainmask;
|
||||
dev->mphy.hw->wiphy->available_antennas_rx = dev->chainmask;
|
||||
dev->mphy.hw->wiphy->available_antennas_tx = dev->chainmask;
|
||||
mt76_set_stream_caps(&dev->mt76, true);
|
||||
}
|
||||
|
||||
|
@ -425,11 +445,9 @@ void mt7615_unregister_ext_phy(struct mt7615_dev *dev)
|
|||
ieee80211_free_hw(mphy->hw);
|
||||
}
|
||||
|
||||
|
||||
int mt7615_register_device(struct mt7615_dev *dev)
|
||||
void mt7615_init_device(struct mt7615_dev *dev)
|
||||
{
|
||||
struct ieee80211_hw *hw = mt76_hw(dev);
|
||||
int ret;
|
||||
|
||||
dev->phy.dev = dev;
|
||||
dev->phy.mt76 = &dev->mt76.phy;
|
||||
|
@ -440,14 +458,6 @@ int mt7615_register_device(struct mt7615_dev *dev)
|
|||
init_waitqueue_head(&dev->reset_wait);
|
||||
INIT_WORK(&dev->reset_work, mt7615_mac_reset_work);
|
||||
|
||||
ret = mt7622_wmac_init(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = mt7615_init_hardware(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
mt7615_init_wiphy(hw);
|
||||
dev->mphy.sband_2g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING;
|
||||
dev->mphy.sband_5g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING;
|
||||
|
@ -456,6 +466,13 @@ int mt7615_register_device(struct mt7615_dev *dev)
|
|||
IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
|
||||
mt7615_cap_dbdc_disable(dev);
|
||||
dev->phy.dfs_state = -1;
|
||||
}
|
||||
|
||||
int mt7615_register_device(struct mt7615_dev *dev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
mt7615_init_device(dev);
|
||||
|
||||
/* init led callbacks */
|
||||
if (IS_ENABLED(CONFIG_MT76_LEDS)) {
|
||||
|
@ -463,6 +480,14 @@ int mt7615_register_device(struct mt7615_dev *dev)
|
|||
dev->mt76.led_cdev.blink_set = mt7615_led_set_blink;
|
||||
}
|
||||
|
||||
ret = mt7622_wmac_init(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = mt7615_init_hardware(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = mt76_register_device(&dev->mt76, true, mt7615_rates,
|
||||
ARRAY_SIZE(mt7615_rates));
|
||||
if (ret)
|
||||
|
|
|
@ -503,7 +503,7 @@ mt7615_mac_tx_rate_val(struct mt7615_dev *dev,
|
|||
int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
|
||||
struct sk_buff *skb, struct mt76_wcid *wcid,
|
||||
struct ieee80211_sta *sta, int pid,
|
||||
struct ieee80211_key_conf *key)
|
||||
struct ieee80211_key_conf *key, bool beacon)
|
||||
{
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
struct ieee80211_tx_rate *rate = &info->control.rates[0];
|
||||
|
@ -541,7 +541,7 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
|
|||
q_idx = wmm_idx * MT7615_MAX_WMM_SETS +
|
||||
skb_get_queue_mapping(skb);
|
||||
p_fmt = MT_TX_TYPE_CT;
|
||||
} else if (ieee80211_is_beacon(fc)) {
|
||||
} else if (beacon) {
|
||||
if (ext_phy)
|
||||
q_idx = MT_LMAC_BCN1;
|
||||
else
|
||||
|
@ -703,9 +703,9 @@ void mt7615_txp_skb_unmap(struct mt76_dev *dev,
|
|||
mt7615_txp_skb_unmap_hw(dev, &txp->hw);
|
||||
}
|
||||
|
||||
static u32 mt7615_mac_wtbl_addr(int wcid)
|
||||
static u32 mt7615_mac_wtbl_addr(struct mt7615_dev *dev, int wcid)
|
||||
{
|
||||
return MT_WTBL_BASE + wcid * MT_WTBL_ENTRY_SIZE;
|
||||
return MT_WTBL_BASE(dev) + wcid * MT_WTBL_ENTRY_SIZE;
|
||||
}
|
||||
|
||||
bool mt7615_mac_wtbl_update(struct mt7615_dev *dev, int idx, u32 mask)
|
||||
|
@ -751,7 +751,7 @@ void mt7615_mac_sta_poll(struct mt7615_dev *dev)
|
|||
list_del_init(&msta->poll_list);
|
||||
spin_unlock_bh(&dev->sta_poll_lock);
|
||||
|
||||
addr = mt7615_mac_wtbl_addr(msta->wcid.idx) + 19 * 4;
|
||||
addr = mt7615_mac_wtbl_addr(dev, msta->wcid.idx) + 19 * 4;
|
||||
|
||||
for (i = 0; i < 4; i++, addr += 8) {
|
||||
u32 tx_last = msta->airtime_ac[i];
|
||||
|
@ -801,7 +801,7 @@ void mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta,
|
|||
struct mt76_phy *mphy = phy->mt76;
|
||||
struct ieee80211_tx_rate *ref;
|
||||
int wcid = sta->wcid.idx;
|
||||
u32 addr = mt7615_mac_wtbl_addr(wcid);
|
||||
u32 addr = mt7615_mac_wtbl_addr(dev, wcid);
|
||||
bool stbc = false;
|
||||
int n_rates = sta->n_rates;
|
||||
u8 bw, bw_prev, bw_idx = 0;
|
||||
|
@ -966,7 +966,7 @@ mt7615_mac_wtbl_update_key(struct mt7615_dev *dev, struct mt76_wcid *wcid,
|
|||
enum mt7615_cipher_type cipher,
|
||||
enum set_key_cmd cmd)
|
||||
{
|
||||
u32 addr = mt7615_mac_wtbl_addr(wcid->idx) + 30 * 4;
|
||||
u32 addr = mt7615_mac_wtbl_addr(dev, wcid->idx) + 30 * 4;
|
||||
u8 data[32] = {};
|
||||
|
||||
if (key->keylen > sizeof(data))
|
||||
|
@ -1004,7 +1004,7 @@ mt7615_mac_wtbl_update_pk(struct mt7615_dev *dev, struct mt76_wcid *wcid,
|
|||
enum mt7615_cipher_type cipher, int keyidx,
|
||||
enum set_key_cmd cmd)
|
||||
{
|
||||
u32 addr = mt7615_mac_wtbl_addr(wcid->idx), w0, w1;
|
||||
u32 addr = mt7615_mac_wtbl_addr(dev, wcid->idx), w0, w1;
|
||||
|
||||
if (!mt76_poll(dev, MT_WTBL_UPDATE, MT_WTBL_UPDATE_BUSY, 0, 5000))
|
||||
return -ETIMEDOUT;
|
||||
|
@ -1040,7 +1040,7 @@ mt7615_mac_wtbl_update_cipher(struct mt7615_dev *dev, struct mt76_wcid *wcid,
|
|||
enum mt7615_cipher_type cipher,
|
||||
enum set_key_cmd cmd)
|
||||
{
|
||||
u32 addr = mt7615_mac_wtbl_addr(wcid->idx);
|
||||
u32 addr = mt7615_mac_wtbl_addr(dev, wcid->idx);
|
||||
|
||||
if (cmd == SET_KEY) {
|
||||
if (cipher != MT_CIPHER_BIP_CMAC_128 || !wcid->cipher)
|
||||
|
@ -1208,7 +1208,7 @@ int mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
|
|||
return id;
|
||||
|
||||
mt7615_mac_write_txwi(dev, txwi_ptr, tx_info->skb, wcid, sta,
|
||||
pid, key);
|
||||
pid, key, false);
|
||||
|
||||
txp = txwi + MT_TXD_SIZE;
|
||||
memset(txp, 0, sizeof(struct mt7615_txp_common));
|
||||
|
@ -1524,6 +1524,9 @@ void mt7615_mac_set_scs(struct mt7615_dev *dev, bool enable)
|
|||
if (dev->scs_en == enable)
|
||||
goto out;
|
||||
|
||||
if (is_mt7663(&dev->mt76))
|
||||
goto out;
|
||||
|
||||
if (enable) {
|
||||
mt76_set(dev, MT_WF_PHY_MIN_PRI_PWR(0),
|
||||
MT_WF_PHY_PD_BLK(0));
|
||||
|
@ -1555,6 +1558,9 @@ void mt7615_mac_enable_nf(struct mt7615_dev *dev, bool ext_phy)
|
|||
{
|
||||
u32 rxtd;
|
||||
|
||||
if (is_mt7663(&dev->mt76))
|
||||
return;
|
||||
|
||||
if (ext_phy)
|
||||
rxtd = MT_WF_PHY_RXTD2(10);
|
||||
else
|
||||
|
@ -1630,7 +1636,6 @@ mt7615_mac_adjust_sensitivity(struct mt7615_phy *phy,
|
|||
MT_WF_PHY_PD_OFDM(ext_phy, val));
|
||||
} else {
|
||||
val = *sensitivity + 256;
|
||||
if (!ext_phy)
|
||||
mt76_rmw(dev, MT_WF_PHY_RXTD_CCK_PD(ext_phy),
|
||||
MT_WF_PHY_PD_CCK_MASK(ext_phy),
|
||||
MT_WF_PHY_PD_CCK(ext_phy, val));
|
||||
|
@ -1823,8 +1828,9 @@ static void
|
|||
mt7615_update_vif_beacon(void *priv, u8 *mac, struct ieee80211_vif *vif)
|
||||
{
|
||||
struct ieee80211_hw *hw = priv;
|
||||
struct mt7615_dev *dev = mt7615_hw_dev(hw);
|
||||
|
||||
mt7615_mcu_set_bcn(hw, vif, vif->bss_conf.enable_beacon);
|
||||
mt7615_mcu_add_beacon(dev, hw, vif, vif->bss_conf.enable_beacon);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#define MT_CT_DMA_BUF_NUM 2
|
||||
|
||||
#define MT_RXD0_LENGTH GENMASK(15, 0)
|
||||
#define MT_RXD0_PKT_FLAG GENMASK(19, 16)
|
||||
#define MT_RXD0_PKT_TYPE GENMASK(31, 29)
|
||||
|
||||
#define MT_RXD0_NORMAL_ETH_TYPE_OFS GENMASK(22, 16)
|
||||
|
@ -26,7 +27,8 @@ enum rx_pkt_type {
|
|||
PKT_TYPE_RX_TMR,
|
||||
PKT_TYPE_RETRIEVE,
|
||||
PKT_TYPE_TXRX_NOTIFY,
|
||||
PKT_TYPE_RX_EVENT
|
||||
PKT_TYPE_RX_EVENT,
|
||||
PKT_TYPE_NORMAL_MCU,
|
||||
};
|
||||
|
||||
#define MT_RXD1_NORMAL_BSSID GENMASK(31, 26)
|
||||
|
@ -229,8 +231,15 @@ enum tx_phy_bandwidth {
|
|||
#define MT_TXD6_FIXED_BW BIT(2)
|
||||
#define MT_TXD6_BW GENMASK(1, 0)
|
||||
|
||||
/* MT7663 DW7 HW-AMSDU */
|
||||
#define MT_TXD7_HW_AMSDU_CAP BIT(30)
|
||||
#define MT_TXD7_TYPE GENMASK(21, 20)
|
||||
#define MT_TXD7_SUB_TYPE GENMASK(19, 16)
|
||||
#define MT_TXD7_SPE_IDX GENMASK(15, 11)
|
||||
#define MT_TXD7_SPE_IDX_SLE BIT(10)
|
||||
|
||||
#define MT_TXD8_L_TYPE GENMASK(5, 4)
|
||||
#define MT_TXD8_L_SUB_TYPE GENMASK(3, 0)
|
||||
|
||||
#define MT_TX_RATE_STBC BIT(11)
|
||||
#define MT_TX_RATE_NSS GENMASK(10, 9)
|
||||
|
|
|
@ -39,13 +39,13 @@ static int mt7615_start(struct ieee80211_hw *hw)
|
|||
running = mt7615_dev_running(dev);
|
||||
|
||||
if (!running) {
|
||||
mt7615_mcu_ctrl_pm_state(dev, 0, 0);
|
||||
mt7615_mcu_set_pm(dev, 0, 0);
|
||||
mt7615_mcu_set_mac_enable(dev, 0, true);
|
||||
mt7615_mac_enable_nf(dev, 0);
|
||||
}
|
||||
|
||||
if (phy != &dev->phy) {
|
||||
mt7615_mcu_ctrl_pm_state(dev, 1, 0);
|
||||
mt7615_mcu_set_pm(dev, 1, 0);
|
||||
mt7615_mcu_set_mac_enable(dev, 1, true);
|
||||
mt7615_mac_enable_nf(dev, 1);
|
||||
}
|
||||
|
@ -78,14 +78,14 @@ static void mt7615_stop(struct ieee80211_hw *hw)
|
|||
clear_bit(MT76_STATE_RUNNING, &phy->mt76->state);
|
||||
|
||||
if (phy != &dev->phy) {
|
||||
mt7615_mcu_ctrl_pm_state(dev, 1, 1);
|
||||
mt7615_mcu_set_pm(dev, 1, 1);
|
||||
mt7615_mcu_set_mac_enable(dev, 1, false);
|
||||
}
|
||||
|
||||
if (!mt7615_dev_running(dev)) {
|
||||
cancel_delayed_work_sync(&dev->mt76.mac_work);
|
||||
|
||||
mt7615_mcu_ctrl_pm_state(dev, 0, 1);
|
||||
mt7615_mcu_set_pm(dev, 0, 1);
|
||||
mt7615_mcu_set_mac_enable(dev, 0, false);
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ static int mt7615_add_interface(struct ieee80211_hw *hw,
|
|||
else
|
||||
mvif->wmm_idx = mvif->idx % MT7615_MAX_WMM_SETS;
|
||||
|
||||
ret = mt7615_mcu_set_dev_info(dev, vif, 1);
|
||||
ret = mt7615_mcu_add_dev_info(dev, vif, true);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
|
@ -200,7 +200,7 @@ static void mt7615_remove_interface(struct ieee80211_hw *hw,
|
|||
|
||||
/* TODO: disable beacon for the bss */
|
||||
|
||||
mt7615_mcu_set_dev_info(dev, vif, 0);
|
||||
mt7615_mcu_add_dev_info(dev, vif, false);
|
||||
|
||||
rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
|
||||
if (vif->txq)
|
||||
|
@ -412,7 +412,7 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
|
|||
mutex_lock(&dev->mt76.mutex);
|
||||
|
||||
if (changed & BSS_CHANGED_ASSOC)
|
||||
mt7615_mcu_set_bss_info(dev, vif, info->assoc);
|
||||
mt7615_mcu_add_bss_info(dev, vif, info->assoc);
|
||||
|
||||
if (changed & BSS_CHANGED_ERP_SLOT) {
|
||||
int slottime = info->use_short_slot ? 9 : 20;
|
||||
|
@ -425,13 +425,13 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
|
|||
}
|
||||
|
||||
if (changed & BSS_CHANGED_BEACON_ENABLED) {
|
||||
mt7615_mcu_set_bss_info(dev, vif, info->enable_beacon);
|
||||
mt7615_mcu_set_bmc(dev, vif, info->enable_beacon);
|
||||
mt7615_mcu_add_bss_info(dev, vif, info->enable_beacon);
|
||||
mt7615_mcu_sta_add(dev, vif, NULL, info->enable_beacon);
|
||||
}
|
||||
|
||||
if (changed & (BSS_CHANGED_BEACON |
|
||||
BSS_CHANGED_BEACON_ENABLED))
|
||||
mt7615_mcu_set_bcn(hw, vif, info->enable_beacon);
|
||||
mt7615_mcu_add_beacon(dev, hw, vif, info->enable_beacon);
|
||||
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
}
|
||||
|
@ -444,7 +444,7 @@ mt7615_channel_switch_beacon(struct ieee80211_hw *hw,
|
|||
struct mt7615_dev *dev = mt7615_hw_dev(hw);
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
mt7615_mcu_set_bcn(hw, vif, true);
|
||||
mt7615_mcu_add_beacon(dev, hw, vif, true);
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ int mt7615_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
|
|||
mt7615_mac_wtbl_update(dev, idx,
|
||||
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
|
||||
|
||||
mt7615_mcu_set_sta(dev, vif, sta, 1);
|
||||
mt7615_mcu_sta_add(dev, vif, sta, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ void mt7615_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
|
|||
struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
|
||||
struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv;
|
||||
|
||||
mt7615_mcu_set_sta(dev, vif, sta, 0);
|
||||
mt7615_mcu_sta_add(dev, vif, sta, false);
|
||||
mt7615_mac_wtbl_update(dev, msta->wcid.idx,
|
||||
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
|
||||
|
||||
|
@ -578,21 +578,21 @@ mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
|||
case IEEE80211_AMPDU_RX_START:
|
||||
mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid, ssn,
|
||||
params->buf_size);
|
||||
mt7615_mcu_set_rx_ba(dev, params, 1);
|
||||
mt7615_mcu_add_rx_ba(dev, params, true);
|
||||
break;
|
||||
case IEEE80211_AMPDU_RX_STOP:
|
||||
mt76_rx_aggr_stop(&dev->mt76, &msta->wcid, tid);
|
||||
mt7615_mcu_set_rx_ba(dev, params, 0);
|
||||
mt7615_mcu_add_rx_ba(dev, params, false);
|
||||
break;
|
||||
case IEEE80211_AMPDU_TX_OPERATIONAL:
|
||||
mtxq->aggr = true;
|
||||
mtxq->send_bar = false;
|
||||
mt7615_mcu_set_tx_ba(dev, params, 1);
|
||||
mt7615_mcu_add_tx_ba(dev, params, true);
|
||||
break;
|
||||
case IEEE80211_AMPDU_TX_STOP_FLUSH:
|
||||
case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
|
||||
mtxq->aggr = false;
|
||||
mt7615_mcu_set_tx_ba(dev, params, 0);
|
||||
mt7615_mcu_add_tx_ba(dev, params, false);
|
||||
break;
|
||||
case IEEE80211_AMPDU_TX_START:
|
||||
mtxq->agg_ssn = IEEE80211_SN_TO_SEQ(ssn);
|
||||
|
@ -600,7 +600,7 @@ mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
|||
break;
|
||||
case IEEE80211_AMPDU_TX_STOP_CONT:
|
||||
mtxq->aggr = false;
|
||||
mt7615_mcu_set_tx_ba(dev, params, 0);
|
||||
mt7615_mcu_add_tx_ba(dev, params, false);
|
||||
ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
|
||||
break;
|
||||
}
|
||||
|
@ -686,7 +686,13 @@ mt7615_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
|
|||
mutex_lock(&dev->mt76.mutex);
|
||||
|
||||
phy->mt76->antenna_mask = tx_ant;
|
||||
phy->chainmask = ext_phy ? tx_ant << 2 : tx_ant;
|
||||
if (ext_phy) {
|
||||
if (dev->chainmask == 0xf)
|
||||
tx_ant <<= 2;
|
||||
else
|
||||
tx_ant <<= 1;
|
||||
}
|
||||
phy->chainmask = tx_ant;
|
||||
|
||||
mt76_set_stream_caps(&dev->mt76, true);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,6 +23,57 @@ struct mt7615_mcu_txd {
|
|||
u32 reserved[5];
|
||||
} __packed __aligned(4);
|
||||
|
||||
/**
|
||||
* struct mt7615_uni_txd - mcu command descriptor for firmware v3
|
||||
* @txd: hardware descriptor
|
||||
* @len: total length not including txd
|
||||
* @cid: command identifier
|
||||
* @pkt_type: must be 0xa0 (cmd packet by long format)
|
||||
* @frag_n: fragment number
|
||||
* @seq: sequence number
|
||||
* @checksum: 0 mean there is no checksum
|
||||
* @s2d_index: index for command source and destination
|
||||
* Definition | value | note
|
||||
* CMD_S2D_IDX_H2N | 0x00 | command from HOST to WM
|
||||
* CMD_S2D_IDX_C2N | 0x01 | command from WA to WM
|
||||
* CMD_S2D_IDX_H2C | 0x02 | command from HOST to WA
|
||||
* CMD_S2D_IDX_H2N_AND_H2C | 0x03 | command from HOST to WA and WM
|
||||
*
|
||||
* @option: command option
|
||||
* BIT[0]: UNI_CMD_OPT_BIT_ACK
|
||||
* set to 1 to request a fw reply
|
||||
* if UNI_CMD_OPT_BIT_0_ACK is set and UNI_CMD_OPT_BIT_2_SET_QUERY
|
||||
* is set, mcu firmware will send response event EID = 0x01
|
||||
* (UNI_EVENT_ID_CMD_RESULT) to the host.
|
||||
* BIT[1]: UNI_CMD_OPT_BIT_UNI_CMD
|
||||
* 0: original command
|
||||
* 1: unified command
|
||||
* BIT[2]: UNI_CMD_OPT_BIT_SET_QUERY
|
||||
* 0: QUERY command
|
||||
* 1: SET command
|
||||
*/
|
||||
struct mt7615_uni_txd {
|
||||
__le32 txd[8];
|
||||
|
||||
/* DW1 */
|
||||
__le16 len;
|
||||
__le16 cid;
|
||||
|
||||
/* DW2 */
|
||||
u8 reserved;
|
||||
u8 pkt_type;
|
||||
u8 frag_n;
|
||||
u8 seq;
|
||||
|
||||
/* DW3 */
|
||||
__le16 checksum;
|
||||
u8 s2d_index;
|
||||
u8 option;
|
||||
|
||||
/* DW4 */
|
||||
u8 reserved2[4];
|
||||
} __packed __aligned(4);
|
||||
|
||||
/* event table */
|
||||
enum {
|
||||
MCU_EVENT_TARGET_ADDRESS_LEN = 0x01,
|
||||
|
@ -179,16 +230,20 @@ enum {
|
|||
MCU_S2D_H2CN
|
||||
};
|
||||
|
||||
#define MCU_FW_PREFIX BIT(31)
|
||||
#define MCU_UNI_PREFIX BIT(30)
|
||||
#define MCU_CMD_MASK ~(MCU_FW_PREFIX | MCU_UNI_PREFIX)
|
||||
|
||||
enum {
|
||||
MCU_CMD_TARGET_ADDRESS_LEN_REQ = 0x01,
|
||||
MCU_CMD_FW_START_REQ = 0x02,
|
||||
MCU_CMD_TARGET_ADDRESS_LEN_REQ = MCU_FW_PREFIX | 0x01,
|
||||
MCU_CMD_FW_START_REQ = MCU_FW_PREFIX | 0x02,
|
||||
MCU_CMD_INIT_ACCESS_REG = 0x3,
|
||||
MCU_CMD_PATCH_START_REQ = 0x05,
|
||||
MCU_CMD_PATCH_FINISH_REQ = 0x07,
|
||||
MCU_CMD_PATCH_SEM_CONTROL = 0x10,
|
||||
MCU_CMD_PATCH_FINISH_REQ = MCU_FW_PREFIX | 0x07,
|
||||
MCU_CMD_PATCH_SEM_CONTROL = MCU_FW_PREFIX | 0x10,
|
||||
MCU_CMD_EXT_CID = 0xED,
|
||||
MCU_CMD_FW_SCATTER = 0xEE,
|
||||
MCU_CMD_RESTART_DL_REQ = 0xEF,
|
||||
MCU_CMD_FW_SCATTER = MCU_FW_PREFIX | 0xEE,
|
||||
MCU_CMD_RESTART_DL_REQ = MCU_FW_PREFIX | 0xEF,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -214,6 +269,23 @@ enum {
|
|||
MCU_EXT_CMD_SET_RDD_PATTERN = 0x7d,
|
||||
};
|
||||
|
||||
enum {
|
||||
MCU_UNI_CMD_DEV_INFO_UPDATE = MCU_UNI_PREFIX | 0x01,
|
||||
MCU_UNI_CMD_BSS_INFO_UPDATE = MCU_UNI_PREFIX | 0x02,
|
||||
MCU_UNI_CMD_STA_REC_UPDATE = MCU_UNI_PREFIX | 0x03,
|
||||
};
|
||||
|
||||
#define MCU_CMD_ACK BIT(0)
|
||||
#define MCU_CMD_UNI BIT(1)
|
||||
#define MCU_CMD_QUERY BIT(2)
|
||||
|
||||
#define MCU_CMD_UNI_EXT_ACK (MCU_CMD_ACK | MCU_CMD_UNI | MCU_CMD_QUERY)
|
||||
|
||||
enum {
|
||||
UNI_BSS_INFO_BASIC = 0,
|
||||
UNI_BSS_INFO_BCN_CONTENT = 7,
|
||||
};
|
||||
|
||||
enum {
|
||||
PATCH_SEM_RELEASE = 0x0,
|
||||
PATCH_SEM_GET = 0x1
|
||||
|
@ -274,6 +346,11 @@ enum {
|
|||
__DBDC_TYPE_MAX,
|
||||
};
|
||||
|
||||
struct tlv {
|
||||
__le16 tag;
|
||||
__le16 len;
|
||||
} __packed;
|
||||
|
||||
struct bss_info_omac {
|
||||
__le16 tag;
|
||||
__le16 len;
|
||||
|
@ -483,18 +560,28 @@ struct wtbl_raw {
|
|||
__le32 val;
|
||||
} __packed;
|
||||
|
||||
#define MT7615_WTBL_UPDATE_MAX_SIZE (sizeof(struct wtbl_req_hdr) + \
|
||||
sizeof(struct wtbl_generic) + \
|
||||
sizeof(struct wtbl_rx) + \
|
||||
sizeof(struct wtbl_ht) + \
|
||||
sizeof(struct wtbl_vht) + \
|
||||
sizeof(struct wtbl_tx_ps) + \
|
||||
sizeof(struct wtbl_hdr_trans) + \
|
||||
sizeof(struct wtbl_ba) + \
|
||||
sizeof(struct wtbl_bf) + \
|
||||
sizeof(struct wtbl_smps) + \
|
||||
sizeof(struct wtbl_pn) + \
|
||||
sizeof(struct wtbl_spe))
|
||||
#define MT7615_WTBL_UPDATE_MAX_SIZE (sizeof(struct wtbl_req_hdr) + \
|
||||
sizeof(struct wtbl_generic) + \
|
||||
sizeof(struct wtbl_rx) + \
|
||||
sizeof(struct wtbl_ht) + \
|
||||
sizeof(struct wtbl_vht) + \
|
||||
sizeof(struct wtbl_tx_ps) + \
|
||||
sizeof(struct wtbl_hdr_trans) +\
|
||||
sizeof(struct wtbl_ba) + \
|
||||
sizeof(struct wtbl_bf) + \
|
||||
sizeof(struct wtbl_smps) + \
|
||||
sizeof(struct wtbl_pn) + \
|
||||
sizeof(struct wtbl_spe))
|
||||
|
||||
#define MT7615_STA_UPDATE_MAX_SIZE (sizeof(struct sta_req_hdr) + \
|
||||
sizeof(struct sta_rec_basic) + \
|
||||
sizeof(struct sta_rec_ht) + \
|
||||
sizeof(struct sta_rec_vht) + \
|
||||
sizeof(struct tlv) + \
|
||||
MT7615_WTBL_UPDATE_MAX_SIZE)
|
||||
|
||||
#define MT7615_WTBL_UPDATE_BA_SIZE (sizeof(struct wtbl_req_hdr) + \
|
||||
sizeof(struct wtbl_ba))
|
||||
|
||||
enum {
|
||||
WTBL_GENERIC,
|
||||
|
@ -517,6 +604,11 @@ enum {
|
|||
WTBL_MAX_NUM
|
||||
};
|
||||
|
||||
struct sta_ntlv_hdr {
|
||||
u8 rsv[2];
|
||||
__le16 tlv_num;
|
||||
} __packed;
|
||||
|
||||
struct sta_req_hdr {
|
||||
u8 bss_idx;
|
||||
u8 wlan_idx;
|
||||
|
@ -526,6 +618,15 @@ struct sta_req_hdr {
|
|||
u8 rsv[2];
|
||||
} __packed;
|
||||
|
||||
struct sta_rec_state {
|
||||
__le16 tag;
|
||||
__le16 len;
|
||||
u8 state;
|
||||
__le32 flags;
|
||||
u8 vhtop;
|
||||
u8 pad[2];
|
||||
} __packed;
|
||||
|
||||
struct sta_rec_basic {
|
||||
__le16 tag;
|
||||
__le16 len;
|
||||
|
@ -565,11 +666,6 @@ struct sta_rec_ba {
|
|||
__le16 winsize;
|
||||
} __packed;
|
||||
|
||||
struct sta_rec_wtbl {
|
||||
__le16 tag;
|
||||
__le16 len;
|
||||
} __packed;
|
||||
|
||||
enum {
|
||||
STA_REC_BASIC,
|
||||
STA_REC_RA,
|
||||
|
@ -578,7 +674,7 @@ enum {
|
|||
STA_REC_BF,
|
||||
STA_REC_AMSDU, /* for CR4 */
|
||||
STA_REC_BA,
|
||||
STA_REC_RED, /* not used */
|
||||
STA_REC_STATE,
|
||||
STA_REC_TX_PROC, /* for hdr trans and CSO in CR4 */
|
||||
STA_REC_HT,
|
||||
STA_REC_VHT,
|
||||
|
|
|
@ -2,14 +2,68 @@
|
|||
#include <linux/module.h>
|
||||
|
||||
#include "mt7615.h"
|
||||
#include "regs.h"
|
||||
#include "mac.h"
|
||||
#include "../trace.h"
|
||||
|
||||
const u32 mt7615e_reg_map[] = {
|
||||
[MT_TOP_CFG_BASE] = 0x01000,
|
||||
[MT_HW_BASE] = 0x01000,
|
||||
[MT_PCIE_REMAP_2] = 0x02504,
|
||||
[MT_ARB_BASE] = 0x20c00,
|
||||
[MT_HIF_BASE] = 0x04000,
|
||||
[MT_CSR_BASE] = 0x07000,
|
||||
[MT_PHY_BASE] = 0x10000,
|
||||
[MT_CFG_BASE] = 0x20200,
|
||||
[MT_AGG_BASE] = 0x20a00,
|
||||
[MT_TMAC_BASE] = 0x21000,
|
||||
[MT_RMAC_BASE] = 0x21200,
|
||||
[MT_DMA_BASE] = 0x21800,
|
||||
[MT_WTBL_BASE_ON] = 0x23000,
|
||||
[MT_WTBL_BASE_OFF] = 0x23400,
|
||||
[MT_LPON_BASE] = 0x24200,
|
||||
[MT_MIB_BASE] = 0x24800,
|
||||
[MT_WTBL_BASE_ADDR] = 0x30000,
|
||||
[MT_PCIE_REMAP_BASE2] = 0x80000,
|
||||
[MT_TOP_MISC_BASE] = 0xc0000,
|
||||
[MT_EFUSE_ADDR_BASE] = 0x81070000,
|
||||
};
|
||||
|
||||
const u32 mt7663e_reg_map[] = {
|
||||
[MT_TOP_CFG_BASE] = 0x01000,
|
||||
[MT_HW_BASE] = 0x02000,
|
||||
[MT_DMA_SHDL_BASE] = 0x06000,
|
||||
[MT_PCIE_REMAP_2] = 0x0700c,
|
||||
[MT_ARB_BASE] = 0x20c00,
|
||||
[MT_HIF_BASE] = 0x04000,
|
||||
[MT_CSR_BASE] = 0x07000,
|
||||
[MT_PHY_BASE] = 0x10000,
|
||||
[MT_CFG_BASE] = 0x20000,
|
||||
[MT_AGG_BASE] = 0x22000,
|
||||
[MT_TMAC_BASE] = 0x24000,
|
||||
[MT_RMAC_BASE] = 0x25000,
|
||||
[MT_DMA_BASE] = 0x27000,
|
||||
[MT_WTBL_BASE_ON] = 0x29000,
|
||||
[MT_WTBL_BASE_OFF] = 0x29800,
|
||||
[MT_LPON_BASE] = 0x2b000,
|
||||
[MT_MIB_BASE] = 0x2d000,
|
||||
[MT_WTBL_BASE_ADDR] = 0x30000,
|
||||
[MT_PCIE_REMAP_BASE2] = 0x90000,
|
||||
[MT_TOP_MISC_BASE] = 0xc0000,
|
||||
[MT_EFUSE_ADDR_BASE] = 0x78011000,
|
||||
};
|
||||
|
||||
u32 mt7615_reg_map(struct mt7615_dev *dev, u32 addr)
|
||||
{
|
||||
u32 base = addr & MT_MCU_PCIE_REMAP_2_BASE;
|
||||
u32 offset = addr & MT_MCU_PCIE_REMAP_2_OFFSET;
|
||||
u32 base, offset;
|
||||
|
||||
if (is_mt7663(&dev->mt76)) {
|
||||
base = addr & MT7663_MCU_PCIE_REMAP_2_BASE;
|
||||
offset = addr & MT7663_MCU_PCIE_REMAP_2_OFFSET;
|
||||
} else {
|
||||
base = addr & MT_MCU_PCIE_REMAP_2_BASE;
|
||||
offset = addr & MT_MCU_PCIE_REMAP_2_OFFSET;
|
||||
}
|
||||
mt76_wr(dev, MT_MCU_PCIE_REMAP_2, base);
|
||||
|
||||
return MT_PCIE_REMAP_BASE_2 + offset;
|
||||
|
@ -66,7 +120,8 @@ static irqreturn_t mt7615_irq_handler(int irq, void *dev_instance)
|
|||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base, int irq)
|
||||
int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base,
|
||||
int irq, const u32 *map)
|
||||
{
|
||||
static const struct mt76_driver_ops drv_ops = {
|
||||
/* txwi_size = txd size + txp size */
|
||||
|
@ -95,6 +150,7 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base, int irq)
|
|||
dev = container_of(mdev, struct mt7615_dev, mt76);
|
||||
mt76_mmio_init(&dev->mt76, mem_base);
|
||||
|
||||
dev->reg_map = map;
|
||||
mdev->rev = (mt76_rr(dev, MT_HW_CHIPID) << 16) |
|
||||
(mt76_rr(dev, MT_HW_REV) & 0xff);
|
||||
dev_dbg(mdev->dev, "ASIC revision: %04x\n", mdev->rev);
|
||||
|
@ -104,6 +160,9 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base, int irq)
|
|||
if (ret)
|
||||
goto error;
|
||||
|
||||
if (is_mt7663(mdev))
|
||||
mt76_wr(dev, MT_PCIE_IRQ_ENABLE, 1);
|
||||
|
||||
ret = mt7615_register_device(dev);
|
||||
if (ret)
|
||||
goto error;
|
||||
|
|
|
@ -38,6 +38,10 @@
|
|||
|
||||
#define MT7615_FIRMWARE_V1 1
|
||||
#define MT7615_FIRMWARE_V2 2
|
||||
#define MT7615_FIRMWARE_V3 3
|
||||
|
||||
#define MT7663_ROM_PATCH "mediatek/mt7663pr2h_v3.bin"
|
||||
#define MT7663_FIRMWARE_N9 "mediatek/mt7663_n9_v3.bin"
|
||||
|
||||
#define MT7615_EEPROM_SIZE 1024
|
||||
#define MT7615_TOKEN_SIZE 4096
|
||||
|
@ -144,6 +148,33 @@ struct mt7615_phy {
|
|||
struct mib_stats mib;
|
||||
};
|
||||
|
||||
#define mt7615_mcu_add_tx_ba(dev, ...) (dev)->mcu_ops->add_tx_ba((dev), __VA_ARGS__)
|
||||
#define mt7615_mcu_add_rx_ba(dev, ...) (dev)->mcu_ops->add_rx_ba((dev), __VA_ARGS__)
|
||||
#define mt7615_mcu_sta_add(dev, ...) (dev)->mcu_ops->sta_add((dev), __VA_ARGS__)
|
||||
#define mt7615_mcu_add_dev_info(dev, ...) (dev)->mcu_ops->add_dev_info((dev), __VA_ARGS__)
|
||||
#define mt7615_mcu_add_bss_info(dev, ...) (dev)->mcu_ops->add_bss_info((dev), __VA_ARGS__)
|
||||
#define mt7615_mcu_add_beacon(dev, ...) (dev)->mcu_ops->add_beacon_offload((dev), __VA_ARGS__)
|
||||
#define mt7615_mcu_set_pm(dev, ...) (dev)->mcu_ops->set_pm_state((dev), __VA_ARGS__)
|
||||
struct mt7615_mcu_ops {
|
||||
int (*add_tx_ba)(struct mt7615_dev *dev,
|
||||
struct ieee80211_ampdu_params *params,
|
||||
bool enable);
|
||||
int (*add_rx_ba)(struct mt7615_dev *dev,
|
||||
struct ieee80211_ampdu_params *params,
|
||||
bool enable);
|
||||
int (*sta_add)(struct mt7615_dev *dev,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_sta *sta, bool enable);
|
||||
int (*add_dev_info)(struct mt7615_dev *dev,
|
||||
struct ieee80211_vif *vif, bool enable);
|
||||
int (*add_bss_info)(struct mt7615_dev *dev, struct ieee80211_vif *vif,
|
||||
bool enable);
|
||||
int (*add_beacon_offload)(struct mt7615_dev *dev,
|
||||
struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif, bool enable);
|
||||
int (*set_pm_state)(struct mt7615_dev *dev, int band, int state);
|
||||
};
|
||||
|
||||
struct mt7615_dev {
|
||||
union { /* must be first */
|
||||
struct mt76_dev mt76;
|
||||
|
@ -156,7 +187,9 @@ struct mt7615_dev {
|
|||
|
||||
u16 chainmask;
|
||||
|
||||
const struct mt7615_mcu_ops *mcu_ops;
|
||||
struct regmap *infracfg;
|
||||
const u32 *reg_map;
|
||||
|
||||
struct work_struct mcu_work;
|
||||
|
||||
|
@ -257,6 +290,8 @@ mt7615_ext_phy(struct mt7615_dev *dev)
|
|||
}
|
||||
|
||||
extern const struct ieee80211_ops mt7615_ops;
|
||||
extern const u32 mt7615e_reg_map[__MT_BASE_MAX];
|
||||
extern const u32 mt7663e_reg_map[__MT_BASE_MAX];
|
||||
extern struct pci_driver mt7615_pci_driver;
|
||||
extern struct platform_driver mt7622_wmac_driver;
|
||||
|
||||
|
@ -269,9 +304,11 @@ static inline int mt7622_wmac_init(struct mt7615_dev *dev)
|
|||
}
|
||||
#endif
|
||||
|
||||
int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base, int irq);
|
||||
int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base,
|
||||
int irq, const u32 *map);
|
||||
u32 mt7615_reg_map(struct mt7615_dev *dev, u32 addr);
|
||||
|
||||
void mt7615_init_device(struct mt7615_dev *dev);
|
||||
int mt7615_register_device(struct mt7615_dev *dev);
|
||||
void mt7615_unregister_device(struct mt7615_dev *dev);
|
||||
int mt7615_register_ext_phy(struct mt7615_dev *dev);
|
||||
|
@ -284,29 +321,13 @@ int mt7615_dma_init(struct mt7615_dev *dev);
|
|||
void mt7615_dma_cleanup(struct mt7615_dev *dev);
|
||||
int mt7615_mcu_init(struct mt7615_dev *dev);
|
||||
bool mt7615_wait_for_mcu_init(struct mt7615_dev *dev);
|
||||
int mt7615_mcu_set_dev_info(struct mt7615_dev *dev,
|
||||
struct ieee80211_vif *vif, bool enable);
|
||||
int mt7615_mcu_set_bss_info(struct mt7615_dev *dev, struct ieee80211_vif *vif,
|
||||
int en);
|
||||
void mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta,
|
||||
struct ieee80211_tx_rate *probe_rate,
|
||||
struct ieee80211_tx_rate *rates);
|
||||
int mt7615_mcu_del_wtbl_all(struct mt7615_dev *dev);
|
||||
int mt7615_mcu_set_bmc(struct mt7615_dev *dev, struct ieee80211_vif *vif,
|
||||
bool en);
|
||||
int mt7615_mcu_set_sta(struct mt7615_dev *dev, struct ieee80211_vif *vif,
|
||||
struct ieee80211_sta *sta, bool en);
|
||||
int mt7615_mcu_set_bcn(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
int en);
|
||||
int mt7615_mcu_set_chan_info(struct mt7615_phy *phy, int cmd);
|
||||
int mt7615_mcu_set_wmm(struct mt7615_dev *dev, u8 queue,
|
||||
const struct ieee80211_tx_queue_params *params);
|
||||
int mt7615_mcu_set_tx_ba(struct mt7615_dev *dev,
|
||||
struct ieee80211_ampdu_params *params,
|
||||
bool add);
|
||||
int mt7615_mcu_set_rx_ba(struct mt7615_dev *dev,
|
||||
struct ieee80211_ampdu_params *params,
|
||||
bool add);
|
||||
void mt7615_mcu_rx_event(struct mt7615_dev *dev, struct sk_buff *skb);
|
||||
int mt7615_mcu_rdd_cmd(struct mt7615_dev *dev,
|
||||
enum mt7615_rdd_cmd cmd, u8 index,
|
||||
|
@ -327,6 +348,11 @@ static inline bool is_mt7615(struct mt76_dev *dev)
|
|||
return mt76_chip(dev) == 0x7615;
|
||||
}
|
||||
|
||||
static inline bool is_mt7663(struct mt76_dev *dev)
|
||||
{
|
||||
return mt76_chip(dev) == 0x7663;
|
||||
}
|
||||
|
||||
static inline void mt7615_irq_enable(struct mt7615_dev *dev, u32 mask)
|
||||
{
|
||||
mt76_set_irq_mask(&dev->mt76, MT_INT_MASK_CSR, 0, mask);
|
||||
|
@ -347,7 +373,7 @@ void mt7615_mac_sta_poll(struct mt7615_dev *dev);
|
|||
int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
|
||||
struct sk_buff *skb, struct mt76_wcid *wcid,
|
||||
struct ieee80211_sta *sta, int pid,
|
||||
struct ieee80211_key_conf *key);
|
||||
struct ieee80211_key_conf *key, bool beacon);
|
||||
void mt7615_mac_set_timing(struct mt7615_phy *phy);
|
||||
int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb);
|
||||
void mt7615_mac_add_txs(struct mt7615_dev *dev, void *data);
|
||||
|
@ -361,9 +387,10 @@ int mt7615_mcu_set_dbdc(struct mt7615_dev *dev);
|
|||
int mt7615_mcu_set_eeprom(struct mt7615_dev *dev);
|
||||
int mt7615_mcu_set_mac_enable(struct mt7615_dev *dev, int band, bool enable);
|
||||
int mt7615_mcu_set_rts_thresh(struct mt7615_phy *phy, u32 val);
|
||||
int mt7615_mcu_ctrl_pm_state(struct mt7615_dev *dev, int band, int enter);
|
||||
int mt7615_mcu_get_temperature(struct mt7615_dev *dev, int index);
|
||||
void mt7615_mcu_exit(struct mt7615_dev *dev);
|
||||
void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb,
|
||||
int cmd, int *wait_seq);
|
||||
|
||||
int mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
|
||||
enum mt76_txq_id qid, struct mt76_wcid *wcid,
|
||||
|
|
|
@ -13,12 +13,14 @@
|
|||
|
||||
static const struct pci_device_id mt7615_pci_device_table[] = {
|
||||
{ PCI_DEVICE(0x14c3, 0x7615) },
|
||||
{ PCI_DEVICE(0x14c3, 0x7663) },
|
||||
{ },
|
||||
};
|
||||
|
||||
static int mt7615_pci_probe(struct pci_dev *pdev,
|
||||
const struct pci_device_id *id)
|
||||
{
|
||||
const u32 *map;
|
||||
int ret;
|
||||
|
||||
ret = pcim_enable_device(pdev);
|
||||
|
@ -35,7 +37,9 @@ static int mt7615_pci_probe(struct pci_dev *pdev,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
return mt7615_mmio_probe(&pdev->dev, pcim_iomap_table(pdev)[0], pdev->irq);
|
||||
map = id->device == 0x7663 ? mt7663e_reg_map : mt7615e_reg_map;
|
||||
return mt7615_mmio_probe(&pdev->dev, pcim_iomap_table(pdev)[0],
|
||||
pdev->irq, map);
|
||||
}
|
||||
|
||||
static void mt7615_pci_remove(struct pci_dev *pdev)
|
||||
|
@ -57,3 +61,5 @@ MODULE_DEVICE_TABLE(pci, mt7615_pci_device_table);
|
|||
MODULE_FIRMWARE(MT7615_FIRMWARE_CR4);
|
||||
MODULE_FIRMWARE(MT7615_FIRMWARE_N9);
|
||||
MODULE_FIRMWARE(MT7615_ROM_PATCH);
|
||||
MODULE_FIRMWARE(MT7663_FIRMWARE_N9);
|
||||
MODULE_FIRMWARE(MT7663_ROM_PATCH);
|
||||
|
|
|
@ -4,17 +4,46 @@
|
|||
#ifndef __MT7615_REGS_H
|
||||
#define __MT7615_REGS_H
|
||||
|
||||
#define MT_HW_REV 0x1000
|
||||
#define MT_HW_CHIPID 0x1008
|
||||
#define MT_TOP_STRAP_STA 0x1010
|
||||
enum mt7615_reg_base {
|
||||
MT_TOP_CFG_BASE,
|
||||
MT_HW_BASE,
|
||||
MT_DMA_SHDL_BASE,
|
||||
MT_PCIE_REMAP_2,
|
||||
MT_ARB_BASE,
|
||||
MT_HIF_BASE,
|
||||
MT_CSR_BASE,
|
||||
MT_PHY_BASE,
|
||||
MT_CFG_BASE,
|
||||
MT_AGG_BASE,
|
||||
MT_TMAC_BASE,
|
||||
MT_RMAC_BASE,
|
||||
MT_DMA_BASE,
|
||||
MT_WTBL_BASE_ON,
|
||||
MT_WTBL_BASE_OFF,
|
||||
MT_LPON_BASE,
|
||||
MT_MIB_BASE,
|
||||
MT_WTBL_BASE_ADDR,
|
||||
MT_PCIE_REMAP_BASE2,
|
||||
MT_TOP_MISC_BASE,
|
||||
MT_EFUSE_ADDR_BASE,
|
||||
__MT_BASE_MAX,
|
||||
};
|
||||
|
||||
#define MT_HW_INFO_BASE ((dev)->reg_map[MT_HW_BASE])
|
||||
#define MT_HW_INFO(ofs) (MT_HW_INFO_BASE + (ofs))
|
||||
#define MT_HW_REV MT_HW_INFO(0x000)
|
||||
#define MT_HW_CHIPID MT_HW_INFO(0x008)
|
||||
#define MT_TOP_STRAP_STA MT_HW_INFO(0x010)
|
||||
#define MT_TOP_3NSS BIT(24)
|
||||
|
||||
#define MT_TOP_OFF_RSV 0x1128
|
||||
#define MT_TOP_OFF_RSV_FW_STATE GENMASK(18, 16)
|
||||
|
||||
#define MT_TOP_MISC2 0x1134
|
||||
#define MT_TOP_MISC2 ((dev)->reg_map[MT_TOP_CFG_BASE] + 0x134)
|
||||
#define MT_TOP_MISC2_FW_STATE GENMASK(2, 0)
|
||||
|
||||
#define MT7663_TOP_MISC2_FW_STATE GENMASK(3, 1)
|
||||
|
||||
#define MT_MCU_BASE 0x2000
|
||||
#define MT_MCU(ofs) (MT_MCU_BASE + (ofs))
|
||||
|
||||
|
@ -23,13 +52,19 @@
|
|||
#define MT_MCU_PCIE_REMAP_1_BASE GENMASK(31, 18)
|
||||
#define MT_PCIE_REMAP_BASE_1 0x40000
|
||||
|
||||
#define MT_MCU_PCIE_REMAP_2 MT_MCU(0x504)
|
||||
#define MT_MCU_PCIE_REMAP_2 ((dev)->reg_map[MT_PCIE_REMAP_2])
|
||||
#define MT_MCU_PCIE_REMAP_2_OFFSET GENMASK(18, 0)
|
||||
#define MT_MCU_PCIE_REMAP_2_BASE GENMASK(31, 19)
|
||||
#define MT_PCIE_REMAP_BASE_2 0x80000
|
||||
#define MT_PCIE_REMAP_BASE_2 ((dev)->reg_map[MT_PCIE_REMAP_BASE2])
|
||||
|
||||
#define MT_HIF_BASE 0x4000
|
||||
#define MT_HIF(ofs) (MT_HIF_BASE + (ofs))
|
||||
#define MT_HIF(ofs) ((dev)->reg_map[MT_HIF_BASE] + (ofs))
|
||||
|
||||
#define MT7663_MCU_PCIE_REMAP_2_OFFSET GENMASK(15, 0)
|
||||
#define MT7663_MCU_PCIE_REMAP_2_BASE GENMASK(31, 16)
|
||||
|
||||
#define MT_HIF2_BASE 0xf0000
|
||||
#define MT_HIF2(ofs) (MT_HIF2_BASE + (ofs))
|
||||
#define MT_PCIE_IRQ_ENABLE MT_HIF2(0x188)
|
||||
|
||||
#define MT_CFG_LPCR_HOST MT_HIF(0x1f0)
|
||||
#define MT_CFG_LPCR_HOST_FW_OWN BIT(0)
|
||||
|
@ -95,6 +130,9 @@
|
|||
#define MT_WPDMA_ABT_CFG MT_HIF(0x530)
|
||||
#define MT_WPDMA_ABT_CFG1 MT_HIF(0x534)
|
||||
|
||||
#define MT_CSR(ofs) ((dev)->reg_map[MT_CSR_BASE] + (ofs))
|
||||
#define MT_CONN_HIF_ON_LPCTL MT_CSR(0x000)
|
||||
|
||||
#define MT_PLE_BASE 0x8000
|
||||
#define MT_PLE(ofs) (MT_PLE_BASE + (ofs))
|
||||
|
||||
|
@ -106,7 +144,7 @@
|
|||
#define MT_PLE_AC_QEMPTY(ac, n) MT_PLE(0x300 + 0x10 * (ac) + \
|
||||
((n) << 2))
|
||||
|
||||
#define MT_WF_PHY_BASE 0x10000
|
||||
#define MT_WF_PHY_BASE ((dev)->reg_map[MT_PHY_BASE])
|
||||
#define MT_WF_PHY(ofs) (MT_WF_PHY_BASE + (ofs))
|
||||
|
||||
#define MT_WF_PHY_WF2_RFCTRL0(n) MT_WF_PHY(0x1900 + (n) * 0x400)
|
||||
|
@ -139,7 +177,7 @@
|
|||
#define MT_WF_PHY_RXTD2_BASE MT_WF_PHY(0x2a00)
|
||||
#define MT_WF_PHY_RXTD2(_n) (MT_WF_PHY_RXTD2_BASE + ((_n) << 2))
|
||||
|
||||
#define MT_WF_CFG_BASE 0x20200
|
||||
#define MT_WF_CFG_BASE ((dev)->reg_map[MT_CFG_BASE])
|
||||
#define MT_WF_CFG(ofs) (MT_WF_CFG_BASE + (ofs))
|
||||
|
||||
#define MT_CFG_CCR MT_WF_CFG(0x000)
|
||||
|
@ -148,7 +186,7 @@
|
|||
#define MT_CFG_CCR_MAC_D1_2X_GC_EN BIT(30)
|
||||
#define MT_CFG_CCR_MAC_D0_2X_GC_EN BIT(31)
|
||||
|
||||
#define MT_WF_AGG_BASE 0x20a00
|
||||
#define MT_WF_AGG_BASE ((dev)->reg_map[MT_AGG_BASE])
|
||||
#define MT_WF_AGG(ofs) (MT_WF_AGG_BASE + (ofs))
|
||||
|
||||
#define MT_AGG_ARCR MT_WF_AGG(0x010)
|
||||
|
@ -179,7 +217,7 @@
|
|||
#define MT_AGG_SCR MT_WF_AGG(0x0fc)
|
||||
#define MT_AGG_SCR_NLNAV_MID_PTEC_DIS BIT(3)
|
||||
|
||||
#define MT_WF_ARB_BASE 0x20c00
|
||||
#define MT_WF_ARB_BASE ((dev)->reg_map[MT_ARB_BASE])
|
||||
#define MT_WF_ARB(ofs) (MT_WF_ARB_BASE + (ofs))
|
||||
|
||||
#define MT_ARB_SCR MT_WF_ARB(0x080)
|
||||
|
@ -188,7 +226,7 @@
|
|||
#define MT_ARB_SCR_TX1_DISABLE BIT(10)
|
||||
#define MT_ARB_SCR_RX1_DISABLE BIT(11)
|
||||
|
||||
#define MT_WF_TMAC_BASE 0x21000
|
||||
#define MT_WF_TMAC_BASE ((dev)->reg_map[MT_TMAC_BASE])
|
||||
#define MT_WF_TMAC(ofs) (MT_WF_TMAC_BASE + (ofs))
|
||||
|
||||
#define MT_TMAC_CDTR MT_WF_TMAC(0x090)
|
||||
|
@ -212,7 +250,7 @@
|
|||
#define MT_TMAC_CTCR0_INS_DDLMT_EN BIT(17)
|
||||
#define MT_TMAC_CTCR0_INS_DDLMT_VHT_SMPDU_EN BIT(18)
|
||||
|
||||
#define MT_WF_RMAC_BASE 0x21200
|
||||
#define MT_WF_RMAC_BASE ((dev)->reg_map[MT_RMAC_BASE])
|
||||
#define MT_WF_RMAC(ofs) (MT_WF_RMAC_BASE + (ofs))
|
||||
|
||||
#define MT_WF_RFCR(_band) MT_WF_RMAC((_band) ? 0x100 : 0x000)
|
||||
|
@ -257,7 +295,7 @@
|
|||
#define MT_WF_RMAC_MIB_TIME6 MT_WF_RMAC(0x03dc)
|
||||
#define MT_MIB_OBSSTIME_MASK GENMASK(23, 0)
|
||||
|
||||
#define MT_WF_DMA_BASE 0x21800
|
||||
#define MT_WF_DMA_BASE ((dev)->reg_map[MT_DMA_BASE])
|
||||
#define MT_WF_DMA(ofs) (MT_WF_DMA_BASE + (ofs))
|
||||
|
||||
#define MT_DMA_DCR0 MT_WF_DMA(0x000)
|
||||
|
@ -272,10 +310,10 @@
|
|||
#define MT_DMA_RCFR0_RX_DROPPED_UCAST GENMASK(25, 24)
|
||||
#define MT_DMA_RCFR0_RX_DROPPED_MCAST GENMASK(27, 26)
|
||||
|
||||
#define MT_WTBL_BASE 0x30000
|
||||
#define MT_WTBL_BASE(dev) ((dev)->reg_map[MT_WTBL_BASE_ADDR])
|
||||
#define MT_WTBL_ENTRY_SIZE 256
|
||||
|
||||
#define MT_WTBL_OFF_BASE 0x23400
|
||||
#define MT_WTBL_OFF_BASE ((dev)->reg_map[MT_WTBL_BASE_OFF])
|
||||
#define MT_WTBL_OFF(n) (MT_WTBL_OFF_BASE + (n))
|
||||
|
||||
#define MT_WTBL_W0_KEY_IDX GENMASK(24, 23)
|
||||
|
@ -292,7 +330,11 @@
|
|||
#define MT_WTBL_UPDATE_TX_COUNT_CLEAR BIT(14)
|
||||
#define MT_WTBL_UPDATE_BUSY BIT(31)
|
||||
|
||||
#define MT_WTBL_ON_BASE 0x23000
|
||||
#define MT_TOP_MISC(ofs) ((dev)->reg_map[MT_TOP_MISC_BASE] + (ofs))
|
||||
#define MT_CONN_ON_MISC MT_TOP_MISC(0x1140)
|
||||
#define MT_TOP_MISC2_FW_N9_RDY BIT(2)
|
||||
|
||||
#define MT_WTBL_ON_BASE ((dev)->reg_map[MT_WTBL_BASE_ON])
|
||||
#define MT_WTBL_ON(_n) (MT_WTBL_ON_BASE + (_n))
|
||||
|
||||
#define MT_WTBL_RICR0 MT_WTBL_ON(0x010)
|
||||
|
@ -328,8 +370,7 @@
|
|||
|
||||
#define MT_WTBL_W27_CC_BW_SEL GENMASK(6, 5)
|
||||
|
||||
#define MT_LPON_BASE 0x24200
|
||||
#define MT_LPON(_n) (MT_LPON_BASE + (_n))
|
||||
#define MT_LPON(_n) ((dev)->reg_map[MT_LPON_BASE] + (_n))
|
||||
|
||||
#define MT_LPON_T0CR MT_LPON(0x010)
|
||||
#define MT_LPON_T0CR_MODE GENMASK(1, 0)
|
||||
|
@ -337,7 +378,7 @@
|
|||
#define MT_LPON_UTTR0 MT_LPON(0x018)
|
||||
#define MT_LPON_UTTR1 MT_LPON(0x01c)
|
||||
|
||||
#define MT_WF_MIB_BASE 0x24800
|
||||
#define MT_WF_MIB_BASE (dev->reg_map[MT_MIB_BASE])
|
||||
#define MT_WF_MIB(ofs) (MT_WF_MIB_BASE + (ofs))
|
||||
|
||||
#define MT_MIB_M0_MISC_CR MT_WF_MIB(0x00c)
|
||||
|
@ -367,6 +408,8 @@
|
|||
|
||||
#define MT_TX_AGG_CNT(n) MT_WF_MIB(0xa8 + ((n) << 2))
|
||||
|
||||
#define MT_DMA_SHDL(ofs) (dev->reg_map[MT_DMA_SHDL_BASE] + (ofs))
|
||||
|
||||
#define MT_DMASHDL_BASE 0x5000a000
|
||||
#define MT_DMASHDL_OPTIONAL 0x008
|
||||
#define MT_DMASHDL_PAGE 0x00c
|
||||
|
@ -406,7 +449,7 @@
|
|||
#define MT_LED_STATUS_ON GENMASK(23, 16)
|
||||
#define MT_LED_STATUS_DURATION GENMASK(15, 0)
|
||||
|
||||
#define MT_EFUSE_BASE 0x81070000
|
||||
#define MT_EFUSE_BASE ((dev)->reg_map[MT_EFUSE_ADDR_BASE])
|
||||
#define MT_EFUSE_BASE_CTRL 0x000
|
||||
#define MT_EFUSE_BASE_CTRL_EMPTY BIT(30)
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ static int mt7622_wmac_probe(struct platform_device *pdev)
|
|||
return PTR_ERR(mem_base);
|
||||
}
|
||||
|
||||
return mt7615_mmio_probe(&pdev->dev, mem_base, irq);
|
||||
return mt7615_mmio_probe(&pdev->dev, mem_base, irq, mt7615e_reg_map);
|
||||
}
|
||||
|
||||
static int mt7622_wmac_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -1155,7 +1155,6 @@ static void mt76x0_rf_patch_reg_array(struct mt76x02_dev *dev,
|
|||
static void mt76x0_phy_rf_init(struct mt76x02_dev *dev)
|
||||
{
|
||||
int i;
|
||||
u8 val;
|
||||
|
||||
mt76x0_rf_patch_reg_array(dev, mt76x0_rf_central_tab,
|
||||
ARRAY_SIZE(mt76x0_rf_central_tab));
|
||||
|
@ -1188,7 +1187,7 @@ static void mt76x0_phy_rf_init(struct mt76x02_dev *dev)
|
|||
*/
|
||||
mt76x0_rf_wr(dev, MT_RF(0, 22),
|
||||
min_t(u8, dev->cal.rx.freq_offset, 0xbf));
|
||||
val = mt76x0_rf_rr(dev, MT_RF(0, 22));
|
||||
mt76x0_rf_rr(dev, MT_RF(0, 22));
|
||||
|
||||
/* Reset procedure DAC during power-up:
|
||||
* - set B0.R73<7>
|
||||
|
|
|
@ -461,6 +461,7 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev)
|
|||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
|
||||
dev->mcu_timeout = 0;
|
||||
if (restart)
|
||||
mt76x02_reset_state(dev);
|
||||
|
||||
|
@ -544,10 +545,6 @@ static void mt76x02_check_tx_hang(struct mt76x02_dev *dev)
|
|||
restart:
|
||||
mt76x02_watchdog_reset(dev);
|
||||
|
||||
mutex_lock(&dev->mt76.mcu.mutex);
|
||||
dev->mcu_timeout = 0;
|
||||
mutex_unlock(&dev->mt76.mcu.mutex);
|
||||
|
||||
dev->tx_hang_reset++;
|
||||
dev->tx_hang_check = 0;
|
||||
memset(dev->mt76.tx_dma_idx, 0xff,
|
||||
|
|
|
@ -70,10 +70,10 @@ static u32 ___mt76u_rr(struct mt76_dev *dev, u8 req, u32 addr)
|
|||
|
||||
ret = __mt76u_vendor_request(dev, req,
|
||||
USB_DIR_IN | USB_TYPE_VENDOR,
|
||||
addr >> 16, addr, &usb->reg_val,
|
||||
addr >> 16, addr, usb->data,
|
||||
sizeof(__le32));
|
||||
if (ret == sizeof(__le32))
|
||||
data = le32_to_cpu(usb->reg_val);
|
||||
data = get_unaligned_le32(usb->data);
|
||||
trace_usb_reg_rr(dev, addr, data);
|
||||
|
||||
return data;
|
||||
|
@ -125,10 +125,10 @@ static void ___mt76u_wr(struct mt76_dev *dev, u8 req,
|
|||
{
|
||||
struct mt76_usb *usb = &dev->usb;
|
||||
|
||||
usb->reg_val = cpu_to_le32(val);
|
||||
put_unaligned_le32(val, usb->data);
|
||||
__mt76u_vendor_request(dev, req,
|
||||
USB_DIR_OUT | USB_TYPE_VENDOR,
|
||||
addr >> 16, addr, &usb->reg_val,
|
||||
addr >> 16, addr, usb->data,
|
||||
sizeof(__le32));
|
||||
trace_usb_reg_wr(dev, addr, val);
|
||||
}
|
||||
|
@ -672,10 +672,17 @@ mt76u_process_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
|
|||
static void mt76u_rx_tasklet(unsigned long data)
|
||||
{
|
||||
struct mt76_dev *dev = (struct mt76_dev *)data;
|
||||
struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
|
||||
struct mt76_queue *q;
|
||||
int i;
|
||||
|
||||
rcu_read_lock();
|
||||
mt76u_process_rx_queue(dev, q);
|
||||
for (i = 0; i < __MT_RXQ_MAX; i++) {
|
||||
q = &dev->q_rx[i];
|
||||
if (!q->ndesc)
|
||||
continue;
|
||||
|
||||
mt76u_process_rx_queue(dev, q);
|
||||
}
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
|
@ -1150,6 +1157,7 @@ int mt76u_init(struct mt76_dev *dev,
|
|||
};
|
||||
struct usb_device *udev = interface_to_usbdev(intf);
|
||||
struct mt76_usb *usb = &dev->usb;
|
||||
int err = -ENOMEM;
|
||||
|
||||
mt76u_ops.rr = ext ? mt76u_rr_ext : mt76u_rr;
|
||||
mt76u_ops.wr = ext ? mt76u_wr_ext : mt76u_wr;
|
||||
|
@ -1169,10 +1177,8 @@ int mt76u_init(struct mt76_dev *dev,
|
|||
usb->data_len = 32;
|
||||
|
||||
usb->data = devm_kmalloc(dev->dev, usb->data_len, GFP_KERNEL);
|
||||
if (!usb->data) {
|
||||
mt76u_deinit(dev);
|
||||
return -ENOMEM;
|
||||
}
|
||||
if (!usb->data)
|
||||
goto error;
|
||||
|
||||
mutex_init(&usb->usb_ctrl_mtx);
|
||||
dev->bus = &mt76u_ops;
|
||||
|
@ -1182,7 +1188,15 @@ int mt76u_init(struct mt76_dev *dev,
|
|||
|
||||
usb->sg_en = mt76u_check_sg(dev);
|
||||
|
||||
return mt76u_set_endpoints(intf, usb);
|
||||
err = mt76u_set_endpoints(intf, usb);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
mt76u_deinit(dev);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76u_init);
|
||||
|
||||
|
|
Loading…
Reference in New Issue