blob: b414b2a0f3be03027afa2b95de91b798b8774c14 [file] [log] [blame]
Wolfgang Denk97caf672006-03-12 02:12:27 +01001/*
2 * U-boot - board.c First C file to be called contains init routines
3 *
Mike Frysinger6a675322008-02-19 00:54:20 -05004 * Copyright (c) 2005-2008 Analog Devices Inc.
Wolfgang Denk97caf672006-03-12 02:12:27 +01005 *
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
Mike Frysinger6a675322008-02-19 00:54:20 -05009 * Licensed under the GPL-2 or later.
Wolfgang Denk97caf672006-03-12 02:12:27 +010010 */
11
12#include <common.h>
13#include <command.h>
Jean-Christophe PLAGNIOL-VILLARD2a7a0312009-05-16 12:14:54 +020014#include <stdio_dev.h>
Wolfgang Denk97caf672006-03-12 02:12:27 +010015#include <environment.h>
Mike Frysinger6a675322008-02-19 00:54:20 -050016#include <malloc.h>
17#include <net.h>
Peter Tyser62948502008-11-03 09:30:59 -060018#include <timestamp.h>
Mike Frysingerc6b978b2008-10-06 03:52:24 -040019#include <status_led.h>
Mike Frysinger6a675322008-02-19 00:54:20 -050020#include <version.h>
21
Aubrey.Li9da597f2007-03-09 13:38:44 +080022#include <asm/cplb.h>
Mike Frysinger6a675322008-02-19 00:54:20 -050023#include <asm/mach-common/bits/mpu.h>
24
25#ifdef CONFIG_CMD_NAND
26#include <nand.h> /* cannot even include nand.h if it isnt configured */
27#endif
Wolfgang Denk97caf672006-03-12 02:12:27 +010028
Luigi 'Comio' Mantellini01db1552009-10-10 12:42:21 +020029#ifdef CONFIG_BITBANGMII
30#include <miiphy.h>
31#endif
32
Mike Frysinger94bae5c2008-03-30 15:46:13 -040033#if defined(CONFIG_POST)
Aubrey.Li9da597f2007-03-09 13:38:44 +080034#include <post.h>
35int post_flag;
36#endif
Wolfgang Denk6405a152006-03-31 18:32:53 +020037
Wolfgang Denkd112a2c2007-09-15 20:48:41 +020038DECLARE_GLOBAL_DATA_PTR;
39
Peter Tyser62948502008-11-03 09:30:59 -060040const char version_string[] = U_BOOT_VERSION " ("U_BOOT_DATE" - "U_BOOT_TIME")";
Mike Frysinger6a675322008-02-19 00:54:20 -050041
42__attribute__((always_inline))
43static inline void serial_early_puts(const char *s)
44{
45#ifdef CONFIG_DEBUG_EARLY_SERIAL
46 serial_puts("Early: ");
47 serial_puts(s);
Aubrey.Li9da597f2007-03-09 13:38:44 +080048#endif
Mike Frysinger6a675322008-02-19 00:54:20 -050049}
Aubrey.Li9da597f2007-03-09 13:38:44 +080050
Wolfgang Denk97caf672006-03-12 02:12:27 +010051static int display_banner(void)
52{
Mike Frysinger6a675322008-02-19 00:54:20 -050053 printf("\n\n%s\n\n", version_string);
Mike Frysinger7e1bbd82009-01-06 06:16:19 -050054 printf("CPU: ADSP " MK_STR(CONFIG_BFIN_CPU) " "
55 "(Detected Rev: 0.%d) "
56 "(%s boot)\n",
57 bfin_revid(),
58 get_bfin_boot_mode(CONFIG_BFIN_BOOT_MODE));
Mike Frysinger6a675322008-02-19 00:54:20 -050059 return 0;
Wolfgang Denk97caf672006-03-12 02:12:27 +010060}
61
Wolfgang Denk97caf672006-03-12 02:12:27 +010062static int init_baudrate(void)
63{
Mike Frysinger6a675322008-02-19 00:54:20 -050064 char baudrate[15];
65 int i = getenv_r("baudrate", baudrate, sizeof(baudrate));
Wolfgang Denk97caf672006-03-12 02:12:27 +010066 gd->bd->bi_baudrate = gd->baudrate = (i > 0)
Mike Frysinger6a675322008-02-19 00:54:20 -050067 ? simple_strtoul(baudrate, NULL, 10)
Aubrey.Li9da597f2007-03-09 13:38:44 +080068 : CONFIG_BAUDRATE;
Mike Frysinger6a675322008-02-19 00:54:20 -050069 return 0;
Wolfgang Denk97caf672006-03-12 02:12:27 +010070}
71
Wolfgang Denk97caf672006-03-12 02:12:27 +010072static void display_global_data(void)
73{
Mike Frysinger6a675322008-02-19 00:54:20 -050074#ifdef CONFIG_DEBUG_EARLY_SERIAL
Wolfgang Denk97caf672006-03-12 02:12:27 +010075 bd_t *bd;
76 bd = gd->bd;
Mike Frysinger34298372009-08-24 19:03:18 -040077 printf(" gd: %p\n", gd);
78 printf(" |-flags: %lx\n", gd->flags);
79 printf(" |-board_type: %lx\n", gd->board_type);
80 printf(" |-baudrate: %lu\n", gd->baudrate);
81 printf(" |-have_console: %lx\n", gd->have_console);
82 printf(" |-ram_size: %lx\n", gd->ram_size);
83 printf(" |-reloc_off: %lx\n", gd->reloc_off);
84 printf(" |-env_addr: %lx\n", gd->env_addr);
85 printf(" |-env_valid: %lx\n", gd->env_valid);
86 printf(" |-jt(%p): %p\n", gd->jt, *(gd->jt));
87 printf(" \\-bd: %p\n", gd->bd);
Mike Frysinger6a675322008-02-19 00:54:20 -050088 printf(" |-bi_baudrate: %x\n", bd->bi_baudrate);
Mike Frysinger34298372009-08-24 19:03:18 -040089 printf(" |-bi_ip_addr: %lx\n", bd->bi_ip_addr);
90 printf(" |-bi_boot_params: %lx\n", bd->bi_boot_params);
91 printf(" |-bi_memstart: %lx\n", bd->bi_memstart);
92 printf(" |-bi_memsize: %lx\n", bd->bi_memsize);
93 printf(" |-bi_flashstart: %lx\n", bd->bi_flashstart);
94 printf(" |-bi_flashsize: %lx\n", bd->bi_flashsize);
95 printf(" \\-bi_flashoffset: %lx\n", bd->bi_flashoffset);
Wolfgang Denk97caf672006-03-12 02:12:27 +010096#endif
Mike Frysinger6a675322008-02-19 00:54:20 -050097}
Aubrey.Li9da597f2007-03-09 13:38:44 +080098
Mike Frysinger6a675322008-02-19 00:54:20 -050099#define CPLB_PAGE_SIZE (4 * 1024 * 1024)
100#define CPLB_PAGE_MASK (~(CPLB_PAGE_SIZE - 1))
Aubrey.Li9da597f2007-03-09 13:38:44 +0800101void init_cplbtables(void)
102{
Mike Frysinger6a675322008-02-19 00:54:20 -0500103 volatile uint32_t *ICPLB_ADDR, *ICPLB_DATA;
104 volatile uint32_t *DCPLB_ADDR, *DCPLB_DATA;
105 uint32_t extern_memory;
106 size_t i;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800107
Mike Frysinger6a675322008-02-19 00:54:20 -0500108 void icplb_add(uint32_t addr, uint32_t data)
109 {
110 *(ICPLB_ADDR + i) = addr;
111 *(ICPLB_DATA + i) = data;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800112 }
Mike Frysinger6a675322008-02-19 00:54:20 -0500113 void dcplb_add(uint32_t addr, uint32_t data)
114 {
115 *(DCPLB_ADDR + i) = addr;
116 *(DCPLB_DATA + i) = data;
117 }
Aubrey.Li9da597f2007-03-09 13:38:44 +0800118
Mike Frysinger6a675322008-02-19 00:54:20 -0500119 /* populate a few common entries ... we'll let
120 * the memory map and cplb exception handler do
121 * the rest of the work.
122 */
123 i = 0;
124 ICPLB_ADDR = (uint32_t *)ICPLB_ADDR0;
125 ICPLB_DATA = (uint32_t *)ICPLB_DATA0;
126 DCPLB_ADDR = (uint32_t *)DCPLB_ADDR0;
127 DCPLB_DATA = (uint32_t *)DCPLB_DATA0;
128
129 icplb_add(0xFFA00000, L1_IMEMORY);
130 dcplb_add(0xFF800000, L1_DMEMORY);
131 ++i;
132
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200133 icplb_add(CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK, SDRAM_IKERNEL);
134 dcplb_add(CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK, SDRAM_DKERNEL);
Mike Frysinger6a675322008-02-19 00:54:20 -0500135 ++i;
136
137 /* If the monitor crosses a 4 meg boundary, we'll need
138 * to lock two entries for it.
139 */
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200140 if ((CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK) != ((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) & CPLB_PAGE_MASK)) {
141 icplb_add((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) & CPLB_PAGE_MASK, SDRAM_IKERNEL);
142 dcplb_add((CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) & CPLB_PAGE_MASK, SDRAM_DKERNEL);
Mike Frysinger6a675322008-02-19 00:54:20 -0500143 ++i;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800144 }
145
Mike Frysinger6a675322008-02-19 00:54:20 -0500146 icplb_add(0x20000000, SDRAM_INON_CHBL);
147 dcplb_add(0x20000000, SDRAM_EBIU);
148 ++i;
149
150 /* Add entries for the rest of external RAM up to the bootrom */
151 extern_memory = 0;
152
153#ifdef CONFIG_DEBUG_NULL_PTR
154 icplb_add(extern_memory, (SDRAM_IKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB);
155 dcplb_add(extern_memory, (SDRAM_DKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB);
156 ++i;
157 icplb_add(extern_memory, SDRAM_IKERNEL);
158 dcplb_add(extern_memory, SDRAM_DKERNEL);
159 extern_memory += CPLB_PAGE_SIZE;
160 ++i;
161#endif
162
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200163 while (i < 16 && extern_memory < (CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK)) {
Mike Frysinger6a675322008-02-19 00:54:20 -0500164 icplb_add(extern_memory, SDRAM_IGENERIC);
165 dcplb_add(extern_memory, SDRAM_DGENERIC);
166 extern_memory += CPLB_PAGE_SIZE;
167 ++i;
168 }
169 while (i < 16) {
170 icplb_add(0, 0);
171 dcplb_add(0, 0);
172 ++i;
173 }
Aubrey.Li9da597f2007-03-09 13:38:44 +0800174}
175
Wolfgang Denk97caf672006-03-12 02:12:27 +0100176/*
177 * All attempts to come up with a "common" initialization sequence
178 * that works for all boards and architectures failed: some of the
179 * requirements are just _too_ different. To get rid of the resulting
180 * mess of board dependend #ifdef'ed code we now make the whole
181 * initialization sequence configurable to the user.
182 *
183 * The requirements for any new initalization function is simple: it
184 * receives a pointer to the "global data" structure as it's only
185 * argument, and returns an integer return code, where 0 means
186 * "continue" and != 0 means "fatal error, hang the system".
187 */
188
Mike Frysinger6a675322008-02-19 00:54:20 -0500189extern int exception_init(void);
190extern int irq_init(void);
Mike Frysinger6a675322008-02-19 00:54:20 -0500191extern int timer_init(void);
192
Wolfgang Denk97caf672006-03-12 02:12:27 +0100193void board_init_f(ulong bootflag)
194{
Wolfgang Denk97caf672006-03-12 02:12:27 +0100195 ulong addr;
196 bd_t *bd;
Mike Frysingera2672072008-10-20 16:15:04 -0400197 char buf[32];
Aubrey.Li9da597f2007-03-09 13:38:44 +0800198
Mike Frysinger6a675322008-02-19 00:54:20 -0500199#ifdef CONFIG_BOARD_EARLY_INIT_F
200 serial_early_puts("Board early init flash\n");
201 board_early_init_f();
202#endif
203
204 serial_early_puts("Init CPLB tables\n");
Aubrey.Li9da597f2007-03-09 13:38:44 +0800205 init_cplbtables();
Wolfgang Denk97caf672006-03-12 02:12:27 +0100206
Mike Frysinger6a675322008-02-19 00:54:20 -0500207 serial_early_puts("Exceptions setup\n");
208 exception_init();
209
210#ifndef CONFIG_ICACHE_OFF
211 serial_early_puts("Turn on ICACHE\n");
212 icache_enable();
213#endif
214#ifndef CONFIG_DCACHE_OFF
215 serial_early_puts("Turn on DCACHE\n");
216 dcache_enable();
217#endif
218
Mike Frysingerf93f0302008-10-06 03:57:39 -0400219#ifdef DEBUG
220 if (CONFIG_SYS_GBL_DATA_SIZE < sizeof(*gd))
221 hang();
222#endif
Mike Frysinger6a675322008-02-19 00:54:20 -0500223 serial_early_puts("Init global data\n");
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200224 gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR);
Mike Frysingerf93f0302008-10-06 03:57:39 -0400225 memset((void *)gd, 0, CONFIG_SYS_GBL_DATA_SIZE);
Wolfgang Denk97caf672006-03-12 02:12:27 +0100226
227 /* Board data initialization */
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200228 addr = (CONFIG_SYS_GBL_DATA_ADDR + sizeof(gd_t));
Wolfgang Denk97caf672006-03-12 02:12:27 +0100229
230 /* Align to 4 byte boundary */
Wolfgang Denk2bad8682006-03-12 02:55:22 +0100231 addr &= ~(4 - 1);
Aubrey.Li9da597f2007-03-09 13:38:44 +0800232 bd = (bd_t *) addr;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100233 gd->bd = bd;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800234 memset((void *)bd, 0, sizeof(bd_t));
Wolfgang Denk97caf672006-03-12 02:12:27 +0100235
Mike Frysinger6a675322008-02-19 00:54:20 -0500236 bd->bi_r_version = version_string;
237 bd->bi_cpu = MK_STR(CONFIG_BFIN_CPU);
238 bd->bi_board_name = BFIN_BOARD_NAME;
239 bd->bi_vco = get_vco();
240 bd->bi_cclk = get_cclk();
241 bd->bi_sclk = get_sclk();
Mike Frysingera6f1ea42009-11-03 06:28:22 -0500242 bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
243 bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE;
Mike Frysinger6a675322008-02-19 00:54:20 -0500244
Wolfgang Denk97caf672006-03-12 02:12:27 +0100245 /* Initialize */
Mike Frysinger6a675322008-02-19 00:54:20 -0500246 serial_early_puts("IRQ init\n");
Mike Frysinger94bae5c2008-03-30 15:46:13 -0400247 irq_init();
Mike Frysinger6a675322008-02-19 00:54:20 -0500248 serial_early_puts("Environment init\n");
249 env_init();
250 serial_early_puts("Baudrate init\n");
251 init_baudrate();
252 serial_early_puts("Serial init\n");
253 serial_init();
254 serial_early_puts("Console init flash\n");
Wolfgang Denk97caf672006-03-12 02:12:27 +0100255 console_init_f();
Mike Frysinger6a675322008-02-19 00:54:20 -0500256 serial_early_puts("End of early debugging\n");
257 display_banner();
Aubrey.Li9da597f2007-03-09 13:38:44 +0800258
Wolfgang Denk97caf672006-03-12 02:12:27 +0100259 checkboard();
Wolfgang Denk97caf672006-03-12 02:12:27 +0100260 timer_init();
Mike Frysinger6a675322008-02-19 00:54:20 -0500261
Mike Frysingera2672072008-10-20 16:15:04 -0400262 printf("Clock: VCO: %s MHz, ", strmhz(buf, get_vco()));
263 printf("Core: %s MHz, ", strmhz(buf, get_cclk()));
264 printf("System: %s MHz\n", strmhz(buf, get_sclk()));
Mike Frysinger6a675322008-02-19 00:54:20 -0500265
266 printf("RAM: ");
Mike Frysingera6f1ea42009-11-03 06:28:22 -0500267 print_size(bd->bi_memsize, "\n");
Mike Frysinger94bae5c2008-03-30 15:46:13 -0400268#if defined(CONFIG_POST)
Aubrey.Li9da597f2007-03-09 13:38:44 +0800269 post_init_f();
270 post_bootmode_init();
271 post_run(NULL, POST_ROM | post_bootmode_get(0));
272#endif
Mike Frysinger6a675322008-02-19 00:54:20 -0500273
Wolfgang Denk97caf672006-03-12 02:12:27 +0100274 board_init_r((gd_t *) gd, 0x20000010);
275}
Aubrey.Li9da597f2007-03-09 13:38:44 +0800276
Mike Frysingere434b9f2009-02-22 16:02:27 -0500277static void board_net_init_r(bd_t *bd)
278{
Luigi 'Comio' Mantellini01db1552009-10-10 12:42:21 +0200279#ifdef CONFIG_BITBANGMII
280 bb_miiphy_init();
281#endif
Mike Frysingere434b9f2009-02-22 16:02:27 -0500282#ifdef CONFIG_CMD_NET
Mike Frysingere434b9f2009-02-22 16:02:27 -0500283 char *s;
284
285 if ((s = getenv("bootfile")) != NULL)
286 copy_filename(BootFile, s, sizeof(BootFile));
287
288 bd->bi_ip_addr = getenv_IPaddr("ipaddr");
289
290 printf("Net: ");
291 eth_initialize(gd->bd);
Mike Frysingere434b9f2009-02-22 16:02:27 -0500292#endif
293}
294
Wolfgang Denk97caf672006-03-12 02:12:27 +0100295void board_init_r(gd_t * id, ulong dest_addr)
296{
Mike Frysinger6a675322008-02-19 00:54:20 -0500297 char *s;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100298 bd_t *bd;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100299 gd = id;
300 gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
301 bd = gd->bd;
302
Mike Frysinger94bae5c2008-03-30 15:46:13 -0400303#if defined(CONFIG_POST)
Aubrey.Li9da597f2007-03-09 13:38:44 +0800304 post_output_backlog();
305 post_reloc();
306#endif
307
Stefan Roeseb81464e2009-05-11 15:50:12 +0200308 /* initialize malloc() area */
Peter Tysered527702009-08-21 23:05:20 -0500309 mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
Stefan Roeseb81464e2009-05-11 15:50:12 +0200310
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200311#if !defined(CONFIG_SYS_NO_FLASH)
Mike Frysinger0dc765f2008-10-06 04:00:07 -0400312 /* Initialize the flash and protect u-boot by default */
Mike Frysinger6a675322008-02-19 00:54:20 -0500313 extern flash_info_t flash_info[];
Mike Frysinger6a675322008-02-19 00:54:20 -0500314 puts("Flash: ");
Mike Frysingerd1c68c12008-10-06 04:01:26 -0400315 ulong size = flash_init();
Mike Frysinger6a675322008-02-19 00:54:20 -0500316 print_size(size, "\n");
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200317 flash_protect(FLAG_PROTECT_SET, CONFIG_SYS_FLASH_BASE,
Mike Frysinger0dc765f2008-10-06 04:00:07 -0400318 CONFIG_SYS_FLASH_BASE + CONFIG_SYS_MONITOR_LEN - 1,
319 &flash_info[0]);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200320 bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100321 bd->bi_flashsize = size;
322 bd->bi_flashoffset = 0;
323#else
324 bd->bi_flashstart = 0;
325 bd->bi_flashsize = 0;
326 bd->bi_flashoffset = 0;
327#endif
Wolfgang Denk97caf672006-03-12 02:12:27 +0100328
Mike Frysinger392bc552008-10-06 03:55:25 -0400329#ifdef CONFIG_CMD_NAND
330 puts("NAND: ");
331 nand_init(); /* go init the NAND */
332#endif
333
Wolfgang Denk97caf672006-03-12 02:12:27 +0100334 /* relocate environment function pointers etc. */
335 env_relocate();
336
Jean-Christophe PLAGNIOL-VILLARD2a7a0312009-05-16 12:14:54 +0200337 /* Initialize stdio devices */
338 stdio_init();
Wolfgang Denk97caf672006-03-12 02:12:27 +0100339 jumptable_init();
340
341 /* Initialize the console (after the relocation and devices init) */
342 console_init_r();
343
Mike Frysingerc6b978b2008-10-06 03:52:24 -0400344#ifdef CONFIG_STATUS_LED
345 status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
346 status_led_set(STATUS_LED_CRASH, STATUS_LED_OFF);
347#endif
348
Wolfgang Denk97caf672006-03-12 02:12:27 +0100349 /* Initialize from environment */
Mike Frysinger6a675322008-02-19 00:54:20 -0500350 if ((s = getenv("loadaddr")) != NULL)
Wolfgang Denk97caf672006-03-12 02:12:27 +0100351 load_addr = simple_strtoul(s, NULL, 16);
Aubrey.Li9da597f2007-03-09 13:38:44 +0800352
Wolfgang Denk97caf672006-03-12 02:12:27 +0100353#if defined(CONFIG_MISC_INIT_R)
354 /* miscellaneous platform dependent initialisations */
355 misc_init_r();
356#endif
357
Mike Frysingere434b9f2009-02-22 16:02:27 -0500358 board_net_init_r(bd);
Wolfgang Denk97caf672006-03-12 02:12:27 +0100359
Aubrey.Li9da597f2007-03-09 13:38:44 +0800360 display_global_data();
Aubrey.Li9da597f2007-03-09 13:38:44 +0800361
Mike Frysinger94bae5c2008-03-30 15:46:13 -0400362#if defined(CONFIG_POST)
Aubrey.Li9da597f2007-03-09 13:38:44 +0800363 if (post_flag)
364 post_run(NULL, POST_RAM | post_bootmode_get(0));
Wolfgang Denk97caf672006-03-12 02:12:27 +0100365#endif
366
Mike Frysinger08975892009-07-09 01:15:05 -0400367 if (bfin_os_log_check()) {
368 puts("\nLog buffer from operating system:\n");
369 bfin_os_log_dump();
370 puts("\n");
371 }
372
Wolfgang Denk97caf672006-03-12 02:12:27 +0100373 /* main_loop() can return to retry autoboot, if so just run it again. */
Mike Frysinger6a675322008-02-19 00:54:20 -0500374 for (;;)
Wolfgang Denk97caf672006-03-12 02:12:27 +0100375 main_loop();
Wolfgang Denk97caf672006-03-12 02:12:27 +0100376}
Wolfgang Denk97caf672006-03-12 02:12:27 +0100377
378void hang(void)
379{
Mike Frysingerc6b978b2008-10-06 03:52:24 -0400380#ifdef CONFIG_STATUS_LED
381 status_led_set(STATUS_LED_BOOT, STATUS_LED_OFF);
382 status_led_set(STATUS_LED_CRASH, STATUS_LED_BLINKING);
383#endif
Wolfgang Denk97caf672006-03-12 02:12:27 +0100384 puts("### ERROR ### Please RESET the board ###\n");
Mike Frysinger6a675322008-02-19 00:54:20 -0500385 while (1)
386 /* If a JTAG emulator is hooked up, we'll automatically trigger
387 * a breakpoint in it. If one isn't, this is just a NOP.
388 */
389 asm("emuexcpt;");
Wolfgang Denk97caf672006-03-12 02:12:27 +0100390}