[Feature][T108][system][task-view-1640]optimize sdk boot time

Only Configure: No
Affected branch: GSW_V1453
Affected module: sys
Is it affected on IC: only ASR
Self-test: yes
Doc Update: no

Change-Id: Ifdb7019430a2ec751cfb931ef034a107019afe28
diff --git a/build.sh b/build.sh
index 712b03b..8346703 100755
--- a/build.sh
+++ b/build.sh
@@ -184,9 +184,12 @@
 			ln -s ../init.d/mbtk_logd S13mbtk_logd
 		fi
 
-		if [ ! -f S20gsw_start -a -f ../init.d/gsw_start ];then
-			ln -s ../init.d/gsw_start S20gsw_start
+		if [ ! -f S12gsw_start -a -f ../init.d/gsw_start ];then
+			ln -s ../init.d/gsw_start S12gsw_start
 		fi
+		mv S10adbd S13adbd
+		mv S10dnsmasq S13dnsmasq
+		mv S10sdcard_mount S20sdcard_mount
 
 		cd $CUR_PWD
 
diff --git a/config/defconfig_asr1806p301 b/config/defconfig_asr1806p301
index 28777e4..29e61fb 100755
--- a/config/defconfig_asr1806p301
+++ b/config/defconfig_asr1806p301
@@ -120,7 +120,7 @@
 # CONFIG_QSPINAND_64M is not set
 # CONFIG_MODULE_BUILDIN is not set
 # CONFIG_CAMERA is not set
-# CONFIG_UART_921600 is not set
+CONFIG_UART_921600=y
 # CONFIG_DAILY is not set
 # CONFIG_DSDS is not set
 # CONFIG_JSON_OVERVIEW_IMAGE_INFO is not set
diff --git a/marvell/lte-telephony/apps/diag/diag_config.c b/marvell/lte-telephony/apps/diag/diag_config.c
index 7f88097..569ede1 100644
--- a/marvell/lte-telephony/apps/diag/diag_config.c
+++ b/marvell/lte-telephony/apps/diag/diag_config.c
@@ -259,7 +259,7 @@
 	if(!ret)
 		mrvl_add_comment(pRoot, "SystemSettings/silent_type", "Diag Silent Type: 0-off, 1-on (default)");
 
-    if(1)//diag_get_cplog_type())
+    if(diag_get_cplog_type())
     {
         config->sys_settings.silent_type = DiagSilentOn;
     }
diff --git a/marvell/obm/Common/Misc/asr_flag.c b/marvell/obm/Common/Misc/asr_flag.c
index f905862..e7a8df7 100755
--- a/marvell/obm/Common/Misc/asr_flag.c
+++ b/marvell/obm/Common/Misc/asr_flag.c
@@ -487,7 +487,7 @@
 	pFOTA_T->eehP[1] = 2;

 

 	pFOTA_T->ramdump[0] = RAMDUMPID;

-	pFOTA_T->ramdump[1] = 1;

+	pFOTA_T->ramdump[1] = 0;

     

     pFOTA_T->cplog[0] = CPLOGID;

     pFOTA_T->cplog[1] = 1;

@@ -642,4 +642,4 @@
 	}

 

 	return FALSE;

-}
\ No newline at end of file
+}

diff --git a/marvell/obm/Loader/Main/BootLoader.c b/marvell/obm/Loader/Main/BootLoader.c
index c6cf924..1ab6110 100755
--- a/marvell/obm/Loader/Main/BootLoader.c
+++ b/marvell/obm/Loader/Main/BootLoader.c
@@ -781,16 +781,7 @@
 			}
 			OBMNODL_RST_FLAG= 0;
 		} else {
-			UINT_T DlFlag = BU_REG_READ(OBMDL_DDR_ADDRES);
-			if(DlFlag == OBMDL)
-			{
-				BU_REG_WRITE(OBMDL_DDR_ADDRES, 0x0);
-				mode = UPGRADESW;
-				time_count_enable = FALSE;
-				obm_printf("[Non-Prod]Wait for download(AT)...\n\r");
-			}else {
-				obm_printf("[Non-Prod]Don't enum USB port\n\r");
-			}
+			time_count_enable = TRUE;
 		}
 		return mode;
 	}
diff --git a/marvell/uboot/common/main.c b/marvell/uboot/common/main.c
index 7a21fda..9f64a2f 100644
--- a/marvell/uboot/common/main.c
+++ b/marvell/uboot/common/main.c
@@ -341,7 +341,8 @@
 #endif /* CONFIG_BOOTCOUNT_LIMIT */
 
 	s = getenv ("bootdelay");
