Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 1 | /* |
| 2 | * ppmc7xx.c |
| 3 | * --------- |
Wolfgang Denk | ba94093 | 2006-07-19 13:50:38 +0200 | [diff] [blame] | 4 | * |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 5 | * Main board-specific routines for Wind River PPMC 7xx/74xx board. |
Wolfgang Denk | ba94093 | 2006-07-19 13:50:38 +0200 | [diff] [blame] | 6 | * |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 7 | * By Richard Danter (richard.danter@windriver.com) |
| 8 | * Copyright (C) 2005 Wind River Systems |
| 9 | */ |
| 10 | |
| 11 | #include <common.h> |
| 12 | #include <command.h> |
Ben Warren | 052a5ea | 2008-08-31 20:37:00 -0700 | [diff] [blame] | 13 | #include <netdev.h> |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 14 | |
| 15 | |
| 16 | /* Define some MPC107 (memory controller) registers */ |
| 17 | #define MPC107_EUMB_GCR 0xfce41020 |
| 18 | #define MPC107_EUMB_IACKR 0xfce600a0 |
| 19 | |
| 20 | |
| 21 | /* Function prototypes */ |
Peter Tyser | f191901 | 2010-09-14 19:13:52 -0500 | [diff] [blame] | 22 | extern void _start(void); |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 23 | |
| 24 | |
| 25 | /* |
| 26 | * initdram() |
Wolfgang Denk | ba94093 | 2006-07-19 13:50:38 +0200 | [diff] [blame] | 27 | * |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 28 | * This function normally initialises the (S)DRAM of the system. For this board |
| 29 | * the SDRAM was already initialised by board_asm_init (see init.S) so we just |
| 30 | * return the size of RAM. |
| 31 | */ |
Becky Bruce | bd99ae7 | 2008-06-09 16:03:40 -0500 | [diff] [blame] | 32 | phys_size_t initdram( int board_type ) |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 33 | { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 34 | return CONFIG_SYS_SDRAM_SIZE; |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | |
| 38 | /* |
| 39 | * after_reloc() |
Wolfgang Denk | ba94093 | 2006-07-19 13:50:38 +0200 | [diff] [blame] | 40 | * |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 41 | * This is called after U-Boot has been copied from Flash/ROM to RAM. It gives |
| 42 | * us an opportunity to do some additional setup before the rest of the system |
| 43 | * is initialised. We don't need to do anything, so we just call board_init_r() |
| 44 | * which should never return. |
Wolfgang Denk | ba94093 | 2006-07-19 13:50:38 +0200 | [diff] [blame] | 45 | */ |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 46 | void after_reloc( ulong dest_addr, gd_t* gd ) |
| 47 | { |
| 48 | /* Jump to the main U-Boot board init code */ |
| 49 | board_init_r( gd, dest_addr ); |
| 50 | } |
| 51 | |
| 52 | |
| 53 | /* |
| 54 | * checkboard() |
Wolfgang Denk | ba94093 | 2006-07-19 13:50:38 +0200 | [diff] [blame] | 55 | * |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 56 | * We could do some board level checks here, such as working out what version |
| 57 | * it is, but for this board we simply display it's name (on the console). |
| 58 | */ |
| 59 | int checkboard( void ) |
| 60 | { |
| 61 | puts( "Board: Wind River PPMC 7xx/74xx\n" ); |
| 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | |
| 66 | /* |
| 67 | * misc_init_r |
Wolfgang Denk | ba94093 | 2006-07-19 13:50:38 +0200 | [diff] [blame] | 68 | * |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 69 | * Used for other setup which needs to be done late in the bring-up phase. |
| 70 | */ |
| 71 | int misc_init_r( void ) |
| 72 | { |
| 73 | /* Reset the EPIC and clear pending interrupts */ |
| 74 | out32r(MPC107_EUMB_GCR, 0xa0000000); |
| 75 | while( in32r( MPC107_EUMB_GCR ) & 0x80000000 ); |
| 76 | out32r( MPC107_EUMB_GCR, 0x20000000 ); |
| 77 | while( in32r( MPC107_EUMB_IACKR ) != 0xff ); |
| 78 | |
| 79 | /* Enable the I-Cache */ |
| 80 | icache_enable(); |
Wolfgang Denk | ba94093 | 2006-07-19 13:50:38 +0200 | [diff] [blame] | 81 | |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 82 | return 0; |
| 83 | } |
| 84 | |
| 85 | |
| 86 | /* |
| 87 | * do_reset() |
Wolfgang Denk | ba94093 | 2006-07-19 13:50:38 +0200 | [diff] [blame] | 88 | * |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 89 | * Shell command to reset the board. |
| 90 | */ |
Peter Tyser | 693d638 | 2010-12-03 10:28:47 -0600 | [diff] [blame] | 91 | int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 92 | { |
| 93 | printf( "Resetting...\n" ); |
Wolfgang Denk | ba94093 | 2006-07-19 13:50:38 +0200 | [diff] [blame] | 94 | |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 95 | /* Disabe and invalidate cache */ |
| 96 | icache_disable(); |
| 97 | dcache_disable(); |
| 98 | |
Peter Tyser | f191901 | 2010-09-14 19:13:52 -0500 | [diff] [blame] | 99 | /* Jump to cold reset point (in RAM) */ |
| 100 | _start(); |
Wolfgang Denk | ba94093 | 2006-07-19 13:50:38 +0200 | [diff] [blame] | 101 | |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 102 | /* Should never get here */ |
Peter Tyser | 693d638 | 2010-12-03 10:28:47 -0600 | [diff] [blame] | 103 | while(1) |
| 104 | ; |
| 105 | |
| 106 | return 1; |
Heiko Schocher | d7f77fb | 2006-06-19 11:02:41 +0200 | [diff] [blame] | 107 | } |
Ben Warren | 052a5ea | 2008-08-31 20:37:00 -0700 | [diff] [blame] | 108 | |
| 109 | int board_eth_init(bd_t *bis) |
| 110 | { |
| 111 | return pci_eth_init(bis); |
| 112 | } |