blob: 5c5b1b9148875158bc26273f0c840c1443c4d585 [file] [log] [blame]
Thomas Chou7ffbbf52010-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 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Thomas Chou7ffbbf52010-04-21 08:40:59 +08007 */
8
9#include <common.h>
10#include <netdev.h>
Thomas Chou035acb92011-01-18 11:13:56 +080011#include <mtd/cfi_flash.h>
12#include <asm/io.h>
Joachim Foersterc932eed2011-10-21 15:48:50 +020013#include <asm/gpio.h>
Thomas Chou7ffbbf52010-04-21 08:40:59 +080014
15void text_base_hook(void); /* nop hook for text_base.S */
16
Thomas Chou035acb92011-01-18 11:13:56 +080017#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR)
18static void __early_flash_cmd_reset(void)
19{
20 /* reset flash before we read env */
21 writeb(AMD_CMD_RESET, CONFIG_ENV_ADDR);
22 writeb(FLASH_CMD_RESET, CONFIG_ENV_ADDR);
23}
24void early_flash_cmd_reset(void)
25 __attribute__((weak,alias("__early_flash_cmd_reset")));
26#endif
27
Thomas Chou7ffbbf52010-04-21 08:40:59 +080028int board_early_init_f(void)
29{
30 text_base_hook();
Joachim Foersterc932eed2011-10-21 15:48:50 +020031#ifdef CONFIG_ALTERA_PIO
32#ifdef LED_PIO_BASE
33 altera_pio_init(LED_PIO_BASE, LED_PIO_WIDTH, 'o',
34 LED_PIO_RSTVAL, (1 << LED_PIO_WIDTH) - 1,
35 "led");
36#endif
37#endif
Thomas Chou035acb92011-01-18 11:13:56 +080038#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR)
39 early_flash_cmd_reset();
40#endif
Thomas Chou7ffbbf52010-04-21 08:40:59 +080041 return 0;
42}
43
44int checkboard(void)
45{
46 printf("BOARD : %s\n", CONFIG_BOARD_NAME);
47 return 0;
48}
49
50phys_size_t initdram(int board_type)
51{
52 return 0;
53}
54
55#ifdef CONFIG_CMD_NET
56int board_eth_init(bd_t *bis)
57{
58 int rc = 0;
59#ifdef CONFIG_SMC91111
60 rc += smc91111_initialize(0, CONFIG_SMC91111_BASE);
61#endif
62#ifdef CONFIG_DRIVER_DM9000
63 rc += dm9000_initialize(bis);
64#endif
65#ifdef CONFIG_ALTERA_TSE
66 rc += altera_tse_initialize(0,
67 CONFIG_SYS_ALTERA_TSE_MAC_BASE,
68 CONFIG_SYS_ALTERA_TSE_SGDMA_RX_BASE,
Joachim Foerstercb0ddaf2011-10-17 05:24:44 +000069 CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE,
70#if defined(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE) && \
71 (CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE > 0)
72 CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE,
73 CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE);
74#else
75 0,
76 0);
77#endif
Thomas Chou7ffbbf52010-04-21 08:40:59 +080078#endif
79#ifdef CONFIG_ETHOC
80 rc += ethoc_initialize(0, CONFIG_SYS_ETHOC_BASE);
81#endif
82 return rc;
83}
84#endif