|
|
@ -23,6 +23,10 @@ |
|
|
|
#include <i2c.h> |
|
|
|
#include <i2c.h> |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int eeprom_diag; |
|
|
|
|
|
|
|
static int mac_diag; |
|
|
|
|
|
|
|
static int gpio_diag; |
|
|
|
|
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR; |
|
|
|
DECLARE_GLOBAL_DATA_PTR; |
|
|
|
|
|
|
|
|
|
|
|
static void gpio_configure(void) |
|
|
|
static void gpio_configure(void) |
|
|
@ -126,8 +130,6 @@ static u32 gpio_querykbd(void) |
|
|
|
|
|
|
|
|
|
|
|
/* excerpt from the recovery's hw_info.h */ |
|
|
|
/* excerpt from the recovery's hw_info.h */ |
|
|
|
|
|
|
|
|
|
|
|
static int eeprom_diag = 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct __attribute__ ((__packed__)) eeprom_layout { |
|
|
|
struct __attribute__ ((__packed__)) eeprom_layout { |
|
|
|
char magic[3]; /** 'ifm' */ |
|
|
|
char magic[3]; /** 'ifm' */ |
|
|
|
u8 len[2]; /** content length without magic/len fields */ |
|
|
|
u8 len[2]; /** content length without magic/len fields */ |
|
|
@ -231,11 +233,13 @@ int mac_read_from_eeprom(void) |
|
|
|
|
|
|
|
|
|
|
|
if (mac && is_valid_ether_addr(mac)) { |
|
|
|
if (mac && is_valid_ether_addr(mac)) { |
|
|
|
eth_setenv_enetaddr("ethaddr", mac); |
|
|
|
eth_setenv_enetaddr("ethaddr", mac); |
|
|
|
mac_txt = getenv("ethaddr"); |
|
|
|
if (mac_diag) { |
|
|
|
if (mac_txt) |
|
|
|
mac_txt = getenv("ethaddr"); |
|
|
|
printf("DIAG: MAC value [%s]\n", mac_txt); |
|
|
|
if (mac_txt) |
|
|
|
else |
|
|
|
printf("DIAG: MAC value [%s]\n", mac_txt); |
|
|
|
printf("DIAG: failed to setup MAC env\n"); |
|
|
|
else |
|
|
|
|
|
|
|
printf("DIAG: failed to setup MAC env\n"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
@ -337,29 +341,31 @@ int misc_init_r(void) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
want_recovery = 0; |
|
|
|
want_recovery = 0; |
|
|
|
keys = gpio_querykbd(); |
|
|
|
keys = gpio_querykbd(); |
|
|
|
printf("GPIO keyboard status [0x%08X]\n", keys); |
|
|
|
if (gpio_diag) |
|
|
|
|
|
|
|
printf("GPIO keyboard status [0x%02X]\n", keys); |
|
|
|
if ((keys & GPIOKEY_BITS_RECOVERY) == GPIOKEY_BITS_RECOVERY) { |
|
|
|
if ((keys & GPIOKEY_BITS_RECOVERY) == GPIOKEY_BITS_RECOVERY) { |
|
|
|
printf("GPIO keyboard requested RECOVERY\n"); |
|
|
|
printf("detected recovery request (keyboard)\n"); |
|
|
|
want_recovery = 1; |
|
|
|
want_recovery = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
s = getenv("install_in_progress"); |
|
|
|
s = getenv("install_in_progress"); |
|
|
|
if ((s != NULL) && (*s != '\0')) { |
|
|
|
if ((s != NULL) && (*s != '\0')) { |
|
|
|
printf("previous installation aborted, running RECOVERY\n"); |
|
|
|
printf("previous installation has not completed\n"); |
|
|
|
want_recovery = 1; |
|
|
|
want_recovery = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
s = getenv("install_failed"); |
|
|
|
s = getenv("install_failed"); |
|
|
|
if ((s != NULL) && (*s != '\0')) { |
|
|
|
if ((s != NULL) && (*s != '\0')) { |
|
|
|
printf("previous installation FAILED, running RECOVERY\n"); |
|
|
|
printf("previous installation has failed\n"); |
|
|
|
want_recovery = 1; |
|
|
|
want_recovery = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
s = getenv("want_recovery"); |
|
|
|
s = getenv("want_recovery"); |
|
|
|
if ((s != NULL) && (*s != '\0')) { |
|
|
|
if ((s != NULL) && (*s != '\0')) { |
|
|
|
printf("running RECOVERY according to the request\n"); |
|
|
|
printf("detected recovery request (environment)\n"); |
|
|
|
want_recovery = 1; |
|
|
|
want_recovery = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (want_recovery) { |
|
|
|
if (want_recovery) |
|
|
|
printf("enforced start of the recovery system\n"); |
|
|
|
setenv("bootcmd", "run recovery"); |
|
|
|
setenv("bootcmd", "run recovery"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* boot the recovery system without waiting; boot the |
|
|
|
* boot the recovery system without waiting; boot the |
|
|
|