Po-Yu Chuang | 5614a4d | 2009-11-11 17:27:30 +0800 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2009 Faraday Technology |
| 3 | * Po-Yu Chuang <ratbert@faraday-tech.com> |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Po-Yu Chuang | 5614a4d | 2009-11-11 17:27:30 +0800 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <netdev.h> |
| 10 | #include <asm/io.h> |
| 11 | |
Macpaul Lin | d204d62 | 2011-04-15 21:37:11 +0000 | [diff] [blame] | 12 | #include <faraday/ftsmc020.h> |
Po-Yu Chuang | 5614a4d | 2009-11-11 17:27:30 +0800 | [diff] [blame] | 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
| 15 | |
| 16 | /* |
| 17 | * Miscellaneous platform dependent initialisations |
| 18 | */ |
| 19 | |
| 20 | int board_init(void) |
| 21 | { |
Po-Yu Chuang | 5614a4d | 2009-11-11 17:27:30 +0800 | [diff] [blame] | 22 | gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; |
| 23 | |
| 24 | ftsmc020_init(); /* initialize Flash */ |
| 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | int dram_init(void) |
| 29 | { |
| 30 | unsigned long sdram_base = PHYS_SDRAM_1; |
| 31 | unsigned long expected_size = PHYS_SDRAM_1_SIZE; |
| 32 | unsigned long actual_size; |
| 33 | |
| 34 | actual_size = get_ram_size((void *)sdram_base, expected_size); |
| 35 | |
Po-Yu Chuang | c78522a | 2010-12-19 23:07:23 +0000 | [diff] [blame] | 36 | gd->ram_size = actual_size; |
Po-Yu Chuang | 5614a4d | 2009-11-11 17:27:30 +0800 | [diff] [blame] | 37 | |
| 38 | if (expected_size != actual_size) |
| 39 | printf("Warning: Only %lu of %lu MiB SDRAM is working\n", |
| 40 | actual_size >> 20, expected_size >> 20); |
| 41 | |
| 42 | return 0; |
| 43 | } |
| 44 | |
| 45 | int board_eth_init(bd_t *bd) |
| 46 | { |
| 47 | return ftmac100_initialize(bd); |
| 48 | } |
| 49 | |
| 50 | ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info) |
| 51 | { |
| 52 | if (banknum == 0) { /* non-CFI boot flash */ |
| 53 | info->portwidth = FLASH_CFI_8BIT; |
| 54 | info->chipwidth = FLASH_CFI_BY8; |
| 55 | info->interface = FLASH_CFI_X8; |
| 56 | return 1; |
| 57 | } else |
| 58 | return 0; |
| 59 | } |