board_r.c 18 KB

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