[Feature][ZXW-130]merge P50U02 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: I4f29ec5bb7c59385f23738d2b7ca84e67c100f69
diff --git a/boot/common/src/uboot/include/boot_mode.h b/boot/common/src/uboot/include/boot_mode.h
old mode 100644
new mode 100755
index d1fdc26..6d8ea1a
--- a/boot/common/src/uboot/include/boot_mode.h
+++ b/boot/common/src/uboot/include/boot_mode.h
@@ -7,6 +7,8 @@
 #ifndef __BOOT_MODE__
 #define __BOOT_MODE__
 
+extern unsigned char g_nor_flag;
+
 typedef enum
 {
 	TLOAD_MODE = 1,
diff --git a/boot/common/src/uboot/include/configs/zx297520v3.h b/boot/common/src/uboot/include/configs/zx297520v3.h
index e218408..ea771fa 100755
--- a/boot/common/src/uboot/include/configs/zx297520v3.h
+++ b/boot/common/src/uboot/include/configs/zx297520v3.h
@@ -131,6 +131,7 @@
 #define CONFIG_SYS_SDRAM_IMAGEFS_BASE	0x25000000
 #define CONFIG_SYS_SDRAM_IMAGEFS_END	0x27000000
 #define CONFIG_SYS_SDRAM_IMAGEFS_SIZE	(CONFIG_SYS_SDRAM_IMAGEFS_END - CONFIG_SYS_SDRAM_IMAGEFS_BASE)
+
 #else
 #define PHYS_SDRAM_1_SIZE	        	0x02000000     	/* 32MB */
 #define CONFIG_SYS_SDRAM_SIZE	    	0x02000000	   	/* 32MB in DDR */
@@ -141,6 +142,7 @@
 
 #define CONFIG_SYS_SDRAM_TEMP_BASE		0x21400000  	/* ddrÊý¾Ý°æ±¾ÁÙʱ»º´æµØÖ· */
 #define CONFIG_SYS_SDRAM_TEMP_LZMA  	0X21600000  	/* »º´æµØÖ·£¬ÓÃÓÚ½âѹ°æ±¾Ê±Ê¹Óà */
+#define CONFIG_SYS_SDRAM_ROOTFS_BASE	0x25000000
 
 #define CONFIG_SYS_SDRAM_UPDATE_ALIGNED_OFFSET	0x5000000 	/* 80MB for LocalUpdate Use. */
 
diff --git a/boot/common/src/uboot/include/linux/mtd/nand.h b/boot/common/src/uboot/include/linux/mtd/nand.h
index efdfb54..f1c4aa1 100755
--- a/boot/common/src/uboot/include/linux/mtd/nand.h
+++ b/boot/common/src/uboot/include/linux/mtd/nand.h
@@ -519,10 +519,11 @@
 #define NAND_MFR_ZETTA  	0xBA
 #define NAND_MFR_DOSILICON  0xE5
 #define NAND_MFR_FUDANWEI   0xA1
-#define NAND_MFR_HOSIN	   0xD6
-#define NAND_MFR_EMST			0xC8
-#define NAND_MFR_FORESEE		0xCD
+#define NAND_MFR_HOSIN	    0xD6
+#define NAND_MFR_EMST		0xC8
+#define NAND_MFR_FORESEE	0xCD
 #define NAND_MFR_XTX		0x0B
+#define NAND_MFR_UNIM		0xB0
 
 
 #define NAND_DEVID_GD5F1GQ5R_1G 0x41
diff --git a/boot/common/src/uboot/include/linux/mtd/spi-nor.h b/boot/common/src/uboot/include/linux/mtd/spi-nor.h
index b3cef24..310dbb1 100755
--- a/boot/common/src/uboot/include/linux/mtd/spi-nor.h
+++ b/boot/common/src/uboot/include/linux/mtd/spi-nor.h
@@ -191,8 +191,14 @@
 	void (*write)(struct spi_nor *nor, loff_t to,
 			size_t len, size_t *retlen, const u_char *write_buf);
 	int (*erase)(struct spi_nor *nor, loff_t offs);
-
-	int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
+	
+    int (*read_security_register)(struct spi_nor *nor, loff_t from,
+			size_t len, size_t *retlen, u_char *read_buf);
+	void (*write_security_register)(struct spi_nor *nor, loff_t to,
+			size_t len, size_t *retlen, const u_char *write_buf);
+	int (*erase_security_register)(struct spi_nor *nor, loff_t offs);
+	
+	int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len);	
 	int (*flash_unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
 	int (*flash_is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len);
 
diff --git a/boot/common/src/uboot/include/secure_verify.h b/boot/common/src/uboot/include/secure_verify.h
old mode 100644
new mode 100755
index 34c2ce5..2132a03
--- a/boot/common/src/uboot/include/secure_verify.h
+++ b/boot/common/src/uboot/include/secure_verify.h
@@ -51,6 +51,13 @@
 	u32		dev_id[3];	
 } efuse_struct;
 
+typedef volatile struct
+{
+	u32		secure_flag;
+	u32		puk_hash[8];
+	u32		dev_id[3];	
+} otp_struct;
+
 typedef struct
 {
 	u32 uiPubKeyRsaE[32];
@@ -58,9 +65,24 @@
 	u32 uiHashY[32];
 } sImageHeader;
 
+typedef struct
+{
+	uint16_t   signtype;
+    uint16_t   hashtype;   
+	uint32_t   uiPubKeyRsaELen;
+	uint32_t   uiPubKeyRsaNLen;
+	uint8_t    uiPubKeyRsaE[4];
+	uint8_t    uiPubKeyRsaN[256];
+	uint8_t    reserve[112]; //380 bytes
+    uint8_t    uiHashY[256];    //256 bytes
+} sImageNewHeader;
+
+extern otp_struct otpInfo;
+
 static void get_efuse_data(void);
 static u32 SMALL2BIG(u32 *puiArrIn, u32 *puiArrOut, u32 uiLen);
 u8 secure_verify(u32 addr);
+u8 rootfs_secure_verify(u32 addr);
 static u8 data_cmp_word(u32* src, u32* dst, u32 cnt);
 int efuse_init(void);
 void efuse_get_devinfo(efuse_struct *efuse_info);