The environment variable 'safeboot' will be set when <CTRL-C> is
detected early in the boot process.
'wdreset' is set when the last boot cause was a watchdog reset.
This makes it possible to handle these events from the boot scripts.
"bootargs",
"fileaddr",
"filesize",
"bootargs",
"fileaddr",
"filesize",
+ "safeboot",
+ "wdreset",
};
void env_cleanup(void)
};
void env_cleanup(void)
while ((rtc_stat = readl(&rtc_regs->hw_rtc_stat)) &
RTC_STAT_STALE_REGS_PERSISTENT0) {
if (timeout-- < 0)
while ((rtc_stat = readl(&rtc_regs->hw_rtc_stat)) &
RTC_STAT_STALE_REGS_PERSISTENT0) {
if (timeout-- < 0)
udelay(1);
}
boot_cause = readl(&rtc_regs->hw_rtc_persistent0);
udelay(1);
}
boot_cause = readl(&rtc_regs->hw_rtc_persistent0);
rtc_err:
serial_puts("Inconsistent value in RTC_PERSISTENT0 register; power-on-reset required\n");
rtc_err:
serial_puts("Inconsistent value in RTC_PERSISTENT0 register; power-on-reset required\n");
+ if (ctrlc()) {
+ printf("CTRL-C detected; safeboot enabled\n");
+ return 1;
+ }
+
/* Address of boot parameters */
#ifdef CONFIG_OF_LIBFDT
gd->bd->bi_arch_number = -1;
/* Address of boot parameters */
#ifdef CONFIG_OF_LIBFDT
gd->bd->bi_arch_number = -1;
+ if (had_ctrlc())
+ setenv_ulong("safeboot", 1);
+ else
+ karo_fdt_move_fdt();
baseboard = getenv("baseboard");
if (!baseboard)
baseboard = getenv("baseboard");
if (!baseboard)
/* address of boot parameters */
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
/* address of boot parameters */
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
- if (ctrlc())
- printf("CTRL-C detected\n");
+ if (ctrlc() || (prm_rstst & PRM_RSTST_WDT1_RST)) {
+ if (prm_rstst & PRM_RSTST_WDT1_RST)
+ printf("WDOG RESET detected\n");
+ else
+ printf("<CTRL-C> detected; safeboot enabled\n");
+ }
gpio_request_array(tx48_gpios, ARRAY_SIZE(tx48_gpios));
tx48_set_pin_mux(tx48_pads, ARRAY_SIZE(tx48_pads));
gpio_request_array(tx48_gpios, ARRAY_SIZE(tx48_gpios));
tx48_set_pin_mux(tx48_pads, ARRAY_SIZE(tx48_pads));
return;
if (had_ctrlc() || (prm_rstst & PRM_RSTST_WDT1_RST)) {
return;
if (had_ctrlc() || (prm_rstst & PRM_RSTST_WDT1_RST)) {
- if (prm_rstst & PRM_RSTST_WDT1_RST) {
- printf("Watchdog reset detected; skipping cpu clock change\n");
- } else {
- printf("<CTRL-C> detected; skipping cpu clock change\n");
- }
+ printf("%s detected; skipping cpu clock change\n",
+ (prm_rstst & PRM_RSTST_WDT1_RST) ?
+ "WDOG RESET" : "<CTRL-C>");
env_cleanup();
tx48_set_cpu_clock();
env_cleanup();
tx48_set_cpu_clock();
+
+ if (had_ctrlc())
+ setenv_ulong("safeboot", 1);
+ else if (prm_rstst & PRM_RSTST_WDT1_RST)
+ setenv_ulong("wdreset", 1);
+ else
+ karo_fdt_move_fdt();
baseboard = getenv("baseboard");
if (!baseboard)
baseboard = getenv("baseboard");
if (!baseboard)
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x1000;
if (ctrlc() || (wrsr & WRSR_TOUT)) {
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x1000;
if (ctrlc() || (wrsr & WRSR_TOUT)) {
- printf("CTRL-C detected; Skipping boot critical setup\n");
+ if (wrsr & WRSR_TOUT)
+ printf("WDOG RESET detected\n");
+ else
+ printf("<CTRL-C> detected; safeboot enabled\n");
env_cleanup();
tx51_set_cpu_clock();
env_cleanup();
tx51_set_cpu_clock();
+
+ if (had_ctrlc())
+ setenv_ulong("safeboot", 1);
+ else if (wrsr & WRSR_TOUT)
+ setenv_ulong("wdreset", 1);
+ else
+ karo_fdt_move_fdt();
baseboard = getenv("baseboard");
if (!baseboard)
baseboard = getenv("baseboard");
if (!baseboard)
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x1000;
if (ctrlc() || (wrsr & WRSR_TOUT)) {
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x1000;
if (ctrlc() || (wrsr & WRSR_TOUT)) {
- printf("CTRL-C detected; Skipping PMIC setup\n");
+ if (wrsr & WRSR_TOUT)
+ printf("WDOG RESET detected; Skipping PMIC setup\n");
+ else
+ printf("<CTRL-C> detected; safeboot enabled\n");
{
unsigned long cpu_clk = getenv_ulong("cpu_clk", 10, 0);
{
unsigned long cpu_clk = getenv_ulong("cpu_clk", 10, 0);
- if (had_ctrlc() || (wrsr & WRSR_TOUT))
+ if (cpu_clk == 0 || cpu_clk == mxc_get_clock(MXC_ARM_CLK) / 1000000)
- if (cpu_clk == 0 || cpu_clk == mxc_get_clock(MXC_ARM_CLK) / 1000000)
+ if (had_ctrlc() || (wrsr & WRSR_TOUT)) {
+ printf("%s detected; skipping cpu clock change\n",
+ (wrsr & WRSR_TOUT) ? "WDOG RESET" : "<CTRL-C>");
if (mxc_set_clock(CONFIG_SYS_MX5_HCLK, cpu_clk, MXC_ARM_CLK) == 0) {
cpu_clk = mxc_get_clock(MXC_ARM_CLK);
if (mxc_set_clock(CONFIG_SYS_MX5_HCLK, cpu_clk, MXC_ARM_CLK) == 0) {
cpu_clk = mxc_get_clock(MXC_ARM_CLK);
env_cleanup();
tx53_set_cpu_clock();
env_cleanup();
tx53_set_cpu_clock();
+
+ if (had_ctrlc())
+ setenv_ulong("safeboot", 1);
+ else if (wrsr & WRSR_TOUT)
+ setenv_ulong("wdreset", 1);
+ else
+ karo_fdt_move_fdt();
baseboard = getenv("baseboard");
if (!baseboard)
baseboard = getenv("baseboard");
if (!baseboard)
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x1000;
gd->bd->bi_arch_number = -1;
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x1000;
gd->bd->bi_arch_number = -1;
+ if (ctrlc() || (wrsr & WRSR_TOUT)) {
+ if (wrsr & WRSR_TOUT)
+ printf("WDOG RESET detected; Skipping PMIC setup\n");
+ else
+ printf("<CTRL-C> detected; safeboot enabled\n");
#ifndef CONFIG_MX6_TEMPERATURE_HOT
tx6_temp_check_enabled = false;
#endif
#ifndef CONFIG_MX6_TEMPERATURE_HOT
tx6_temp_check_enabled = false;
#endif
- printf("CTRL-C detected; Skipping PMIC setup\n");
{
unsigned long cpu_clk = getenv_ulong("cpu_clk", 10, 0);
{
unsigned long cpu_clk = getenv_ulong("cpu_clk", 10, 0);
- if (had_ctrlc() || (wrsr & WRSR_TOUT))
- return;
-
if (cpu_clk == 0 || cpu_clk == mxc_get_clock(MXC_ARM_CLK) / 1000000)
return;
if (cpu_clk == 0 || cpu_clk == mxc_get_clock(MXC_ARM_CLK) / 1000000)
return;
+ if (had_ctrlc() || (wrsr & WRSR_TOUT)) {
+ printf("%s detected; skipping cpu clock change\n",
+ (wrsr & WRSR_TOUT) ? "WDOG RESET" : "<CTRL-C>");
+ return;
+ }
if (mxc_set_clock(CONFIG_SYS_MX6_HCLK, cpu_clk, MXC_ARM_CLK) == 0) {
cpu_clk = mxc_get_clock(MXC_ARM_CLK);
printf("CPU clock set to %lu.%03lu MHz\n",
if (mxc_set_clock(CONFIG_SYS_MX6_HCLK, cpu_clk, MXC_ARM_CLK) == 0) {
cpu_clk = mxc_get_clock(MXC_ARM_CLK);
printf("CPU clock set to %lu.%03lu MHz\n",
check_cpu_temperature(1);
tx6qdl_set_cpu_clock();
check_cpu_temperature(1);
tx6qdl_set_cpu_clock();
+
+ if (had_ctrlc())
+ setenv_ulong("safeboot", 1);
+ else if (wrsr & WRSR_TOUT)
+ setenv_ulong("wdreset", 1);
+ else
karo_fdt_move_fdt();
baseboard = getenv("baseboard");
karo_fdt_move_fdt();
baseboard = getenv("baseboard");