board_r.c 18 KB

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