Commit d4bf77bd authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

mt76: mt7615: introduce mt7663u support to mt7615_write_txwi



Extend mt7615_write_txwi routine to support usb txwi configuration

Co-developed-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent bb31a80e
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -528,11 +528,12 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
	struct ieee80211_vif *vif = info->control.vif;
	struct mt76_phy *mphy = &dev->mphy;
	bool ext_phy = info->hw_queue & MT_TX_HW_QUEUE_EXT_PHY;
	bool is_usb = mt76_is_usb(&dev->mt76);
	int tx_count = 8;
	u8 fc_type, fc_stype, p_fmt, q_idx, omac_idx = 0, wmm_idx = 0;
	__le16 fc = hdr->frame_control;
	u32 val, sz_txd = is_usb ? MT_USB_TXD_SIZE : MT_TXD_SIZE;
	u16 seqno = 0;
	u32 val;

	if (vif) {
		struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
@@ -556,7 +557,7 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
	if (ieee80211_is_data(fc) || ieee80211_is_bufferable_mmpdu(fc)) {
		q_idx = wmm_idx * MT7615_MAX_WMM_SETS +
			skb_get_queue_mapping(skb);
		p_fmt = MT_TX_TYPE_CT;
		p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT;
	} else if (beacon) {
		if (ext_phy)
			q_idx = MT_LMAC_BCN1;
@@ -568,10 +569,10 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
			q_idx = MT_LMAC_ALTX1;
		else
			q_idx = MT_LMAC_ALTX0;
		p_fmt = MT_TX_TYPE_CT;
		p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT;
	}

	val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len + MT_TXD_SIZE) |
	val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len + sz_txd) |
	      FIELD_PREP(MT_TXD0_P_IDX, MT_TX_PORT_IDX_LMAC) |
	      FIELD_PREP(MT_TXD0_Q_IDX, q_idx);
	txwi[0] = cpu_to_le32(val);
@@ -665,6 +666,9 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,

	txwi[7] = FIELD_PREP(MT_TXD7_TYPE, fc_type) |
		  FIELD_PREP(MT_TXD7_SUB_TYPE, fc_stype);
	if (is_usb)
		txwi[8] = FIELD_PREP(MT_TXD8_L_TYPE, fc_type) |
			  FIELD_PREP(MT_TXD8_L_SUB_TYPE, fc_stype);

	return 0;
}
+1 −0
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@ enum tx_phy_bandwidth {
#define MT_CT_INFO_NONE_CIPHER_FRAME	BIT(3)
#define MT_CT_INFO_HSR2_TX		BIT(4)

#define MT_USB_TXD_SIZE			(MT_TXD_SIZE + 8 * 4)
#define MT_TXD_SIZE			(8 * 4)

#define MT_TXD0_P_IDX			BIT(31)