nrhw20: cleanup code in board file

This commit is contained in:
Rene Straub 2018-03-16 13:34:57 +01:00
parent f735627eca
commit 26da1f4009
1 changed files with 12 additions and 18 deletions

View File

@ -525,6 +525,9 @@ static void init_pcie_slot(void)
mdelay(10); /* PCIe requires at least 1ms delay between power on and reset release */
gpio_set_value(NETBIRD_GPIO_RST_PCI, 0); /* Release reset */
/* TODO: Define state of W_DISABLE */
}
static void init_gsm(void)
@ -810,7 +813,7 @@ static void blink_led(void)
set_status_led(0, 1);
}
static int check_reset_button(void)
static void check_reset_button(void)
{
int counter = 0;
@ -833,13 +836,12 @@ static int check_reset_button(void)
}
} while (counter < 12000);
/* Don't do anything for duration < 2s */
if (counter < 2000)
return 0;
/* Do factory reset for duration between ~5s and ~15s */
if (counter < 12000)
if (counter < 2000) {
/* Don't do anything for duration < 2s */
}
else if (counter < 12000)
{
/* Do factory reset for duration between 2s and 12s */
char new_bootargs[512];
char *bootargs = getenv("bootargs");
@ -851,27 +853,19 @@ static int check_reset_button(void)
strncat(new_bootargs, " factory-reset", sizeof(new_bootargs));
setenv("bootargs", new_bootargs);
printf("bootargs = %s\n", new_bootargs);
return 1;
}
/* Boot into recovery for duration > 15s */
else
{
/* set consoledev to external port */
/* setenv("consoledev", "ttyS1"); */
/* Boot into recovery for duration > 12s */
printf("Booting recovery image...\n");
/* Set bootcmd to run recovery */
setenv("bootcmd", "run recovery");
return 0;
/* set consoledev to external port */
/* setenv("consoledev", "ttyS1"); */
}
return 0;
}
#endif