wdenk | ed50b78 | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2005 |
| 3 | * Greg Ungerer, OpenGear Inc, <greg.ungerer@opengear.com> |
| 4 | * |
| 5 | * (C) Copyright 2002 |
| 6 | * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net |
| 7 | * |
| 8 | * (C) Copyright 2002 |
| 9 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 10 | * Marius Groeger <mgroeger@sysgo.de> |
| 11 | * |
| 12 | * See file CREDITS for list of people who contributed to this |
| 13 | * project. |
| 14 | * |
| 15 | * This program is free software; you can redistribute it and/or |
| 16 | * modify it under the terms of the GNU General Public License as |
| 17 | * published by the Free Software Foundation; either version 2 of |
| 18 | * the License, or (at your option) any later version. |
| 19 | * |
| 20 | * This program is distributed in the hope that it will be useful, |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | * GNU General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU General Public License |
| 26 | * along with this program; if not, write to the Free Software |
| 27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 28 | * MA 02111-1307 USA |
| 29 | */ |
| 30 | |
| 31 | #include <common.h> |
| 32 | #include <asm/arch/platform.h> |
Wolfgang Denk | de02ce9 | 2011-09-10 16:59:02 +0200 | [diff] [blame^] | 33 | #include <netdev.h> |
wdenk | ed50b78 | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 34 | |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 35 | DECLARE_GLOBAL_DATA_PTR; |
| 36 | |
wdenk | ed50b78 | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 37 | /* ------------------------------------------------------------------------- */ |
| 38 | |
| 39 | #define ks8695_read(a) *((volatile unsigned int *) (KS8695_IO_BASE+(a))) |
| 40 | #define ks8695_write(a,b) *((volatile unsigned int *) (KS8695_IO_BASE+(a))) = (b) |
| 41 | |
| 42 | /* ------------------------------------------------------------------------- */ |
| 43 | |
| 44 | |
| 45 | /* |
| 46 | * Miscelaneous platform dependent initialisations |
| 47 | */ |
| 48 | int env_flash_cmdline (void) |
| 49 | { |
Greg Ungerer | 44104fa | 2011-09-10 18:36:40 +1000 | [diff] [blame] | 50 | char *sp = (char *) 0x0201c020; |
| 51 | char *ep; |
wdenk | ed50b78 | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 52 | int len; |
| 53 | |
| 54 | /* Check if "erase" push button is depressed */ |
| 55 | if ((ks8695_read(KS8695_GPIO_DATA) & 0x8) == 0) { |
| 56 | printf("### Entering network recovery mode...\n"); |
| 57 | setenv("bootargs", "console=ttyAM0,115200 mem=16M initrd=0x400000,6M root=/dev/ram0"); |
| 58 | setenv("bootcmd", "bootp 0x400000; gofsk 0x400000"); |
| 59 | setenv("bootdelay", "2"); |
| 60 | return 0; |
| 61 | } |
| 62 | |
| 63 | /* Check for flash based kernel boot args to use as default */ |
| 64 | for (ep = sp, len = 0; ((len < 1024) && (*ep != 0)); ep++, len++) |
| 65 | ; |
| 66 | |
| 67 | if ((len > 0) && (len <1024)) |
| 68 | setenv("bootargs", sp); |
| 69 | |
| 70 | return 0; |
| 71 | } |
| 72 | |
| 73 | int board_late_init (void) |
| 74 | { |
| 75 | return 0; |
| 76 | } |
| 77 | |
Greg Ungerer | 32b0316 | 2011-09-10 18:40:34 +1000 | [diff] [blame] | 78 | int board_eth_init(bd_t *bis) |
| 79 | { |
| 80 | return ks8695_eth_initialize(); |
| 81 | } |
wdenk | ed50b78 | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 82 | |
| 83 | int board_init (void) |
| 84 | { |
wdenk | ed50b78 | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 85 | /* arch number of CM4008 */ |
| 86 | gd->bd->bi_arch_number = 624; |
| 87 | |
| 88 | /* adress of boot parameters */ |
| 89 | gd->bd->bi_boot_params = 0x00000100; |
| 90 | |
| 91 | /* power down all but port 0 on the switch */ |
| 92 | ks8695_write(KS8695_SWITCH_LPPM12, 0x00000005); |
| 93 | ks8695_write(KS8695_SWITCH_LPPM34, 0x00050005); |
wdenk | 62cb5cf | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 94 | |
wdenk | ed50b78 | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 95 | return 0; |
| 96 | } |
| 97 | |
| 98 | int dram_init (void) |
| 99 | { |
wdenk | ed50b78 | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 100 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 101 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
| 102 | |
| 103 | return (0); |
| 104 | } |