-	bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
+	//bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
+	bootdelay = 0;
 
 #ifdef CONFIG_OF_CONTROL
 	bootdelay = fdtdec_get_config_int(gd->fdt_blob, "bootdelay",
@@ -392,7 +393,8 @@
 
 	debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
 
-	if (bootdelay != -1 && s && !abortboot(bootdelay)) {
+	//if (bootdelay != -1 && s && !abortboot(bootdelay)) {
+	if (bootdelay != -1 && s) {
 #if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
 		int prev = disable_ctrlc(1);	/* disable Control C checking */
 #endif
diff --git a/mbtk/libgsw_lib/gsw_pm_interface.c b/mbtk/libgsw_lib/gsw_pm_interface.c
index f16b5da..0d1aec4 100755
--- a/mbtk/libgsw_lib/gsw_pm_interface.c
+++ b/mbtk/libgsw_lib/gsw_pm_interface.c
@@ -13,6 +13,7 @@
 #include <sys/ioctl.h>

 #include <dlfcn.h>

 #include <stdint.h>

+#include <sys/time.h>

 #include "gsw_pm_interface.h"

 

 #ifndef LOG_ERR_LEVEL

@@ -105,6 +106,11 @@
     

 

 #define LOCK_MAX_SIZE 129

+#define SDK_READY_CMD "uci get persist.mbtk.sdk__state"

+#define CHECK_SYSTEM(cmd) do { \

+    int _ret = system(cmd); \

+    if (_ret == -1) perror("system error"); \

+} while(0)

 typedef void (*GSW_PM_WAKEUPCALLBACK)(int32_t wakeup_in);

 typedef void (*mbtk_lpm_handler_t)(int32_t wakeup_in);

 typedef void (*mbtk_log)(int level, const char *format,...);

@@ -128,6 +134,42 @@
 static void *dlHandle_sleep = NULL;

 char *lynqLib_sleep = "/lib/libmbtk_lib.so";

 

+//0 success,1 timeout,the timeout is 60s

+static int wait_sdk_ready()

+{

+    char buffer[8] = {0};

+    int sdk_value = -1;

+    int timeout = 0;

+    const char *s_kmsg = "echo \"check_sdk_ready ready\" > /dev/kmsg";

+    const char *f_kmsg = "echo \"check_sdk_ready timeout\" > /dev/kmsg";

+    while(timeout < 500)   // ~= 60s

+    {

+        timeout++;

+        FILE *fp = popen(SDK_READY_CMD, "r");

+        if(NULL == fp)

+        {

+            continue;

+        }

+        memset(buffer,0,sizeof(buffer));

+        if(fgets(buffer, sizeof(buffer), fp) == NULL)

+        {

+            pclose(fp);

+            perror("fgets failed:");

+            continue;

+        }

+        pclose(fp);

+        printf("gsw wait_sdk_ready:%s",buffer);

+        sdk_value = atoi(buffer);

+        if(sdk_value == 0)  //sdk ready

+        {

+           CHECK_SYSTEM(s_kmsg);

+           return 0;

+        }

+        usleep(1000*100);//100ms

+    }

+    CHECK_SYSTEM(f_kmsg);

+    return 1;

+}

 

 /**

 * @brief Enable autosleep

@@ -191,7 +233,9 @@
 */

 int32_t gsw_pm_sdk_init(GSW_PM_WAKEUPCALLBACK wakeup_callback)

 {

-    int ret;

+    int ret = 0;

+    ret = wait_sdk_ready();                 //Continue to execute even if timed out

+    printf("wait_sdk_ready ret:%d\n",ret);  //due to the LOG* can not use

     if (handle())

         return GSW_HAL_NORMAL_FAIL;

     mbtk_lpm_init=(int(*)(mbtk_lpm_handler_t))dlsym(dlHandle_sleep, "mbtk_lpm_init");

diff --git a/mbtk/rootfs/etc/init.d/gsw_start b/mbtk/rootfs/etc/init.d/gsw_start
index 3fe84d2..0fe39dd 100755
--- a/mbtk/rootfs/etc/init.d/gsw_start
+++ b/mbtk/rootfs/etc/init.d/gsw_start
@@ -1,10 +1,12 @@
 #!/bin/sh /etc/rc.common
 # Copyright (C) 2006-2011 OpenWrt.org
-START=20
+START=12
 start_service() {
         echo "gsw start--" > /dev/kmsg
         rmmod mfp #temp for gsw
 	echo 255 > /sys/class/leds/red/brightness #when start oemapp up GPIO08
+	ifconfig eth0 up
+	ifconfig eth0 mtu 1500
 	if [ -f /etc/gsw_oemapp_start.sh ]
         then
 		/etc/gsw_oemapp_start.sh &
diff --git a/package/network/services/lte-telephony/files/lte-telephony.init b/package/network/services/lte-telephony/files/lte-telephony.init
index c03dfba..797a8b1 100644
--- a/package/network/services/lte-telephony/files/lte-telephony.init
+++ b/package/network/services/lte-telephony/files/lte-telephony.init
@@ -6,7 +6,7 @@
 
 start() {
 	echo "Starting LTE-Telephony Service"
-	sleep 5
+	sleep 8
 	chmod 664 /dev/kmsg
 	mkdir -p NVM
 	export NVM_ROOT_DIR=/NVM
diff --git a/package/network/services/lte-telephony/files/telinit b/package/network/services/lte-telephony/files/telinit
index fbc3c0f..62c6cc6 100755
--- a/package/network/services/lte-telephony/files/telinit
+++ b/package/network/services/lte-telephony/files/telinit
@@ -92,7 +92,7 @@
 if [ "$PRODMODE" == "0" ]; then
 	######### user mode ########
 	/bin/rild &
-	/sbin/usb_init &
+#	/sbin/usb_init &
 
 	#Quickly start audio_if, ecall daemon & app, slic app
 	[ -e "/usr/bin/audio_if" ] && {
diff --git a/target/linux/mmp/base-files/etc/config/network b/target/linux/mmp/base-files/etc/config/network
index d7f1c82..b316ccb 100755
--- a/target/linux/mmp/base-files/etc/config/network
+++ b/target/linux/mmp/base-files/etc/config/network
@@ -185,8 +185,3 @@
 
 config interface wlan6
 	option proto    none
-
-config interface 'autowan'
-        option ifname 'eth0'
-        option proto 'none'
-        option mtu '1500'