]> git.ipfire.org Git - people/ms/u-boot.git/blame - common/board_r.c
OMAP3/4/5/AM33xx: Correct logic for checking FAT or RAW MMC
[people/ms/u-boot.git] / common / board_r.c
CommitLineData
6f6430d7
SG
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>
c2240d4d
SG
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
6f6430d7
SG
34#ifdef CONFIG_HAS_DATAFLASH
35#include <dataflash.h>
36#endif
37#include <environment.h>
38#include <fdtdec.h>
c2240d4d
SG
39#if defined(CONFIG_CMD_IDE)
40#include <ide.h>
41#endif
6f6430d7 42#include <initcall.h>
c2240d4d
SG
43#ifdef CONFIG_PS2KBD
44#include <keyboard.h>
45#endif
46#if defined(CONFIG_CMD_KGDB)
47#include <kgdb.h>
48#endif
6f6430d7
SG
49#include <logbuff.h>
50#include <malloc.h>
c2240d4d
SG
51#ifdef CONFIG_BITBANGMII
52#include <miiphy.h>
53#endif
6f6430d7
SG
54#include <mmc.h>
55#include <nand.h>
56#include <onenand_uboot.h>
c2240d4d 57#include <scsi.h>
6f6430d7 58#include <serial.h>
c2240d4d 59#include <spi.h>
6f6430d7 60#include <stdio_dev.h>
c2240d4d
SG
61#include <watchdog.h>
62#ifdef CONFIG_ADDR_MAP
63#include <asm/mmu.h>
64#endif
6f6430d7 65#include <asm/sections.h>
be274b99
SG
66#ifdef CONFIG_X86
67#include <asm/init_helpers.h>
68#endif
c2240d4d 69#include <linux/compiler.h>
6f6430d7
SG
70
71DECLARE_GLOBAL_DATA_PTR;
72
73ulong monitor_flash_len;
74
c2240d4d
SG
75int __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}
6f6430d7
SG
108
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
c2240d4d
SG
130__weak int fixup_cpu(void)
131{
132 return 0;
133}
134
6f6430d7
SG
135static 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
c2240d4d
SG
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;
6f6430d7
SG
167}
168
169static int initr_serial(void)
170{
171 serial_initialize();
172 return 0;
173}
174
c2240d4d
SG
175#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
6f6430d7
SG
196#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
c2240d4d
SG
217#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
6f6430d7
SG
261static 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
276static 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)
283static int initr_flash(void)
284{
c2240d4d
SG
285 ulong flash_size = 0;
286 bd_t *bd = gd->bd;
287 int ok;
6f6430d7
SG
288
289 puts("Flash: ");
290
c2240d4d
SG
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) {
6f6430d7 300 puts("*** failed ***\n");
c2240d4d
SG
301#ifdef CONFIG_PPC
302 /* Why does PPC do this? */
303 hang();
304#endif
6f6430d7
SG
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
c2240d4d
SG
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
346static 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
6f6430d7
SG
355 return 0;
356}
357#endif
358
359#ifdef CONFIG_CMD_NAND
360/* go init the NAND */
361int 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 */
371int initr_onenand(void)
372{
373 puts("NAND: ");
374 onenand_init();
375 return 0;
376}
377#endif
378
379#ifdef CONFIG_GENERIC_MMC
380int initr_mmc(void)
381{
382 puts("MMC: ");
383 mmc_initialize(gd->bd);
384 return 0;
385}
386#endif
387
388#ifdef CONFIG_HAS_DATAFLASH
389int 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 */
408static 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
419static 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);
c2240d4d
SG
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
451static 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
460static int initr_hermes_start(void)
461{
462 if (gd->bd->bi_ethspeed != 0xFFFF)
463 hermes_start_lxt980((int) gd->bd->bi_ethspeed);
6f6430d7
SG
464 return 0;
465}
c2240d4d
SG
466#endif
467
468#ifdef CONFIG_SC3
469/* TODO: with new initcalls, move this into the driver */
470extern void sc3_read_eeprom(void);
471
472static int initr_sc3_read_eeprom(void)
473{
474 sc3_read_eeprom();
475 return 0;
476}
477#endif
6f6430d7
SG
478
479static int initr_jumptable(void)
480{
481 jumptable_init();
482 return 0;
483}
484
485#if defined(CONFIG_API)
486static int initr_api(void)
487{
488 /* Initialize API */
489 api_init();
490 return 0;
491}
492#endif
493
494#ifdef CONFIG_DISPLAY_BOARDINFO_LATE
495static 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 */
e424c15c 510#ifdef CONFIG_ARM
6f6430d7
SG
511static int initr_enable_interrupts(void)
512{
513 enable_interrupts();
514 return 0;
515}
e424c15c 516#endif
6f6430d7
SG
517
518#ifdef CONFIG_CMD_NET
519static int initr_ethaddr(void)
520{
c2240d4d
SG
521 bd_t *bd = gd->bd;
522
523 /* kept around for legacy kernels only ... ignore the next section */
524 eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr);
525#ifdef CONFIG_HAS_ETH1
526 eth_getenv_enetaddr("eth1addr", bd->bi_enet1addr);
527#endif
528#ifdef CONFIG_HAS_ETH2
529 eth_getenv_enetaddr("eth2addr", bd->bi_enet2addr);
530#endif
531#ifdef CONFIG_HAS_ETH3
532 eth_getenv_enetaddr("eth3addr", bd->bi_enet3addr);
533#endif
534#ifdef CONFIG_HAS_ETH4
535 eth_getenv_enetaddr("eth4addr", bd->bi_enet4addr);
536#endif
537#ifdef CONFIG_HAS_ETH5
538 eth_getenv_enetaddr("eth5addr", bd->bi_enet5addr);
539#endif
540 return 0;
541}
542#endif /* CONFIG_CMD_NET */
543
544#ifdef CONFIG_CMD_KGDB
545static int initr_kgdb(void)
546{
547 puts("KGDB: ");
548 kgdb_init();
549 return 0;
550}
551#endif
552
553#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
554static int initr_status_led(void)
555{
556 status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
557
558 return 0;
559}
560#endif
561
562#if defined(CONFIG_CMD_SCSI)
563static int initr_scsi(void)
564{
565 /* Not supported properly on ARM yet */
566#ifndef CONFIG_ARM
567 puts("SCSI: ");
568 scsi_init();
569#endif
6f6430d7
SG
570
571 return 0;
572}
573#endif /* CONFIG_CMD_NET */
574
c2240d4d
SG
575#if defined(CONFIG_CMD_DOC)
576static int initr_doc(void)
577{
578 puts("DOC: ");
579 doc_init();
580}
581#endif
582
6f6430d7
SG
583#ifdef CONFIG_BITBANGMII
584static int initr_bbmii(void)
585{
586 bb_miiphy_init();
587 return 0;
588}
589#endif
590
591#ifdef CONFIG_CMD_NET
592static int initr_net(void)
593{
594 puts("Net: ");
595 eth_initialize(gd->bd);
596#if defined(CONFIG_RESET_PHY_R)
597 debug("Reset Ethernet PHY\n");
598 reset_phy();
599#endif
600 return 0;
601}
602#endif
603
604#ifdef CONFIG_POST
605static int initr_post(void)
606{
607 post_run(NULL, POST_RAM | post_bootmode_get(0));
608 return 0;
609}
610#endif
611
c2240d4d
SG
612#if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_CMD_IDE)
613static int initr_pcmcia(void)
614{
615 puts("PCMCIA:");
616 pcmcia_init();
617 return 0;
618}
619#endif
620
621#if defined(CONFIG_CMD_IDE)
622static int initr_ide(void)
623{
624#ifdef CONFIG_IDE_8xx_PCCARD
625 puts("PCMCIA:");
626#else
627 puts("IDE: ");
628#endif
629#if defined(CONFIG_START_IDE)
630 if (board_start_ide())
631 ide_init();
632#else
633 ide_init();
634#endif
635 return 0;
636}
637#endif
638
6f6430d7
SG
639#if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
640/*
641 * Export available size of memory for Linux, taking into account the
642 * protected RAM at top of memory
643 */
644int initr_mem(void)
645{
646 ulong pram = 0;
647 char memsz[32];
648
649# ifdef CONFIG_PRAM
650 pram = getenv_ulong("pram", 10, CONFIG_PRAM);
651# endif
652# if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
653 /* Also take the logbuffer into account (pram is in kB) */
654 pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
655# endif
656 sprintf(memsz, "%ldk", (gd->ram_size / 1024) - pram);
657 setenv("mem", memsz);
c2240d4d
SG
658
659 return 0;
660}
661#endif
662
663#ifdef CONFIG_CMD_BEDBUG
664static int initr_bedbug(void)
665{
666 bedbug_init();
667
668 return 0;
669}
670#endif
671
672#ifdef CONFIG_PS2KBD
673static int initr_kbd(void)
674{
675 puts("PS/2: ");
676 kbd_init();
677 return 0;
678}
679#endif
680
681#ifdef CONFIG_MODEM_SUPPORT
682static int initr_modem(void)
683{
684 /* TODO: with new initcalls, move this into the driver */
685 extern int do_mdm_init;
686
687 do_mdm_init = gd->do_mdm_init;
688 return 0;
6f6430d7
SG
689}
690#endif
691
692static int run_main_loop(void)
693{
694 /* main_loop() can return to retry autoboot, if so just run it again */
695 for (;;)
696 main_loop();
697 return 0;
698}
699
700/*
701 * Over time we hope to remove these functions with code fragments and
702 * stub funtcions, and instead call the relevant function directly.
703 *
704 * We also hope to remove most of the driver-related init and do it if/when
705 * the driver is later used.
c2240d4d
SG
706 *
707 * TODO: perhaps reset the watchdog in the initcall function after each call?
6f6430d7
SG
708 */
709init_fnc_t init_sequence_r[] = {
710 initr_reloc,
c2240d4d 711 /* TODO: could x86/PPC have this also perhaps? */
6f6430d7
SG
712#ifdef CONFIG_ARM
713 initr_caches,
714 board_init, /* Setup chipselects */
c2240d4d
SG
715#endif
716 /*
717 * TODO: printing of the clock inforamtion of the board is now
718 * implemented as part of bdinfo command. Currently only support for
719 * davinci SOC's is added. Remove this check once all the board
720 * implement this.
721 */
722#ifdef CONFIG_CLOCKS
723 set_cpu_clk_info, /* Setup clock information */
be274b99
SG
724#endif
725#ifdef CONFIG_X86
726 init_bd_struct_r,
6f6430d7
SG
727#endif
728 initr_reloc_global_data,
729 initr_serial,
730 initr_announce,
c2240d4d
SG
731 INIT_FUNC_WATCHDOG_RESET
732#ifdef CONFIG_PPC
733 initr_trap,
734#endif
735#ifdef CONFIG_ADDR_MAP
736 initr_addr_map,
737#endif
738#if defined(CONFIG_BOARD_EARLY_INIT_R)
739 board_early_init_r,
740#endif
741 INIT_FUNC_WATCHDOG_RESET
6f6430d7
SG
742#ifdef CONFIG_LOGBUFFER
743 initr_logbuffer,
744#endif
745#ifdef CONFIG_POST
746 initr_post_backlog,
747#endif
c2240d4d
SG
748 INIT_FUNC_WATCHDOG_RESET
749#ifdef CONFIG_SYS_DELAYED_ICACHE
750 initr_icache_enable,
751#endif
752#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
753 initr_unlock_ram_in_cache,
754#endif
755#if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT)
756 /*
757 * Do early PCI configuration _before_ the flash gets initialised,
758 * because PCU ressources are crucial for flash access on some boards.
759 */
760 initr_pci,
761#endif
762#ifdef CONFIG_WINBOND_83C553
763 initr_w83c553f,
764#endif
765 initr_barrier,
6f6430d7
SG
766 initr_malloc,
767#ifdef CONFIG_ARCH_EARLY_INIT_R
768 arch_early_init_r,
769#endif
770 power_init_board,
771#ifndef CONFIG_SYS_NO_FLASH
772 initr_flash,
c2240d4d
SG
773#endif
774 INIT_FUNC_WATCHDOG_RESET
be274b99 775#if defined(CONFIG_PPC) || defined(CONFIG_X86)
c2240d4d
SG
776 /* initialize higher level parts of CPU like time base and timers */
777 cpu_init_r,
be274b99
SG
778#endif
779#ifdef CONFIG_PPC
c2240d4d 780 initr_spi,
6f6430d7 781#endif
be274b99
SG
782#if defined(CONFIG_X86) && defined(CONFIG_SPI)
783 init_func_spi,
784#endif
6f6430d7
SG
785#ifdef CONFIG_CMD_NAND
786 initr_nand,
787#endif
788#ifdef CONFIG_CMD_ONENAND
789 initr_onenand,
790#endif
791#ifdef CONFIG_GENERIC_MMC
792 initr_mmc,
793#endif
794#ifdef CONFIG_HAS_DATAFLASH
795 initr_dataflash,
796#endif
797 initr_env,
c2240d4d
SG
798 INIT_FUNC_WATCHDOG_RESET
799 initr_secondary_cpu,
800#ifdef CONFIG_SC3
801 initr_sc3_read_eeprom,
802#endif
803#ifdef CONFIG_HERMES
804 initr_hermes,
805#endif
806#if defined(CONFIG_ID_EEPROM) || defined(CONFIG_SYS_I2C_MAC_OFFSET)
807 mac_read_from_eeprom,
808#endif
809 INIT_FUNC_WATCHDOG_RESET
810#if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
811 /*
812 * Do pci configuration
813 */
814 initr_pci,
815#endif
6f6430d7
SG
816 stdio_init,
817 initr_jumptable,
818#ifdef CONFIG_API
819 initr_api,
820#endif
821 console_init_r, /* fully init console as a device */
822#ifdef CONFIG_DISPLAY_BOARDINFO_LATE
823 show_model_r,
824#endif
825#ifdef CONFIG_ARCH_MISC_INIT
826 arch_misc_init, /* miscellaneous arch-dependent init */
827#endif
828#ifdef CONFIG_MISC_INIT_R
829 misc_init_r, /* miscellaneous platform-dependent init */
c2240d4d
SG
830#endif
831#ifdef CONFIG_HERMES
832 initr_hermes_start,
833#endif
834 INIT_FUNC_WATCHDOG_RESET
835#ifdef CONFIG_CMD_KGDB
836 initr_kgdb,
be274b99
SG
837#endif
838#ifdef CONFIG_X86
839 board_early_init_r,
6f6430d7
SG
840#endif
841 interrupt_init,
be274b99 842#if defined(CONFIG_ARM) || defined(CONFIG_x86)
6f6430d7 843 initr_enable_interrupts,
c2240d4d 844#endif
be274b99
SG
845#ifdef CONFIG_X86
846 timer_init, /* initialize timer */
847#endif
c2240d4d
SG
848#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
849 initr_status_led,
850#endif
851 /* PPC has a udelay(20) here dating from 2002. Why? */
6f6430d7
SG
852#ifdef CONFIG_CMD_NET
853 initr_ethaddr,
854#endif
855#ifdef CONFIG_BOARD_LATE_INIT
856 board_late_init,
857#endif
c2240d4d
SG
858#ifdef CONFIG_CMD_SCSI
859 INIT_FUNC_WATCHDOG_RESET
860 initr_scsi,
861#endif
862#ifdef CONFIG_CMD_DOC
863 INIT_FUNC_WATCHDOG_RESET
864 initr_doc,
865#endif
6f6430d7
SG
866#ifdef CONFIG_BITBANGMII
867 initr_bbmii,
868#endif
869#ifdef CONFIG_CMD_NET
c2240d4d 870 INIT_FUNC_WATCHDOG_RESET
6f6430d7
SG
871 initr_net,
872#endif
873#ifdef CONFIG_POST
874 initr_post,
c2240d4d
SG
875#endif
876#if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_CMD_IDE)
877 initr_pcmcia,
878#endif
879#if defined(CONFIG_CMD_IDE)
880 initr_ide,
881#endif
882#ifdef CONFIG_LAST_STAGE_INIT
883 INIT_FUNC_WATCHDOG_RESET
884 /*
885 * Some parts can be only initialized if all others (like
886 * Interrupts) are up and running (i.e. the PC-style ISA
887 * keyboard).
888 */
889 last_stage_init,
890#endif
891#ifdef CONFIG_CMD_BEDBUG
892 INIT_FUNC_WATCHDOG_RESET
893 initr_bedbug,
894#endif
895#if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
896 initr_mem,
897#endif
898#ifdef CONFIG_PS2KBD
899 initr_kbd,
900#endif
901#ifdef CONFIG_MODEM_SUPPORT
902 initr_modem,
6f6430d7
SG
903#endif
904 run_main_loop,
905};
906
907void board_init_r(gd_t *new_gd, ulong dest_addr)
908{
be274b99 909#ifndef CONFIG_X86
6f6430d7 910 gd = new_gd;
be274b99 911#endif
6f6430d7
SG
912 if (initcall_run_list(init_sequence_r))
913 hang();
914
915 /* NOTREACHED - run_main_loop() does not return */
916 hang();
917}