[Feature]add MT2731_MP2_MR2_SVN388 baseline version
Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/src/bsp/lk/platform/mediatek/mt2712/rules.mk b/src/bsp/lk/platform/mediatek/mt2712/rules.mk
new file mode 100644
index 0000000..67d8a28
--- /dev/null
+++ b/src/bsp/lk/platform/mediatek/mt2712/rules.mk
@@ -0,0 +1,152 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+COMMON_PLAT := $(LOCAL_DIR)/../common
+
+ARCH ?= arm64
+ARM_CPU ?= cortex-a53
+WITH_SMP ?= 0
+WITH_KERNEL_VM ?= 1
+
+LK_HEAP_IMPLEMENTATION ?= miniheap
+
+GLOBAL_INCLUDES += -I$(LK_TOP_DIR)/include \
+
+MODULE_SRCS += \
+ $(COMMON_PLAT)/debug.c \
+ $(COMMON_PLAT)/fastboot_oem_cmd/oem_ab_cmd.c \
+ $(COMMON_PLAT)/fastboot_oem_cmd/oem_mac_cmd.c \
+ $(COMMON_PLAT)/interrupts.c \
+ $(COMMON_PLAT)/boot_mode.c \
+ $(LOCAL_DIR)/boot_mode.c \
+ $(LOCAL_DIR)/fixup/plat_fixup.c \
+ $(LOCAL_DIR)/platform.c \
+
+# check bcb (bootloader control block) for recovery mode
+BCB_RECOVERY_SUPPORT ?= 0
+
+ifeq ($(WITH_SMP),1)
+SMP_MAX_CPUS := 6 # if we need only one big core, set this to 5
+SMP_CPU_CLUSTER_SHIFT := 2
+SMP_CPU_ON_MASK ?= 0x11 # mask for which cpu to be on
+
+MODULE_SRCS += \
+ $(COMMON_PLAT)/arch/$(ARCH)/mp.c \
+ $(LOCAL_DIR)/plat_mp.c
+
+GLOBAL_DEFINES += SMP_CPU_ON_MASK=$(SMP_CPU_ON_MASK)
+endif
+
+ifeq ($(LK_AS_BL33),1)
+MODULE_SRCS += \
+ $(COMMON_PLAT)/fastboot_oem_cmd/oem_efuse_cmd.c
+endif
+
+GLOBAL_INCLUDES += \
+ $(COMMON_PLAT)/include \
+
+MACH_TYPE := 2712
+
+ifeq ($(WITH_KERNEL_VM),1)
+KERNEL_ASPACE_BASE ?= 0xfffffff000000000
+KERNEL_ASPACE_SIZE ?= 0x0000000180000000
+MMU_IDENT_SIZE_SHIFT ?= 32
+endif
+
+SCRATCH_SIZE := 0x02000000 # 32MB
+
+# mempool configuration
+ifeq ($(WITH_KERNEL_VM),1)
+CACHED_MEMPOOL_ADDR ?= 0xfffffff073800000
+CACHED_MEMPOOL_SIZE ?= 0x02800000 # 40MB
+UNCACHED_MEMPOOL_ADDR ?= 0xfffffff073600000
+UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
+BL33_ADDR ?= 0xfffffff073500000
+else
+CACHED_MEMPOOL_ADDR ?= 0 # don't care this when mmu is off
+CACHED_MEMPOOL_SIZE ?= 0
+UNCACHED_MEMPOOL_ADDR ?= 0x73600000
+UNCACHED_MEMPOOL_SIZE ?= 0x0c800000 # 200MB
+BL33_ADDR ?= 0x73500000
+endif
+
+# if DEBUG is not 0, enable debug feature
+ifneq ($(DEBUG),0)
+LOG_STORE_SUPPORT ?= 1
+endif
+
+# LK build as BL2 or BL33 setting
+LK_AS_BL33 ?= 0
+
+# CA35 FREQ:
+# CA35_FREQ_806MHZ (0.8G), CA35_FREQ_1001MHZ (1.0G), CA35_FREQ_1196MHZ (1.2G)
+CA35_FREQ ?= CA35_FREQ_1196MHZ
+
+# CA72 FREQ:
+# CA72_FREQ_1001MHZ(1.0G), CA72_FREQ_1196MHZ(1.2G), CA72_FREQ_1391MHZ(1.4G),
+# CA72_FREQ_1495MHZ(1.5G), CA72_FREQ_1599MHZ(1.6G)
+CA72_FREQ ?= CA72_FREQ_1599MHZ
+
+MODULE_DEPS += \
+ dev/interrupt/arm_gic \
+ dev/timer/arm_generic \
+ lib/bio \
+ lib/fastboot \
+ lib/fdt \
+ lib/fit \
+ lib/kcmdline \
+ lib/partition \
+ lib/mempool
+
+ifeq ($(LOG_STORE_SUPPORT),1)
+MODULE_DEPS += \
+ lib/log_store
+
+GLOBAL_DEFINES += LOG_STORE_SUPPORT=$(LOG_STORE_SUPPORT)
+endif
+
+# if BOOTAPP is not specified elsewhere, and AVB is required, choose 'avbboot'
+ifeq ($(strip $(SECURE_BOOT_ENABLE)),yes)
+ifeq ($(strip $(SECURE_BOOT_TYPE)),avb)
+BOOTAPP ?= avbboot
+endif
+endif
+
+# otherwise, choose 'fitboot'
+BOOTAPP ?= fitboot
+
+MODULES += app/$(BOOTAPP)
+
+# RTC OSC Removal
+ifeq ($(strip $(MTK_CLK32K_EXT_REMOVAL_SUPPORT)),yes)
+GLOBAL_DEFINES += MTK_CLK32K_EXT_REMOVAL_SUPPORT=1
+endif
+
+GLOBAL_DEFINES += MTK_THERMAL_RESET_SUPPORT
+
+ifeq ($(WITH_KERNEL_VM),1)
+GLOBAL_DEFINES += MMU_IDENT_SIZE_SHIFT=$(MMU_IDENT_SIZE_SHIFT)
+else
+GLOBAL_DEFINES += NOVM_MAX_ARENAS=2
+endif
+
+GLOBAL_DEFINES += \
+ RAMBASE=$(RAMBASE) \
+ MACH_TYPE=$(MACH_TYPE) \
+ PLATFORM_SUPPORTS_PANIC_SHELL=1 \
+ WITH_NO_FP=1 \
+ CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
+ CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
+ UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
+ UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
+ BL33_ADDR=$(BL33_ADDR) \
+ $(CA35_FREQ) \
+ $(CA72_FREQ) \
+ LK_AS_BL33=$(LK_AS_BL33) \
+ BCB_RECOVERY_SUPPORT=$(BCB_RECOVERY_SUPPORT)
+
+LINKER_SCRIPT += \
+ $(BUILDDIR)/system-onesegment.ld
+
+include $(LOCAL_DIR)/bl2_bl33_options.mk
+include make/module.mk $(LOCAL_DIR)/drivers/rules.mk