blob: f2fa3fc9c14ed0153744911737f2639b27265bb3 [file] [log] [blame]
developerd4e2b9d2022-12-15 16:48:11 +08001From 1430e7a7a3d5ae7693d6fa8e795524ee4c78c0ef Mon Sep 17 00:00:00 2001
2From: Shayne Chen <shayne.chen@mediatek.com>
3Date: Mon, 7 Nov 2022 23:05:51 +0800
4Subject: [PATCH] mt76: add internal wed_tiny header file
5
6To prevent build fail of WED related parts.
7
8Change-Id: I907cae30e0775337a0c670010b450be15b510e18
9---
10 mt76.h | 4 ++++
11 wed_tiny.h | 31 +++++++++++++++++++++++++++++++
12 2 files changed, 35 insertions(+)
13 create mode 100644 wed_tiny.h
14
15diff --git a/mt76.h b/mt76.h
16index a3cf0d95..5edb986b 100755
17--- a/mt76.h
18+++ b/mt76.h
19@@ -13,7 +13,11 @@
20 #include <linux/leds.h>
21 #include <linux/usb.h>
22 #include <linux/average.h>
23+#ifdef CONFIG_NET_MEDIATEK_SOC_WED
24 #include <linux/soc/mediatek/mtk_wed.h>
25+#else
26+#include "wed_tiny.h"
27+#endif
28 #include <net/mac80211.h>
29 #include "util.h"
30 #include "testmode.h"
31diff --git a/wed_tiny.h b/wed_tiny.h
32new file mode 100644
33index 00000000..91c98e7d
34--- /dev/null
35+++ b/wed_tiny.h
36@@ -0,0 +1,110 @@
37+#ifndef __WED_TINY_H
38+#define __WED_TINY_H
39+
40+#include <linux/pci.h>
41+
42+#define MTK_WED_TX_QUEUES 2
43+#define MTK_WED_RX_QUEUES 2
44+
45+struct mtk_wed_device {
46+ const struct mtk_wed_ops *ops;
47+ struct device *dev;
48+ struct mtk_wed_hw *hw;
49+ bool init_done, running;
50+ int wdma_idx;
51+ int irq;
52+ u8 ver;
53+ u32 rev_id;
54+
55+ struct {
56+ int size;
57+ struct page_frag_cache rx_page;
58+ struct mtk_rxbm_desc *desc;
59+ dma_addr_t desc_phys;
60+ } rx_buf_ring;
61+
62+ struct {
63+
64+ void __iomem *rro_desc;
65+ dma_addr_t miod_desc_phys;
66+ dma_addr_t fdbk_desc_phys;
67+ u32 mcu_view_miod;
68+ } rro;
69+
70+ /* filled by driver: */
71+ struct {
72+ union {
73+ struct platform_device *platform_dev;
74+ struct pci_dev *pci_dev;
75+ };
76+ void __iomem *base;
77+ u32 bus_type;
78+ u32 phy_base;
79+
80+ u32 wpdma_phys;
81+ u32 wpdma_int;
82+ u32 wpdma_mask;
83+ u32 wpdma_tx;
84+ u32 wpdma_txfree;
85+ u32 wpdma_rx_glo;
86+ u32 wpdma_rx;
87+
88+ u8 tx_tbit[MTK_WED_TX_QUEUES];
89+ u8 rx_tbit[MTK_WED_RX_QUEUES];
90+ u8 txfree_tbit;
91+
92+ u16 token_start;
93+ unsigned int nbuf;
94+ unsigned int rx_nbuf;
95+ unsigned int rx_npkt;
96+ unsigned int rx_size;
97+
98+ bool wcid_512;
99+
100+ u32 (*init_buf)(void *ptr, dma_addr_t phys, int token_id);
101+ int (*offload_enable)(struct mtk_wed_device *wed);
102+ void (*offload_disable)(struct mtk_wed_device *wed);
103+ u32 (*init_rx_buf)(struct mtk_wed_device *wed,
104+ int pkt_num);
105+ void (*release_rx_buf)(struct mtk_wed_device *wed);
106+
107+ void (*ser_trigger)(struct mtk_wed_device *wed);
108+ } wlan;
109+ struct completion fe_reset_done;
110+ struct completion wlan_reset_done;
111+ atomic_t fe_reset;
112+};
113+
114+static inline int
115+mtk_wed_device_attach(struct mtk_wed_device *dev)
116+{
117+ int ret = -ENODEV;
118+ return ret;
119+}
120+
121+static inline bool mtk_wed_device_active(struct mtk_wed_device *dev)
122+{
123+ return false;
124+}
125+
126+static inline bool
127+mtk_wed_get_rx_capa(struct mtk_wed_device *dev)
128+{
129+ return false;
130+}
131+
132+#define mtk_wed_device_detach(_dev) do {} while (0)
133+#define mtk_wed_device_start(_dev, _mask) do {} while (0)
134+#define mtk_wed_device_stop(_dev, _reset) do {} while (0)
135+#define mtk_wed_device_tx_ring_setup(_dev, _ring, _regs, _reset) -ENODEV
136+#define mtk_wed_device_txfree_ring_setup(_dev, _ring, _regs) -ENODEV
137+#define mtk_wed_device_rx_ring_setup(_dev, _ring, _regs, _reset) -ENODEV
138+#define mtk_wed_device_reg_read(_dev, _reg) 0
139+#define mtk_wed_device_reg_write(_dev, _reg, _val) do {} while (0)
140+#define mtk_wed_device_irq_get(_dev, _mask) 0
141+#define mtk_wed_device_irq_set_mask(_dev, _mask) do {} while (0)
142+#define mtk_wed_device_dma_reset(_dev) do {} while (0)
143+#define mtk_wed_device_ppe_check(_dev, _skb, _reason, _hash) do {} while (0)
144+#define mtk_wed_device_update_msg(_dev, _id, _msg, _len) -ENODEV
145+
146+#endif
147diff --git a/mt7915/mmio.c b/mt7915/mmio.c
148index e30a8d4c..57c56918 100644
149--- a/mt7915/mmio.c
150+++ b/mt7915/mmio.c
151@@ -11,7 +11,11 @@
152 #include "../trace.h"
153 #include "../dma.h"
154
155+#ifdef CONFIG_NET_MEDIATEK_SOC_WED
156 static bool wed_enable = true;
157+#else
158+static bool wed_enable;
159+#endif
160 module_param(wed_enable, bool, 0644);
161 MODULE_PARM_DESC(wed_enable, "Enable Wireless Ethernet Dispatch support");