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