board_r.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  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. #ifdef CONFIG_ARM
  453. static int initr_enable_interrupts(void)
  454. {
  455. enable_interrupts();
  456. return 0;
  457. }
  458. #endif
  459. #ifdef CONFIG_CMD_NET
  460. static int initr_ethaddr(void)
  461. {
  462. bd_t *bd = gd->bd;
  463. /* kept around for legacy kernels only ... ignore the next section */
  464. eth_getenv_enetaddr("ethaddr", bd->bi_enetaddr);
  465. #ifdef CONFIG_HAS_ETH1
  466. eth_getenv_enetaddr("eth1addr", bd->bi_enet1addr);
  467. #endif
  468. #ifdef CONFIG_HAS_ETH2
  469. eth_getenv_enetaddr("eth2addr", bd->bi_enet2addr);
  470. #endif
  471. #ifdef CONFIG_HAS_ETH3
  472. eth_getenv_enetaddr("eth3addr", bd->bi_enet3addr);
  473. #endif
  474. #ifdef CONFIG_HAS_ETH4
  475. eth_getenv_enetaddr("eth4addr", bd->bi_enet4addr);
  476. #endif
  477. #ifdef CONFIG_HAS_ETH5
  478. eth_getenv_enetaddr("eth5addr", bd->bi_enet5addr);
  479. #endif
  480. return 0;
  481. }
  482. #endif /* CONFIG_CMD_NET */
  483. #ifdef CONFIG_CMD_KGDB
  484. static int initr_kgdb(void)
  485. {
  486. puts("KGDB: ");
  487. kgdb_init();
  488. return 0;
  489. }
  490. #endif
  491. #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
  492. static int initr_status_led(void)
  493. {
  494. status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
  495. return 0;
  496. }
  497. #endif
  498. #if defined(CONFIG_CMD_SCSI)
  499. static int initr_scsi(void)
  500. {
  501. /* Not supported properly on ARM yet */
  502. #ifndef CONFIG_ARM
  503. puts("SCSI: ");
  504. scsi_init();
  505. #endif
  506. return 0;
  507. }
  508. #endif /* CONFIG_CMD_NET */
  509. #if defined(CONFIG_CMD_DOC)
  510. static int initr_doc(void)
  511. {
  512. puts("DOC: ");
  513. doc_init();
  514. }
  515. #endif
  516. #ifdef CONFIG_BITBANGMII
  517. static int initr_bbmii(void)
  518. {
  519. bb_miiphy_init();
  520. return 0;
  521. }
  522. #endif
  523. #ifdef CONFIG_CMD_NET
  524. static int initr_net(void)
  525. {
  526. puts("Net: ");
  527. eth_initialize(gd->bd);
  528. #if defined(CONFIG_RESET_PHY_R)
  529. debug("Reset Ethernet PHY\n");
  530. reset_phy();
  531. #endif
  532. return 0;
  533. }
  534. #endif
  535. #ifdef CONFIG_POST
  536. static int initr_post(void)
  537. {
  538. post_run(NULL, POST_RAM | post_bootmode_get(0));
  539. return 0;
  540. }
  541. #endif
  542. #if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_CMD_IDE)
  543. static int initr_pcmcia(void)
  544. {
  545. puts("PCMCIA:");
  546. pcmcia_init();
  547. return 0;
  548. }
  549. #endif
  550. #if defined(CONFIG_CMD_IDE)
  551. static int initr_ide(void)
  552. {
  553. #ifdef CONFIG_IDE_8xx_PCCARD
  554. puts("PCMCIA:");
  555. #else
  556. puts("IDE: ");
  557. #endif
  558. #if defined(CONFIG_START_IDE)
  559. if (board_start_ide())
  560. ide_init();
  561. #else
  562. ide_init();
  563. #endif
  564. return 0;
  565. }
  566. #endif
  567. #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
  568. /*
  569. * Export available size of memory for Linux, taking into account the
  570. * protected RAM at top of memory
  571. */
  572. int initr_mem(void)
  573. {
  574. ulong pram = 0;
  575. char memsz[32];
  576. # ifdef CONFIG_PRAM
  577. pram = getenv_ulong("pram", 10, CONFIG_PRAM);
  578. # endif
  579. # if defined(CONFIG_LOGBUFFER) && !defined(CONFIG_ALT_LB_ADDR)
  580. /* Also take the logbuffer into account (pram is in kB) */
  581. pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
  582. # endif
  583. sprintf(memsz, "%ldk", (gd->ram_size / 1024) - pram);
  584. setenv("mem", memsz);
  585. return 0;
  586. }
  587. #endif
  588. #ifdef CONFIG_CMD_BEDBUG
  589. static int initr_bedbug(void)
  590. {
  591. bedbug_init();
  592. return 0;
  593. }
  594. #endif
  595. #ifdef CONFIG_PS2KBD
  596. static int initr_kbd(void)
  597. {
  598. puts("PS/2: ");
  599. kbd_init();
  600. return 0;
  601. }
  602. #endif
  603. #ifdef CONFIG_MODEM_SUPPORT
  604. static int initr_modem(void)
  605. {
  606. /* TODO: with new initcalls, move this into the driver */
  607. extern int do_mdm_init;
  608. do_mdm_init = gd->do_mdm_init;
  609. return 0;
  610. }
  611. #endif
  612. static int run_main_loop(void)
  613. {
  614. /* main_loop() can return to retry autoboot, if so just run it again */
  615. for (;;)
  616. main_loop();
  617. return 0;
  618. }
  619. /*
  620. * Over time we hope to remove these functions with code fragments and
  621. * stub funtcions, and instead call the relevant function directly.
  622. *
  623. * We also hope to remove most of the driver-related init and do it if/when
  624. * the driver is later used.
  625. *
  626. * TODO: perhaps reset the watchdog in the initcall function after each call?
  627. */
  628. init_fnc_t init_sequence_r[] = {
  629. initr_reloc,
  630. /* TODO: could x86/PPC have this also perhaps? */
  631. #ifdef CONFIG_ARM
  632. initr_caches,
  633. board_init, /* Setup chipselects */
  634. #endif
  635. /*
  636. * TODO: printing of the clock inforamtion of the board is now
  637. * implemented as part of bdinfo command. Currently only support for
  638. * davinci SOC's is added. Remove this check once all the board
  639. * implement this.
  640. */
  641. #ifdef CONFIG_CLOCKS
  642. set_cpu_clk_info, /* Setup clock information */
  643. #endif
  644. initr_reloc_global_data,
  645. initr_serial,
  646. initr_announce,
  647. INIT_FUNC_WATCHDOG_RESET
  648. #ifdef CONFIG_PPC
  649. initr_trap,
  650. #endif
  651. #ifdef CONFIG_ADDR_MAP
  652. initr_addr_map,
  653. #endif
  654. #if defined(CONFIG_BOARD_EARLY_INIT_R)
  655. board_early_init_r,
  656. #endif
  657. INIT_FUNC_WATCHDOG_RESET
  658. #ifdef CONFIG_LOGBUFFER
  659. initr_logbuffer,
  660. #endif
  661. #ifdef CONFIG_POST
  662. initr_post_backlog,
  663. #endif
  664. INIT_FUNC_WATCHDOG_RESET
  665. #ifdef CONFIG_SYS_DELAYED_ICACHE
  666. initr_icache_enable,
  667. #endif
  668. #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
  669. initr_unlock_ram_in_cache,
  670. #endif
  671. #if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT)
  672. /*
  673. * Do early PCI configuration _before_ the flash gets initialised,
  674. * because PCU ressources are crucial for flash access on some boards.
  675. */
  676. initr_pci,
  677. #endif
  678. #ifdef CONFIG_WINBOND_83C553
  679. initr_w83c553f,
  680. #endif
  681. initr_barrier,
  682. initr_malloc,
  683. #ifdef CONFIG_ARCH_EARLY_INIT_R
  684. arch_early_init_r,
  685. #endif
  686. power_init_board,
  687. #ifndef CONFIG_SYS_NO_FLASH
  688. initr_flash,
  689. #endif
  690. INIT_FUNC_WATCHDOG_RESET
  691. #if defined(CONFIG_PPC) || defined(CONFIG_X86)
  692. /* initialize higher level parts of CPU like time base and timers */
  693. cpu_init_r,
  694. #endif
  695. #ifdef CONFIG_PPC
  696. initr_spi,
  697. #endif
  698. #if defined(CONFIG_X86) && defined(CONFIG_SPI)
  699. init_func_spi,
  700. #endif
  701. #ifdef CONFIG_CMD_NAND
  702. initr_nand,
  703. #endif
  704. #ifdef CONFIG_CMD_ONENAND
  705. initr_onenand,
  706. #endif
  707. #ifdef CONFIG_GENERIC_MMC
  708. initr_mmc,
  709. #endif
  710. #ifdef CONFIG_HAS_DATAFLASH
  711. initr_dataflash,
  712. #endif
  713. initr_env,
  714. INIT_FUNC_WATCHDOG_RESET
  715. initr_secondary_cpu,
  716. #ifdef CONFIG_SC3
  717. initr_sc3_read_eeprom,
  718. #endif
  719. #ifdef CONFIG_HERMES
  720. initr_hermes,
  721. #endif
  722. #if defined(CONFIG_ID_EEPROM) || defined(CONFIG_SYS_I2C_MAC_OFFSET)
  723. mac_read_from_eeprom,
  724. #endif
  725. INIT_FUNC_WATCHDOG_RESET
  726. #if defined(CONFIG_PCI) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
  727. /*
  728. * Do pci configuration
  729. */
  730. initr_pci,
  731. #endif
  732. stdio_init,
  733. initr_jumptable,
  734. #ifdef CONFIG_API
  735. initr_api,
  736. #endif
  737. console_init_r, /* fully init console as a device */
  738. #ifdef CONFIG_DISPLAY_BOARDINFO_LATE
  739. show_model_r,
  740. #endif
  741. #ifdef CONFIG_ARCH_MISC_INIT
  742. arch_misc_init, /* miscellaneous arch-dependent init */
  743. #endif
  744. #ifdef CONFIG_MISC_INIT_R
  745. misc_init_r, /* miscellaneous platform-dependent init */
  746. #endif
  747. #ifdef CONFIG_HERMES
  748. initr_hermes_start,
  749. #endif
  750. INIT_FUNC_WATCHDOG_RESET
  751. #ifdef CONFIG_CMD_KGDB
  752. initr_kgdb,
  753. #endif
  754. #ifdef CONFIG_X86
  755. board_early_init_r,
  756. #endif
  757. interrupt_init,
  758. #if defined(CONFIG_ARM) || defined(CONFIG_x86)
  759. initr_enable_interrupts,
  760. #endif
  761. #ifdef CONFIG_X86
  762. timer_init, /* initialize timer */
  763. #endif
  764. #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
  765. initr_status_led,
  766. #endif
  767. /* PPC has a udelay(20) here dating from 2002. Why? */
  768. #ifdef CONFIG_CMD_NET
  769. initr_ethaddr,
  770. #endif
  771. #ifdef CONFIG_BOARD_LATE_INIT
  772. board_late_init,
  773. #endif
  774. #ifdef CONFIG_CMD_SCSI
  775. INIT_FUNC_WATCHDOG_RESET
  776. initr_scsi,
  777. #endif
  778. #ifdef CONFIG_CMD_DOC
  779. INIT_FUNC_WATCHDOG_RESET
  780. initr_doc,
  781. #endif
  782. #ifdef CONFIG_BITBANGMII
  783. initr_bbmii,
  784. #endif
  785. #ifdef CONFIG_CMD_NET
  786. INIT_FUNC_WATCHDOG_RESET
  787. initr_net,
  788. #endif
  789. #ifdef CONFIG_POST
  790. initr_post,
  791. #endif
  792. #if defined(CONFIG_CMD_PCMCIA) && !defined(CONFIG_CMD_IDE)
  793. initr_pcmcia,
  794. #endif
  795. #if defined(CONFIG_CMD_IDE)
  796. initr_ide,
  797. #endif
  798. #ifdef CONFIG_LAST_STAGE_INIT
  799. INIT_FUNC_WATCHDOG_RESET
  800. /*
  801. * Some parts can be only initialized if all others (like
  802. * Interrupts) are up and running (i.e. the PC-style ISA
  803. * keyboard).
  804. */
  805. last_stage_init,
  806. #endif
  807. #ifdef CONFIG_CMD_BEDBUG
  808. INIT_FUNC_WATCHDOG_RESET
  809. initr_bedbug,
  810. #endif
  811. #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
  812. initr_mem,
  813. #endif
  814. #ifdef CONFIG_PS2KBD
  815. initr_kbd,
  816. #endif
  817. #ifdef CONFIG_MODEM_SUPPORT
  818. initr_modem,
  819. #endif
  820. run_main_loop,
  821. };
  822. void board_init_r(gd_t *new_gd, ulong dest_addr)
  823. {
  824. #ifndef CONFIG_X86
  825. gd = new_gd;
  826. #endif
  827. if (initcall_run_list(init_sequence_r))
  828. hang();
  829. /* NOTREACHED - run_main_loop() does not return */
  830. hang();
  831. }