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