blob: fd1fd319b6351cfce2c4dff0b6a4860259d7b3e8 [file] [log] [blame]
Simon Glassdb397fa2013-03-11 14:30:37 +00001/*
2 * Copyright (c) 2011 The Chromium OS Authors.
3 * (C) Copyright 2002-2006
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 *
6 * (C) Copyright 2002
7 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
8 * Marius Groeger <mgroeger@sysgo.de>
9 *
10 * See file CREDITS for list of people who contributed to this
11 * project.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License as
15 * published by the Free Software Foundation; either version 2 of
16 * the License, or (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 * MA 02111-1307 USA
27 */
28
29#include <common.h>
Simon Glass5af29bd2013-03-14 07:20:12 +000030/* TODO: can we just include all these headers whether needed or not? */
31#if defined(CONFIG_CMD_BEDBUG)
32#include <bedbug/type.h>
33#endif
Simon Glassdb397fa2013-03-11 14:30:37 +000034#ifdef CONFIG_HAS_DATAFLASH
35#include <dataflash.h>
36#endif
37#include <environment.h>
38#include <fdtdec.h>
Simon Glass5af29bd2013-03-14 07:20:12 +000039#if defined(CONFIG_CMD_IDE)
40#include <ide.h>
41#endif
Simon Glassdb397fa2013-03-11 14:30:37 +000042#include <initcall.h>
Simon Glass5af29bd2013-03-14 07:20:12 +000043#ifdef CONFIG_PS2KBD
44#include <keyboard.h>
45#endif
46#if defined(CONFIG_CMD_KGDB)
47#include <kgdb.h>
48#endif
Simon Glassdb397fa2013-03-11 14:30:37 +000049#include <logbuff.h>
50#include <malloc.h>
Simon Glass5af29bd2013-03-14 07:20:12 +000051#ifdef CONFIG_BITBANGMII
52#include <miiphy.h>
53#endif
Simon Glassdb397fa2013-03-11 14:30:37 +000054#include <mmc.h>
55#include <nand.h>
56#include <onenand_uboot.h>
Simon Glass5af29bd2013-03-14 07:20:12 +000057#include <scsi.h>
Simon Glassdb397fa2013-03-11 14:30:37 +000058#include <serial.h>
Simon Glass5af29bd2013-03-14 07:20:12 +000059#include <spi.h>
Simon Glassdb397fa2013-03-11 14:30:37 +000060#include <stdio_dev.h>
Simon Glass5af29bd2013-03-14 07:20:12 +000061#include <watchdog.h>
62#ifdef CONFIG_ADDR_MAP
63#include <asm/mmu.h>
64#endif
Simon Glassdb397fa2013-03-11 14:30:37 +000065#include <asm/sections.h>
Simon Glass6f5567d2013-03-05 14:39:53 +000066#ifdef CONFIG_X86
67#include <asm/init_helpers.h>
68#endif
Simon Glass5af29bd2013-03-14 07:20:12 +000069#include <linux/compiler.h>
Simon Glassdb397fa2013-03-11 14:30:37 +000070
71DECLARE_GLOBAL_DATA_PTR;
72
73ulong monitor_flash_len;
74
Simon Glass5af29bd2013-03-14 07:20:12 +000075int __board_flash_wp_on(void)
76{
77 /*
78 * Most flashes can't be detected when write protection is enabled,
79 * so provide a way to let U-Boot gracefully ignore write protected
80 * devices.
81 */
82 return 0;
83}
84
85int board_flash_wp_on(void)
86 __attribute__ ((weak, alias("__board_flash_wp_on")));
87
88void __cpu_secondary_init_r(void)
89{
90}
91
92void cpu_secondary_init_r(void)
93 __attribute__ ((weak, alias("__cpu_secondary_init_r")));
94
95static int initr_secondary_cpu(void)
96{
97 /*
98 * after non-volatile devices & environment is setup and cpu code have
99 * another round to deal with any initialization that might require
100 * full access to the environment or loading of some image (firmware)
101 * from a non-volatile device
102 */
103 /* TODO: maybe define this for all archs? */
104 cpu_secondary_init_r();
105
106 return 0;
107}
Simon Glassdb397fa2013-03-11 14:30:37 +0000108
109static int initr_reloc(void)
110{
111 gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
112 bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, "board_init_r");
113
114 return 0;
115}
116
117#ifdef CONFIG_ARM
118/*
119 * Some of these functions are needed purely because the functions they
120 * call return void. If we change them to return 0, these stubs can go away.
121 */
122static int initr_caches(void)
123{
124 /* Enable caches */
125 enable_caches();
126 return 0;
127}
128#endif
129
Simon Glass5af29bd2013-03-14 07:20:12 +0000130__weak int fixup_cpu(void)
131{
132 return 0;
133}
134
Simon Glassdb397fa2013-03-11 14:30:37 +0000135static int initr_reloc_global_data(void)
136{
137#ifdef CONFIG_SYS_SYM_OFFSETS
138 monitor_flash_len = _end_ofs;
Simon Glass62cf9122013-04-26 02:53:43 +0000139#elif !defined(CONFIG_SANDBOX)
Simon Glassdb397fa2013-03-11 14:30:37 +0000140 monitor_flash_len = (ulong)&__init_end - gd->dest_addr;
141#endif
Simon Glass5af29bd2013-03-14 07:20:12 +0000142#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
143 /*
144 * The gd->cpu pointer is set to an address in flash before relocation.
145 * We need to update it to point to the same CPU entry in RAM.
146 * TODO: why not just add gd->reloc_ofs?
147 */
148 gd->arch.cpu += gd->dest_addr - CONFIG_SYS_MONITOR_BASE;
149
150 /*
151 * If we didn't know the cpu mask & # cores, we can save them of
152 * now rather than 'computing' them constantly
153 */
154 fixup_cpu();
155#endif
156#ifdef CONFIG_SYS_EXTRA_ENV_RELOC
157 /*
158 * Some systems need to relocate the env_addr pointer early because the
159 * location it points to will get invalidated before env_relocate is
160 * called. One example is on systems that might use a L2 or L3 cache
161 * in SRAM mode and initialize that cache from SRAM mode back to being
162 * a cache in cpu_init_r.
163 */
164 gd->env_addr += gd->dest_addr - CONFIG_SYS_MONITOR_BASE;
165#endif
166 return 0;
Simon Glassdb397fa2013-03-11 14:30:37 +0000167}
168
169static int initr_serial(void)
170{
171 serial_initialize();
172 return 0;
173}
174
Simon Glass5af29bd2013-03-14 07:20:12 +0000175#ifdef CONFIG_PPC
176static int initr_trap(void)
177{
178 /*
179 * Setup trap handlers
180 */
181 trap_init(gd->dest_addr);
182
183 return 0;
184}
185#endif
186
187#ifdef CONFIG_ADDR_MAP
188static int initr_addr_map(void)
189{
190 init_addr_map();
191
192 return 0;
193}
194#endif
195
Simon Glassdb397fa2013-03-11 14:30:37 +0000196#ifdef CONFIG_LOGBUFFER
197unsigned long logbuffer_base(void)
198{
199 return gd->ram_top - LOGBUFF_LEN;
200}
201
202static int initr_logbuffer(void)
203{
204 logbuff_init_ptrs();
205 return 0;
206}
207#endif
208
209#ifdef CONFIG_POST
210static int initr_post_backlog(void)
211{
212 post_output_backlog();
213 return 0;
214}
215#endif
216
Simon Glass5af29bd2013-03-14 07:20:12 +0000217#ifdef CONFIG_SYS_DELAYED_ICACHE
218static int initr_icache_enable(void)
219{
220 return 0;
221}
222#endif
223
224#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
225static int initr_unlock_ram_in_cache(void)
226{
227 unlock_ram_in_cache(); /* it's time to unlock D-cache in e500 */
228 return 0;
229}
230#endif
231
232#ifdef CONFIG_PCI
233static int initr_pci(void)
234{
235 pci_init();
236
237 return 0;
238}
239#endif
240
241#ifdef CONFIG_WINBOND_83C553
242static int initr_w83c553f(void)
243{
244 /*
245 * Initialise the ISA bridge
246 */
247 initialise_w83c553f();
248 return 0;
249}
250#endif
251
252static int initr_barrier(void)
253{
254#ifdef CONFIG_PPC
255 /* TODO: Can we not use dmb() macros for this? */
256 asm("sync ; isync");
257#endif
258 return 0;
259}
260
Simon Glassdb397fa2013-03-11 14:30:37 +0000261static int initr_malloc(void)
262{
263 ulong malloc_start;
264
265 /* The malloc area is immediately below the monitor copy in DRAM */
266 malloc_start = gd->dest_addr - TOTAL_MALLOC_LEN;
Simon Glass62cf9122013-04-26 02:53:43 +0000267 mem_malloc_init((ulong)map_sysmem(malloc_start, TOTAL_MALLOC_LEN),
268 TOTAL_MALLOC_LEN);
Simon Glassdb397fa2013-03-11 14:30:37 +0000269 return 0;
270}
271
272__weak int power_init_board(void)
273{
274 return 0;
275}
276
277static int initr_announce(void)
278{
279 debug("Now running in RAM - U-Boot at: %08lx\n", gd->dest_addr);
280 return 0;
281}
282
283#if !defined(CONFIG_SYS_NO_FLASH)
284static int initr_flash(void)
285{
Simon Glass5af29bd2013-03-14 07:20:12 +0000286 ulong flash_size = 0;
287 bd_t *bd = gd->bd;
288 int ok;
Simon Glassdb397fa2013-03-11 14:30:37 +0000289
290 puts("Flash: ");
291
Simon Glass5af29bd2013-03-14 07:20:12 +0000292 if (board_flash_wp_on()) {
293 printf("Uninitialized - Write Protect On\n");
294 /* Since WP is on, we can't find real size. Set to 0 */
295 ok = 1;
296 } else {
297 flash_size = flash_init();
298 ok = flash_size > 0;
299 }
300 if (!ok) {
Simon Glassdb397fa2013-03-11 14:30:37 +0000301 puts("*** failed ***\n");
Simon Glass5af29bd2013-03-14 07:20:12 +0000302#ifdef CONFIG_PPC
303 /* Why does PPC do this? */
304 hang();
305#endif
Simon Glassdb397fa2013-03-11 14:30:37 +0000306 return -1;
307 }
308 print_size(flash_size, "");
309#ifdef CONFIG_SYS_FLASH_CHECKSUM
310 /*
311 * Compute and print flash CRC if flashchecksum is set to 'y'
312 *
313 * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
314 */
315 if (getenv_yesno("flashchecksum") == 1) {
316 printf(" CRC: %08X", crc32(0,
317 (const unsigned char *) CONFIG_SYS_FLASH_BASE,
318 flash_size));
319 }
320#endif /* CONFIG_SYS_FLASH_CHECKSUM */
321 putc('\n');
322
Simon Glass5af29bd2013-03-14 07:20:12 +0000323 /* update start of FLASH memory */
324#ifdef CONFIG_SYS_FLASH_BASE
325 bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
326#endif
327 /* size of FLASH memory (final value) */
328 bd->bi_flashsize = flash_size;
329
330#if defined(CONFIG_SYS_UPDATE_FLASH_SIZE)
331 /* Make a update of the Memctrl. */
332 update_flash_size(flash_size);
333#endif
334
335
336#if defined(CONFIG_OXC) || defined(CONFIG_RMU)
337 /* flash mapped at end of memory map */
338 bd->bi_flashoffset = CONFIG_SYS_TEXT_BASE + flash_size;
339#elif CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE
340 bd->bi_flashoffset = monitor_flash_len; /* reserved area for monitor */
341#endif
342 return 0;
343}
344#endif
345
346#ifdef CONFIG_PPC
347static int initr_spi(void)
348{
349 /* PPC does this here */
350#ifdef CONFIG_SPI
351#if !defined(CONFIG_ENV_IS_IN_EEPROM)
352 spi_init_f();
353#endif
354 spi_init_r();
355#endif
Simon Glassdb397fa2013-03-11 14:30:37 +0000356 return 0;
357}
358#endif
359
360#ifdef CONFIG_CMD_NAND
361/* go init the NAND */
362int initr_nand(void)
363{
364 puts("NAND: ");
365 nand_init();
366 return 0;
367}
368#endif
369
370#if defined(CONFIG_CMD_ONENAND)
371/* go init the NAND */
372int initr_onenand(void)
373{
374 puts("NAND: ");
375 onenand_init();
376 return 0;
377}
378#endif
379
380#ifdef CONFIG_GENERIC_MMC
381int initr_mmc(void)
382{
383 puts("MMC: ");
384 mmc_initialize(gd->bd);
385 return 0;
386}
387#endif
388
389#ifdef CONFIG_HAS_DATAFLASH
390int initr_dataflash(void)
391{
392 AT91F_DataflashInit();
393 dataflash_print_info();
394 return 0;
395}
396#endif
397
398/*
399 * Tell if it's OK to load the environment early in boot.
400 *
401 * If CONFIG_OF_CONFIG is defined, we'll check with the FDT to see
402 * if this is OK (defaulting to saying it's OK).
403 *
404 * NOTE: Loading the environment early can be a bad idea if security is
405 * important, since no verification is done on the environment.
406 *
407 * @return 0 if environment should not be loaded, !=0 if it is ok to load
408 */
409static int should_load_env(void)
410{
411#ifdef CONFIG_OF_CONTROL
412 return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 1);
413#elif defined CONFIG_DELAY_ENVIRONMENT
414 return 0;
415#else
416 return 1;
417#endif
418}
419
420static int initr_env(void)
421{
422 /* initialize environment */
423 if (should_load_env())
424 env_relocate();
425 else
426 set_default_env(NULL);
427
428 /* Initialize from environment */
429 load_addr = getenv_ulong("loadaddr", 16, load_addr);
Simon Glass5af29bd2013-03-14 07:20:12 +0000430#if defined(CONFIG_SYS_EXTBDINFO)
431#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
432#if defined(CONFIG_I2CFAST)
433 /*
434 * set bi_iic_fast for linux taking environment variable
435 * "i2cfast" into account
436 */
437 {
438 char *s = getenv("i2cfast");
439
440 if (s && ((*s == 'y') || (*s == 'Y'))) {
441 gd->bd->bi_iic_fast[0] = 1;
442 gd->bd->bi_iic_fast[1] = 1;
443 }
444 }
445#endif /* CONFIG_I2CFAST */
446#endif /* CONFIG_405GP, CONFIG_405EP */
447#endif /* CONFIG_SYS_EXTBDINFO */
448 return 0;
449}
450
451#ifdef CONFIG_HERMES
452static int initr_hermes(void)
453{
454 if ((gd->board_type >> 16) == 2)
455 gd->bd->bi_ethspeed = gd->board_type & 0xFFFF;
456 else
457 gd->bd->bi_ethspeed = 0xFFFF;
458 return 0;
459}
460
461static int initr_hermes_start(void)
462{
463 if (gd->bd->bi_ethspeed != 0xFFFF)
464 hermes_start_lxt980((int) gd->bd->bi_ethspeed);
Simon Glassdb397fa2013-03-11 14:30:37 +0000465 return 0;
466}
Simon Glass5af29bd2013-03-14 07:20:12 +0000467#endif
468
469#ifdef CONFIG_SC3
470/* TODO: with new initcalls, move this into the driver */
471extern void sc3_read_eeprom(void);
472
473static int initr_sc3_read_eeprom(void)
474{
475 sc3_read_eeprom();
476 return 0;
477}
478#endif
Simon Glassdb397fa2013-03-11 14:30:37 +0000479
480static int initr_jumptable(void)
481{
482 jumptable_init();
483 return 0;
484}
485
486#if defined(CONFIG_API)
487static int initr_api(void)
488{
489 /* Initialize API */
490 api_init();
491 return 0;
492}
493#endif
494
495#ifdef CONFIG_DISPLAY_BOARDINFO_LATE
496static int show_model_r(void)
497{
498 /* Put this here so it appears on the LCD, now it is ready */
499# ifdef CONFIG_OF_CONTROL
500 const char *model;
501
502 model = (char *)fdt_getprop(gd->fdt_blob, 0, "model", NULL);
503 printf("Model: %s\n", model ? model : "<unknown>");
504# else
505 checkboard();
506# endif
507}
508#endif
509
510/* enable exceptions */
Simon Glass2e4622d2013-03-11 07:40:13 +0000511#ifdef CONFIG_ARM
Simon Glassdb397fa2013-03-11 14:30:37 +0000512static int initr_enable_interrupts(void)
513{
514 enable_interrupts();
515 return 0;
516}
Simon Glass2e4622d2013-03-11 07:40:13 +0000517#endif
Simon Glassdb397fa2013-03-11 14:30:37 +0000518
519#ifdef CONFIG_CMD_NET
520static int initr_ethaddr(void)
521{
Simon Glass5af29bd2013-03-14 07:20:12 +0000522 bd_t *bd = gd->bd;
523
524 /* kept around for legacy kernels only ... ignore the next section */
525 eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr);
526#ifdef CONFIG_HAS_ETH1
527 eth_getenv_enetaddr("eth1addr", bd->bi_enet1addr);
528#endif
529#ifdef CONFIG_HAS_ETH2
530 eth_getenv_enetaddr("eth2addr", bd->bi_enet2addr);
531#endif
532#ifdef CONFIG_HAS_ETH3
533 eth_getenv_enetaddr("eth3addr", bd->bi_enet3addr);
534#endif
535#ifdef CONFIG_HAS_ETH4
536 eth_getenv_enetaddr("eth4addr", bd->bi_enet4addr);
537#endif
538#ifdef CONFIG_HAS_ETH5
539 eth_getenv_enetaddr("eth5addr", bd->bi_enet5addr);
540#endif
541 return 0;
542}
543#endif /* CONFIG_CMD_NET */
544
545#ifdef CONFIG_CMD_KGDB
546static int initr_kgdb(void)
547{
548 puts("KGDB: ");
549 kgdb_init();
550 return 0;
551}
552#endif
553
554#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
555static int initr_status_led(void)
556{
557 status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
558
559 return 0;
560}
561#endif
562
563#if defined(CONFIG_CMD_SCSI)
564static int initr_scsi(void)
565{
566 /* Not supported properly on ARM yet */
567#ifndef CONFIG_ARM
568 puts("SCSI: ");
569 scsi_init();
570#endif
Simon Glassdb397fa2013-03-11 14:30:37 +0000571
572 return 0;
573}
574#endif /* CONFIG_CMD_NET */
575
Simon Glass5af29bd2013-03-14 07:20:12 +0000576#if defined(CONFIG_CMD_DOC)
577static int initr_doc(void)
578{
579 puts("DOC: ");
580 doc_init();
581}
582#endif
583
Simon Glassdb397fa2013-03-11 14:30:37 +0000584#ifdef CONFIG_BITBANGMII
585static int initr_bbmii(void)
586{
587 bb_miiphy_init();
588 return 0;
589}
590#endif
591
592#ifdef CONFIG_CMD_NET
593static int initr_net(void)
594{
595 puts("Net: ");
596 eth_initialize(gd->bd);
597#if defined(CONFIG_RESET_PHY_R)
598 debug("Reset Ethernet PHY\n");
599 reset_phy();
600#endif
601 return 0;
602}
603#endif
604
605#ifdef CONFIG_POST
606static int initr_post(void)
607{
608 post_run(NULL, POST_RAM | post_bootmode_get(0));
609 return 0;
610}
611#endif
612
Simon Glass5af29bd2013-03-14 07:20:12 +0000613#if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_CMD_IDE)
614static int initr_pcmcia(void)
615{
616 puts("PCMCIA:");
617 pcmcia_init();
618 return 0;
619}
620#endif
621
622#if defined(CONFIG_CMD_IDE)
623static int initr_ide(void)
624{
625#ifdef CONFIG_IDE_8xx_PCCARD
626 puts("PCMCIA:");
627#else
628 puts("IDE: ");
629#endif
630#if defined(CONFIG_START_IDE)
631 if (board_start_ide())
632 ide_init();
633#else
634 ide_init();
635#endif
636 return 0;
637}
638#endif
639
Simon Glassdb397fa2013-03-11 14:30:37 +0000640#if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
641/*
642 * Export available size of memory for Linux, taking into account the
643 * protected RAM at top of memory
644 */
645int initr_mem(void)
646{
647 ulong pram = 0;
648 char memsz[32];
649
650# ifdef CONFIG_PRAM
651 pram = getenv_ulong("pram", 10, CONFIG_PRAM);
652# endif
653# if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
654 /* Also take the logbuffer into account (pram is in kB) */
655 pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
656# endif
657 sprintf(memsz, "%ldk", (gd->ram_size / 1024) - pram);
658 setenv("mem", memsz);
Simon Glass5af29bd2013-03-14 07:20:12 +0000659
660 return 0;
Simon Glassdb397fa2013-03-11 14:30:37 +0000661}
662#endif
663
Simon Glass5af29bd2013-03-14 07:20:12 +0000664#ifdef CONFIG_CMD_BEDBUG
665static int initr_bedbug(void)
666{
667 bedbug_init();
668
669 return 0;
670}
671#endif
672
673#ifdef CONFIG_PS2KBD
674static int initr_kbd(void)
675{
676 puts("PS/2: ");
677 kbd_init();
678 return 0;
679}
680#endif
681
682#ifdef CONFIG_MODEM_SUPPORT
683static int initr_modem(void)
684{
685 /* TODO: with new initcalls, move this into the driver */
686 extern int do_mdm_init;
687
688 do_mdm_init = gd->do_mdm_init;
689 return 0;
690}
691#endif
692
Simon Glassdb397fa2013-03-11 14:30:37 +0000693static int run_main_loop(void)
694{
Simon Glass62cf9122013-04-26 02:53:43 +0000695#ifdef CONFIG_SANDBOX
696 sandbox_main_loop_init();
697#endif
Simon Glassdb397fa2013-03-11 14:30:37 +0000698 /* main_loop() can return to retry autoboot, if so just run it again */
699 for (;;)
700 main_loop();
701 return 0;
702}
703
704/*
705 * Over time we hope to remove these functions with code fragments and
706 * stub funtcions, and instead call the relevant function directly.
707 *
708 * We also hope to remove most of the driver-related init and do it if/when
709 * the driver is later used.
Simon Glass5af29bd2013-03-14 07:20:12 +0000710 *
711 * TODO: perhaps reset the watchdog in the initcall function after each call?
Simon Glassdb397fa2013-03-11 14:30:37 +0000712 */
713init_fnc_t init_sequence_r[] = {
714 initr_reloc,
Simon Glass5af29bd2013-03-14 07:20:12 +0000715 /* TODO: could x86/PPC have this also perhaps? */
Simon Glassdb397fa2013-03-11 14:30:37 +0000716#ifdef CONFIG_ARM
717 initr_caches,
718 board_init, /* Setup chipselects */
719#endif
Simon Glass5af29bd2013-03-14 07:20:12 +0000720 /*
721 * TODO: printing of the clock inforamtion of the board is now
722 * implemented as part of bdinfo command. Currently only support for
723 * davinci SOC's is added. Remove this check once all the board
724 * implement this.
725 */
726#ifdef CONFIG_CLOCKS
727 set_cpu_clk_info, /* Setup clock information */
728#endif
Simon Glassdb397fa2013-03-11 14:30:37 +0000729 initr_reloc_global_data,
730 initr_serial,
731 initr_announce,
Simon Glass5af29bd2013-03-14 07:20:12 +0000732 INIT_FUNC_WATCHDOG_RESET
733#ifdef CONFIG_PPC
734 initr_trap,
735#endif
736#ifdef CONFIG_ADDR_MAP
737 initr_addr_map,
738#endif
739#if defined(CONFIG_BOARD_EARLY_INIT_R)
740 board_early_init_r,
741#endif
742 INIT_FUNC_WATCHDOG_RESET
Simon Glassdb397fa2013-03-11 14:30:37 +0000743#ifdef CONFIG_LOGBUFFER
744 initr_logbuffer,
745#endif
746#ifdef CONFIG_POST
747 initr_post_backlog,
748#endif
Simon Glass5af29bd2013-03-14 07:20:12 +0000749 INIT_FUNC_WATCHDOG_RESET
750#ifdef CONFIG_SYS_DELAYED_ICACHE
751 initr_icache_enable,
752#endif
753#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
754 initr_unlock_ram_in_cache,
755#endif
756#if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT)
757 /*
758 * Do early PCI configuration _before_ the flash gets initialised,
759 * because PCU ressources are crucial for flash access on some boards.
760 */
761 initr_pci,
762#endif
763#ifdef CONFIG_WINBOND_83C553
764 initr_w83c553f,
765#endif
766 initr_barrier,
Simon Glassdb397fa2013-03-11 14:30:37 +0000767 initr_malloc,
Doug Anderson844199d2013-04-17 16:13:42 +0000768 bootstage_relocate,
Simon Glassdb397fa2013-03-11 14:30:37 +0000769#ifdef CONFIG_ARCH_EARLY_INIT_R
770 arch_early_init_r,
771#endif
772 power_init_board,
773#ifndef CONFIG_SYS_NO_FLASH
774 initr_flash,
775#endif
Simon Glass5af29bd2013-03-14 07:20:12 +0000776 INIT_FUNC_WATCHDOG_RESET
Simon Glass6f5567d2013-03-05 14:39:53 +0000777#if defined(CONFIG_PPC) || defined(CONFIG_X86)
Simon Glass5af29bd2013-03-14 07:20:12 +0000778 /* initialize higher level parts of CPU like time base and timers */
779 cpu_init_r,
Simon Glass6f5567d2013-03-05 14:39:53 +0000780#endif
781#ifdef CONFIG_PPC
Simon Glass5af29bd2013-03-14 07:20:12 +0000782 initr_spi,
783#endif
Simon Glass6f5567d2013-03-05 14:39:53 +0000784#if defined(CONFIG_X86) && defined(CONFIG_SPI)
785 init_func_spi,
786#endif
Simon Glassdb397fa2013-03-11 14:30:37 +0000787#ifdef CONFIG_CMD_NAND
788 initr_nand,
789#endif
790#ifdef CONFIG_CMD_ONENAND
791 initr_onenand,
792#endif
793#ifdef CONFIG_GENERIC_MMC
794 initr_mmc,
795#endif
796#ifdef CONFIG_HAS_DATAFLASH
797 initr_dataflash,
798#endif
799 initr_env,
Simon Glass5af29bd2013-03-14 07:20:12 +0000800 INIT_FUNC_WATCHDOG_RESET
801 initr_secondary_cpu,
802#ifdef CONFIG_SC3
803 initr_sc3_read_eeprom,
804#endif
805#ifdef CONFIG_HERMES
806 initr_hermes,
807#endif
808#if defined(CONFIG_ID_EEPROM) || defined(CONFIG_SYS_I2C_MAC_OFFSET)
809 mac_read_from_eeprom,
810#endif
811 INIT_FUNC_WATCHDOG_RESET
812#if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
813 /*
814 * Do pci configuration
815 */
816 initr_pci,
817#endif
Simon Glassdb397fa2013-03-11 14:30:37 +0000818 stdio_init,
819 initr_jumptable,
820#ifdef CONFIG_API
821 initr_api,
822#endif
823 console_init_r, /* fully init console as a device */
824#ifdef CONFIG_DISPLAY_BOARDINFO_LATE
825 show_model_r,
826#endif
827#ifdef CONFIG_ARCH_MISC_INIT
828 arch_misc_init, /* miscellaneous arch-dependent init */
829#endif
830#ifdef CONFIG_MISC_INIT_R
831 misc_init_r, /* miscellaneous platform-dependent init */
832#endif
Simon Glass5af29bd2013-03-14 07:20:12 +0000833#ifdef CONFIG_HERMES
834 initr_hermes_start,
835#endif
836 INIT_FUNC_WATCHDOG_RESET
837#ifdef CONFIG_CMD_KGDB
838 initr_kgdb,
839#endif
Simon Glass6f5567d2013-03-05 14:39:53 +0000840#ifdef CONFIG_X86
841 board_early_init_r,
842#endif
Simon Glassdb397fa2013-03-11 14:30:37 +0000843 interrupt_init,
Simon Glass6f5567d2013-03-05 14:39:53 +0000844#if defined(CONFIG_ARM) || defined(CONFIG_x86)
Simon Glassdb397fa2013-03-11 14:30:37 +0000845 initr_enable_interrupts,
Simon Glass5af29bd2013-03-14 07:20:12 +0000846#endif
Simon Glass6f5567d2013-03-05 14:39:53 +0000847#ifdef CONFIG_X86
848 timer_init, /* initialize timer */
849#endif
Simon Glass5af29bd2013-03-14 07:20:12 +0000850#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
851 initr_status_led,
852#endif
853 /* PPC has a udelay(20) here dating from 2002. Why? */
Simon Glassdb397fa2013-03-11 14:30:37 +0000854#ifdef CONFIG_CMD_NET
855 initr_ethaddr,
856#endif
857#ifdef CONFIG_BOARD_LATE_INIT
858 board_late_init,
859#endif
Simon Glass5af29bd2013-03-14 07:20:12 +0000860#ifdef CONFIG_CMD_SCSI
861 INIT_FUNC_WATCHDOG_RESET
862 initr_scsi,
863#endif
864#ifdef CONFIG_CMD_DOC
865 INIT_FUNC_WATCHDOG_RESET
866 initr_doc,
867#endif
Simon Glassdb397fa2013-03-11 14:30:37 +0000868#ifdef CONFIG_BITBANGMII
869 initr_bbmii,
870#endif
871#ifdef CONFIG_CMD_NET
Simon Glass5af29bd2013-03-14 07:20:12 +0000872 INIT_FUNC_WATCHDOG_RESET
Simon Glassdb397fa2013-03-11 14:30:37 +0000873 initr_net,
874#endif
875#ifdef CONFIG_POST
876 initr_post,
877#endif
Simon Glass5af29bd2013-03-14 07:20:12 +0000878#if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_CMD_IDE)
879 initr_pcmcia,
880#endif
881#if defined(CONFIG_CMD_IDE)
882 initr_ide,
883#endif
884#ifdef CONFIG_LAST_STAGE_INIT
885 INIT_FUNC_WATCHDOG_RESET
886 /*
887 * Some parts can be only initialized if all others (like
888 * Interrupts) are up and running (i.e. the PC-style ISA
889 * keyboard).
890 */
891 last_stage_init,
892#endif
893#ifdef CONFIG_CMD_BEDBUG
894 INIT_FUNC_WATCHDOG_RESET
895 initr_bedbug,
896#endif
897#if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
898 initr_mem,
899#endif
900#ifdef CONFIG_PS2KBD
901 initr_kbd,
902#endif
903#ifdef CONFIG_MODEM_SUPPORT
904 initr_modem,
905#endif
Simon Glassdb397fa2013-03-11 14:30:37 +0000906 run_main_loop,
907};
908
909void board_init_r(gd_t *new_gd, ulong dest_addr)
910{
Simon Glass6f5567d2013-03-05 14:39:53 +0000911#ifndef CONFIG_X86
Simon Glassdb397fa2013-03-11 14:30:37 +0000912 gd = new_gd;
Simon Glass6f5567d2013-03-05 14:39:53 +0000913#endif
Simon Glassdb397fa2013-03-11 14:30:37 +0000914 if (initcall_run_list(init_sequence_r))
915 hang();
916
917 /* NOTREACHED - run_main_loop() does not return */
918 hang();
919}