blob: 6c827a03229be28663e3ee97ac664501427a8474 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001###############################################################################
2# Necessary Check
3ifneq ($(CONFIG_MTK_COMBO),)
4ifeq ($(CONFIG_MTK_COMBO_CHIP),)
5 $(error CONFIG_MTK_COMBO_CHIP not defined)
6endif
7
8ifeq ($(TARGET_BUILD_VARIANT),$(filter $(TARGET_BUILD_VARIANT),userdebug user))
9 #ldflags-y += -s
10endif
11
12# Force build fail on modpost warning
13KBUILD_MODPOST_FAIL_ON_WARNINGS := y
14###############################################################################
15
16#ccflags-y += -D MTK_WCN_REMOVE_KERNEL_MODULE
17ifeq ($(CONFIG_ARM64), y)
18 ccflags-y += -D CONFIG_MTK_WCN_ARM64
19endif
20
21ifeq ($(CONFIG_MTK_CONN_LTE_IDC_SUPPORT),y)
22 ccflags-y += -D WMT_IDC_SUPPORT=1
23else
24 ccflags-y += -D WMT_IDC_SUPPORT=0
25endif
26ccflags-y += -D MTK_WCN_WMT_STP_EXP_SYMBOL_ABSTRACT
27ifndef MTK_PLATFORM
28MTK_PLATFORM := $(subst ",,$(CONFIG_MTK_PLATFORM))
29endif
30ccflags-y += -I$(srctree)/drivers/misc/mediatek/include
31ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include
32ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/mach
33ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat
34ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)
35ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include
36ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include/clkbuf_v1
37ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include/clkbuf_v1/$(MTK_PLATFORM)
38ccflags-y += -I$(srctree)/drivers/misc/mediatek/btif/common/inc
39ccflags-y += -I$(srctree)/drivers/misc/mediatek/eccci
40ccflags-y += -I$(srctree)/drivers/misc/mediatek/eccci/$(MTK_PLATFORM)
41ccflags-y += -I$(srctree)/drivers/misc/mediatek/eemcs
42ccflags-y += -I$(srctree)/drivers/misc/mediatek/conn_md/include
43ccflags-y += -I$(srctree)/drivers/misc/mediatek/mach/$(MTK_PLATFORM)/include/mach
44ccflags-y += -I$(srctree)/drivers/misc/mediatek/emi/submodule
45ccflags-y += -I$(srctree)/drivers/misc/mediatek/emi/$(MTK_PLATFORM)
46ccflags-y += -I$(srctree)/drivers/mmc/core
47ccflags-y += -I$(srctree)/drivers/misc/mediatek/connectivity/common
48###############################################################################
49
50
51ccflags-y += -Werror
52
53ifneq ($(filter "MT6628",$(CONFIG_MTK_COMBO_CHIP)),)
54 ccflags-y += -D MT6628
55 ccflags-y += -D MERGE_INTERFACE_SUPPORT
56endif
57ifneq ($(filter "MT6630",$(CONFIG_MTK_COMBO_CHIP)),)
58 ccflags-y += -D MT6630
59ifneq ($(CONFIG_ARCH_MT2601),y)
60 ccflags-y += -D MERGE_INTERFACE_SUPPORT
61endif
62endif
63
64ifneq ($(filter "MT6632",$(CONFIG_MTK_COMBO_CHIP)),)
65 ccflags-y += -D MT6632
66 ccflags-y += -D MERGE_INTERFACE_SUPPORT
67endif
68
69#obj-y += common_main/
70#obj-y += common_detect/
71
72
73
74###############################################################################
75MODULE_NAME := wmt_drv
76ifeq ($(CONFIG_WLAN_DRV_BUILD_IN),y)
77$(warning $(MODULE_NAME) build-in boot.img)
78obj-y += $(MODULE_NAME).o
79else
80$(warning $(MODULE_NAME) is kernel module)
81obj-m += $(MODULE_NAME).o
82endif
83
84###############################################################################
85# common_detect
86###############################################################################
87ccflags-y += -I$(srctree)/arch/arm/mach-$(MTK_PLATFORM)/$(ARCH_MTK_PROJECT)/dct/dct
88ccflags-y += -DWMT_PLAT_ALPS=1
89
90COMBO_CHIP_SUPPORT := false
91ifneq ($(filter "MT6620E3",$(CONFIG_MTK_COMBO_CHIP)),)
92 COMBO_CHIP_SUPPORT := true
93endif
94ifneq ($(filter "MT6628",$(CONFIG_MTK_COMBO_CHIP)),)
95 COMBO_CHIP_SUPPORT := true
96endif
97ifneq ($(filter "MT6630",$(CONFIG_MTK_COMBO_CHIP)),)
98 COMBO_CHIP_SUPPORT := true
99endif
100ifneq ($(filter "MT6632",$(CONFIG_MTK_COMBO_CHIP)),)
101 COMBO_CHIP_SUPPORT := true
102endif
103ifeq ($(COMBO_CHIP_SUPPORT), true)
104 ccflags-y += -D MTK_WCN_COMBO_CHIP_SUPPORT
105endif
106
107ifneq ($(filter "CONSYS_%",$(CONFIG_MTK_COMBO_CHIP)),)
108 ccflags-y += -D MTK_WCN_SOC_CHIP_SUPPORT
109endif
110
111ccflags-y += -I$(src)/common_main/linux/include
112ccflags-y += -I$(src)/common_detect/drv_init/inc
113ccflags-y += -I$(src)/common_detect
114ccflags-y += -I$(src)/debug_utility
115
116$(MODULE_NAME)-objs += common_detect/wmt_detect_pwr.o
117$(MODULE_NAME)-objs += common_detect/wmt_detect.o
118$(MODULE_NAME)-objs += common_detect/sdio_detect.o
119$(MODULE_NAME)-objs += common_detect/mtk_wcn_stub_alps.o
120$(MODULE_NAME)-objs += common_detect/wmt_gpio.o
121
122
123ifneq ($(filter "MT6630",$(CONFIG_MTK_COMBO_CHIP)),)
124 ccflags-y += -D MTK_WCN_WLAN_GEN3
125endif
126
127ifneq ($(filter "MT6632",$(CONFIG_MTK_COMBO_CHIP)),)
128 ccflags-y += -D MTK_WCN_WLAN_GEN4
129endif
130
131ifneq ($(filter "CONSYS_6797" "CONSYS_6759" "CONSYS_6758" "CONSYS_6771" "CONSYS_6775",$(CONFIG_MTK_COMBO_CHIP)),)
132 ccflags-y += -D MTK_WCN_WLAN_GEN3
133else ifneq ($(filter "CONSYS_%",$(CONFIG_MTK_COMBO_CHIP)),)
134 ccflags-y += -D MTK_WCN_WLAN_GEN2
135endif
136
137$(MODULE_NAME)-objs += common_detect/drv_init/fm_drv_init.o
138$(MODULE_NAME)-objs += common_detect/drv_init/conn_drv_init.o
139$(MODULE_NAME)-objs += common_detect/drv_init/bluetooth_drv_init.o
140$(MODULE_NAME)-objs += common_detect/drv_init/wlan_drv_init.o
141$(MODULE_NAME)-objs += common_detect/drv_init/common_drv_init.o
142$(MODULE_NAME)-objs += common_detect/drv_init/gps_drv_init.o
143
144
145###############################################################################
146# common_main
147###############################################################################
148ccflags-y += -I$(src)/common_main/linux/include
149ccflags-y += -I$(src)/common_main/linux/pri/include
150ccflags-y += -I$(src)/common_main/platform/include
151ccflags-y += -I$(src)/common_main/core/include
152ccflags-y += -I$(src)/common_main/include
153
154ccflags-y += -D WMT_PLAT_ALPS=1
155ccflags-y += -D WMT_UART_RX_MODE_WORK=0 # 1. work thread 0. tasklet
156ccflags-y += -D WMT_SDIO_MODE=1
157ccflags-y += -D WMT_CREATE_NODE_DYNAMIC=1
158
159ifneq ($(TARGET_BUILD_VARIANT),eng)
160ifeq ($(CONFIG_EXTREME_LOW_RAM), y)
161ccflags-y += -DLOG_STP_DEBUG_DISABLE
162endif
163endif
164
165ifneq ($(filter mt2712,$(CONFIG_MTK_PLATFORM)),)
166ccflags-y += -DLOG_STP_DEBUG_DISABLE
167endif
168
169ifneq ($(TARGET_BUILD_VARIANT), user)
170 ccflags-y += -D WMT_DBG_SUPPORT=1
171else
172 ccflags-y += -D WMT_DBG_SUPPORT=0
173endif
174
175ifeq ($(CONFIG_ARCH_MT6580), y)
176ccflags-y += -D CFG_WMT_READ_EFUSE_VCN33
177endif
178
179# STEP: (Support Connac)
180# MTK eng/userdebug/user load: Support
181# Customer eng/userdebug load: Support
182# Customer user load: Not support
183
184ifeq ($(wildcard vendor/mediatek/proprietary/external/aee_config_internal/init.aee.mtk.system.rc),)
185 ccflags-y += -D CFG_WMT_STEP
186else
187 ifneq ($(TARGET_BUILD_VARIANT),user)
188 ccflags-y += -D CFG_WMT_STEP
189 endif
190endif
191
192ifeq ($(findstring evb, $(MTK_PROJECT)), evb)
193ccflags-y += -D CFG_WMT_EVB
194endif
195
196ifneq ($(filter "CONSYS_%",$(CONFIG_MTK_COMBO_CHIP)),)
197$(MODULE_NAME)-objs += common_main/platform/$(MTK_PLATFORM).o
198endif
199
200#$(MODULE_NAME)-objs += common_main/platform/wmt_plat_stub.o
201$(MODULE_NAME)-objs += common_main/platform/wmt_plat_alps.o
202$(MODULE_NAME)-objs += common_main/platform/mtk_wcn_consys_hw.o
203$(MODULE_NAME)-objs += common_main/platform/mtk_wcn_cmb_hw.o
204
205$(MODULE_NAME)-objs += common_main/core/wmt_ic_6628.o
206$(MODULE_NAME)-objs += common_main/core/wmt_conf.o
207$(MODULE_NAME)-objs += common_main/core/stp_core.o
208$(MODULE_NAME)-objs += common_main/core/wmt_ctrl.o
209$(MODULE_NAME)-objs += common_main/core/wmt_func.o
210$(MODULE_NAME)-objs += common_main/core/wmt_core.o
211$(MODULE_NAME)-objs += common_main/core/psm_core.o
212$(MODULE_NAME)-objs += common_main/core/wmt_ic_soc.o
213$(MODULE_NAME)-objs += common_main/core/wmt_lib.o
214$(MODULE_NAME)-objs += common_main/core/wmt_ic_6620.o
215$(MODULE_NAME)-objs += common_main/core/stp_exp.o
216$(MODULE_NAME)-objs += common_main/core/wmt_ic_6632.o
217$(MODULE_NAME)-objs += common_main/core/wmt_exp.o
218$(MODULE_NAME)-objs += common_main/core/btm_core.o
219$(MODULE_NAME)-objs += common_main/core/wmt_ic_6630.o
220
221$(MODULE_NAME)-objs += common_main/linux/hif_sdio.o
222$(MODULE_NAME)-objs += common_main/linux/stp_dbg_soc.o
223$(MODULE_NAME)-objs += common_main/linux/stp_dbg_combo.o
224$(MODULE_NAME)-objs += common_main/linux/osal.o
225$(MODULE_NAME)-objs += common_main/linux/wmt_dev.o
226$(MODULE_NAME)-objs += common_main/linux/stp_sdio.o
227$(MODULE_NAME)-objs += common_main/linux/bgw_desense.o
228$(MODULE_NAME)-objs += common_main/linux/wmt_idc.o
229$(MODULE_NAME)-objs += common_main/linux/stp_uart.o
230$(MODULE_NAME)-objs += common_main/linux/wmt_dbg.o
231$(MODULE_NAME)-objs += common_main/linux/stp_dbg.o
232ifneq ($(CONFIG_MTK_CONNSYS_DEDICATED_LOG_PATH),)
233$(MODULE_NAME)-objs += common_main/linux/fw_log_wmt.o
234endif
235$(MODULE_NAME)-objs += common_main/linux/wmt_step.o
236
237ifeq ($(CONFIG_MTK_BTIF), y)
238$(MODULE_NAME)-objs += common_main/linux/stp_btif.o
239endif
240
241$(MODULE_NAME)-objs += debug_utility/ring.o
242$(MODULE_NAME)-objs += debug_utility/ring_emi.o
243$(MODULE_NAME)-objs += debug_utility/connsys_debug_utility.o
244###############################################################################
245# test
246###############################################################################
247ifeq ($(TARGET_BUILD_VARIANT),eng)
248ccflags-y += -I$(src)/test/include
249endif
250
251ifeq ($(TARGET_BUILD_VARIANT),eng)
252$(MODULE_NAME)-objs += test/wmt_step_test.o
253endif
254
255endif