Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Altera Corporation <www.altera.com> |
| 3 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <asm/io.h> |
Pavel Machek | ce340e9 | 2014-07-14 14:14:17 +0200 | [diff] [blame] | 9 | #include <miiphy.h> |
| 10 | #include <netdev.h> |
Pavel Machek | 56a00ab | 2014-09-09 14:03:28 +0200 | [diff] [blame^] | 11 | #include <asm/arch/reset_manager.h> |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 12 | |
| 13 | DECLARE_GLOBAL_DATA_PTR; |
| 14 | |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 15 | int dram_init(void) |
| 16 | { |
| 17 | gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE); |
| 18 | return 0; |
| 19 | } |
Chin Liang See | bff262c | 2014-06-10 02:23:45 -0500 | [diff] [blame] | 20 | |
| 21 | #if defined(CONFIG_DISPLAY_CPUINFO) |
| 22 | /* |
| 23 | * Print CPU information |
| 24 | */ |
| 25 | int print_cpuinfo(void) |
| 26 | { |
| 27 | puts("CPU : Altera SOCFPGA Platform\n"); |
| 28 | return 0; |
| 29 | } |
| 30 | #endif |
| 31 | |
| 32 | #if defined(CONFIG_SYS_CONSOLE_IS_IN_ENV) && \ |
| 33 | defined(CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE) |
| 34 | int overwrite_console(void) |
| 35 | { |
| 36 | return 0; |
| 37 | } |
| 38 | #endif |
| 39 | |
Pavel Machek | 56a00ab | 2014-09-09 14:03:28 +0200 | [diff] [blame^] | 40 | int arch_cpu_init(void) |
| 41 | { |
| 42 | /* |
| 43 | * If the HW watchdog is NOT enabled, make sure it is not running, |
| 44 | * for example because it was enabled in the preloader. This might |
| 45 | * trigger a watchdog-triggered reboot of Linux kernel later. |
| 46 | */ |
| 47 | #ifndef CONFIG_HW_WATCHDOG |
| 48 | socfpga_watchdog_reset(); |
| 49 | #endif |
| 50 | return 0; |
| 51 | } |
| 52 | |
Chin Liang See | bff262c | 2014-06-10 02:23:45 -0500 | [diff] [blame] | 53 | int misc_init_r(void) |
| 54 | { |
| 55 | return 0; |
| 56 | } |
Pavel Machek | ce340e9 | 2014-07-14 14:14:17 +0200 | [diff] [blame] | 57 | |
| 58 | |
| 59 | /* |
| 60 | * DesignWare Ethernet initialization |
| 61 | */ |
| 62 | int cpu_eth_init(bd_t *bis) |
| 63 | { |
| 64 | #if !defined(CONFIG_SOCFPGA_VIRTUAL_TARGET) && !defined(CONFIG_SPL_BUILD) |
| 65 | /* initialize and register the emac */ |
| 66 | return designware_initialize(CONFIG_EMAC_BASE, |
| 67 | CONFIG_PHY_INTERFACE_MODE); |
| 68 | #else |
| 69 | return 0; |
| 70 | #endif |
| 71 | } |