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 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Thomas Chou | 8cbb0dd | 2010-04-21 08:40:59 +0800 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <common.h> |
| 10 | #include <netdev.h> |
Ezequiel Garcia | a113fb3 | 2013-12-20 18:34:53 -0300 | [diff] [blame] | 11 | #if defined(CONFIG_CFI_FLASH_MTD) |
Thomas Chou | 030103d | 2011-01-18 11:13:56 +0800 | [diff] [blame] | 12 | #include <mtd/cfi_flash.h> |
Ezequiel Garcia | a113fb3 | 2013-12-20 18:34:53 -0300 | [diff] [blame] | 13 | #endif |
Thomas Chou | 030103d | 2011-01-18 11:13:56 +0800 | [diff] [blame] | 14 | #include <asm/io.h> |
Joachim Foerster | 03d67e1 | 2011-10-21 15:48:50 +0200 | [diff] [blame] | 15 | #include <asm/gpio.h> |
Thomas Chou | 8cbb0dd | 2010-04-21 08:40:59 +0800 | [diff] [blame] | 16 | |
Ezequiel Garcia | 07e2822 | 2014-01-28 07:19:06 -0300 | [diff] [blame] | 17 | #if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) && \ |
| 18 | defined(CONFIG_CFI_FLASH_MTD) |
Thomas Chou | 030103d | 2011-01-18 11:13:56 +0800 | [diff] [blame] | 19 | static void __early_flash_cmd_reset(void) |
| 20 | { |
| 21 | /* reset flash before we read env */ |
| 22 | writeb(AMD_CMD_RESET, CONFIG_ENV_ADDR); |
| 23 | writeb(FLASH_CMD_RESET, CONFIG_ENV_ADDR); |
| 24 | } |
| 25 | void early_flash_cmd_reset(void) |
| 26 | __attribute__((weak,alias("__early_flash_cmd_reset"))); |
| 27 | #endif |
| 28 | |
Thomas Chou | 8cbb0dd | 2010-04-21 08:40:59 +0800 | [diff] [blame] | 29 | int board_early_init_f(void) |
| 30 | { |
Joachim Foerster | 03d67e1 | 2011-10-21 15:48:50 +0200 | [diff] [blame] | 31 | #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 |
Ezequiel Garcia | 07e2822 | 2014-01-28 07:19:06 -0300 | [diff] [blame] | 38 | #if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) && \ |
| 39 | defined(CONFIG_CFI_FLASH_MTD) |
Thomas Chou | 030103d | 2011-01-18 11:13:56 +0800 | [diff] [blame] | 40 | early_flash_cmd_reset(); |
| 41 | #endif |
Thomas Chou | 8cbb0dd | 2010-04-21 08:40:59 +0800 | [diff] [blame] | 42 | return 0; |
| 43 | } |
| 44 | |
| 45 | int checkboard(void) |
| 46 | { |
| 47 | printf("BOARD : %s\n", CONFIG_BOARD_NAME); |
| 48 | return 0; |
| 49 | } |
| 50 | |
| 51 | phys_size_t initdram(int board_type) |
| 52 | { |
| 53 | return 0; |
| 54 | } |
| 55 | |
| 56 | #ifdef CONFIG_CMD_NET |
| 57 | int board_eth_init(bd_t *bis) |
| 58 | { |
| 59 | int rc = 0; |
| 60 | #ifdef CONFIG_SMC91111 |
| 61 | rc += smc91111_initialize(0, CONFIG_SMC91111_BASE); |
| 62 | #endif |
| 63 | #ifdef CONFIG_DRIVER_DM9000 |
| 64 | rc += dm9000_initialize(bis); |
| 65 | #endif |
| 66 | #ifdef CONFIG_ALTERA_TSE |
| 67 | rc += altera_tse_initialize(0, |
| 68 | CONFIG_SYS_ALTERA_TSE_MAC_BASE, |
| 69 | CONFIG_SYS_ALTERA_TSE_SGDMA_RX_BASE, |
Joachim Foerster | b962ac7 | 2011-10-17 05:24:44 +0000 | [diff] [blame] | 70 | CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE, |
| 71 | #if defined(CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE) && \ |
| 72 | (CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE > 0) |
| 73 | CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_BASE, |
| 74 | CONFIG_SYS_ALTERA_TSE_SGDMA_DESC_SIZE); |
| 75 | #else |
| 76 | 0, |
| 77 | 0); |
| 78 | #endif |
Thomas Chou | 8cbb0dd | 2010-04-21 08:40:59 +0800 | [diff] [blame] | 79 | #endif |
| 80 | #ifdef CONFIG_ETHOC |
| 81 | rc += ethoc_initialize(0, CONFIG_SYS_ETHOC_BASE); |
| 82 | #endif |
| 83 | return rc; |
| 84 | } |
| 85 | #endif |