Daniel Hellstrom | 9d7c6b2 | 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 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 9 | * SPDX-License-Identifier: GPL-2.0+ |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <common.h> |
| 13 | #include <command.h> |
| 14 | #include <malloc.h> |
Jean-Christophe PLAGNIOL-VILLARD | 2a7a031 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 15 | #include <stdio_dev.h> |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 16 | #include <config.h> |
| 17 | #if defined(CONFIG_CMD_IDE) |
| 18 | #include <ide.h> |
| 19 | #endif |
| 20 | #ifdef CONFIG_STATUS_LED |
| 21 | #include <status_led.h> |
| 22 | #endif |
| 23 | #include <net.h> |
| 24 | #include <serial.h> |
| 25 | #include <version.h> |
| 26 | #if defined(CONFIG_POST) |
| 27 | #include <post.h> |
| 28 | #endif |
| 29 | #ifdef CONFIG_PS2KBD |
| 30 | #include <keyboard.h> |
| 31 | #endif |
| 32 | #ifdef CONFIG_CMD_AMBAPP |
| 33 | #include <ambapp.h> |
| 34 | #endif |
| 35 | |
Luigi 'Comio' Mantellini | 01db155 | 2009-10-10 12:42:21 +0200 | [diff] [blame] | 36 | #ifdef CONFIG_BITBANGMII |
| 37 | #include <miiphy.h> |
| 38 | #endif |
| 39 | |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 40 | DECLARE_GLOBAL_DATA_PTR; |
| 41 | |
| 42 | /* Debug options |
| 43 | #define DEBUG_INIT_SEQUENCE |
| 44 | #define DEBUG_MEM_LAYOUT |
| 45 | #define DEBUG_COMMANDS |
| 46 | */ |
| 47 | |
| 48 | extern void timer_interrupt_init(void); |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 49 | extern int do_ambapp_print(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]); |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 50 | extern int prom_init(void); |
| 51 | |
| 52 | #if defined(CONFIG__CMD_DOC) |
| 53 | void doc_init(void); |
| 54 | #endif |
| 55 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 56 | #if !defined(CONFIG_SYS_NO_FLASH) |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 57 | static char *failed = "*** failed ***\n"; |
| 58 | #endif |
| 59 | |
| 60 | #include <environment.h> |
| 61 | |
| 62 | ulong monitor_flash_len; |
| 63 | |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 64 | /************************************************************************ |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 65 | * Init Utilities * |
| 66 | ************************************************************************ |
| 67 | * Some of this code should be moved into the core functions, |
| 68 | * but let's get it working (again) first... |
| 69 | */ |
| 70 | |
| 71 | static int init_baudrate(void) |
| 72 | { |
Simon Glass | c131e52 | 2011-10-13 14:43:13 +0000 | [diff] [blame] | 73 | gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE); |
| 74 | return 0; |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | /***********************************************************************/ |
| 78 | |
| 79 | /* |
| 80 | * All attempts to come up with a "common" initialization sequence |
| 81 | * that works for all boards and architectures failed: some of the |
| 82 | * requirements are just _too_ different. To get rid of the resulting |
| 83 | * mess of board dependend #ifdef'ed code we now make the whole |
| 84 | * initialization sequence configurable to the user. |
| 85 | * |
| 86 | * The requirements for any new initalization function is simple: it |
| 87 | * receives a pointer to the "global data" structure as it's only |
| 88 | * argument, and returns an integer return code, where 0 means |
| 89 | * "continue" and != 0 means "fatal error, hang the system". |
| 90 | */ |
| 91 | typedef int (init_fnc_t) (void); |
| 92 | |
| 93 | #define WATCHDOG_RESET(x) |
| 94 | |
| 95 | /************************************************************************ |
| 96 | * Initialization sequence * |
| 97 | ************************************************************************ |
| 98 | */ |
| 99 | |
| 100 | init_fnc_t *init_sequence[] = { |
| 101 | |
| 102 | #if defined(CONFIG_BOARD_EARLY_INIT_F) |
| 103 | board_early_init_f, |
| 104 | #endif |
| 105 | serial_init, |
| 106 | |
| 107 | init_timebase, |
| 108 | |
| 109 | #if defined(CONFIG_CMD_AMBAPP) |
| 110 | ambapp_init_reloc, |
| 111 | #endif |
| 112 | |
| 113 | env_init, |
| 114 | |
| 115 | init_baudrate, |
| 116 | |
| 117 | console_init_f, |
| 118 | display_options, |
| 119 | |
| 120 | checkcpu, |
| 121 | checkboard, |
| 122 | #if defined(CONFIG_MISC_INIT_F) |
| 123 | misc_init_f, |
| 124 | #endif |
| 125 | |
| 126 | #ifdef CONFIG_POST |
| 127 | post_init_f, |
| 128 | #endif |
| 129 | |
| 130 | NULL, /* Terminate this list, |
| 131 | * beware: this list will be relocated |
| 132 | * which means that NULL will become |
| 133 | * NULL+RELOC_OFFSET. We simply make |
| 134 | * NULL be -RELOC_OFFSET instead. |
| 135 | */ |
| 136 | }; |
| 137 | |
| 138 | /************************************************************************ |
| 139 | * |
| 140 | * This is the SPARC board initialization routine, running from RAM. |
| 141 | * |
| 142 | ************************************************************************ |
| 143 | */ |
| 144 | #ifdef DEBUG_INIT_SEQUENCE |
| 145 | char *str_init_seq = "INIT_SEQ 00\n"; |
| 146 | char *str_init_seq_done = "\n\rInit sequence done...\r\n\r\n"; |
| 147 | #endif |
| 148 | |
| 149 | void board_init_f(ulong bootflag) |
| 150 | { |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 151 | bd_t *bd; |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 152 | init_fnc_t **init_fnc_ptr; |
| 153 | int j; |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 154 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 155 | #ifndef CONFIG_SYS_NO_FLASH |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 156 | ulong flash_size; |
| 157 | #endif |
| 158 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 159 | gd = (gd_t *) (CONFIG_SYS_GBL_DATA_OFFSET); |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 160 | |
| 161 | /* Clear initial global data */ |
| 162 | memset((void *)gd, 0, sizeof(gd_t)); |
| 163 | |
| 164 | gd->bd = (bd_t *) (gd + 1); /* At end of global data */ |
| 165 | gd->baudrate = CONFIG_BAUDRATE; |
| 166 | gd->cpu_clk = CONFIG_SYS_CLK_FREQ; |
| 167 | |
| 168 | bd = gd->bd; |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 169 | bd->bi_memstart = CONFIG_SYS_RAM_BASE; |
| 170 | bd->bi_memsize = CONFIG_SYS_RAM_SIZE; |
| 171 | bd->bi_flashstart = CONFIG_SYS_FLASH_BASE; |
| 172 | #if defined(CONFIG_SYS_SRAM_BASE) && defined(CONFIG_SYS_SRAM_SIZE) |
| 173 | bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; |
| 174 | bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 175 | #endif |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 176 | bd->bi_bootflags = bootflag; /* boot / reboot flag (for LynxOS) */ |
| 177 | |
| 178 | gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 179 | gd->reloc_off = CONFIG_SYS_RELOC_MONITOR_BASE - CONFIG_SYS_MONITOR_BASE; |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 180 | |
| 181 | for (init_fnc_ptr = init_sequence, j = 0; *init_fnc_ptr; |
| 182 | ++init_fnc_ptr, j++) { |
| 183 | #ifdef DEBUG_INIT_SEQUENCE |
| 184 | if (j > 9) |
| 185 | str_init_seq[9] = '0' + (j / 10); |
| 186 | str_init_seq[10] = '0' + (j - (j / 10) * 10); |
| 187 | serial_puts(str_init_seq); |
| 188 | #endif |
| 189 | if ((*init_fnc_ptr + gd->reloc_off) () != 0) { |
| 190 | hang(); |
| 191 | } |
| 192 | } |
| 193 | #ifdef DEBUG_INIT_SEQUENCE |
| 194 | serial_puts(str_init_seq_done); |
| 195 | #endif |
| 196 | |
| 197 | /* |
| 198 | * Now that we have DRAM mapped and working, we can |
| 199 | * relocate the code and continue running from DRAM. |
| 200 | * |
| 201 | * Reserve memory at end of RAM for (top down in that order): |
| 202 | * - kernel log buffer |
| 203 | * - protected RAM |
| 204 | * - LCD framebuffer |
| 205 | * - monitor code |
| 206 | * - board info struct |
| 207 | */ |
| 208 | #ifdef DEBUG_MEM_LAYOUT |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 209 | printf("CONFIG_SYS_MONITOR_BASE: 0x%lx\n", CONFIG_SYS_MONITOR_BASE); |
Jean-Christophe PLAGNIOL-VILLARD | 7e1cda6 | 2008-09-10 22:48:06 +0200 | [diff] [blame] | 210 | printf("CONFIG_ENV_ADDR: 0x%lx\n", CONFIG_ENV_ADDR); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 211 | printf("CONFIG_SYS_RELOC_MONITOR_BASE: 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE, |
| 212 | CONFIG_SYS_MONITOR_LEN); |
| 213 | printf("CONFIG_SYS_MALLOC_BASE: 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE, |
| 214 | CONFIG_SYS_MALLOC_LEN); |
| 215 | printf("CONFIG_SYS_INIT_SP_OFFSET: 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET, |
| 216 | CONFIG_SYS_STACK_SIZE); |
| 217 | printf("CONFIG_SYS_PROM_OFFSET: 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET, |
| 218 | CONFIG_SYS_PROM_SIZE); |
| 219 | printf("CONFIG_SYS_GBL_DATA_OFFSET: 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET, |
Wolfgang Denk | 0191e47 | 2010-10-26 14:34:52 +0200 | [diff] [blame] | 220 | GENERATED_GBL_DATA_SIZE); |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 221 | #endif |
| 222 | |
| 223 | #ifdef CONFIG_POST |
| 224 | post_bootmode_init(); |
| 225 | post_run(NULL, POST_ROM | post_bootmode_get(0)); |
| 226 | #endif |
| 227 | |
Wolfgang Denk | d0813e5 | 2010-10-28 20:00:11 +0200 | [diff] [blame] | 228 | #if defined(CONFIG_NEEDS_MANUAL_RELOC) |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 229 | /* |
| 230 | * We have to relocate the command table manually |
| 231 | */ |
Marek Vasut | 69c5e34 | 2012-10-12 10:27:04 +0000 | [diff] [blame] | 232 | fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd), |
| 233 | ll_entry_count(cmd_tbl_t, cmd)); |
Wolfgang Denk | d0813e5 | 2010-10-28 20:00:11 +0200 | [diff] [blame] | 234 | #endif /* defined(CONFIG_NEEDS_MANUAL_RELOC) */ |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 235 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 236 | #if defined(CONFIG_CMD_AMBAPP) && defined(CONFIG_SYS_AMBAPP_PRINT_ON_STARTUP) |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 237 | puts("AMBA:\n"); |
| 238 | do_ambapp_print(NULL, 0, 0, NULL); |
| 239 | #endif |
| 240 | |
| 241 | /* initialize higher level parts of CPU like time base and timers */ |
| 242 | cpu_init_r(); |
| 243 | |
| 244 | /* start timer */ |
| 245 | timer_interrupt_init(); |
| 246 | |
| 247 | /* |
| 248 | * Enable Interrupts before any calls to udelay, |
| 249 | * the flash driver may use udelay resulting in |
| 250 | * a hang if not timer0 IRQ is enabled. |
| 251 | */ |
| 252 | interrupt_init(); |
| 253 | |
Peter Tyser | 781c9b8 | 2009-08-21 23:05:21 -0500 | [diff] [blame] | 254 | /* The Malloc area is immediately below the monitor copy in RAM */ |
Peter Tyser | ed52770 | 2009-08-21 23:05:20 -0500 | [diff] [blame] | 255 | mem_malloc_init(CONFIG_SYS_MALLOC_BASE, |
| 256 | CONFIG_SYS_MALLOC_END - CONFIG_SYS_MALLOC_BASE); |
Stefan Roese | b81464e | 2009-05-11 15:50:12 +0200 | [diff] [blame] | 257 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 258 | #if !defined(CONFIG_SYS_NO_FLASH) |
Peter Tyser | 0b5a263 | 2010-12-28 18:12:05 -0600 | [diff] [blame] | 259 | puts("Flash: "); |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 260 | |
| 261 | if ((flash_size = flash_init()) > 0) { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 262 | # ifdef CONFIG_SYS_FLASH_CHECKSUM |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 263 | print_size(flash_size, ""); |
| 264 | /* |
| 265 | * Compute and print flash CRC if flashchecksum is set to 'y' |
| 266 | * |
| 267 | * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX |
| 268 | */ |
Joe Hershberger | 864ec56 | 2012-12-11 22:16:22 -0600 | [diff] [blame] | 269 | if (getenv_yesno("flashchecksum") == 1) { |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 270 | printf(" CRC: %08lX", |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 271 | crc32(0, (const unsigned char *)CONFIG_SYS_FLASH_BASE, |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 272 | flash_size) |
| 273 | ); |
| 274 | } |
| 275 | putc('\n'); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 276 | # else /* !CONFIG_SYS_FLASH_CHECKSUM */ |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 277 | print_size(flash_size, "\n"); |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 278 | # endif /* CONFIG_SYS_FLASH_CHECKSUM */ |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 279 | } else { |
| 280 | puts(failed); |
| 281 | hang(); |
| 282 | } |
| 283 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 284 | bd->bi_flashstart = CONFIG_SYS_FLASH_BASE; /* update start of FLASH memory */ |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 285 | bd->bi_flashsize = flash_size; /* size of FLASH memory (final value) */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 286 | #if CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 287 | bd->bi_flashoffset = monitor_flash_len; /* reserved area for startup monitor */ |
| 288 | #else |
| 289 | bd->bi_flashoffset = 0; |
| 290 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 291 | #else /* CONFIG_SYS_NO_FLASH */ |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 292 | bd->bi_flashsize = 0; |
| 293 | bd->bi_flashstart = 0; |
| 294 | bd->bi_flashoffset = 0; |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 295 | #endif /* !CONFIG_SYS_NO_FLASH */ |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 296 | |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 297 | #ifdef CONFIG_SPI |
Jean-Christophe PLAGNIOL-VILLARD | e46af64 | 2008-09-05 09:19:30 +0200 | [diff] [blame] | 298 | # if !defined(CONFIG_ENV_IS_IN_EEPROM) |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 299 | spi_init_f(); |
| 300 | # endif |
| 301 | spi_init_r(); |
| 302 | #endif |
| 303 | |
| 304 | /* relocate environment function pointers etc. */ |
| 305 | env_relocate(); |
| 306 | |
| 307 | #if defined(CONFIG_BOARD_LATE_INIT) |
| 308 | board_late_init(); |
| 309 | #endif |
| 310 | |
Jean-Christophe PLAGNIOL-VILLARD | 8349c72 | 2008-08-30 23:54:58 +0200 | [diff] [blame] | 311 | #ifdef CONFIG_ID_EEPROM |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 312 | mac_read_from_eeprom(); |
| 313 | #endif |
| 314 | |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 315 | #if defined(CONFIG_PCI) |
| 316 | /* |
| 317 | * Do pci configuration |
| 318 | */ |
| 319 | pci_init(); |
| 320 | #endif |
| 321 | |
Jean-Christophe PLAGNIOL-VILLARD | 2a7a031 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 322 | /* Initialize stdio devices */ |
| 323 | stdio_init(); |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 324 | |
| 325 | /* Initialize the jump table for applications */ |
| 326 | jumptable_init(); |
| 327 | |
| 328 | /* Initialize the console (after the relocation and devices init) */ |
| 329 | console_init_r(); |
| 330 | |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 331 | #ifdef CONFIG_STATUS_LED |
| 332 | status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING); |
| 333 | #endif |
| 334 | |
| 335 | udelay(20); |
| 336 | |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 337 | /* Initialize from environment */ |
Simon Glass | c131e52 | 2011-10-13 14:43:13 +0000 | [diff] [blame] | 338 | load_addr = getenv_ulong("loadaddr", 16, load_addr); |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 339 | |
| 340 | WATCHDOG_RESET(); |
| 341 | |
| 342 | #if defined(CONFIG_CMD_DOC) |
| 343 | WATCHDOG_RESET(); |
| 344 | puts("DOC: "); |
| 345 | doc_init(); |
| 346 | #endif |
| 347 | |
Luigi 'Comio' Mantellini | 01db155 | 2009-10-10 12:42:21 +0200 | [diff] [blame] | 348 | #ifdef CONFIG_BITBANGMII |
| 349 | bb_miiphy_init(); |
| 350 | #endif |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 351 | #if defined(CONFIG_CMD_NET) |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 352 | WATCHDOG_RESET(); |
| 353 | puts("Net: "); |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 354 | eth_initialize(bd); |
| 355 | #endif |
| 356 | |
| 357 | #if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R) |
| 358 | WATCHDOG_RESET(); |
| 359 | debug("Reset Ethernet PHY\n"); |
| 360 | reset_phy(); |
| 361 | #endif |
| 362 | |
| 363 | #ifdef CONFIG_POST |
| 364 | post_run(NULL, POST_RAM | post_bootmode_get(0)); |
| 365 | #endif |
| 366 | |
| 367 | #if defined(CONFIG_CMD_IDE) |
| 368 | WATCHDOG_RESET(); |
| 369 | puts("IDE: "); |
| 370 | ide_init(); |
Stefan Roese | 3762825 | 2008-08-06 14:05:38 +0200 | [diff] [blame] | 371 | #endif /* CONFIG_CMD_IDE */ |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 372 | |
| 373 | #ifdef CONFIG_LAST_STAGE_INIT |
| 374 | WATCHDOG_RESET(); |
| 375 | /* |
| 376 | * Some parts can be only initialized if all others (like |
| 377 | * Interrupts) are up and running (i.e. the PC-style ISA |
| 378 | * keyboard). |
| 379 | */ |
| 380 | last_stage_init(); |
| 381 | #endif |
| 382 | |
| 383 | #ifdef CONFIG_PS2KBD |
| 384 | puts("PS/2: "); |
| 385 | kbd_init(); |
| 386 | #endif |
| 387 | prom_init(); |
| 388 | |
| 389 | /* main_loop */ |
| 390 | for (;;) { |
| 391 | WATCHDOG_RESET(); |
| 392 | main_loop(); |
| 393 | } |
| 394 | |
| 395 | } |
| 396 | |
Daniel Hellstrom | 9d7c6b2 | 2008-03-28 09:47:00 +0100 | [diff] [blame] | 397 | /************************************************************************/ |