[Feature][ZXW-136]merge P50U04 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: I7b6a8e22777591bc7a9ede91d6695d9415116f81
diff --git a/boot/common/src/uboot/arch/arm/include/asm/arch-zx297520v3/efuse.h b/boot/common/src/uboot/arch/arm/include/asm/arch-zx297520v3/efuse.h
index 87c3e39..e84ccbd 100755
--- a/boot/common/src/uboot/arch/arm/include/asm/arch-zx297520v3/efuse.h
+++ b/boot/common/src/uboot/arch/arm/include/asm/arch-zx297520v3/efuse.h
@@ -60,4 +60,6 @@
#define ZX297520V3ECO_AZW_UNILC_512M_DDR 0x1F9801
+void efuse_get_data(void);
+
#endif /*__EFUSE_H__*/
diff --git a/boot/common/src/uboot/downloader/cmd_dl_nand.c b/boot/common/src/uboot/downloader/cmd_dl_nand.c
index 8105776..12eea2e 100755
--- a/boot/common/src/uboot/downloader/cmd_dl_nand.c
+++ b/boot/common/src/uboot/downloader/cmd_dl_nand.c
@@ -35,7 +35,7 @@
extern char *tsp_console_buffer;
extern int crc_switch_flag;
extern unsigned int null_slice_flag;
-
+extern unsigned int guiEfuseStatus;
/*******************************************************************************
* Function:do_nand_write
@@ -97,9 +97,15 @@
if(memcmp(par,"zloader",7) == 0) /* ÏÂÔØzloader·ÖÇø£¬Í¬Ê±ÏÂÔØ·ÖÇø±í */
{
#if defined (CONFIG_ZX297520V3E_VEHICLE_DC) || defined (CONFIG_ZX297520V3E_VEHICLE_DC_REF)
+ if(size > 0x2800){
memcpy((char *)(DOWNLOADER_BUFFER_BASE+0xA000),g_partition_table_dl,4096);
ret = downloader_nand_write(part, offset_par, 0x3000,
(unsigned char *)(DOWNLOADER_BUFFER_BASE+0x8000));
+ }else{
+ memcpy((char *)(DOWNLOADER_BUFFER_BASE+8192),g_partition_table_dl,4096);
+ ret = downloader_nand_write(part, offset_par, 0x3000,
+ (unsigned char *)DOWNLOADER_BUFFER_BASE);
+ }
#else
memcpy((char *)(DOWNLOADER_BUFFER_BASE+8192),g_partition_table_dl,4096);
ret = downloader_nand_write(part, offset_par, 0x3000,
@@ -281,27 +287,33 @@
return EINVAL; /* Invalid argument */
}
leftWriteLength = size;
-
- if(g_nor_flag == 1)
- {
- ret = get_nor_null_slice_flag(&null_slice_flag);
- if(ret)
- {
- printf ("nor flash read null_slice_flag error.\n");
- return 1;
- }
- }
- if(null_slice_flag == 1)
- {
- ret = downloader_nor_erase(part,part->part_size);
- if(ret)
+ if(!(g_nor_flag == 1 && guiEfuseStatus == 0)){
+
+ if(g_nor_flag == 1)
{
- sprintf(ack,"FAIL ERASE ERROR");
- downloader_serial_write(ack, strlen(ack)+1);
- return ENOSYS; /* Function not implemented */
+ ret = get_nor_null_slice_flag(&null_slice_flag);
+ if(ret)
+ {
+ printf ("nor flash read null_slice_flag error.\n");
+ return 1;
+ }
}
+
+ if(null_slice_flag == 1)
+ {
+ ret = downloader_nor_erase(part,part->part_size);
+ if(ret)
+ {
+ sprintf(ack,"FAIL ERASE ERROR");
+ downloader_serial_write(ack, strlen(ack)+1);
+ return ENOSYS; /* Function not implemented */
+ }
+
+ }
+
}
+
while(leftWriteLength>0)
{
@@ -315,9 +327,14 @@
{
if(g_nor_flag == 1)
{
- memset((char *)(DOWNLOADER_BUFFER_BASE+0x8000), 0, 4096);
- memcpy((char *)(DOWNLOADER_BUFFER_BASE+0x8000),g_partition_table_dl,4096);
- ret = downloader_nor_write( part, offset_par, 0x9000, (unsigned char *)DOWNLOADER_BUFFER_BASE);
+ if(guiEfuseStatus == 0){
+ printf("skip load ...\n");
+
+ }else{
+ memset((char *)(DOWNLOADER_BUFFER_BASE+0x8000), 0, 4096);
+ memcpy((char *)(DOWNLOADER_BUFFER_BASE+0x8000),g_partition_table_dl,4096);
+ ret = downloader_nor_write( part, offset_par, 0x9000, (unsigned char *)DOWNLOADER_BUFFER_BASE);
+ }
}
else
{
diff --git a/boot/common/src/uboot/drivers/efuse/efuse.c b/boot/common/src/uboot/drivers/efuse/efuse.c
index 96e4901..9d0937e 100755
--- a/boot/common/src/uboot/drivers/efuse/efuse.c
+++ b/boot/common/src/uboot/drivers/efuse/efuse.c
@@ -193,7 +193,7 @@
guiOtpStatus = 0; //Enable.
}
-static void efuse_get_data(void)
+void efuse_get_data(void)
{
efuse_struct *psEfuseInfo = NULL;
u32 uiLen = 0;
@@ -401,6 +401,8 @@
u32 puiArrPubKey[64] = {0};
T_Rsa_Paramter sRSAInput;
u32 *puiRsaResAddr = NULL;
+
+ if(NULL == addr)
{
BOOT_PRINTF(UBOOT_ERR, "Bad Parameter(Empty Pointer)!\n");
return -1;
diff --git a/boot/common/src/uboot/drivers/mtd/nand/nand.c b/boot/common/src/uboot/drivers/mtd/nand/nand.c
index 7abfca0..92aa855 100755
--- a/boot/common/src/uboot/drivers/mtd/nand/nand.c
+++ b/boot/common/src/uboot/drivers/mtd/nand/nand.c
@@ -49,6 +49,7 @@
struct flash_ops flash;
unsigned char g_nor_flag = 0;
+int one_flag = 0;
/*******************************************************************************
* Function:
* Description:
@@ -163,12 +164,16 @@
int i;
unsigned int size = 0;
- /*¶ÁȡоƬid*/
- if((reg32(0x0121b040)>>8) == ZX297520V3ECOGG_GW_NYC_NOR_2G_DDR
- ||(reg32(0x0121b040)>>8) == ZX297520V3ECOSC_GW_NYC_NOR_2G_DDR)
- {
- g_nor_flag = 1;
- printf("g_nor_flag is %d.\n",g_nor_flag);
+ if(one_flag == 0){
+ /*¶ÁȡоƬid*/
+ if((reg32(0x0121b040)>>8) == ZX297520V3ECOGG_GW_NYC_NOR_2G_DDR
+ ||(reg32(0x0121b040)>>8) == ZX297520V3ECOSC_GW_NYC_NOR_2G_DDR)
+ {
+ g_nor_flag = 1;
+ efuse_get_data();
+ //printf("chip id is 0x%x.\n",reg32(0x0121b040));
+ //printf("g_nor_flag is %d.\n",g_nor_flag);
+ }
}
for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
@@ -190,5 +195,11 @@
#endif
set_flash_opt();
- jffs2_lzma_init();
+
+ if(one_flag == 0){
+
+ jffs2_lzma_init();
+ one_flag = 1;
+ }
+
}