Revert "mt76: probe load mt7615 driver asynchronously"
[openwrt/openwrt.git] / package / kernel / mt76 / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=mt76
4 PKG_RELEASE=1
5
6 PKG_LICENSE:=GPLv2
7 PKG_LICENSE_FILES:=
8
9 PKG_SOURCE_URL:=https://github.com/openwrt/mt76
10 PKG_SOURCE_PROTO:=git
11 PKG_SOURCE_DATE:=2019-10-10
12 PKG_SOURCE_VERSION:=d3a589586d1b1d9e1422e31f642a500ff0195f20
13 PKG_MIRROR_HASH:=46df12037db0d3438cb0ae97cded24a6562502d5cbd2d6d6d4e72ca807b0407e
14
15 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
16 PKG_BUILD_PARALLEL:=1
17
18 PKG_CONFIG_DEPENDS += \
19 CONFIG_PACKAGE_kmod-mt76-usb \
20 CONFIG_PACKAGE_kmod-mt76x02-common \
21 CONFIG_PACKAGE_kmod-mt76x0-common \
22 CONFIG_PACKAGE_kmod-mt76x0u \
23 CONFIG_PACKAGE_kmod-mt76x2-common \
24 CONFIG_PACKAGE_kmod-mt76x2 \
25 CONFIG_PACKAGE_kmod-mt76x2u \
26 CONFIG_PACKAGE_kmod-mt7603
27
28 STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
29
30 include $(INCLUDE_DIR)/kernel.mk
31 include $(INCLUDE_DIR)/package.mk
32
33 define KernelPackage/mt76-default
34 SUBMENU:=Wireless Drivers
35 DEPENDS:= \
36 +kmod-mac80211 \
37 +@DRIVER_11AC_SUPPORT +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT
38 endef
39
40 define KernelPackage/mt76
41 SUBMENU:=Wireless Drivers
42 TITLE:=MediaTek MT76x2/MT7603 wireless driver (metapackage)
43 DEPENDS:= \
44 +kmod-mt76-core +kmod-mt76x2 +kmod-mt7603
45 endef
46
47 define KernelPackage/mt76-core
48 $(KernelPackage/mt76-default)
49 TITLE:=MediaTek MT76xx wireless driver
50 HIDDEN:=1
51 FILES:=\
52 $(PKG_BUILD_DIR)/mt76.ko
53 endef
54
55 define KernelPackage/mt76-usb
56 $(KernelPackage/mt76-default)
57 TITLE:=MediaTek MT76xx wireless driver USB support
58 DEPENDS += +kmod-usb-core +kmod-mt76-core
59 HIDDEN:=1
60 FILES:=\
61 $(PKG_BUILD_DIR)/mt76-usb.ko
62 endef
63
64 define KernelPackage/mt76x02-usb
65 $(KernelPackage/mt76-default)
66 TITLE:=MediaTek MT76x0/MT76x2 USB wireless driver common code
67 DEPENDS+=+kmod-mt76-usb +kmod-mt76x02-common
68 HIDDEN:=1
69 FILES:=$(PKG_BUILD_DIR)/mt76x02-usb.ko
70 endef
71
72 define KernelPackage/mt76x02-common
73 $(KernelPackage/mt76-default)
74 TITLE:=MediaTek MT76x0/MT76x2 wireless driver common code
75 DEPENDS+=+kmod-mt76-core
76 HIDDEN:=1
77 FILES:=$(PKG_BUILD_DIR)/mt76x02-lib.ko
78 endef
79
80 define KernelPackage/mt76x0-common
81 $(KernelPackage/mt76-default)
82 TITLE:=MediaTek MT76x0 wireless driver common code
83 DEPENDS+=+kmod-mt76x02-common
84 HIDDEN:=1
85 FILES:=$(PKG_BUILD_DIR)/mt76x0/mt76x0-common.ko
86 endef
87
88 define KernelPackage/mt76x0e
89 $(KernelPackage/mt76-default)
90 TITLE:=MediaTek MT76x0E wireless driver
91 DEPENDS+=@PCI_SUPPORT +kmod-mt76x0-common
92 FILES:=\
93 $(PKG_BUILD_DIR)/mt76x0/mt76x0e.ko
94 AUTOLOAD:=$(call AutoProbe,mt76x0e)
95 endef
96
97 define KernelPackage/mt76x0u
98 $(KernelPackage/mt76-default)
99 TITLE:=MediaTek MT76x0U wireless driver
100 DEPENDS+=+kmod-mt76x0-common +kmod-mt76x02-usb
101 FILES:=\
102 $(PKG_BUILD_DIR)/mt76x0/mt76x0u.ko
103 AUTOLOAD:=$(call AutoProbe,mt76x0u)
104 endef
105
106 define KernelPackage/mt76x2-common
107 $(KernelPackage/mt76-default)
108 TITLE:=MediaTek MT76x2 wireless driver common code
109 DEPENDS+=+kmod-mt76-core +kmod-mt76x02-common
110 HIDDEN:=1
111 FILES:=$(PKG_BUILD_DIR)/mt76x2/mt76x2-common.ko
112 endef
113
114 define KernelPackage/mt76x2u
115 $(KernelPackage/mt76-default)
116 TITLE:=MediaTek MT76x2U wireless driver
117 DEPENDS+=+kmod-mt76x2-common +kmod-mt76x02-usb
118 FILES:=\
119 $(PKG_BUILD_DIR)/mt76x2/mt76x2u.ko
120 AUTOLOAD:=$(call AutoProbe,mt76x2u)
121 endef
122
123 define KernelPackage/mt76x2
124 $(KernelPackage/mt76-default)
125 TITLE:=MediaTek MT76x2 wireless driver
126 DEPENDS+=@PCI_SUPPORT +kmod-mt76x2-common
127 FILES:=\
128 $(PKG_BUILD_DIR)/mt76x2/mt76x2e.ko
129 AUTOLOAD:=$(call AutoProbe,mt76x2e)
130 endef
131
132 define KernelPackage/mt7603
133 $(KernelPackage/mt76-default)
134 TITLE:=MediaTek MT7603 wireless driver
135 DEPENDS+=@PCI_SUPPORT +kmod-mt76-core
136 FILES:=\
137 $(PKG_BUILD_DIR)/mt7603/mt7603e.ko
138 AUTOLOAD:=$(call AutoProbe,mt7603e)
139 endef
140
141 define KernelPackage/mt7615e
142 $(KernelPackage/mt76-default)
143 TITLE:=MediaTek MT7615 wireless driver
144 DEPENDS+=@PCI_SUPPORT +kmod-mt76-core
145 FILES:=\
146 $(PKG_BUILD_DIR)/mt7615/mt7615e.ko
147 AUTOLOAD:=$(call AutoProbe,mt7615e)
148 endef
149
150 NOSTDINC_FLAGS = \
151 -I$(PKG_BUILD_DIR) \
152 -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
153 -I$(STAGING_DIR)/usr/include/mac80211-backport \
154 -I$(STAGING_DIR)/usr/include/mac80211/uapi \
155 -I$(STAGING_DIR)/usr/include/mac80211 \
156 -include backport/autoconf.h \
157 -include backport/backport.h
158
159 ifdef CONFIG_PACKAGE_MAC80211_MESH
160 NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
161 endif
162
163 ifdef CONFIG_PACKAGE_kmod-mt76-usb
164 PKG_MAKE_FLAGS += CONFIG_MT76_USB=m
165 endif
166 ifdef CONFIG_PACKAGE_kmod-mt76x02-common
167 PKG_MAKE_FLAGS += CONFIG_MT76x02_LIB=m
168 endif
169 ifdef CONFIG_PACKAGE_kmod-mt76x02-usb
170 PKG_MAKE_FLAGS += CONFIG_MT76x02_USB=m
171 endif
172 ifdef CONFIG_PACKAGE_kmod-mt76x0-common
173 PKG_MAKE_FLAGS += CONFIG_MT76x0_COMMON=m
174 endif
175 ifdef CONFIG_PACKAGE_kmod-mt76x0e
176 PKG_MAKE_FLAGS += CONFIG_MT76x0E=m
177 endif
178 ifdef CONFIG_PACKAGE_kmod-mt76x0u
179 PKG_MAKE_FLAGS += CONFIG_MT76x0U=m
180 endif
181 ifdef CONFIG_PACKAGE_kmod-mt76x2-common
182 PKG_MAKE_FLAGS += CONFIG_MT76x2_COMMON=m
183 endif
184 ifdef CONFIG_PACKAGE_kmod-mt76x2
185 PKG_MAKE_FLAGS += CONFIG_MT76x2E=m
186 endif
187 ifdef CONFIG_PACKAGE_kmod-mt76x2u
188 PKG_MAKE_FLAGS += CONFIG_MT76x2U=m
189 endif
190 ifdef CONFIG_PACKAGE_kmod-mt7603
191 PKG_MAKE_FLAGS += CONFIG_MT7603E=m
192 endif
193 ifdef CONFIG_PACKAGE_kmod-mt7615e
194 PKG_MAKE_FLAGS += CONFIG_MT7615E=m
195 endif
196
197 define Build/Compile
198 +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
199 $(KERNEL_MAKE_FLAGS) \
200 $(PKG_MAKE_FLAGS) \
201 SUBDIRS="$(PKG_BUILD_DIR)" \
202 NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
203 modules
204 endef
205
206 define Package/kmod-mt76/install
207 true
208 endef
209
210 define KernelPackage/mt76x0-common/install
211 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
212 cp \
213 $(PKG_BUILD_DIR)/firmware/mt7610e.bin \
214 $(1)/lib/firmware/mediatek
215 endef
216
217 define KernelPackage/mt76x2-common/install
218 $(INSTALL_DIR) $(1)/lib/firmware
219 cp \
220 $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
221 $(PKG_BUILD_DIR)/firmware/mt7662.bin \
222 $(1)/lib/firmware
223 endef
224
225 define KernelPackage/mt76x0u/install
226 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
227 ln -sf mt7610e.bin $(1)/lib/firmware/mediatek/mt7610u.bin
228 endef
229
230 define KernelPackage/mt76x2u/install
231 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
232 ln -sf ../mt7662.bin $(1)/lib/firmware/mediatek/mt7662u.bin
233 ln -sf ../mt7662_rom_patch.bin $(1)/lib/firmware/mediatek/mt7662u_rom_patch.bin
234 endef
235
236 define KernelPackage/mt7603/install
237 $(INSTALL_DIR) $(1)/lib/firmware
238 cp $(if $(CONFIG_TARGET_ramips_mt76x8), \
239 $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
240 $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
241 ,\
242 $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
243 $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
244 ) \
245 $(1)/lib/firmware
246 endef
247
248 define KernelPackage/mt7615e/install
249 $(INSTALL_DIR) $(1)/lib/firmware/mediatek
250 cp \
251 $(PKG_BUILD_DIR)/firmware/mt7615_cr4.bin \
252 $(PKG_BUILD_DIR)/firmware/mt7615_n9.bin \
253 $(PKG_BUILD_DIR)/firmware/mt7615_rom_patch.bin \
254 $(1)/lib/firmware/mediatek
255 endef
256
257 $(eval $(call KernelPackage,mt76-core))
258 $(eval $(call KernelPackage,mt76-usb))
259 $(eval $(call KernelPackage,mt76x02-usb))
260 $(eval $(call KernelPackage,mt76x02-common))
261 $(eval $(call KernelPackage,mt76x0-common))
262 $(eval $(call KernelPackage,mt76x0e))
263 $(eval $(call KernelPackage,mt76x0u))
264 $(eval $(call KernelPackage,mt76x2-common))
265 $(eval $(call KernelPackage,mt76x2u))
266 $(eval $(call KernelPackage,mt76x2))
267 $(eval $(call KernelPackage,mt7603))
268 $(eval $(call KernelPackage,mt7615e))
269 $(eval $(call KernelPackage,mt76))