blob: aa126d71bc50a5f90695d25957a3f5b5cd2bc530 [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>
Ezequiel Garcia7ab2d3f2013-12-20 18:34:53 -030011#if defined(CONFIG_CFI_FLASH_MTD)
Thomas Chou035acb92011-01-18 11:13:56 +080012#include <mtd/cfi_flash.h>
Ezequiel Garcia7ab2d3f2013-12-20 18:34:53 -030013#endif
Thomas Chou035acb92011-01-18 11:13:56 +080014#include <asm/io.h>
Joachim Foersterc932eed2011-10-21 15:48:50 +020015#include <asm/gpio.h>
Thomas Chou7ffbbf52010-04-21 08:40:59 +080016
17void text_base_hook(void); /* nop hook for text_base.S */
18
Thomas Chou035acb92011-01-18 11:13:56 +080019#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR)
20static void __early_flash_cmd_reset(void)
21{
22 /* reset flash before we read env */
23 writeb(AMD_CMD_RESET, CONFIG_ENV_ADDR);
24 writeb(FLASH_CMD_RESET, CONFIG_ENV_ADDR);
25}
26void early_flash_cmd_reset(void)
27 __attribute__((weak,alias("__early_flash_cmd_reset")));
28#endif
29
Thomas Chou7ffbbf52010-04-21 08:40:59 +080030int board_early_init_f(void)
31{
32 text_base_hook();
Joachim Foersterc932eed2011-10-21 15:48:50 +020033#ifdef CONFIG_ALTERA_PIO
34#ifdef LED_PIO_BASE
35 altera_pio_init(LED_PIO_BASE, LED_PIO_WIDTH, 'o',
36 LED_PIO_RSTVAL, (1 << LED_PIO_WIDTH) - 1,
37 "led");
38#endif
39#endif
Thomas Chou035acb92011-01-18 11:13:56 +080040#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR)
41 early_flash_cmd_reset();
42#endif
Thomas Chou7ffbbf52010-04-21 08:40:59 +080043 return 0;
44}
45
46int checkboard(void)
47{
48 printf("BOARD : %s\n", CONFIG_BOARD_NAME);
49 return 0;
50}
51
52phys_size_t initdram(int board_type)
53{
54 return 0;
55}
56
57#ifdef CONFIG_CMD_NET
58int board_eth_init(bd_t *bis)
59{
60 int rc = 0;
61#ifdef CONFIG_SMC91111
62 rc += smc91111_initialize(0, CONFIG_SMC91111_BASE);
63#endif
64#ifdef CONFIG_DRIVER_DM9000
65 rc += dm9000_initialize(bis);
66#endif
67#ifdef CONFIG_ALTERA_TSE
68 rc += altera_tse_initialize(0,
69 CONFIG_SYS_ALTERA_TSE_MAC_BASE,
70 CONFIG_SYS_ALTERA_TSE_SGDMA_RX_BASE,
Joachim Foerstercb0ddaf2011-10-17 05:24:44 +000071 CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE,
72#if defined(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE) && \
73 (CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE > 0)
74 CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE,
75 CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE);
76#else
77 0,
78 0);
79#endif
Thomas Chou7ffbbf52010-04-21 08:40:59 +080080#endif
81#ifdef CONFIG_ETHOC
82 rc += ethoc_initialize(0, CONFIG_SYS_ETHOC_BASE);
83#endif
84 return rc;
85}
86#endif