#include <asm/blackfin.h>
 #include <asm/cplb.h>
 #include <asm/mach-common/bits/core.h>
+#include <asm/mach-common/bits/ebiu.h>
 #include <asm/mach-common/bits/trace.h>
 
 #include "cpu.h"
 #include "serial.h"
 
+ulong bfin_poweron_retx;
+
 __attribute__ ((__noreturn__))
 void cpu_init_f(ulong bootflag, ulong loaded_from_ldr)
 {
                bfin_write_EBIU_AMGCTL(CONFIG_EBIU_AMGCTL_VAL);
 #endif
 
+       /* Save RETX so we can pass it while booting Linux */
+       bfin_poweron_retx = bootflag;
+
 #ifdef CONFIG_DEBUG_DUMP
        /* Turn on hardware trace buffer */
        bfin_write_TBUFCTL(TBUFPWR | TBUFEN);
 
        return dest;
 }
 
+extern ulong bfin_poweron_retx;
+
 int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 {
        int     (*appl) (char *cmdline);
        cmdline = make_command_line();
        icache_disable();
        dcache_disable();
-       (*appl) (cmdline);
+       asm __volatile__(
+               "RETX = %[retx];"
+               "CALL (%0);"
+               :
+               : "p"(appl), "q0"(cmdline), [retx] "d"(bfin_poweron_retx)
+       );
        /* does not return */
 
        return 1;