board_r.c 18 KB

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