blob: ab46415168f5cda26346562f9b4a75e52d03e4ee [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0 */
Ley Foon Tanb149f2b2017-04-26 02:44:36 +08002/*
Tien Fong Chee8ca17082021-11-07 23:08:55 +08003 * Copyright (C) 2016-2021 Intel Corporation
Tien Fong Chee3a07a2c2024-09-18 16:43:02 +08004 * Copyright (C) 2025 Altera Corporation <www.altera.com>
Ley Foon Tanb149f2b2017-04-26 02:44:36 +08005 */
6
Simon Goldschmidt52166712019-10-23 22:32:30 +02007#ifndef _SOCFPGA_MISC_H_
8#define _SOCFPGA_MISC_H_
Ley Foon Tanb149f2b2017-04-26 02:44:36 +08009
Simon Goldschmidtda13a0a2018-10-10 14:55:23 +020010#include <asm/sections.h>
11
Ley Foon Tanb149f2b2017-04-26 02:44:36 +080012void dwmac_deassert_reset(const unsigned int of_reset_id, const u32 phymode);
13
14struct bsel {
15 const char *mode;
16 const char *name;
17};
18
19extern struct bsel bsel_str[];
20
21#ifdef CONFIG_FPGA
Ang, Chee Hongff14f162018-12-19 18:35:15 -080022void socfpga_fpga_add(void *fpga_desc);
Ley Foon Tanb149f2b2017-04-26 02:44:36 +080023#else
Tom Riniea84ae62020-05-14 08:30:05 -040024static inline void socfpga_fpga_add(void *fpga_desc) {}
Ley Foon Tanb149f2b2017-04-26 02:44:36 +080025#endif
26
Simon Goldschmidt8e302032018-08-13 21:34:35 +020027#ifdef CONFIG_TARGET_SOCFPGA_GEN5
28void socfpga_sdram_remap_zero(void);
Simon Goldschmidtda13a0a2018-10-10 14:55:23 +020029static inline bool socfpga_is_booting_from_fpga(void)
30{
31 if ((__image_copy_start >= (char *)SOCFPGA_FPGA_SLAVES_ADDRESS) &&
32 (__image_copy_start < (char *)SOCFPGA_STM_ADDRESS))
33 return true;
34 return false;
35}
Simon Goldschmidt8e302032018-08-13 21:34:35 +020036#endif
37
Marek Vasut8fdb4192018-08-18 19:11:52 +020038#ifdef CONFIG_TARGET_SOCFPGA_ARRIA10
39void socfpga_init_security_policies(void);
40void socfpga_sdram_remap_zero(void);
41#endif
42
Chee Hong Ang61e91992020-08-06 11:56:29 +080043#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10) || \
44 defined(CONFIG_TARGET_SOCFPGA_AGILEX)
45int is_fpga_config_ready(void);
46#endif
47
Marek Vasut713a8a22019-04-16 22:28:08 +020048void do_bridge_reset(int enable, unsigned int mask);
Tien Fong Cheeadc079f2021-11-07 23:08:56 +080049void force_periph_program(unsigned int status);
Tien Fong Chee8ca17082021-11-07 23:08:55 +080050bool is_regular_boot_valid(void);
Tien Fong Cheeadc079f2021-11-07 23:08:56 +080051bool is_periph_program_force(void);
Tien Fong Chee8ca17082021-11-07 23:08:55 +080052void set_regular_boot(unsigned int status);
Marek Vasutb6ba4902019-03-21 23:05:38 +010053void socfpga_pl310_clear(void);
Ley Foon Tanfed4c952019-11-08 10:38:19 +080054void socfpga_get_managers_addr(void);
Tien Fong Chee3a07a2c2024-09-18 16:43:02 +080055void socfpga_get_sys_mgr_addr(const char *compat);
Tien Fong Chee8ca17082021-11-07 23:08:55 +080056int qspi_flash_software_reset(void);
Ley Foon Tan4cc6b582018-05-24 00:17:23 +080057
Simon Goldschmidt52166712019-10-23 22:32:30 +020058#endif /* _SOCFPGA_MISC_H_ */