recovery: Make it possible to force the recovery

For factory flashing it is the easiest if we can force the
recovery process. Parse the "force" from a potential second
argument and then skip the timeout.
This commit is contained in:
Holger Hans Peter Freyther 2013-06-01 18:45:18 +02:00 committed by Alexander Couzens
parent 3fd2eddce5
commit 08ebe9fb54
1 changed files with 14 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 sysmocom s.f.m.c. GmbH * Copyright (C) 2012, 2013 sysmocom s.f.m.c. GmbH
* Author: Holger Hans Peter Freyther * Author: Holger Hans Peter Freyther
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -93,13 +93,17 @@ static int do_run_recovery(cmd_tbl_t *cmdtp, int flag, int argc, const char *arg
printf("Starting the recovery process.\n"); printf("Starting the recovery process.\n");
/* Wait a bit and check if the reset button is still pressed */ /* Wait a bit and check if the reset button is still pressed */
run_command("sleep 5", 0); if (argc == 2 && strcmp(argv[1], "force") == 0) {
if (gpio_get_value(38) != 0) { printf("Forcing the recovery process.\n");
printf("Recovery process aborted.\n"); } else {
run_command("dhcp", 0); run_command("sleep 5", 0);
enable_netconsole(); if (gpio_get_value(38) != 0) {
BLINK_LED(4); printf("Recovery process aborted.\n");
return 0; run_command("dhcp", 0);
enable_netconsole();
BLINK_LED(4);
return 0;
}
} }
BLINK_LED(5); BLINK_LED(5);
@ -135,5 +139,6 @@ static int do_run_recovery(cmd_tbl_t *cmdtp, int flag, int argc, const char *arg
U_BOOT_CMD( U_BOOT_CMD(
run_recovery, CONFIG_SYS_MAXARGS, 1, do_run_recovery, run_recovery, CONFIG_SYS_MAXARGS, 1, do_run_recovery,
"Run the sysmocom sysmoBTS recovery process", NULL "Run the sysmocom sysmoBTS recovery process",
"[force]"
); );