blob: 1b56dac56c6fd818ed8c05c302d28635e5be628e [file] [log] [blame]
Macpaul Linae717542011-09-23 16:48:16 +08001/*
2 * Copyright (C) 2011 Andes Technology Corporation
3 * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
4 * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
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 modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (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., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#include <common.h>
25#include <netdev.h>
26#include <asm/io.h>
27
Gabor Juhos2aa3eb82013-05-26 12:11:31 +020028#include <faraday/ftpci100.h>
Macpaul Linae717542011-09-23 16:48:16 +080029#include <faraday/ftsdc010.h>
30#ifdef CONFIG_FTSMC020
31#include <faraday/ftsmc020.h>
32#endif
33
34DECLARE_GLOBAL_DATA_PTR;
35
36/*
37 * Miscellaneous platform dependent initializations
38 */
39
40int board_init(void)
41{
42 /*
43 * refer to BOOT_PARAMETER_PA_BASE within
44 * "linux/arch/nds32/include/asm/misc_spec.h"
45 */
46 gd->bd->bi_arch_number = MACH_TYPE_ADPAG102;
47 gd->bd->bi_boot_params = PHYS_SDRAM_0 + 0x400;
48
49#if !defined(CONFIG_SYS_NO_FLASH)
50 ftsmc020_init(); /* initialize Flash */
51#endif /* CONFIG_SYS_NO_FLASH */
52 return 0;
53}
54
55int dram_init(void)
56{
57 unsigned long sdram_base = PHYS_SDRAM_0;
58 unsigned long expected_size = PHYS_SDRAM_0_SIZE;
59 unsigned long actual_size;
60
61 actual_size = get_ram_size((void *)sdram_base, expected_size);
62
63 gd->ram_size = actual_size;
64
65 if (expected_size != actual_size) {
66 printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
67 actual_size >> 20, expected_size >> 20);
68 }
69
70 return 0;
71}
72
73int board_eth_init(bd_t *bd)
74{
75 return ftgmac100_initialize(bd);
76}
77
78#if !defined(CONFIG_SYS_NO_FLASH)
79ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
80{
81 if (banknum == 0) { /* non-CFI boot flash */
82 info->portwidth = FLASH_CFI_8BIT;
83 info->chipwidth = FLASH_CFI_BY8;
84 info->interface = FLASH_CFI_X8;
85 return 1;
86 } else {
87 return 0;
88 }
89}
90#endif /* CONFIG_SYS_NO_FLASH */
91
92#if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI)
93void pci_init_board(void)
94{
95 /* should be pci_ftpci100_init() */
Macpaul Linae717542011-09-23 16:48:16 +080096 pci_ftpci_init();
97}
98#endif
99
100#ifdef CONFIG_GENERIC_MMC
101int board_mmc_init(bd_t *bis)
102{
103 ftsdc010_mmc_init(0);
104 return 0;
105}
106#endif