Thomas Chou | 8cbb0dd | 2010-04-21 08:40:59 +0800 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2005, Psyent Corporation <www.psyent.com> |
| 3 | * Scott McNutt <smcnutt@psyent.com> |
| 4 | * (C) Copyright 2010, Thomas Chou <thomas@wytron.com.tw> |
| 5 | * |
| 6 | * See file CREDITS for list of people who contributed to this |
| 7 | * project. |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License as |
| 11 | * published by the Free Software Foundation; either version 2 of |
| 12 | * the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 22 | * MA 02111-1307 USA |
| 23 | */ |
| 24 | |
| 25 | #include <common.h> |
| 26 | #include <netdev.h> |
Thomas Chou | 030103d | 2011-01-18 11:13:56 +0800 | [diff] [blame] | 27 | #include <mtd/cfi_flash.h> |
| 28 | #include <asm/io.h> |
Thomas Chou | 8cbb0dd | 2010-04-21 08:40:59 +0800 | [diff] [blame] | 29 | |
| 30 | void text_base_hook(void); /* nop hook for text_base.S */ |
| 31 | |
Thomas Chou | 030103d | 2011-01-18 11:13:56 +0800 | [diff] [blame] | 32 | #if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) |
| 33 | static void __early_flash_cmd_reset(void) |
| 34 | { |
| 35 | /* reset flash before we read env */ |
| 36 | writeb(AMD_CMD_RESET, CONFIG_ENV_ADDR); |
| 37 | writeb(FLASH_CMD_RESET, CONFIG_ENV_ADDR); |
| 38 | } |
| 39 | void early_flash_cmd_reset(void) |
| 40 | __attribute__((weak,alias("__early_flash_cmd_reset"))); |
| 41 | #endif |
| 42 | |
Thomas Chou | 8cbb0dd | 2010-04-21 08:40:59 +0800 | [diff] [blame] | 43 | int board_early_init_f(void) |
| 44 | { |
| 45 | text_base_hook(); |
Thomas Chou | 030103d | 2011-01-18 11:13:56 +0800 | [diff] [blame] | 46 | #if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) |
| 47 | early_flash_cmd_reset(); |
| 48 | #endif |
Thomas Chou | 8cbb0dd | 2010-04-21 08:40:59 +0800 | [diff] [blame] | 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | int checkboard(void) |
| 53 | { |
| 54 | printf("BOARD : %s\n", CONFIG_BOARD_NAME); |
| 55 | return 0; |
| 56 | } |
| 57 | |
| 58 | phys_size_t initdram(int board_type) |
| 59 | { |
| 60 | return 0; |
| 61 | } |
| 62 | |
| 63 | #ifdef CONFIG_CMD_NET |
| 64 | int board_eth_init(bd_t *bis) |
| 65 | { |
| 66 | int rc = 0; |
| 67 | #ifdef CONFIG_SMC91111 |
| 68 | rc += smc91111_initialize(0, CONFIG_SMC91111_BASE); |
| 69 | #endif |
| 70 | #ifdef CONFIG_DRIVER_DM9000 |
| 71 | rc += dm9000_initialize(bis); |
| 72 | #endif |
| 73 | #ifdef CONFIG_ALTERA_TSE |
| 74 | rc += altera_tse_initialize(0, |
| 75 | CONFIG_SYS_ALTERA_TSE_MAC_BASE, |
| 76 | CONFIG_SYS_ALTERA_TSE_SGDMA_RX_BASE, |
Joachim Foerster | b962ac7 | 2011-10-17 05:24:44 +0000 | [diff] [blame] | 77 | CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE, |
| 78 | #if defined(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE) && \ |
| 79 | (CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE > 0) |
| 80 | CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE, |
| 81 | CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE); |
| 82 | #else |
| 83 | 0, |
| 84 | 0); |
| 85 | #endif |
Thomas Chou | 8cbb0dd | 2010-04-21 08:40:59 +0800 | [diff] [blame] | 86 | #endif |
| 87 | #ifdef CONFIG_ETHOC |
| 88 | rc += ethoc_initialize(0, CONFIG_SYS_ETHOC_BASE); |
| 89 | #endif |
| 90 | return rc; |
| 91 | } |
| 92 | #endif |