board.c 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280
  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. addr = CFG_SDRAM_BASE + get_effective_memsize();
  390. #ifdef CONFIG_LOGBUFFER
  391. #ifndef CONFIG_ALT_LB_ADDR
  392. /* reserve kernel log buffer */
  393. addr -= (LOGBUFF_RESERVE);
  394. debug ("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN, addr);
  395. #endif
  396. #endif
  397. #ifdef CONFIG_PRAM
  398. /*
  399. * reserve protected RAM
  400. */
  401. i = getenv_r ("pram", (char *)tmp, sizeof (tmp));
  402. reg = (i > 0) ? simple_strtoul ((const char *)tmp, NULL, 10) : CONFIG_PRAM;
  403. addr -= (reg << 10); /* size is in kB */
  404. debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
  405. #endif /* CONFIG_PRAM */
  406. /* round down to next 4 kB limit */
  407. addr &= ~(4096 - 1);
  408. debug ("Top of RAM usable for U-Boot at: %08lx\n", addr);
  409. #ifdef CONFIG_LCD
  410. /* reserve memory for LCD display (always full pages) */
  411. addr = lcd_setmem (addr);
  412. gd->fb_base = addr;
  413. #endif /* CONFIG_LCD */
  414. #if defined(CONFIG_VIDEO) && defined(CONFIG_8xx)
  415. /* reserve memory for video display (always full pages) */
  416. addr = video_setmem (addr);
  417. gd->fb_base = addr;
  418. #endif /* CONFIG_VIDEO */
  419. /*
  420. * reserve memory for U-Boot code, data & bss
  421. * round down to next 4 kB limit
  422. */
  423. addr -= len;
  424. addr &= ~(4096 - 1);
  425. #ifdef CONFIG_E500
  426. /* round down to next 64 kB limit so that IVPR stays aligned */
  427. addr &= ~(65536 - 1);
  428. #endif
  429. debug ("Reserving %ldk for U-Boot at: %08lx\n", len >> 10, addr);
  430. #ifdef CONFIG_AMIGAONEG3SE
  431. gd->relocaddr = addr;
  432. #endif
  433. /*
  434. * reserve memory for malloc() arena
  435. */
  436. addr_sp = addr - TOTAL_MALLOC_LEN;
  437. debug ("Reserving %dk for malloc() at: %08lx\n",
  438. TOTAL_MALLOC_LEN >> 10, addr_sp);
  439. /*
  440. * (permanently) allocate a Board Info struct
  441. * and a permanent copy of the "global" data
  442. */
  443. addr_sp -= sizeof (bd_t);
  444. bd = (bd_t *) addr_sp;
  445. gd->bd = bd;
  446. debug ("Reserving %d Bytes for Board Info at: %08lx\n",
  447. sizeof (bd_t), addr_sp);
  448. addr_sp -= sizeof (gd_t);
  449. id = (gd_t *) addr_sp;
  450. debug ("Reserving %d Bytes for Global Data at: %08lx\n",
  451. sizeof (gd_t), addr_sp);
  452. /*
  453. * Finally, we set up a new (bigger) stack.
  454. *
  455. * Leave some safety gap for SP, force alignment on 16 byte boundary
  456. * Clear initial stack frame
  457. */
  458. addr_sp -= 16;
  459. addr_sp &= ~0xF;
  460. s = (ulong *)addr_sp;
  461. *s-- = 0;
  462. *s-- = 0;
  463. addr_sp = (ulong)s;
  464. debug ("Stack Pointer at: %08lx\n", addr_sp);
  465. /*
  466. * Save local variables to board info struct
  467. */
  468. bd->bi_memstart = CFG_SDRAM_BASE; /* start of DRAM memory */
  469. bd->bi_memsize = gd->ram_size; /* size of DRAM memory in bytes */
  470. #ifdef CONFIG_IP860
  471. bd->bi_sramstart = SRAM_BASE; /* start of SRAM memory */
  472. bd->bi_sramsize = SRAM_SIZE; /* size of SRAM memory */
  473. #elif defined CONFIG_MPC8220
  474. bd->bi_sramstart = CFG_SRAM_BASE; /* start of SRAM memory */
  475. bd->bi_sramsize = CFG_SRAM_SIZE; /* size of SRAM memory */
  476. #else
  477. bd->bi_sramstart = 0; /* FIXME */ /* start of SRAM memory */
  478. bd->bi_sramsize = 0; /* FIXME */ /* size of SRAM memory */
  479. #endif
  480. #if defined(CONFIG_8xx) || defined(CONFIG_8260) || defined(CONFIG_5xx) || \
  481. defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
  482. bd->bi_immr_base = CFG_IMMR; /* base of IMMR register */
  483. #endif
  484. #if defined(CONFIG_MPC5xxx)
  485. bd->bi_mbar_base = CFG_MBAR; /* base of internal registers */
  486. #endif
  487. #if defined(CONFIG_MPC83XX)
  488. bd->bi_immrbar = CFG_IMMR;
  489. #endif
  490. #if defined(CONFIG_MPC8220)
  491. bd->bi_mbar_base = CFG_MBAR; /* base of internal registers */
  492. bd->bi_inpfreq = gd->inp_clk;
  493. bd->bi_pcifreq = gd->pci_clk;
  494. bd->bi_vcofreq = gd->vco_clk;
  495. bd->bi_pevfreq = gd->pev_clk;
  496. bd->bi_flbfreq = gd->flb_clk;
  497. /* store bootparam to sram (backward compatible), here? */
  498. {
  499. u32 *sram = (u32 *)CFG_SRAM_BASE;
  500. *sram++ = gd->ram_size;
  501. *sram++ = gd->bus_clk;
  502. *sram++ = gd->inp_clk;
  503. *sram++ = gd->cpu_clk;
  504. *sram++ = gd->vco_clk;
  505. *sram++ = gd->flb_clk;
  506. *sram++ = 0xb8c3ba11; /* boot signature */
  507. }
  508. #endif
  509. bd->bi_bootflags = bootflag; /* boot / reboot flag (for LynxOS) */
  510. WATCHDOG_RESET ();
  511. bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */
  512. bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */
  513. #if defined(CONFIG_CPM2)
  514. bd->bi_cpmfreq = gd->cpm_clk;
  515. bd->bi_brgfreq = gd->brg_clk;
  516. bd->bi_sccfreq = gd->scc_clk;
  517. bd->bi_vco = gd->vco_out;
  518. #endif /* CONFIG_CPM2 */
  519. #if defined(CONFIG_MPC512X)
  520. bd->bi_ipsfreq = gd->ips_clk;
  521. #endif /* CONFIG_MPC512X */
  522. #if defined(CONFIG_MPC5xxx)
  523. bd->bi_ipbfreq = gd->ipb_clk;
  524. bd->bi_pcifreq = gd->pci_clk;
  525. #endif /* CONFIG_MPC5xxx */
  526. bd->bi_baudrate = gd->baudrate; /* Console Baudrate */
  527. #ifdef CFG_EXTBDINFO
  528. strncpy ((char *)bd->bi_s_version, "1.2", sizeof (bd->bi_s_version));
  529. strncpy ((char *)bd->bi_r_version, U_BOOT_VERSION, sizeof (bd->bi_r_version));
  530. bd->bi_procfreq = gd->cpu_clk; /* Processor Speed, In Hz */
  531. bd->bi_plb_busfreq = gd->bus_clk;
  532. #if defined(CONFIG_405GP) || defined(CONFIG_405EP) || \
  533. defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
  534. defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
  535. bd->bi_pci_busfreq = get_PCI_freq ();
  536. bd->bi_opbfreq = get_OPB_freq ();
  537. #elif defined(CONFIG_XILINX_ML300)
  538. bd->bi_pci_busfreq = get_PCI_freq ();
  539. #endif
  540. #endif
  541. debug ("New Stack Pointer is: %08lx\n", addr_sp);
  542. WATCHDOG_RESET ();
  543. #ifdef CONFIG_POST
  544. post_bootmode_init();
  545. post_run (NULL, POST_ROM | post_bootmode_get(0));
  546. #endif
  547. WATCHDOG_RESET();
  548. memcpy (id, (void *)gd, sizeof (gd_t));
  549. relocate_code (addr_sp, id, addr);
  550. /* NOTREACHED - relocate_code() does not return */
  551. }
  552. /************************************************************************
  553. *
  554. * This is the next part if the initialization sequence: we are now
  555. * running from RAM and have a "normal" C environment, i. e. global
  556. * data can be written, BSS has been cleared, the stack size in not
  557. * that critical any more, etc.
  558. *
  559. ************************************************************************
  560. */
  561. void board_init_r (gd_t *id, ulong dest_addr)
  562. {
  563. cmd_tbl_t *cmdtp;
  564. char *s, *e;
  565. bd_t *bd;
  566. int i;
  567. extern void malloc_bin_reloc (void);
  568. #ifndef CFG_ENV_IS_NOWHERE
  569. extern char * env_name_spec;
  570. #endif
  571. #ifndef CFG_NO_FLASH
  572. ulong flash_size;
  573. #endif
  574. gd = id; /* initialize RAM version of global data */
  575. bd = gd->bd;
  576. gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
  577. #if defined(CONFIG_RELOC_FIXUP_WORKS)
  578. gd->reloc_off = 0;
  579. mem_malloc_end = dest_addr;
  580. #else
  581. gd->reloc_off = dest_addr - CFG_MONITOR_BASE;
  582. #endif
  583. #ifdef CONFIG_SERIAL_MULTI
  584. serial_initialize();
  585. #endif
  586. debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
  587. WATCHDOG_RESET ();
  588. #if defined(CONFIG_BOARD_EARLY_INIT_R)
  589. board_early_init_r ();
  590. #endif
  591. monitor_flash_len = (ulong)&__init_end - dest_addr;
  592. /*
  593. * We have to relocate the command table manually
  594. */
  595. for (cmdtp = &__u_boot_cmd_start; cmdtp != &__u_boot_cmd_end; cmdtp++) {
  596. ulong addr;
  597. addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
  598. #if 0
  599. printf ("Command \"%s\": 0x%08lx => 0x%08lx\n",
  600. cmdtp->name, (ulong) (cmdtp->cmd), addr);
  601. #endif
  602. cmdtp->cmd =
  603. (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
  604. addr = (ulong)(cmdtp->name) + gd->reloc_off;
  605. cmdtp->name = (char *)addr;
  606. if (cmdtp->usage) {
  607. addr = (ulong)(cmdtp->usage) + gd->reloc_off;
  608. cmdtp->usage = (char *)addr;
  609. }
  610. #ifdef CFG_LONGHELP
  611. if (cmdtp->help) {
  612. addr = (ulong)(cmdtp->help) + gd->reloc_off;
  613. cmdtp->help = (char *)addr;
  614. }
  615. #endif
  616. }
  617. /* there are some other pointer constants we must deal with */
  618. #ifndef CFG_ENV_IS_NOWHERE
  619. env_name_spec += gd->reloc_off;
  620. #endif
  621. WATCHDOG_RESET ();
  622. #ifdef CONFIG_LOGBUFFER
  623. logbuff_init_ptrs ();
  624. #endif
  625. #ifdef CONFIG_POST
  626. post_output_backlog ();
  627. post_reloc ();
  628. #endif
  629. WATCHDOG_RESET();
  630. #if defined(CONFIG_IP860) || defined(CONFIG_PCU_E) || \
  631. defined (CONFIG_FLAGADM) || defined(CONFIG_MPC83XX)
  632. icache_enable (); /* it's time to enable the instruction cache */
  633. #endif
  634. #if defined(CFG_INIT_RAM_LOCK) && defined(CONFIG_E500)
  635. unlock_ram_in_cache(); /* it's time to unlock D-cache in e500 */
  636. #endif
  637. #if defined(CONFIG_BAB7xx) || defined(CONFIG_CPC45)
  638. /*
  639. * Do PCI configuration on BAB7xx and CPC45 _before_ the flash
  640. * gets initialised, because we need the ISA resp. PCI_to_LOCAL bus
  641. * bridge there.
  642. */
  643. pci_init ();
  644. #endif
  645. #if defined(CONFIG_BAB7xx)
  646. /*
  647. * Initialise the ISA bridge
  648. */
  649. initialise_w83c553f ();
  650. #endif
  651. asm ("sync ; isync");
  652. /*
  653. * Setup trap handlers
  654. */
  655. trap_init (dest_addr);
  656. #if !defined(CFG_NO_FLASH)
  657. puts ("FLASH: ");
  658. if ((flash_size = flash_init ()) > 0) {
  659. # ifdef CFG_FLASH_CHECKSUM
  660. print_size (flash_size, "");
  661. /*
  662. * Compute and print flash CRC if flashchecksum is set to 'y'
  663. *
  664. * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
  665. */
  666. s = getenv ("flashchecksum");
  667. if (s && (*s == 'y')) {
  668. printf (" CRC: %08lX",
  669. crc32 (0, (const unsigned char *) CFG_FLASH_BASE, flash_size)
  670. );
  671. }
  672. putc ('\n');
  673. # else /* !CFG_FLASH_CHECKSUM */
  674. print_size (flash_size, "\n");
  675. # endif /* CFG_FLASH_CHECKSUM */
  676. } else {
  677. puts (failed);
  678. hang ();
  679. }
  680. bd->bi_flashstart = CFG_FLASH_BASE; /* update start of FLASH memory */
  681. bd->bi_flashsize = flash_size; /* size of FLASH memory (final value) */
  682. #if defined(CFG_UPDATE_FLASH_SIZE)
  683. /* Make a update of the Memctrl. */
  684. update_flash_size (flash_size);
  685. #endif
  686. # if defined(CONFIG_PCU_E) || defined(CONFIG_OXC) || defined(CONFIG_RMU)
  687. /* flash mapped at end of memory map */
  688. bd->bi_flashoffset = TEXT_BASE + flash_size;
  689. # elif CFG_MONITOR_BASE == CFG_FLASH_BASE
  690. bd->bi_flashoffset = monitor_flash_len; /* reserved area for startup monitor */
  691. # else
  692. bd->bi_flashoffset = 0;
  693. # endif
  694. #else /* CFG_NO_FLASH */
  695. bd->bi_flashsize = 0;
  696. bd->bi_flashstart = 0;
  697. bd->bi_flashoffset = 0;
  698. #endif /* !CFG_NO_FLASH */
  699. WATCHDOG_RESET ();
  700. /* initialize higher level parts of CPU like time base and timers */
  701. cpu_init_r ();
  702. WATCHDOG_RESET ();
  703. /* initialize malloc() area */
  704. mem_malloc_init ();
  705. malloc_bin_reloc ();
  706. #ifdef CONFIG_SPI
  707. # if !defined(CFG_ENV_IS_IN_EEPROM)
  708. spi_init_f ();
  709. # endif
  710. spi_init_r ();
  711. #endif
  712. #if defined(CONFIG_CMD_NAND)
  713. WATCHDOG_RESET ();
  714. puts ("NAND: ");
  715. nand_init(); /* go init the NAND */
  716. #endif
  717. /* relocate environment function pointers etc. */
  718. env_relocate ();
  719. /*
  720. * Fill in missing fields of bd_info.
  721. * We do this here, where we have "normal" access to the
  722. * environment; we used to do this still running from ROM,
  723. * where had to use getenv_r(), which can be pretty slow when
  724. * the environment is in EEPROM.
  725. */
  726. #if defined(CFG_EXTBDINFO)
  727. #if defined(CONFIG_405GP) || defined(CONFIG_405EP)
  728. #if defined(CONFIG_I2CFAST)
  729. /*
  730. * set bi_iic_fast for linux taking environment variable
  731. * "i2cfast" into account
  732. */
  733. {
  734. char *s = getenv ("i2cfast");
  735. if (s && ((*s == 'y') || (*s == 'Y'))) {
  736. bd->bi_iic_fast[0] = 1;
  737. bd->bi_iic_fast[1] = 1;
  738. } else {
  739. bd->bi_iic_fast[0] = 0;
  740. bd->bi_iic_fast[1] = 0;
  741. }
  742. }
  743. #else
  744. bd->bi_iic_fast[0] = 0;
  745. bd->bi_iic_fast[1] = 0;
  746. #endif /* CONFIG_I2CFAST */
  747. #endif /* CONFIG_405GP, CONFIG_405EP */
  748. #endif /* CFG_EXTBDINFO */
  749. #if defined(CONFIG_SC3)
  750. sc3_read_eeprom();
  751. #endif
  752. #ifdef CFG_ID_EEPROM
  753. mac_read_from_eeprom();
  754. #endif
  755. s = getenv ("ethaddr");
  756. #if defined (CONFIG_MBX) || \
  757. defined (CONFIG_RPXCLASSIC) || \
  758. defined(CONFIG_IAD210) || \
  759. defined(CONFIG_V38B)
  760. if (s == NULL)
  761. board_get_enetaddr (bd->bi_enetaddr);
  762. else
  763. #endif
  764. for (i = 0; i < 6; ++i) {
  765. bd->bi_enetaddr[i] = s ? simple_strtoul (s, &e, 16) : 0;
  766. if (s)
  767. s = (*e) ? e + 1 : e;
  768. }
  769. #ifdef CONFIG_HERMES
  770. if ((gd->board_type >> 16) == 2)
  771. bd->bi_ethspeed = gd->board_type & 0xFFFF;
  772. else
  773. bd->bi_ethspeed = 0xFFFF;
  774. #endif
  775. #ifdef CONFIG_NX823
  776. load_sernum_ethaddr ();
  777. #endif
  778. #ifdef CONFIG_HAS_ETH1
  779. /* handle the 2nd ethernet address */
  780. s = getenv ("eth1addr");
  781. for (i = 0; i < 6; ++i) {
  782. bd->bi_enet1addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
  783. if (s)
  784. s = (*e) ? e + 1 : e;
  785. }
  786. #endif
  787. #ifdef CONFIG_HAS_ETH2
  788. /* handle the 3rd ethernet address */
  789. s = getenv ("eth2addr");
  790. #if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
  791. if (s == NULL)
  792. board_get_enetaddr(bd->bi_enet2addr);
  793. else
  794. #endif
  795. for (i = 0; i < 6; ++i) {
  796. bd->bi_enet2addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
  797. if (s)
  798. s = (*e) ? e + 1 : e;
  799. }
  800. #endif
  801. #ifdef CONFIG_HAS_ETH3
  802. /* handle 4th ethernet address */
  803. s = getenv("eth3addr");
  804. #if defined(CONFIG_XPEDITE1K) || defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
  805. if (s == NULL)
  806. board_get_enetaddr(bd->bi_enet3addr);
  807. else
  808. #endif
  809. for (i = 0; i < 6; ++i) {
  810. bd->bi_enet3addr[i] = s ? simple_strtoul (s, &e, 16) : 0;
  811. if (s)
  812. s = (*e) ? e + 1 : e;
  813. }
  814. #endif
  815. #if defined(CONFIG_TQM8xxL) || defined(CONFIG_TQM8260) || \
  816. defined(CONFIG_TQM8272) || \
  817. defined(CONFIG_CCM) || defined(CONFIG_KUP4K) || \
  818. defined(CONFIG_KUP4X) || defined(CONFIG_PCS440EP)
  819. load_sernum_ethaddr ();
  820. #endif
  821. /* IP Address */
  822. bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
  823. WATCHDOG_RESET ();
  824. #if defined(CONFIG_PCI) && !defined(CONFIG_BAB7xx) && !defined(CONFIG_CPC45)
  825. /*
  826. * Do pci configuration
  827. */
  828. pci_init ();
  829. #endif
  830. /** leave this here (after malloc(), environment and PCI are working) **/
  831. /* Initialize devices */
  832. devices_init ();
  833. /* Initialize the jump table for applications */
  834. jumptable_init ();
  835. #if defined(CONFIG_API)
  836. /* Initialize API */
  837. api_init ();
  838. #endif
  839. /* Initialize the console (after the relocation and devices init) */
  840. console_init_r ();
  841. #if defined(CONFIG_CCM) || \
  842. defined(CONFIG_COGENT) || \
  843. defined(CONFIG_CPCI405) || \
  844. defined(CONFIG_EVB64260) || \
  845. defined(CONFIG_KUP4K) || \
  846. defined(CONFIG_KUP4X) || \
  847. defined(CONFIG_LWMON) || \
  848. defined(CONFIG_PCU_E) || \
  849. defined(CONFIG_SC3) || \
  850. defined(CONFIG_W7O) || \
  851. defined(CONFIG_MISC_INIT_R)
  852. /* miscellaneous platform dependent initialisations */
  853. misc_init_r ();
  854. #endif
  855. #ifdef CONFIG_HERMES
  856. if (bd->bi_ethspeed != 0xFFFF)
  857. hermes_start_lxt980 ((int) bd->bi_ethspeed);
  858. #endif
  859. #if defined(CONFIG_CMD_KGDB)
  860. WATCHDOG_RESET ();
  861. puts ("KGDB: ");
  862. kgdb_init ();
  863. #endif
  864. debug ("U-Boot relocated to %08lx\n", dest_addr);
  865. /*
  866. * Enable Interrupts
  867. */
  868. interrupt_init ();
  869. /* Must happen after interrupts are initialized since
  870. * an irq handler gets installed
  871. */
  872. #ifdef CONFIG_SERIAL_SOFTWARE_FIFO
  873. serial_buffered_init();
  874. #endif
  875. #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
  876. status_led_set (STATUS_LED_BOOT, STATUS_LED_BLINKING);
  877. #endif
  878. udelay (20);
  879. set_timer (0);
  880. /* Initialize from environment */
  881. if ((s = getenv ("loadaddr")) != NULL) {
  882. load_addr = simple_strtoul (s, NULL, 16);
  883. }
  884. #if defined(CONFIG_CMD_NET)
  885. if ((s = getenv ("bootfile")) != NULL) {
  886. copy_filename (BootFile, s, sizeof (BootFile));
  887. }
  888. #endif
  889. WATCHDOG_RESET ();
  890. #if defined(CONFIG_CMD_SCSI)
  891. WATCHDOG_RESET ();
  892. puts ("SCSI: ");
  893. scsi_init ();
  894. #endif
  895. #if defined(CONFIG_CMD_DOC)
  896. WATCHDOG_RESET ();
  897. puts ("DOC: ");
  898. doc_init ();
  899. #endif
  900. #if defined(CONFIG_CMD_NET)
  901. #if defined(CONFIG_NET_MULTI)
  902. WATCHDOG_RESET ();
  903. puts ("Net: ");
  904. #endif
  905. eth_initialize (bd);
  906. #endif
  907. #if defined(CONFIG_CMD_NET) && ( \
  908. defined(CONFIG_CCM) || \
  909. defined(CONFIG_ELPT860) || \
  910. defined(CONFIG_EP8260) || \
  911. defined(CONFIG_IP860) || \
  912. defined(CONFIG_IVML24) || \
  913. defined(CONFIG_IVMS8) || \
  914. defined(CONFIG_MPC8260ADS) || \
  915. defined(CONFIG_MPC8266ADS) || \
  916. defined(CONFIG_MPC8560ADS) || \
  917. defined(CONFIG_PCU_E) || \
  918. defined(CONFIG_RPXSUPER) || \
  919. defined(CONFIG_STXGP3) || \
  920. defined(CONFIG_SPD823TS) || \
  921. defined(CONFIG_RESET_PHY_R) )
  922. WATCHDOG_RESET ();
  923. debug ("Reset Ethernet PHY\n");
  924. reset_phy ();
  925. #endif
  926. #ifdef CONFIG_POST
  927. post_run (NULL, POST_RAM | post_bootmode_get(0));
  928. #endif
  929. #if defined(CONFIG_CMD_PCMCIA) \
  930. && !defined(CONFIG_CMD_IDE)
  931. WATCHDOG_RESET ();
  932. puts ("PCMCIA:");
  933. pcmcia_init ();
  934. #endif
  935. #if defined(CONFIG_CMD_IDE)
  936. WATCHDOG_RESET ();
  937. # ifdef CONFIG_IDE_8xx_PCCARD
  938. puts ("PCMCIA:");
  939. # else
  940. puts ("IDE: ");
  941. #endif
  942. #if defined(CONFIG_START_IDE)
  943. if (board_start_ide())
  944. ide_init ();
  945. #else
  946. ide_init ();
  947. #endif
  948. #endif
  949. #ifdef CONFIG_LAST_STAGE_INIT
  950. WATCHDOG_RESET ();
  951. /*
  952. * Some parts can be only initialized if all others (like
  953. * Interrupts) are up and running (i.e. the PC-style ISA
  954. * keyboard).
  955. */
  956. last_stage_init ();
  957. #endif
  958. #if defined(CONFIG_CMD_BEDBUG)
  959. WATCHDOG_RESET ();
  960. bedbug_init ();
  961. #endif
  962. #if defined(CONFIG_PRAM) || defined(CONFIG_LOGBUFFER)
  963. /*
  964. * Export available size of memory for Linux,
  965. * taking into account the protected RAM at top of memory
  966. */
  967. {
  968. ulong pram;
  969. uchar memsz[32];
  970. #ifdef CONFIG_PRAM
  971. char *s;
  972. if ((s = getenv ("pram")) != NULL) {
  973. pram = simple_strtoul (s, NULL, 10);
  974. } else {
  975. pram = CONFIG_PRAM;
  976. }
  977. #else
  978. pram=0;
  979. #endif
  980. #ifdef CONFIG_LOGBUFFER
  981. #ifndef CONFIG_ALT_LB_ADDR
  982. /* Also take the logbuffer into account (pram is in kB) */
  983. pram += (LOGBUFF_LEN+LOGBUFF_OVERHEAD)/1024;
  984. #endif
  985. #endif
  986. sprintf ((char *)memsz, "%ldk", (bd->bi_memsize / 1024) - pram);
  987. setenv ("mem", (char *)memsz);
  988. }
  989. #endif
  990. #ifdef CONFIG_PS2KBD
  991. puts ("PS/2: ");
  992. kbd_init();
  993. #endif
  994. #ifdef CONFIG_MODEM_SUPPORT
  995. {
  996. extern int do_mdm_init;
  997. do_mdm_init = gd->do_mdm_init;
  998. }
  999. #endif
  1000. /* Initialization complete - start the monitor */
  1001. /* main_loop() can return to retry autoboot, if so just run it again. */
  1002. for (;;) {
  1003. WATCHDOG_RESET ();
  1004. main_loop ();
  1005. }
  1006. /* NOTREACHED - no way out of command loop except booting */
  1007. }
  1008. void hang (void)
  1009. {
  1010. puts ("### ERROR ### Please RESET the board ###\n");
  1011. show_boot_progress(-30);
  1012. for (;;);
  1013. }
  1014. #ifdef CONFIG_MODEM_SUPPORT
  1015. /* called from main loop (common/main.c) */
  1016. /* 'inline' - We have to do it fast */
  1017. static inline void mdm_readline(char *buf, int bufsiz)
  1018. {
  1019. char c;
  1020. char *p;
  1021. int n;
  1022. n = 0;
  1023. p = buf;
  1024. for(;;) {
  1025. c = serial_getc();
  1026. /* dbg("(%c)", c); */
  1027. switch(c) {
  1028. case '\r':
  1029. break;
  1030. case '\n':
  1031. *p = '\0';
  1032. return;
  1033. default:
  1034. if(n++ > bufsiz) {
  1035. *p = '\0';
  1036. return; /* sanity check */
  1037. }
  1038. *p = c;
  1039. p++;
  1040. break;
  1041. }
  1042. }
  1043. }
  1044. extern void dbg(const char *fmt, ...);
  1045. int mdm_init (void)
  1046. {
  1047. char env_str[16];
  1048. char *init_str;
  1049. int i;
  1050. extern char console_buffer[];
  1051. extern void enable_putc(void);
  1052. extern int hwflow_onoff(int);
  1053. enable_putc(); /* enable serial_putc() */
  1054. #ifdef CONFIG_HWFLOW
  1055. init_str = getenv("mdm_flow_control");
  1056. if (init_str && (strcmp(init_str, "rts/cts") == 0))
  1057. hwflow_onoff (1);
  1058. else
  1059. hwflow_onoff(-1);
  1060. #endif
  1061. for (i = 1;;i++) {
  1062. sprintf(env_str, "mdm_init%d", i);
  1063. if ((init_str = getenv(env_str)) != NULL) {
  1064. serial_puts(init_str);
  1065. serial_puts("\n");
  1066. for(;;) {
  1067. mdm_readline(console_buffer, CFG_CBSIZE);
  1068. dbg("ini%d: [%s]", i, console_buffer);
  1069. if ((strcmp(console_buffer, "OK") == 0) ||
  1070. (strcmp(console_buffer, "ERROR") == 0)) {
  1071. dbg("ini%d: cmd done", i);
  1072. break;
  1073. } else /* in case we are originating call ... */
  1074. if (strncmp(console_buffer, "CONNECT", 7) == 0) {
  1075. dbg("ini%d: connect", i);
  1076. return 0;
  1077. }
  1078. }
  1079. } else
  1080. break; /* no init string - stop modem init */
  1081. udelay(100000);
  1082. }
  1083. udelay(100000);
  1084. /* final stage - wait for connect */
  1085. for(;i > 1;) { /* if 'i' > 1 - wait for connection
  1086. message from modem */
  1087. mdm_readline(console_buffer, CFG_CBSIZE);
  1088. dbg("ini_f: [%s]", console_buffer);
  1089. if (strncmp(console_buffer, "CONNECT", 7) == 0) {
  1090. dbg("ini_f: connected");
  1091. return 0;
  1092. }
  1093. }
  1094. return 0;
  1095. }
  1096. #endif
  1097. #if 0 /* We could use plain global data, but the resulting code is bigger */
  1098. /*
  1099. * Pointer to initial global data area
  1100. *
  1101. * Here we initialize it.
  1102. */
  1103. #undef XTRN_DECLARE_GLOBAL_DATA_PTR
  1104. #define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */
  1105. DECLARE_GLOBAL_DATA_PTR = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
  1106. #endif /* 0 */
  1107. /************************************************************************/