[Feature]add MT2731_MP2_MR2_SVN388 baseline version

Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/custom_emi.c b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/custom_emi.c
new file mode 100644
index 0000000..562845d
--- /dev/null
+++ b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/custom_emi.c
@@ -0,0 +1,117 @@
+/*****************************************************************************
+*  Copyright Statement:
+*  --------------------
+*  This software is protected by Copyright and the information contained
+*  herein is confidential. The software may not be copied and the information
+*  contained herein may not be used or disclosed except with the written
+*  permission of MediaTek Inc. (C) 2008
+*
+*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ *   custom_emi.c
+ *
+ * Project:
+ * --------
+ *   Android
+ *
+ * Description:
+ * ------------
+ *   This Module defines the EMI (external memory interface) related setting.
+ *
+ * Author:
+ * -------
+ *  EMI auto generator V0.01
+ *
+ *   Memory Device database last modified on 2015/6/26
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * $Revision$
+ * $Modtime$
+ * $Log$
+ *
+ *------------------------------------------------------------------------------
+ * WARNING!!!  WARNING!!!   WARNING!!!  WARNING!!!  WARNING!!!  WARNING!!!
+ * This file is generated by EMI Auto-gen Tool.
+ * Please do not modify the content directly!
+ * It could be overwritten!
+ *============================================================================
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+#include <platform/emi.h>
+
+#define NUM_EMI_RECORD (1)
+
+int num_of_emi_records = NUM_EMI_RECORD ;
+
+EMI_SETTINGS emi_settings[] = {
+    //COMMON_DDR3_1GB
+    {
+        0x0,        /* sub_version */
+        0x0004,     /* TYPE */
+        0,      /* EMMC ID/FW ID checking length */
+        0,      /* FW length */
+        {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},      /* NAND_EMMC_ID */
+        {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},      /* FW_ID */
+        0x00003122,     /* EMI_CONA_VAL */
+        0xAA00AA00,     /* DRAMC_DRVCTL0_VAL */
+        0xAA00AA00,     /* DRAMC_DRVCTL1_VAL */
+        0x448B47B7,     /* DRAMC_ACTIM_VAL */
+        0x01000000,     /* DRAMC_GDDR3CTL1_VAL */
+        0xF07486A3,     /* DRAMC_CONF1_VAL */
+        0xB18E22C1,     /* DRAMC_DDR2CTL_VAL */
+        0xBF8D0401,     /* DRAMC_TEST2_3_VAL */
+        0x03046960,     /* DRAMC_CONF2_VAL */
+        0xD5642842,     /* DRAMC_PD_CTRL_VAL */
+        0x00008888,     /* DRAMC_PADCTL3_VAL */
+        0x88888888,     /* DRAMC_DQODLY_VAL */
+        0x00000000,     /* DRAMC_ADDR_OUTPUT_DLY */
+        0x00000000,     /* DRAMC_CLK_OUTPUT_DLY */
+        0x00000660,     /* DRAMC_ACTIM1_VAL*/
+        0x07800000,     /* DRAMC_MISCTL0_VAL*/
+        0x040000D1,     /* DRAMC_ACTIM05T_VAL*/
+        {0x40000000,0,0,0},     /* DRAM RANK SIZE */
+        {0x00000004,0,0,0,0,0,0,0,0,0},     /* reserved 10 */
+        {   {
+                0x00001D71,     /* PCDDR3_MODE_REG0 */
+                0x00002000,     /* PCDDR3_MODE_REG1 */
+                0x00004018,     /* PCDDR3_MODE_REG2 */
+                0x00006000,     /* PCDDR3_MODE_REG3 */
+                0x00000024,     /* PCDDR3_MODE_REG4 */
+                0x00000000
+            }
+        },     /* PCDDR3_MODE_REG5 */
+    },
+};
diff --git a/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/custom_emi.h b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/custom_emi.h
new file mode 100644
index 0000000..cdce2ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/custom_emi.h
@@ -0,0 +1,76 @@
+/*****************************************************************************
+*  Copyright Statement:
+*  --------------------
+*  This software is protected by Copyright and the information contained
+*  herein is confidential. The software may not be copied and the information
+*  contained herein may not be used or disclosed except with the written
+*  permission of MediaTek Inc. (C) 2008
+*
+*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ *   custom_emi.h
+ *
+ * Project:
+ * --------
+ *   Android
+ *
+ * Description:
+ * ------------
+ *   This Module defines the EMI (external memory interface) related setting.
+ *
+ * Author:
+ * -------
+ *  EMI auto generator V0.01
+ *
+ *   Memory Device database last modified on 2015/6/26
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * $Revision$
+ * $Modtime$
+ * $Log$
+ *
+ *------------------------------------------------------------------------------
+ * WARNING!!!  WARNING!!!   WARNING!!!  WARNING!!!  WARNING!!!  WARNING!!!
+ * This file is generated by EMI Auto-gen Tool.
+ * Please do not modify the content directly!
+ * It could be overwritten!
+ *============================================================================
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#pragma once
+
+#define COMBO_LPDDR2 (0+0)
+#define COMBO_LPDDR3 (0+0)
+#define COMBO_PCDDR3 (0+1)
diff --git a/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/target/cust_usb.h b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/target/cust_usb.h
new file mode 100644
index 0000000..501b4ad
--- /dev/null
+++ b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/target/cust_usb.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#define CONFIG_USBD_LANG    "0409"
+
+#define USB_VENDORID        (0x0E8D)
+#define USB_PRODUCTID       (0x201C)
+#define USB_VERSIONID       (0x0100)
+#define USB_MANUFACTURER    "MediaTek"
+#define USB_PRODUCT_NAME    "Yocto"
diff --git a/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/target/debugconfig.h b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/target/debugconfig.h
new file mode 100644
index 0000000..8f463ef
--- /dev/null
+++ b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/include/target/debugconfig.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014 Travis Geiselbrecht
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#pragma once
+
+#define DEBUG_UART 0
+
diff --git a/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/rules.mk b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/rules.mk
new file mode 100644
index 0000000..35be0a3
--- /dev/null
+++ b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/rules.mk
@@ -0,0 +1,62 @@
+LOCAL_DIR := $(GET_LOCAL_DIR)
+MODULE := ${LOCAL_DIR}
+
+GLOBAL_INCLUDES += \
+    $(LOCAL_DIR)/include
+
+MODULE_SRCS += \
+    $(LOCAL_DIR)/target.c
+
+PLATFORM := mt8516
+
+TZ_PART_NAME := TEE1
+RECOVERY_TZ_PART_NAME = TEE2
+DTBO_PART_NAME := DTBO
+BOOT_PART_NAME := BOOTIMG1
+RECOVERY_BOOT_PART_NAME = BOOTIMG2
+
+ifeq ($(WITH_KERNEL_VM),1)
+# The physical dram address is 0x40000000 and its virtual address 0xffff00000d600000
+# The SCRATCH_ADDR virtual address would be 0xffff00000d600000 + 0x4000000 = 0xffff00000f400000
+# The BL33_ADDR virtual address would be 0xffff00000d600000 + 0x1e00000 = 0xffff00000f400000
+SCRATCH_ADDR		    := 0xffff00000DC00000UL
+BL33_ADDR               := 0xffff00000f400000UL
+NAND_BUF_ADDR           := 0xffff00000fa00000UL
+else
+SCRATCH_ADDR            := 0x40600000
+BL33_ADDR               := 0x41e00000
+NAND_BUF_ADDR           := 0x42400000
+endif
+SCRATCH_SIZE		    := 0x00800000 #  64M -> 40M for max rootfs ->8M
+
+MAX_TEE_DRAM_SIZE	:= 0x00300000 # 2M ->3M
+MAX_KERNEL_SIZE		:= 0x00600000 # 12M  ->6M
+MAX_DTB_SIZE		:= 0x00200000 # 2M
+MAX_LZ4_BUF_SIZE	:= 0x00100000 # 1M
+MAX_NAND_BUF_SIZE	:= 0x00100000 # 1M
+
+# SCRATCH_ADDR + SCRATCH_SIZE for upgrade
+# SCRATCH_ADDR + MAX_TEE_DRAM_SIZE + MAX_KERNEL_SIZE
+# + MAX_DTB_SIZE + MAX_LZ4_BUF_SIZE for boot
+# NAND_BUF_ADDR + MAX_NAND_BUF_SIZE for nand reserved dram buffer
+
+GLOBAL_CFLAGS +=  -DTZ_PART_NAME=\"$(TZ_PART_NAME)\" \
+                  -DDTBO_PART_NAME=\"$(DTBO_PART_NAME)\" \
+                  -DBOOT_PART_NAME=\"$(BOOT_PART_NAME)\" \
+                  -DRECOVERY_BOOT_PART_NAME=\"$(RECOVERY_BOOT_PART_NAME)\" \
+                  -DRECOVERY_TZ_PART_NAME=\"$(RECOVERY_TZ_PART_NAME)\" \
+
+GLOBAL_DEFINES += SCRATCH_SIZE=$(SCRATCH_SIZE) \
+                  SCRATCH_ADDR=$(SCRATCH_ADDR) \
+                  BL33_ADDR=$(BL33_ADDR) \
+                  MAX_TEE_DRAM_SIZE=$(MAX_TEE_DRAM_SIZE) \
+                  MAX_KERNEL_SIZE=$(MAX_KERNEL_SIZE) \
+                  MAX_DTB_SIZE=$(MAX_DTB_SIZE) \
+                  MAX_LZ4_BUF_SIZE=$(MAX_LZ4_BUF_SIZE) \
+                  NAND_BUF_ADDR=$(NAND_BUF_ADDR) \
+                  MAX_NAND_BUF_SIZE=$(MAX_NAND_BUF_SIZE)
+
+MODULE_DEPS += \
+    platform/$(PLATFORM)/drivers/nand \
+
+include make/module.mk
diff --git a/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/target.c b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/target.c
new file mode 100644
index 0000000..a47315d
--- /dev/null
+++ b/src/bsp/lk/target/aud8516p1v1-slc-32b-gva-user/target.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <platform/nand.h>
+#include "platform/led.h"
+
+void target_init(void)
+{
+    nand_init_device();
+    led_init();
+}
+