blob: 0f882756f5ef23b6d23b494e2361f9e5a8da0577 [file] [log] [blame]
Thomas Chou8cbb0dd2010-04-21 08:40:59 +08001/*
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 Chou030103d2011-01-18 11:13:56 +080027#include <mtd/cfi_flash.h>
28#include <asm/io.h>
Joachim Foerster03d67e12011-10-21 15:48:50 +020029#include <asm/gpio.h>
Thomas Chou8cbb0dd2010-04-21 08:40:59 +080030
31void text_base_hook(void); /* nop hook for text_base.S */
32
Thomas Chou030103d2011-01-18 11:13:56 +080033#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR)
34static void __early_flash_cmd_reset(void)
35{
36 /* reset flash before we read env */
37 writeb(AMD_CMD_RESET, CONFIG_ENV_ADDR);
38 writeb(FLASH_CMD_RESET, CONFIG_ENV_ADDR);
39}
40void early_flash_cmd_reset(void)
41 __attribute__((weak,alias("__early_flash_cmd_reset")));
42#endif
43
Thomas Chou8cbb0dd2010-04-21 08:40:59 +080044int board_early_init_f(void)
45{
46 text_base_hook();
Joachim Foerster03d67e12011-10-21 15:48:50 +020047#ifdef CONFIG_ALTERA_PIO
48#ifdef LED_PIO_BASE
49 altera_pio_init(LED_PIO_BASE, LED_PIO_WIDTH, 'o',
50 LED_PIO_RSTVAL, (1 << LED_PIO_WIDTH) - 1,
51 "led");
52#endif
53#endif
Thomas Chou030103d2011-01-18 11:13:56 +080054#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR)
55 early_flash_cmd_reset();
56#endif
Thomas Chou8cbb0dd2010-04-21 08:40:59 +080057 return 0;
58}
59
60int checkboard(void)
61{
62 printf("BOARD : %s\n", CONFIG_BOARD_NAME);
63 return 0;
64}
65
66phys_size_t initdram(int board_type)
67{
68 return 0;
69}
70
71#ifdef CONFIG_CMD_NET
72int board_eth_init(bd_t *bis)
73{
74 int rc = 0;
75#ifdef CONFIG_SMC91111
76 rc += smc91111_initialize(0, CONFIG_SMC91111_BASE);
77#endif
78#ifdef CONFIG_DRIVER_DM9000
79 rc += dm9000_initialize(bis);
80#endif
81#ifdef CONFIG_ALTERA_TSE
82 rc += altera_tse_initialize(0,
83 CONFIG_SYS_ALTERA_TSE_MAC_BASE,
84 CONFIG_SYS_ALTERA_TSE_SGDMA_RX_BASE,
Joachim Foersterb962ac72011-10-17 05:24:44 +000085 CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE,
86#if defined(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE) && \
87 (CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE > 0)
88 CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE,
89 CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE);
90#else
91 0,
92 0);
93#endif
Thomas Chou8cbb0dd2010-04-21 08:40:59 +080094#endif
95#ifdef CONFIG_ETHOC
96 rc += ethoc_initialize(0, CONFIG_SYS_ETHOC_BASE);
97#endif
98 return rc;
99}
100#endif