blob: 5ab9471246e7fdb48ef2c3f1d511ad071e636da3 [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 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Thomas Chou8cbb0dd2010-04-21 08:40:59 +08007 */
8
9#include <common.h>
10#include <netdev.h>
Ezequiel Garciaa113fb32013-12-20 18:34:53 -030011#if defined(CONFIG_CFI_FLASH_MTD)
Thomas Chou030103d2011-01-18 11:13:56 +080012#include <mtd/cfi_flash.h>
Ezequiel Garciaa113fb32013-12-20 18:34:53 -030013#endif
Thomas Chou030103d2011-01-18 11:13:56 +080014#include <asm/io.h>
Joachim Foerster03d67e12011-10-21 15:48:50 +020015#include <asm/gpio.h>
Thomas Chou8cbb0dd2010-04-21 08:40:59 +080016
17void text_base_hook(void); /* nop hook for text_base.S */
18
Ezequiel Garcia07e28222014-01-28 07:19:06 -030019#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) && \
20 defined(CONFIG_CFI_FLASH_MTD)
Thomas Chou030103d2011-01-18 11:13:56 +080021static void __early_flash_cmd_reset(void)
22{
23 /* reset flash before we read env */
24 writeb(AMD_CMD_RESET, CONFIG_ENV_ADDR);
25 writeb(FLASH_CMD_RESET, CONFIG_ENV_ADDR);
26}
27void early_flash_cmd_reset(void)
28 __attribute__((weak,alias("__early_flash_cmd_reset")));
29#endif
30
Thomas Chou8cbb0dd2010-04-21 08:40:59 +080031int board_early_init_f(void)
32{
33 text_base_hook();
Joachim Foerster03d67e12011-10-21 15:48:50 +020034#ifdef CONFIG_ALTERA_PIO
35#ifdef LED_PIO_BASE
36 altera_pio_init(LED_PIO_BASE, LED_PIO_WIDTH, 'o',
37 LED_PIO_RSTVAL, (1 << LED_PIO_WIDTH) - 1,
38 "led");
39#endif
40#endif
Ezequiel Garcia07e28222014-01-28 07:19:06 -030041#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) && \
42 defined(CONFIG_CFI_FLASH_MTD)
Thomas Chou030103d2011-01-18 11:13:56 +080043 early_flash_cmd_reset();
44#endif
Thomas Chou8cbb0dd2010-04-21 08:40:59 +080045 return 0;
46}
47
48int checkboard(void)
49{
50 printf("BOARD : %s\n", CONFIG_BOARD_NAME);
51 return 0;
52}
53
54phys_size_t initdram(int board_type)
55{
56 return 0;
57}
58
59#ifdef CONFIG_CMD_NET
60int board_eth_init(bd_t *bis)
61{
62 int rc = 0;
63#ifdef CONFIG_SMC91111
64 rc += smc91111_initialize(0, CONFIG_SMC91111_BASE);
65#endif
66#ifdef CONFIG_DRIVER_DM9000
67 rc += dm9000_initialize(bis);
68#endif
69#ifdef CONFIG_ALTERA_TSE
70 rc += altera_tse_initialize(0,
71 CONFIG_SYS_ALTERA_TSE_MAC_BASE,
72 CONFIG_SYS_ALTERA_TSE_SGDMA_RX_BASE,
Joachim Foersterb962ac72011-10-17 05:24:44 +000073 CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE,
74#if defined(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE) && \
75 (CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE > 0)
76 CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE,
77 CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE);
78#else
79 0,
80 0);
81#endif
Thomas Chou8cbb0dd2010-04-21 08:40:59 +080082#endif
83#ifdef CONFIG_ETHOC
84 rc += ethoc_initialize(0, CONFIG_SYS_ETHOC_BASE);
85#endif
86 return rc;
87}
88#endif