blob: ed4e77b4bc02611006f536e288ce788d26a881c8 [file] [log] [blame]
Wolfgang Denk6cb142f2006-03-12 02:12:27 +01001/*
2 * U-boot - board.c First C file to be called contains init routines
3 *
Mike Frysingerd5bffeb2008-02-19 00:54:20 -05004 * Copyright (c) 2005-2008 Analog Devices Inc.
Wolfgang Denk6cb142f2006-03-12 02:12:27 +01005 *
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
Mike Frysingerd5bffeb2008-02-19 00:54:20 -05009 * Licensed under the GPL-2 or later.
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010010 */
11
12#include <common.h>
13#include <command.h>
Jean-Christophe PLAGNIOL-VILLARD52cb4d42009-05-16 12:14:54 +020014#include <stdio_dev.h>
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010015#include <environment.h>
Mike Frysingerd5bffeb2008-02-19 00:54:20 -050016#include <malloc.h>
17#include <net.h>
Peter Tyser561858e2008-11-03 09:30:59 -060018#include <timestamp.h>
Mike Frysinger01815c22008-10-06 03:52:24 -040019#include <status_led.h>
Mike Frysingerd5bffeb2008-02-19 00:54:20 -050020#include <version.h>
21
Aubrey.Li3f0606a2007-03-09 13:38:44 +080022#include <asm/cplb.h>
Mike Frysingerd5bffeb2008-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 Denk6cb142f2006-03-12 02:12:27 +010028
Luigi 'Comio' Mantellini310cecb2009-10-10 12:42:21 +020029#ifdef CONFIG_BITBANGMII
30#include <miiphy.h>
31#endif
32
Mike Frysinger9171fc82008-03-30 15:46:13 -040033#if defined(CONFIG_POST)
Aubrey.Li3f0606a2007-03-09 13:38:44 +080034#include <post.h>
35int post_flag;
36#endif
Wolfgang Denkd87080b2006-03-31 18:32:53 +020037
Wolfgang Denk1218abf2007-09-15 20:48:41 +020038DECLARE_GLOBAL_DATA_PTR;
39
Peter Tyser561858e2008-11-03 09:30:59 -060040const char version_string[] = U_BOOT_VERSION " ("U_BOOT_DATE" - "U_BOOT_TIME")";
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010041
Mike Frysingerd5bffeb2008-02-19 00:54:20 -050042__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);
48#endif
49}
50
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010051static int display_banner(void)
52{
Mike Frysingerd5bffeb2008-02-19 00:54:20 -050053 printf("\n\n%s\n\n", version_string);
Mike Frysingerfc68f9f2009-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 Frysingerd5bffeb2008-02-19 00:54:20 -050059 return 0;
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010060}
61
62static int init_baudrate(void)
63{
Mike Frysingerd5bffeb2008-02-19 00:54:20 -050064 char baudrate[15];
65 int i = getenv_r("baudrate", baudrate, sizeof(baudrate));
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010066 gd->bd->bi_baudrate = gd->baudrate = (i > 0)
Mike Frysingerd5bffeb2008-02-19 00:54:20 -050067 ? simple_strtoul(baudrate, NULL, 10)
Aubrey.Li3f0606a2007-03-09 13:38:44 +080068 : CONFIG_BAUDRATE;
Mike Frysingerd5bffeb2008-02-19 00:54:20 -050069 return 0;
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010070}
71
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010072static void display_global_data(void)
73{
Mike Frysingerd5bffeb2008-02-19 00:54:20 -050074#ifdef CONFIG_DEBUG_EARLY_SERIAL
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010075 bd_t *bd;
76 bd = gd->bd;
Mike Frysingerf541e1d2009-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 Frysingerd5bffeb2008-02-19 00:54:20 -050088 printf(" |-bi_baudrate: %x\n", bd->bi_baudrate);
Mike Frysingerf541e1d2009-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 Denk6cb142f2006-03-12 02:12:27 +010096#endif
Mike Frysingerd5bffeb2008-02-19 00:54:20 -050097}
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010098
Mike Frysingerd5bffeb2008-02-19 00:54:20 -050099#define CPLB_PAGE_SIZE (4 * 1024 * 1024)
100#define CPLB_PAGE_MASK (~(CPLB_PAGE_SIZE - 1))
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800101void init_cplbtables(void)
102{
Mike Frysingerd5bffeb2008-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.Li3f0606a2007-03-09 13:38:44 +0800107
Mike Frysingerd5bffeb2008-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.Li3f0606a2007-03-09 13:38:44 +0800112 }
Mike Frysingerd5bffeb2008-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;
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800117 }
118
Mike Frysingerd5bffeb2008-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
Mike Frysinger7527fee2009-11-09 19:38:23 -0500133 if (CONFIG_MEM_SIZE) {
134 uint32_t mbase = CONFIG_SYS_MONITOR_BASE;
135 uint32_t mend = mbase + CONFIG_SYS_MONITOR_LEN;
136 mbase &= CPLB_PAGE_MASK;
137 mend &= CPLB_PAGE_MASK;
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500138
Mike Frysinger7527fee2009-11-09 19:38:23 -0500139 icplb_add(mbase, SDRAM_IKERNEL);
140 dcplb_add(mbase, SDRAM_DKERNEL);
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500141 ++i;
Mike Frysinger7527fee2009-11-09 19:38:23 -0500142
143 /*
144 * If the monitor crosses a 4 meg boundary, we'll need
145 * to lock two entries for it. We assume it doesn't
146 * cross two 4 meg boundaries ...
147 */
148 if (mbase != mend) {
149 icplb_add(mend, SDRAM_IKERNEL);
150 dcplb_add(mend, SDRAM_DKERNEL);
151 ++i;
152 }
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500153 }
154
155 icplb_add(0x20000000, SDRAM_INON_CHBL);
156 dcplb_add(0x20000000, SDRAM_EBIU);
157 ++i;
158
159 /* Add entries for the rest of external RAM up to the bootrom */
160 extern_memory = 0;
161
162#ifdef CONFIG_DEBUG_NULL_PTR
163 icplb_add(extern_memory, (SDRAM_IKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB);
164 dcplb_add(extern_memory, (SDRAM_DKERNEL & ~PAGE_SIZE_MASK) | PAGE_SIZE_1KB);
165 ++i;
166 icplb_add(extern_memory, SDRAM_IKERNEL);
167 dcplb_add(extern_memory, SDRAM_DKERNEL);
168 extern_memory += CPLB_PAGE_SIZE;
169 ++i;
170#endif
171
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200172 while (i < 16 && extern_memory < (CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK)) {
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500173 icplb_add(extern_memory, SDRAM_IGENERIC);
174 dcplb_add(extern_memory, SDRAM_DGENERIC);
175 extern_memory += CPLB_PAGE_SIZE;
176 ++i;
177 }
178 while (i < 16) {
179 icplb_add(0, 0);
180 dcplb_add(0, 0);
181 ++i;
182 }
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800183}
184
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100185/*
186 * All attempts to come up with a "common" initialization sequence
187 * that works for all boards and architectures failed: some of the
188 * requirements are just _too_ different. To get rid of the resulting
189 * mess of board dependend #ifdef'ed code we now make the whole
190 * initialization sequence configurable to the user.
191 *
192 * The requirements for any new initalization function is simple: it
193 * receives a pointer to the "global data" structure as it's only
194 * argument, and returns an integer return code, where 0 means
195 * "continue" and != 0 means "fatal error, hang the system".
196 */
197
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500198extern int exception_init(void);
199extern int irq_init(void);
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500200extern int timer_init(void);
201
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100202void board_init_f(ulong bootflag)
203{
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100204 ulong addr;
205 bd_t *bd;
Mike Frysinger6dadc912008-10-20 16:15:04 -0400206 char buf[32];
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800207
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500208#ifdef CONFIG_BOARD_EARLY_INIT_F
209 serial_early_puts("Board early init flash\n");
210 board_early_init_f();
211#endif
212
213 serial_early_puts("Init CPLB tables\n");
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800214 init_cplbtables();
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100215
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500216 serial_early_puts("Exceptions setup\n");
217 exception_init();
218
219#ifndef CONFIG_ICACHE_OFF
220 serial_early_puts("Turn on ICACHE\n");
221 icache_enable();
222#endif
223#ifndef CONFIG_DCACHE_OFF
224 serial_early_puts("Turn on DCACHE\n");
225 dcache_enable();
226#endif
227
Mike Frysinger78a0ba72008-10-06 03:57:39 -0400228#ifdef DEBUG
229 if (CONFIG_SYS_GBL_DATA_SIZE < sizeof(*gd))
230 hang();
231#endif
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500232 serial_early_puts("Init global data\n");
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200233 gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR);
Mike Frysinger78a0ba72008-10-06 03:57:39 -0400234 memset((void *)gd, 0, CONFIG_SYS_GBL_DATA_SIZE);
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100235
236 /* Board data initialization */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200237 addr = (CONFIG_SYS_GBL_DATA_ADDR + sizeof(gd_t));
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100238
239 /* Align to 4 byte boundary */
Wolfgang Denk8e7b7032006-03-12 02:55:22 +0100240 addr &= ~(4 - 1);
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800241 bd = (bd_t *) addr;
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100242 gd->bd = bd;
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800243 memset((void *)bd, 0, sizeof(bd_t));
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100244
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500245 bd->bi_r_version = version_string;
246 bd->bi_cpu = MK_STR(CONFIG_BFIN_CPU);
247 bd->bi_board_name = BFIN_BOARD_NAME;
248 bd->bi_vco = get_vco();
249 bd->bi_cclk = get_cclk();
250 bd->bi_sclk = get_sclk();
Mike Frysingerfa45bd42009-11-03 06:28:22 -0500251 bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
252 bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE;
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800253
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500254 /* Initialize */
255 serial_early_puts("IRQ init\n");
256 irq_init();
257 serial_early_puts("Environment init\n");
258 env_init();
259 serial_early_puts("Baudrate init\n");
260 init_baudrate();
261 serial_early_puts("Serial init\n");
262 serial_init();
263 serial_early_puts("Console init flash\n");
264 console_init_f();
265 serial_early_puts("End of early debugging\n");
266 display_banner();
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800267
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100268 checkboard();
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100269 timer_init();
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500270
Mike Frysinger6dadc912008-10-20 16:15:04 -0400271 printf("Clock: VCO: %s MHz, ", strmhz(buf, get_vco()));
272 printf("Core: %s MHz, ", strmhz(buf, get_cclk()));
273 printf("System: %s MHz\n", strmhz(buf, get_sclk()));
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500274
275 printf("RAM: ");
Mike Frysingerfa45bd42009-11-03 06:28:22 -0500276 print_size(bd->bi_memsize, "\n");
Mike Frysinger9171fc82008-03-30 15:46:13 -0400277#if defined(CONFIG_POST)
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800278 post_init_f();
279 post_bootmode_init();
280 post_run(NULL, POST_ROM | post_bootmode_get(0));
281#endif
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500282
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100283 board_init_r((gd_t *) gd, 0x20000010);
284}
285
Mike Frysinger8996d162009-02-22 16:02:27 -0500286static void board_net_init_r(bd_t *bd)
287{
Luigi 'Comio' Mantellini310cecb2009-10-10 12:42:21 +0200288#ifdef CONFIG_BITBANGMII
289 bb_miiphy_init();
290#endif
Mike Frysinger8996d162009-02-22 16:02:27 -0500291#ifdef CONFIG_CMD_NET
Mike Frysinger8996d162009-02-22 16:02:27 -0500292 char *s;
293
294 if ((s = getenv("bootfile")) != NULL)
295 copy_filename(BootFile, s, sizeof(BootFile));
296
297 bd->bi_ip_addr = getenv_IPaddr("ipaddr");
298
299 printf("Net: ");
300 eth_initialize(gd->bd);
Mike Frysinger8996d162009-02-22 16:02:27 -0500301#endif
302}
303
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100304void board_init_r(gd_t * id, ulong dest_addr)
305{
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500306 char *s;
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100307 bd_t *bd;
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100308 gd = id;
309 gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
310 bd = gd->bd;
311
Mike Frysinger9171fc82008-03-30 15:46:13 -0400312#if defined(CONFIG_POST)
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800313 post_output_backlog();
314 post_reloc();
315#endif
316
Stefan Roesec790b042009-05-11 15:50:12 +0200317 /* initialize malloc() area */
Peter Tysera483a162009-08-21 23:05:20 -0500318 mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
Stefan Roesec790b042009-05-11 15:50:12 +0200319
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200320#if !defined(CONFIG_SYS_NO_FLASH)
Mike Frysingerb6edc712008-10-06 04:00:07 -0400321 /* Initialize the flash and protect u-boot by default */
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500322 extern flash_info_t flash_info[];
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500323 puts("Flash: ");
Mike Frysinger45c48952008-10-06 04:01:26 -0400324 ulong size = flash_init();
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500325 print_size(size, "\n");
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200326 flash_protect(FLAG_PROTECT_SET, CONFIG_SYS_FLASH_BASE,
Mike Frysingerb6edc712008-10-06 04:00:07 -0400327 CONFIG_SYS_FLASH_BASE + CONFIG_SYS_MONITOR_LEN - 1,
328 &flash_info[0]);
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200329 bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100330 bd->bi_flashsize = size;
331 bd->bi_flashoffset = 0;
332#else
333 bd->bi_flashstart = 0;
334 bd->bi_flashsize = 0;
335 bd->bi_flashoffset = 0;
336#endif
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100337
Mike Frysinger39782722008-10-06 03:55:25 -0400338#ifdef CONFIG_CMD_NAND
339 puts("NAND: ");
340 nand_init(); /* go init the NAND */
341#endif
342
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100343 /* relocate environment function pointers etc. */
344 env_relocate();
345
Jean-Christophe PLAGNIOL-VILLARD52cb4d42009-05-16 12:14:54 +0200346 /* Initialize stdio devices */
347 stdio_init();
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100348 jumptable_init();
349
350 /* Initialize the console (after the relocation and devices init) */
351 console_init_r();
352
Mike Frysinger01815c22008-10-06 03:52:24 -0400353#ifdef CONFIG_STATUS_LED
354 status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
355 status_led_set(STATUS_LED_CRASH, STATUS_LED_OFF);
356#endif
357
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100358 /* Initialize from environment */
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500359 if ((s = getenv("loadaddr")) != NULL)
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100360 load_addr = simple_strtoul(s, NULL, 16);
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800361
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100362#if defined(CONFIG_MISC_INIT_R)
363 /* miscellaneous platform dependent initialisations */
364 misc_init_r();
365#endif
366
Mike Frysinger8996d162009-02-22 16:02:27 -0500367 board_net_init_r(bd);
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800368
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800369 display_global_data();
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800370
Mike Frysinger9171fc82008-03-30 15:46:13 -0400371#if defined(CONFIG_POST)
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800372 if (post_flag)
373 post_run(NULL, POST_RAM | post_bootmode_get(0));
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100374#endif
375
Mike Frysinger909878f2009-07-09 01:15:05 -0400376 if (bfin_os_log_check()) {
377 puts("\nLog buffer from operating system:\n");
378 bfin_os_log_dump();
379 puts("\n");
380 }
381
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100382 /* main_loop() can return to retry autoboot, if so just run it again. */
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500383 for (;;)
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100384 main_loop();
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100385}
386
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100387void hang(void)
388{
Mike Frysinger01815c22008-10-06 03:52:24 -0400389#ifdef CONFIG_STATUS_LED
390 status_led_set(STATUS_LED_BOOT, STATUS_LED_OFF);
391 status_led_set(STATUS_LED_CRASH, STATUS_LED_BLINKING);
392#endif
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100393 puts("### ERROR ### Please RESET the board ###\n");
Mike Frysingerd5bffeb2008-02-19 00:54:20 -0500394 while (1)
395 /* If a JTAG emulator is hooked up, we'll automatically trigger
396 * a breakpoint in it. If one isn't, this is just a NOP.
397 */
398 asm("emuexcpt;");
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100399}