Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 1 | /* SPARC Board initialization |
| 2 | * |
| 3 | * (C) Copyright 2000-2006 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 5 | * |
| 6 | * (C) Copyright 2007 |
| 7 | * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com. |
| 8 | * |
| 9 | * See file CREDITS for list of people who contributed to this |
| 10 | * project. |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License as |
| 14 | * published by the Free Software Foundation; either version 2 of |
| 15 | * the License, or (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 25 | * MA 02111-1307 USA |
| 26 | */ |
| 27 | |
| 28 | #include <common.h> |
| 29 | #include <command.h> |
| 30 | #include <malloc.h> |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 31 | #include <stdio_dev.h> |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 32 | #include <config.h> |
| 33 | #if defined(CONFIG_CMD_IDE) |
| 34 | #include <ide.h> |
| 35 | #endif |
| 36 | #ifdef CONFIG_STATUS_LED |
| 37 | #include <status_led.h> |
| 38 | #endif |
| 39 | #include <net.h> |
| 40 | #include <serial.h> |
| 41 | #include <version.h> |
| 42 | #if defined(CONFIG_POST) |
| 43 | #include <post.h> |
| 44 | #endif |
| 45 | #ifdef CONFIG_PS2KBD |
| 46 | #include <keyboard.h> |
| 47 | #endif |
| 48 | #ifdef CONFIG_CMD_AMBAPP |
| 49 | #include <ambapp.h> |
| 50 | #endif |
| 51 | |
| 52 | DECLARE_GLOBAL_DATA_PTR; |
| 53 | |
| 54 | /* Debug options |
| 55 | #define DEBUG_INIT_SEQUENCE |
| 56 | #define DEBUG_MEM_LAYOUT |
| 57 | #define DEBUG_COMMANDS |
| 58 | */ |
| 59 | |
| 60 | extern void timer_interrupt_init(void); |
| 61 | extern void malloc_bin_reloc(void); |
| 62 | extern int do_ambapp_print(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]); |
| 63 | extern int prom_init(void); |
| 64 | |
| 65 | #if defined(CONFIG__CMD_DOC) |
| 66 | void doc_init(void); |
| 67 | #endif |
| 68 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 69 | #if !defined(CONFIG_SYS_NO_FLASH) |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 70 | static char *failed = "*** failed ***\n"; |
| 71 | #endif |
| 72 | |
| 73 | #include <environment.h> |
| 74 | |
| 75 | ulong monitor_flash_len; |
| 76 | |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 77 | /************************************************************************ |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 78 | * Init Utilities * |
| 79 | ************************************************************************ |
| 80 | * Some of this code should be moved into the core functions, |
| 81 | * but let's get it working (again) first... |
| 82 | */ |
| 83 | |
| 84 | static int init_baudrate(void) |
| 85 | { |
| 86 | char tmp[64]; /* long enough for environment variables */ |
| 87 | int i = getenv_r("baudrate", tmp, sizeof(tmp)); |
| 88 | |
| 89 | gd->baudrate = (i > 0) |
| 90 | ? (int)simple_strtoul(tmp, NULL, 10) |
| 91 | : CONFIG_BAUDRATE; |
| 92 | return (0); |
| 93 | } |
| 94 | |
| 95 | /***********************************************************************/ |
| 96 | |
| 97 | /* |
| 98 | * All attempts to come up with a "common" initialization sequence |
| 99 | * that works for all boards and architectures failed: some of the |
| 100 | * requirements are just _too_ different. To get rid of the resulting |
| 101 | * mess of board dependend #ifdef'ed code we now make the whole |
| 102 | * initialization sequence configurable to the user. |
| 103 | * |
| 104 | * The requirements for any new initalization function is simple: it |
| 105 | * receives a pointer to the "global data" structure as it's only |
| 106 | * argument, and returns an integer return code, where 0 means |
| 107 | * "continue" and != 0 means "fatal error, hang the system". |
| 108 | */ |
| 109 | typedef int (init_fnc_t) (void); |
| 110 | |
| 111 | #define WATCHDOG_RESET(x) |
| 112 | |
| 113 | /************************************************************************ |
| 114 | * Initialization sequence * |
| 115 | ************************************************************************ |
| 116 | */ |
| 117 | |
| 118 | init_fnc_t *init_sequence[] = { |
| 119 | |
| 120 | #if defined(CONFIG_BOARD_EARLY_INIT_F) |
| 121 | board_early_init_f, |
| 122 | #endif |
| 123 | serial_init, |
| 124 | |
| 125 | init_timebase, |
| 126 | |
| 127 | #if defined(CONFIG_CMD_AMBAPP) |
| 128 | ambapp_init_reloc, |
| 129 | #endif |
| 130 | |
| 131 | env_init, |
| 132 | |
| 133 | init_baudrate, |
| 134 | |
| 135 | console_init_f, |
| 136 | display_options, |
| 137 | |
| 138 | checkcpu, |
| 139 | checkboard, |
| 140 | #if defined(CONFIG_MISC_INIT_F) |
| 141 | misc_init_f, |
| 142 | #endif |
| 143 | |
| 144 | #ifdef CONFIG_POST |
| 145 | post_init_f, |
| 146 | #endif |
| 147 | |
| 148 | NULL, /* Terminate this list, |
| 149 | * beware: this list will be relocated |
| 150 | * which means that NULL will become |
| 151 | * NULL+RELOC_OFFSET. We simply make |
| 152 | * NULL be -RELOC_OFFSET instead. |
| 153 | */ |
| 154 | }; |
| 155 | |
| 156 | /************************************************************************ |
| 157 | * |
| 158 | * This is the SPARC board initialization routine, running from RAM. |
| 159 | * |
| 160 | ************************************************************************ |
| 161 | */ |
| 162 | #ifdef DEBUG_INIT_SEQUENCE |
| 163 | char *str_init_seq = "INIT_SEQ 00\n"; |
| 164 | char *str_init_seq_done = "\n\rInit sequence done...\r\n\r\n"; |
| 165 | #endif |
| 166 | |
| 167 | void board_init_f(ulong bootflag) |
| 168 | { |
| 169 | cmd_tbl_t *cmdtp; |
| 170 | bd_t *bd; |
| 171 | unsigned char *s; |
| 172 | init_fnc_t **init_fnc_ptr; |
| 173 | int j; |
| 174 | int i; |
| 175 | char *e; |
| 176 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 177 | #ifndef CONFIG_SYS_NO_FLASH |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 178 | ulong flash_size; |
| 179 | #endif |
| 180 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 181 | gd = (gd_t *) (CONFIG_SYS_GBL_DATA_OFFSET); |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 182 | |
| 183 | /* Clear initial global data */ |
| 184 | memset((void *)gd, 0, sizeof(gd_t)); |
| 185 | |
| 186 | gd->bd = (bd_t *) (gd + 1); /* At end of global data */ |
| 187 | gd->baudrate = CONFIG_BAUDRATE; |
| 188 | gd->cpu_clk = CONFIG_SYS_CLK_FREQ; |
| 189 | |
| 190 | bd = gd->bd; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 191 | bd->bi_memstart = CONFIG_SYS_RAM_BASE; |
| 192 | bd->bi_memsize = CONFIG_SYS_RAM_SIZE; |
| 193 | bd->bi_flashstart = CONFIG_SYS_FLASH_BASE; |
| 194 | #if defined(CONFIG_SYS_SRAM_BASE) && defined(CONFIG_SYS_SRAM_SIZE) |
| 195 | bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; |
| 196 | bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 197 | #endif |
| 198 | bd->bi_baudrate = CONFIG_BAUDRATE; |
| 199 | bd->bi_bootflags = bootflag; /* boot / reboot flag (for LynxOS) */ |
| 200 | |
| 201 | gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 202 | gd->reloc_off = CONFIG_SYS_RELOC_MONITOR_BASE - CONFIG_SYS_MONITOR_BASE; |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 203 | |
| 204 | for (init_fnc_ptr = init_sequence, j = 0; *init_fnc_ptr; |
| 205 | ++init_fnc_ptr, j++) { |
| 206 | #ifdef DEBUG_INIT_SEQUENCE |
| 207 | if (j > 9) |
| 208 | str_init_seq[9] = '0' + (j / 10); |
| 209 | str_init_seq[10] = '0' + (j - (j / 10) * 10); |
| 210 | serial_puts(str_init_seq); |
| 211 | #endif |
| 212 | if ((*init_fnc_ptr + gd->reloc_off) () != 0) { |
| 213 | hang(); |
| 214 | } |
| 215 | } |
| 216 | #ifdef DEBUG_INIT_SEQUENCE |
| 217 | serial_puts(str_init_seq_done); |
| 218 | #endif |
| 219 | |
| 220 | /* |
| 221 | * Now that we have DRAM mapped and working, we can |
| 222 | * relocate the code and continue running from DRAM. |
| 223 | * |
| 224 | * Reserve memory at end of RAM for (top down in that order): |
| 225 | * - kernel log buffer |
| 226 | * - protected RAM |
| 227 | * - LCD framebuffer |
| 228 | * - monitor code |
| 229 | * - board info struct |
| 230 | */ |
| 231 | #ifdef DEBUG_MEM_LAYOUT |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 232 | printf("CONFIG_SYS_MONITOR_BASE: 0x%lx\n", CONFIG_SYS_MONITOR_BASE); |
Jean-Christophe PLAGNIOL-VILLARD | 0e8d158 | 2008-09-10 22:48:06 +0200 | [diff] [blame] | 233 | printf("CONFIG_ENV_ADDR: 0x%lx\n", CONFIG_ENV_ADDR); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 234 | printf("CONFIG_SYS_RELOC_MONITOR_BASE: 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE, |
| 235 | CONFIG_SYS_MONITOR_LEN); |
| 236 | printf("CONFIG_SYS_MALLOC_BASE: 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE, |
| 237 | CONFIG_SYS_MALLOC_LEN); |
| 238 | printf("CONFIG_SYS_INIT_SP_OFFSET: 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET, |
| 239 | CONFIG_SYS_STACK_SIZE); |
| 240 | printf("CONFIG_SYS_PROM_OFFSET: 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET, |
| 241 | CONFIG_SYS_PROM_SIZE); |
| 242 | printf("CONFIG_SYS_GBL_DATA_OFFSET: 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET, |
| 243 | CONFIG_SYS_GBL_DATA_SIZE); |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 244 | #endif |
| 245 | |
| 246 | #ifdef CONFIG_POST |
| 247 | post_bootmode_init(); |
| 248 | post_run(NULL, POST_ROM | post_bootmode_get(0)); |
| 249 | #endif |
| 250 | |
| 251 | /* |
| 252 | * We have to relocate the command table manually |
| 253 | */ |
| 254 | for (cmdtp = &__u_boot_cmd_start; cmdtp != &__u_boot_cmd_end; cmdtp++) { |
| 255 | ulong addr; |
| 256 | addr = (ulong) (cmdtp->cmd) + gd->reloc_off; |
| 257 | #if DEBUG_COMMANDS |
| 258 | printf("Command \"%s\": 0x%08lx => 0x%08lx\n", |
| 259 | cmdtp->name, (ulong) (cmdtp->cmd), addr); |
| 260 | #endif |
| 261 | cmdtp->cmd = |
| 262 | (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr; |
| 263 | |
| 264 | addr = (ulong) (cmdtp->name) + gd->reloc_off; |
| 265 | cmdtp->name = (char *)addr; |
| 266 | |
| 267 | if (cmdtp->usage) { |
| 268 | addr = (ulong) (cmdtp->usage) + gd->reloc_off; |
| 269 | cmdtp->usage = (char *)addr; |
| 270 | } |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 271 | #ifdef CONFIG_SYS_LONGHELP |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 272 | if (cmdtp->help) { |
| 273 | addr = (ulong) (cmdtp->help) + gd->reloc_off; |
| 274 | cmdtp->help = (char *)addr; |
| 275 | } |
| 276 | #endif |
| 277 | } |
| 278 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 279 | #if defined(CONFIG_CMD_AMBAPP) && defined(CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP) |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 280 | puts("AMBA:\n"); |
| 281 | do_ambapp_print(NULL, 0, 0, NULL); |
| 282 | #endif |
| 283 | |
| 284 | /* initialize higher level parts of CPU like time base and timers */ |
| 285 | cpu_init_r(); |
| 286 | |
| 287 | /* start timer */ |
| 288 | timer_interrupt_init(); |
| 289 | |
| 290 | /* |
| 291 | * Enable Interrupts before any calls to udelay, |
| 292 | * the flash driver may use udelay resulting in |
| 293 | * a hang if not timer0 IRQ is enabled. |
| 294 | */ |
| 295 | interrupt_init(); |
| 296 | |
Peter Tyser | bdb2802 | 2009-08-21 23:05:21 -0500 | [diff] [blame^] | 297 | /* The Malloc area is immediately below the monitor copy in RAM */ |
Peter Tyser | 832f437 | 2009-08-21 23:05:20 -0500 | [diff] [blame] | 298 | mem_malloc_init(CONFIG_SYS_MALLOC_BASE, |
| 299 | CONFIG_SYS_MALLOC_END - CONFIG_SYS_MALLOC_BASE); |
Stefan Roese | c790b04 | 2009-05-11 15:50:12 +0200 | [diff] [blame] | 300 | malloc_bin_reloc(); |
| 301 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 302 | #if !defined(CONFIG_SYS_NO_FLASH) |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 303 | puts("FLASH: "); |
| 304 | |
| 305 | if ((flash_size = flash_init()) > 0) { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 306 | # ifdef CONFIG_SYS_FLASH_CHECKSUM |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 307 | print_size(flash_size, ""); |
| 308 | /* |
| 309 | * Compute and print flash CRC if flashchecksum is set to 'y' |
| 310 | * |
| 311 | * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX |
| 312 | */ |
| 313 | s = getenv("flashchecksum"); |
| 314 | if (s && (*s == 'y')) { |
| 315 | printf(" CRC: %08lX", |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 316 | crc32(0, (const unsigned char *)CONFIG_SYS_FLASH_BASE, |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 317 | flash_size) |
| 318 | ); |
| 319 | } |
| 320 | putc('\n'); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 321 | # else /* !CONFIG_SYS_FLASH_CHECKSUM */ |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 322 | print_size(flash_size, "\n"); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 323 | # endif /* CONFIG_SYS_FLASH_CHECKSUM */ |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 324 | } else { |
| 325 | puts(failed); |
| 326 | hang(); |
| 327 | } |
| 328 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 329 | bd->bi_flashstart = CONFIG_SYS_FLASH_BASE; /* update start of FLASH memory */ |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 330 | bd->bi_flashsize = flash_size; /* size of FLASH memory (final value) */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 331 | #if CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 332 | bd->bi_flashoffset = monitor_flash_len; /* reserved area for startup monitor */ |
| 333 | #else |
| 334 | bd->bi_flashoffset = 0; |
| 335 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 336 | #else /* CONFIG_SYS_NO_FLASH */ |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 337 | bd->bi_flashsize = 0; |
| 338 | bd->bi_flashstart = 0; |
| 339 | bd->bi_flashoffset = 0; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 340 | #endif /* !CONFIG_SYS_NO_FLASH */ |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 341 | |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 342 | #ifdef CONFIG_SPI |
Jean-Christophe PLAGNIOL-VILLARD | bb1f8b4 | 2008-09-05 09:19:30 +0200 | [diff] [blame] | 343 | # if !defined(CONFIG_ENV_IS_IN_EEPROM) |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 344 | spi_init_f(); |
| 345 | # endif |
| 346 | spi_init_r(); |
| 347 | #endif |
| 348 | |
| 349 | /* relocate environment function pointers etc. */ |
| 350 | env_relocate(); |
| 351 | |
| 352 | #if defined(CONFIG_BOARD_LATE_INIT) |
| 353 | board_late_init(); |
| 354 | #endif |
| 355 | |
Jean-Christophe PLAGNIOL-VILLARD | 32628c5 | 2008-08-30 23:54:58 +0200 | [diff] [blame] | 356 | #ifdef CONFIG_ID_EEPROM |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 357 | mac_read_from_eeprom(); |
| 358 | #endif |
| 359 | |
| 360 | /* IP Address */ |
| 361 | bd->bi_ip_addr = getenv_IPaddr("ipaddr"); |
| 362 | #if defined(CONFIG_PCI) |
| 363 | /* |
| 364 | * Do pci configuration |
| 365 | */ |
| 366 | pci_init(); |
| 367 | #endif |
| 368 | |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 369 | /* Initialize stdio devices */ |
| 370 | stdio_init(); |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 371 | |
| 372 | /* Initialize the jump table for applications */ |
| 373 | jumptable_init(); |
| 374 | |
| 375 | /* Initialize the console (after the relocation and devices init) */ |
| 376 | console_init_r(); |
| 377 | |
| 378 | #ifdef CONFIG_SERIAL_SOFTWARE_FIFO |
| 379 | serial_buffered_init(); |
| 380 | #endif |
| 381 | |
| 382 | #ifdef CONFIG_STATUS_LED |
| 383 | status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING); |
| 384 | #endif |
| 385 | |
| 386 | udelay(20); |
| 387 | |
| 388 | set_timer(0); |
| 389 | |
| 390 | /* Initialize from environment */ |
| 391 | if ((s = getenv("loadaddr")) != NULL) { |
| 392 | load_addr = simple_strtoul(s, NULL, 16); |
| 393 | } |
| 394 | #if defined(CONFIG_CMD_NET) |
| 395 | if ((s = getenv("bootfile")) != NULL) { |
| 396 | copy_filename(BootFile, s, sizeof(BootFile)); |
| 397 | } |
Stefan Roese | f2302d4 | 2008-08-06 14:05:38 +0200 | [diff] [blame] | 398 | #endif /* CONFIG_CMD_NET */ |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 399 | |
| 400 | WATCHDOG_RESET(); |
| 401 | |
| 402 | #if defined(CONFIG_CMD_DOC) |
| 403 | WATCHDOG_RESET(); |
| 404 | puts("DOC: "); |
| 405 | doc_init(); |
| 406 | #endif |
| 407 | |
| 408 | #if defined(CONFIG_CMD_NET) |
| 409 | #if defined(CONFIG_NET_MULTI) |
| 410 | WATCHDOG_RESET(); |
| 411 | puts("Net: "); |
| 412 | #endif |
| 413 | eth_initialize(bd); |
| 414 | #endif |
| 415 | |
| 416 | #if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R) |
| 417 | WATCHDOG_RESET(); |
| 418 | debug("Reset Ethernet PHY\n"); |
| 419 | reset_phy(); |
| 420 | #endif |
| 421 | |
| 422 | #ifdef CONFIG_POST |
| 423 | post_run(NULL, POST_RAM | post_bootmode_get(0)); |
| 424 | #endif |
| 425 | |
| 426 | #if defined(CONFIG_CMD_IDE) |
| 427 | WATCHDOG_RESET(); |
| 428 | puts("IDE: "); |
| 429 | ide_init(); |
Stefan Roese | f2302d4 | 2008-08-06 14:05:38 +0200 | [diff] [blame] | 430 | #endif /* CONFIG_CMD_IDE */ |
Daniel Hellstrom | c2f02da | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 431 | |
| 432 | #ifdef CONFIG_LAST_STAGE_INIT |
| 433 | WATCHDOG_RESET(); |
| 434 | /* |
| 435 | * Some parts can be only initialized if all others (like |
| 436 | * Interrupts) are up and running (i.e. the PC-style ISA |
| 437 | * keyboard). |
| 438 | */ |
| 439 | last_stage_init(); |
| 440 | #endif |
| 441 | |
| 442 | #ifdef CONFIG_PS2KBD |
| 443 | puts("PS/2: "); |
| 444 | kbd_init(); |
| 445 | #endif |
| 446 | prom_init(); |
| 447 | |
| 448 | /* main_loop */ |
| 449 | for (;;) { |
| 450 | WATCHDOG_RESET(); |
| 451 | main_loop(); |
| 452 | } |
| 453 | |
| 454 | } |
| 455 | |
| 456 | void hang(void) |
| 457 | { |
| 458 | puts("### ERROR ### Please RESET the board ###\n"); |
| 459 | #ifdef CONFIG_SHOW_BOOT_PROGRESS |
| 460 | show_boot_progress(-30); |
| 461 | #endif |
| 462 | for (;;) ; |
| 463 | } |
| 464 | |
| 465 | /************************************************************************/ |