wifi: mt76: introduce wed pointer in mt76_queue
[linux-2.6-microblaze.git] / drivers / net / wireless / mediatek / mt76 / mt76.h
index ea828ba..afcc98d 100644 (file)
@@ -199,6 +199,7 @@ struct mt76_queue {
        u8 hw_idx;
        u8 flags;
 
+       struct mtk_wed_device *wed;
        u32 wed_regs;
 
        dma_addr_t desc_dma;
@@ -1047,6 +1048,12 @@ bool ____mt76_poll_msec(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,
 void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs);
 void mt76_pci_disable_aspm(struct pci_dev *pdev);
 
+#ifdef CONFIG_NET_MEDIATEK_SOC_WED
+int mt76_net_setup_tc(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+                     struct net_device *netdev, enum tc_setup_type type,
+                     void *type_data);
+#endif /*CONFIG_NET_MEDIATEK_SOC_WED */
+
 static inline u16 mt76_chip(struct mt76_dev *dev)
 {
        return dev->rev >> 16;
@@ -1057,6 +1064,13 @@ static inline u16 mt76_rev(struct mt76_dev *dev)
        return dev->rev & 0xffff;
 }
 
+#ifdef CONFIG_NET_MEDIATEK_SOC_WED
+u32 mt76_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size);
+void mt76_mmio_wed_release_rx_buf(struct mtk_wed_device *wed);
+int mt76_mmio_wed_offload_enable(struct mtk_wed_device *wed);
+void mt76_mmio_wed_offload_disable(struct mtk_wed_device *wed);
+#endif /*CONFIG_NET_MEDIATEK_SOC_WED */
+
 #define mt76xx_chip(dev) mt76_chip(&((dev)->mt76))
 #define mt76xx_rev(dev) mt76_rev(&((dev)->mt76))
 
@@ -1102,19 +1116,22 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str,
 
 int mt76_eeprom_init(struct mt76_dev *dev, int len);
 void mt76_eeprom_override(struct mt76_phy *phy);
-int mt76_get_of_eeprom(struct mt76_dev *dev, void *data, int offset, int len);
+int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int len);
+int mt76_get_of_data_from_nvmem(struct mt76_dev *dev, void *eep,
+                               const char *cell_name, int len);
 
 struct mt76_queue *
 mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc,
-               int ring_base, u32 flags);
+               int ring_base, void *wed, u32 flags);
 u16 mt76_calculate_default_rate(struct mt76_phy *phy,
                                struct ieee80211_vif *vif, int rateidx);
 static inline int mt76_init_tx_queue(struct mt76_phy *phy, int qid, int idx,
-                                    int n_desc, int ring_base, u32 flags)
+                                    int n_desc, int ring_base, void *wed,
+                                    u32 flags)
 {
        struct mt76_queue *q;
 
-       q = mt76_init_queue(phy->dev, qid, idx, n_desc, ring_base, flags);
+       q = mt76_init_queue(phy->dev, qid, idx, n_desc, ring_base, wed, flags);
        if (IS_ERR(q))
                return PTR_ERR(q);
 
@@ -1128,7 +1145,7 @@ static inline int mt76_init_mcu_queue(struct mt76_dev *dev, int qid, int idx,
 {
        struct mt76_queue *q;
 
-       q = mt76_init_queue(dev, qid, idx, n_desc, ring_base, 0);
+       q = mt76_init_queue(dev, qid, idx, n_desc, ring_base, NULL, 0);
        if (IS_ERR(q))
                return PTR_ERR(q);
 
@@ -1547,6 +1564,12 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
                              struct mt76_power_limits *dest,
                              s8 target_power);
 
+static inline bool mt76_queue_is_wed_tx_free(struct mt76_queue *q)
+{
+       return (q->flags & MT_QFLAG_WED) &&
+              FIELD_GET(MT_QFLAG_WED_TYPE, q->flags) == MT76_WED_Q_TXFREE;
+}
+
 static inline bool mt76_queue_is_wed_rx(struct mt76_queue *q)
 {
        return (q->flags & MT_QFLAG_WED) &&