From 354c2e5665e760bf1765a79aa4b83a70954e87e4 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 11 Jul 2012 14:21:39 +0200 Subject: [PATCH] rbl: Make sure that the UBL is always flashed In case bootmode=NAND but the RBL has loaded the UBL via UART we would end up not flashing the UBL in case the NAND holds the U-Boot. Fix it by doing the I_ME boot interruption, another option would be to check if UBL is in flash, sadly the DM644x does not have any information of how the system was started. --- src/main.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 51a34f9..7e5aaf8 100644 --- a/src/main.c +++ b/src/main.c @@ -294,10 +294,24 @@ send_binary(const char *orig_file, const char *tmp_file, int format, if (found != 1) goto error_unhandled; - found = wait_for_message("BootMode = UART", NULL, NULL); + /* + * It is possible that bootmode=nand but the UBL partition is + * blank. In that case the RBL will load the UBL via the UART + * and we have just provided the UBL. Once UBL is started it + * will recognize that it is in bootmode=nand and attempts to + * load the U-Boot payload. If it is present U-Boot will be + * started and UBL will not be programmed to the nand. + * + * We are using the the I_ME feature to interrupt the boot. + */ + found = wait_for_message("BootMode = UART", "I_ME", NULL); if (!found) log_info("Warning: invalid boot mode !!"); - //goto error_unhandled; + else if (found == 2) { + log_info("Sending interrupt command to UBL ($%08X)", 0x23); + send_message(" CMD\n"); + send_number(0x23, 8); + } found = wait_for_message("BOOTPSP", NULL, NULL); if (!found)