1190207Srpaulo#
2146773Ssam# Copyright (C) 2007-2012 OpenWrt.org
3146773Ssam#
4146773Ssam# This is free software, licensed under the GNU General Public License v2.
5146773Ssam# See /LICENSE for more information.
6146773Ssam#
7146773Ssam
8146773Ssaminclude $(TOPDIR)/rules.mk
9146773Ssaminclude $(INCLUDE_DIR)/kernel.mk
10146773Ssam
11146773SsamPKG_NAME:=acx-mac80211
12146773SsamPKG_REV:=b6fc31491020cb01d2cd1acc170cfa03ced7e726
13146773SsamPKG_VERSION:=20140216
14146773SsamPKG_RELEASE:=1
15146773Ssam
16146773SsamPKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
17146773SsamPKG_SOURCE_URL:=git://git.code.sf.net/p/acx100/acx-mac80211
18146773SsamPKG_SOURCE_PROTO:=git
19146773SsamPKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
20146773SsamPKG_SOURCE_VERSION:=$(PKG_REV)
21146773Ssam# PKG_MIRROR_MD5SUM:=
22146773SsamPKG_BUILD_DEPENDS:=mac80211
23146773Ssam
24146773SsamPKG_CONFIG_DEPENDS:= \
25146773Ssam	CONFIG_PACKAGE_MAC80211_DEBUGFS \
26146773Ssam	CONFIG_PACKAGE_MAC80211_MESH \
27146773Ssam
28146773Ssaminclude $(INCLUDE_DIR)/package.mk
29146773Ssam
30146773Ssamdefine KernelPackage/acx-mac80211
31146773Ssam  SUBMENU:=Wireless Drivers
32146773Ssam  TITLE:=ACX1xx mac80211 driver
33190207Srpaulo  DEPENDS:=@(PCI_SUPPORT||TARGET_ar7) @!TARGET_cobalt @mipsel +kmod-mac80211
34146773Ssam  FILES:=$(PKG_BUILD_DIR)/acx-mac80211.ko
35146773Ssam  AUTOLOAD:=$(call AutoLoad,50,mac80211 acx-mac80211)
36146773Ssam  MAINTAINER:=Florian Fainelli <florian@openwrt.org>
37146773Ssam  MENU:=1
38146773Ssamendef
39146773Ssam
40146773Ssamdefine KernelPackage/acx-mac80211/config
41146773Ssam	menu "Configuration"
42146773Ssam		depends on PACKAGE_kmod-acx-mac80211
43146773Ssam
44146773Ssam	config ACX_ID_0D
45146773Ssam		bool "ACX1xx Radio ID 0D firmware"
46146773Ssam		help
47146773Ssam		  Download and install firmware for:
48146773Ssam		    ACX1xx cards with Radio ID 0D into /lib/firmware.
49146773Ssam
50146773Ssam	config ACX_ID_11
51146773Ssam		bool "ACX1xx Radio ID 11 firmware"
52146773Ssam		help
53146773Ssam		  Download and install firmware for:
54146773Ssam		    ACX1xx cards with Radio ID 11 into /lib/firmware.
55146773Ssam
56146773Ssam	config ACX_ID_15
57146773Ssam		bool "ACX1xx Radio ID 15 firmware"
58146773Ssam		help
59146773Ssam		  Download and install firmware for:
60146773Ssam		    ACX1xx cards with Radio ID 15 into /lib/firmware.
61146773Ssam
62146773Ssam	config ACX_ID_16
63146773Ssam		bool "ACX1xx Radio ID 16 firmware"
64146773Ssam		default y
65146773Ssam		help
66146773Ssam		  Download and install firmware for:
67146773Ssam		    ACX1xx cards with Radio ID 16 into /lib/firmware.
68146773Ssam
69146773Ssam	choice
70146773Ssam		prompt "ACX111 firmware version"
71146773Ssam		depends on ACX_ID_16
72146773Ssam		default ACX_DEFAULT if !TARGET_adm5120
73146773Ssam		default ACX_1_2_1_34 if TARGET_adm5120
74146773Ssam		help
75146773Ssam		  This option allows you to select the version of the acx firmware.
76146773Ssam
77146773Ssam	config ACX_DEFAULT
78146773Ssam		bool "Default"
79146773Ssam		help
80146773Ssam		  Default firmware for ACX111 devices.
81146773Ssam
82146773Ssam		  If unsure, select this.
83146773Ssam
84146773Ssam	config ACX_1_2_1_34
85146773Ssam		bool "1.2.1_34"
86146773Ssam		help
87146773Ssam		  1.2.1_34 firmware for ACX111 devices. Works with Zyxel P-334WT.
88146773Ssam
89146773Ssam		  If unsure, select the "default" firmware.
90146773Ssam
91146773Ssam	endchoice
92146773Ssam
93146773Ssam	config ACX_ID_17
94146773Ssam		bool "ACX1xx Radio ID 17 firmware"
95146773Ssam		help
96146773Ssam		  Download and install firmware for:
97146773Ssam		    ACX1xx cards with Radio ID 17 into /lib/firmware.
98146773Ssam
99146773Ssam	config ACX_ID_19
100146773Ssam		bool "ACX1xx Radio ID 19 firmware"
101146773Ssam		default y
102146773Ssam		help
103146773Ssam		  Download and install firmware for:
104146773Ssam		    ACX1xx cards with Radio ID 19 into /lib/firmware.
105146773Ssam
106146773Ssam	config ACX_ID_1B
107146773Ssam		bool "ACX1xx Radio ID 1B firmware"
108146773Ssam		help
109146773Ssam		  Download and install firmware for:
110146773Ssam		    ACX1xx cards with Radio ID 1b into /lib/firmware.
111146773Ssam
112146773Ssam	endmenu
113146773Ssamendef
114146773Ssam
115146773Ssamdefine KernelPackage/acx-mac80211/description
116146773Ssam	Driver for acx111 cards (mac80211 version)
117146773Ssamendef
118146773Ssam
119146773Ssamdefine Download/tiacx100
120146773Ssam	FILE:=tiacx100
121146773Ssam	URL:=http://acx100.erley.org/fw/acx100_1.9.8.b/
122146773Ssam	MD5SUM:=24a54fd30f7658fcbffc825b0dd7aa5b
123146773Ssamendef
124146773Ssam
125146773Ssamdefine Download/tiacx100r0d
126146773Ssam	FILE:=tiacx100r0D
127146773Ssam	URL:=http://acx100.erley.org/fw/acx100_1.9.8.b/
128146773Ssam	MD5SUM:=1c7413e7b0be4ef7d1e424a132e17fab
129146773Ssamendef
130
131define Download/tiacx100r11
132	FILE:=tiacx100r11
133	URL:=http://acx100.erley.org/fw/acx100_1.9.8.b/
134	MD5SUM:=a150750ad33c512edc4afee5270b37cb
135endef
136
137define Download/tiacx100r15
138	FILE:=tiacx100r15
139	URL:=http://acx100.erley.org/fw/acx100_1.9.8.b/
140	MD5SUM:=c99d01d4fcf0d6cc00441aff60690be4
141endef
142
143define Download/tiacx111c16
144	FILE:=tiacx111c16
145	URL:=http://acx100.erley.org/fw/acx111_2.3.1.31/
146	MD5SUM:=7026826460376f6b174f9225bd7781b9
147endef
148
149define Download/tiacx111c16_1
150	FILE:=tiacx111c16_1.2.1_34
151	URL:=http://sites.google.com/site/atorkhov/files/
152	MD5SUM:=fcd07de4b25e1d2aaf3b78b27c5b7ee9
153endef
154
155define Download/tiacx111c17
156	FILE:=tiacx111c17
157	URL:=http://acx100.erley.org/fw/acx111_2.3.1.31/
158	MD5SUM:=95552544ca6d2b4e8c6aeb80b8ae7fdf
159endef
160
161define Download/tiacx111c19
162	FILE:=tiacx111c19
163	URL:=http://acx100.erley.org/fw/acx111_2.3.1.31/
164	MD5SUM:=a1fa9681e297b4e36e257090fc12265a
165endef
166
167define Download/tiacx111usbc1b
168	FILE:=tiacx111usbc1B
169	URL:=http://acx100.erley.org/fw/acx111_2.4.0.70-USB/
170	MD5SUM:=c4edecd912b2417779d0b65e3a7dc86d
171endef
172
173PKG_EXTRA_KCONFIG:= \
174	CONFIG_ACX_MAC80211=m \
175	CONFIG_ACX_MAC80211_PCI=m \
176
177PKG_EXTRA_CFLAGS:= \
178	$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \
179	$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \
180	$(if $(CONFIG_LEDS_TRIGGERS), -DCONFIG_MAC80211_LEDS -DCONFIG_LEDS_TRIGGERS) \
181	$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS), -DCONFIG_CFG80211_DEBUGFS -DCONFIG_MAC80211_DEBUGFS) \
182	$(if $(CONFIG_PACKAGE_MAC80211_MESH), -DCONFIG_MAC80211_MESH) \
183	-DBACKPORTED_KERNEL_NAME=\\\"$(PKG_SOURCE)\\\" \
184	-DBACKPORTED_KERNEL_VERSION=\\\"$(PKG_SOURCE_VERSION)\\\" \
185	-DBACKPORTS_VERSION=\\\"unknown\\\" \
186
187define Build/Compile
188	$(MAKE) -C "$(LINUX_DIR)" \
189		ARCH="$(LINUX_KARCH)" \
190		CROSS_COMPILE="$(TARGET_CROSS)" \
191		SUBDIRS="$(PKG_BUILD_DIR)" \
192		$(PKG_EXTRA_KCONFIG) \
193		EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(4,2,0)\"" \
194		LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi -I$(STAGING_DIR)/usr/include/mac80211-backport \
195			-I$(STAGING_DIR)/usr/include/mac80211/uapi -I$(STAGING_DIR)/usr/include/mac80211 \
196			-I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \
197			-I$(LINUX_DIR)/include/generated/uapi/ -Iarch/$(LINUX_KARCH)/include \
198			-Iarch/$(LINUX_KARCH)/include/$(LINUX_UAPI_DIR) \
199			-Iarch/$(LINUX_KARCH)/include/generated \
200			-Iarch/$(LINUX_KARCH)/include/generated/$(LINUX_UAPI_DIR) \
201			-include generated/autoconf.h \
202			-include backport/backport.h " \
203		V="$(V)" \
204		modules
205endef
206
207define Build/Configure
208endef
209
210define KernelPackage/acx-mac80211/install
211	$(INSTALL_DIR) $(1)/lib/firmware
212
213ifneq ($(CONFIG_ACX_ID_0D)$(CONFIG_ACX_ID_11)$(CONFIG_ACX_ID_15),)
214	$(INSTALL_DATA) $(DL_DIR)/tiacx100 $(1)/lib/firmware/
215endif
216
217ifneq ($(CONFIG_ACX_ID_0D),)
218	$(INSTALL_DATA) $(DL_DIR)/tiacx100r0D $(1)/lib/firmware/
219endif
220
221ifneq ($(CONFIG_ACX_ID_11),)
222	$(INSTALL_DATA) $(DL_DIR)/tiacx100r11 $(1)/lib/firmware/
223endif
224
225ifneq ($(CONFIG_ACX_ID_15),)
226	$(INSTALL_DATA) $(DL_DIR)/tiacx100r15 $(1)/lib/firmware/
227endif
228
229ifneq ($(CONFIG_ACX_DEFAULT),)
230	$(INSTALL_DATA) $(DL_DIR)/tiacx111c16 $(1)/lib/firmware/
231endif
232
233ifneq ($(CONFIG_ACX_1_2_1_34),)
234	$(INSTALL_DATA)	$(DL_DIR)/tiacx111c16_1.2.1_34 $(1)/lib/firmware/tiacx111c16
235endif
236
237ifneq ($(CONFIG_ACX_ID_17),)
238	$(INSTALL_DATA) $(DL_DIR)/tiacx111c17 $(1)/lib/firmware/
239endif
240
241ifneq ($(CONFIG_ACX_ID_19),)
242	$(INSTALL_DATA) $(DL_DIR)/tiacx111c19 $(1)/lib/firmware/
243endif
244
245ifneq ($(CONFIG_ACX_ID_1B),)
246	$(INSTALL_DATA) $(DL_DIR)/tiacx111usbc1B $(1)/lib/firmware/
247endif
248
249endef
250
251$(eval $(call KernelPackage,acx-mac80211))
252$(eval $(call Download,tiacx100))
253$(eval $(call Download,tiacx100r0d))
254$(eval $(call Download,tiacx100r11))
255$(eval $(call Download,tiacx100r15))
256$(eval $(call Download,tiacx111c16))
257$(eval $(call Download,tiacx111c16_1))
258$(eval $(call Download,tiacx111c17))
259$(eval $(call Download,tiacx111c19))
260$(eval $(call Download,tiacx111usbc1b))
261