board_r.c 18 KB

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