blob: 2578be4f92c469e6eef4ee5f86ed48580244c908 [file] [log] [blame]
Po-Yu Chuang43a5f0d2009-11-11 17:27:30 +08001/*
2 * (C) Copyright 2009 Faraday Technology
3 * Po-Yu Chuang <ratbert@faraday-tech.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#include <common.h>
21#include <netdev.h>
22#include <asm/io.h>
23
Macpaul Lin00d10eb2011-04-15 21:37:11 +000024#include <faraday/ftsmc020.h>
Po-Yu Chuang43a5f0d2009-11-11 17:27:30 +080025
26DECLARE_GLOBAL_DATA_PTR;
27
28/*
29 * Miscellaneous platform dependent initialisations
30 */
31
32int board_init(void)
33{
34 gd->bd->bi_arch_number = MACH_TYPE_FARADAY;
35 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
36
37 ftsmc020_init(); /* initialize Flash */
38 return 0;
39}
40
41int dram_init(void)
42{
43 unsigned long sdram_base = PHYS_SDRAM_1;
44 unsigned long expected_size = PHYS_SDRAM_1_SIZE;
45 unsigned long actual_size;
46
47 actual_size = get_ram_size((void *)sdram_base, expected_size);
48
Po-Yu Chuang5eb522a2010-12-19 23:07:23 +000049 gd->ram_size = actual_size;
Po-Yu Chuang43a5f0d2009-11-11 17:27:30 +080050
51 if (expected_size != actual_size)
52 printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
53 actual_size >> 20, expected_size >> 20);
54
55 return 0;
56}
57
58int board_eth_init(bd_t *bd)
59{
60 return ftmac100_initialize(bd);
61}
62
63ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
64{
65 if (banknum == 0) { /* non-CFI boot flash */
66 info->portwidth = FLASH_CFI_8BIT;
67 info->chipwidth = FLASH_CFI_BY8;
68 info->interface = FLASH_CFI_X8;
69 return 1;
70 } else
71 return 0;
72}