board.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291
  1. /*
  2. * (C) Copyright 2000-2006
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <watchdog.h>
  25. #include <command.h>
  26. #include <malloc.h>
  27. #include <devices.h>
  28. #ifdef CONFIG_8xx
  29. #include <mpc8xx.h>
  30. #endif
  31. #ifdef CONFIG_5xx
  32. #include <mpc5xx.h>
  33. #endif
  34. #ifdef CONFIG_MPC5xxx
  35. #include <mpc5xxx.h>
  36. #endif
  37. #if defined(CONFIG_CMD_IDE)
  38. #include <ide.h>
  39. #endif
  40. #if defined(CONFIG_CMD_SCSI)
  41. #include <scsi.h>
  42. #endif
  43. #if defined(CONFIG_CMD_KGDB)
  44. #include <kgdb.h>
  45. #endif
  46. #ifdef CONFIG_STATUS_LED
  47. #include <status_led.h>
  48. #endif
  49. #include <net.h>
  50. #include <serial.h>
  51. #ifdef CFG_ALLOC_DPRAM
  52. #if !defined(CONFIG_CPM2)
  53. #include <commproc.h>
  54. #endif
  55. #endif
  56. #include <version.h>
  57. #if defined(CONFIG_BAB7xx)
  58. #include <w83c553f.h>
  59. #endif
  60. #include <dtt.h>
  61. #if defined(CONFIG_POST)
  62. #include <post.h>
  63. #endif
  64. #if defined(CONFIG_LOGBUFFER)
  65. #include <logbuff.h>
  66. #endif
  67. #if defined(CFG_INIT_RAM_LOCK) && defined(CONFIG_E500)
  68. #include <asm/cache.h>
  69. #endif
  70. #ifdef CONFIG_PS2KBD
  71. #include <keyboard.h>
  72. #endif
  73. #ifdef CFG_UPDATE_FLASH_SIZE
  74. extern int update_flash_size (int flash_size);
  75. #endif
  76. #if defined(CONFIG_SC3)
  77. extern void sc3_read_eeprom(void);
  78. #endif
  79. #if defined(CONFIG_CMD_DOC)
  80. void doc_init (void);
  81. #endif
  82. #if defined(CONFIG_HARD_I2C) || \
  83. defined(CONFIG_SOFT_I2C)
  84. #include <i2c.h>
  85. #endif
  86. #if defined(CONFIG_HARD_SPI)
  87. #include <spi.h>
  88. #endif
  89. #if defined(CONFIG_CMD_NAND)
  90. void nand_init (void);
  91. #endif
  92. static char *failed = "*** failed ***\n";
  93. #if defined(CONFIG_OXC) || defined(CONFIG_PCU_E) || defined(CONFIG_RMU)
  94. extern flash_info_t flash_info[];
  95. #endif
  96. #if defined(CONFIG_START_IDE)
  97. extern int board_start_ide(void);
  98. #endif
  99. #include <environment.h>
  100. DECLARE_GLOBAL_DATA_PTR;
  101. #if defined(CFG_ENV_IS_EMBEDDED)
  102. #define TOTAL_MALLOC_LEN CFG_MALLOC_LEN
  103. #elif ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \
  104. (CFG_ENV_ADDR >= (CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \
  105. defined(CFG_ENV_IS_IN_NVRAM)
  106. #define TOTAL_MALLOC_LEN (CFG_MALLOC_LEN + CFG_ENV_SIZE)
  107. #else
  108. #define TOTAL_MALLOC_LEN CFG_MALLOC_LEN
  109. #endif
  110. extern ulong __init_end;
  111. extern ulong _end;
  112. ulong monitor_flash_len;
  113. #if defined(CONFIG_CMD_BEDBUG)
  114. #include <bedbug/type.h>
  115. #endif
  116. /*
  117. * Begin and End of memory area for malloc(), and current "brk"
  118. */
  119. static ulong mem_malloc_start = 0;
  120. static ulong mem_malloc_end = 0;
  121. static ulong mem_malloc_brk = 0;
  122. /************************************************************************
  123. * Utilities *
  124. ************************************************************************
  125. */
  126. /*
  127. * The Malloc area is immediately below the monitor copy in DRAM
  128. */
  129. static void mem_malloc_init (void)
  130. {
  131. #if !defined(CONFIG_RELOC_FIXUP_WORKS)
  132. mem_malloc_end = CFG_MONITOR_BASE + gd->reloc_off;
  133. #endif
  134. mem_malloc_start = mem_malloc_end - TOTAL_MALLOC_LEN;
  135. mem_malloc_brk = mem_malloc_start;
  136. memset ((void *) mem_malloc_start,
  137. 0,
  138. mem_malloc_end - mem_malloc_start);
  139. }
  140. void *sbrk (ptrdiff_t increment)
  141. {
  142. ulong old = mem_malloc_brk;
  143. ulong new = old + increment;
  144. if ((new < mem_malloc_start) || (new > mem_malloc_end)) {
  145. return (NULL);
  146. }
  147. mem_malloc_brk = new;
  148. return ((void *) old);
  149. }
  150. char *strmhz (char *buf, long hz)
  151. {
  152. long l, n;
  153. long m;
  154. n = hz / 1000000L;
  155. l = sprintf (buf, "%ld", n);
  156. m = (hz % 1000000L) / 1000L;
  157. if (m != 0)
  158. sprintf (buf + l, ".%03ld", m);
  159. return (buf);
  160. }
  161. /*
  162. * All attempts to come up with a "common" initialization sequence
  163. * that works for all boards and architectures failed: some of the
  164. * requirements are just _too_ different. To get rid of the resulting
  165. * mess of board dependend #ifdef'ed code we now make the whole
  166. * initialization sequence configurable to the user.
  167. *
  168. * The requirements for any new initalization function is simple: it
  169. * receives a pointer to the "global data" structure as it's only
  170. * argument, and returns an integer return code, where 0 means
  171. * "continue" and != 0 means "fatal error, hang the system".
  172. */
  173. typedef int (init_fnc_t) (void);
  174. /************************************************************************
  175. * Init Utilities *
  176. ************************************************************************
  177. * Some of this code should be moved into the core functions,
  178. * but let's get it working (again) first...
  179. */
  180. static int init_baudrate (void)
  181. {
  182. char tmp[64]; /* long enough for environment variables */
  183. int i = getenv_r ("baudrate", tmp, sizeof (tmp));
  184. gd->baudrate = (i > 0)
  185. ? (int) simple_strtoul (tmp, NULL, 10)
  186. : CONFIG_BAUDRATE;
  187. return (0);
  188. }
  189. /***********************************************************************/
  190. void __board_add_ram_info(int use_default)
  191. {
  192. /* please define platform specific board_add_ram_info() */
  193. }
  194. void board_add_ram_info(int) __attribute__((weak, alias("__board_add_ram_info")));
  195. static int init_func_ram (void)
  196. {
  197. #ifdef CONFIG_BOARD_TYPES
  198. int board_type = gd->board_type;
  199. #else
  200. int board_type = 0; /* use dummy arg */
  201. #endif
  202. puts ("DRAM: ");
  203. if ((gd->ram_size = initdram (board_type)) > 0) {
  204. print_size (gd->ram_size, "");
  205. board_add_ram_info(0);
  206. putc('\n');
  207. return (0);
  208. }
  209. puts (failed);
  210. return (1);
  211. }
  212. /***********************************************************************/
  213. #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
  214. static int init_func_i2c (void)
  215. {
  216. puts ("I2C: ");
  217. i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
  218. puts ("ready\n");
  219. return (0);
  220. }
  221. #endif
  222. #if defined(CONFIG_HARD_SPI)
  223. static int init_func_spi (void)
  224. {
  225. puts ("SPI: ");
  226. spi_init ();
  227. puts ("ready\n");
  228. return (0);
  229. }
  230. #endif
  231. /***********************************************************************/
  232. #if defined(CONFIG_WATCHDOG)
  233. static int init_func_watchdog_init (void)
  234. {
  235. puts (" Watchdog enabled\n");
  236. WATCHDOG_RESET ();
  237. return (0);
  238. }
  239. # define INIT_FUNC_WATCHDOG_INIT init_func_watchdog_init,
  240. static int init_func_watchdog_reset (void)
  241. {
  242. WATCHDOG_RESET ();
  243. return (0);
  244. }
  245. # define INIT_FUNC_WATCHDOG_RESET init_func_watchdog_reset,
  246. #else
  247. # define INIT_FUNC_WATCHDOG_INIT /* undef */
  248. # define INIT_FUNC_WATCHDOG_RESET /* undef */
  249. #endif /* CONFIG_WATCHDOG */
  250. /************************************************************************
  251. * Initialization sequence *
  252. ************************************************************************
  253. */
  254. init_fnc_t *init_sequence[] = {
  255. #if defined(CONFIG_BOARD_EARLY_INIT_F)
  256. board_early_init_f,
  257. #endif
  258. #if !defined(CONFIG_8xx_CPUCLK_DEFAULT)
  259. get_clocks, /* get CPU and bus clocks (etc.) */
  260. #if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) \
  261. && !defined(CONFIG_TQM885D)
  262. adjust_sdram_tbs_8xx,
  263. #endif
  264. init_timebase,
  265. #endif
  266. #ifdef CFG_ALLOC_DPRAM
  267. #if !defined(CONFIG_CPM2)
  268. dpram_init,
  269. #endif
  270. #endif
  271. #if defined(CONFIG_BOARD_POSTCLK_INIT)
  272. board_postclk_init,
  273. #endif
  274. env_init,
  275. #if defined(CONFIG_8xx_CPUCLK_DEFAULT)
  276. get_clocks_866, /* get CPU and bus clocks according to the environment variable */
  277. sdram_adjust_866, /* adjust sdram refresh rate according to the new clock */
  278. init_timebase,
  279. #endif
  280. init_baudrate,
  281. serial_init,
  282. console_init_f,
  283. display_options,
  284. #if defined(CONFIG_8260)
  285. prt_8260_rsr,
  286. prt_8260_clks,
  287. #endif /* CONFIG_8260 */
  288. #if defined(CONFIG_MPC83XX)
  289. prt_83xx_rsr,
  290. #endif
  291. checkcpu,
  292. #if defined(CONFIG_MPC5xxx)
  293. prt_mpc5xxx_clks,
  294. #endif /* CONFIG_MPC5xxx */
  295. #if defined(CONFIG_MPC8220)
  296. prt_mpc8220_clks,
  297. #endif
  298. checkboard,
  299. INIT_FUNC_WATCHDOG_INIT
  300. #if defined(CONFIG_MISC_INIT_F)
  301. misc_init_f,
  302. #endif
  303. INIT_FUNC_WATCHDOG_RESET
  304. #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
  305. init_func_i2c,
  306. #endif
  307. #if defined(CONFIG_HARD_SPI)
  308. init_func_spi,
  309. #endif
  310. #if defined(CONFIG_DTT) /* Digital Thermometers and Thermostats */
  311. dtt_init,
  312. #endif
  313. #ifdef CONFIG_POST
  314. post_init_f,
  315. #endif
  316. INIT_FUNC_WATCHDOG_RESET
  317. init_func_ram,
  318. #if defined(CFG_DRAM_TEST)
  319. testdram,
  320. #endif /* CFG_DRAM_TEST */
  321. INIT_FUNC_WATCHDOG_RESET
  322. NULL, /* Terminate this list */
  323. };
  324. #ifndef CONFIG_MAX_MEM_MAPPED
  325. #define CONFIG_MAX_MEM_MAPPED (256 << 20)
  326. #endif
  327. ulong get_effective_memsize(void)
  328. {
  329. #ifndef CONFIG_VERY_BIG_RAM
  330. return gd->ram_size;
  331. #else
  332. /* limit stack to what we can reasonable map */
  333. return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
  334. CONFIG_MAX_MEM_MAPPED : gd->ram_size);
  335. #endif
  336. }
  337. /************************************************************************
  338. *
  339. * This is the first part of the initialization sequence that is
  340. * implemented in C, but still running from ROM.
  341. *
  342. * The main purpose is to provide a (serial) console interface as
  343. * soon as possible (so we can see any error messages), and to
  344. * initialize the RAM so that we can relocate the monitor code to
  345. * RAM.
  346. *
  347. * Be aware of the restrictions: global data is read-only, BSS is not
  348. * initialized, and stack space is limited to a few kB.
  349. *
  350. ************************************************************************
  351. */
  352. void board_init_f (ulong bootflag)
  353. {
  354. bd_t *bd;
  355. ulong len, addr, addr_sp;
  356. ulong *s;
  357. gd_t *id;
  358. init_fnc_t **init_fnc_ptr;
  359. #ifdef CONFIG_PRAM
  360. int i;
  361. ulong reg;
  362. uchar tmp[64]; /* long enough for environment variables */
  363. #endif
  364. /* Pointer is writable since we allocated a register for it */
  365. gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
  366. /* compiler optimization barrier needed for GCC >= 3.4 */
  367. __asm__ __volatile__("": : :"memory");
  368. #if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC83XX)
  369. /* Clear initial global data */
  370. memset ((void *) gd, 0, sizeof (gd_t));
  371. #endif
  372. for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
  373. if ((*init_fnc_ptr) () != 0) {
  374. hang ();
  375. }
  376. }
  377. /*
  378. * Now that we have DRAM mapped and working, we can
  379. * relocate the code and continue running from DRAM.
  380. *
  381. * Reserve memory at end of RAM for (top down in that order):
  382. * - kernel log buffer
  383. * - protected RAM
  384. * - LCD framebuffer
  385. * - monitor code
  386. * - board info struct
  387. */
  388. len = (ulong)&_end - CFG_MONITOR_BASE;
  389. #ifndef CONFIG_MAX_MEM_MAPPED
  390. #define CONFIG_MAX_MEM_MAPPED (256 << 20)
  391. #endif
  392. #ifndef CONFIG_VERY_BIG_RAM
  393. addr = CFG_SDRAM_BASE + get_effective_memsize();
  394. #else
  395. /* only allow stack below 256M */
  396. addr = CFG_SDRAM_BASE +
  397. (gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
  398. CONFIG_MAX_MEM_MAPPED : get_effective_memsize();
  399. #endif
  400. #ifdef CONFIG_LOGBUFFER
  401. #ifndef CONFIG_ALT_LB_ADDR
  402. /* reserve kernel log buffer */
  403. addr -= (LOGBUFF_RESERVE);
  404. debug ("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN, addr);
  405. #endif
  406. #endif
  407. #ifdef CONFIG_PRAM
  408. /*
  409. * reserve protected RAM
  410. */
  411. i = getenv_r ("pram", (char *)tmp, sizeof (tmp));
  412. reg = (i > 0) ? simple_strtoul ((const char *)tmp, NULL, 10) : CONFIG_PRAM;
  413. addr -= (reg << 10); /* size is in kB */
  414. debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
  415. #endif /* CONFIG_PRAM */
  416. /* round down to next 4 kB limit */
  417. addr &= ~(4096 - 1);
  418. debug ("Top of RAM usable for U-Boot at: %08lx\n", addr);
  419. #ifdef CONFIG_LCD
  420. /* reserve memory for LCD display (always full pages) */
  421. addr = lcd_setmem (addr);
  422. gd->fb_base = addr;
  423. #endif /* CONFIG_LCD */
  424. #if defined(CONFIG_VIDEO) && defined(CONFIG_8xx)
  425. /* reserve memory for video display (always full pages) */
  426. addr = video_setmem (addr);
  427. gd->fb_base = addr;
  428. #endif /* CONFIG_VIDEO */
  429. /*
  430. * reserve memory for U-Boot code, data & bss
  431. * round down to next 4 kB limit
  432. */
  433. addr -= len;
  434. addr &= ~(4096 - 1);
  435. #ifdef CONFIG_E500
  436. /* round down to next 64 kB limit so that IVPR stays aligned */
  437. addr &= ~(65536 - 1);
  438. #endif
  439. debug ("Reserving %ldk for U-Boot at: %08lx\n", len >> 10, addr);
  440. #ifdef CONFIG_AMIGAONEG3SE
  441. gd->relocaddr = addr;
  442. #endif
  443. /*
  444. * reserve memory for malloc() arena
  445. */
  446. addr_sp = addr - TOTAL_MALLOC_LEN;
  447. debug ("Reserving %dk for malloc() at: %08lx\n",
  448. TOTAL_MALLOC_LEN >> 10, addr_sp);
  449. /*
  450. * (permanently) allocate a Board Info struct
  451. * and a permanent copy of the "global" data
  452. */
  453. addr_sp -= sizeof (bd_t);
  454. bd = (bd_t *) addr_sp;
  455. gd->bd = bd;
  456. debug ("Reserving %d Bytes for Board Info at: %08lx\n",
  457. sizeof (bd_t), addr_sp);
  458. addr_sp -= sizeof (gd_t);
  459. id = (gd_t *) addr_sp;
  460. debug ("Reserving %d Bytes for Global Data at: %08lx\n",
  461. sizeof (gd_t), addr_sp);
  462. /*
  463. * Finally, we set up a new (bigger) stack.
  464. *
  465. * Leave some safety gap for SP, force alignment on 16 byte boundary
  466. * Clear initial stack frame
  467. */
  468. addr_sp -= 16;
  469. addr_sp &= ~0xF;
  470. s = (ulong *)addr_sp;
  471. *s-- = 0;
  472. *s-- = 0;
  473. addr_sp = (ulong)s;
  474. debug ("Stack Pointer at: %08lx\n", addr_sp);
  475. /*
  476. * Save local variables to board info struct
  477. */
  478. bd->bi_memstart = CFG_SDRAM_BASE; /* start of DRAM memory */
  479. bd->bi_memsize = gd->ram_size; /* size of DRAM memory in bytes */
  480. #ifdef CONFIG_IP860
  481. bd->bi_sramstart = SRAM_BASE; /* start of SRAM memory */
  482. bd->bi_sramsize = SRAM_SIZE; /* size of SRAM memory */
  483. #elif defined CONFIG_MPC8220
  484. bd->bi_sramstart = CFG_SRAM_BASE; /* start of SRAM memory */
  485. bd->bi_sramsize = CFG_SRAM_SIZE; /* size of SRAM memory */
  486. #else
  487. bd->bi_sramstart = 0; /* FIXME */ /* start of SRAM memory */
  488. bd->bi_sramsize = 0; /* FIXME */ /* size of SRAM memory */
  489. #endif
  490. #if defined(CONFIG_8xx) || defined(CONFIG_8260) || defined(CONFIG_5xx) || \
  491. defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
  492. bd->bi_immr_base = CFG_IMMR; /* base of IMMR register */
  493. #endif
  494. #if defined(CONFIG_MPC5xxx)
  495. bd->bi_mbar_base = CFG_MBAR; /* base of internal registers */
  496. #endif
  497. #if defined(CONFIG_MPC83XX)
  498. bd->bi_immrbar = CFG_IMMR;
  499. #endif
  500. #if defined(CONFIG_MPC8220)
  501. bd->bi_mbar_base = CFG_MBAR; /* base of internal registers */
  502. bd->bi_inpfreq = gd->inp_clk;
  503. bd->bi_pcifreq = gd->pci_clk;
  504. bd->bi_vcofreq = gd->vco_clk;
  505. bd->bi_pevfreq = gd->pev_clk;
  506. bd->bi_flbfreq = gd->flb_clk;
  507. /* store bootparam to sram (backward compatible), here? */
  508. {
  509. u32 *sram = (u32 *)CFG_SRAM_BASE;
  510. *sram++ = gd->ram_size;
  511. *sram++ = gd->bus_clk;
  512. *sram++ = gd->inp_clk;
  513. *sram++ = gd->cpu_clk;
  514. *sram++ = gd->vco_clk;
  515. *sram++ = gd->flb_clk;
  516. *sram++ = 0xb8c3ba11; /* boot signature */
  517. }
  518. #endif
  519. bd->bi_bootflags = bootflag; /* boot / reboot flag (for LynxOS) */
  520. WATCHDOG_RESET ();
  521. bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */
  522. bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */
  523. #if defined(CONFIG_CPM2)
  524. bd->bi_cpmfreq = gd->cpm_clk;
  525. bd->bi_brgfreq = gd->brg_clk;
  526. bd->bi_sccfreq = gd->scc_clk;
  527. bd->bi_vco = gd->vco_out;
  528. #endif /* CONFIG_CPM2 */
  529. #if defined(CONFIG_MPC512X)
  530. bd->bi_ipsfreq = gd->ips_clk;
  531. #endif /* CONFIG_MPC512X */
  532. #if defined(CONFIG_MPC5xxx)
  533. bd->bi_ipbfreq = gd->ipb_clk;
  534. bd->bi_pcifreq = gd->pci_clk;
  535. #endif /* CONFIG_MPC5xxx */
  536. bd->bi_baudrate = gd->baudrate; /* Console Baudrate */
  537. #ifdef CFG_EXTBDINFO
  538. strncpy ((char *)bd->bi_s_version, "1.2", sizeof (bd->bi_s_version));
  539. strncpy ((char *)bd->bi_r_version, U_BOOT_VERSION, sizeof (bd->bi_r_version));
  540. bd->bi_procfreq = gd->cpu_clk; /* Processor Speed, In Hz */
  541. bd->bi_plb_busfreq = gd->bus_clk;
  542. #if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
  543. defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
  544. defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
  545. bd->bi_pci_busfreq = get_PCI_freq ();
  546. bd->bi_opbfreq = get_OPB_freq ();
  547. #elif defined(CONFIG_XILINX_ML300)
  548. bd->bi_pci_busfreq = get_PCI_freq ();
  549. #endif
  550. #endif
  551. debug ("New Stack Pointer is: %08lx\n", addr_sp);
  552. WATCHDOG_RESET ();
  553. #ifdef CONFIG_POST
  554. post_bootmode_init();
  555. post_run (NULL, POST_ROM | post_bootmode_get(0));
  556. #endif
  557. WATCHDOG_RESET();
  558. memcpy (id, (void *)gd, sizeof (gd_t));
  559. relocate_code (addr_sp, id, addr);
  560. /* NOTREACHED - relocate_code() does not return */
  561. }
  562. /************************************************************************
  563. *
  564. * This is the next part if the initialization sequence: we are now
  565. * running from RAM and have a "normal" C environment, i. e. global
  566. * data can be written, BSS has been cleared, the stack size in not
  567. * that critical any more, etc.
  568. *
  569. ************************************************************************
  570. */
  571. void board_init_r (gd_t *id, ulong dest_addr)
  572. {
  573. cmd_tbl_t *cmdtp;
  574. char *s, *e;
  575. bd_t *bd;
  576. int i;
  577. extern void malloc_bin_reloc (void);
  578. #ifndef CFG_ENV_IS_NOWHERE
  579. extern char * env_name_spec;
  580. #endif
  581. #ifndef CFG_NO_FLASH
  582. ulong flash_size;
  583. #endif
  584. gd = id; /* initialize RAM version of global data */
  585. bd = gd->bd;
  586. gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
  587. #if defined(CONFIG_RELOC_FIXUP_WORKS)
  588. gd->reloc_off = 0;
  589. mem_malloc_end = dest_addr;
  590. #else
  591. gd->reloc_off = dest_addr - CFG_MONITOR_BASE;
  592. #endif
  593. #ifdef CONFIG_SERIAL_MULTI
  594. serial_initialize();
  595. #endif
  596. debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
  597. WATCHDOG_RESET ();
  598. #if defined(CONFIG_BOARD_EARLY_INIT_R)
  599. board_early_init_r ();
  600. #endif
  601. monitor_flash_len = (ulong)&__init_end - dest_addr;
  602. /*
  603. * We have to relocate the command table manually
  604. */
  605. for (cmdtp = &__u_boot_cmd_start; cmdtp != &__u_boot_cmd_end; cmdtp++) {
  606. ulong addr;
  607. addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
  608. #if 0
  609. printf ("Command \"%s\": 0x%08lx => 0x%08lx\n",
  610. cmdtp->name, (ulong) (cmdtp->cmd), addr);
  611. #endif
  612. cmdtp->cmd =
  613. (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
  614. addr = (ulong)(cmdtp->name) + gd->reloc_off;
  615. cmdtp->name = (char *)addr;
  616. if (cmdtp->usage) {
  617. addr = (ulong)(cmdtp->usage) + gd->reloc_off;
  618. cmdtp->usage = (char *)addr;
  619. }
  620. #ifdef CFG_LONGHELP
  621. if (cmdtp->help) {
  622. addr = (ulong)(cmdtp->help) + gd->reloc_off;
  623. cmdtp->help = (char *)addr;
  624. }
  625. #endif
  626. }
  627. /* there are some other pointer constants we must deal with */
  628. #ifndef CFG_ENV_IS_NOWHERE
  629. env_name_spec += gd->reloc_off;
  630. #endif
  631. WATCHDOG_RESET ();
  632. #ifdef CONFIG_LOGBUFFER
  633. logbuff_init_ptrs ();
  634. #endif
  635. #ifdef CONFIG_POST
  636. post_output_backlog ();
  637. post_reloc ();
  638. #endif
  639. WATCHDOG_RESET();
  640. #if defined(CONFIG_IP860) || defined(CONFIG_PCU_E) || \
  641. defined (CONFIG_FLAGADM) || defined(CONFIG_MPC83XX)
  642. icache_enable (); /* it's time to enable the instruction cache */
  643. #endif
  644. #if defined(CFG_INIT_RAM_LOCK) && defined(CONFIG_E500)
  645. unlock_ram_in_cache(); /* it's time to unlock D-cache in e500 */
  646. #endif
  647. #if defined(CONFIG_BAB7xx) || defined(CONFIG_CPC45)
  648. /*
  649. * Do PCI configuration on BAB7xx and CPC45 _before_ the flash
  650. * gets initialised, because we need the ISA resp. PCI_to_LOCAL bus
  651. * bridge there.
  652. */
  653. pci_init ();
  654. #endif
  655. #if defined(CONFIG_BAB7xx)
  656. /*
  657. * Initialise the ISA bridge
  658. */
  659. initialise_w83c553f ();
  660. #endif
  661. asm ("sync ; isync");
  662. /*
  663. * Setup trap handlers
  664. */
  665. trap_init (dest_addr);
  666. #if !defined(CFG_NO_FLASH)
  667. puts ("FLASH: ");
  668. if ((flash_size = flash_init ()) > 0) {
  669. # ifdef CFG_FLASH_CHECKSUM
  670. print_size (flash_size, "");
  671. /*
  672. * Compute and print flash CRC if flashchecksum is set to 'y'
  673. *
  674. * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
  675. */
  676. s = getenv ("flashchecksum");
  677. if (s && (*s == 'y')) {
  678. printf (" CRC: %08lX",
  679. crc32 (0, (const unsigned char *) CFG_FLASH_BASE, flash_size)
  680. );
  681. }
  682. putc ('\n');
  683. # else /* !CFG_FLASH_CHECKSUM */
  684. print_size (flash_size, "\n");
  685. # endif /* CFG_FLASH_CHECKSUM */
  686. } else {
  687. puts (failed);
  688. hang ();
  689. }
  690. bd->bi_flashstart = CFG_FLASH_BASE; /* update start of FLASH memory */
  691. bd->bi_flashsize = flash_size; /* size of FLASH memory (final value) */
  692. #if defined(CFG_UPDATE_FLASH_SIZE)
  693. /* Make a update of the Memctrl. */
  694. update_flash_size (flash_size);
  695. #endif
  696. # if defined(CONFIG_PCU_E) || defined(CONFIG_OXC) || defined(CONFIG_RMU)
  697. /* flash mapped at end of memory map */
  698. bd->bi_flashoffset = TEXT_BASE + flash_size;
  699. # elif CFG_MONITOR_BASE == CFG_FLASH_BASE
  700. bd->bi_flashoffset = monitor_flash_len; /* reserved area for startup monitor */
  701. # else
  702. bd->bi_flashoffset = 0;
  703. # endif
  704. #else /* CFG_NO_FLASH */
  705. bd->bi_flashsize = 0;
  706. bd->bi_flashstart = 0;
  707. bd->bi_flashoffset = 0;
  708. #endif /* !CFG_NO_FLASH */
  709. WATCHDOG_RESET ();
  710. /* initialize higher level parts of CPU like time base and timers */
  711. cpu_init_r ();
  712. WATCHDOG_RESET ();
  713. /* initialize malloc() area */
  714. mem_malloc_init ();
  715. malloc_bin_reloc ();
  716. #ifdef CONFIG_SPI
  717. # if !defined(CFG_ENV_IS_IN_EEPROM)
  718. spi_init_f ();
  719. # endif
  720. spi_init_r ();
  721. #endif
  722. #if defined(CONFIG_CMD_NAND)
  723. WATCHDOG_RESET ();
  724. puts ("NAND: ");
  725. nand_init(); /* go init the NAND */
  726. #endif
  727. /* relocate environment function pointers etc. */
  728. env_relocate ();
  729. /*
  730. * Fill in missing fields of bd_info.
  731. * We do this here, where we have "normal" access to the
  732. * environment; we used to do this still running from ROM,
  733. * where had to use getenv_r(), which can be pretty slow when
  734. * the environment is in EEPROM.
  735. */
  736. #if defined(CFG_EXTBDINFO)
  737. #if defined(CONFIG_405GP) || defined(CONFIG_405EP)
  738. #if defined(CONFIG_I2CFAST)
  739. /*
  740. * set bi_iic_fast for linux taking environment variable
  741. * "i2cfast" into account
  742. */
  743. {
  744. char *s = getenv ("i2cfast");
  745. if (s && ((*s == 'y') || (*s == 'Y'))) {
  746. bd->bi_iic_fast[0] = 1;
  747. bd->bi_iic_fast[1] = 1;
  748. } else {
  749. bd->bi_iic_fast[0] = 0;
  750. bd->bi_iic_fast[1] = 0;
  751. }
  752. }
  753. #else
  754. bd->bi_iic_fast[0] = 0;
  755. bd->bi_iic_fast[1] = 0;
  756. #endif /* CONFIG_I2CFAST */
  757. #endif /* CONFIG_405GP, CONFIG_405EP */
  758. #endif /* CFG_EXTBDINFO */
  759. #if defined(CONFIG_SC3)
  760. sc3_read_eeprom();
  761. #endif
  762. #ifdef CFG_ID_EEPROM
  763. mac_read_from_eeprom();
  764. #endif
  765. s = getenv ("ethaddr");
  766. #if defined (CONFIG_MBX) || \
  767. defined (CONFIG_RPXCLASSIC) || \
  768. defined(CONFIG_IAD210) || \
  769. defined(CONFIG_V38B)
  770. if (s == NULL)
  771. board_get_enetaddr (bd->bi_enetaddr);
  772. else
  773. #endif
  774. for (i = 0; i < 6; ++i) {
  775. bd->bi_enetaddr[i] = s ? simple_strtoul (s, &e, 16) : 0;
  776. if (s)
  777. s = (*e) ? e + 1 : e;
  778. }
  779. #ifdef CONFIG_HERMES
  780. if ((gd->board_type >> 16) == 2)
  781. bd->bi_ethspeed = gd->board_type & 0xFFFF;
  782. else
  783. bd->bi_ethspeed = 0xFFFF;
  784. #endif
  785. #ifdef CONFIG_NX823
  786. load_sernum_ethaddr ();
  787. #endif
  788. #ifdef CONFIG_HAS_ETH1
  789. /* handle the 2nd ethernet address */
  790. s = getenv ("eth1addr");
  791. for (i = 0; i < 6; ++i) {
  792. bd->bi_enet1addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
  793. if (s)
  794. s = (*e) ? e + 1 : e;
  795. }
  796. #endif
  797. #ifdef CONFIG_HAS_ETH2
  798. /* handle the 3rd ethernet address */
  799. s = getenv ("eth2addr");
  800. #if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
  801. if (s == NULL)
  802. board_get_enetaddr(bd->bi_enet2addr);
  803. else
  804. #endif
  805. for (i = 0; i < 6; ++i) {
  806. bd->bi_enet2addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
  807. if (s)
  808. s = (*e) ? e + 1 : e;
  809. }
  810. #endif
  811. #ifdef CONFIG_HAS_ETH3
  812. /* handle 4th ethernet address */
  813. s = getenv("eth3addr");
  814. #if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
  815. if (s == NULL)
  816. board_get_enetaddr(bd->bi_enet3addr);
  817. else
  818. #endif
  819. for (i = 0; i < 6; ++i) {
  820. bd->bi_enet3addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
  821. if (s)
  822. s = (*e) ? e + 1 : e;
  823. }
  824. #endif
  825. #if defined(CONFIG_TQM8xxL) || defined(CONFIG_TQM8260) || \
  826. defined(CONFIG_TQM8272) || \
  827. defined(CONFIG_CCM) || defined(CONFIG_KUP4K) || \
  828. defined(CONFIG_KUP4X) || defined(CONFIG_PCS440EP)
  829. load_sernum_ethaddr ();
  830. #endif
  831. /* IP Address */
  832. bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
  833. WATCHDOG_RESET ();
  834. #if defined(CONFIG_PCI) && !defined(CONFIG_BAB7xx) && !defined(CONFIG_CPC45)
  835. /*
  836. * Do pci configuration
  837. */
  838. pci_init ();
  839. #endif
  840. /** leave this here (after malloc(), environment and PCI are working) **/
  841. /* Initialize devices */
  842. devices_init ();
  843. /* Initialize the jump table for applications */
  844. jumptable_init ();
  845. #if defined(CONFIG_API)
  846. /* Initialize API */
  847. api_init ();
  848. #endif
  849. /* Initialize the console (after the relocation and devices init) */
  850. console_init_r ();
  851. #if defined(CONFIG_CCM) || \
  852. defined(CONFIG_COGENT) || \
  853. defined(CONFIG_CPCI405) || \
  854. defined(CONFIG_EVB64260) || \
  855. defined(CONFIG_KUP4K) || \
  856. defined(CONFIG_KUP4X) || \
  857. defined(CONFIG_LWMON) || \
  858. defined(CONFIG_PCU_E) || \
  859. defined(CONFIG_SC3) || \
  860. defined(CONFIG_W7O) || \
  861. defined(CONFIG_MISC_INIT_R)
  862. /* miscellaneous platform dependent initialisations */
  863. misc_init_r ();
  864. #endif
  865. #ifdef CONFIG_HERMES
  866. if (bd->bi_ethspeed != 0xFFFF)
  867. hermes_start_lxt980 ((int) bd->bi_ethspeed);
  868. #endif
  869. #if defined(CONFIG_CMD_KGDB)
  870. WATCHDOG_RESET ();
  871. puts ("KGDB: ");
  872. kgdb_init ();
  873. #endif
  874. debug ("U-Boot relocated to %08lx\n", dest_addr);
  875. /*
  876. * Enable Interrupts
  877. */
  878. interrupt_init ();
  879. /* Must happen after interrupts are initialized since
  880. * an irq handler gets installed
  881. */
  882. #ifdef CONFIG_SERIAL_SOFTWARE_FIFO
  883. serial_buffered_init();
  884. #endif
  885. #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
  886. status_led_set (STATUS_LED_BOOT, STATUS_LED_BLINKING);
  887. #endif
  888. udelay (20);
  889. set_timer (0);
  890. /* Initialize from environment */
  891. if ((s = getenv ("loadaddr")) != NULL) {
  892. load_addr = simple_strtoul (s, NULL, 16);
  893. }
  894. #if defined(CONFIG_CMD_NET)
  895. if ((s = getenv ("bootfile")) != NULL) {
  896. copy_filename (BootFile, s, sizeof (BootFile));
  897. }
  898. #endif
  899. WATCHDOG_RESET ();
  900. #if defined(CONFIG_CMD_SCSI)
  901. WATCHDOG_RESET ();
  902. puts ("SCSI: ");
  903. scsi_init ();
  904. #endif
  905. #if defined(CONFIG_CMD_DOC)
  906. WATCHDOG_RESET ();
  907. puts ("DOC: ");
  908. doc_init ();
  909. #endif
  910. #if defined(CONFIG_CMD_NET)
  911. #if defined(CONFIG_NET_MULTI)
  912. WATCHDOG_RESET ();
  913. puts ("Net: ");
  914. #endif
  915. eth_initialize (bd);
  916. #endif
  917. #if defined(CONFIG_CMD_NET) && ( \
  918. defined(CONFIG_CCM) || \
  919. defined(CONFIG_ELPT860) || \
  920. defined(CONFIG_EP8260) || \
  921. defined(CONFIG_IP860) || \
  922. defined(CONFIG_IVML24) || \
  923. defined(CONFIG_IVMS8) || \
  924. defined(CONFIG_MPC8260ADS) || \
  925. defined(CONFIG_MPC8266ADS) || \
  926. defined(CONFIG_MPC8560ADS) || \
  927. defined(CONFIG_PCU_E) || \
  928. defined(CONFIG_RPXSUPER) || \
  929. defined(CONFIG_STXGP3) || \
  930. defined(CONFIG_SPD823TS) || \
  931. defined(CONFIG_RESET_PHY_R) )
  932. WATCHDOG_RESET ();
  933. debug ("Reset Ethernet PHY\n");
  934. reset_phy ();
  935. #endif
  936. #ifdef CONFIG_POST
  937. post_run (NULL, POST_RAM | post_bootmode_get(0));
  938. #endif
  939. #if defined(CONFIG_CMD_PCMCIA) \
  940. && !defined(CONFIG_CMD_IDE)
  941. WATCHDOG_RESET ();
  942. puts ("PCMCIA:");
  943. pcmcia_init ();
  944. #endif
  945. #if defined(CONFIG_CMD_IDE)
  946. WATCHDOG_RESET ();
  947. # ifdef CONFIG_IDE_8xx_PCCARD
  948. puts ("PCMCIA:");
  949. # else
  950. puts ("IDE: ");
  951. #endif
  952. #if defined(CONFIG_START_IDE)
  953. if (board_start_ide())
  954. ide_init ();
  955. #else
  956. ide_init ();
  957. #endif
  958. #endif
  959. #ifdef CONFIG_LAST_STAGE_INIT
  960. WATCHDOG_RESET ();
  961. /*
  962. * Some parts can be only initialized if all others (like
  963. * Interrupts) are up and running (i.e. the PC-style ISA
  964. * keyboard).
  965. */
  966. last_stage_init ();
  967. #endif
  968. #if defined(CONFIG_CMD_BEDBUG)
  969. WATCHDOG_RESET ();
  970. bedbug_init ();
  971. #endif
  972. #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
  973. /*
  974. * Export available size of memory for Linux,
  975. * taking into account the protected RAM at top of memory
  976. */
  977. {
  978. ulong pram;
  979. uchar memsz[32];
  980. #ifdef CONFIG_PRAM
  981. char *s;
  982. if ((s = getenv ("pram")) != NULL) {
  983. pram = simple_strtoul (s, NULL, 10);
  984. } else {
  985. pram = CONFIG_PRAM;
  986. }
  987. #else
  988. pram=0;
  989. #endif
  990. #ifdef CONFIG_LOGBUFFER
  991. #ifndef CONFIG_ALT_LB_ADDR
  992. /* Also take the logbuffer into account (pram is in kB) */
  993. pram += (LOGBUFF_LEN+LOGBUFF_OVERHEAD)/1024;
  994. #endif
  995. #endif
  996. sprintf ((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
  997. setenv ("mem", (char *)memsz);
  998. }
  999. #endif
  1000. #ifdef CONFIG_PS2KBD
  1001. puts ("PS/2: ");
  1002. kbd_init();
  1003. #endif
  1004. #ifdef CONFIG_MODEM_SUPPORT
  1005. {
  1006. extern int do_mdm_init;
  1007. do_mdm_init = gd->do_mdm_init;
  1008. }
  1009. #endif
  1010. /* Initialization complete - start the monitor */
  1011. /* main_loop() can return to retry autoboot, if so just run it again. */
  1012. for (;;) {
  1013. WATCHDOG_RESET ();
  1014. main_loop ();
  1015. }
  1016. /* NOTREACHED - no way out of command loop except booting */
  1017. }
  1018. void hang (void)
  1019. {
  1020. puts ("### ERROR ### Please RESET the board ###\n");
  1021. show_boot_progress(-30);
  1022. for (;;);
  1023. }
  1024. #ifdef CONFIG_MODEM_SUPPORT
  1025. /* called from main loop (common/main.c) */
  1026. /* 'inline' - We have to do it fast */
  1027. static inline void mdm_readline(char *buf, int bufsiz)
  1028. {
  1029. char c;
  1030. char *p;
  1031. int n;
  1032. n = 0;
  1033. p = buf;
  1034. for(;;) {
  1035. c = serial_getc();
  1036. /* dbg("(%c)", c); */
  1037. switch(c) {
  1038. case '\r':
  1039. break;
  1040. case '\n':
  1041. *p = '\0';
  1042. return;
  1043. default:
  1044. if(n++ > bufsiz) {
  1045. *p = '\0';
  1046. return; /* sanity check */
  1047. }
  1048. *p = c;
  1049. p++;
  1050. break;
  1051. }
  1052. }
  1053. }
  1054. extern void dbg(const char *fmt, ...);
  1055. int mdm_init (void)
  1056. {
  1057. char env_str[16];
  1058. char *init_str;
  1059. int i;
  1060. extern char console_buffer[];
  1061. extern void enable_putc(void);
  1062. extern int hwflow_onoff(int);
  1063. enable_putc(); /* enable serial_putc() */
  1064. #ifdef CONFIG_HWFLOW
  1065. init_str = getenv("mdm_flow_control");
  1066. if (init_str && (strcmp(init_str, "rts/cts") == 0))
  1067. hwflow_onoff (1);
  1068. else
  1069. hwflow_onoff(-1);
  1070. #endif
  1071. for (i = 1;;i++) {
  1072. sprintf(env_str, "mdm_init%d", i);
  1073. if ((init_str = getenv(env_str)) != NULL) {
  1074. serial_puts(init_str);
  1075. serial_puts("\n");
  1076. for(;;) {
  1077. mdm_readline(console_buffer, CFG_CBSIZE);
  1078. dbg("ini%d: [%s]", i, console_buffer);
  1079. if ((strcmp(console_buffer, "OK") == 0) ||
  1080. (strcmp(console_buffer, "ERROR") == 0)) {
  1081. dbg("ini%d: cmd done", i);
  1082. break;
  1083. } else /* in case we are originating call ... */
  1084. if (strncmp(console_buffer, "CONNECT", 7) == 0) {
  1085. dbg("ini%d: connect", i);
  1086. return 0;
  1087. }
  1088. }
  1089. } else
  1090. break; /* no init string - stop modem init */
  1091. udelay(100000);
  1092. }
  1093. udelay(100000);
  1094. /* final stage - wait for connect */
  1095. for(;i > 1;) { /* if 'i' > 1 - wait for connection
  1096. message from modem */
  1097. mdm_readline(console_buffer, CFG_CBSIZE);
  1098. dbg("ini_f: [%s]", console_buffer);
  1099. if (strncmp(console_buffer, "CONNECT", 7) == 0) {
  1100. dbg("ini_f: connected");
  1101. return 0;
  1102. }
  1103. }
  1104. return 0;
  1105. }
  1106. #endif
  1107. #if 0 /* We could use plain global data, but the resulting code is bigger */
  1108. /*
  1109. * Pointer to initial global data area
  1110. *
  1111. * Here we initialize it.
  1112. */
  1113. #undef XTRN_DECLARE_GLOBAL_DATA_PTR
  1114. #define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */
  1115. DECLARE_GLOBAL_DATA_PTR = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
  1116. #endif /* 0 */
  1117. /************************************************************************/