summaryrefslogtreecommitdiff
path: root/rbutil/mkimxboot/dualboot/dualboot.c
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/mkimxboot/dualboot/dualboot.c')
-rw-r--r--rbutil/mkimxboot/dualboot/dualboot.c40
1 files changed, 35 insertions, 5 deletions
diff --git a/rbutil/mkimxboot/dualboot/dualboot.c b/rbutil/mkimxboot/dualboot/dualboot.c
index 82568b8893..77b816bf76 100644
--- a/rbutil/mkimxboot/dualboot/dualboot.c
+++ b/rbutil/mkimxboot/dualboot/dualboot.c
@@ -18,11 +18,11 @@
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "pinctrl.h" 21#include "regs/pinctrl.h"
22#include "power.h" 22#include "regs/power.h"
23#include "lradc.h" 23#include "regs/lradc.h"
24#include "digctl.h" 24#include "regs/digctl.h"
25#include "clkctrl.h" 25#include "regs/clkctrl.h"
26 26
27#define BOOT_ROM_CONTINUE 0 /* continue boot */ 27#define BOOT_ROM_CONTINUE 0 /* continue boot */
28#define BOOT_ROM_SECTION 1 /* switch to new section *result_id */ 28#define BOOT_ROM_SECTION 1 /* switch to new section *result_id */
@@ -34,6 +34,10 @@
34 34
35typedef unsigned long uint32_t; 35typedef unsigned long uint32_t;
36 36
37/* we include the dualboot rtc code directly */
38#include "dualboot-imx233.h"
39#include "dualboot-imx233.c"
40
37// target specific boot context 41// target specific boot context
38enum context_t 42enum context_t
39{ 43{
@@ -270,10 +274,36 @@ static inline void do_charge(void)
270 } 274 }
271} 275}
272 276
277static void set_updater_bits(void)
278{
279 /* The OF will continue to updater if we clear 18 of PERSISTENT1.
280 * See dualboot-imx233.c in firmware/ for more explanation */
281 HW_RTC_PERSISTENT1_CLR = 1 << 18;
282}
283
273int main(uint32_t arg, uint32_t *result_id) 284int main(uint32_t arg, uint32_t *result_id)
274{ 285{
275 if(arg == BOOT_ARG_CHARGE) 286 if(arg == BOOT_ARG_CHARGE)
276 do_charge(); 287 do_charge();
288 /* tell rockbox that we can handle boot mode */
289 imx233_dualboot_set_field(DUALBOOT_CAP_BOOT, 1);
290 /* if we were asked to boot in a special mode, do so */
291 unsigned boot_mode = imx233_dualboot_get_field(DUALBOOT_BOOT);
292 /* clear boot mode to avoid any loop */
293 imx233_dualboot_set_field(DUALBOOT_BOOT, IMX233_BOOT_NORMAL);
294 switch(boot_mode)
295 {
296 case IMX233_BOOT_UPDATER:
297 set_updater_bits();
298 /* fallthrough */
299 case IMX233_BOOT_OF:
300 /* continue booting */
301 return BOOT_ROM_CONTINUE;
302 case IMX233_BOOT_NORMAL:
303 default:
304 break;
305 }
306 /* normal boot */
277 switch(boot_decision(get_context())) 307 switch(boot_decision(get_context()))
278 { 308 {
279 case BOOT_ROCK: 309 case BOOT_ROCK: