ath5k: do not stop the hardware queues during PAPD calibration, speeds up calibration
[oweals/openwrt.git] / package / ltq-dsl / Makefile
1 #
2 # Copyright (C) 2011 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=ltq-dsl
12 PKG_BASE_NAME:=drv_dsl_cpe_api_danube
13 PKG_VERSION:=3.24.4.4
14 PKG_RELEASE:=3
15 PKG_SOURCE:=$(PKG_BASE_NAME)-$(PKG_VERSION).tar.gz
16 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/drv_dsl_cpe_api-$(PKG_VERSION)
17 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/
18 PKG_MD5SUM:=c45bc531c1ed2ac80f68fb986b63bb87
19
20 FW_NAME:=ltq-dsl-fw-0.1
21 FW_MD5:=4700a36b66b955b4c5544227267356f4
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Download/ltq-dsl-fw
26         FILE:=$(FW_NAME).tar.bz2
27         MD5SUM:=$(FW_MD5)
28         URL:=http://mirror2.openwrt.org/sources/
29 endef
30 $(eval $(call Download,ltq-dsl-fw))
31
32 define KernelPackage/ltq-dsl-template
33   SECTION:=sys
34   CATEGORY:=Kernel modules
35   SUBMENU:=Network Devices
36   TITLE:=Lantiq dsl driver for $(1)
37   URL:=http://www.lantiq.com/
38   VARIANT:=$(1)
39   DEPENDS:=@TARGET_lantiq_$(1) +kmod-atm
40   FILES:=$(PKG_BUILD_DIR)/src/mei/lantiq_mei.ko \
41         $(PKG_BUILD_DIR)/src/drv_dsl_cpe_api.ko \
42         $(PKG_BUILD_DIR)/src/mei/lantiq_atm.ko
43   AUTOLOAD:=$(call AutoLoad,50,lantiq_mei drv_dsl_cpe_api lantiq_atm)
44   MAINTAINER:=John Crispin <blogic@openwrt.org>
45 endef
46
47 KernelPackage/ltq-dsl-danube=$(call KernelPackage/ltq-dsl-template,danube)
48 KernelPackage/ltq-dsl-ase=$(call KernelPackage/ltq-dsl-template,ase)
49 KernelPackage/ltq-dsl-ar9=$(call KernelPackage/ltq-dsl-template,ar9)
50 KernelPackage/ltq-dsl-vr9=$(call KernelPackage/ltq-dsl-template,vr9)
51
52 define Package/kmod-ltq-dsl-firmware-template
53   TITLE+=Firmware Annex-$(1) $(2)
54   SECTION:=sys
55   CATEGORY:=Kernel modules
56   SUBMENU:=Network Devices
57   VARIANT:= $(1)-$(2)
58   URL:=http://www.lantiq.com/
59   DEPENDS:=@TARGET_lantiq_$(2) kmod-ltq-dsl-$(2)
60   MAINTAINER:=John Crispin <blogic@openwrt.org>
61 endef
62
63 Package/kmod-ltq-dsl-firmware-a-danube=$(call Package/kmod-ltq-dsl-firmware-template,a,danube)
64 Package/kmod-ltq-dsl-firmware-b-danube=$(call Package/kmod-ltq-dsl-firmware-template,b,danube)
65 Package/kmod-ltq-dsl-firmware-a-ase=$(call Package/kmod-ltq-dsl-firmware-template,a,ase)
66 Package/kmod-ltq-dsl-firmware-b-ase=$(call Package/kmod-ltq-dsl-firmware-template,b,ase)
67 Package/kmod-ltq-dsl-firmware-a-ar9=$(call Package/kmod-ltq-dsl-firmware-template,a,ar9)
68 Package/kmod-ltq-dsl-firmware-b-ar9=$(call Package/kmod-ltq-dsl-firmware-template,b,ar9)
69 Package/kmod-ltq-dsl-firmware-a-vr9=$(call Package/kmod-ltq-dsl-firmware-template,a,vr9)
70 Package/kmod-ltq-dsl-firmware-b-vr9=$(call Package/kmod-ltq-dsl-firmware-template,b,vr9)
71
72 define KernelPackage/ltq-dsl/description
73         Lantiq DSL driver for AR9, Amazon SE, Danube and VR9
74 endef
75
76 define KernelPackage/ltq-dsl/config
77         source "$(SOURCE)/Config.in"
78 endef
79
80 IFX_DSL_MAX_DEVICE=1
81 IFX_DSL_LINES_PER_DEVICE=1
82 IFX_DSL_CHANNELS_PER_LINE=1
83
84 CONFIGURE_ARGS += --enable-kernel-include="$(LINUX_DIR)/include" \
85         --with-max-device="$(IFX_DSL_MAX_DEVICE)" \
86         --with-lines-per-device="$(IFX_DSL_LINES_PER_DEVICE)" \
87         --with-channels-per-line="$(IFX_DSL_CHANNELS_PER_LINE)" \
88         --disable-dsl-delt-static \
89         --disable-adsl-led \
90         --enable-dsl-ceoc \
91         --enable-dsl-pm \
92         --enable-dsl-pm-total \
93         --enable-dsl-pm-history \
94         --enable-dsl-pm-showtime \
95         --enable-dsl-pm-channel-counters \
96         --enable-dsl-pm-datapath-counters \
97         --enable-dsl-pm-line-counters \
98         --enable-dsl-pm-channel-thresholds \
99         --enable-dsl-pm-datapath-thresholds \
100         --enable-dsl-pm-line-thresholds \
101         --enable-dsl-pm-optional-parameters \
102         --enable-linux-26 \
103         --enable-kernelbuild="$(LINUX_DIR)" \
104         ARCH=$(LINUX_KARCH)
105
106 CONFIG_TAG_danube:=DANUBE
107 CONFIG_TAG_ase:=AMAZON_SE
108 CONFIG_TAG_ar9:=AR9
109 CONFIG_TAG_vr9:=VR9
110 CONFIGURE_ARGS += --enable-add-drv-cflags="-DMODULE -DCONFIG_$(CONFIG_TAG_$(BUILD_VARIANT))"
111
112 ifeq ($(BUILD_VARIANT),vr9)
113 CONFIGURE_ARGS += --enable-vinax
114 else
115 CONFIGURE_ARGS += --enable-danube
116 endif
117
118 ifeq ($(CONFIG_LANTIQ_DSL_DEBUG),y)
119 CONFIGURE_ARGS += \
120         --enable-debug=yes \
121         --enable-debug-prints=yes
122 EXTRA_CFLAGS += -DDEBUG
123 endif
124
125 EXTRA_CFLAGS = -fno-pic -mno-abicalls -mlong-calls -G 0
126
127 define Build/Prepare
128         $(PKG_UNPACK)
129         $(INSTALL_DIR) $(PKG_BUILD_DIR)/src/mei/ 
130         $(CP) ./src/* $(PKG_BUILD_DIR)/src/mei/
131         $(Build/Patch)
132         $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(FW_NAME).tar.bz2
133 endef
134
135 define Build/Configure
136         (cd $(PKG_BUILD_DIR); aclocal && autoconf && automake)
137         $(call Build/Configure/Default)
138 endef
139
140 define Build/Compile
141         cd $(LINUX_DIR); \
142                 ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
143                 $(MAKE) BUILD_VARIANT=$(BUILD_VARIANT) M=$(PKG_BUILD_DIR)/src/mei/ V=1 modules
144         $(call Build/Compile/Default)
145 endef
146
147 define Build/InstallDev
148         $(INSTALL_DIR) $(1)/usr/include
149         $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api.h $(1)/usr/include
150         $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_ioctl.h $(1)/usr/include
151         $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_adslmib.h $(1)/usr/include
152         $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_adslmib_ioctl.h $(1)/usr/include
153         $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_g997.h $(1)/usr/include
154         $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_types.h $(1)/usr/include
155         $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_pm.h $(1)/usr/include
156         $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_error.h $(1)/usr/include
157         $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_danube_ctx.h $(1)/usr/include
158         $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_cmv_danube.h $(1)/usr/include
159 endef
160
161 define Package/kmod-ltq-dsl-firmware-$(BUILD_VARIANT)/install
162         $(INSTALL_DIR) $(1)/lib/firmware/
163         $(CP) $(PKG_BUILD_DIR)/$(FW_NAME)/ltq-dsl-fw-$(BUILD_VARIANT).bin $(1)/lib/firmware/dsl-fw-$(word 1, $(subst -, ,$(BUILD_VARIANT))).bin
164         ln -s /lib/firmware/dsl-fw-$(word 1, $(subst -, ,$(BUILD_VARIANT))).bin $(1)/lib/firmware/ModemHWE.bin
165 endef
166
167 $(eval $(call BuildPackage,kmod-ltq-dsl-firmware-a-danube))
168 $(eval $(call BuildPackage,kmod-ltq-dsl-firmware-b-danube))
169 $(eval $(call BuildPackage,kmod-ltq-dsl-firmware-a-ase))
170 $(eval $(call BuildPackage,kmod-ltq-dsl-firmware-b-ase))
171 $(eval $(call BuildPackage,kmod-ltq-dsl-firmware-a-ar9))
172 $(eval $(call BuildPackage,kmod-ltq-dsl-firmware-b-ar9))
173 #$(eval $(call BuildPackage,kmod-ltq-dsl-firmware-a-vr9))
174 #$(eval $(call BuildPackage,kmod-ltq-dsl-firmware-b-vr9))
175 $(eval $(call KernelPackage,ltq-dsl-danube))
176 $(eval $(call KernelPackage,ltq-dsl-ase))
177 $(eval $(call KernelPackage,ltq-dsl-ar9))
178 #$(eval $(call KernelPackage,ltq-dsl-vr9))