1.uboot下增加区分自动和手动模式升级

This commit is contained in:
payton 2023-12-27 11:37:33 +08:00
parent b5c509d678
commit b998092203
5 changed files with 70 additions and 37 deletions

View File

@ -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); extern void nvt_update_dual_rtos_info(void *p_bininfo, int boot_bank);
#endif #endif
extern void sf_display_lcd_bl(UINT32 vlaue);
UINT32 sf_get_display_lcd_bl(void);
#endif /* __ARCH_COMMON_NVT_COMMON_H__ */ #endif /* __ARCH_COMMON_NVT_COMMON_H__ */

View File

@ -46,6 +46,7 @@
((((UINT32)(data)) & 0x0000FF00) << 8) | \ ((((UINT32)(data)) & 0x0000FF00) << 8) | \
((((UINT32)(data)) & 0x00FF0000) >> 8) | \ ((((UINT32)(data)) & 0x00FF0000) >> 8) | \
((((UINT32)(data)) & 0xFF000000) >> 24)) ///< Swap [31:24] with [7:0] and [23:16] with [15: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) 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; return 0;
} }
void sf_display_lcd_bl(UINT32 vlaue)
{
g_LcdBl = vlaue;
}
UINT32 sf_get_display_lcd_bl(void)
{
return g_LcdBl;
}

View File

@ -157,6 +157,7 @@ static UINT32 g_uiStr5_UVAddr = 0;
static UINT32 g_uiStr6_YAddr = 0; //"Updating again" string static UINT32 g_uiStr6_YAddr = 0; //"Updating again" string
static UINT32 g_uiStr6_UVAddr = 0; static UINT32 g_uiStr6_UVAddr = 0;
static UINT32 g_bUpdatFwAgain = FALSE; static UINT32 g_bUpdatFwAgain = FALSE;
static UINT32 g_LcdBl = FALSE;
int nvt_display_init(void) int nvt_display_init(void)
{ {
@ -329,7 +330,7 @@ int nvt_display_init(void)
if (u32LcdBlCtrlPin != 0) { if (u32LcdBlCtrlPin != 0) {
nvt_gpio_setDir(u32LcdBlCtrlPin, GPIO_DIR_OUTPUT); nvt_gpio_setDir(u32LcdBlCtrlPin, GPIO_DIR_OUTPUT);
if (u32LcdBlOutIoSts) { if (u32LcdBlOutIoSts && (TRUE == sf_get_display_lcd_bl())) {
nvt_gpio_setPin(u32LcdBlCtrlPin); nvt_gpio_setPin(u32LcdBlCtrlPin);
} else { } else {
nvt_gpio_clearPin(u32LcdBlCtrlPin); nvt_gpio_clearPin(u32LcdBlCtrlPin);

View File

@ -136,6 +136,7 @@ int board_eth_init(bd_t *bis)
typedef enum { typedef enum {
WDT_OTA_STS_INVALID = 0, WDT_OTA_STS_INVALID = 0,
WDT_OTA_STS_LOADER_DETECTING_FW, WDT_OTA_STS_LOADER_DETECTING_FW,
WDT_OTA_STS_LOADER_DETECTING_FW_AUTO,
WDT_OTA_STS_UBOOT_UPDATE_FAILED, WDT_OTA_STS_UBOOT_UPDATE_FAILED,
WDT_OTA_STS_UBOOT_UPDATE_OPEN_FAILED, WDT_OTA_STS_UBOOT_UPDATE_OPEN_FAILED,
WDT_OTA_STS_UBOOT_UPDATE_READ_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_UNKNOWN,
WDT_OTA_STS_UBOOT_UPDATE_OK, /* uboot stage ok */ WDT_OTA_STS_UBOOT_UPDATE_OK, /* uboot stage ok */
WDT_OTA_STS_LINUX_TRIGGER, /* linux stage trigger ota */ WDT_OTA_STS_LINUX_TRIGGER, /* linux stage trigger ota */
WDT_OTA_STS_LINUX_TRIGGER_AUTO, /* linux stage trigger ota */
} WDT_OTA_STS; } WDT_OTA_STS;
#define WDT_OTA_MAKEFOURCC(sts) MAKEFOURCC('O','T','A', 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 cmdline[1024] = {0};
char buf[1024] = {0}; char buf[1024] = {0};
int ota_upgrade_sts = 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 */ /* To handle firmware update */
ret = nvt_fw_update(false); ret = nvt_fw_update(false);
if (ret < 0) { if (ret < 0) {

View File

@ -24,32 +24,35 @@ static void led_set_gpio_high(int operation)
int ofs = NVT_LED_PIN/32; int ofs = NVT_LED_PIN/32;
int shift = NVT_LED_PIN & 0x1F; 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*/ #if 0
gpio_reg = INW(IOADDR_GPIO_REG_BASE + 0x20 + ofs); 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 OUTW(IOADDR_GPIO_REG_BASE + 0x40 + ofs, (1 << shift));
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)); #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) static void led_set_gpio_low(void)
@ -57,20 +60,23 @@ static void led_set_gpio_low(void)
//u32 gpio_reg; //u32 gpio_reg;
int ofs = NVT_LED_PIN/32; int ofs = NVT_LED_PIN/32;
int shift = NVT_LED_PIN & 0x1F; int shift = NVT_LED_PIN & 0x1F;
if(TRUE == sf_get_display_lcd_bl())
{
ofs = ofs*0x4;
ofs = ofs*0x4; /*Set gpio as low*/
/*Set gpio as low*/ OUTW(IOADDR_GPIO_REG_BASE + 0x60 + ofs, (1 << shift));
OUTW(IOADDR_GPIO_REG_BASE + 0x60 + ofs, (1 << shift));
#if 0 #if 0
/*Force gpio direction as original config*/ /*Force gpio direction as original config*/
if (!(RESTORE_GPIO_DIR)) { if (!(RESTORE_GPIO_DIR)) {
gpio_reg = INW(IOADDR_GPIO_REG_BASE + 0x20 + ofs); gpio_reg = INW(IOADDR_GPIO_REG_BASE + 0x20 + ofs);
gpio_reg &= ~(1 << shift); gpio_reg &= ~(1 << shift);
OUTW(IOADDR_GPIO_REG_BASE + 0x20 + ofs, gpio_reg); OUTW(IOADDR_GPIO_REG_BASE + 0x20 + ofs, gpio_reg);
RESTORE_GPIO_DIR = 0; RESTORE_GPIO_DIR = 0;
} }
#endif #endif
}
} }
static void led_flicker(void) static void led_flicker(void)