Commit fd8fed44cc57ce0423d6aa51c36637e6d360dcfb
Committed by
Macpaul Lin
1 parent
cf14123021
Exists in
master
and in
54 other branches
board/adp-ag102: add board specific files
Add board specific files. Signed-off-by: Macpaul Lin <macpaul@andestech.com>
Showing 2 changed files with 150 additions and 0 deletions Side-by-side Diff
board/AndesTech/adp-ag102/Makefile
1 | +# | |
2 | +# Copyright (C) 2011 Andes Technology Corporation | |
3 | +# Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com> | |
4 | +# | |
5 | +# See file CREDITS for list of people who contributed to this | |
6 | +# project. | |
7 | +# | |
8 | +# This program is free software; you can redistribute it and/or | |
9 | +# modify it under the terms of the GNU General Public License as | |
10 | +# published by the Free Software Foundation; either version 2 of | |
11 | +# the License, or (at your option) any later version. | |
12 | +# | |
13 | +# This program is distributed in the hope that it will be useful, | |
14 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | +# GNU General Public License for more details. | |
17 | +# | |
18 | +# You should have received a copy of the GNU General Public License | |
19 | +# along with this program; if not, write to the Free Software | |
20 | +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
21 | +# MA 02111-1307 USA | |
22 | +# | |
23 | + | |
24 | +include $(TOPDIR)/config.mk | |
25 | + | |
26 | +LIB = $(obj)lib$(BOARD).o | |
27 | + | |
28 | +COBJS := adp-ag102.o | |
29 | + | |
30 | +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) | |
31 | +OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) | |
32 | + | |
33 | +$(LIB): $(OBJS) | |
34 | + $(call cmd_link_o_target, $(OBJS)) | |
35 | + | |
36 | +######################################################################### | |
37 | + | |
38 | +# defines $(obj).depend target | |
39 | +include $(SRCTREE)/rules.mk | |
40 | + | |
41 | +sinclude $(obj).depend | |
42 | + | |
43 | +######################################################################### |
board/AndesTech/adp-ag102/adp-ag102.c
1 | +/* | |
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 | + | |
28 | +#include <faraday/ftsdc010.h> | |
29 | +#ifdef CONFIG_FTSMC020 | |
30 | +#include <faraday/ftsmc020.h> | |
31 | +#endif | |
32 | + | |
33 | +DECLARE_GLOBAL_DATA_PTR; | |
34 | + | |
35 | +/* | |
36 | + * Miscellaneous platform dependent initializations | |
37 | + */ | |
38 | + | |
39 | +int board_init(void) | |
40 | +{ | |
41 | + /* | |
42 | + * refer to BOOT_PARAMETER_PA_BASE within | |
43 | + * "linux/arch/nds32/include/asm/misc_spec.h" | |
44 | + */ | |
45 | + gd->bd->bi_arch_number = MACH_TYPE_ADPAG102; | |
46 | + gd->bd->bi_boot_params = PHYS_SDRAM_0 + 0x400; | |
47 | + | |
48 | +#if !defined(CONFIG_SYS_NO_FLASH) | |
49 | + ftsmc020_init(); /* initialize Flash */ | |
50 | +#endif /* CONFIG_SYS_NO_FLASH */ | |
51 | + return 0; | |
52 | +} | |
53 | + | |
54 | +int dram_init(void) | |
55 | +{ | |
56 | + unsigned long sdram_base = PHYS_SDRAM_0; | |
57 | + unsigned long expected_size = PHYS_SDRAM_0_SIZE; | |
58 | + unsigned long actual_size; | |
59 | + | |
60 | + actual_size = get_ram_size((void *)sdram_base, expected_size); | |
61 | + | |
62 | + gd->ram_size = actual_size; | |
63 | + | |
64 | + if (expected_size != actual_size) { | |
65 | + printf("Warning: Only %lu of %lu MiB SDRAM is working\n", | |
66 | + actual_size >> 20, expected_size >> 20); | |
67 | + } | |
68 | + | |
69 | + return 0; | |
70 | +} | |
71 | + | |
72 | +int board_eth_init(bd_t *bd) | |
73 | +{ | |
74 | + return ftgmac100_initialize(bd); | |
75 | +} | |
76 | + | |
77 | +#if !defined(CONFIG_SYS_NO_FLASH) | |
78 | +ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info) | |
79 | +{ | |
80 | + if (banknum == 0) { /* non-CFI boot flash */ | |
81 | + info->portwidth = FLASH_CFI_8BIT; | |
82 | + info->chipwidth = FLASH_CFI_BY8; | |
83 | + info->interface = FLASH_CFI_X8; | |
84 | + return 1; | |
85 | + } else { | |
86 | + return 0; | |
87 | + } | |
88 | +} | |
89 | +#endif /* CONFIG_SYS_NO_FLASH */ | |
90 | + | |
91 | +#if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI) | |
92 | +void pci_init_board(void) | |
93 | +{ | |
94 | + /* should be pci_ftpci100_init() */ | |
95 | + extern void pci_ftpci_init(); | |
96 | + | |
97 | + pci_ftpci_init(); | |
98 | +} | |
99 | +#endif | |
100 | + | |
101 | +#ifdef CONFIG_GENERIC_MMC | |
102 | +int board_mmc_init(bd_t *bis) | |
103 | +{ | |
104 | + ftsdc010_mmc_init(0); | |
105 | + return 0; | |
106 | +} | |
107 | +#endif |