[Feature][ZXW-237]merge P54U03 version

Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: Id39ef8b992af691eab09c01d4ea26da89e5f4049
diff --git a/boot/common/src/uboot/board/zte/zx297520v3/zx297520v3_vehicle_dc_ref.c b/boot/common/src/uboot/board/zte/zx297520v3/zx297520v3_vehicle_dc_ref.c
index 30e4518..27dfc10 100755
--- a/boot/common/src/uboot/board/zte/zx297520v3/zx297520v3_vehicle_dc_ref.c
+++ b/boot/common/src/uboot/board/zte/zx297520v3/zx297520v3_vehicle_dc_ref.c
@@ -1146,7 +1146,9 @@
 	default:
 		break;
 	}
-
+#ifdef CONFIG_CTRL_X_SWTCH_UART
+	serial_getc_cons_key_flag(100,50);
+#endif
 	add_partition_to_bootargs();
 	for (;;)
 	{
diff --git a/boot/common/src/uboot/drivers/mtd/partition/partition.c b/boot/common/src/uboot/drivers/mtd/partition/partition.c
index 7b200e6..89105cc 100755
--- a/boot/common/src/uboot/drivers/mtd/partition/partition.c
+++ b/boot/common/src/uboot/drivers/mtd/partition/partition.c
@@ -61,8 +61,10 @@
 //#ifdef CONFIG_ZX297520V3E_MDL_AB
 #if defined(CONFIG_ZX297520V3E_MDL_AB) || defined(CONFIG_ZX297520V3E_VEHICLE_DC) || defined(CONFIG_ZX297520V3E_VEHICLE_DC_REF)
 extern int imagefs_flag;
+#ifdef CONFIG_CTRL_X_SWTCH_UART
+bool g_flg_ctrl_x = true;
 #endif
-
+#endif
 unsigned char key_hash[128] = {0};
 unsigned char *bin2hex(const unsigned char *old, const size_t oldlen)
 {
@@ -117,8 +119,16 @@
 	}
 	
 	/* console=ttyS1,115200 no_console_suspend */
+	#ifdef CONFIG_CTRL_X_SWTCH_UART
+	if(!g_flg_ctrl_x){
+		sprintf((char *)bootargs_cmd, " ");
+		sprintf((char *)bootargs_cmd_cap, "console=ttyS3,921600n8 earlycon no_console_suspend ");
+	}else
+	#endif	
+	{
 	sprintf((char *)bootargs_cmd, "console=ttyS1,921600 no_console_suspend ");
     sprintf((char *)bootargs_cmd_cap, "console=ttyS1,921600n8 earlycon no_console_suspend ");
+	}
 
 	if(g_nor_flag == 1)
 	{
diff --git a/boot/common/src/uboot/drivers/serial/uart.c b/boot/common/src/uboot/drivers/serial/uart.c
old mode 100644
new mode 100755
index 2118369..c5eb337
--- a/boot/common/src/uboot/drivers/serial/uart.c
+++ b/boot/common/src/uboot/drivers/serial/uart.c
@@ -171,6 +171,36 @@
 }
 
 
+#ifdef CONFIG_CTRL_X_SWTCH_UART
+extern bool g_flg_ctrl_x;
+void serial_getc_cons_key_flag(unsigned long us,unsigned int wait)
+{
+	int c1,c2;
+	static int cnt_wait = 0;
+	while(1)
+	{
+		if((__REG(UART_FR) & UART_RXFE) == 0)
+			c1 = (__REG(UART_DR) & 0xff);
+		udelay(us);
+		if((__REG(UART_FR) & UART_RXFE) == 0)
+			c2 = (__REG(UART_DR) & 0xff);
+		if((c1 == c2) && (c1 == 24)){
+			g_flg_ctrl_x = false;
+			debug("ctrk+x:get.\n");
+			return 1;
+		}
+		if(cnt_wait > wait){
+			debug("ctrk+x:not get.\n");
+			g_flg_ctrl_x = true;
+			cnt_wait = 0;
+			return 0;
+		}else{
+			cnt_wait++;
+		}
+	}
+	return 0;	
+}
+#endif
 #ifdef CONFIG_HWFLOW
 static int hwflow = 0; /* turned off by default */
 int hwflow_onoff(int on)