1.uboot下增加区分自动和手动模式升级
This commit is contained in:
		
							parent
							
								
									b5c509d678
								
							
						
					
					
						commit
						b998092203
					
				|  | @ -219,4 +219,6 @@ extern int nvt_decide_dual_rtos_idx(void); | |||
| extern void nvt_update_dual_rtos_info(void *p_bininfo, int boot_bank); | ||||
| #endif | ||||
| 
 | ||||
| extern void sf_display_lcd_bl(UINT32 vlaue); | ||||
| UINT32 sf_get_display_lcd_bl(void); | ||||
| #endif /* __ARCH_COMMON_NVT_COMMON_H__ */ | ||||
|  |  | |||
|  | @ -46,6 +46,7 @@ | |||
|                                      ((((UINT32)(data)) & 0x0000FF00) << 8) | \ | ||||
|                                      ((((UINT32)(data)) & 0x00FF0000) >> 8) | \ | ||||
|                                      ((((UINT32)(data)) & 0xFF000000) >> 24))   ///< Swap [31:24] with [7:0] and [23:16] with [15:8].
 | ||||
| static UINT32 g_LcdBl = TRUE; | ||||
| 
 | ||||
| static int nvt_update_partitions(unsigned int addr, unsigned int size, u64 part_off, u64 PartitionSize) | ||||
| { | ||||
|  | @ -2426,3 +2427,13 @@ int nvt_fw_update(bool firm_upd_firm) | |||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| void sf_display_lcd_bl(UINT32 vlaue) | ||||
| { | ||||
|     g_LcdBl = vlaue; | ||||
| } | ||||
| 
 | ||||
| UINT32 sf_get_display_lcd_bl(void) | ||||
| { | ||||
|     return g_LcdBl; | ||||
| } | ||||
|  | @ -157,6 +157,7 @@ static UINT32 g_uiStr5_UVAddr = 0; | |||
| static UINT32 g_uiStr6_YAddr = 0;  //"Updating again" string
 | ||||
| static UINT32 g_uiStr6_UVAddr = 0; | ||||
| static UINT32 g_bUpdatFwAgain = FALSE; | ||||
| static UINT32 g_LcdBl = FALSE; | ||||
| 
 | ||||
| int nvt_display_init(void) | ||||
| { | ||||
|  | @ -329,7 +330,7 @@ int nvt_display_init(void) | |||
| 
 | ||||
|     if (u32LcdBlCtrlPin != 0) { | ||||
|         nvt_gpio_setDir(u32LcdBlCtrlPin, GPIO_DIR_OUTPUT); | ||||
|         if (u32LcdBlOutIoSts) { | ||||
|         if (u32LcdBlOutIoSts && (TRUE == sf_get_display_lcd_bl())) { | ||||
|             nvt_gpio_setPin(u32LcdBlCtrlPin); | ||||
|         } else { | ||||
|             nvt_gpio_clearPin(u32LcdBlCtrlPin); | ||||
|  |  | |||
|  | @ -136,6 +136,7 @@ int board_eth_init(bd_t *bis) | |||
| typedef enum { | ||||
| 	WDT_OTA_STS_INVALID = 0, | ||||
| 	WDT_OTA_STS_LOADER_DETECTING_FW, | ||||
|     WDT_OTA_STS_LOADER_DETECTING_FW_AUTO, | ||||
| 	WDT_OTA_STS_UBOOT_UPDATE_FAILED, | ||||
| 	WDT_OTA_STS_UBOOT_UPDATE_OPEN_FAILED, | ||||
| 	WDT_OTA_STS_UBOOT_UPDATE_READ_FAILED, | ||||
|  | @ -143,6 +144,7 @@ typedef enum { | |||
| 	WDT_OTA_STS_UBOOT_UPDATE_UNKNOWN, | ||||
| 	WDT_OTA_STS_UBOOT_UPDATE_OK,			/* uboot stage ok */ | ||||
| 	WDT_OTA_STS_LINUX_TRIGGER,				/* linux stage trigger ota */ | ||||
|     WDT_OTA_STS_LINUX_TRIGGER_AUTO,				/* linux stage trigger ota */ | ||||
| } WDT_OTA_STS; | ||||
| 
 | ||||
| #define WDT_OTA_MAKEFOURCC(sts)			MAKEFOURCC('O','T','A', sts) | ||||
|  | @ -155,8 +157,19 @@ static int nvt_handle_fw_abin(void) | |||
| 	char cmdline[1024] = {0}; | ||||
| 	char buf[1024] = {0}; | ||||
| 	int  ota_upgrade_sts = 0; | ||||
| 	int is_ota = (WDT_OTA_GET_STS() == WDT_OTA_MAKEFOURCC(WDT_OTA_STS_LOADER_DETECTING_FW)) ? 1 : 0; | ||||
| 
 | ||||
| 	int is_ota = 0; | ||||
|     if(WDT_OTA_GET_STS() == WDT_OTA_MAKEFOURCC(WDT_OTA_STS_LOADER_DETECTING_FW)) | ||||
|     { | ||||
|         is_ota = 1; | ||||
|     } | ||||
|     else if(WDT_OTA_GET_STS() == WDT_OTA_MAKEFOURCC(WDT_OTA_STS_LOADER_DETECTING_FW_AUTO)) | ||||
|     { | ||||
|         is_ota = 1; | ||||
|         #ifdef CONFIG_NVT_DISPLAY_BAR_FWUPDATE //uboot config
 | ||||
|         sf_display_lcd_bl(0); | ||||
|         #endif | ||||
|     } | ||||
|     printf("is_ota: %d\r\n", is_ota); | ||||
| 	/* To handle firmware update */ | ||||
| 	ret = nvt_fw_update(false); | ||||
| 	if (ret < 0) { | ||||
|  |  | |||
|  | @ -24,32 +24,35 @@ static void led_set_gpio_high(int operation) | |||
| 	int ofs = NVT_LED_PIN/32; | ||||
| 	int shift = NVT_LED_PIN & 0x1F; | ||||
| 
 | ||||
| 	ofs = ofs*0x4; | ||||
|     if(TRUE == sf_get_display_lcd_bl()) | ||||
|     { | ||||
|         ofs = ofs*0x4; | ||||
|         /*Set gpio as high*/ | ||||
|         gpio_reg = INW(IOADDR_GPIO_REG_BASE + 0x20 + ofs); | ||||
| 
 | ||||
| 	/*Set gpio as high*/ | ||||
| 	gpio_reg = INW(IOADDR_GPIO_REG_BASE + 0x20 + ofs); | ||||
|         #if 0 | ||||
|         if (gpio_reg & (1 << shift)) | ||||
|             RESTORE_GPIO_DIR = 1; | ||||
|         else { | ||||
|             gpio_reg |= (1 << shift); | ||||
|             OUTW(IOADDR_GPIO_REG_BASE + 0x20 + ofs, gpio_reg); | ||||
|         } | ||||
|         #else | ||||
|         gpio_reg |= (1 << shift); | ||||
|         OUTW(IOADDR_GPIO_REG_BASE + 0x20 + ofs, gpio_reg); | ||||
|         #endif | ||||
| 
 | ||||
| 	#if 0 | ||||
| 	if (gpio_reg & (1 << shift)) | ||||
| 		RESTORE_GPIO_DIR = 1; | ||||
| 	else { | ||||
| 		gpio_reg |= (1 << shift); | ||||
| 		OUTW(IOADDR_GPIO_REG_BASE + 0x20 + ofs, gpio_reg); | ||||
| 	} | ||||
| 	#else | ||||
| 	gpio_reg |= (1 << shift); | ||||
| 	OUTW(IOADDR_GPIO_REG_BASE + 0x20 + ofs, gpio_reg); | ||||
| 	#endif | ||||
|         OUTW(IOADDR_GPIO_REG_BASE + 0x40 + ofs, (1 << shift)); | ||||
| 
 | ||||
| 	OUTW(IOADDR_GPIO_REG_BASE + 0x40 + ofs, (1 << shift)); | ||||
|         #if 0 // do not use delay!!! it will slow down flash erase/program!!!
 | ||||
|         /*Config duration*/ | ||||
|         if (operation) | ||||
|             mdelay(NVT_LED_PROGRAM_DURATION); | ||||
|         else | ||||
|             mdelay(NVT_LED_ERASE_DURATION); | ||||
|         #endif | ||||
|     } | ||||
| 
 | ||||
| 	#if 0 // do not use delay!!! it will slow down flash erase/program!!!
 | ||||
| 	/*Config duration*/ | ||||
| 	if (operation) | ||||
| 		mdelay(NVT_LED_PROGRAM_DURATION); | ||||
| 	else | ||||
| 		mdelay(NVT_LED_ERASE_DURATION); | ||||
| 	#endif | ||||
| } | ||||
| 
 | ||||
| static void led_set_gpio_low(void) | ||||
|  | @ -57,20 +60,23 @@ static void led_set_gpio_low(void) | |||
| 	//u32 gpio_reg;
 | ||||
| 	int ofs = NVT_LED_PIN/32; | ||||
| 	int shift = NVT_LED_PIN & 0x1F; | ||||
|     if(TRUE == sf_get_display_lcd_bl()) | ||||
|     { | ||||
|         ofs = ofs*0x4; | ||||
| 
 | ||||
| 	ofs = ofs*0x4; | ||||
| 	/*Set gpio as low*/ | ||||
| 	OUTW(IOADDR_GPIO_REG_BASE + 0x60 + ofs, (1 << shift)); | ||||
|         /*Set gpio as low*/ | ||||
|         OUTW(IOADDR_GPIO_REG_BASE + 0x60 + ofs, (1 << shift)); | ||||
| 
 | ||||
| 	#if 0 | ||||
| 	/*Force gpio direction as original config*/ | ||||
| 	if (!(RESTORE_GPIO_DIR)) { | ||||
| 		gpio_reg = INW(IOADDR_GPIO_REG_BASE + 0x20 + ofs); | ||||
| 		gpio_reg &= ~(1 << shift); | ||||
| 		OUTW(IOADDR_GPIO_REG_BASE + 0x20 + ofs, gpio_reg); | ||||
| 		RESTORE_GPIO_DIR = 0; | ||||
| 	} | ||||
| 	#endif | ||||
|         #if 0 | ||||
|         /*Force gpio direction as original config*/ | ||||
|         if (!(RESTORE_GPIO_DIR)) { | ||||
|             gpio_reg = INW(IOADDR_GPIO_REG_BASE + 0x20 + ofs); | ||||
|             gpio_reg &= ~(1 << shift); | ||||
|             OUTW(IOADDR_GPIO_REG_BASE + 0x20 + ofs, gpio_reg); | ||||
|             RESTORE_GPIO_DIR = 0; | ||||
|         } | ||||
|         #endif | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| static void led_flicker(void) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 payton
						payton