blob: b633615208f683ee32c85cf4f7f0f68dd58a192a [file] [log] [blame]
Dinh Nguyen77754402012-10-04 06:46:02 +00001/*
2 * Copyright (C) 2012 Altera Corporation <www.altera.com>
3 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Dinh Nguyen77754402012-10-04 06:46:02 +00005 */
6
7#include <common.h>
8#include <asm/io.h>
Pavel Machek99b97102014-07-14 14:14:17 +02009#include <miiphy.h>
10#include <netdev.h>
Pavel Machekde6da922014-09-09 14:03:28 +020011#include <asm/arch/reset_manager.h>
Dinh Nguyen77754402012-10-04 06:46:02 +000012
13DECLARE_GLOBAL_DATA_PTR;
14
Dinh Nguyen77754402012-10-04 06:46:02 +000015int 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 See23f23f22014-06-10 02:23:45 -050020
21#if defined(CONFIG_DISPLAY_CPUINFO)
22/*
23 * Print CPU information
24 */
25int 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) && \
33defined(CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE)
34int overwrite_console(void)
35{
36 return 0;
37}
38#endif
39
Pavel Machekde6da922014-09-09 14:03:28 +020040int 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 See23f23f22014-06-10 02:23:45 -050053int misc_init_r(void)
54{
55 return 0;
56}
Pavel Machek99b97102014-07-14 14:14:17 +020057
58
59/*
60 * DesignWare Ethernet initialization
61 */
62int 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}