wdenk | 16b013e | 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 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 12 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 16b013e | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 13 | */ |
| 14 | |
| 15 | #include <common.h> |
| 16 | #include <asm/arch/platform.h> |
Wolfgang Denk | bd6ce9d | 2011-09-10 16:59:02 +0200 | [diff] [blame] | 17 | #include <netdev.h> |
wdenk | 16b013e | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 18 | |
Wolfgang Denk | d87080b | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 19 | DECLARE_GLOBAL_DATA_PTR; |
| 20 | |
wdenk | 16b013e | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 21 | /* ------------------------------------------------------------------------- */ |
| 22 | |
| 23 | #define ks8695_read(a) *((volatile unsigned int *) (KS8695_IO_BASE+(a))) |
| 24 | #define ks8695_write(a,b) *((volatile unsigned int *) (KS8695_IO_BASE+(a))) = (b) |
| 25 | |
| 26 | /* ------------------------------------------------------------------------- */ |
| 27 | |
| 28 | |
| 29 | /* |
| 30 | * Miscelaneous platform dependent initialisations |
| 31 | */ |
| 32 | int env_flash_cmdline (void) |
| 33 | { |
Greg Ungerer | a00e749 | 2011-09-10 18:37:21 +1000 | [diff] [blame] | 34 | char *sp = (char *) 0x0201c020; |
| 35 | char *ep; |
wdenk | 16b013e | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 36 | int len; |
| 37 | |
| 38 | /* Check if "erase" push button is depressed */ |
| 39 | if ((ks8695_read(KS8695_GPIO_DATA) & 0x8) == 0) { |
| 40 | printf("### Entering network recovery mode...\n"); |
| 41 | setenv("bootargs", "console=ttyAM0,115200 mem=32M initrd=0x400000,8M root=/dev/ram0"); |
| 42 | setenv("bootcmd", "bootp 0x400000; gofsk 0x400000"); |
| 43 | setenv("bootdelay", "2"); |
| 44 | return 0; |
| 45 | } |
| 46 | |
| 47 | /* Check for flash based kernel boot args to use as default */ |
| 48 | for (ep = sp, len = 0; ((len < 1024) && (*ep != 0)); ep++, len++) |
| 49 | ; |
| 50 | |
| 51 | if ((len > 0) && (len <1024)) |
| 52 | setenv("bootargs", sp); |
| 53 | |
| 54 | return 0; |
| 55 | } |
| 56 | |
| 57 | int board_late_init (void) |
| 58 | { |
| 59 | return 0; |
| 60 | } |
| 61 | |
Greg Ungerer | 1e8ff71 | 2011-09-10 18:40:34 +1000 | [diff] [blame] | 62 | int board_eth_init(bd_t *bis) |
| 63 | { |
| 64 | return ks8695_eth_initialize(); |
| 65 | } |
wdenk | 16b013e | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 66 | |
| 67 | int board_init (void) |
| 68 | { |
wdenk | 16b013e | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 69 | /* arch number of CM41xx */ |
| 70 | gd->bd->bi_arch_number = 672; |
| 71 | |
| 72 | /* adress of boot parameters */ |
| 73 | gd->bd->bi_boot_params = 0x00000100; |
| 74 | |
| 75 | /* power down all but port 0 on the switch */ |
| 76 | ks8695_write(KS8695_SWITCH_LPPM12, 0x00000005); |
| 77 | ks8695_write(KS8695_SWITCH_LPPM34, 0x00050005); |
| 78 | |
| 79 | return 0; |
| 80 | } |
| 81 | |
| 82 | int dram_init (void) |
| 83 | { |
wdenk | 16b013e | 2005-05-19 22:46:33 +0000 | [diff] [blame] | 84 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 85 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
| 86 | |
| 87 | return (0); |
| 88 | } |