Fix %Tl 'last touch' tag not accepting the timeout
[kugel-rb.git] / bootloader / imx233.c
blob868d6e499fafb4277a09c17a50253b9dc56dd33d
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2011 by amaury Pouly
12 * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing
13 * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 ****************************************************************************/
25 #include <stdio.h>
26 #include <system.h>
27 #include <inttypes.h>
28 #include "config.h"
29 #include "gcc_extensions.h"
30 #include "lcd.h"
31 #include "backlight.h"
32 #include "button-target.h"
33 #include "common.h"
34 #include "storage.h"
35 #include "disk.h"
36 #include "panic.h"
37 #include "power.h"
38 #include "pinctrl-imx233.h"
39 #include "system-target.h"
41 int show_logo(void);
43 void main(void) NORETURN_ATTR;
44 void main(void)
46 unsigned char* loadbuffer;
47 int buffer_size;
48 void(*kernel_entry)(void);
49 int ret;
51 system_init();
52 kernel_init();
54 enable_irq();
56 lcd_init();
57 show_logo();
59 backlight_init();
61 button_init_device();
63 button_debug_screen();
65 power_off();
67 ret = storage_init();
68 if(ret < 0)
69 error(EATA, ret, true);
71 while(!disk_init(IF_MV(0)))
72 panicf("disk_init failed!");
74 while((ret = disk_mount_all()) <= 0)
76 error(EDISK, ret, true);
79 printf("Loading firmware");
81 loadbuffer = (unsigned char*)DRAM_ORIG; /* DRAM */
82 buffer_size = (int)(loadbuffer + DRAM_SIZE - TTB_SIZE);
84 while((ret = load_firmware(loadbuffer, BOOTFILE, buffer_size)) < 0)
86 error(EBOOTFILE, ret, true);
89 kernel_entry = (void*) loadbuffer;
90 //cpucache_invalidate();
91 printf("Executing");
92 kernel_entry();
93 printf("ERR: Failed to boot");
95 /* never returns */
96 while(1) ;