blob: 88575c133f211dad50217a9af6494fd7f0462fa1 [file] [log] [blame]
# Makefile for MT76x8 combo driver
##############################################################
# Common settings
##############################################################
export MTK_COMBO_CHIP=MT6632
export HIF=usb
export CONFIG_MTK_WIFI_ONLY=m
export CONFIG_MTK_COMBO=m
export CONFIG_MTK_COMBO_WIFI=m
export CONFIG_MTK_COMBO_COMM=m
export CONFIG_MTK_COMBO_COMM_UART=m
export CONFIG_MTK_COMBO_COMM_SDIO=m
export CONFIG_MT_WIFI_CHRDEV=m
WLAN_CHIP_ID := mt7668
ifeq ($(DRIVER_DIR),)
PWD=$(shell pwd)
DRIVER_DIR=$(PWD)
endif
ifeq ($(HIF),)
HIF=usb
endif
export CONFIG_MTK_COMBO_WIFI_HIF=$(HIF)
MODULE_NAME := wlan_$(WLAN_CHIP_ID)_$(HIF)
export CONFIG_MTK_PREALLOC_MEMORY=n
##############################################################
# Platform specific
##############################################################
# Set default platform
PLATFORM:=MT53XX
ifeq ($(PLATFORM),)
PLATFORM=MT53XX
endif
#= = = = = = = = = = = = = = = = = = = = = = = = = = = =
# MT53XX start
#- - - - - - - - - - - - - - - - - - - - - - - - - - - -
ifeq ($(PLATFORM),MT53XX)
TARGET = LINUX
# Sets DRIVER_PARTIAL_BUILD to y to compile driver only, otherwise set to n
DRIVER_PARTIAL_BUILD := n
ANDROID=true
#
# [ Driver Partial Build ]
#
ifeq ($(DRIVER_PARTIAL_BUILD),y)
# Please adjust the following variables according to your build attempt
ifeq ($(ANDROID),)
ANDROID=false
endif
64BIT_MODE := false
LINUX_ROOT ?= $(word 1, $(subst /apollo/,/apollo /, $(shell pwd -L)))
ifeq ($(ANDROID),true)
# -> Android, driver partial build
SYSBUILD_NAME=m-base
RELEASE_NAME=mediatek/mt5891_eu_64
KERNEL_VER=3.18
KERNEL_CONFIG=mt5891_android_smp_mod_defconfig
ifeq ($(64BIT_MODE),true)
export 64BIT_MODE=true
export KERNEL_64BIT=true
export TOOL_CHAIN_64BIT=4.9.3
endif
LINUX_SRC=$(LINUX_ROOT)/../android/$(SYSBUILD_NAME)/out/mediatek_linux/output/$(RELEASE_NAME)/rel/obj/kernel/linux_core/kernel/linux-$(KERNEL_VER)/$(KERNEL_CONFIG)_modules
OBJ_ROOT ?= $(LINUX_ROOT)/../android/$(SYSBUILD_NAME)/out/mediatek_linux/output/$(RELEASE_NAME)/rel/obj
export KERNEL_OBJ_ROOT=$(LINUX_SRC)/../..
else
# -> Linux, driver partial build
# !NOTE! Edit the following parameters!
SYSBUILD_NAME := sys_build/XXXX
RELEASE_NAME=mt5891_eu
KERNEL_VER=3.10?
KERNEL_CONFIG=mt5891_smp_mod_defconfig
ifeq ($(64BIT_MODE),true)
export 64BIT_MODE=true
export KERNEL_64BIT=true
export TOOL_CHAIN_64BIT=4.9.3
endif
LINUX_SRC=$(LINUX_ROOT)/$(SYSBUILD_NAME)/$(RELEASE_NAME)/rel_obj/kernel/linux_core/kernel/linux-$(KERNEL_VER)/$(KERNEL_CONFIG)_modules
OBJ_ROOT := $(LINUX_ROOT)/$(SYSBUILD_NAME)/$(RELEASE_NAME)/rel_obj
export KERNEL_OBJ_ROOT=$(LINUX_SRC)/../..
CROSS_COMPILE=/mtkoss/gnuarm/neon_4.8.2_2.6.35_cortex-a9-ubuntu/i686/bin/armv7a-mediatek482_001_neon-linux-gnueabi-
endif
#
# [ Sys build ]
#
else
LINUX_SRC=$(KERNEL_OBJ_ROOT)/$(KERNEL_VER)/$(KERNEL_CONFIG)_modules
# overwrite $(OUT_STA_KO) for MT53XX platform
OUT_STA_KO = $(OBJ_ROOT)/third_party/source/wlan/mtk/$(WLAN_CHIP_ID)/$(MODULE_NAME).ko
include $(LINUX_ROOT)/linux_mts/mak/toolchain.mak
endif
ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE=/mtkoss/gnuarm/vfp_4.5.1_2.6.27_cortex-a9-rhel4/i686/bin/armv7a-mediatek451_001_vfp-linux-gnueabi-
endif
ifeq "$(CC)" "gcc"
CC ?= $(CROSS_COMPILE)gcc
endif
$(warning =============================================)
$(warning wifi driver LINUX_SRC=$(LINUX_SRC))
$(warning CROSS_COMPILE=$(CROSS_COMPILE))
$(warning KERNEL_CROSS_COMPILE=$(KERNEL_CROSS_COMPILE))
$(warning =============================================)
endif
#- - - - - - - - - - - - - - - - - - - - - - - - - - - -
# MT53XX end
#= = = = = = = = = = = = = = = = = = = = = = = = = = = =
##############################################################
# Compile options
##############################################################
#/***** Common part ******/
# Define maximum different channels supported for ieee80211_iface_combination setting.
CFG_NUM_DIFFERENT_CHANNELS_STA=1
CFG_NUM_DIFFERENT_CHANNELS_P2P=1
# Define initial driver running mode.
# 0=RUNNING_P2P_MODE, 1=RUNNING_AP_MODE, 2=RUNNING_DUAL_AP_MODE, 3=RUNNING_P2P_AP_MODE
CFG_DRIVER_INITIAL_RUNNING_MODE=3
# Define to enable Android wake_lock
CFG_ENABLE_WAKE_LOCK=0
# For wpa_supplicant w/o MTK priv lib
# y: enable, n: disable
CFG_ANDROID_AOSP_PRIV_CMD=n
CFG_DEFAULT_DBG_LEVEL=0xF
CFG_TX_DIRECT_USB=1
CFG_RX_DIRECT_USB=1
CFG_USB_REQ_TX_DATA_FFA_CNT=6
CFG_USB_REQ_TX_DATA_CNT=2
CFG_USB_REQ_RX_DATA_CNT=4
CFG_ENABLE_EFUSE_MAC_ADDR=1
#CFG_SUPPORT_SINGLE_SKU_LOCAL_DB=0
#CFG_SUPPORT_DFS_MASTER=1
CFG_SCAN_CHANNEL_SPECIFIED=1
CFG_SUPPORT_ROAMING=0
# Report all bss networks to cfg80211 when do p2p scan
CFG_P2P_SCAN_REPORT_ALL_BSS=0
# Support to change sta, p2p, ap interface names
# y: enable, n: disable
# eg. insmod wlan_mt7668_usb.ko sta=wlan p2p=p2p ap=ap
CFG_DRIVER_INF_NAME_CHANGE=n
CFG_CHIP_RESET_SUPPORT=0
# 1: Enable SDIO RX Tasklet De-Aggregation
# 0: Disable (default)
CFG_SDIO_RX_AGG_TASKLET=0
#/***** Platform dependent part ******/
ifeq ($(PLATFORM),MT53XX)
CFG_DRIVER_INITIAL_RUNNING_MODE=0
CFG_SUPPORT_SINGLE_SKU_LOCAL_DB=0
endif
ifeq ($(WOW_WAKE_UP), 1)
PLATFORM_FLAGS += -DCFG_USE_LINUX_GPIO_GLUE=1
endif
#/***** Manage configs into compile options ******/
ifneq ($(CFG_NUM_DIFFERENT_CHANNELS_STA),)
PLATFORM_FLAGS += -DCFG_NUM_DIFFERENT_CHANNELS_STA=$(CFG_NUM_DIFFERENT_CHANNELS_STA)
endif
ifneq ($(CFG_NUM_DIFFERENT_CHANNELS_P2P),)
PLATFORM_FLAGS += -DCFG_NUM_DIFFERENT_CHANNELS_P2P=$(CFG_NUM_DIFFERENT_CHANNELS_P2P)
endif
ifneq ($(CFG_DRIVER_INITIAL_RUNNING_MODE),)
PLATFORM_FLAGS += -DCFG_DRIVER_INITIAL_RUNNING_MODE=$(CFG_DRIVER_INITIAL_RUNNING_MODE)
endif
ifneq ($(CFG_ENABLE_WAKE_LOCK),)
PLATFORM_FLAGS += -DCFG_ENABLE_WAKE_LOCK=$(CFG_ENABLE_WAKE_LOCK)
endif
ifneq ($(CFG_DEFAULT_DBG_LEVEL),)
PLATFORM_FLAGS += -DCFG_DEFAULT_DBG_LEVEL=$(CFG_DEFAULT_DBG_LEVEL)
endif
ifneq ($(CFG_TX_DIRECT_USB),)
PLATFORM_FLAGS += -DCFG_TX_DIRECT_USB=$(CFG_TX_DIRECT_USB)
endif
ifneq ($(CFG_RX_DIRECT_USB),)
PLATFORM_FLAGS += -DCFG_RX_DIRECT_USB=$(CFG_RX_DIRECT_USB)
endif
ifneq ($(CFG_USB_REQ_TX_DATA_FFA_CNT),)
PLATFORM_FLAGS += -DCFG_USB_REQ_TX_DATA_FFA_CNT=$(CFG_USB_REQ_TX_DATA_FFA_CNT)
endif
ifneq ($(CFG_USB_REQ_TX_DATA_CNT),)
PLATFORM_FLAGS += -DCFG_USB_REQ_TX_DATA_CNT=$(CFG_USB_REQ_TX_DATA_CNT)
endif
ifneq ($(CFG_USB_REQ_RX_DATA_CNT),)
PLATFORM_FLAGS += -DCFG_USB_REQ_RX_DATA_CNT=$(CFG_USB_REQ_RX_DATA_CNT)
endif
ifneq ($(CFG_SUPPORT_ROAMING),)
PLATFORM_FLAGS += -DCFG_SUPPORT_ROAMING=$(CFG_SUPPORT_ROAMING)
endif
ifneq ($(CFG_ENABLE_EFUSE_MAC_ADDR),)
PLATFORM_FLAGS += -DCFG_ENABLE_EFUSE_MAC_ADDR=$(CFG_ENABLE_EFUSE_MAC_ADDR)
endif
ifeq ($(CFG_DRIVER_INF_NAME_CHANGE), y)
PLATFORM_FLAGS += -DCFG_DRIVER_INF_NAME_CHANGE
endif
ifeq ($(CFG_ANDROID_AOSP_PRIV_CMD), y)
PLATFORM_FLAGS += -DCFG_ANDROID_AOSP_PRIV_CMD
endif
ifneq ($(CFG_SUPPORT_SINGLE_SKU_LOCAL_DB),)
PLATFORM_FLAGS += -DCFG_SUPPORT_SINGLE_SKU_LOCAL_DB=$(CFG_SUPPORT_SINGLE_SKU_LOCAL_DB)
endif
ifneq ($(CFG_SUPPORT_DFS_MASTER),)
PLATFORM_FLAGS += -DCFG_SUPPORT_DFS_MASTER=$(CFG_SUPPORT_DFS_MASTER)
endif
ifneq ($(CFG_P2P_SCAN_REPORT_ALL_BSS),)
PLATFORM_FLAGS += -DCFG_P2P_SCAN_REPORT_ALL_BSS=$(CFG_P2P_SCAN_REPORT_ALL_BSS)
endif
ifneq ($(CFG_SCAN_CHANNEL_SPECIFIED),)
PLATFORM_FLAGS += -DCFG_SCAN_CHANNEL_SPECIFIED=$(CFG_SCAN_CHANNEL_SPECIFIED)
endif
ifneq ($(CFG_CHIP_RESET_SUPPORT),)
PLATFORM_FLAGS += -DCFG_CHIP_RESET_SUPPORT=$(CFG_CHIP_RESET_SUPPORT)
endif
ifneq ($(CFG_SDIO_RX_AGG_TASKLET),)
PLATFORM_FLAGS += -DCFG_SDIO_RX_AGG_TASKLET=$(CFG_SDIO_RX_AGG_TASKLET)
endif
##############################################################
# Compile settings
##############################################################
all: driver
driver:
+cd $(DRIVER_DIR) && make -C $(LINUX_SRC) M=$(DRIVER_DIR) PLATFORM_FLAGS="$(PLATFORM_FLAGS)" WLAN_CHIP_ID=$(WLAN_CHIP_ID) modules
ifeq ($(PLATFORM),MT53XX)
ifeq ($(DRIVER_PARTIAL_BUILD), y)
@cd $(DRIVER_DIR) && $(CROSS_COMPILE)strip --strip-unneeded $(MODULE_NAME).ko
else
$(KERNEL_CROSS_COMPILE)strip --strip-unneeded $(OUT_STA_KO)
endif
endif
ifeq ($(PLATFORM),MT8516)
@cd $(DRIVER_DIR) && $(CROSS_COMPILE)strip --strip-unneeded $(MODULE_NAME).ko
endif
##############################################################
# Post processing
##############################################################
#= = = = = = = = = = = = = = = = = = = = = = = = = = = =
# MT53XX start
#- - - - - - - - - - - - - - - - - - - - - - - - - - - -
ifeq ($(PLATFORM),MT53XX)
ifneq ($(DRIVER_PARTIAL_BUILD), y)
ifneq ($(ANDROID),true)
if [ ! -d $(THIRDPARTY_LIB_ROOT)/wlan/$(KERNEL_VER_FOR_3RD)/mtk/$(WLAN_CHIP_ID) ]; then \
mkdir -p $(THIRDPARTY_LIB_ROOT)/wlan/$(KERNEL_VER_FOR_3RD)/mtk/$(WLAN_CHIP_ID)/; \
fi
cp -f $(OBJ_ROOT)/third_party/source/wlan/mtk/$(WLAN_CHIP_ID)/$(MODULE_NAME).ko $(THIRDPARTY_LIB_ROOT)/wlan/$(KERNEL_VER_FOR_3RD)/mtk/$(WLAN_CHIP_ID)/$(MODULE_NAME).ko
else
ifeq "$(BUILD_CFG)" "debug"
echo "ANDROID_VERSION=$(ANDROID_VERSION)"
if [ ! -d $(LINUX_ROOT)/../android/$(ANDROID_VERSION)/vendor/mediatek/open/hardware/prebuilt/wifi/$(ANDROID_IC_SETTING)/dbg ]; then \
mkdir -p $(LINUX_ROOT)/../android/$(ANDROID_VERSION)/vendor/mediatek/open/hardware/prebuilt/wifi/$(ANDROID_IC_SETTING)/dbg; \
fi
cp -f $(OBJ_ROOT)/third_party/source/wlan/mtk/$(WLAN_CHIP_ID)/$(MODULE_NAME).ko $(LINUX_ROOT)/../android/$(ANDROID_VERSION)/vendor/mediatek/open/hardware/prebuilt/wifi/$(ANDROID_IC_SETTING)/dbg/$(MODULE_NAME).ko
$(CROSS_COMPILE)strip --strip-unneeded $(LINUX_ROOT)/../android/$(ANDROID_VERSION)/vendor/mediatek/open/hardware/prebuilt/wifi/$(ANDROID_IC_SETTING)/dbg/$(MODULE_NAME).ko
if [ -d $(OUTPUT_ROOT)/basic/modules ]; then \
cp -f $(OBJ_ROOT)/third_party/source/wlan/mtk/$(WLAN_CHIP_ID)/$(MODULE_NAME).ko $(OUTPUT_ROOT)/basic/modules/wlan.ko; \
$(CROSS_COMPILE)strip --strip-unneeded $(OUTPUT_ROOT)/basic/modules/wlan.ko; \
fi
else
if [ ! -d $(LINUX_ROOT)/../android/$(ANDROID_VERSION)/vendor/mediatek/open/hardware/prebuilt/wifi/$(ANDROID_IC_SETTING) ]; then \
mkdir -p $(LINUX_ROOT)/../android/$(ANDROID_VERSION)/vendor/mediatek/open/hardware/prebuilt/wifi/$(ANDROID_IC_SETTING); \
fi
cp -f $(OBJ_ROOT)/third_party/source/wlan/mtk/$(WLAN_CHIP_ID)/$(MODULE_NAME).ko $(LINUX_ROOT)/../android/$(ANDROID_VERSION)/vendor/mediatek/open/hardware/prebuilt/wifi/$(ANDROID_IC_SETTING)/$(MODULE_NAME).ko
$(CROSS_COMPILE)strip --strip-unneeded $(LINUX_ROOT)/../android/$(ANDROID_VERSION)/vendor/mediatek/open/hardware/prebuilt/wifi/$(ANDROID_IC_SETTING)/$(MODULE_NAME).ko
if [ -d $(OUTPUT_ROOT)/basic/modules ]; then \
cp -f $(OBJ_ROOT)/third_party/source/wlan/mtk/$(WLAN_CHIP_ID)/$(MODULE_NAME).ko $(OUTPUT_ROOT)/basic/modules/wlan.ko; \
$(CROSS_COMPILE)strip --strip-unneeded $(OUTPUT_ROOT)/basic/modules/wlan.ko; \
fi
endif
endif #ANDROID
endif #DRIVER_PARTIAL_BUILD
endif #MT53XX
#- - - - - - - - - - - - - - - - - - - - - - - - - - - -
# MT53XX end
#= = = = = = = = = = = = = = = = = = = = = = = = = = = =
clean: driver_clean
driver_clean:
ifneq ($(ANDROID),true)
rm -rf $(THIRDPARTY_LIB_ROOT)/wlan
endif
# cd $(DRIVER_DIR) && make -C $(LINUX_SRC) M=$(DRIVER_DIR) MODULE_NAME=$(MODULE_NAME) clean
# if [ -e $(DRIVER_DIR)/$(MODULE_NAME).ko ]; then rm $(DRIVER_DIR)/$(MODULE_NAME).ko; \
# fi
.PHONY: all clean driver driver_clean