]> git.sur5r.net Git - u-boot/blob - common/board_r.c
63c69365b19733ed53a29ef71c370a644e03087a
[u-boot] / common / board_r.c
1 /*
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>
30 /* 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
34 #ifdef CONFIG_HAS_DATAFLASH
35 #include <dataflash.h>
36 #endif
37 #include <environment.h>
38 #include <fdtdec.h>
39 #if defined(CONFIG_CMD_IDE)
40 #include <ide.h>
41 #endif
42 #include <initcall.h>
43 #ifdef CONFIG_PS2KBD
44 #include <keyboard.h>
45 #endif
46 #if defined(CONFIG_CMD_KGDB)
47 #include <kgdb.h>
48 #endif
49 #include <logbuff.h>
50 #include <malloc.h>
51 #ifdef CONFIG_BITBANGMII
52 #include <miiphy.h>
53 #endif
54 #include <mmc.h>
55 #include <nand.h>
56 #include <onenand_uboot.h>
57 #include <scsi.h>
58 #include <serial.h>
59 #include <spi.h>
60 #include <stdio_dev.h>
61 #include <watchdog.h>
62 #ifdef CONFIG_ADDR_MAP
63 #include <asm/mmu.h>
64 #endif
65 #include <asm/sections.h>
66 #ifdef CONFIG_X86
67 #include <asm/init_helpers.h>
68 #endif
69 #include <linux/compiler.h>
70
71 DECLARE_GLOBAL_DATA_PTR;
72
73 ulong monitor_flash_len;
74
75 int __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
85 int board_flash_wp_on(void)
86         __attribute__ ((weak, alias("__board_flash_wp_on")));
87
88 void __cpu_secondary_init_r(void)
89 {
90 }
91
92 void cpu_secondary_init_r(void)
93         __attribute__ ((weak, alias("__cpu_secondary_init_r")));
94
95 static 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 }
108
109 static 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  */
122 static int initr_caches(void)
123 {
124         /* Enable caches */
125         enable_caches();
126         return 0;
127 }
128 #endif
129
130 __weak int fixup_cpu(void)
131 {
132         return 0;
133 }
134
135 static int initr_reloc_global_data(void)
136 {
137 #ifdef CONFIG_SYS_SYM_OFFSETS
138         monitor_flash_len = _end_ofs;
139 #else
140         monitor_flash_len = (ulong)&__init_end - gd->dest_addr;
141 #endif
142 #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;
167 }
168
169 static int initr_serial(void)
170 {
171         serial_initialize();
172         return 0;
173 }
174
175 #ifdef CONFIG_PPC
176 static 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
188 static int initr_addr_map(void)
189 {
190         init_addr_map();
191
192         return 0;
193 }
194 #endif
195
196 #ifdef CONFIG_LOGBUFFER
197 unsigned long logbuffer_base(void)
198 {
199         return gd->ram_top - LOGBUFF_LEN;
200 }
201
202 static int initr_logbuffer(void)
203 {
204         logbuff_init_ptrs();
205         return 0;
206 }
207 #endif
208
209 #ifdef CONFIG_POST
210 static int initr_post_backlog(void)
211 {
212         post_output_backlog();
213         return 0;
214 }
215 #endif
216
217 #ifdef CONFIG_SYS_DELAYED_ICACHE
218 static int initr_icache_enable(void)
219 {
220         return 0;
221 }
222 #endif
223
224 #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
225 static 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
233 static int initr_pci(void)
234 {
235         pci_init();
236
237         return 0;
238 }
239 #endif
240
241 #ifdef CONFIG_WINBOND_83C553
242 static int initr_w83c553f(void)
243 {
244         /*
245          * Initialise the ISA bridge
246          */
247         initialise_w83c553f();
248         return 0;
249 }
250 #endif
251
252 static 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
261 static 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;
267         mem_malloc_init(malloc_start, TOTAL_MALLOC_LEN);
268         return 0;
269 }
270
271 __weak int power_init_board(void)
272 {
273         return 0;
274 }
275
276 static int initr_announce(void)
277 {
278         debug("Now running in RAM - U-Boot at: %08lx\n", gd->dest_addr);
279         return 0;
280 }
281
282 #if !defined(CONFIG_SYS_NO_FLASH)
283 static int initr_flash(void)
284 {
285         ulong flash_size = 0;
286         bd_t *bd = gd->bd;
287         int ok;
288
289         puts("Flash: ");
290
291         if (board_flash_wp_on()) {
292                 printf("Uninitialized - Write Protect On\n");
293                 /* Since WP is on, we can't find real size.  Set to 0 */
294                 ok = 1;
295         } else {
296                 flash_size = flash_init();
297                 ok = flash_size > 0;
298         }
299         if (!ok) {
300                 puts("*** failed ***\n");
301 #ifdef CONFIG_PPC
302                 /* Why does PPC do this? */
303                 hang();
304 #endif
305                 return -1;
306         }
307         print_size(flash_size, "");
308 #ifdef CONFIG_SYS_FLASH_CHECKSUM
309         /*
310         * Compute and print flash CRC if flashchecksum is set to 'y'
311         *
312         * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
313         */
314         if (getenv_yesno("flashchecksum") == 1) {
315                 printf("  CRC: %08X", crc32(0,
316                         (const unsigned char *) CONFIG_SYS_FLASH_BASE,
317                         flash_size));
318         }
319 #endif /* CONFIG_SYS_FLASH_CHECKSUM */
320         putc('\n');
321
322         /* update start of FLASH memory    */
323 #ifdef CONFIG_SYS_FLASH_BASE
324         bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
325 #endif
326         /* size of FLASH memory (final value) */
327         bd->bi_flashsize = flash_size;
328
329 #if defined(CONFIG_SYS_UPDATE_FLASH_SIZE)
330         /* Make a update of the Memctrl. */
331         update_flash_size(flash_size);
332 #endif
333
334
335 #if defined(CONFIG_OXC) || defined(CONFIG_RMU)
336         /* flash mapped at end of memory map */
337         bd->bi_flashoffset = CONFIG_SYS_TEXT_BASE + flash_size;
338 #elif CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE
339         bd->bi_flashoffset = monitor_flash_len; /* reserved area for monitor */
340 #endif
341         return 0;
342 }
343 #endif
344
345 #ifdef CONFIG_PPC
346 static int initr_spi(void)
347 {
348         /* PPC does this here */
349 #ifdef CONFIG_SPI
350 #if !defined(CONFIG_ENV_IS_IN_EEPROM)
351         spi_init_f();
352 #endif
353         spi_init_r();
354 #endif
355         return 0;
356 }
357 #endif
358
359 #ifdef CONFIG_CMD_NAND
360 /* go init the NAND */
361 int initr_nand(void)
362 {
363         puts("NAND:  ");
364         nand_init();
365         return 0;
366 }
367 #endif
368
369 #if defined(CONFIG_CMD_ONENAND)
370 /* go init the NAND */
371 int initr_onenand(void)
372 {
373         puts("NAND:  ");
374         onenand_init();
375         return 0;
376 }
377 #endif
378
379 #ifdef CONFIG_GENERIC_MMC
380 int initr_mmc(void)
381 {
382         puts("MMC:   ");
383         mmc_initialize(gd->bd);
384         return 0;
385 }
386 #endif
387
388 #ifdef CONFIG_HAS_DATAFLASH
389 int initr_dataflash(void)
390 {
391         AT91F_DataflashInit();
392         dataflash_print_info();
393         return 0;
394 }
395 #endif
396
397 /*
398  * Tell if it's OK to load the environment early in boot.
399  *
400  * If CONFIG_OF_CONFIG is defined, we'll check with the FDT to see
401  * if this is OK (defaulting to saying it's OK).
402  *
403  * NOTE: Loading the environment early can be a bad idea if security is
404  *       important, since no verification is done on the environment.
405  *
406  * @return 0 if environment should not be loaded, !=0 if it is ok to load
407  */
408 static int should_load_env(void)
409 {
410 #ifdef CONFIG_OF_CONTROL
411         return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 1);
412 #elif defined CONFIG_DELAY_ENVIRONMENT
413         return 0;
414 #else
415         return 1;
416 #endif
417 }
418
419 static int initr_env(void)
420 {
421         /* initialize environment */
422         if (should_load_env())
423                 env_relocate();
424         else
425                 set_default_env(NULL);
426
427         /* Initialize from environment */
428         load_addr = getenv_ulong("loadaddr", 16, load_addr);
429 #if defined(CONFIG_SYS_EXTBDINFO)
430 #if defined(CONFIG_405GP) || defined(CONFIG_405EP)
431 #if defined(CONFIG_I2CFAST)
432         /*
433          * set bi_iic_fast for linux taking environment variable
434          * "i2cfast" into account
435          */
436         {
437                 char *s = getenv("i2cfast");
438
439                 if (s && ((*s == 'y') || (*s == 'Y'))) {
440                         gd->bd->bi_iic_fast[0] = 1;
441                         gd->bd->bi_iic_fast[1] = 1;
442                 }
443         }
444 #endif /* CONFIG_I2CFAST */
445 #endif /* CONFIG_405GP, CONFIG_405EP */
446 #endif /* CONFIG_SYS_EXTBDINFO */
447         return 0;
448 }
449
450 #ifdef  CONFIG_HERMES
451 static int initr_hermes(void)
452 {
453         if ((gd->board_type >> 16) == 2)
454                 gd->bd->bi_ethspeed = gd->board_type & 0xFFFF;
455         else
456                 gd->bd->bi_ethspeed = 0xFFFF;
457         return 0;
458 }
459
460 static int initr_hermes_start(void)
461 {
462         if (gd->bd->bi_ethspeed != 0xFFFF)
463                 hermes_start_lxt980((int) gd->bd->bi_ethspeed);
464         return 0;
465 }
466 #endif
467
468 #ifdef CONFIG_SC3
469 /* TODO: with new initcalls, move this into the driver */
470 extern void sc3_read_eeprom(void);
471
472 static int initr_sc3_read_eeprom(void)
473 {
474         sc3_read_eeprom();
475         return 0;
476 }
477 #endif
478
479 static int initr_jumptable(void)
480 {
481         jumptable_init();
482         return 0;
483 }
484
485 #if defined(CONFIG_API)
486 static int initr_api(void)
487 {
488         /* Initialize API */
489         api_init();
490         return 0;
491 }
492 #endif
493
494 #ifdef CONFIG_DISPLAY_BOARDINFO_LATE
495 static int show_model_r(void)
496 {
497         /* Put this here so it appears on the LCD, now it is ready */
498 # ifdef CONFIG_OF_CONTROL
499         const char *model;
500
501         model = (char *)fdt_getprop(gd->fdt_blob, 0, "model", NULL);
502         printf("Model: %s\n", model ? model : "<unknown>");
503 # else
504         checkboard();
505 # endif
506 }
507 #endif
508
509 /* enable exceptions */
510 static int initr_enable_interrupts(void)
511 {
512         enable_interrupts();
513         return 0;
514 }
515
516 #ifdef CONFIG_CMD_NET
517 static int initr_ethaddr(void)
518 {
519         bd_t *bd = gd->bd;
520
521         /* kept around for legacy kernels only ... ignore the next section */
522         eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr);
523 #ifdef CONFIG_HAS_ETH1
524         eth_getenv_enetaddr("eth1addr", bd->bi_enet1addr);
525 #endif
526 #ifdef CONFIG_HAS_ETH2
527         eth_getenv_enetaddr("eth2addr", bd->bi_enet2addr);
528 #endif
529 #ifdef CONFIG_HAS_ETH3
530         eth_getenv_enetaddr("eth3addr", bd->bi_enet3addr);
531 #endif
532 #ifdef CONFIG_HAS_ETH4
533         eth_getenv_enetaddr("eth4addr", bd->bi_enet4addr);
534 #endif
535 #ifdef CONFIG_HAS_ETH5
536         eth_getenv_enetaddr("eth5addr", bd->bi_enet5addr);
537 #endif
538         return 0;
539 }
540 #endif /* CONFIG_CMD_NET */
541
542 #ifdef CONFIG_CMD_KGDB
543 static int initr_kgdb(void)
544 {
545         puts("KGDB:  ");
546         kgdb_init();
547         return 0;
548 }
549 #endif
550
551 #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
552 static int initr_status_led(void)
553 {
554         status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
555
556         return 0;
557 }
558 #endif
559
560 #if defined(CONFIG_CMD_SCSI)
561 static int initr_scsi(void)
562 {
563         /* Not supported properly on ARM yet */
564 #ifndef CONFIG_ARM
565         puts("SCSI:  ");
566         scsi_init();
567 #endif
568
569         return 0;
570 }
571 #endif /* CONFIG_CMD_NET */
572
573 #if defined(CONFIG_CMD_DOC)
574 static int initr_doc(void)
575 {
576         puts("DOC:   ");
577         doc_init();
578 }
579 #endif
580
581 #ifdef CONFIG_BITBANGMII
582 static int initr_bbmii(void)
583 {
584         bb_miiphy_init();
585         return 0;
586 }
587 #endif
588
589 #ifdef CONFIG_CMD_NET
590 static int initr_net(void)
591 {
592         puts("Net:   ");
593         eth_initialize(gd->bd);
594 #if defined(CONFIG_RESET_PHY_R)
595         debug("Reset Ethernet PHY\n");
596         reset_phy();
597 #endif
598         return 0;
599 }
600 #endif
601
602 #ifdef CONFIG_POST
603 static int initr_post(void)
604 {
605         post_run(NULL, POST_RAM | post_bootmode_get(0));
606         return 0;
607 }
608 #endif
609
610 #if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_CMD_IDE)
611 static int initr_pcmcia(void)
612 {
613         puts("PCMCIA:");
614         pcmcia_init();
615         return 0;
616 }
617 #endif
618
619 #if defined(CONFIG_CMD_IDE)
620 static int initr_ide(void)
621 {
622 #ifdef  CONFIG_IDE_8xx_PCCARD
623         puts("PCMCIA:");
624 #else
625         puts("IDE:   ");
626 #endif
627 #if defined(CONFIG_START_IDE)
628         if (board_start_ide())
629                 ide_init();
630 #else
631         ide_init();
632 #endif
633         return 0;
634 }
635 #endif
636
637 #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
638 /*
639  * Export available size of memory for Linux, taking into account the
640  * protected RAM at top of memory
641  */
642 int initr_mem(void)
643 {
644         ulong pram = 0;
645         char memsz[32];
646
647 # ifdef CONFIG_PRAM
648         pram = getenv_ulong("pram", 10, CONFIG_PRAM);
649 # endif
650 # if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
651         /* Also take the logbuffer into account (pram is in kB) */
652         pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
653 # endif
654         sprintf(memsz, "%ldk", (gd->ram_size / 1024) - pram);
655         setenv("mem", memsz);
656
657         return 0;
658 }
659 #endif
660
661 #ifdef CONFIG_CMD_BEDBUG
662 static int initr_bedbug(void)
663 {
664         bedbug_init();
665
666         return 0;
667 }
668 #endif
669
670 #ifdef CONFIG_PS2KBD
671 static int initr_kbd(void)
672 {
673         puts("PS/2:  ");
674         kbd_init();
675         return 0;
676 }
677 #endif
678
679 #ifdef CONFIG_MODEM_SUPPORT
680 static int initr_modem(void)
681 {
682         /* TODO: with new initcalls, move this into the driver */
683         extern int do_mdm_init;
684
685         do_mdm_init = gd->do_mdm_init;
686         return 0;
687 }
688 #endif
689
690 static int run_main_loop(void)
691 {
692         /* main_loop() can return to retry autoboot, if so just run it again */
693         for (;;)
694                 main_loop();
695         return 0;
696 }
697
698 /*
699  * Over time we hope to remove these functions with code fragments and
700  * stub funtcions, and instead call the relevant function directly.
701  *
702  * We also hope to remove most of the driver-related init and do it if/when
703  * the driver is later used.
704  *
705  * TODO: perhaps reset the watchdog in the initcall function after each call?
706  */
707 init_fnc_t init_sequence_r[] = {
708         initr_reloc,
709         /* TODO: could x86/PPC have this also perhaps? */
710 #ifdef CONFIG_ARM
711         initr_caches,
712         board_init,     /* Setup chipselects */
713 #endif
714         /*
715          * TODO: printing of the clock inforamtion of the board is now
716          * implemented as part of bdinfo command. Currently only support for
717          * davinci SOC's is added. Remove this check once all the board
718          * implement this.
719          */
720 #ifdef CONFIG_CLOCKS
721         set_cpu_clk_info, /* Setup clock information */
722 #endif
723 #ifdef CONFIG_X86
724         init_bd_struct_r,
725 #endif
726         initr_reloc_global_data,
727         initr_serial,
728         initr_announce,
729         INIT_FUNC_WATCHDOG_RESET
730 #ifdef CONFIG_PPC
731         initr_trap,
732 #endif
733 #ifdef CONFIG_ADDR_MAP
734         initr_addr_map,
735 #endif
736 #if defined(CONFIG_BOARD_EARLY_INIT_R)
737         board_early_init_r,
738 #endif
739         INIT_FUNC_WATCHDOG_RESET
740 #ifdef CONFIG_LOGBUFFER
741         initr_logbuffer,
742 #endif
743 #ifdef CONFIG_POST
744         initr_post_backlog,
745 #endif
746         INIT_FUNC_WATCHDOG_RESET
747 #ifdef CONFIG_SYS_DELAYED_ICACHE
748         initr_icache_enable,
749 #endif
750 #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
751         initr_unlock_ram_in_cache,
752 #endif
753 #if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT)
754         /*
755          * Do early PCI configuration _before_ the flash gets initialised,
756          * because PCU ressources are crucial for flash access on some boards.
757          */
758         initr_pci,
759 #endif
760 #ifdef CONFIG_WINBOND_83C553
761         initr_w83c553f,
762 #endif
763         initr_barrier,
764         initr_malloc,
765 #ifdef CONFIG_ARCH_EARLY_INIT_R
766         arch_early_init_r,
767 #endif
768         power_init_board,
769 #ifndef CONFIG_SYS_NO_FLASH
770         initr_flash,
771 #endif
772         INIT_FUNC_WATCHDOG_RESET
773 #if defined(CONFIG_PPC) || defined(CONFIG_X86)
774         /* initialize higher level parts of CPU like time base and timers */
775         cpu_init_r,
776 #endif
777 #ifdef CONFIG_PPC
778         initr_spi,
779 #endif
780 #if defined(CONFIG_X86) && defined(CONFIG_SPI)
781         init_func_spi,
782 #endif
783 #ifdef CONFIG_CMD_NAND
784         initr_nand,
785 #endif
786 #ifdef CONFIG_CMD_ONENAND
787         initr_onenand,
788 #endif
789 #ifdef CONFIG_GENERIC_MMC
790         initr_mmc,
791 #endif
792 #ifdef CONFIG_HAS_DATAFLASH
793         initr_dataflash,
794 #endif
795         initr_env,
796         INIT_FUNC_WATCHDOG_RESET
797         initr_secondary_cpu,
798 #ifdef CONFIG_SC3
799         initr_sc3_read_eeprom,
800 #endif
801 #ifdef  CONFIG_HERMES
802         initr_hermes,
803 #endif
804 #if defined(CONFIG_ID_EEPROM) || defined(CONFIG_SYS_I2C_MAC_OFFSET)
805         mac_read_from_eeprom,
806 #endif
807         INIT_FUNC_WATCHDOG_RESET
808 #if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
809         /*
810          * Do pci configuration
811          */
812         initr_pci,
813 #endif
814         stdio_init,
815         initr_jumptable,
816 #ifdef CONFIG_API
817         initr_api,
818 #endif
819         console_init_r,         /* fully init console as a device */
820 #ifdef CONFIG_DISPLAY_BOARDINFO_LATE
821         show_model_r,
822 #endif
823 #ifdef CONFIG_ARCH_MISC_INIT
824         arch_misc_init,         /* miscellaneous arch-dependent init */
825 #endif
826 #ifdef CONFIG_MISC_INIT_R
827         misc_init_r,            /* miscellaneous platform-dependent init */
828 #endif
829 #ifdef CONFIG_HERMES
830         initr_hermes_start,
831 #endif
832         INIT_FUNC_WATCHDOG_RESET
833 #ifdef CONFIG_CMD_KGDB
834         initr_kgdb,
835 #endif
836 #ifdef CONFIG_X86
837         board_early_init_r,
838 #endif
839         interrupt_init,
840 #if defined(CONFIG_ARM) || defined(CONFIG_x86)
841         initr_enable_interrupts,
842 #endif
843 #ifdef CONFIG_X86
844         timer_init,             /* initialize timer */
845 #endif
846 #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
847         initr_status_led,
848 #endif
849         /* PPC has a udelay(20) here dating from 2002. Why? */
850 #ifdef CONFIG_CMD_NET
851         initr_ethaddr,
852 #endif
853 #ifdef CONFIG_BOARD_LATE_INIT
854         board_late_init,
855 #endif
856 #ifdef CONFIG_CMD_SCSI
857         INIT_FUNC_WATCHDOG_RESET
858         initr_scsi,
859 #endif
860 #ifdef CONFIG_CMD_DOC
861         INIT_FUNC_WATCHDOG_RESET
862         initr_doc,
863 #endif
864 #ifdef CONFIG_BITBANGMII
865         initr_bbmii,
866 #endif
867 #ifdef CONFIG_CMD_NET
868         INIT_FUNC_WATCHDOG_RESET
869         initr_net,
870 #endif
871 #ifdef CONFIG_POST
872         initr_post,
873 #endif
874 #if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_CMD_IDE)
875         initr_pcmcia,
876 #endif
877 #if defined(CONFIG_CMD_IDE)
878         initr_ide,
879 #endif
880 #ifdef CONFIG_LAST_STAGE_INIT
881         INIT_FUNC_WATCHDOG_RESET
882         /*
883          * Some parts can be only initialized if all others (like
884          * Interrupts) are up and running (i.e. the PC-style ISA
885          * keyboard).
886          */
887         last_stage_init,
888 #endif
889 #ifdef CONFIG_CMD_BEDBUG
890         INIT_FUNC_WATCHDOG_RESET
891         initr_bedbug,
892 #endif
893 #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
894         initr_mem,
895 #endif
896 #ifdef CONFIG_PS2KBD
897         initr_kbd,
898 #endif
899 #ifdef CONFIG_MODEM_SUPPORT
900         initr_modem,
901 #endif
902         run_main_loop,
903 };
904
905 void board_init_r(gd_t *new_gd, ulong dest_addr)
906 {
907 #ifndef CONFIG_X86
908         gd = new_gd;
909 #endif
910         if (initcall_run_list(init_sequence_r))
911                 hang();
912
913         /* NOTREACHED - run_main_loop() does not return */
914         hang();
915 }