summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt792x.h
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2023-09-21 12:23:47 +0200
committerFelix Fietkau <nbd@nbd.name>2023-09-30 20:17:18 +0200
commit4d2cb56afaf7a96f04bab4c03506e4f5ad8f03db (patch)
treec0e41e5e78382c2da08df660cb76e5f5399d0eff /drivers/net/wireless/mediatek/mt76/mt792x.h
parentwifi: mt76: mt7915 add tc offloading support (diff)
downloadlinux-4d2cb56afaf7a96f04bab4c03506e4f5ad8f03db.tar.xz
linux-4d2cb56afaf7a96f04bab4c03506e4f5ad8f03db.zip
wifi: mt76: mt792x: move mt7921_skb_add_usb_sdio_hdr in mt792x module
Since mt7921_skb_add_usb_sdio_hdr is shared between mt7925 and mt7921 drivers, move it in mt792x module. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt792x.h')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt792x.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h
index 548e89fad4d9..fd1614e4926b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x.h
+++ b/drivers/net/wireless/mediatek/mt76/mt792x.h
@@ -42,6 +42,9 @@
#define MT7922_ROM_PATCH "mediatek/WIFI_MT7922_patch_mcu_1_1_hdr.bin"
#define MT7925_ROM_PATCH "mediatek/mt7925/WIFI_MT7925_PATCH_MCU_1_1_hdr.bin"
+#define MT792x_SDIO_HDR_TX_BYTES GENMASK(15, 0)
+#define MT792x_SDIO_HDR_PKT_TYPE GENMASK(17, 16)
+
struct mt792x_vif;
struct mt792x_sta;
@@ -343,6 +346,19 @@ u32 mt792xu_rmw(struct mt76_dev *dev, u32 addr, u32 mask, u32 val);
void mt792xu_copy(struct mt76_dev *dev, u32 offset, const void *data, int len);
void mt792xu_disconnect(struct usb_interface *usb_intf);
+static inline void
+mt792x_skb_add_usb_sdio_hdr(struct mt792x_dev *dev, struct sk_buff *skb,
+ int type)
+{
+ u32 hdr, len;
+
+ len = mt76_is_usb(&dev->mt76) ? skb->len : skb->len + sizeof(hdr);
+ hdr = FIELD_PREP(MT792x_SDIO_HDR_TX_BYTES, len) |
+ FIELD_PREP(MT792x_SDIO_HDR_PKT_TYPE, type);
+
+ put_unaligned_le32(hdr, skb_push(skb, sizeof(hdr)));
+}
+
int __mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev);
int mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev);
int mt792xe_mcu_fw_pmctrl(struct mt792x_dev *dev);