summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx233/debug-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2016-09-26 21:22:21 +0100
committerGerrit Rockbox <gerrit@rockbox.org>2016-12-12 12:03:08 +0100
commita983859291e29e2cfe26df8e00814b546d865b5c (patch)
tree7ba94ae05153124a52bc546d46aecb91715578b3 /firmware/target/arm/imx233/debug-imx233.c
parent5c50efc9cec9b0b2f0af216c4e9bf82dc3046d04 (diff)
downloadrockbox-a983859291e29e2cfe26df8e00814b546d865b5c.tar.gz
rockbox-a983859291e29e2cfe26df8e00814b546d865b5c.zip
imx233: add capability to boot OF or updater instead of Rockbox
This commit adds the necessary code in the dualboot stub (bootloader) to let rockbox control the boot process. In particular, rockbox can now choose if the next boot will be normal (boot rockbox or OF on magic key), to OF or to updater. The intents (to be added in follow-up commits) are: 1) Let the user more easily reboot to the OF. On some targets it is not trivial, especially in USB mode. 2) Automatically reboot to updater when the user drop firmware.sb at the root of the drive (currently, the user needs to do that in OF USB mode) 3) Document this OF magic Change-Id: I86df651dec048c318c6a22de74abb8c6b41aa9ad
Diffstat (limited to 'firmware/target/arm/imx233/debug-imx233.c')
-rw-r--r--firmware/target/arm/imx233/debug-imx233.c65
1 files changed, 62 insertions, 3 deletions
diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c
index 89365cb148..68865efc8d 100644
--- a/firmware/target/arm/imx233/debug-imx233.c
+++ b/firmware/target/arm/imx233/debug-imx233.c
@@ -31,6 +31,7 @@
31#include "clkctrl-imx233.h" 31#include "clkctrl-imx233.h"
32#include "powermgmt-imx233.h" 32#include "powermgmt-imx233.h"
33#include "rtc-imx233.h" 33#include "rtc-imx233.h"
34#include "dualboot-imx233.h"
34#include "dcp-imx233.h" 35#include "dcp-imx233.h"
35#include "pinctrl-imx233.h" 36#include "pinctrl-imx233.h"
36#include "ocotp-imx233.h" 37#include "ocotp-imx233.h"
@@ -535,10 +536,11 @@ bool dbg_hw_info_rtc(void)
535 lcd_clear_display(); 536 lcd_clear_display();
536 struct imx233_rtc_info_t info = imx233_rtc_get_info(); 537 struct imx233_rtc_info_t info = imx233_rtc_get_info();
537 538
538 lcd_putsf(0, 0, "seconds: %lu", info.seconds); 539 int line = 0;
539 lcd_putsf(0, 1, "alarm: %lu", info.alarm); 540 lcd_putsf(0, line++, "seconds: %lu", info.seconds);
541 lcd_putsf(0, line++, "alarm: %lu", info.alarm);
540 for(int i = 0; i < 6; i++) 542 for(int i = 0; i < 6; i++)
541 lcd_putsf(0, i + 2, "persist%d: 0x%lx", i, info.persistent[i]); 543 lcd_putsf(0, line++, "persist%d: 0x%lx", i, info.persistent[i]);
542 544
543 lcd_update(); 545 lcd_update();
544 yield(); 546 yield();
@@ -1255,6 +1257,60 @@ bool dbg_hw_info_sdmmc(void)
1255 } 1257 }
1256} 1258}
1257 1259
1260#ifdef HAVE_DUALBOOT_STUB
1261bool dbg_hw_info_dualboot(void)
1262{
1263 lcd_setfont(FONT_SYSFIXED);
1264
1265 while(1)
1266 {
1267 int button = my_get_action(HZ / 10);
1268 switch(button)
1269 {
1270 case ACT_NEXT:
1271 case ACT_PREV:
1272 {
1273 /* only if boot mode is supported... */
1274 if(!imx233_dualboot_get_field(DUALBOOT_CAP_BOOT))
1275 break;
1276 /* change it */
1277 unsigned boot = imx233_dualboot_get_field(DUALBOOT_BOOT);
1278 if(boot == IMX233_BOOT_NORMAL)
1279 boot = IMX233_BOOT_OF;
1280 else if(boot == IMX233_BOOT_OF)
1281 boot = IMX233_BOOT_UPDATER;
1282 else
1283 boot = IMX233_BOOT_NORMAL;
1284 imx233_dualboot_set_field(DUALBOOT_BOOT, boot);
1285 break;
1286 }
1287 case ACT_OK:
1288 lcd_setfont(FONT_UI);
1289 return true;
1290 case ACT_CANCEL:
1291 lcd_setfont(FONT_UI);
1292 return false;
1293 }
1294
1295 lcd_clear_display();
1296 int line = 0;
1297 unsigned cap_boot = imx233_dualboot_get_field(DUALBOOT_CAP_BOOT);
1298 lcd_putsf(0, line++, "cap_boot: %s", cap_boot ? "yes" : "no");
1299 if(cap_boot)
1300 {
1301 unsigned boot = imx233_dualboot_get_field(DUALBOOT_BOOT);
1302 lcd_putsf(0, line++, "boot: %s",
1303 boot == IMX233_BOOT_NORMAL ? "normal"
1304 : boot == IMX233_BOOT_OF ? "of"
1305 : boot == IMX233_BOOT_UPDATER ? "updater" : "?");
1306 }
1307
1308 lcd_update();
1309 yield();
1310 }
1311}
1312#endif
1313
1258static struct 1314static struct
1259{ 1315{
1260 const char *name; 1316 const char *name;
@@ -1281,6 +1337,9 @@ static struct
1281 {"timrot", dbg_hw_info_timrot}, 1337 {"timrot", dbg_hw_info_timrot},
1282 {"button", dbg_hw_info_button}, 1338 {"button", dbg_hw_info_button},
1283 {"sdmmc", dbg_hw_info_sdmmc}, 1339 {"sdmmc", dbg_hw_info_sdmmc},
1340#ifdef HAVE_DUALBOOT_STUB
1341 {"dualboot", dbg_hw_info_dualboot},
1342#endif
1284 {"target", dbg_hw_target_info}, 1343 {"target", dbg_hw_target_info},
1285}; 1344};
1286 1345