blob: a19602039397016d53e7f467b95e8422a95a5123 [file] [log] [blame]
Siew Chin Lim7f0b45b2021-08-10 11:26:38 +08001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2020-2021 Intel Corporation <www.intel.com>
4 *
5 */
6
Siew Chin Lim7f0b45b2021-08-10 11:26:38 +08007#include <asm/arch/clock_manager.h>
8#include <asm/arch/firewall.h>
9#include <asm/arch/mailbox_s10.h>
10#include <asm/arch/misc.h>
11#include <asm/arch/reset_manager.h>
12#include <asm/arch/system_manager.h>
13#include <asm/global_data.h>
14#include <asm/io.h>
15#include <asm/u-boot.h>
16#include <asm/utils.h>
17#include <dm/uclass.h>
18#include <hang.h>
19#include <image.h>
20#include <init.h>
21#include <spl.h>
22#include <watchdog.h>
23
24DECLARE_GLOBAL_DATA_PTR;
25
26void board_init_f(ulong dummy)
27{
28 int ret;
29 struct udevice *dev;
30
31 ret = spl_early_init();
32 if (ret)
33 hang();
34
35 socfpga_get_managers_addr();
36
37 /* Ensure watchdog is paused when debugging is happening */
38 writel(SYSMGR_WDDBG_PAUSE_ALL_CPU,
39 socfpga_get_sysmgr_addr() + SYSMGR_SOC64_WDDBG);
40
41#ifdef CONFIG_HW_WATCHDOG
42 /* Enable watchdog before initializing the HW */
43 socfpga_per_reset(SOCFPGA_RESET(L4WD0), 1);
44 socfpga_per_reset(SOCFPGA_RESET(L4WD0), 0);
45 hw_watchdog_init();
46#endif
47
48 /* ensure all processors are not released prior Linux boot */
49 writeq(0, CPU_RELEASE_ADDR);
50
51 timer_init();
52
53 sysmgr_pinmux_init();
54
55 preloader_console_init();
56
57 ret = uclass_get_device(UCLASS_CLK, 0, &dev);
58 if (ret) {
59 printf("Clock init failed: %d\n", ret);
60 hang();
61 }
62
63 ret = uclass_get_device(UCLASS_CLK, 1, &dev);
64 if (ret) {
65 printf("Memory clock init failed: %d\n", ret);
66 hang();
67 }
68
69 print_reset_info();
70 cm_print_clock_quick_summary();
71
72 firewall_setup();
73
74 ret = uclass_get_device(UCLASS_CACHE, 0, &dev);
75 if (ret) {
76 printf("CCU init failed: %d\n", ret);
77 hang();
78 }
79
80#if CONFIG_IS_ENABLED(ALTERA_SDRAM)
81 ret = uclass_get_device(UCLASS_RAM, 0, &dev);
82 if (ret) {
83 printf("DRAM init failed: %d\n", ret);
84 hang();
85 }
86#endif
87
88 mbox_init();
89
90#ifdef CONFIG_CADENCE_QSPI
91 mbox_qspi_open();
92#endif
93}